diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bb64f856..a3903a835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - File viewer in chats (Image/Animated Image/Video/Texts) with the option to export the file. - Accept/decline CLI commands. -## 5.0.12 - 2023-02-28 +## 5.0.12 - 2023-03-01 ## Fixed +- Some case of unwanted settings folders creation. +- Replace black thumbnails that contains transparency by white color. - Unusable Contact sheet. -- Update SDK to 5.2.28 (cleanup orphan NAT sections and race condition on MSTicker threads) +- Update SDK to 5.2.28 (cleanup orphan NAT sections and race condition on MSTicker threads). ## 5.0.11 - 2023-02-24 diff --git a/linphone-app/src/components/content/ContentModel.cpp b/linphone-app/src/components/content/ContentModel.cpp index 1e16ee65b..dd07c0b1c 100644 --- a/linphone-app/src/components/content/ContentModel.cpp +++ b/linphone-app/src/components/content/ContentModel.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "app/App.hpp" #include "app/paths/Paths.hpp" @@ -163,20 +164,26 @@ void ContentModel::createThumbnail (const bool& force) { if(!appdata.mData.contains(path) || !QFileInfo(QString::fromStdString(Paths::getThumbnailsDirPath())+appdata.mData[path]).isFile()){ // File don't exist. Create the thumbnail + QImage originalImage(path); - QImage image(path); - if( image.isNull()){// Try to determine format from headers + if( originalImage.isNull()){// Try to determine format from headers QImageReader reader(path); reader.setDecideFormatFromContent(true); QByteArray format = reader.format(); if(!format.isEmpty()) - image = QImage(path, format); + originalImage = QImage(path, format); } - if (!image.isNull()){ + if (!originalImage.isNull()){ int rotation = 0; QExifImageHeader exifImageHeader; if (exifImageHeader.loadFromJpeg(path)) rotation = int(exifImageHeader.value(QExifImageHeader::ImageTag::Orientation).toShort()); +// Fill with color to replace transparency with white color instead of black (default). + QImage image(originalImage.size(), originalImage.format()); + image.fill(QColor(Qt::white).rgb()); + QPainter painter(&image); + painter.drawImage(0, 0, originalImage); +//-------------------- QImage thumbnail = image.scaled( Constants::ThumbnailImageFileWidth, Constants::ThumbnailImageFileHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation diff --git a/linphone-app/src/components/recorder/RecorderModel.cpp b/linphone-app/src/components/recorder/RecorderModel.cpp index 955875022..78f10e01a 100644 --- a/linphone-app/src/components/recorder/RecorderModel.cpp +++ b/linphone-app/src/components/recorder/RecorderModel.cpp @@ -87,7 +87,7 @@ void RecorderModel::start(){ .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm-ss-zzz")); const QString safeFilePath = Utils::getSafeFilePath( QStringLiteral("%1%2") - .arg(Utils::coreStringToAppString(Paths::getCapturesDirPath())) + .arg(CoreManager::getInstance()->getSettingsModel()->getSavedCallsFolder()) .arg(filename), &soFarSoGood ); diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 1404eae33..a2b76be29 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -1436,11 +1436,10 @@ void SettingsModel::setTextMessageFontSize(const int& size){ } QString SettingsModel::getSavedScreenshotsFolder () const { - return QDir::cleanPath( - Utils::coreStringToAppString( - mConfig->getString(UiSection, "saved_screenshots_folder", Paths::getCapturesDirPath()) - ) - ) + QDir::separator(); + auto path = mConfig->getString(UiSection, "saved_screenshots_folder", ""); + if(path == "") + path = Paths::getCapturesDirPath(); + return QDir::cleanPath(Utils::coreStringToAppString(path)) + QDir::separator(); } void SettingsModel::setSavedScreenshotsFolder (const QString &folder) { @@ -1452,15 +1451,17 @@ void SettingsModel::setSavedScreenshotsFolder (const QString &folder) { // ----------------------------------------------------------------------------- static inline string getLegacySavedCallsFolder (const shared_ptr &config) { - return config->getString(SettingsModel::UiSection, "saved_videos_folder", Paths::getCapturesDirPath()); + auto path = config->getString(SettingsModel::UiSection, "saved_videos_folder", ""); + if(path == "")// Avoid to call default function if exist because calling Path:: will create a folder to be writable. + path = Paths::getCapturesDirPath(); + return path; } QString SettingsModel::getSavedCallsFolder () const { - return QDir::cleanPath( - Utils::coreStringToAppString( - mConfig->getString(UiSection, "saved_calls_folder", getLegacySavedCallsFolder(mConfig)) - ) - ) + QDir::separator(); + auto path = mConfig->getString(UiSection, "saved_calls_folder", "");// Avoid to call default function if exist. + if(path == "") + path = getLegacySavedCallsFolder(mConfig); + return QDir::cleanPath(Utils::coreStringToAppString(path)) + QDir::separator(); } void SettingsModel::setSavedCallsFolder (const QString &folder) { @@ -1472,11 +1473,10 @@ void SettingsModel::setSavedCallsFolder (const QString &folder) { // ----------------------------------------------------------------------------- QString SettingsModel::getDownloadFolder () const { - return QDir::cleanPath( - Utils::coreStringToAppString( - mConfig->getString(UiSection, "download_folder", Paths::getDownloadDirPath()) - ) - ) + QDir::separator(); + auto path = mConfig->getString(UiSection, "download_folder", "");// Avoid to call default function if exist because calling Path:: will create a folder to be writable. + if(path == "" ) + path = Paths::getDownloadDirPath(); + return QDir::cleanPath(Utils::coreStringToAppString(path)) + QDir::separator(); } void SettingsModel::setDownloadFolder (const QString &folder) {