|
|
@ -38,6 +38,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
//#include <iostream>
|
|
|
|
//#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#define ICON_SIZE 24
|
|
|
|
|
|
|
|
#define ICON_SIZE 22
|
|
|
|
|
|
|
|
|
|
|
|
KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutUpsData* upsRecords){
|
|
|
|
KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutUpsData* upsRecords){
|
|
|
|
QString valueName;
|
|
|
|
QString valueName;
|
|
|
|
|
|
|
|
|
|
|
@ -68,13 +71,14 @@ KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingD
|
|
|
|
m_battPix = UserIcon ("knc_batt");
|
|
|
|
m_battPix = UserIcon ("knc_batt");
|
|
|
|
|
|
|
|
|
|
|
|
createMainMenu();
|
|
|
|
createMainMenu();
|
|
|
|
|
|
|
|
#define ICON_SIZE 22
|
|
|
|
|
|
|
|
|
|
|
|
m_statusLayer = 0;
|
|
|
|
m_statusLayer = 0;
|
|
|
|
m_runtimeLayer = 0;
|
|
|
|
m_runtimeLayer = 0;
|
|
|
|
|
|
|
|
|
|
|
|
m_loadLayer = new QPixmap(24,24);
|
|
|
|
m_loadLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
m_chargeLayer = new QPixmap(24,24);
|
|
|
|
m_chargeLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
m_mainLayer = new QPixmap(24,24);
|
|
|
|
m_mainLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initImage();
|
|
|
|
initImage();
|
|
|
@ -139,14 +143,14 @@ void KNutDock::changeKIcon (void) {
|
|
|
|
|
|
|
|
|
|
|
|
if (m_mainLayer) {
|
|
|
|
if (m_mainLayer) {
|
|
|
|
delete m_mainLayer;
|
|
|
|
delete m_mainLayer;
|
|
|
|
m_mainLayer=new QPixmap(24,24);
|
|
|
|
m_mainLayer=new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_statusLayer) {
|
|
|
|
if (!m_statusLayer) {
|
|
|
|
m_statusLayer = new QPixmap(24,24);
|
|
|
|
m_statusLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!m_runtimeLayer) {
|
|
|
|
if (!m_runtimeLayer) {
|
|
|
|
m_runtimeLayer = new QPixmap(24,24);
|
|
|
|
m_runtimeLayer = new QPixmap(ICON_SIZE,ICON_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
paintStatus(m_statusValue);
|
|
|
|
paintStatus(m_statusValue);
|
|
|
|
paintRuntime(m_runtimeValue, m_statusValue);
|
|
|
|
paintRuntime(m_runtimeValue, m_statusValue);
|
|
|
@ -299,18 +303,18 @@ void KNutDock::repaintDock (const bool always) {
|
|
|
|
switch (m_typeOfIcon) {
|
|
|
|
switch (m_typeOfIcon) {
|
|
|
|
case generalKI:
|
|
|
|
case generalKI:
|
|
|
|
m_mainLayer->fill(m_myBGColor);
|
|
|
|
m_mainLayer->fill(m_myBGColor);
|
|
|
|
// copyBlt (m_mainLayer,0,0,m_runtimeLayer,0,0,24,24);
|
|
|
|
// copyBlt (m_mainLayer,0,0,m_runtimeLayer,0,0,ICON_SIZE,ICON_SIZE);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_runtimeLayer,0,0,24,24,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_runtimeLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_loadLayer,0,0,24,24,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_loadLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_chargeLayer,0,0,24,24,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_chargeLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_statusLayer,0,0,24,24,AndROP);
|
|
|
|
bitBlt (m_mainLayer,0,0,m_statusLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case pictureKI:
|
|
|
|
case pictureKI:
|
|
|
|
// if (m_statusValue & KNutNet::OL) bitBlt (m_mainLayer,0,0,m_loadLayer,0,0,24,24,AndROP); // icon of UPS
|
|
|
|
// if (m_statusValue & KNutNet::OL) bitBlt (m_mainLayer,0,0,m_loadLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP); // icon of UPS
|
|
|
|
if (m_statusValue & KNutNet::OL) { // ONLINE - icon of UPS
|
|
|
|
if (m_statusValue & KNutNet::OL) { // ONLINE - icon of UPS
|
|
|
|
int myLoad;
|
|
|
|
int myLoad;
|
|
|
|
QPainter paint;
|
|
|
|
QPainter paint;
|
|
|
|
copyBlt (m_mainLayer,0,0,&m_upsPix,0,0,24,24); // icon of UPS
|
|
|
|
copyBlt (m_mainLayer,0,0,&m_upsPix,0,0,ICON_SIZE,ICON_SIZE); // icon of UPS
|
|
|
|
|
|
|
|
|
|
|
|
paint.begin(m_mainLayer);
|
|
|
|
paint.begin(m_mainLayer);
|
|
|
|
if (m_upsLoadValue == knc::numberVarError) myLoad=0;
|
|
|
|
if (m_upsLoadValue == knc::numberVarError) myLoad=0;
|
|
|
@ -339,7 +343,7 @@ void KNutDock::repaintDock (const bool always) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
QPainter paint;
|
|
|
|
QPainter paint;
|
|
|
|
copyBlt (m_mainLayer,0,0,&m_battPix,0,0,24,24); // icon of Battery
|
|
|
|
copyBlt (m_mainLayer,0,0,&m_battPix,0,0,ICON_SIZE,ICON_SIZE); // icon of Battery
|
|
|
|
paint.begin(m_mainLayer);
|
|
|
|
paint.begin(m_mainLayer);
|
|
|
|
if (m_batteryChargeValue != knc::numberVarError) {
|
|
|
|
if (m_batteryChargeValue != knc::numberVarError) {
|
|
|
|
if (m_batteryChargeValue < 40) paint.setPen(Qt::red);
|
|
|
|
if (m_batteryChargeValue < 40) paint.setPen(Qt::red);
|
|
|
@ -802,7 +806,7 @@ void KNutDock::paintLoad (int load ) {
|
|
|
|
QPainter paint;
|
|
|
|
QPainter paint;
|
|
|
|
int myLoad;
|
|
|
|
int myLoad;
|
|
|
|
|
|
|
|
|
|
|
|
// if (m_typeOfIcon != generalKI) bitBlt (m_loadLayer,0,0,m_upsLayer,0,0,24,24,AndROP);
|
|
|
|
// if (m_typeOfIcon != generalKI) bitBlt (m_loadLayer,0,0,m_upsLayer,0,0,ICON_SIZE,ICON_SIZE,AndROP);
|
|
|
|
m_loadLayer->fill(Qt::white);
|
|
|
|
m_loadLayer->fill(Qt::white);
|
|
|
|
paint.begin(m_loadLayer);
|
|
|
|
paint.begin(m_loadLayer);
|
|
|
|
if (load == knc::numberVarError) myLoad=0;
|
|
|
|
if (load == knc::numberVarError) myLoad=0;
|
|
|
|