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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/***************************************************************************
knutpanelmeter.h - description
-------------------
begin : Út b?e 16 2004
copyright : (C) 2004 by Daniel Prynych
email : Daniel.Prynych@alo.cz
***************************************************************************/
/***************************************************************************
* *
* 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 KNUTPANELMETER_H
#define KNUTPANELMETER_H
#include "knutanalog.h"
#include "knutvardata.h"
//#include <tqwidget.h>
#include <tqscrollview.h>
class TQLabel;
class TQFont;
/**
*@author Daniel Prynych
*/
class KNutPanelMeter : public TQScrollView {
TQ_OBJECT
public:
/**
* Konstruktor
*
* Param taPanelPalette je paleta pozadi subpanelu MERAKU !!!
* @param activeUpsInfo ukazatel na data o aktivni UPS
* @param settingData ukazatel na zakladni data programu (barvy pozadi, mezikruzi, rucicky ... ,fonty atd )
* @param analogRecords ukazatel na tridu ktera pracuje s daty o upsekach
*
* @since 0.2
**/
KNutPanelMeter(TQPalette aPanelPalette, KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutVarData* analogRecords, TQWidget *parent=0, const char *name=0);
/**
* Destruktor
*
* @since 0.1
**/
~KNutPanelMeter();
/**
* Zrusi analogove panely vcetne uvoneni pameti.
*
* @since 0.1
**/
void deActivateAnalogs (void);
/**
* Vytvori a inicializuje analogove panely.
*
* @since 0.1
**/
void activateAnalogs (void);
/**
* Rozmisti analogove panely po hlavnim panelu a spocte jeho rozmery.
*
* @param showPanels je true jsou rozsviceny (show) subpanely
* @since 0.2
**/
void setSize (bool showPanels = false);
/**
* Prekresli zmenu rozsahu pro dany analogovy panel (jenom jeden)
* Pokud panel nepodporuje zmeny rozsahu neprovede nic.
* Zmenu rozsahu podporuji nasledujici panely: Current,BattVolt,BattCurrent
*
* @param panelNumber je cislo analogoveho panelu.
* @param value je hodnota na kterou je panel nastaven.
*
* @since 0.1
**/
void repaintScaleAnalogPanel (int panelNumber, float value);
/**
* Paints pointer for selected analog panel
* Prekresli rucicku pro vybrany analogovy panel.
*
* @param panelNumber is number of analog panel.
* @param value is value of settimg amalog panel.
* @param run = TRUE makes immediately repaint of panel
* @param panelNumber je cislo analogoveho panelu.
* @param value je hodnota na kterou je panel nastaven.
* @param run = TRUE provede okamzite prekresleni
*
* @since 0.2
**/
void repaintAnalogPointer (int panelNumber, float value, bool run = true);
/**
* Repaints analog panels
* Repainting range of panel for frequency and voltage, based on current setting.
* Prekresli a prebarvi analogove panely.
* Prekresuje rozsah panelu pro frekvenci a nepeti na zaklade soucasneho nastaveni.
*
* @param repaintFrequencyPanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni frequency.
* @param repaintVoltagePanels urcuje ze ma prekreslit panely ktere zobrazuji vstupni a vystupni napeti.
* @param repaintAllPanels urcuje ze ma prebarvit vsechny prvky panelu.
*
* @since 0.1
**/
void repaintAnalogPanels (bool repaintFrequencyPanels, bool repaintVoltagePanels, bool repaintAllPanels);
/**
* Changes type of digital processing of pointer and repaints it.
* Zmeni zpusob digitalniho zpracovani rucucky a prekresli ji
*
* @since 0.1
**/
void changeAnalogPanelsDigProcessing (void);
/**
* Sets value of panels to zero
* Nastavi hodnotu vsech panelu na nulu
*
* @since 0.1
**/
void zeroingPanels (void);
/**
* Repaints backgroud of analog panels
* Prebarvi pozadi analogovych panelu.
*
* @param taPanelPalette je hodnota nove palety pro pozadi
*
* @since 0.1
**/
void setAnalogBG(TQPalette aPanelPalette);
/**
* Vraci soucasnou velikost panelu.
*
* @since 0.1
**/
virtual TQSize sizeHint (void);
public slots:
/**
* Sets new font for all panels
* Nastavy novy font ve vsech panelech.
*
* @since 0.1
**/
void slotSetPanelsFont(TQFont newFont);
private:
/************ private const *****************/
static const int SpacePanels = 2; //vzdalenost mezi meraky, length between panels
static const int MaxBattVolt = 350; // max battery.voltage
static const int MaxCurrent = 50; // max output.current
static const int MaxBattCurrent = 50; // max battery.current
/************ private struct ************************/
struct analogPanelRecordsDef {
int scaleEnd[knc::NumberOfVars];
int scaleStart[knc::NumberOfVars];
KNutAnalog* upsAnalogs[knc::NumberOfVars];
};
/*********** private vars *******************/
TQLabel* m_analogArea;
analogPanelRecordsDef* m_analogPanels;
KNutVarData::upsInfoDef* m_activeUpsInfo; // values for selected ups -- hodnoty pro vybrane ups
KNutVarData::SettingDataDef* m_settingData; // v teto strukture jsou ulozeny promene ktere nastavuji konfiguraci
KNutVarData* m_analogRecords;
TQPalette m_aPanelPalette;
int m_widthArea;
int m_heightArea;
};
#endif
|