2024-11-24 09:48:52 +00:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2024-12-16 08:38:04 +00:00
|
|
|
#include "flowlayout.h"
|
|
|
|
#include "sensorwidget.h"
|
|
|
|
#include "sensorservice.h"
|
|
|
|
#include "httpclient.h"
|
2024-12-28 17:15:48 +00:00
|
|
|
#include "alarmsservice.h"
|
|
|
|
#include "journalservice.h"
|
2024-12-16 08:38:04 +00:00
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
#include <QMainWindow>
|
2024-11-24 21:46:29 +00:00
|
|
|
#include <QPixmap>
|
|
|
|
#include <QVBoxLayout>
|
2024-12-28 17:15:48 +00:00
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QMap>
|
2024-11-24 21:46:29 +00:00
|
|
|
|
2024-11-28 18:34:00 +00:00
|
|
|
#ifdef Q_OS_WIN
|
2024-12-09 08:30:43 +00:00
|
|
|
#include <Qlabel>
|
2024-11-28 18:34:00 +00:00
|
|
|
#elif defined(Q_OS_LINUX)
|
2024-12-09 08:30:43 +00:00
|
|
|
#include <QLabel>
|
2024-11-28 18:34:00 +00:00
|
|
|
#endif
|
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2024-11-28 18:34:00 +00:00
|
|
|
struct TabImageData
|
|
|
|
{
|
2024-11-24 21:46:29 +00:00
|
|
|
QLabel *label;
|
|
|
|
QPixmap pixmap;
|
|
|
|
QSize originalSize;
|
|
|
|
};
|
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2024-12-28 17:15:48 +00:00
|
|
|
private slots:
|
|
|
|
void onIncidentsPageChanged(int page);
|
|
|
|
void onJournalPageChanged(int page);
|
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
public:
|
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::MainWindow *ui;
|
2024-11-24 21:46:29 +00:00
|
|
|
|
|
|
|
private:
|
2024-12-28 17:15:48 +00:00
|
|
|
AlarmsService *asr;
|
|
|
|
JournalService *jsr;
|
2024-12-16 08:38:04 +00:00
|
|
|
HttpClient *httpClient;
|
|
|
|
QWidget *widgetContainer;
|
|
|
|
FlowLayout *layout;
|
|
|
|
SensorService *sensorService;
|
2024-12-28 17:15:48 +00:00
|
|
|
QMap<QString, QString> nameToId;
|
2024-12-16 08:38:04 +00:00
|
|
|
|
2024-11-24 21:46:29 +00:00
|
|
|
|
|
|
|
private:
|
2024-12-28 17:15:48 +00:00
|
|
|
//COMMON------------------------------------------------------
|
|
|
|
void loadSenorsTree(QTreeWidget* tree);
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
//SENSOR------------------------------------------------------
|
2024-12-16 08:38:04 +00:00
|
|
|
//dialog windows
|
|
|
|
void showSensorDialog(SensorWidget *sensor);
|
|
|
|
void onSensorDialogFinished(int result);
|
|
|
|
//api requests
|
|
|
|
void loadSensors(const QString& group);
|
|
|
|
void loadSensorGroups();
|
2024-12-28 17:15:48 +00:00
|
|
|
//update widgets
|
2024-12-16 08:38:04 +00:00
|
|
|
void updateDisplayedWidgets();
|
|
|
|
void onSearchTextChanged(const QString &text);
|
|
|
|
void onGroupSelected(int index);
|
|
|
|
void onShowHiddenSelected(int index);
|
2024-12-28 17:15:48 +00:00
|
|
|
//utility
|
2024-12-16 08:38:04 +00:00
|
|
|
void startSensorTabRefreshTimer();
|
|
|
|
void SetupSensorTab();
|
2024-12-28 17:15:48 +00:00
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
//INCEDENTS---------------------------------------------------
|
|
|
|
//update widgets
|
|
|
|
void onSearchIncedentsTextChanged(const QString &text);
|
|
|
|
void onTreeIncidentsChanged(QTreeWidgetItem *item, int column);
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
//JOURNAL-----------------------------------------------------
|
|
|
|
//update widgets
|
|
|
|
void onSearchJournalTextChanged(const QString &text);
|
|
|
|
void onTreeJournalChanged(QTreeWidgetItem *item, int column);
|
|
|
|
//------------------------------------------------------------
|
2024-12-16 08:38:04 +00:00
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|