[Companion] Add optional logging of all debug output. (#4974)

* [AppDebugMessageHandler] Add ability to write debug output to any number of QIODevices.

* [Simulator][DebugOutput] Use new QIODevice hook in AppDebugMessageHandler instead of signal/slot.

* [AppData] Add new settings for debug logging; Refactor property creation macro to work with any data type and add varName_init() method to set default; Refactor all boolean settings to use new macro (others to be migrated later).

* [AppPreferencesDialog] Add UI for appDebugLog, fwTraceLog, & appLogsDir settings; Clean up layout on application prefs. tab, move and re-label a couple items.

* [Companion][Simulator] Enable optional application debug output logging.

* [Simulator] Enable optional logging of firmware debug output to file.

* [EEPROMInterface] Use qDebug() instead of std::cout so that now all debug output can be routed via custom message handler/logger.

* [Companion][Simulator] Add missing #include.
This commit is contained in:
Max Paperno
2017-06-10 23:33:03 +02:00
committed by Bertrand Songis
parent 2e4775b19a
commit f50ee3fb39
16 changed files with 680 additions and 498 deletions
+19 -37
View File
@@ -460,16 +460,6 @@ QString AppData::libDir() { return _libDir; }
QString AppData::snapshotDir() { return _snapshotDir; }
QString AppData::updatesDir() { return _updatesDir; }
bool AppData::jsSupport() { return _jsSupport; }
bool AppData::maximized() { return _maximized; }
bool AppData::showSplash() { return _showSplash; }
bool AppData::snapToClpbrd() { return _snapToClpbrd; }
bool AppData::autoCheckApp() { return _autoCheckApp; }
bool AppData::autoCheckFw() { return _autoCheckFw; }
bool AppData::simuSW() { return _simuSW; }
bool AppData::tabbedMdi() { return _tabbedMdi; }
bool AppData::removeModelSlots() { return _remvModelSlots; }
int AppData::newModelAction() { return _newModelAction; }
int AppData::backLight() { return _backLight; }
int AppData::embedSplashes() { return _embedSplashes; }
@@ -517,16 +507,6 @@ void AppData::libDir (const QString x) { store(x, _libDir,
void AppData::snapshotDir (const QString x) { store(x, _snapshotDir, "snapshotpath" );}
void AppData::updatesDir (const QString x) { store(x, _updatesDir, "lastUpdatesDir" );}
void AppData::maximized (const bool x) { store(x, _maximized, "maximized" );}
void AppData::jsSupport (const bool x) { store(x, _jsSupport, "js_support" );}
void AppData::showSplash (const bool x) { store(x, _showSplash, "show_splash" );}
void AppData::snapToClpbrd (const bool x) { store(x, _snapToClpbrd, "snapshot_to_clipboard" );}
void AppData::autoCheckApp (const bool x) { store(x, _autoCheckApp, "startup_check_companion" );}
void AppData::autoCheckFw (const bool x) { store(x, _autoCheckFw, "startup_check_fw" );}
void AppData::simuSW (const bool x) { store(x, _simuSW, "simuSW" );}
void AppData::tabbedMdi (const bool x) { store(x, _tabbedMdi, "tabbedMdi" );}
void AppData::removeModelSlots(const bool x) { store(x, _remvModelSlots, "removeModelSlots" );}
void AppData::newModelAction (const int x) { store(x, _newModelAction, "newModelAction" );}
void AppData::backLight (const int x) { store(x, _backLight, "backLight" );}
void AppData::embedSplashes (const int x) { store(x, _embedSplashes, "embedded_splashes" );}
@@ -610,24 +590,26 @@ void AppData::init()
getset( _libDir, "libraryPath" ,"" );
getset( _snapshotDir, "snapshotpath" ,"" );
getset( _updatesDir, "lastUpdatesDir" ,"" );
appLogsDir_init();
getset( _enableBackup, "enableBackup" ,false );
getset( _backupOnFlash, "backupOnFlash" ,true );
getset( _outputDisplayDetails, "outputDisplayDetails" ,false );
getset( _checkHardwareCompatibility, "checkHardwareCompatibility" ,true );
getset( _useCompanionNightlyBuilds, "useCompanionNightlyBuilds" ,false );
getset( _useFirmwareNightlyBuilds, "useFirmwareNightlyBuilds" ,false );
getset( _jsSupport, "js_support" ,false );
getset( _maximized, "maximized" ,false );
getset( _showSplash, "show_splash" ,true );
getset( _snapToClpbrd, "snapshot_to_clipboard" ,false );
getset( _autoCheckApp, "startup_check_companion" ,true );
getset( _autoCheckFw, "startup_check_fw" ,true );
getset( _simuSW, "simuSW" ,false );
getset( _tabbedMdi, "tabbedMdi" ,false );
getset( _remvModelSlots, "removeModelSlots" ,true );
// booleans
enableBackup_init();
backupOnFlash_init();
outputDisplayDetails_init();
checkHardwareCompatibility_init();
useCompanionNightlyBuilds_init();
useFirmwareNightlyBuilds_init();
removeModelSlots_init();
maximized_init();
simuSW_init();
tabbedMdi_init();
appDebugLog_init();
fwTraceLog_init();
jsSupport_init();
showSplash_init();
snapToClpbrd_init();
autoCheckApp_init();
autoCheckFw_init();
getset( _newModelAction, "newModelAction" ,1 );
getset( _backLight, "backLight" ,0 );
+28 -40
View File
@@ -29,6 +29,7 @@
#include <QStringList>
#include <QString>
#include <QSettings>
#include <QStandardPaths>
#include "simulator.h"
@@ -226,21 +227,37 @@ class Profile: protected CompStoreObj
QString groupId();
};
#define BOOL_PROPERTY(name, dflt) \
#define PROPERTY4(type, name, key, dflt) \
public: \
inline bool name() { return _ ## name; } \
void name(const bool val) { store(val, _ ## name, # name); } \
inline type name() { return _ ## name; } \
void name(const type val) { store(val, _ ## name, # key); } \
private: \
bool _ ## name;
void name ## _init() { getset(_ ## name, # key, dflt); } \
type _ ## name;
#define PROPERTY(type, name, dflt) PROPERTY4(type, name, name, dflt)
class AppData: protected CompStoreObj
{
BOOL_PROPERTY(enableBackup, false)
BOOL_PROPERTY(backupOnFlash, true)
BOOL_PROPERTY(outputDisplayDetails, false)
BOOL_PROPERTY(checkHardwareCompatibility, true)
BOOL_PROPERTY(useCompanionNightlyBuilds, false)
BOOL_PROPERTY(useFirmwareNightlyBuilds, false)
PROPERTY(bool, enableBackup, false)
PROPERTY(bool, backupOnFlash, true)
PROPERTY(bool, outputDisplayDetails, false)
PROPERTY(bool, checkHardwareCompatibility, true)
PROPERTY(bool, useCompanionNightlyBuilds, false)
PROPERTY(bool, useFirmwareNightlyBuilds, false)
PROPERTY(bool, removeModelSlots, true)
PROPERTY(bool, maximized, false)
PROPERTY(bool, simuSW, false)
PROPERTY(bool, tabbedMdi, false)
PROPERTY(bool, appDebugLog, false)
PROPERTY(bool, fwTraceLog, false)
PROPERTY4(bool, jsSupport, js_support ,false)
PROPERTY4(bool, showSplash, show_splash ,true)
PROPERTY4(bool, snapToClpbrd, snapshot_to_clipboard ,false)
PROPERTY4(bool, autoCheckApp, startup_check_companion ,true)
PROPERTY4(bool, autoCheckFw, startup_check_fw ,true)
// All the global variables
public:
@@ -280,16 +297,7 @@ class AppData: protected CompStoreObj
QString _libDir;
QString _snapshotDir;
QString _updatesDir;
bool _maximized;
bool _jsSupport;
bool _showSplash;
bool _snapToClpbrd;
bool _autoCheckApp;
bool _autoCheckFw;
bool _simuSW;
bool _tabbedMdi;
bool _remvModelSlots;
PROPERTY(QString, appLogsDir, QString(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) % "/" COMPANY "/DebugLogs"))
int _newModelAction; // 0=no action; 1=model wizard; 2=model edit
int _backLight;
@@ -341,16 +349,6 @@ class AppData: protected CompStoreObj
QString snapshotDir();
QString updatesDir();
bool jsSupport();
bool maximized();
bool showSplash();
bool snapToClpbrd();
bool autoCheckApp();
bool autoCheckFw();
bool simuSW();
bool tabbedMdi();
bool removeModelSlots();
int newModelAction();
int backLight();
int embedSplashes();
@@ -399,16 +397,6 @@ class AppData: protected CompStoreObj
void snapshotDir (const QString);
void updatesDir (const QString);
void maximized (const bool);
void jsSupport (const bool);
void showSplash (const bool);
void snapToClpbrd (const bool);
void autoCheckApp (const bool);
void autoCheckFw (const bool);
void simuSW (const bool);
void tabbedMdi (const bool);
void removeModelSlots(const bool);
void newModelAction (const int);
void backLight (const int);
void embedSplashes (const int);