-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathledlamplistwidget.h
153 lines (81 loc) · 3.56 KB
/
ledlamplistwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#ifndef LEDLAMPLISTWIDGET_H
#define LEDLAMPLISTWIDGET_H
#include <QWidget>
#include <QMenu>
#include <QStandardItemModel>
#include <QJsonObject>
#include <QJsonDocument>
#include <QTableView>
#include "mysortfilterproxymodel.h"
#include "addeditlampdlg.h"
namespace Ui {
class LedLampListWidget;
}
class LedLampListWidget : public QWidget
{
Q_OBJECT
public:
explicit LedLampListWidget(QWidget *parent = nullptr);
~LedLampListWidget();
int protocolVersion;
bool canWriteOperatorCommands;
void setupObjectTv(QTableView *tv);
QString map2jsonLine(const QVariantMap &map);
QVariantMap getPower2groups(const QMap<int, int> &groupId2power);
QVariantMap getPower2groupsExt(const QMap<int, int> &groupId2power, const bool &isPowerInPercents);
QStringList getKeysLedLampV2();
int getProtocolVersion();
int getMatches4ThisCellText(const int &col, const QString &celltxt, const int &limit);
int getMatches4TheseCellsText(const QList<int> &cols, const QStringList &celltxtl, const int &limit);
QStringList getSelectedRowsText( const int &col);
void setModelHorizontalHeaderItems(const QStringList &header);
bool getSelectedNI4lampsSmart(QString &s);
QStringList getSelectedNis(const int &maxsize);
QStringList getUniqGroupIds();
// QVariantHash getPageSett(bool &eraseAll);
QJsonObject getPageSett(int &row, int &rowCount, const int &maxLen);
QStringList varList2strList(const QVariantList &list);
signals:
void showMessage(QString message);
void mWrite2RemoteDev(quint16 command, QJsonObject jobj);
public slots:
void initPage();
void clearPage();
void onReadingFinished();
void setPageSett(const QJsonObject &jobj);
void onActSelectedPollOnAddLedLampTable();
void onActSelectedPollOffAddLedLampTable();
void addLamp(QString lamp_ni, int grp_id, QString crdnts, QString memo, QString lampmodel, QVariant modelData, QString sbAddLampPstart, QString sbAddLampPna, QString sbAddLampTna, QString cbAddLampOnOffPoll, QString leAddLampStreet, bool quite);
void showDlgSetupTempPower4schedule();
void resetSelectedTempPower4schedule();
void resetAllTempPower4schedule();
void setTempSchedule4theseGroups(QStringList groups, int power, int minutesfrom, int minutesto);
void sendCOMMAND_WRITE_ADD_DEL_TEMPSCHEDULE(const QStringList &sdp, const QStringList &dtsl, const QStringList &idsr);
void setProtocolVersion(int version);
void setCanWriteOperatorCommands(bool canwrite);
void setPower4selectedExt(int value, int tag, QVariant data);
private slots:
void on_pbAddLamp_clicked();
void on_tvTable_doubleClicked(const QModelIndex &index);
void on_tvTable_customContextMenuRequested(const QPoint &pos);
void onActEditLedLampTable();
void editLampFromRow(int row);
void checkLampState4selected();
void blymBlym4selected();
void onActWriteSeleted();
void onActWriteSeletedOn();
void onActWriteSeletedOff();
void onActWriteSeletedDeletePart();
void tryToSendAdditionalCommand(const QVariantList &varl, const QString &text);
void onDeleteSelectedAct();
void onResetSortingAct();
private:
Ui::LedLampListWidget *ui;
AddEditLampDlg *editWdgt;
MySortFilterProxyModel *proxy_model;
QStandardItemModel *model;
QMenu *getMenuSelected(QWidget *prnt, const bool &youHaveApower, const bool &hasSelItems);
QMenu *getMenuTempSchedule(QWidget *prnt, const bool &youHaveApower, const bool &hasSelItems);
QStringList lastColumnsSequence;
};
#endif // LEDLAMPLISTWIDGET_H