PNP_PIbd-31_Rodionov_I_A_Co.../mainwindow.h
2024-12-24 18:13:22 +04:00

98 lines
2.6 KiB
C++

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QCloseEvent>
#include <QDialog>
#include <QButtonGroup>
#include <QScreen>
#include <QListWidget>
#include <QToolTip>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QTextStream>
#include <QFile>
#include "apiclient.h"
#include "models/types.h" // IWYU pragma: keep
#include "models/filterparams.h"
#include "utils/buttonhoverwatcher.h" // IWYU pragma: keep
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void setClient(ApiClient *newClient);
void setMapLocations(const QMap<int, Location> &newMapLocations);
void setMapDepartments(const QMap<int, Department> &newMapDepartments);
void setMapManufacturers(const QMap<int, Manufacturer> &newMapManufacturers);
void setMapDeviceTypes(const QMap<int, DeviceType> &newMapDeviceTypes);
QMap<int, DeviceModel> getMapDeviceModels() const;
void setMapDeviceModels(const QMap<int, DeviceModel> &newMapDeviceModels);
void setMapDevices(const QMap<int, Device> &newMapDevices);
private:
template <typename T>
void fillTable(const QMap<int, T> &map);
void updateListWidgetDevices(int entityId);
QWidget* createMessageEmptyCard();
QWidget* createDeviceCard(const Device &device);
void addDeviceToList(const Device &device);
void returnToDeviceList();
void showTableWithStructureElements(const QList<DeviceStructureElement>& elements);
void showTableWithDeviceModelCharacteristics(const DeviceModel& model);
void clearFilters();
void clearDevicesOutputSettings();
int getSelectedIndex();
private slots:
void updateTableWidget(int index);
void updateListWidget();
void showItemInfo(QListWidgetItem*);
void changeSortOrder();
void pushButtonBackClicked();
void pushButtonClearClicked();
void pushButtonSearchClicked();
void pushButtonApplyFiltersClicked();
void pushButtonCancelFiltersClicked();
void pushButtonStructureClicked();
void pushButtonCharacteristicsClicked();
void pushButtonDefaultClicked();
private:
Ui::MainWindow *ui;
ApiClient *client;
QString searchInfo = "";
FilterParams filterParams;
int idCard = 0;
QMap<int, QString> deviceTypeImages;
QMap<int, Location> mapLocations;
QMap<int, Department> mapDepartments;
QMap<int, Manufacturer> mapManufacturers;
QMap<int, DeviceType> mapDeviceTypes;
QMap<int, DeviceModel> mapDeviceModels;
QMap<int, Device> mapDevices;
};
#endif // MAINWINDOW_H