From 07da8b532bc37dccc4dd65eb54192bffb8eabd78 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 14 Jun 2017 10:22:40 +0200 Subject: [PATCH 1/5] fix(ui/modules/Common/Form/SearchBox): emit enter pressed before closed signal --- .../ui/modules/Common/Form/SearchBox.qml | 2 +- .../SmartSearchBar/SmartSearchBar.qml | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/linphone-desktop/ui/modules/Common/Form/SearchBox.qml b/linphone-desktop/ui/modules/Common/Form/SearchBox.qml index 76aae7a51..040447c67 100644 --- a/linphone-desktop/ui/modules/Common/Form/SearchBox.qml +++ b/linphone-desktop/ui/modules/Common/Form/SearchBox.qml @@ -69,8 +69,8 @@ Item { Keys.onEscapePressed: searchBox.closeMenu() Keys.onReturnPressed: { - searchBox.closeMenu() searchBox.enterPressed() + searchBox.closeMenu() } onActiveFocusChanged: { diff --git a/linphone-desktop/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml b/linphone-desktop/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml index c2f22a4c7..8746f87bd 100644 --- a/linphone-desktop/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml +++ b/linphone-desktop/ui/modules/Linphone/SmartSearchBar/SmartSearchBar.qml @@ -6,11 +6,11 @@ import Linphone.Styles 1.0 // ============================================================================= SearchBox { - id: searchBar + id: searchBox // --------------------------------------------------------------------------- - readonly property alias isOpen: searchBar._isOpen + readonly property alias isOpen: searchBox._isOpen // --------------------------------------------------------------------------- @@ -29,7 +29,7 @@ SearchBox { onEnterPressed: { var sipAddress = view.interpretableSipAddress - return sipAddress.length > 0 && searchBar.launchCall(sipAddress) + return sipAddress.length > 0 && searchBox.launchCall(sipAddress) } // --------------------------------------------------------------------------- @@ -40,37 +40,37 @@ SearchBox { actions: [{ icon: 'video_call', handler: function (entry) { - searchBar.closeMenu() - searchBar.launchVideoCall(entry.sipAddress) + searchBox.closeMenu() + searchBox.launchVideoCall(entry.sipAddress) } }, { icon: 'call', handler: function (entry) { - searchBar.closeMenu() - searchBar.launchCall(entry.sipAddress) + searchBox.closeMenu() + searchBox.launchCall(entry.sipAddress) } }, { icon: 'chat', handler: function (entry) { - searchBar.closeMenu() - searchBar.launchChat(entry.sipAddress) + searchBox.closeMenu() + searchBox.launchChat(entry.sipAddress) } }] headerButtonDescription: qsTr('addContact') headerButtonIcon: 'contact_add' headerButtonAction: (function (sipAddress) { - searchBar.closeMenu() - searchBar.addContact(sipAddress) + searchBox.closeMenu() + searchBox.addContact(sipAddress) }) - genSipAddress: searchBar.filter + genSipAddress: searchBox.filter model: SipAddressesProxyModel {} onEntryClicked: { - searchBar.closeMenu() - searchBar.entryClicked(entry) + searchBox.closeMenu() + searchBox.entryClicked(entry) } } } From 734c1328b56bd0510b1067cae5413bb946045ce2 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 14 Jun 2017 10:29:02 +0200 Subject: [PATCH 2/5] Improve desktop file. --- linphone-desktop/linphone.desktop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linphone-desktop/linphone.desktop b/linphone-desktop/linphone.desktop index eb1ddd2a8..8235d9514 100644 --- a/linphone-desktop/linphone.desktop +++ b/linphone-desktop/linphone.desktop @@ -1,7 +1,7 @@ [Desktop Entry] Name=Linphone -GenericName=Web-phone -Comment=Linphone is a web-phone +GenericName=SIP Phone +Comment=Linphone is a libre SIP client Type=Application Exec=linphone %u Icon=linphone From a1a6f01949e8c2830cf3d82f5b9486dd1cf8e779 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 14 Jun 2017 10:41:56 +0200 Subject: [PATCH 3/5] Updated linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 3841f9c41..4c291e2c5 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3841f9c417019448118208291470232f7e20d60f +Subproject commit 4c291e2c5a32711a1176459d74ed405cf225f706 From 28d615cc62fa5cab78815e153e67f7a4e76bde55 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Wed, 14 Jun 2017 10:45:47 +0200 Subject: [PATCH 4/5] Fix display of Linphone name in menu bar on Mac OS X. --- cmake_builder/linphone_package/Info.plist.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake_builder/linphone_package/Info.plist.in b/cmake_builder/linphone_package/Info.plist.in index ef51a1bd6..18ac851cc 100644 --- a/cmake_builder/linphone_package/Info.plist.in +++ b/cmake_builder/linphone_package/Info.plist.in @@ -4,6 +4,10 @@ CFBundleDevelopmentRegion English + CFBundleName + Linphone + CFBundleDisplayName + Linphone CFBundleExecutable linphone CFBundleGetInfoString From ba15723a6b6c9aa85d7e219abcda0ed6d43c1542 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 14 Jun 2017 10:47:52 +0200 Subject: [PATCH 5/5] feat(src/app/App): translate help --- linphone-desktop/assets/languages/en.ts | 8 ++ linphone-desktop/assets/languages/fr.ts | 8 ++ linphone-desktop/src/app/App.cpp | 105 ++++++++++++++---------- linphone-desktop/src/app/App.hpp | 6 +- 4 files changed, 81 insertions(+), 46 deletions(-) diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 66a94e58d..4518af654 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -76,6 +76,14 @@ commandLineOptionCmdArg command line + + commandLineOptionHelp + + + + commandLineOptionVersion + + AssistantAbstractView diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index d7af8ce17..833a44a47 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -76,6 +76,14 @@ commandLineOptionCmdArg ligne de commande + + commandLineOptionHelp + + + + commandLineOptionVersion + + AssistantAbstractView diff --git a/linphone-desktop/src/app/App.cpp b/linphone-desktop/src/app/App.cpp index b3c65d0b3..6dc9cb22d 100644 --- a/linphone-desktop/src/app/App.cpp +++ b/linphone-desktop/src/app/App.cpp @@ -20,6 +20,7 @@ * Author: Ronan Abhamon */ +#include #include #include #include @@ -74,44 +75,33 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true) { parseArgs(); + // Initialize logger. (Do not do this before this point because the + // application has to be created for the logs to be put in the correct + // directory.) + Logger::init(); + if (mParser->isSet("verbose")) + Logger::getInstance()->setVerbose(true); + // List available locales. for (const auto &locale : QDir(LANGUAGES_PATH).entryList()) mAvailableLocales << QLocale(locale); + // Init locale. mTranslator = new DefaultTranslator(this); + initLocale(); - // Try to use preferred locale. - QString locale = ::Utils::coreStringToAppString( - linphone::Config::newWithFactory( - Paths::getConfigFilePath(mParser.value("config"), false), "")->getString( - SettingsModel::UI_SECTION, "locale", "" - ) - ); + parseArgs(); - if (!locale.isEmpty() && installLocale(*this, *mTranslator, QLocale(locale))) { - mLocale = locale; - qInfo() << QStringLiteral("Use preferred locale: %1").arg(locale); - return; - } - - // Try to use system locale. - QLocale sysLocale = QLocale::system(); - if (installLocale(*this, *mTranslator, sysLocale)) { - mLocale = sysLocale.name(); - qInfo() << QStringLiteral("Use system locale: %1").arg(mLocale); - return; - } - - // Use english. - mLocale = DEFAULT_LOCALE; - if (!installLocale(*this, *mTranslator, QLocale(mLocale))) - qFatal("Unable to install default translator."); - qInfo() << QStringLiteral("Use default locale: %1").arg(mLocale); + if (mParser->isSet("help")) + mParser->showHelp(); + if (mParser->isSet("version")) + mParser->showVersion(); } App::~App () { qInfo() << QStringLiteral("Destroying app..."); delete mEngine; + delete mParser; } // ----------------------------------------------------------------------------- @@ -167,7 +157,7 @@ void App::initContentApp () { } // Init core. - CoreManager::init(this, mParser.value("config")); + CoreManager::init(this, mParser->value("config")); // Init engine content. mEngine = new QQmlApplicationEngine(); @@ -193,7 +183,7 @@ void App::initContentApp () { createNotifier(); // Load splashscreen. - bool selfTest = mParser.isSet("self-test"); + bool selfTest = mParser->isSet("self-test"); if (!selfTest) activeSplashScreen(this); // Set a self test limit. @@ -218,7 +208,7 @@ void App::initContentApp () { // ----------------------------------------------------------------------------- QString App::getCommandArgument () { - return mParser.value("cmd"); + return mParser->value("cmd"); } // ----------------------------------------------------------------------------- @@ -282,10 +272,15 @@ bool App::hasFocus () const { // ----------------------------------------------------------------------------- void App::parseArgs () { - mParser.setApplicationDescription(tr("applicationDescription")); - mParser.addHelpOption(); - mParser.addVersionOption(); - mParser.addOptions({ + if (mParser) + delete mParser; + + mParser = new QCommandLineParser(); + + mParser->setApplicationDescription(tr("applicationDescription")); + mParser->addOptions({ + { { "h", "help" }, tr("commandLineOptionHelp") }, + { { "v", "version" }, tr("commandLineOptionVersion") }, { "config", tr("commandLineOptionConfig"), tr("commandLineOptionConfigArg") }, #ifndef Q_OS_MACOS { "iconified", tr("commandLineOptionIconified") }, @@ -295,15 +290,7 @@ void App::parseArgs () { { { "c", "cmd" }, tr("commandLineOptionCmd"), tr("commandLineOptionCmdArg") } }); - mParser.process(*this); - - // Initialize logger. (Do not do this before this point because the - // application has to be created for the logs to be put in the correct - // directory.) - Logger::init(); - if (mParser.isSet("verbose")) { - Logger::getInstance()->setVerbose(true); - } + mParser->process(*this); } // ----------------------------------------------------------------------------- @@ -448,6 +435,36 @@ void App::createNotifier () { // ----------------------------------------------------------------------------- +void App::initLocale () { + // Try to use preferred locale. + QString locale = ::Utils::coreStringToAppString( + linphone::Config::newWithFactory( + Paths::getConfigFilePath(mParser->value("config"), false), "")->getString( + SettingsModel::UI_SECTION, "locale", "" + ) + ); + + if (!locale.isEmpty() && installLocale(*this, *mTranslator, QLocale(locale))) { + mLocale = locale; + qInfo() << QStringLiteral("Use preferred locale: %1").arg(locale); + return; + } + + // Try to use system locale. + QLocale sysLocale = QLocale::system(); + if (installLocale(*this, *mTranslator, sysLocale)) { + mLocale = sysLocale.name(); + qInfo() << QStringLiteral("Use system locale: %1").arg(mLocale); + return; + } + + // Use english. + mLocale = DEFAULT_LOCALE; + if (!installLocale(*this, *mTranslator, QLocale(mLocale))) + qFatal("Unable to install default translator."); + qInfo() << QStringLiteral("Use default locale: %1").arg(mLocale); +} + QString App::getConfigLocale () const { return ::Utils::coreStringToAppString( CoreManager::getInstance()->getCore()->getConfig()->getString( @@ -482,7 +499,7 @@ void App::openAppAfterInit () { else setTrayIcon(); - if (!mParser.isSet("iconified")) + if (!mParser->isSet("iconified")) smartShowWindow(mainWindow); #else smartShowWindow(mainWindow); @@ -508,7 +525,7 @@ void App::openAppAfterInit () { // ----------------------------------------------------------------------------- void App::quit () { - if (mParser.isSet("self-test")) + if (mParser->isSet("self-test")) cout << tr("selfTestResult").toStdString() << endl; QApplication::quit(); diff --git a/linphone-desktop/src/app/App.hpp b/linphone-desktop/src/app/App.hpp index 66404e645..69dabe524 100644 --- a/linphone-desktop/src/app/App.hpp +++ b/linphone-desktop/src/app/App.hpp @@ -23,7 +23,6 @@ #ifndef APP_H_ #define APP_H_ -#include #include #include @@ -36,6 +35,7 @@ class Cli; class DefaultTranslator; +class QCommandLineParser; class App : public SingleApplication { Q_OBJECT; @@ -96,6 +96,8 @@ private: void setTrayIcon (); void createNotifier (); + void initLocale (); + QString getConfigLocale () const; void setConfigLocale (const QString &locale); @@ -111,7 +113,7 @@ private: return qVersion(); } - QCommandLineParser mParser; + QCommandLineParser *mParser = nullptr; QVariantList mAvailableLocales; QString mLocale;