From 809abc653b68a26fa6aa7ed723b734be81680cbf Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Tue, 2 Nov 2021 14:59:42 +0100 Subject: [PATCH] - Add Vendor and copyright ranges - Color customization on tray event count - Allow the use of a custom URL for remote provisioning(first stage dev) - Fix assistant to come back to home if no more items - Update icon generation to inkscape 1.1 --- linphone-app/CMakeLists.txt | 8 +- linphone-app/application_info.cmake | 2 + linphone-app/assets/icons/genicons_1.1.sh | 27 +++ .../linphone_package/macos/Info.plist.in | 4 +- .../windows/appDetailsWindows.rc.in | 2 +- linphone-app/src/app/App.cpp | 9 +- .../EventCountNotifierSystemTrayIcon.cpp | 7 +- .../other/colors/ColorListModel.cpp | 17 +- .../src/components/settings/SettingsModel.cpp | 11 +- linphone-app/src/config.h.cmake | 2 + linphone-app/src/utils/Constants.cpp | 2 +- linphone-app/src/utils/Constants.hpp | 7 +- linphone-app/ui/views/App/Main/Assistant.qml | 6 +- linphone-app/ui/views/App/Main/ContactEdit.js | 5 +- .../ui/views/App/Main/Dialogs/About.qml | 189 +++++++++--------- 15 files changed, 180 insertions(+), 118 deletions(-) create mode 100755 linphone-app/assets/icons/genicons_1.1.sh diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index 499fe4983..de7f917f6 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -55,6 +55,12 @@ list(APPEND CMAKE_MODULE_PATH "${LINPHONE_OUTPUT_DIR}/cmake") set(APP_LIBRARY app-library) set(APP_PLUGIN app-plugin) include(application_info.cmake) +string(TIMESTAMP CURRENT_YEAR "%Y") +if( "${CURRENT_YEAR}" STREQUAL "${APPLICATION_START_LICENCE}") + set(COPYRIGHT_RANGE_DATE "${APPLICATION_START_LICENCE}") +else() + set(COPYRIGHT_RANGE_DATE "${APPLICATION_START_LICENCE}-${CURRENT_YEAR}") +endif() if(WIN32) set(EXECUTABLE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") @@ -467,8 +473,6 @@ list(APPEND SOURCES ${TS_FILES}) # set application details if(WIN32) - string(TIMESTAMP CURRENT_YEAR "%Y") - set(COPYRIGTH_RANGE_DATE "2010-${CURRENT_YEAR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/appDetailsWindows.rc") set(RC_FILE ${CMAKE_CURRENT_BINARY_DIR}/appDetailsWindows.rc) endif() diff --git a/linphone-app/application_info.cmake b/linphone-app/application_info.cmake index 9d7375c39..9281a0838 100644 --- a/linphone-app/application_info.cmake +++ b/linphone-app/application_info.cmake @@ -3,5 +3,7 @@ set(APPLICATION_ID "com.belledonnecommunications.linphone") set(APPLICATION_NAME Linphone) set(APPLICATION_URL "https://www.linphone.org") set(APPLICATION_VENDOR "Belledonne Communications") +set(APPLICATION_LICENCE "GNU General Public License V3") +set(APPLICATION_START_LICENCE "2010") set(EXECUTABLE_NAME linphone) diff --git a/linphone-app/assets/icons/genicons_1.1.sh b/linphone-app/assets/icons/genicons_1.1.sh new file mode 100755 index 000000000..19982c5e0 --- /dev/null +++ b/linphone-app/assets/icons/genicons_1.1.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +## +## Copyright (c) 2010-2020 Belledonne Communications SARL. +## +## This file is part of linphone-desktop +## (see https://www.linphone.org). +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . +## + +for i in 16 22 24 32 64 128 256 +do + mkdir -p hicolor/${i}x${i}/apps + inkscape -z --export-type=png --export-filename=hicolor/${i}x${i}/apps/icon.png -w $i -h $i ../images/linphone_logo.svg +done +convert hicolor/16x16/apps/icon.png hicolor/22x22/apps/icon.png hicolor/24x24/apps/icon.png hicolor/32x32/apps/icon.png hicolor/64x64/apps/icon.png hicolor/128x128/apps/icon.png hicolor/256x256/apps/icon.png -colors 256 ../icon.ico diff --git a/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in b/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in index 4d9277691..464c91eab 100644 --- a/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in +++ b/linphone-app/cmake_builder/linphone_package/macos/Info.plist.in @@ -11,7 +11,7 @@ CFBundleExecutable @EXECUTABLE_NAME@ CFBundleGetInfoString - @PACKAGE_VERSION@, (C) 2011-2020 @APPLICATION_NAME@ @APPLICATION_URL@ + @PACKAGE_VERSION@, (C) @COPYRIGHT_RANGE_DATE@ @APPLICATION_NAME@ @APPLICATION_URL@ CFBundleIconFile @EXECUTABLE_NAME@.icns CFBundleIdentifier @@ -27,7 +27,7 @@ CFBundleVersion @PACKAGE_VERSION@ NSHumanReadableCopyright - Copyright 2011-2020 @APPLICATION_VENDOR@ + Copyright @COPYRIGHT_RANGE_DATE@ @APPLICATION_VENDOR@ LSMinimumSystemVersion @CMAKE_OSX_DEPLOYMENT_TARGET@ NSAppSleepDisabled diff --git a/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in b/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in index 1324ece2e..94fa1b416 100644 --- a/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in +++ b/linphone-app/cmake_builder/linphone_package/windows/appDetailsWindows.rc.in @@ -27,7 +27,7 @@ VS_VERSION_INFO VERSIONINFO VALUE "FileDescription", "${APPLICATION_NAME} - ${APPLICATION_DESCRIPTION}\0" VALUE "FileVersion", "${FULL_VERSION}" VALUE "ProductVersion", "${version_major}.${version_minor}.${version_patch}\0" - VALUE "LegalCopyright", "Copyright (C) ${COPYRIGTH_RANGE_DATE} ${APPLICATION_VENDOR} ${APPLICATION_URL}\0" + VALUE "LegalCopyright", "Copyright (C) ${COPYRIGHT_RANGE_DATE} ${APPLICATION_VENDOR} ${APPLICATION_URL}\0" VALUE "OriginalFilename", "${EXECUTABLE_NAME}.exe\0" VALUE "ProductName", "${APPLICATION_NAME}\0" END diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index a926203ea..69a0e4cff 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -373,6 +373,13 @@ void App::initContentApp () { mEngine->addImageProvider(ThumbnailProvider::ProviderId, new ThumbnailProvider()); mEngine->rootContext()->setContextProperty("applicationUrl", APPLICATION_URL); + mEngine->rootContext()->setContextProperty("applicationVendor", APPLICATION_VENDOR); +#ifdef APPLICATION_LICENCE + mEngine->rootContext()->setContextProperty("applicationLicence", APPLICATION_LICENCE); +#else + mEngine->rootContext()->setContextProperty("applicationLicence", ""); +#endif + mEngine->rootContext()->setContextProperty("copyrightRangeDate", COPYRIGHT_RANGE_DATE); mEngine->rootContext()->setContextProperty("Colors", mColorListModel->getQmlData()); mEngine->rootContext()->setContextProperty("Images", mImageListModel->getQmlData()); @@ -736,8 +743,6 @@ void App::setTrayIcon () { menu->addSeparator(); menu->addAction(quitAction); - - systemTrayIcon->setContextMenu(menu); systemTrayIcon->setIcon(QIcon(Constants::WindowIconPath)); systemTrayIcon->setToolTip(APPLICATION_NAME); diff --git a/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp b/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp index 97135d07d..ccc6e73c8 100644 --- a/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp +++ b/linphone-app/src/components/core/event-count-notifier/EventCountNotifierSystemTrayIcon.cpp @@ -28,6 +28,7 @@ #include "app/App.hpp" #include "utils/Utils.hpp" #include "utils/Constants.hpp" +#include "components/other/colors/ColorListModel.hpp" #include "EventCountNotifierSystemTrayIcon.hpp" @@ -37,10 +38,8 @@ namespace { constexpr int IconWidth = 256; constexpr int IconHeight = 256; - constexpr char IconCounterBackgroundColor[] = "#FF3C31"; constexpr int IconCounterBackgroundRadius = 100; constexpr int IconCounterBlinkInterval = 1000; - constexpr char IconCounterTextColor[] = "#FFFBFA"; constexpr int IconCounterTextPixelSize = 144; } @@ -92,7 +91,7 @@ void EventCountNotifier::notifyEventCount (int n) { // Draw background. { - p.setBrush(QColor(IconCounterBackgroundColor)); + p.setBrush(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_bg", Constants::WindowIconPath,"b")->getColor()); p.drawEllipse(QPointF(width / 2, height / 2), IconCounterBackgroundRadius, IconCounterBackgroundRadius); } @@ -102,7 +101,7 @@ void EventCountNotifier::notifyEventCount (int n) { font.setPixelSize(IconCounterTextPixelSize); p.setFont(font); - p.setPen(QPen(QColor(IconCounterTextColor), 1)); + p.setPen(QPen(App::getInstance()->getColorListModel()->addImageColor("Logo_tray_blink_fg", Constants::WindowIconPath,"ai")->getColor(), 1)); p.drawText(QRect(0, 0, width, height), Qt::AlignCenter, QString::number(n)); } diff --git a/linphone-app/src/components/other/colors/ColorListModel.cpp b/linphone-app/src/components/other/colors/ColorListModel.cpp index 1e8f7ea9f..053eedf4c 100644 --- a/linphone-app/src/components/other/colors/ColorListModel.cpp +++ b/linphone-app/src/components/other/colors/ColorListModel.cpp @@ -322,7 +322,22 @@ void ColorListModel::handleUiColorChanged(const QString& id, const QColor& color } //-------------------------------------------------------------------------------- - +/* Snippet for having 2 custom colors +QPixmap ColorListModel::getLogoIcon(){ +// Icon colors + QPixmap foregroundPixmap = QPixmap(Constants::WindowIconPath); + QPixmap backgroundPixmap = QPixmap(Constants::WindowIconPath); + QBitmap inMask = backgroundPixmap.createMaskFromColor(QColor("black"), Qt::MaskInColor); + QBitmap outMask = backgroundPixmap.createMaskFromColor(QColor("black"), Qt::MaskOutColor); + backgroundPixmap.fill(App::getInstance()->getColorListModel()->addImageColor("Logo_bg", Constants::WindowIconPath, "i")->getColor()); + backgroundPixmap.setMask(inMask); + foregroundPixmap.fill(App::getInstance()->getColorListModel()->addImageColor("Logo_fg", Constants::WindowIconPath, "ai")->getColor()); + foregroundPixmap.setMask(outMask); + QPainter painter(&backgroundPixmap); + painter.drawPixmap(0,backgroundPixmap.height()-foregroundPixmap.height(),foregroundPixmap); + + return backgroundPixmap; +}*/ /* std::shared_ptr ColorListModel::getImdnState(const std::shared_ptr & state){ diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 21943cc62..6289e7e80 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -1238,10 +1238,15 @@ QString SettingsModel::getRemoteProvisioning () const { } void SettingsModel::setRemoteProvisioning (const QString &remoteProvisioning) { - if (!CoreManager::getInstance()->getCore()->setProvisioningUri(Utils::appStringToCoreString(remoteProvisioning))) - emit remoteProvisioningChanged(remoteProvisioning); + QString urlRemoteProvisioning = remoteProvisioning; + QUrl url(urlRemoteProvisioning); + if( !url.isValid()) { + urlRemoteProvisioning = QString(Constants::RemoteProvisioningURL) +"/"+ remoteProvisioning; + } + if (!CoreManager::getInstance()->getCore()->setProvisioningUri(Utils::appStringToCoreString(urlRemoteProvisioning))) + emit remoteProvisioningChanged(urlRemoteProvisioning); else - emit remoteProvisioningNotChanged(remoteProvisioning); + emit remoteProvisioningNotChanged(urlRemoteProvisioning); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/config.h.cmake b/linphone-app/src/config.h.cmake index 093539e08..92bc19c6c 100644 --- a/linphone-app/src/config.h.cmake +++ b/linphone-app/src/config.h.cmake @@ -28,3 +28,5 @@ #cmakedefine ENABLE_UPDATE_CHECK 1 #cmakedefine EXECUTABLE_NAME "${EXECUTABLE_NAME}" #cmakedefine MSPLUGINS_DIR "${MSPLUGINS_DIR}" +#cmakedefine APPLICATION_LICENCE "${APPLICATION_LICENCE}" +#cmakedefine COPYRIGHT_RANGE_DATE "${COPYRIGHT_RANGE_DATE}" \ No newline at end of file diff --git a/linphone-app/src/utils/Constants.cpp b/linphone-app/src/utils/Constants.cpp index 21aaeb47d..4a8491dc4 100644 --- a/linphone-app/src/utils/Constants.cpp +++ b/linphone-app/src/utils/Constants.cpp @@ -62,7 +62,7 @@ constexpr qint64 Constants::FileSizeLimit; constexpr char Constants::DefaultXmlrpcUri[]; constexpr char Constants::DefaultConferenceURI[]; constexpr char Constants::DefaultLimeServerURL[]; - +constexpr char Constants::RemoteProvisioningURL[]; #if defined(Q_OS_LINUX) || defined(Q_OS_WIN) constexpr char Constants::H264Description[]; diff --git a/linphone-app/src/utils/Constants.hpp b/linphone-app/src/utils/Constants.hpp index b9310f455..a256bac92 100644 --- a/linphone-app/src/utils/Constants.hpp +++ b/linphone-app/src/utils/Constants.hpp @@ -39,7 +39,7 @@ public: static constexpr char WindowIconPath[] = ":/assets/images/linphone_logo.svg"; static constexpr char DefaultLocale[] = "en"; - static constexpr char ApplicationMinimalQtVersion[] = "5.9.0"; + static constexpr char ApplicationMinimalQtVersion[] = "5.10.0"; static constexpr char DefaultFont[] = "Noto Sans"; static constexpr size_t MaxLogsCollectionSize = 10485760; // 10MB. @@ -56,7 +56,6 @@ public: static constexpr int DefaultExpires = 3600; static constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone"; static constexpr char PasswordRecoveryUrl[] = "https://subscribe.linphone.org/login"; - Q_PROPERTY(QString PasswordRecoveryUrl MEMBER PasswordRecoveryUrl CONSTANT) static constexpr char LinphoneBZip2_exe[] = "http://www.linphone.org/releases/windows/tools/bzip2/bzip2.exe"; static constexpr char LinphoneBZip2_dll[] = "http://www.linphone.org/releases/windows/tools/bzip2/bzip2.dll"; @@ -64,7 +63,9 @@ public: static constexpr char DefaultLogsEmail[] = "linphone-desktop@belledonne-communications.com"; static constexpr char DefaultConferenceURI[] = "sip:conference-factory@sip.linphone.org"; static constexpr char DefaultLimeServerURL[] = "https://lime.linphone.org/lime-server/lime-server.php"; - + static constexpr char RemoteProvisioningURL[] = "https://subscribe.linphone.org/flexiapi/provisioning"; + + Q_PROPERTY(QString PasswordRecoveryUrl MEMBER PasswordRecoveryUrl CONSTANT) // Max image size in bytes. (100Kb) static constexpr qint64 MaxImageSize = 102400;// In Bytes. diff --git a/linphone-app/ui/views/App/Main/Assistant.qml b/linphone-app/ui/views/App/Main/Assistant.qml index 19c0983c0..2112b44de 100644 --- a/linphone-app/ui/views/App/Main/Assistant.qml +++ b/linphone-app/ui/views/App/Main/Assistant.qml @@ -28,7 +28,11 @@ Item { } function popView () { - stack.pop() + if( nViews <= 1 ) { + stack.pop() + window.setView('Home') + }else + stack.pop() } // --------------------------------------------------------------------------- diff --git a/linphone-app/ui/views/App/Main/ContactEdit.js b/linphone-app/ui/views/App/Main/ContactEdit.js index 96134f864..be4471a79 100644 --- a/linphone-app/ui/views/App/Main/ContactEdit.js +++ b/linphone-app/ui/views/App/Main/ContactEdit.js @@ -173,7 +173,7 @@ function handleUrlChanged () { // ----------------------------------------------------------------------------- function buildAddressFields () { -/* + var address = contactEdit._vcard.address return [{ @@ -189,8 +189,7 @@ function buildAddressFields () { placeholder: qsTr('country'), text: address.country }] - */ - return null + } function handleAddressChanged (index, value) { diff --git a/linphone-app/ui/views/App/Main/Dialogs/About.qml b/linphone-app/ui/views/App/Main/Dialogs/About.qml index 01967dd40..47b3e6b3a 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/About.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/About.qml @@ -9,99 +9,98 @@ import App.Styles 1.0 // ============================================================================= DialogPlus { - buttons: [ - TextButtonB { - text: qsTr('ok') - - onClicked: exit(0) - } - ] - - buttonsAlignment: Qt.AlignCenter - objectName: '__about' - - height: AboutStyle.height + 30 - width: AboutStyle.width - - Column { - anchors.fill: parent - spacing: AboutStyle.spacing - - RowLayout { - id:versionsLayout - spacing: AboutStyle.versionsBlock.spacing - - height: AboutStyle.versionsBlock.iconSize - width: parent.width - - Icon { - icon: 'linphone_logo' - iconSize: parent.height - } - - Column { - id:versionsArea - Layout.fillWidth: true - Layout.preferredHeight: parent.height - - spacing: 0 - - TextEdit { - id: appVersion - color: AboutStyle.versionsBlock.appVersion.color - selectByMouse: true - font.pointSize: AboutStyle.versionsBlock.appVersion.pointSize - text: 'Desktop ' + Qt.application.version + ' - Qt' + App.qtVersion +'\nCore ' + CoreManager.version - - height: parent.height - width: parent.width - - verticalAlignment: Text.AlignVCenter - - onActiveFocusChanged: deselect(); - } - } - } - - Column { - spacing: AboutStyle.copyrightBlock.spacing - width: parent.width - - Text { - elide: Text.ElideRight - font.pointSize: AboutStyle.copyrightBlock.url.pointSize - linkColor: AboutStyle.copyrightBlock.url.color - text: ''+applicationUrl+'' - - width: parent.width - - horizontalAlignment: Text.AlignHCenter - - onLinkActivated: Qt.openUrlExternally(link) - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton - cursorShape: parent.hoveredLink - ? Qt.PointingHandCursor - : Qt.IBeamCursor - } - } - - Text { - color: AboutStyle.copyrightBlock.license.color - elide: Text.ElideRight - font.pointSize: AboutStyle.copyrightBlock.license.pointSize - - text: 'GNU General Public License V3\n\u00A9 2010-' + - (new Date().toLocaleDateString(Qt.locale(), 'yyyy')) + - ' Belledonne Communications' - - width: parent.width - - horizontalAlignment: Text.AlignHCenter - } - } - } - + buttons: [ + TextButtonB { + text: qsTr('ok') + + onClicked: exit(0) + } + ] + + buttonsAlignment: Qt.AlignCenter + objectName: '__about' + + height: AboutStyle.height + 30 + width: AboutStyle.width + + Column { + anchors.fill: parent + spacing: AboutStyle.spacing + + RowLayout { + id:versionsLayout + spacing: AboutStyle.versionsBlock.spacing + + height: AboutStyle.versionsBlock.iconSize + width: parent.width + + Icon { + icon: 'linphone_logo' + iconSize: parent.height + } + + Column { + id:versionsArea + Layout.fillWidth: true + Layout.preferredHeight: parent.height + + spacing: 0 + + TextEdit { + id: appVersion + color: AboutStyle.versionsBlock.appVersion.color + selectByMouse: true + font.pointSize: AboutStyle.versionsBlock.appVersion.pointSize + text: 'Desktop ' + Qt.application.version + ' - Qt' + App.qtVersion +'\nCore ' + CoreManager.version + + height: parent.height + width: parent.width + + verticalAlignment: Text.AlignVCenter + + onActiveFocusChanged: deselect(); + } + } + } + + Column { + spacing: AboutStyle.copyrightBlock.spacing + width: parent.width + + Text { + elide: Text.ElideRight + font.pointSize: AboutStyle.copyrightBlock.url.pointSize + linkColor: AboutStyle.copyrightBlock.url.color + text: ''+applicationUrl+'' + + width: parent.width + visible: applicationUrl != '' + horizontalAlignment: Text.AlignHCenter + + onLinkActivated: Qt.openUrlExternally(link) + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton + cursorShape: parent.hoveredLink + ? Qt.PointingHandCursor + : Qt.IBeamCursor + } + } + + Text { + color: AboutStyle.copyrightBlock.license.color + elide: Text.ElideRight + font.pointSize: AboutStyle.copyrightBlock.license.pointSize + visible: applicationVendor != '' + text: (applicationLicence? applicationLicence+'\n':'') +'\u00A9 '+ copyrightRangeDate + + ' ' + applicationVendor + + width: parent.width + + horizontalAlignment: Text.AlignHCenter + } + } + } + }