diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 19:37:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 19:37:06 +0000 |
commit | 968af1d235ac30d737991b269156bee5dc99d318 (patch) | |
tree | 19b118fa5380087e10cb728be545760791ce0676 /src/knutdock.cpp | |
parent | aea4882f3b37f17c5b56bc77667e683c52254c30 (diff) | |
download | knutclient-968af1d235ac30d737991b269156bee5dc99d318.tar.gz knutclient-968af1d235ac30d737991b269156bee5dc99d318.zip |
TQt4 port knutclient
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knutclient@1238881 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/knutdock.cpp')
-rwxr-xr-x | src/knutdock.cpp | 264 |
1 files changed, 132 insertions, 132 deletions
diff --git a/src/knutdock.cpp b/src/knutdock.cpp index b3973ae..ed5204a 100755 --- a/src/knutdock.cpp +++ b/src/knutdock.cpp @@ -25,11 +25,11 @@ #include <kaboutapplication.h> #include <kmessagebox.h> -#include <qpainter.h> -#include <qtooltip.h> -#include <qpixmap.h> -#include <qbitmap.h> -#include <qstring.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqpixmap.h> +#include <tqbitmap.h> +#include <tqstring.h> #include <math.h> @@ -42,7 +42,7 @@ #define ICON_SIZE 22 KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingDataDef* settingData, KNutUpsData* upsRecords){ - QString valueName; + TQString valueName; m_settingData = settingData; m_upsRecords = upsRecords; @@ -76,13 +76,13 @@ KNutDock::KNutDock(KNutVarData::upsInfoDef* activeUpsInfo, KNutVarData::SettingD m_statusLayer = 0; m_runtimeLayer = 0; - m_loadLayer = new QPixmap(ICON_SIZE,ICON_SIZE); - m_chargeLayer = new QPixmap(ICON_SIZE,ICON_SIZE); - m_mainLayer = new QPixmap(ICON_SIZE,ICON_SIZE); + m_loadLayer = new TQPixmap(ICON_SIZE,ICON_SIZE); + m_chargeLayer = new TQPixmap(ICON_SIZE,ICON_SIZE); + m_mainLayer = new TQPixmap(ICON_SIZE,ICON_SIZE); initImage(); - changeKIcon(); // this function calls function repaintIcon + changeKIcon(); // this function calls function tqrepaintIcon } @@ -100,9 +100,9 @@ KNutDock::~KNutDock(){ delete m_menu; } -void KNutDock::resizeEvent ( QResizeEvent * ){ +void KNutDock::resizeEvent ( TQResizeEvent * ){ initImage(); - changeKIcon(); // this function calls function repaintIcon + changeKIcon(); // this function calls function tqrepaintIcon } void KNutDock::changeUps (void) { @@ -117,7 +117,7 @@ void KNutDock::clearDockValues(void){ initImage(); // paints standart icon clearValues(); - repaintDock(true); + tqrepaintDock(true); } @@ -133,7 +133,7 @@ void KNutDock::changeKIBColor(void) { if (!m_settingData->customKIconColor) m_myBGColor = backgroundColor; else m_myBGColor = m_settingData->kIconBackgroundColor; // uses defined color - repaintDock(true); + tqrepaintDock(true); } void KNutDock::changeKIcon (void) { @@ -143,16 +143,16 @@ void KNutDock::changeKIcon (void) { if (m_mainLayer) { delete m_mainLayer; - m_mainLayer=new QPixmap(ICON_SIZE,ICON_SIZE); + m_mainLayer=new TQPixmap(ICON_SIZE,ICON_SIZE); } if (!m_statusLayer) { - m_statusLayer = new QPixmap(ICON_SIZE,ICON_SIZE); + m_statusLayer = new TQPixmap(ICON_SIZE,ICON_SIZE); } if (!m_runtimeLayer) { - m_runtimeLayer = new QPixmap(ICON_SIZE,ICON_SIZE); + m_runtimeLayer = new TQPixmap(ICON_SIZE,ICON_SIZE); } - paintStatus(m_statusValue); + painttqStatus(m_statusValue); paintRuntime(m_runtimeValue, m_statusValue); } else { // picture Icon @@ -166,7 +166,7 @@ void KNutDock::changeKIcon (void) { m_statusWarningValue = m_statusValue & (KNutNet::CAL | KNutNet::TRIM | KNutNet::BOOST | KNutNet::OVER | KNutNet::RB); - repaintDock(true); + tqrepaintDock(true); } void KNutDock::initImage(void) { @@ -181,21 +181,21 @@ void KNutDock::setNewUPS(void) { } -void KNutDock::repaintDock (const bool always) { - QString nutStringVar; +void KNutDock::tqrepaintDock (const bool always) { + TQString nutStringVar; int myRuntimeValue; int myUpsLoadValue; int myStatusValue; int myStatusBatValue; int myBatteryChargeValue; - bool repaintNow = false; - // value repaintNow is seted when some ups values are changed + bool tqrepaintNow = false; + // value tqrepaintNow is seted when some ups values are changed bool okFloat; - QString valueName; - QPainter paint; + TQString valueName; + TQPainter paint; - if (m_activeUpsInfo->upsNet == 0) { repaint(); return;} + if (m_activeUpsInfo->upsNet == 0) { tqrepaint(); return;} m_dataOkOld=m_dataOk; @@ -206,7 +206,7 @@ void KNutDock::repaintDock (const bool always) { if (!m_activeUpsInfo->upsNet->existName(m_activeUpsInfo->runtimeVar)) { nutStringVar = m_activeUpsInfo->upsNet->readStringVar(m_activeUpsInfo->runtimeVar); -//std::cout << "KNutDock::repaintDock RUNTIME " << nutStringVar << std::endl; +//std::cout << "KNutDock::tqrepaintDock RUNTIME " << nutStringVar << std::endl; if (nutStringVar.isEmpty()) myRuntimeValue=knc::numberVarError; else { myRuntimeValue = (int)nutStringVar.toFloat(&okFloat); @@ -215,7 +215,7 @@ void KNutDock::repaintDock (const bool always) { } else myRuntimeValue = knc::numberVarError; - myStatusValue = m_activeUpsInfo->upsNet->readStatus(); + myStatusValue = m_activeUpsInfo->upsNet->readtqStatus(); switch (m_typeOfIcon) { @@ -223,19 +223,19 @@ void KNutDock::repaintDock (const bool always) { // *********STATUS**************** if (myStatusValue !=m_statusValue ) { m_statusValue = myStatusValue; - paintStatus(m_statusValue); - repaintNow = true; + painttqStatus(m_statusValue); + tqrepaintNow = true; } // **********RUNTIME*********** myStatusBatValue = myStatusValue & KNutNet::OB; // OB = UPS runs on battery if ((myRuntimeValue != m_runtimeValue) || (myStatusBatValue != m_statusBatValue)) { - // when runtime is changed or flags OB is changed we must repaint icons + // when runtime is changed or flags OB is changed we must tqrepaint icons // when OB is changed same items in icon will change color m_runtimeValue = myRuntimeValue; // runtime is old value of runtime, one is defined like global value of class m_statusBatValue = myStatusBatValue; paintRuntime(m_runtimeValue, m_statusValue); - repaintNow = true; + tqrepaintNow = true; } break; @@ -245,13 +245,13 @@ void KNutDock::repaintDock (const bool always) { m_statusValue = myStatusValue; m_statusWarningValue = myStatusValue & (KNutNet::CAL | KNutNet::TRIM | KNutNet::BOOST | KNutNet::OVER | KNutNet::RB); - repaintNow = true; + tqrepaintNow = true; } // **********RUNTIME*********** if (myRuntimeValue != m_runtimeValue) { m_runtimeValue = myRuntimeValue; - repaintNow = true; + tqrepaintNow = true; } break; } ///////////////////// end of models @@ -274,7 +274,7 @@ void KNutDock::repaintDock (const bool always) { if (myUpsLoadValue != m_upsLoadValue) { m_upsLoadValue = myUpsLoadValue; if (m_typeOfIcon == generalKI) paintLoad(m_upsLoadValue); - repaintNow = true; + tqrepaintNow = true; } // *********BATTERY CHARGE**************** @@ -293,11 +293,11 @@ void KNutDock::repaintDock (const bool always) { if (myBatteryChargeValue != m_batteryChargeValue) { m_batteryChargeValue = myBatteryChargeValue; if (m_typeOfIcon == generalKI)paintCharge(m_batteryChargeValue); - repaintNow = true; + tqrepaintNow = true; } // ************* End of values******************** - if (repaintNow || always || (m_dataOk != m_dataOkOld)) { + if (tqrepaintNow || always || (m_dataOk != m_dataOkOld)) { switch (m_typeOfIcon) { @@ -313,7 +313,7 @@ void KNutDock::repaintDock (const bool always) { // 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 int myLoad; - QPainter paint; + TQPainter paint; copyBlt (m_mainLayer,0,0,&m_upsPix,0,0,ICON_SIZE,ICON_SIZE); // icon of UPS paint.begin(m_mainLayer); @@ -323,35 +323,35 @@ void KNutDock::repaintDock (const bool always) { if (m_upsLoadValue != knc::numberVarError) { if (myLoad > 12) myLoad=12; if (myLoad > 10) myLoad++; // preskocime rysku pro 100 % - if (myLoad < 9) paint.setPen(QColor(0,192,0)); //green + if (myLoad < 9) paint.setPen(TQColor(0,192,0)); //green else { - if (myLoad < 11) paint.setPen(QColor(255,255,0)); //yellow - else paint.setPen(QColor(255,0,0));//red + if (myLoad < 11) paint.setPen(TQColor(255,255,0)); //yellow + else paint.setPen(TQColor(255,0,0));//red } for (int i = 19; i < 22; i++) paint.drawLine(i,13,i,13-myLoad +1); if (myLoad < 13) { - paint.setPen(QColor(168,220,255)); + paint.setPen(TQColor(168,220,255)); for (int i = 20; i < 23; i++ ) paint.drawLine(i,1,i,13-myLoad); } } - paint.setPen(QColor(Qt::black)); // line for 100 % load + paint.setPen(TQColor(TQt::black)); // line for 100 % load paint.drawLine(19,3,22,3); if (!m_statusWarningValue) paintOKPoint(paint); else paintErrorPoint(paint); paint.end(); } else { - QPainter paint; + TQPainter paint; copyBlt (m_mainLayer,0,0,&m_battPix,0,0,ICON_SIZE,ICON_SIZE); // icon of Battery paint.begin(m_mainLayer); if (m_batteryChargeValue != knc::numberVarError) { - if (m_batteryChargeValue < 40) paint.setPen(Qt::red); - else paint.setPen(Qt::black); - if (m_batteryChargeValue < 40) paint.setPen(Qt::red); + if (m_batteryChargeValue < 40) paint.setPen(TQt::red); + else paint.setPen(TQt::black); + if (m_batteryChargeValue < 40) paint.setPen(TQt::red); else { - if (m_batteryChargeValue < 50) paint.setPen(Qt::yellow); - else paint.setPen(Qt::green); + if (m_batteryChargeValue < 50) paint.setPen(TQt::yellow); + else paint.setPen(TQt::green); } int delka = abs((16*m_batteryChargeValue)/100); delka += abs((delka-1)/4) -1; @@ -390,18 +390,18 @@ void KNutDock::repaintDock (const bool always) { } } } - repaint(); + tqrepaint(); } void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad ) { - QString text; - QString manufacturer = ""; - QString upsModel = ""; - QString serial = ""; - QString firmware = ""; + TQString text; + TQString manufacturer = ""; + TQString upsModel = ""; + TQString serial = ""; + TQString firmware = ""; int myNetErr = 0; int min = abs(runtime/60); @@ -428,7 +428,7 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad text = i18n("Name")+" : "+m_activeUpsInfo->record.name + "\n" +i18n("UPS name")+" : "+m_activeUpsInfo->record.upsName + "\n" +i18n("UPS address")+" : "+m_activeUpsInfo->record.upsAddress +"\n" - +i18n("Status : "); + +i18n("tqStatus : "); if (status == -1) { text += i18n("Connection doesn't exist."); @@ -449,22 +449,22 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad } if (status & KNutNet::LB) { - text += "\n" + i18n("Status : ") + i18n("UPS Battery is low"); + text += "\n" + i18n("tqStatus : ") + i18n("UPS Battery is low"); } if (status & KNutNet::RB) { - text += "\n" + i18n("Status : ") + i18n("Replace battery"); + text += "\n" + i18n("tqStatus : ") + i18n("Replace battery"); } if (status & KNutNet::CAL) { - text += "\n" + i18n("Status : ") + i18n("UPS is performing calibration"); + text += "\n" + i18n("tqStatus : ") + i18n("UPS is performing calibration"); } if (status & KNutNet::OVER) { - text += "\n" + i18n("Status : ") + i18n("UPS is Overload"); + text += "\n" + i18n("tqStatus : ") + i18n("UPS is Overload"); } if (status & KNutNet::TRIM) { - text += "\n" + i18n("Status : ") + i18n("UPS is trimming voltage"); + text += "\n" + i18n("tqStatus : ") + i18n("UPS is trimming voltage"); } if (status & KNutNet::BOOST) { - text += "\n" + i18n("Status : ")+ i18n("UPS is boosting voltage"); + text += "\n" + i18n("tqStatus : ")+ i18n("UPS is boosting voltage"); } @@ -483,21 +483,21 @@ void KNutDock::toolTip (int runtime, int status, int batteryCharge, int upsLoad if (m_toolTipFlags & TTRun) { if (runtime != knc::numberVarError) - text += "\n" + i18n("Runtime") + i18n(" : %1:%2 min").arg(min).arg(sec); + text += "\n" + i18n("Runtime") + i18n(" : %1:%2 min").tqarg(min).tqarg(sec); } if (m_toolTipFlags & TTCharge) { if (batteryCharge != knc::numberVarError) - text += "\n" + i18n("Battery Charge") + QString(" : %1 %").arg(batteryCharge); + text += "\n" + i18n("Battery Charge") + TQString(" : %1 %").tqarg(batteryCharge); } if (m_toolTipFlags & TTLoad) { if (upsLoad != knc::numberVarError) - text += "\n" + i18n("UPS Load") + QString(" : %1 %").arg(upsLoad); + text += "\n" + i18n("UPS Load") + TQString(" : %1 %").tqarg(upsLoad); } - QToolTip::remove(this); - QToolTip::add(this,text); + TQToolTip::remove(this); + TQToolTip::add(this,text); } @@ -564,36 +564,36 @@ void KNutDock::slotRefreshConnection(void) { //------------------------------------------ -void KNutDock::mousePressEvent(QMouseEvent *e) { +void KNutDock::mousePressEvent(TQMouseEvent *e) { //qDebug("KNutDock::mousePressEvent"); - if( e->button()==LeftButton ) emit activeMainWindow(); - if( e->button()==RightButton ) m_menu->popup(e->globalPos()); + if( e->button()==Qt::LeftButton ) emit activeMainWindow(); + if( e->button()==Qt::RightButton ) m_menu->popup(e->globalPos()); } -void KNutDock::paintEvent (QPaintEvent *e) { +void KNutDock::paintEvent (TQPaintEvent *e) { KSystemTray::paintEvent(e); if ((m_activeUpsInfo->upsNet->getState() == KNutNet::Connected) and (m_statusValue != KNutNet::NS)) { // When driver isn't connected, getState is connected and m_statusValue is NS // NONE STATUS if (m_typeOfIcon == pictureKI) { - QPainter painter(this); + TQPainter painter(this); // painter.begin(); if (m_statusValue & KNutNet::OL) { // ONLINE - icon of UPS - painter.setPen(Qt::black); + painter.setPen(TQt::black); paintNumbers (m_upsLoadValue, (width()/-11), ((float) width()/(float) 1.46666666667), &painter, ((float) width()/(float) 22) ); } else { // OFFLINE icon of battery if (m_batteryChargeValue != knc::numberVarError) { - if (m_batteryChargeValue < 40) painter.setPen(Qt::red); - else painter.setPen(Qt::black); + if (m_batteryChargeValue < 40) painter.setPen(TQt::red); + else painter.setPen(TQt::black); paintNumbers(m_batteryChargeValue,(width()/-11),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22)); } else { - painter.setPen(Qt::black); + painter.setPen(TQt::black); paintDash (((float) width()/(float) 7.33333333333),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22)); paintDash (((float) width()/(float) 2.75),((float) width()/(float) 1.375),&painter, ((float) width()/(float) 22)); } @@ -626,9 +626,9 @@ void KNutDock::createUpsMenu(void) { int n = m_upsRecords->getCount(); for (int i =0; i < n; i++) { if (m_activeUpsInfo->record.name == m_upsRecords->getName(i)) - m_upsServerMenu->insertItem(kapp->miniIcon(),m_upsRecords->getName(i), this, SLOT(slotUpsName(int)),0,101+i); + m_upsServerMenu->insertItem(kapp->miniIcon(),m_upsRecords->getName(i), this, TQT_SLOT(slotUpsName(int)),0,101+i); else - m_upsServerMenu->insertItem(m_upsRecords->getName(i), this, SLOT(slotUpsName(int)),0,101+i); + m_upsServerMenu->insertItem(m_upsRecords->getName(i), this, TQT_SLOT(slotUpsName(int)),0,101+i); } } @@ -642,37 +642,37 @@ void KNutDock::createMainMenu(void) { m_menu->insertSeparator(); m_menu->insertItem("UPS",m_upsServerMenu); m_menu->insertSeparator(); - m_menu->insertItem(i18n("&Showing UPS variables and commands"), this, SLOT(slotPrintUPSVars())); - m_menu->insertItem(i18n("&Running instant commands"), this, SLOT(slotInstComms())); - m_menu->insertItem(i18n("Setting R&W variables"), this, SLOT(slotRWVars())); + m_menu->insertItem(i18n("&Showing UPS variables and commands"), this, TQT_SLOT(slotPrintUPSVars())); + m_menu->insertItem(i18n("&Running instant commands"), this, TQT_SLOT(slotInstComms())); + m_menu->insertItem(i18n("Setting R&W variables"), this, TQT_SLOT(slotRWVars())); m_menu->insertSeparator(); - m_menu->insertItem(SmallIcon("reload"),i18n("Reconnect"), this, SLOT(slotRefreshConnection())); + m_menu->insertItem(SmallIcon("reload"),i18n("Reconnect"), this, TQT_SLOT(slotRefreshConnection())); m_menu->insertSeparator(); - m_menu->insertItem(SmallIcon("configure"),i18n("&Preferences"), this, SLOT(slotPreferences())); + m_menu->insertItem(SmallIcon("configure"),i18n("&Preferences"), this, TQT_SLOT(slotPreferences())); m_menu->insertSeparator(); - m_menu->insertItem(kapp->miniIcon(),i18n("&About KNutClient"), this, SLOT(slotShowMyAbout())); + m_menu->insertItem(kapp->miniIcon(),i18n("&About KNutClient"), this, TQT_SLOT(slotShowMyAbout())); m_menu->insertSeparator(); - m_menu->insertItem(i18n("&Minimize"), this, SLOT(slotMinimize())); + m_menu->insertItem(i18n("&Minimize"), this, TQT_SLOT(slotMinimize())); m_menu->insertSeparator(); - m_menu->insertItem (SmallIcon("exit"),i18n("&Exit"),this ,SLOT(slotExitApplication())); + m_menu->insertItem (SmallIcon("exit"),i18n("&Exit"),this ,TQT_SLOT(slotExitApplication())); } void KNutDock::paintCharge (int charge ) { - QPainter paint; + TQPainter paint; - m_chargeLayer->fill(Qt::white); + m_chargeLayer->fill(TQt::white); paint.begin(m_chargeLayer); if (charge > 199) charge = 199; if (m_typeOfIcon == generalKI) { if (charge != knc::numberVarError) { - if (charge < 40) paint.setPen(Qt::red); - else paint.setPen(Qt::black); + if (charge < 40) paint.setPen(TQt::red); + else paint.setPen(TQt::black); paintNumbers(charge,8,2,&paint, 1); } else { - paint.setPen(Qt::black); + paint.setPen(TQt::black); paintDash (13,2,&paint, 1); paintDash (18,2,&paint, 1); } @@ -680,14 +680,14 @@ void KNutDock::paintCharge (int charge ) { else { // picture version if (charge != knc::numberVarError) { - if (charge < 40) paint.setPen(Qt::red); - else paint.setPen(Qt::black); + if (charge < 40) paint.setPen(TQt::red); + else paint.setPen(TQt::black); paintNumbers(charge,-2,16,&paint, 1); - if (charge < 40) paint.setPen(Qt::red); + if (charge < 40) paint.setPen(TQt::red); else { - if (charge < 50) paint.setPen(Qt::yellow); - else paint.setPen(Qt::green); + if (charge < 50) paint.setPen(TQt::yellow); + else paint.setPen(TQt::green); } int delka = abs((16*charge)/100); delka += abs((delka-1)/4) -1; @@ -696,7 +696,7 @@ void KNutDock::paintCharge (int charge ) { paint.drawLine (2,9,2+delka,9); } else { - paint.setPen(Qt::black); + paint.setPen(TQt::black); paintDash (3,16,&paint, 1); paintDash (8,16,&paint, 1); } @@ -706,10 +706,10 @@ void KNutDock::paintCharge (int charge ) { } -void KNutDock::paintErrorPoint ( QPainter& paint ) { +void KNutDock::paintErrorPoint ( TQPainter& paint ) { - paint.setPen(QColor(0,0,255)); - paint.setPen(QColor(255,0,0)); + paint.setPen(TQColor(0,0,255)); + paint.setPen(TQColor(255,0,0)); paint.drawLine(19,18,21,18); paint.drawLine(19,19,21,19); @@ -717,54 +717,54 @@ void KNutDock::paintErrorPoint ( QPainter& paint ) { } -void KNutDock::paintOKPoint (QPainter& paint ) { +void KNutDock::paintOKPoint (TQPainter& paint ) { - paint.setPen(QColor(0,255,0)); + paint.setPen(TQColor(0,255,0)); paint.drawLine(19,18,21,18); paint.drawLine(19,19,21,19); paint.drawLine(19,20,21,20); } -void KNutDock::paintStatus (int status ) { - QPainter paint; +void KNutDock::painttqStatus (int status ) { + TQPainter paint; int lastPos = 0; - m_statusLayer->fill(Qt::white); + m_statusLayer->fill(TQt::white); paint.begin(m_statusLayer); if (status & KNutNet::OL) { - paint.setPen(Qt::black); + paint.setPen(TQt::black); paintChar (1,2,'P',&paint); } else { if (status & KNutNet::OB) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (1,2,'B',&paint); } } if (status & KNutNet::LB) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (6,2,'L',&paint); } if ((lastPos <2) && (status & KNutNet::RB)) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (6,2,'R',&paint); lastPos++; } if ((lastPos <2) && (status & KNutNet::BOOST)) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (6,2,'B',&paint); lastPos++; } if ((lastPos <2) && (status & KNutNet::TRIM)) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (6,2,'T',&paint); lastPos++; } if ((lastPos <2) && (status & KNutNet::CAL)) { - paint.setPen(Qt::red); + paint.setPen(TQt::red); paintChar (6,2,'C',&paint); lastPos++; } @@ -772,15 +772,15 @@ void KNutDock::paintStatus (int status ) { } void KNutDock::paintRuntime (int runtime, int status ) { - QPainter paint; + TQPainter paint; - m_runtimeLayer->fill(Qt::white); + m_runtimeLayer->fill(TQt::white); paint.begin(m_runtimeLayer); if (status & KNutNet::OB) - paint.setPen(Qt::red); + paint.setPen(TQt::red); else - paint.setPen(Qt::black); + paint.setPen(TQt::black); if (runtime != knc::numberVarError) { int min = abs(runtime/60); @@ -803,11 +803,11 @@ void KNutDock::paintRuntime (int runtime, int status ) { } void KNutDock::paintLoad (int load ) { - QPainter paint; + TQPainter paint; int myLoad; // 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(TQt::white); paint.begin(m_loadLayer); if (load == knc::numberVarError) myLoad=0; else myLoad = abs(load/10); @@ -815,16 +815,16 @@ void KNutDock::paintLoad (int load ) { if (m_typeOfIcon == generalKI) { if (load != knc::numberVarError) { if (myLoad > 11) myLoad=11; - if (myLoad < 9) paint.setPen(Qt::green); + if (myLoad < 9) paint.setPen(TQt::green); else { - if (myLoad < 11) paint.setPen(Qt::yellow); - else paint.setPen(Qt::red); + if (myLoad < 11) paint.setPen(TQt::yellow); + else paint.setPen(TQt::red); } - paint.setPen(Qt::green.light(60)); + paint.setPen(TQt::green.light(60)); for (int i = 0; i < myLoad; i++) { paint.drawLine((i*2)+1,19,(i*2)+1,21); } - paint.setPen(Qt::cyan.light(150)); + paint.setPen(TQt::cyan.light(150)); for (int i = myLoad; i < 11; i++) { paint.drawLine((i*2)+1,19,(i*2)+1,21); } @@ -837,7 +837,7 @@ void KNutDock::paintLoad (int load ) { -void KNutDock::paintNumbers (int numbers, int x, int y, QPainter* p, float sizeMult ) { +void KNutDock::paintNumbers (int numbers, int x, int y, TQPainter* p, float sizeMult ) { bool first = false; if (numbers > 199) numbers = 199; @@ -857,26 +857,26 @@ void KNutDock::paintNumbers (int numbers, int x, int y, QPainter* p, float sizeM } else { - p->setPen(Qt::black); + p->setPen(TQt::black); paintDash (((float) x+(5*sizeMult)),y,p,sizeMult); paintDash (((float) x+(10*sizeMult)),y,p,sizeMult); } } -void KNutDock::paintDash (int x, int y, QPainter *p, float sizeMult) { - QPen oldPen = p->pen(); - QPen newPen; +void KNutDock::paintDash (int x, int y, TQPainter *p, float sizeMult) { + TQPen oldPen = p->pen(); + TQPen newPen; newPen.setWidth(((float) (oldPen.width()+1)*sizeMult)-1); p->setPen(newPen); p->drawLine(x,((float) y+(3*sizeMult)),((float) x+(3*sizeMult)),((float) y+(3*sizeMult))); p->setPen(oldPen); } -void KNutDock::paintNumber (int x, int y, int number, QPainter *p, float sizeMult) { +void KNutDock::paintNumber (int x, int y, int number, TQPainter *p, float sizeMult) { // x and y are left top corner - QPen oldPen = p->pen(); - QPen newPen; + TQPen oldPen = p->pen(); + TQPen newPen; newPen.setWidth(((float) (oldPen.width()+1)*sizeMult)-1); p->setPen(newPen); @@ -938,7 +938,7 @@ void KNutDock::paintNumber (int x, int y, int number, QPainter *p, float sizeMul } -void KNutDock::paintChar (int x, int y, char LCDChar, QPainter *p) { +void KNutDock::paintChar (int x, int y, char LCDChar, TQPainter *p) { // x and y are left up corner switch (LCDChar) { case 'L': |