PNP_PIbd-31_Rodionov_I_A_Co.../mainwindow.h

95 lines
2.6 KiB
C
Raw Normal View History

2024-12-24 18:13:22 +04:00
#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);
private:
template <typename T>
void fillTable(const QMap<int, T> &map);
2025-01-14 21:33:47 +04:00
void fillListWidget(const QList<Device> &devices);
void updateDevices(int entityId);
2024-12-24 18:13:22 +04:00
QWidget* createMessageEmptyCard();
QWidget* createDeviceCard(const Device &device);
2025-01-14 21:33:47 +04:00
QString normalizeTypeName(const QString &name);
void addMessageEmptyToList();
2024-12-24 18:13:22 +04:00
void addDeviceToList(const Device &device);
void returnToDeviceList();
void showTableWithStructureElements(const QList<DeviceStructureElement>& elements);
void showTableWithDeviceModelCharacteristics(const DeviceModel& model);
2025-01-14 21:33:47 +04:00
void clearSpinBoxes();
2024-12-24 18:13:22 +04:00
void clearFilters();
void clearDevicesOutputSettings();
2025-01-14 21:33:47 +04:00
int getSelectedElementId();
QMap<int, Device> getDevicesMap(const QList<Device> &devices);
2024-12-24 18:13:22 +04:00
private slots:
void updateTableWidget(int index);
void updateListWidget();
void showItemInfo(QListWidgetItem*);
void changeSortOrder();
2025-01-14 21:33:47 +04:00
2024-12-24 18:13:22 +04:00
void pushButtonBackClicked();
void pushButtonClearClicked();
void pushButtonSearchClicked();
2025-01-14 21:33:47 +04:00
void pushButtonDisregardPriceClicked();
2024-12-24 18:13:22 +04:00
void pushButtonApplyFiltersClicked();
void pushButtonCancelFiltersClicked();
void pushButtonStructureClicked();
void pushButtonCharacteristicsClicked();
void pushButtonDefaultClicked();
2025-01-14 21:33:47 +04:00
void onDevicesReceived(const QList<Device> &devices);
void onDepartmentsReceived(const QMap<int, Department> &departments);
void onDeviceModelsReceived(const QMap<int, DeviceModel> &deviceModels);
void onDeviceTypesReceived(const QMap<int, DeviceType> &deviceTypes);
void onManufacturersReceived(const QMap<int, Manufacturer> &manufacturers);
void onLocationsReceived(const QMap<int, Location> &locations);
2024-12-24 18:13:22 +04:00
private:
Ui::MainWindow *ui;
2025-01-14 21:33:47 +04:00
ApiClient *_client;
2024-12-24 18:13:22 +04:00
2025-01-14 21:33:47 +04:00
QString _searchInfo = "";
FilterParams _filterParams;
2024-12-24 18:13:22 +04:00
2025-01-14 21:33:47 +04:00
bool _initialTypesLoad = true;
int _idCard = 0;
2024-12-24 18:13:22 +04:00
2025-01-14 21:33:47 +04:00
QMap<int, QString> _deviceTypeImages;
2024-12-24 18:13:22 +04:00
2025-01-14 21:33:47 +04:00
QMap<int, Device> _mapDevices;
2024-12-24 18:13:22 +04:00
};
#endif // MAINWINDOW_H