[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / simulation / simulatormainwindow.h
blobe6e6be10fa14177e7eb14ed8f086d59e0b957000
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef SIMULATORMAINWINDOW_H
22 #define SIMULATORMAINWINDOW_H
24 #include "simulator.h"
26 #include <QDockWidget>
27 #include <QFile>
28 #include <QMainWindow>
29 #include <QThread>
31 class DebugOutput;
32 class RadioData;
33 class RadioOutputsWidget;
34 class SimulatorWidget;
35 class SimulatorInterface;
36 class TrainerSimulator;
37 class TelemetrySimulator;
39 class QKeySequence;
41 namespace Ui {
42 class SimulatorMainWindow;
45 using namespace Simulator;
47 class SimulatorMainWindow : public QMainWindow
49 Q_OBJECT
51 public:
52 explicit SimulatorMainWindow(QWidget * parent, const QString & firmwareId = "", quint8 flags=0, Qt::WindowFlags wflags = Qt::WindowFlags());
53 ~SimulatorMainWindow();
55 int getExitStatus(QString * msg = Q_NULLPTR);
56 bool setRadioData(RadioData * radioData);
57 bool useTempDataPath(bool deleteOnClose = true);
58 bool setOptions(SimulatorOptions & options, bool withSave = true);
59 virtual QMenu * createPopupMenu();
61 public slots:
62 virtual void show();
63 void start();
64 void showMenuBar(bool show);
65 void showRadioFixedSize(Qt::Orientation orientation, bool fixed);
66 void showRadioFixedWidth(bool fixed);
67 void showRadioFixedHeight(bool fixed);
68 void showRadioDocked(bool dock);
70 signals:
71 void simulatorStart();
72 void simulatorRestart();
74 protected slots:
75 virtual void closeEvent(QCloseEvent *);
76 virtual void changeEvent(QEvent *e);
77 void restoreUiState();
78 void saveUiState();
79 void toggleMenuBar(bool show);
80 void setRadioSizePolicy(int fixType);
81 void toggleRadioDocked(bool dock);
82 void openJoystickDialog(bool);
83 void showHelp(bool show);
85 protected:
86 void createDockWidgets();
87 void addTool(QDockWidget * widget, Qt::DockWidgetArea area, QIcon icon = QIcon(), QKeySequence shortcut = QKeySequence());
89 SimulatorInterface * m_simulator;
91 Ui::SimulatorMainWindow * ui;
92 SimulatorWidget * m_simulatorWidget;
93 DebugOutput * m_consoleWidget;
94 RadioOutputsWidget * m_outputsWidget;
96 QDockWidget * m_simulatorDockWidget;
97 QDockWidget * m_consoleDockWidget;
98 QDockWidget * m_telemetryDockWidget;
99 QDockWidget * m_trainerDockWidget;
100 QDockWidget * m_outputsDockWidget;
102 QThread simuThread;
103 QFile m_simuLogFile;
104 QVector<keymapHelp_t> m_keymapHelp;
105 QString m_simulatorId;
106 QString m_exitStatusMsg;
107 int m_exitStatusCode;
108 int m_radioProfileId;
109 int m_radioSizeConstraint;
110 bool m_firstShow;
111 bool m_showRadioDocked;
112 bool m_showMenubar;
114 const static quint16 m_savedUiStateVersion;
117 #endif // SIMULATORMAINWINDOW_H