diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 00f7175a..914c5975 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -66,6 +66,11 @@ App::App(int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::User | Mode::ExcludeAppPath | Mode::ExcludeAppVersion) { mLinphoneThread = new Thread(this); init(); + qInfo() << QStringLiteral("Starting application " APPLICATION_NAME " (bin: " EXECUTABLE_NAME + "). Version:%1 Os:%2 Qt:%3") + .arg(applicationVersion()) + .arg(Utils::getOsProduct()) + .arg(qVersion()); } App::~App() { diff --git a/Linphone/core/logger/QtLogger.cpp b/Linphone/core/logger/QtLogger.cpp index 0a83abab..d3b1e136 100644 --- a/Linphone/core/logger/QtLogger.cpp +++ b/Linphone/core/logger/QtLogger.cpp @@ -67,13 +67,32 @@ QtLogger *QtLogger::getInstance() { return &gLogger; } +QString QtLogger::formatLog(QString contextFile, int contextLine, QString msg) { + QString message; + +#ifdef QT_MESSAGELOGCONTEXT + { + QStringList cleanFiles = contextFile.split(Constants::SrcPattern); + QString fileToDisplay = cleanFiles.back(); + + message = QStringLiteral("%1:%2: ").arg(fileToDisplay).arg(contextLine); + } +#else + Q_UNUSED(contextFile) + Q_UNUSED(contextLine) +#endif + message += msg; + return message; +} + void QtLogger::onQtLog(QtMsgType type, const QMessageLogContext &context, const QString &msg) { QString out; + QString message = QtLogger::formatLog(context.file, context.line, msg); if (gLogger.mVerboseEnabled) { gLogger.printLog(&out, Constants::AppDomain, LinphoneEnums::toLinphone(type), - Utils::appStringToCoreString(msg)); + Utils::appStringToCoreString(message)); } - emit gLogger.qtLogReceived(type, context.file, context.line, msg); + emit gLogger.qtLogReceived(type, message); } void QtLogger::enableVerbose(bool verbose) { diff --git a/Linphone/core/logger/QtLogger.hpp b/Linphone/core/logger/QtLogger.hpp index a5f855e4..cf657e1c 100644 --- a/Linphone/core/logger/QtLogger.hpp +++ b/Linphone/core/logger/QtLogger.hpp @@ -48,6 +48,7 @@ public: static void enableVerbose(bool verbose); static void enableQtOnly(bool qtOnly); + static QString formatLog(QString contextFile, int contextLine, QString msg); void printLog(QString *qMessage, const std::string &domain, linphone::LogLevel level, const std::string &message); // Log Sources @@ -55,7 +56,7 @@ public: void onLinphoneLog(const std::string &domain, linphone::LogLevel level, const std::string &message); bool mVerboseEnabled = false; signals: - void qtLogReceived(QtMsgType type, QString contextFile, int contextLine, QString msg); + void qtLogReceived(QtMsgType type, QString msg); void requestVerboseEnabled(bool verbose); void requestQtOnlyEnabled(bool qtOnly); }; diff --git a/Linphone/core/notifier/Notifier.cpp b/Linphone/core/notifier/Notifier.cpp index 538a09ef..61e6dd4a 100644 --- a/Linphone/core/notifier/Notifier.cpp +++ b/Linphone/core/notifier/Notifier.cpp @@ -34,6 +34,7 @@ #include "core/App.hpp" #include "core/call/CallGui.hpp" #include "tool/LinphoneEnums.hpp" +#include "tool/providers/AvatarProvider.hpp" #include "tool/providers/ImageProvider.hpp" DEFINE_ABSTRACT_OBJECT(Notifier) @@ -159,6 +160,7 @@ QObject *Notifier::createNotification(Notifier::NotificationType type, QVariantM // auto engine = App::getInstance()->mEngine; auto engine = new QQmlApplicationEngine(); engine->addImageProvider(ImageProvider::ProviderId, new ImageProvider()); + engine->addImageProvider(AvatarProvider::ProviderId, new AvatarProvider()); engine->addImportPath(":/"); // if(showAsTool) window->setProperty("showAsTool",true); engine->setInitialProperties(data); diff --git a/Linphone/model/logger/LoggerModel.cpp b/Linphone/model/logger/LoggerModel.cpp index d267470a..2318f9ad 100644 --- a/Linphone/model/logger/LoggerModel.cpp +++ b/Linphone/model/logger/LoggerModel.cpp @@ -79,22 +79,10 @@ void LoggerModel::enableQtOnly(const bool &enable) { // ----------------------------------------------------------------------------- // Called from Qt -void LoggerModel::onQtLog(QtMsgType type, QString contextFile, int contextLine, QString msg) { +void LoggerModel::onQtLog(QtMsgType type, QString msg) { auto service = linphone::LoggingService::get(); - QString contextStr = ""; -#ifdef QT_MESSAGELOGCONTEXT - { - QStringList cleanFiles = contextFile.split(Constants::SrcPattern); - QString fileToDisplay = cleanFiles.back(); - contextStr = QStringLiteral("%1:%2: ").arg(fileToDisplay).arg(contextLine); - } -#else - Q_UNUSED(contextFile) - Q_UNUSED(contextLine) -#endif - - auto serviceMsg = Utils::appStringToCoreString(contextStr + msg); + auto serviceMsg = Utils::appStringToCoreString(msg); if (service) { switch (type) { case QtDebugMsg: diff --git a/Linphone/model/logger/LoggerModel.hpp b/Linphone/model/logger/LoggerModel.hpp index c855b73c..5a566937 100644 --- a/Linphone/model/logger/LoggerModel.hpp +++ b/Linphone/model/logger/LoggerModel.hpp @@ -45,7 +45,7 @@ public: void init(); void init(const std::shared_ptr &config); - void onQtLog(QtMsgType type, QString file, int contextLine, QString msg); // Received from Qt + void onQtLog(QtMsgType type, QString msg); // Received from Qt void onLinphoneLog(const std::shared_ptr &, const std::string &domain, linphone::LogLevel level, diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 1d99dd37..af305228 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -314,4 +314,29 @@ int Utils::getRandomIndex(int size) { void Utils::copyToClipboard(const QString &text) { QApplication::clipboard()->setText(text); -} \ No newline at end of file +} + +QString Utils::getApplicationProduct() { + // Note: Keep '-' as a separator between application name and application type + return QString(APPLICATION_NAME "-Desktop").remove(' ') + "/" + QCoreApplication::applicationVersion(); +} + +QString Utils::getOsProduct() { + QString version = + QSysInfo::productVersion().remove(' '); // A version can be "Server 2016" (for Windows Server 2016) + QString product = QSysInfo::productType().replace(' ', '-'); // Just in case + return product + "/" + version; +} + +QString Utils::computeUserAgent() { + // Placeholder + return "Linphone 6.0"; + /* + const std::shared_ptr &config + return QStringLiteral("%1 (%2) %3 Qt/%4 LinphoneSDK") + .arg(Utils::getApplicationProduct()) + .arg(SettingsModel::getDeviceName(config).replace('\\', "\\\\").replace('(', "\\(").replace(')', "\\)")) + .arg(Utils::getOsProduct()) + .arg(qVersion()); + */ +} diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index 1e3bf278..ec2a46cf 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -57,7 +57,7 @@ public: Q_INVOKABLE static QString getInitials(const QString &username); // Support UTF32 Q_INVOKABLE static VariantObject *createCall(const QString &sipAddress, - bool withVideo = false, + bool withVideo = false, const QString &prepareTransfertAddress = "", const QHash &headers = {}); Q_INVOKABLE static void openCallsWindow(CallGui *call); @@ -77,6 +77,10 @@ public: static QString generateSavedFilename(const QString &from, const QString &to); Q_INVOKABLE static QString generateLinphoneSipAddress(const QString &uri); + static QString getApplicationProduct(); + static QString getOsProduct(); + static QString computeUserAgent(); + static inline QString coreStringToAppString(const std::string &str) { if (Constants::LinphoneLocaleEncoding == QString("UTF-8")) return QString::fromStdString(str); else diff --git a/Linphone/view/App/CallsWindow.qml b/Linphone/view/App/CallsWindow.qml index 02a10852..f04ccca0 100644 --- a/Linphone/view/App/CallsWindow.qml +++ b/Linphone/view/App/CallsWindow.qml @@ -210,7 +210,7 @@ Window { id: callStatusIcon width: 15 * DefaultStyle.dp height: 15 * DefaultStyle.dp - source:(mainWindow.call.core.state === LinphoneEnums.CallState.End + imageSource:(mainWindow.call.core.state === LinphoneEnums.CallState.End || mainWindow.call.core.state === LinphoneEnums.CallState.Released) ? AppIcons.endCall : (mainWindow.call.core.state === LinphoneEnums.CallState.Paused @@ -264,7 +264,7 @@ Window { text: mainWindow.call.core.recording ? qsTr("Vous enregistrez l'appel") : qsTr("Votre correspondant enregistre l'appel") } EffectImage { - source: AppIcons.recordFill + imageSource: AppIcons.recordFill colorizationColor: DefaultStyle.danger_500main Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp @@ -640,7 +640,7 @@ Window { background: Item {} contentItem: RowLayout { EffectImage { - source: AppIcons.endCall + imageSource: AppIcons.endCall colorizationColor: DefaultStyle.danger_500main width: 32 * DefaultStyle.dp height: 32 * DefaultStyle.dp @@ -694,7 +694,7 @@ Window { RowLayout { Layout.fillWidth: true EffectImage { - source: AppIcons.speaker + imageSource: AppIcons.speaker colorizationColor: DefaultStyle.main1_500_main Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp @@ -727,7 +727,7 @@ Window { RowLayout { Layout.fillWidth: true EffectImage { - source: AppIcons.microphone + imageSource: AppIcons.microphone colorizationColor: DefaultStyle.main1_500_main Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp @@ -795,7 +795,7 @@ Window { RowLayout { Layout.fillWidth: true EffectImage { - source: AppIcons.videoCamera + imageSource: AppIcons.videoCamera colorizationColor: DefaultStyle.main1_500_main Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp @@ -974,7 +974,7 @@ Window { } contentItem: Item { EffectImage { - source: AppIcons.more + imageSource: AppIcons.more width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp anchors.centerIn: parent @@ -1040,7 +1040,7 @@ Window { Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp fillMode: Image.PreserveAspectFit - source: AppIcons.recordFill + imageSource: AppIcons.recordFill colorizationColor: mainWindow.call.core.recording ? DefaultStyle.danger_500main : undefined } Text { @@ -1063,7 +1063,7 @@ Window { Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp fillMode: Image.PreserveAspectFit - source: AppIcons.recordFill + imageSource: AppIcons.recordFill colorizationColor: mainWindow.call.core.recording ? DefaultStyle.danger_500main : undefined } Text { diff --git a/Linphone/view/App/Layout/MainLayout.qml b/Linphone/view/App/Layout/MainLayout.qml index 7fdaebb4..887b6aa4 100644 --- a/Linphone/view/App/Layout/MainLayout.qml +++ b/Linphone/view/App/Layout/MainLayout.qml @@ -46,7 +46,7 @@ Item { contentItem: RowLayout { spacing: 15 * DefaultStyle.dp EffectImage { - source: AppIcons.smiley + imageSource: AppIcons.smiley colorizationColor: DefaultStyle.success_500main Layout.preferredWidth: 32 * DefaultStyle.dp Layout.preferredHeight: 32 * DefaultStyle.dp diff --git a/Linphone/view/Item/Account/Accounts.qml b/Linphone/view/Item/Account/Accounts.qml index ea99dd2c..c66a11b2 100644 --- a/Linphone/view/Item/Account/Accounts.qml +++ b/Linphone/view/Item/Account/Accounts.qml @@ -70,7 +70,7 @@ Item { spacing: 5 * DefaultStyle.dp EffectImage { id: newAccount - source: AppIcons.plusCircle + imageSource: AppIcons.plusCircle width: 32 * DefaultStyle.dp height: 32 * DefaultStyle.dp Layout.preferredWidth: 32 * DefaultStyle.dp diff --git a/Linphone/view/Item/Button.qml b/Linphone/view/Item/Button.qml index 53c866b9..8221deac 100644 --- a/Linphone/view/Item/Button.qml +++ b/Linphone/view/Item/Button.qml @@ -94,7 +94,7 @@ Control.Button { Layout.alignment: Qt.AlignCenter Layout.fillWidth: true Layout.fillHeight: true - source: mainItem.icon.source + imageSource: mainItem.icon.source imageWidth: mainItem.icon.width imageHeight: mainItem.icon.height colorizationColor: mainItem.contentImageColor diff --git a/Linphone/view/Item/CheckBox.qml b/Linphone/view/Item/CheckBox.qml index d51c2ee8..22ef01f3 100644 --- a/Linphone/view/Item/CheckBox.qml +++ b/Linphone/view/Item/CheckBox.qml @@ -16,7 +16,7 @@ Control.CheckBox { // color: mainItem.checked ? DefaultStyle.main1_500_main : "transparent" EffectImage { visible: mainItem.checked - source: AppIcons.check + imageSource: AppIcons.check colorizationColor: DefaultStyle.main1_500_main anchors.fill: parent } diff --git a/Linphone/view/Item/Contact/Contact.qml b/Linphone/view/Item/Contact/Contact.qml index f8f55d52..980908ee 100644 --- a/Linphone/view/Item/Contact/Contact.qml +++ b/Linphone/view/Item/Contact/Contact.qml @@ -132,7 +132,7 @@ Rectangle{ } EffectImage { id: manageAccount - source: AppIcons.manageProfile + imageSource: AppIcons.manageProfile Layout.preferredWidth: 24 * DefaultStyle.dp Layout.preferredHeight: 24 * DefaultStyle.dp Layout.alignment: Qt.AlignHCenter diff --git a/Linphone/view/Item/Contact/ContactsList.qml b/Linphone/view/Item/Contact/ContactsList.qml index e4037bf9..b490cbcd 100644 --- a/Linphone/view/Item/Contact/ContactsList.qml +++ b/Linphone/view/Item/Contact/ContactsList.qml @@ -132,7 +132,7 @@ ListView { background: Item{} contentItem: RowLayout { EffectImage { - source: AppIcons.trashCan + imageSource: AppIcons.trashCan width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp diff --git a/Linphone/view/Item/EffectImage.qml b/Linphone/view/Item/EffectImage.qml index 2033517f..a2b3e75b 100644 --- a/Linphone/view/Item/EffectImage.qml +++ b/Linphone/view/Item/EffectImage.qml @@ -10,7 +10,7 @@ import Linphone Loader { id: mainItem active: visible - property var source + property var imageSource property var fillMode: Image.PreserveAspectFit property var colorizationColor property int imageWidth: width @@ -20,7 +20,7 @@ Loader { Image { id: image visible: !effect2.enabled - source: mainItem.source ? mainItem.source : "" + source: mainItem.imageSource ? mainItem.imageSource : "" fillMode: mainItem.fillMode sourceSize.width: width sourceSize.height: height diff --git a/Linphone/view/Item/Form/LoginForm.qml b/Linphone/view/Item/Form/LoginForm.qml index 60f8470f..4f734cca 100644 --- a/Linphone/view/Item/Form/LoginForm.qml +++ b/Linphone/view/Item/Form/LoginForm.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick import QtQuick.Layouts import QtQuick.Controls as Control import Linphone diff --git a/Linphone/view/Item/IconLabelButton.qml b/Linphone/view/Item/IconLabelButton.qml index b0cda556..345becda 100644 --- a/Linphone/view/Item/IconLabelButton.qml +++ b/Linphone/view/Item/IconLabelButton.qml @@ -22,7 +22,7 @@ MouseArea { Layout.preferredHeight: mainItem.iconSize width: mainItem.iconSize height: mainItem.iconSize - source: mainItem.iconSource + imageSource: mainItem.iconSource colorizationColor: mainItem.color } Text { diff --git a/Linphone/view/Item/Notification/NotificationReceivedCall.qml b/Linphone/view/Item/Notification/NotificationReceivedCall.qml index 61e6a1da..5b92d18d 100644 --- a/Linphone/view/Item/Notification/NotificationReceivedCall.qml +++ b/Linphone/view/Item/Notification/NotificationReceivedCall.qml @@ -73,7 +73,7 @@ Notification { Layout.preferredHeight: 40 * DefaultStyle.dp contentItem: EffectImage { colorizationColor: DefaultStyle.grey_0 - source: AppIcons.phone + imageSource: AppIcons.phone imageWidth: 24 * DefaultStyle.dp imageHeight: 24 * DefaultStyle.dp } @@ -88,7 +88,7 @@ Notification { Layout.preferredHeight: 40 * DefaultStyle.dp contentItem: EffectImage { colorizationColor: DefaultStyle.grey_0 - source: AppIcons.videoCamera + imageSource: AppIcons.videoCamera imageWidth: 24 * DefaultStyle.dp imageHeight: 24 * DefaultStyle.dp } @@ -109,7 +109,7 @@ Notification { Layout.preferredHeight: 40 * DefaultStyle.dp contentItem: EffectImage { colorizationColor: DefaultStyle.grey_0 - source: AppIcons.endCall + imageSource: AppIcons.endCall imageWidth: 24 * DefaultStyle.dp imageHeight: 24 * DefaultStyle.dp } diff --git a/Linphone/view/Item/TextInput.qml b/Linphone/view/Item/TextInput.qml index ea57e14b..bbe66c2b 100644 --- a/Linphone/view/Item/TextInput.qml +++ b/Linphone/view/Item/TextInput.qml @@ -1,6 +1,6 @@ import QtQuick import QtQuick.Controls as Control -import QtQuick.Layouts 1.0 +import QtQuick.Layouts import Linphone ColumnLayout { @@ -118,8 +118,7 @@ ColumnLayout { icon.source: eyeButton.checked ? AppIcons.eyeShow : AppIcons.eyeHide width: 20 * DefaultStyle.dp height: 20 * DefaultStyle.dp - anchors.top: parent.top - anchors.bottom: parent.bottom + anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 15 * DefaultStyle.dp } diff --git a/Linphone/view/Item/VerticalTabBar.qml b/Linphone/view/Item/VerticalTabBar.qml index 29d76be9..f24a24fe 100644 --- a/Linphone/view/Item/VerticalTabBar.qml +++ b/Linphone/view/Item/VerticalTabBar.qml @@ -65,7 +65,7 @@ Control.TabBar { EffectImage { id: buttonIcon property int buttonSize: 24 * DefaultStyle.dp - source: mainItem.currentIndex === index ? modelData.selectedIcon : modelData.icon + imageSource: mainItem.currentIndex === index ? modelData.selectedIcon : modelData.icon Layout.preferredWidth: buttonSize Layout.preferredHeight: buttonSize width: buttonSize diff --git a/Linphone/view/Page/Main/AbstractMainPage.qml b/Linphone/view/Page/Main/AbstractMainPage.qml index dcc2ff40..aee0d210 100644 --- a/Linphone/view/Page/Main/AbstractMainPage.qml +++ b/Linphone/view/Page/Main/AbstractMainPage.qml @@ -198,7 +198,7 @@ Item { Layout.alignment: Qt.AlignVCenter EffectImage { colorizationColor: DefaultStyle.grey_0 - source: mainItem.newItemIconSource + imageSource: mainItem.newItemIconSource width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp fillMode: Image.PreserveAspectFit diff --git a/Linphone/view/Page/Main/CallPage.qml b/Linphone/view/Page/Main/CallPage.qml index ac319f06..ae4820a9 100644 --- a/Linphone/view/Page/Main/CallPage.qml +++ b/Linphone/view/Page/Main/CallPage.qml @@ -82,7 +82,7 @@ AbstractMainPage { background: Item{} contentItem: RowLayout { EffectImage { - source: AppIcons.trashCan + imageSource: AppIcons.trashCan width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp @@ -533,7 +533,7 @@ AbstractMainPage { property string iconSource property color colorizationColor: DefaultStyle.main2_500main EffectImage { - source: iconLabel.iconSource + imageSource: iconLabel.iconSource width: 24 * DefaultStyle.dp height: 24 * DefaultStyle.dp Layout.preferredWidth: 24 * DefaultStyle.dp