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
154
155
156
157
158
159
160
161
|
/***************************************************************************
knutprintupsvar.h - description
-------------------
begin : St cec 3 2002
copyright : (C) 2002 by Daniel Prynych
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KNUTPRINTUPSVAR_H
#define KNUTPRINTUPSVAR_H
//Od verze 3 je kapp jen odkaz na kapplication
//#include <tdeapplication.h>
#include <kapp.h>
#include "knutupsdata.h"
#include "knutnet.h"
#include <kdialogbase.h>
#include <kcombobox.h>
#include <kpushbutton.h>
#include <tdelistview.h>
#include <tqvariant.h>
#include <tqlayout.h>
#include <tqvaluelist.h>
#include <tqvaluevector.h>
class TQLabel;
class TQPixmap;
class TQFramel;
class TQString;
/**
*@author Daniel Prynych
*/
/**
* Tato trida zajistuje zobrazeni vsech promenych,
* ktere podporuje prislusny ovladac/driver/model (ovladac) NUTu
* pro urcenou UPS-ku
* @author Daniel Prynych
* @short NUT show UPS vars
* @version 0.3.2
*/
class KNutPrintUpsVar : public KDialogBase {
Q_OBJECT
public:
/**
* Constructor - makes window, reads values of variables
* and will write names and values of variables
* Konstruktor - vytvori okno, nacte hodnoty promennych,
* a vypise jmena a hodnoty promenych.
* @param upsnet Je odkaz na instanci KNutNet - obsahuje hodnoty promennych systemu NUT.
* @param useDescription Urcuje zda pouzit pro promenne a prikazy taky popis.
* pokud data o UPS-kach neexistuji vraci funkce upsOk vzdy false.
*
* since 0.3.1
**/
KNutPrintUpsVar(KNutNet* const upsNet, const bool useDescription, TQWidget* parent = 0, const char* name = 0, const bool modal = true);
/**
* @since 0.1
**/
~KNutPrintUpsVar();
/**
* Vrati zda se povedlo pripojit na server NUT-u a nacist udaje.
*
* @since 0.1
**/
bool upsOk (void);
protected:
/****** protected vars ************/
int countVars;
int countIComms;
int countRWVars;
KNutNet* myUpsNet;
KPushButton* reloadButton;
struct dataVar {
TQString myName;
TDEListViewItem* myValue;
};
TQValueVector<dataVar> dataList;
TDEListViewItem* ROVarsList;
TDEListViewItem* RWVarsList;
TDEListViewItem* ICommList;
TQFrame *page;
TDEListView* table;
TQPixmap dirPixmap;
bool upsConnectOk;
/********** protected functions ****************/
/**
* @internal
* adds name into part of tree
* Prida jmeno do casti stromu.
* @param table is top of tree's part
* @param varName is text which is addes into tree on the first column
* @param varName is text which is addes into tree on the second column
* @param table je vrchol casti stromu.
* @param varName je text ktere se prida do stromu na prvni sloupec.
* @param value je text ktere se prida do stromu na druhy sloupec.
*
* @since 0.2.1
**/
TDEListViewItem* addListItem (TDEListViewItem* table, TQString varName, TQString value);
/**
* @internal
* Zjisti existenci jmena ve vetvi stromu
*
* listItem je vrcholovy prvek vetve.
* @param name je jmeno ktere se hleda ve strome.
*
* @since 0.2
**/
TDEListViewItem* existListItem (TDEListViewItem* listItem, TQString name);
protected slots:
/**
* @internal
* Nacte a prepise hodnoty promenych
*
* @since 0.3
**/
void slotReloadVars (void);
};
#endif
|