From d23824dd0e05b2028c24271f832bea7fd887b947 Mon Sep 17 00:00:00 2001 From: Rafael Bachmann Date: Thu, 17 Dec 2015 19:00:14 +0100 Subject: [PATCH 1/4] add error message when opening log file fails --- ground/gcs/src/app/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ground/gcs/src/app/main.cpp b/ground/gcs/src/app/main.cpp index c8260c953..5fce67c8d 100644 --- a/ground/gcs/src/app/main.cpp +++ b/ground/gcs/src/app/main.cpp @@ -209,6 +209,11 @@ inline QString msgSendArgumentFailed() "Unable to send command line arguments to the already running instance. It appears to be not responding."); } +inline QString msgLogfileOpenFailed() +{ + return QCoreApplication::translate("Application", "Failed to open log file"); +} + // Prepare a remote argument: If it is a relative file, add the current directory // since the the central instance might be running in a different directory. inline QString prepareRemoteArgument(const QString &arg) @@ -313,7 +318,8 @@ void logInit(QString fileName) logStream = new QTextStream(file); qInstallMessageHandler(mainMessageOutput); } else { - // TODO error popup + displayError(msgLogfileOpenFailed()); + } } From 142f8a9578a088f52893e1f8a6962867e670e958 Mon Sep 17 00:00:00 2001 From: Rafael Bachmann Date: Thu, 17 Dec 2015 19:12:09 +0100 Subject: [PATCH 2/4] add logfile name to error message. --- ground/gcs/src/app/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ground/gcs/src/app/main.cpp b/ground/gcs/src/app/main.cpp index 5fce67c8d..db01fbaab 100644 --- a/ground/gcs/src/app/main.cpp +++ b/ground/gcs/src/app/main.cpp @@ -209,9 +209,9 @@ inline QString msgSendArgumentFailed() "Unable to send command line arguments to the already running instance. It appears to be not responding."); } -inline QString msgLogfileOpenFailed() +inline QString msgLogfileOpenFailed(QString &fileName) { - return QCoreApplication::translate("Application", "Failed to open log file"); + return QCoreApplication::translate("Application", "Failed to open log file %1").arg(fileName); } // Prepare a remote argument: If it is a relative file, add the current directory @@ -318,7 +318,7 @@ void logInit(QString fileName) logStream = new QTextStream(file); qInstallMessageHandler(mainMessageOutput); } else { - displayError(msgLogfileOpenFailed()); + displayError(msgLogfileOpenFailed(fileName)); } } From f5c23ba32d898e76e7bf0d0038fe6422b1cc4caa Mon Sep 17 00:00:00 2001 From: Rafael Bachmann Date: Sat, 19 Dec 2015 13:48:54 +0100 Subject: [PATCH 3/4] const-correct msgLogfileOpenFailed() --- ground/gcs/src/app/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/gcs/src/app/main.cpp b/ground/gcs/src/app/main.cpp index db01fbaab..004678383 100644 --- a/ground/gcs/src/app/main.cpp +++ b/ground/gcs/src/app/main.cpp @@ -209,7 +209,7 @@ inline QString msgSendArgumentFailed() "Unable to send command line arguments to the already running instance. It appears to be not responding."); } -inline QString msgLogfileOpenFailed(QString &fileName) +inline QString msgLogfileOpenFailed(const QString &fileName) { return QCoreApplication::translate("Application", "Failed to open log file %1").arg(fileName); } From 605374f492d96f39325ed5df71907161a132960d Mon Sep 17 00:00:00 2001 From: Rafael Bachmann Date: Sat, 19 Dec 2015 13:52:25 +0100 Subject: [PATCH 4/4] uncrustify --- ground/gcs/src/app/main.cpp | 1 - ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ground/gcs/src/app/main.cpp b/ground/gcs/src/app/main.cpp index 004678383..a200f8abd 100644 --- a/ground/gcs/src/app/main.cpp +++ b/ground/gcs/src/app/main.cpp @@ -319,7 +319,6 @@ void logInit(QString fileName) qInstallMessageHandler(mainMessageOutput); } else { displayError(msgLogfileOpenFailed(fileName)); - } } diff --git a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp index 2ff76a829..33a52cc9d 100644 --- a/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp +++ b/ground/uavobjgenerator/generators/gcs/uavobjectgeneratorgcs.cpp @@ -614,7 +614,7 @@ bool UAVObjectGeneratorGCS::process_object(ObjectInfo *object) ctxt.object = object; ctxt.registerImpl += ::generate(ctxt, - " qmlRegisterType<:ClassName>(\"%1.:ClassName\", 1, 0, \":ClassName\");\n").arg("UAVTalk"); + " qmlRegisterType<:ClassName>(\"%1.:ClassName\", 1, 0, \":ClassName\");\n").arg("UAVTalk"); for (int n = 0; n < object->fields.length(); ++n) { FieldInfo *field = object->fields[n];