8 #ifndef FCF_GUI_MAINWINDOW_HPP_
9 #define FCF_GUI_MAINWINDOW_HPP_
12 #include <QMainWindow>
23 #include <mal/Cii.hpp>
24 #include <mal/Mal.hpp>
25 #include <mal/utility/LoadMal.hpp>
26 #include <mal/rr/qos/ReplyTime.hpp>
29 #include <utils/bat/dbInterface.hpp>
31 #include <yaml-cpp/yaml.h>
34 #include <QCloseEvent>
35 #include <QApplication>
86 OverrideCursor(Qt::CursorShape shape = Qt::WaitCursor)
88 QApplication::setOverrideCursor(shape);
93 QApplication::restoreOverrideCursor();
100 int polling_interval);
115 void on_actionExit_triggered();
118 void on_actionInit_triggered();
119 void on_actionEnable_triggered();
120 void on_actionDisable_triggered();
121 void on_actionRecover_triggered();
122 void on_actionReset_triggered();
123 void on_actionLogError_triggered() { SetFcsLogLevel(
"ERROR"); };
124 void on_actionLogInfo_triggered() { SetFcsLogLevel(
"INFO"); };
125 void on_actionLogDebug_triggered() { SetFcsLogLevel(
"DEBUG"); };
126 void on_actionLogTrace_triggered() { SetFcsLogLevel(
"TRACE"); };
129 void on_actionSelect_All_triggered();
130 void on_actionDeselect_All_triggered();
131 void on_actionDevReset_triggered();
132 void on_actionDevInit_triggered();
133 void on_actionDevEnable_triggered();
134 void on_actionDevDisable_triggered();
135 void on_actionDevSimulate_triggered();
136 void on_actionDevStopSim_triggered();
137 void on_actionDevIgnore_triggered();
138 void on_actionDevStopIgn_triggered();
141 void on_actionLoadLayout_triggered();
142 void on_actionSaveLayout_triggered();
143 void on_actionResetLayout_triggered();
146 void on_actionFCF_CLI_triggered();
149 void on_actionAbout_triggered();
150 void on_actionWhatsthis_triggered();
153 void handleSetupButton();
154 void handleDeviceSetup(QString name);
155 void handleStopButton();
156 void addLogEntry(
const QString&
type,
158 const QString& text);
159 void updateWindowState();
162 void CreateMalInterfaces(
const QString uri);
163 void GetServerConfiguration();
164 void CreateDbClient();
165 void CreateDeviceWidgets();
167 const std::string& devtype,
168 const std::string& server_id,
170 std::vector<std::string> selectedDevices(MainWindow::Page page = MainWindow::All)
const;
171 void SetFcsLogLevel(
const std::string &level);
173 template <
class WorkerType>
174 void StartInThread(WorkerType* worker)
176 QThread* thread =
new QThread;
177 worker->moveToThread(thread);
178 QObject::connect(thread, &QThread::started, worker, &WorkerType::process);
179 QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater);
180 QObject::connect(worker, &WorkerType::finished, thread, &QThread::quit);
181 QObject::connect(worker, &WorkerType::finished, worker, &WorkerType::deleteLater);
182 QObject::connect(worker, &WorkerType::LogReplyOut,
183 this, &MainWindow::addLogEntry,
184 Qt::QueuedConnection);
189 void WriteSettings()
const;
192 void OnStateCurrentChanged(
const StateEnum& state);
195 static const QString org_name;
196 static const QString app_name;
197 static const int update_ms;
198 static const QString lamp_type;
199 static const QString shutter_type;
200 static const QString motor_type;
201 static const QString iodev_type;
202 static const QString drot_type;
203 static const QString adc_type;
204 static const QString piezo_type;
205 static const QString actuator_type;
206 static const QString smaract_type;
207 static const QString msm_type;
209 using WdgInfo = std::tuple<std::string, MainWindow::Page, AbstractDevice*>;
210 using WdgInfoVec = std::vector<WdgInfo>;
214 QLabel* m_server_connection_label;
219 std::unique_ptr<utils::bat::DbInterface> m_oldb;
220 std::shared_ptr<::elt::mal::Mal> m_mal_instance;
221 std::shared_ptr<::stdif::StdCmdsSync> m_mal_std;
222 std::shared_ptr<::fcfif::AppCmdsSync> m_mal_client;
223 elt::mal::Mal::Properties m_mal_properties;
224 elt::mal::Uri m_mal_uri;
225 elt::mal::Uri m_mal_uri2;
226 elt::mal::rr::ListenerRegistration m_connection_listener;
229 #endif // FCF_GUI_MAINWINDOW_HPP_