diff --git a/linphone-desktop/CMakeLists.txt b/linphone-desktop/CMakeLists.txt index 8a7ee997c..2395a8cf1 100644 --- a/linphone-desktop/CMakeLists.txt +++ b/linphone-desktop/CMakeLists.txt @@ -60,7 +60,7 @@ if(NOT WIN32) set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wsuggest-override -Werror=suggest-override") endif() endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG") # ------------------------------------------------------------------------------ diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index f678511d6..e2251aa47 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -1,6 +1,13 @@ + + About + + ok + OK + + ActivateLinphoneSipAccountWithEmail @@ -760,14 +767,6 @@ to chat or see the conversation history. quit Quit - - importContacts - Import contacts from vCards - - - exportContacts - Export contacts as vCards - ManageAccounts diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index 76d33c0e4..cb42e703b 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -1,6 +1,13 @@ + + About + + ok + OK + + ActivateLinphoneSipAccountWithEmail @@ -759,14 +766,6 @@ chatter ou voir l'historique de conversation. quit Quitter - - importContacts - Importer des contacts depuis des vCards - - - exportContacts - Exporter des contacts sous forme de vCards - ManageAccounts diff --git a/linphone-desktop/resources.qrc b/linphone-desktop/resources.qrc index 9719c97ea..235ed9ee0 100644 --- a/linphone-desktop/resources.qrc +++ b/linphone-desktop/resources.qrc @@ -343,6 +343,7 @@ ui/views/App/Calls/Incall.qml ui/views/App/Calls/IncomingCall.qml ui/views/App/Calls/OutgoingCall.qml + ui/views/App/Main/About.qml ui/views/App/Main/Assistant/ActivateLinphoneSipAccountWithEmail.qml ui/views/App/Main/Assistant/AssistantAbstractView.qml ui/views/App/Main/Assistant/AssistantHome.qml @@ -383,6 +384,7 @@ ui/views/App/SplashScreen/SplashScreen.qml ui/views/App/Styles/Calls/CallStyle.qml ui/views/App/Styles/Calls/CallsWindowStyle.qml + ui/views/App/Styles/Main/AboutStyle.qml ui/views/App/Styles/Main/Assistant/ActivateLinphoneSipAccountWithEmailStyle.qml ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml diff --git a/linphone-desktop/src/app/App.cpp b/linphone-desktop/src/app/App.cpp index a1cacc723..afbab76a4 100644 --- a/linphone-desktop/src/app/App.cpp +++ b/linphone-desktop/src/app/App.cpp @@ -50,6 +50,10 @@ #define QML_VIEW_SPLASH_SCREEN "qrc:/ui/views/App/SplashScreen/SplashScreen.qml" +#ifndef LINPHONE_VERSION + #define LINPHONE_VERSION "unknown" +#endif // ifndef LINPHONE_VERSION + using namespace std; // ============================================================================= @@ -253,6 +257,12 @@ bool App::hasFocus () const { // ----------------------------------------------------------------------------- +QString App::getVersion () const { + return ::Utils::linphoneStringToQString(LINPHONE_VERSION); +} + +// ----------------------------------------------------------------------------- + #define registerSharedSingletonType(TYPE, NAME, METHOD) qmlRegisterSingletonType( \ "Linphone", 1, 0, NAME, \ [](QQmlEngine *, QJSEngine *) -> QObject *{ \ diff --git a/linphone-desktop/src/app/App.hpp b/linphone-desktop/src/app/App.hpp index 2c4fca871..d96903b32 100644 --- a/linphone-desktop/src/app/App.hpp +++ b/linphone-desktop/src/app/App.hpp @@ -37,6 +37,8 @@ class DefaultTranslator; class App : public SingleApplication { Q_OBJECT; + Q_PROPERTY(QString version READ getVersion CONSTANT); + Q_PROPERTY(QString configLocale READ getConfigLocale WRITE setConfigLocale NOTIFY configLocaleChanged); Q_PROPERTY(QString locale READ getLocale CONSTANT); Q_PROPERTY(QVariantList availableLocales READ getAvailableLocales CONSTANT); @@ -76,6 +78,8 @@ signals: void configLocaleChanged (const QString &locale); private: + QString getVersion () const; + void registerTypes (); void setTrayIcon (); diff --git a/linphone-desktop/src/components/core/CoreManager.cpp b/linphone-desktop/src/components/core/CoreManager.cpp index 269e2ef31..e82140c01 100644 --- a/linphone-desktop/src/components/core/CoreManager.cpp +++ b/linphone-desktop/src/components/core/CoreManager.cpp @@ -79,7 +79,7 @@ VcardModel *CoreManager::createDetachedVcardModel () { void CoreManager::forceRefreshRegisters () { qInfo() << QStringLiteral("Refresh registers."); - mInstance->mCore->refreshRegisters(); + mCore->refreshRegisters(); } // ----------------------------------------------------------------------------- @@ -128,8 +128,14 @@ void CoreManager::createLinphoneCore (const QString &configPath) { // ----------------------------------------------------------------------------- +QString CoreManager::getVersion () const { + return ::Utils::linphoneStringToQString(mCore->getVersion()); +} + +// ----------------------------------------------------------------------------- + void CoreManager::iterate () { mInstance->lockVideoRender(); - mInstance->mCore->iterate(); + mCore->iterate(); mInstance->unlockVideoRender(); } diff --git a/linphone-desktop/src/components/core/CoreManager.hpp b/linphone-desktop/src/components/core/CoreManager.hpp index b13a8a7a9..18e374db9 100644 --- a/linphone-desktop/src/components/core/CoreManager.hpp +++ b/linphone-desktop/src/components/core/CoreManager.hpp @@ -42,6 +42,8 @@ class QTimer; class CoreManager : public QObject { Q_OBJECT; + Q_PROPERTY(QString version READ getVersion CONSTANT); + public: ~CoreManager () = default; @@ -121,6 +123,8 @@ private: void createLinphoneCore (const QString &configPath); + QString getVersion () const; + void iterate (); std::shared_ptr mCore; diff --git a/linphone-desktop/ui/modules/Linphone/Calls/CallStatistics.qml b/linphone-desktop/ui/modules/Linphone/Calls/CallStatistics.qml index 755e5dfaf..e628de3b4 100644 --- a/linphone-desktop/ui/modules/Linphone/Calls/CallStatistics.qml +++ b/linphone-desktop/ui/modules/Linphone/Calls/CallStatistics.qml @@ -104,7 +104,7 @@ AbstractDropDownMenu { } Loader { - property string $label: qsTr("audioStatsLabel") + property string $label: qsTr('audioStatsLabel') property var $data: callStatistics.call.audioStats sourceComponent: media @@ -112,7 +112,7 @@ AbstractDropDownMenu { } Loader { - property string $label: qsTr("videoStatsLabel") + property string $label: qsTr('videoStatsLabel') property var $data: callStatistics.call.videoStats sourceComponent: media diff --git a/linphone-desktop/ui/views/App/Main/About.qml b/linphone-desktop/ui/views/App/Main/About.qml new file mode 100644 index 000000000..58defb8ca --- /dev/null +++ b/linphone-desktop/ui/views/App/Main/About.qml @@ -0,0 +1,115 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +import Common 1.0 +import Linphone 1.0 + +import App.Styles 1.0 + +// ============================================================================= + +DialogPlus { + buttons: [ + TextButtonB { + text: qsTr('ok') + + onClicked: exit(0) + } + ] + + centeredButtons: true + + height: AboutStyle.height + width: AboutStyle.width + + Column { + anchors { + fill: parent + leftMargin: AboutStyle.leftMargin + rightMargin: AboutStyle.rightMargin + } + + spacing: AboutStyle.spacing + + RowLayout { + spacing: AboutStyle.versionsBlock.spacing + + height: AboutStyle.versionsBlock.iconSize + width: parent.width + + Icon { + icon: 'linphone_logo' + iconSize: parent.height + } + + Column { + Layout.fillWidth: true + Layout.preferredHeight: parent.height + + spacing: 0 + + Text { + color: AboutStyle.versionsBlock.appVersion.color + elide: Text.ElideRight + font.pointSize: AboutStyle.versionsBlock.appVersion.fontSize + text: 'Linphone Desktop ' + App.version + + height: parent.height / 2 + width: parent.width + + verticalAlignment: Text.AlignVCenter + } + + Text { + color: AboutStyle.versionsBlock.coreVersion.color + elide: Text.ElideRight + font.pointSize: AboutStyle.versionsBlock.coreVersion.fontSize + text: 'Linphone Core ' + CoreManager.version + + height: parent.heigth / 2 + width: parent.width + + verticalAlignment: Text.AlignVCenter + } + } + } + + Column { + spacing: AboutStyle.copyrightBlock.spacing + width: parent.width + + Text { + elide: Text.ElideRight + font.pointSize: AboutStyle.copyrightBlock.url.fontSize + linkColor: AboutStyle.copyrightBlock.url.color + text: 'https://www.linphone.org' + + 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.fontSize + + text: 'GNU General Public License V2\n\u00A9 2010-2017 Belledonne Communications' + + width: parent.width + + horizontalAlignment: Text.AlignHCenter + } + } + } +} diff --git a/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml b/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml index 152efdbc5..de517093c 100644 --- a/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml +++ b/linphone-desktop/ui/views/App/Main/MainWindowMenuBar.qml @@ -7,16 +7,16 @@ import Linphone 1.0 import App.Styles 1.0 -// ============================================================================ +// ============================================================================= MenuBar { id: container - // -------------------------------------------------------------------------- + // --------------------------------------------------------------------------- property bool hide: false - // -------------------------------------------------------------------------- + // --------------------------------------------------------------------------- // Workaround to hide toolbar. // Use private properties of MenuBar. @@ -29,7 +29,7 @@ MenuBar { yScale: Number(!hide) } - // -------------------------------------------------------------------------- + // --------------------------------------------------------------------------- style: MenuBarStyle { background: Rectangle { @@ -109,9 +109,12 @@ MenuBar { } } - // -------------------------------------------------------------------------- + // --------------------------------------------------------------------------- + // Options. + // --------------------------------------------------------------------------- Menu { + title: qsTr('options') MenuItem { @@ -138,36 +141,43 @@ MenuBar { } } + // --------------------------------------------------------------------------- + // Tools. + // --------------------------------------------------------------------------- + Menu { title: qsTr('tools') MenuItem { text: qsTr('audioAssistant') - } - MenuSeparator {} - - MenuItem { - text: qsTr('importContacts') - } - - MenuItem { - text: qsTr('exportContacts') + onTriggered: console.log('TODO') } } + // --------------------------------------------------------------------------- + // Help. + // --------------------------------------------------------------------------- + Menu { title: qsTr('help') MenuItem { shortcut: StandardKey.HelpContents text: qsTr('about') + + onTriggered: { + window.detachVirtualWindow() + window.attachVirtualWindow(Qt.resolvedUrl('About.qml')) + } } MenuSeparator {} MenuItem { text: qsTr('checkForUpdates') + + onTriggered: console.log('TODO') } } } diff --git a/linphone-desktop/ui/views/App/SplashScreen/SplashScreen.qml b/linphone-desktop/ui/views/App/SplashScreen/SplashScreen.qml index 4446e91b1..f45538865 100644 --- a/linphone-desktop/ui/views/App/SplashScreen/SplashScreen.qml +++ b/linphone-desktop/ui/views/App/SplashScreen/SplashScreen.qml @@ -30,7 +30,7 @@ Window { fillMode: Image.PreserveAspectFit mipmap: true - source: SplashScreenStyle.image + source: Constants.imagesPath + 'splash_screen' + Constants.imagesFormat BusyIndicator { height: SplashScreenStyle.busyIndicator.height diff --git a/linphone-desktop/ui/views/App/Styles/Main/AboutStyle.qml b/linphone-desktop/ui/views/App/Styles/Main/AboutStyle.qml new file mode 100644 index 000000000..07c483d51 --- /dev/null +++ b/linphone-desktop/ui/views/App/Styles/Main/AboutStyle.qml @@ -0,0 +1,43 @@ +pragma Singleton +import QtQuick 2.7 + +import Common 1.0 + +// ============================================================================= + +QtObject { + property int height: 225 + property int leftMargin: 25 + property int rightMargin: 25 + property int spacing: 20 + property int width: 400 + + property QtObject copyrightBlock: QtObject { + property int spacing: 10 + + property QtObject license: QtObject { + property color color: Colors.d + property int fontSize: 10 + } + + property QtObject url: QtObject { + property color color: Colors.i + property int fontSize: 10 + } + } + + property QtObject versionsBlock: QtObject { + property int iconSize: 48 + property int spacing: 10 + + property QtObject appVersion: QtObject { + property color color: Colors.d + property int fontSize: 10 + } + + property QtObject coreVersion: QtObject { + property color color: Colors.d + property int fontSize: 10 + } + } +} diff --git a/linphone-desktop/ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml b/linphone-desktop/ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml index c25094635..ddbc957f6 100644 --- a/linphone-desktop/ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml +++ b/linphone-desktop/ui/views/App/Styles/SplashScreen/SplashScreenStyle.qml @@ -7,7 +7,6 @@ QtObject { property color color: '#444444' // Not a `Common.Color`. Specific case. property int height: 350 property int width: 620 - property url image: 'qrc:/assets/images/splash_screen.svg' property QtObject busyIndicator: QtObject { property int bottomMargin: 25 diff --git a/linphone-desktop/ui/views/App/Styles/qmldir b/linphone-desktop/ui/views/App/Styles/qmldir index c031135ea..b18d02ec9 100644 --- a/linphone-desktop/ui/views/App/Styles/qmldir +++ b/linphone-desktop/ui/views/App/Styles/qmldir @@ -13,6 +13,7 @@ singleton AssistantHomeStyle 1.0 Main/Assistant/AssistantH singleton CreateLinphoneSipAccountStyle 1.0 Main/Assistant/CreateLinphoneSipAccountStyle.qml singleton UseLinphoneSipAccountStyle 1.0 Main/Assistant/UseLinphoneSipAccountStyle.qml +singleton AboutStyle 1.0 Main/AboutStyle.qml singleton AssistantStyle 1.0 Main/AssistantStyle.qml singleton AuthenticationRequestStyle 1.0 Main/AuthenticationRequestStyle.qml singleton ContactEditStyle 1.0 Main/ContactEditStyle.qml