diff --git a/README.md b/README.md index a5dc1fd38..aca927410 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,14 @@ Linphone is dual licensed, and is available either : - [Linphone public wiki](https://wiki.linphone.org/xwiki/wiki/public/view/Linphone/) +### Parameters + +`--help` : display available parameters. + +`--verbose` : print logs into stdout/stderr. + +`--qt-logs-only` : print only logs from the application. It strips SDK logs from the output. + ## Getting started Here are the general instructions to build Linphone for desktop. The specific instructions for each build platform is described just below. diff --git a/linphone-app/assets/languages/cs.ts b/linphone-app/assets/languages/cs.ts index 90483c397..837da1f8c 100644 --- a/linphone-app/assets/languages/cs.ts +++ b/linphone-app/assets/languages/cs.ts @@ -117,6 +117,10 @@ checkForUpdates Zkontrolovat aktualizace + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2575,6 +2579,9 @@ Klikněte zde: <a href="%1">%1</a> ZOBRAZIT + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + vfsTitle 'VFS' VFS diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 647b83f5f..b19780ab6 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -117,6 +117,10 @@ checkForUpdates Tjek for opdateringer + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Klik her: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index bcd2f58df..2e6f0f643 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -117,6 +117,10 @@ checkForUpdates Auf Aktualisierungen prüfen + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Klicken Sie hier: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index f80f92236..a6a211eb1 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -117,6 +117,10 @@ checkForUpdates Check for updates + + commandLineOptionQtLogsOnly + Print only logs from the application + AssistantAbstractView @@ -2389,6 +2393,12 @@ Click here: <a href="%1">%1</a> viewlogs VIEW + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + 'Full logs' : label for an option to activate all logs (debug and traces) + Full logs + SettingsAudio diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index b69b6a0bf..27e613e51 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -117,6 +117,10 @@ checkForUpdates Buscar actualizaciones + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Haga clic aquí: <a href="%1">%1 </a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 8bf747b74..9baca6ecc 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -117,6 +117,10 @@ checkForUpdates Vérifier les mises à jour + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2406,6 +2410,9 @@ Cliquez ici : <a href="%1">%1</a> AFFICHER + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + vfsTitle 'VFS' VFS diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index d600fffad..b0af43935 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -117,6 +117,10 @@ checkForUpdates Frissítések keresése + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2376,6 +2380,11 @@ Kattintson ide: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index 1239175f1..c6aab1c59 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -117,6 +117,10 @@ checkForUpdates Cerca aggiornamenti + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Clicca: <a href="%1">%1</a> viewlogs VISTA + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 072f0212b..b5d1b259a 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -117,6 +117,10 @@ checkForUpdates アップデートを確認する + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2376,6 +2380,11 @@ viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 71bbadfe6..211cc1370 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -117,6 +117,10 @@ checkForUpdates + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2402,6 +2406,11 @@ Spustelėkite čia: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index e8f47c712..b91c8f6d2 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -117,6 +117,10 @@ checkForUpdates Verifique se há atualizações + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Clique aqui: <a href="%1">%1 </a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index f6113c13d..446a8ed45 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -117,6 +117,10 @@ checkForUpdates Проверить обновления + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2419,6 +2423,9 @@ ВИД + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + vfsTitle 'VFS' ВФС diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index f551c6364..62ba33556 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -117,6 +117,10 @@ checkForUpdates + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2389,6 +2393,11 @@ Klicka här: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 34b853025..24afbacbf 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -117,6 +117,10 @@ checkForUpdates Güncellemeleri denetle + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2376,6 +2380,11 @@ Buraya tıklayın: <a href="%1">%1</a> viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index f563393ce..5d03ae5c5 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -117,6 +117,10 @@ checkForUpdates + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2402,6 +2406,11 @@ viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 1db885050..77a0c036e 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -117,6 +117,10 @@ checkForUpdates + + commandLineOptionQtLogsOnly + + AssistantAbstractView @@ -2376,6 +2380,11 @@ viewlogs + + fullLogsEnabledLabel + 'Full logs' : label for an option to activate all logs (debug and traces) + + SettingsAudio diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index 861ff4562..170d9dfa5 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -234,6 +234,8 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U if (mParser->isSet("verbose")) Logger::getInstance()->setVerbose(true); + if (mParser->isSet("qt-logs-only")) + Logger::getInstance()->enableQtOnly(true); // List available locales. for (const auto &locale : QDir(Constants::LanguagePath).entryList()) @@ -562,7 +564,8 @@ void App::createParser () { #ifndef Q_OS_MACOS { "iconified", tr("commandLineOptionIconified") }, #endif // ifndef Q_OS_MACOS - { { "V", "verbose" }, tr("commandLineOptionVerbose") } + { { "V", "verbose" }, tr("commandLineOptionVerbose") }, + { "qt-logs-only", tr("commandLineOptionQtLogsOnly") }, }); } diff --git a/linphone-app/src/app/logger/Logger.cpp b/linphone-app/src/app/logger/Logger.cpp index 741a47c06..3a7b24033 100644 --- a/linphone-app/src/app/logger/Logger.cpp +++ b/linphone-app/src/app/logger/Logger.cpp @@ -63,7 +63,7 @@ static inline QByteArray getFormattedCurrentTime () { } // ----------------------------------------------------------------------------- - +// Called from SDK class LinphoneLogger : public linphone::LoggingServiceListener { public: LinphoneLogger (const Logger *logger) : mLogger(logger) {} @@ -75,40 +75,43 @@ private: linphone::LogLevel level, const string &message ) override { - if (!mLogger->isVerbose()) + bool isQtLog = domain==Constants::QtDomain; + if (!mLogger->isVerbose() || (!isQtLog && mLogger->qtOnlyEnabled())) return; - + FILE * out = stdout; using LogLevel = linphone::LogLevel; - const char *format; + QString format = (isQtLog ? PURPLE : YELLOW ) + QString("Core:%s: " RESET "%s\n"); switch (level) { case LogLevel::Debug: - format = GREEN "[%s][Debug]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(GREEN "[%s][Debug]"); break; case LogLevel::Trace: - format = BLUE "[%s][Trace]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(BLUE "[%s][Trace]"); break; case LogLevel::Message: - format = BLUE "[%s][Info]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(BLUE "[%s][Info]"); break; case LogLevel::Warning: - format = RED "[%s][Warning]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(RED "[%s][Warning]"); + out = stderr; break; case LogLevel::Error: - format = RED "[%s][Error]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(RED "[%s][Error]"); + out = stderr; break; case LogLevel::Fatal: - format = RED "[%s][Fatal]" YELLOW "Core:%s: " RESET "%s\n"; + format.prepend(RED "[%s][Fatal]"); + out = stderr; break; } - fprintf( - stderr, - format, + fprintf( out, + qPrintable(format), getFormattedCurrentTime().constData(), domain.empty() ? domain.c_str() : EXECUTABLE_NAME, message.c_str() ); - + fflush(out); if (level == LogLevel::Fatal) terminate(); }; @@ -117,7 +120,7 @@ private: }; // ----------------------------------------------------------------------------- - +// Called from Qt void Logger::log (QtMsgType type, const QMessageLogContext &context, const QString &msg) { const char *format; BctbxLogLevel level; @@ -163,8 +166,6 @@ void Logger::log (QtMsgType type, const QMessageLogContext &context, const QStri mMutex.lock(); - fprintf(stdout, format, dateTime.constData(), QThread::currentThread(), contextStr, localMsg.constData()); - fflush(stdout); if( level == BCTBX_LOG_FATAL) QMessageBox::critical(nullptr, "Linphone will crash", msg); // Print an error message before sending msg to bctoolbox bctbx_log(Constants::QtDomain, level, "QT: %s%s", contextStr, localMsg.constData()); @@ -210,7 +211,26 @@ void Logger::init (const shared_ptr &config) { linphone::Core::setLogCollectionPath(Utils::appStringToCoreString(folder)); linphone::Core::setLogCollectionMaxFileSize(Constants::MaxLogsCollectionSize); + mInstance->enableFullLogs(SettingsModel::getFullLogsEnabled(config)); mInstance->enable(SettingsModel::getLogsEnabled(config)); + +} + +void Logger::enableFullLogs(const bool& full){ + if(mLoggingService){ + mLoggingService->setLogLevel(full ? linphone::LogLevel::Debug : linphone::LogLevel::Message); + } +} + +bool Logger::qtOnlyEnabled() const{ + return mQtOnly; +} + +void Logger::enableQtOnly(const bool& enable){ + mQtOnly = enable; + if(mLoggingService){ + mLoggingService->setDomain(enable ? Constants::QtDomain : ""); + } } QString Logger::getLogText()const{ diff --git a/linphone-app/src/app/logger/Logger.hpp b/linphone-app/src/app/logger/Logger.hpp index 374b49e52..320c88f12 100644 --- a/linphone-app/src/app/logger/Logger.hpp +++ b/linphone-app/src/app/logger/Logger.hpp @@ -44,19 +44,24 @@ public: void enable (bool status); QString getLogText()const; + void enableFullLogs(const bool& full); + bool qtOnlyEnabled() const; + void enableQtOnly(const bool& enable); + static void init (const std::shared_ptr &config); static Logger *getInstance () { return mInstance; } - + private: Logger () = default; static void log (QtMsgType type, const QMessageLogContext &context, const QString &msg); bool mVerbose = false; + bool mQtOnly = false; static QMutex mMutex; static Logger *mInstance; diff --git a/linphone-app/src/components/contact/VcardModel.cpp b/linphone-app/src/components/contact/VcardModel.cpp index f807d756e..b31fa3309 100644 --- a/linphone-app/src/components/contact/VcardModel.cpp +++ b/linphone-app/src/components/contact/VcardModel.cpp @@ -100,11 +100,11 @@ VcardModel::VcardModel (shared_ptr vcard, bool isReadOnly) : QO VcardModel::~VcardModel () { if (!mIsReadOnly) { - qInfo() << QStringLiteral("Destroy detached vcard:") << this; + qDebug() << QStringLiteral("Destroy detached vcard:") << this; if (!mAvatarIsReadOnly) removeBelcardPhoto(mVcard->getVcard()); } else - qInfo() << QStringLiteral("Destroy attached vcard:") << this; + qDebug() << QStringLiteral("Destroy attached vcard:") << this; } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index a2b76be29..5f835de87 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -578,15 +578,15 @@ QVariantMap SettingsModel::getVideoDefinition () const { } QVariantMap SettingsModel::getCurrentPreviewVideoDefinition () const { - auto definition = CoreManager::getInstance()->getCore()->getCurrentPreviewVideoDefinition(); - if(definition) - return createMapFromVideoDefinition(definition); - else { - QVariantMap map; - map["width"] = 0; - map["height"] = 0; - return map; + if(CoreManager::getInstance()->getCore()->videoPreviewEnabled()){ + auto definition = CoreManager::getInstance()->getCore()->getCurrentPreviewVideoDefinition(); + if(definition) + return createMapFromVideoDefinition(definition); } + QVariantMap map; + map["width"] = 0; + map["height"] = 0; + return map; } void SettingsModel::setVideoDefinition (const QVariantMap &definition) { @@ -1685,6 +1685,16 @@ void SettingsModel::setLogsEnabled (bool status) { emit logsEnabledChanged(status); } +bool SettingsModel::getFullLogsEnabled () const { + return getFullLogsEnabled(mConfig); +} + +void SettingsModel::setFullLogsEnabled (bool status) { + mConfig->setInt(UiSection, "full_logs_enabled", status); + Logger::getInstance()->enableFullLogs(status); + emit fullLogsEnabledChanged(); +} + // --------------------------------------------------------------------------- QString SettingsModel::getLogsEmail () const { @@ -1714,6 +1724,9 @@ bool SettingsModel::getLogsEnabled (const shared_ptr &config) return config ? config->getInt(UiSection, "logs_enabled", false) : true; } +bool SettingsModel::getFullLogsEnabled (const shared_ptr &config) { + return config ? config->getInt(UiSection, "full_logs_enabled", false) : false; +} // --------------------------------------------------------------------------- bool SettingsModel::isDeveloperSettingsAvailable() const { #ifdef DEBUG diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 6912884f6..98a82bcc5 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -219,6 +219,7 @@ class SettingsModel : public QObject { Q_PROPERTY(QString logsFolder READ getLogsFolder WRITE setLogsFolder NOTIFY logsFolderChanged) Q_PROPERTY(QString logsUploadUrl READ getLogsUploadUrl WRITE setLogsUploadUrl NOTIFY logsUploadUrlChanged) Q_PROPERTY(bool logsEnabled READ getLogsEnabled WRITE setLogsEnabled NOTIFY logsEnabledChanged) + Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged) Q_PROPERTY(QString logsEmail READ getLogsEmail WRITE setLogsEmail NOTIFY logsEmailChanged) Q_PROPERTY(bool developerSettingsEnabled READ getDeveloperSettingsEnabled WRITE setDeveloperSettingsEnabled NOTIFY developerSettingsEnabledChanged) @@ -608,6 +609,9 @@ public: bool getLogsEnabled () const; void setLogsEnabled (bool status); + bool getFullLogsEnabled () const; + void setFullLogsEnabled (bool status); + QString getLogsEmail () const; void setLogsEmail (const QString &email); @@ -617,6 +621,7 @@ public: static QString getLogsFolder (const std::shared_ptr &config); static bool getLogsEnabled (const std::shared_ptr &config); + static bool getFullLogsEnabled (const std::shared_ptr &config); // --------------------------------------------------------------------------- Q_INVOKABLE bool isDeveloperSettingsAvailable() const; @@ -797,6 +802,7 @@ signals: void logsFolderChanged (const QString &folder); void logsUploadUrlChanged (const QString &url); void logsEnabledChanged (bool status); + void fullLogsEnabledChanged (); void logsEmailChanged (const QString &email); void contactImporterChanged(); diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 7b0c0e30e..13d284f66 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -45,7 +45,7 @@ ColumnLayout { function getPeerAddress() { if(chatRoomModel) { if(chatRoomModel.groupEnabled || chatRoomModel.isSecure()) { - return chatRoomModel.participants.addressesToString; + return chatRoomModel.getPeerAddress(); }else { return chatRoomModel.sipAddress; } @@ -56,7 +56,7 @@ ColumnLayout { function getFullPeerAddress() { if(chatRoomModel) { if(chatRoomModel.groupEnabled || chatRoomModel.isSecure()) { - return chatRoomModel.participants.addressesToString; + return chatRoomModel.getFullPeerAddress() }else { return chatRoomModel.sipAddress; } diff --git a/linphone-app/ui/views/App/Settings/SettingsAdvanced.qml b/linphone-app/ui/views/App/Settings/SettingsAdvanced.qml index 3892883f5..8db4aa7d1 100644 --- a/linphone-app/ui/views/App/Settings/SettingsAdvanced.qml +++ b/linphone-app/ui/views/App/Settings/SettingsAdvanced.qml @@ -68,6 +68,16 @@ TabContainer { onClicked: SettingsModel.logsEnabled = !checked } } + FormGroup { + //: 'Full logs' : label for an option to activate all logs (debug and traces) + label: qsTr('fullLogsEnabledLabel') + + Switch { + checked: SettingsModel.fullLogsEnabled + + onClicked: SettingsModel.fullLogsEnabled = !checked + } + } } } Row {