58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
#ifndef RACKPAGE_H
|
|
#define RACKPAGE_H
|
|
|
|
#include "../models/tray.h"
|
|
|
|
#include <QList>
|
|
#include <QVector>
|
|
#include <QWidget>
|
|
|
|
class QLabel;
|
|
class QButtonGroup;
|
|
class QResizeEvent;
|
|
class SquareTrayButton;
|
|
struct DeviceStatus;
|
|
|
|
namespace Ui { class RackPage; }
|
|
|
|
class RackPage : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit RackPage(QWidget *parent = nullptr);
|
|
~RackPage();
|
|
|
|
public slots:
|
|
void refresh();
|
|
void updateDeviceStatus(const DeviceStatus &status);
|
|
|
|
signals:
|
|
void logRequested(const QString &type, const QString &module, const QString &action,
|
|
const QString &content, const QString &status);
|
|
|
|
private:
|
|
void loadTrays();
|
|
void showTrayDetail(int trayIndex);
|
|
void setupLegend();
|
|
void updateCellSizes();
|
|
void updateTrayButtons();
|
|
void updateTrayCells(const QList<TraySlot> &traySlots);
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
private:
|
|
Ui::RackPage *ui;
|
|
QButtonGroup *rackButtonGroup;
|
|
QVector<SquareTrayButton *> rackTrayButtons;
|
|
QVector<QLabel *> trayCells;
|
|
QList<Tray> trays;
|
|
int selectedTrayId;
|
|
int selectedTrayIndex;
|
|
bool trayPresenceAvailable = false;
|
|
bool trayPresent[6] = {};
|
|
};
|
|
|
|
#endif // RACKPAGE_H
|