* [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.
118 lines
3.2 KiB
C++
118 lines
3.2 KiB
C++
/*
|
|
* Copyright (C) OpenTX
|
|
*
|
|
* Based on code named
|
|
* th9x - http://code.google.com/p/th9x
|
|
* er9x - http://code.google.com/p/er9x
|
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
|
*
|
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef SIMULATORMAINWINDOW_H
|
|
#define SIMULATORMAINWINDOW_H
|
|
|
|
#include "simulator.h"
|
|
|
|
#include <QDockWidget>
|
|
#include <QFile>
|
|
#include <QMainWindow>
|
|
#include <QThread>
|
|
|
|
class DebugOutput;
|
|
class RadioData;
|
|
class RadioOutputsWidget;
|
|
class SimulatorWidget;
|
|
class SimulatorInterface;
|
|
class TrainerSimulator;
|
|
class TelemetrySimulator;
|
|
|
|
class QKeySequence;
|
|
|
|
namespace Ui {
|
|
class SimulatorMainWindow;
|
|
}
|
|
|
|
using namespace Simulator;
|
|
|
|
class SimulatorMainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SimulatorMainWindow(QWidget * parent, const QString & firmwareId = "", quint8 flags=0, Qt::WindowFlags wflags = Qt::WindowFlags());
|
|
~SimulatorMainWindow();
|
|
|
|
int getExitStatus(QString * msg = Q_NULLPTR);
|
|
bool setRadioData(RadioData * radioData);
|
|
bool useTempDataPath(bool deleteOnClose = true);
|
|
bool setOptions(SimulatorOptions & options, bool withSave = true);
|
|
virtual QMenu * createPopupMenu();
|
|
|
|
public slots:
|
|
virtual void show();
|
|
void start();
|
|
void showMenuBar(bool show);
|
|
void showRadioFixedSize(Qt::Orientation orientation, bool fixed);
|
|
void showRadioFixedWidth(bool fixed);
|
|
void showRadioFixedHeight(bool fixed);
|
|
void showRadioDocked(bool dock);
|
|
|
|
signals:
|
|
void simulatorStart();
|
|
void simulatorRestart();
|
|
|
|
protected slots:
|
|
virtual void closeEvent(QCloseEvent *);
|
|
virtual void changeEvent(QEvent *e);
|
|
void restoreUiState();
|
|
void saveUiState();
|
|
void toggleMenuBar(bool show);
|
|
void setRadioSizePolicy(int fixType);
|
|
void toggleRadioDocked(bool dock);
|
|
void openJoystickDialog(bool);
|
|
void showHelp(bool show);
|
|
|
|
protected:
|
|
void createDockWidgets();
|
|
void addTool(QDockWidget * widget, Qt::DockWidgetArea area, QIcon icon = QIcon(), QKeySequence shortcut = QKeySequence());
|
|
|
|
SimulatorInterface * m_simulator;
|
|
|
|
Ui::SimulatorMainWindow * ui;
|
|
SimulatorWidget * m_simulatorWidget;
|
|
DebugOutput * m_consoleWidget;
|
|
RadioOutputsWidget * m_outputsWidget;
|
|
|
|
QDockWidget * m_simulatorDockWidget;
|
|
QDockWidget * m_consoleDockWidget;
|
|
QDockWidget * m_telemetryDockWidget;
|
|
QDockWidget * m_trainerDockWidget;
|
|
QDockWidget * m_outputsDockWidget;
|
|
|
|
QThread simuThread;
|
|
QFile m_simuLogFile;
|
|
QVector<keymapHelp_t> m_keymapHelp;
|
|
QString m_simulatorId;
|
|
QString m_exitStatusMsg;
|
|
int m_exitStatusCode;
|
|
int m_radioProfileId;
|
|
int m_radioSizeConstraint;
|
|
bool m_firstShow;
|
|
bool m_showRadioDocked;
|
|
bool m_showMenubar;
|
|
|
|
const static quint16 m_savedUiStateVersion;
|
|
};
|
|
|
|
#endif // SIMULATORMAINWINDOW_H
|