From 61b4ee3b8f1d4c5d85b7a561551167fa41b12400 Mon Sep 17 00:00:00 2001 From: Daniel Teichmann Date: Tue, 6 Jul 2021 20:04:48 +0200 Subject: Tidy up some debug statements or long strings --- src/Toast.qml | 1 - src/main.cpp | 14 +++++++------- src/main.qml | 9 +++++++-- src/scenes/Scene_placeholder.qml | 2 +- src/session.cpp | 18 +++++++++++++----- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/Toast.qml b/src/Toast.qml index a427d10..60e238c 100644 --- a/src/Toast.qml +++ b/src/Toast.qml @@ -58,7 +58,6 @@ Control { else { time = defaultTime; } - console.log("Showing a new toast with display time: " + time); animation.start(); } diff --git a/src/main.cpp b/src/main.cpp index 213a591..3339840 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,12 +55,12 @@ int main(int argc, char *argv[]) { tmpDir.mkpath("."); } QLockFile lockFile(tmpFilePath); - qDebug() << "Checking for a lockfile at: " + tmpFilePath; + qDebug().noquote() << QString("Checking for a lockfile at: '%0'").arg(tmpFilePath); if(!lockFile.tryLock(100)){ - qDebug() << QObject::tr("You already have this app running."); - qDebug() << QObject::tr("Only one instance is allowed."); - qDebug() << QObject::tr("Closing application now with an error."); + qDebug().noquote() << "You already have this app running.\n" + << "Only one instance is allowed.\n" + << "Closing application now with an error."; return 1; } @@ -71,12 +71,12 @@ int main(int argc, char *argv[]) { QQuickStyle::setStyle("Material"); QTranslator translator; - qDebug() << "Loading locale: qrc:/locales/bin/" + QLocale::system().name(); + qDebug().noquote() << QString("Locales: Loading locale: qrc:/locales/bin/%0").arg(QLocale::system().name()); if(translator.load(":/locales/bin/" + QLocale::system().name())) { app.installTranslator(&translator); - qDebug() << "Loaded: " + QLocale::system().name() + " locale!"; + qDebug().noquote() << "Locales: Loaded: " + QLocale::system().name() + " locale!"; } else { - qDebug() << "Unable to load translation"; + qWarning() << "Locales: Unable to load translation!"; } QQmlApplicationEngine engine(&app); diff --git a/src/main.qml b/src/main.qml index a9bbed7..3574a8c 100644 --- a/src/main.qml +++ b/src/main.qml @@ -32,7 +32,6 @@ import QtQuick.Controls.Styles 1.4 import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.3 import "scenes" as Scenes -//import "ListItem.qml" /*! The main.qml file contains the window, with its header, sidebar, toast and main_content. @@ -59,7 +58,7 @@ ApplicationWindow { function minimizeWindow() { showMinimized(); - console.log("Miniming window now..."); + console.log("Minimizing window now..."); } function showWindow() { @@ -225,6 +224,7 @@ ApplicationWindow { VisualItemModel { id: mainModel + ListItem { text: " " + qsTr("Remote Control") scene_url: "scenes/Scene_remote_control.qml" @@ -362,3 +362,8 @@ ApplicationWindow { } } } + +/*##^## Designer { + D{i:14;anchors_width:650} +} + ##^##*/ diff --git a/src/scenes/Scene_placeholder.qml b/src/scenes/Scene_placeholder.qml index a5ceac9..29e15a9 100644 --- a/src/scenes/Scene_placeholder.qml +++ b/src/scenes/Scene_placeholder.qml @@ -43,7 +43,7 @@ Item { anchors.right: parent.right wrapMode: Text.WordWrap - text: qsTr("The feature you expected here are not yet implemented.") + text: qsTr("The features you expected here are not yet implemented.") horizontalAlignment: Text.AlignHCenter } } diff --git a/src/session.cpp b/src/session.cpp index 4640786..14b6575 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -158,7 +158,8 @@ void Session::setStatus(QString status) { emit _main_gui->showWindow(); - _main_gui->showToast(tr("Remote Support session was stopped ungracefully"), 5000); + _main_gui->showToast(tr("Remote Support session was " + "stopped ungracefully"), 5000); } else if (status == "stopped") { /* Session is stopped */ guiString = tr("Remote Support session was stopped"); @@ -183,24 +184,29 @@ void Session::setStatus(QString status) { guiString = tr("Remote Support session couldn't be started!"); _main_gui->setStatusIndicator(true, QColor(255, 0, 0, 127)); - _main_gui->showToast(tr("An error occured while trying to start a session!"), 5000); + _main_gui->showToast(tr("An error occured while trying " + "to start a session!"), 5000); } else if (status == "start_session_success") { /* Session successfully started */ guiString = tr("Remote Support session successfully started!"); _main_gui->setStatusIndicator(true, QColor(255, 255, 0, 127)); - _main_gui->showToast(tr("Session was started successfully")); + _main_gui->showToast(QString(tr("Session was started " + "on '%0' successfully")) + .arg(_host->alias())); } else if (status == "status_session_error") { /* Session's status couldn't be refreshed */ _main_gui->showToast(tr("Session status could not be refreshed!"), 5000); - guiString = tr("Session status could not be refreshed!") + "\n" + tr("remote support partner could still be connected!"); + guiString = tr("Session status could not be refreshed!") + "\n" + + tr("remote support partner could still be connected!"); _main_gui->setStatusIndicator(true, QColor(255, 0, 0, 127)); emit _main_gui->showWindow(); } else if (status == "stop_session_error") { /* Session couldn't be stopped */ _main_gui->showToast(tr("Session could not be stopped!"), 5000); - guiString = tr("Session could not be stopped!") + "\n" + tr("remote support partner could still be connected!"); + guiString = tr("Session could not be stopped!") + "\n" + + tr("remote support partner could still be connected!"); _main_gui->setStatusIndicator(true, QColor(255, 0, 0, 127)); emit _main_gui->showWindow(); @@ -353,6 +359,8 @@ void Session::status_response(QJsonDocument *doc) { this->setStatus(new_status); if (this->isSessionAliveOrRunning(new_status)) { + qDebug() << "Session is still alive or running. -> Restarting the status timer."; + // Ask status every 1000 millisecond QTimer::singleShot(1000, this, &Session::statusTimerEvent); } -- cgit v1.2.3