Add application info at the start.
Add file position on logs. Add Avatar provider to nitifications. Fix using `source` on EffectImage that shouldn't be used as an image source because this property is for Loader (ImageProviders cannot be used in this case).
This commit is contained in:
parent
fb4ee6b579
commit
f7749a30e3
23 changed files with 92 additions and 49 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
void init();
|
||||
void init(const std::shared_ptr<linphone::Config> &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<linphone::LoggingService> &,
|
||||
const std::string &domain,
|
||||
linphone::LogLevel level,
|
||||
|
|
|
|||
|
|
@ -314,4 +314,29 @@ int Utils::getRandomIndex(int size) {
|
|||
|
||||
void Utils::copyToClipboard(const QString &text) {
|
||||
QApplication::clipboard()->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
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<linphone::Config> &config
|
||||
return QStringLiteral("%1 (%2) %3 Qt/%4 LinphoneSDK")
|
||||
.arg(Utils::getApplicationProduct())
|
||||
.arg(SettingsModel::getDeviceName(config).replace('\\', "\\\\").replace('(', "\\(").replace(')', "\\)"))
|
||||
.arg(Utils::getOsProduct())
|
||||
.arg(qVersion());
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<QString, QString> &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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Control
|
||||
import Linphone
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue