summaryrefslogtreecommitdiffstats
path: root/src/knutfrontpanel.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 19:37:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 19:37:06 +0000
commit968af1d235ac30d737991b269156bee5dc99d318 (patch)
tree19b118fa5380087e10cb728be545760791ce0676 /src/knutfrontpanel.cpp
parentaea4882f3b37f17c5b56bc77667e683c52254c30 (diff)
downloadknutclient-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/knutfrontpanel.cpp')
-rwxr-xr-xsrc/knutfrontpanel.cpp200
1 files changed, 100 insertions, 100 deletions
diff --git a/src/knutfrontpanel.cpp b/src/knutfrontpanel.cpp
index caa5b6e..c8d5ef7 100755
--- a/src/knutfrontpanel.cpp
+++ b/src/knutfrontpanel.cpp
@@ -23,32 +23,32 @@
#include <klocale.h>
#include <kapp.h>
-#include <qtooltip.h>
-#include <qstring.h>
-#include <qpaintdevice.h>
-#include <qlayout.h>
-#include <qlcdnumber.h>
-//#include <qframe.h>
-#include <qlabel.h>
-#include <qcolor.h>
-#include <qfont.h>
-#include <qpalette.h>
-#include <qgroupbox.h>
+#include <tqtooltip.h>
+#include <tqstring.h>
+#include <tqpaintdevice.h>
+#include <tqlayout.h>
+#include <tqlcdnumber.h>
+//#include <tqframe.h>
+#include <tqlabel.h>
+#include <tqcolor.h>
+#include <tqfont.h>
+#include <tqpalette.h>
+#include <tqgroupbox.h>
#include <math.h>
-KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, const unsigned int flags, QFont* const panelFonts, const char *name) : QFrame( parent, name ), m_panelFlags(flags) {
+KNutFrontPanel::KNutFrontPanel( TQPalette* const paletteIn, TQWidget *tqparent, const unsigned int flags, TQFont* const panelFonts, const char *name) : TQFrame( tqparent, name ), m_panelFlags(flags) {
- m_myPalette = paletteIn->copy(); // makes deep copy of palette
- m_upsOkColor = Qt::green;
- m_upsErrorColor = Qt::red;
- m_upsBackColor = Qt::white; //backgroundColor();
- m_helpColor = Qt::black;
+ m_myPalette = TQPalette(*paletteIn); // makes deep copy of palette
+ m_upsOkColor = TQt::green;
+ m_upsErrorColor = TQt::red;
+ m_upsBackColor = TQt::white; //backgroundColor();
+ m_helpColor = TQt::black;
m_typeOfLCDColor=true;
m_LCDNumber1 = 0;
- setFrameStyle( QFrame::Box | QFrame::Raised );
+ setFrameStyle( TQFrame::Box | TQFrame::Raised );
setLineWidth( 2 );
if (panelFonts == 0) {
@@ -62,28 +62,28 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_panelBoldFont.setBold (TRUE);
m_panelFont.setBold (FALSE); // sets no bold
- m_mainLayout = new QVBoxLayout(this);
+ m_mainLayout = new TQVBoxLayout(this);
m_mainLayout->setMargin ( 10 );
m_mainLayout->setSpacing ( 10 );
// layer for bulbs
- m_bulbsGroupBox = new QGroupBox(this);
+ m_bulbsGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_bulbsGroupBox);
- m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
-// m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
+ m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
+// m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_bulbsGroupBox->setLineWidth(2);
- QVBoxLayout* bulbsLayout = new QVBoxLayout(m_bulbsGroupBox);
+ TQVBoxLayout* bulbsLayout = new TQVBoxLayout(m_bulbsGroupBox);
bulbsLayout->setMargin( 5 );
- m_textLabel1 = new QLabel( i18n("UPS On line"),m_bulbsGroupBox);
+ m_textLabel1 = new TQLabel( i18n("UPS On line"),m_bulbsGroupBox);
m_frameOL = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOL->setMaximumSize(30,30);
m_frameOL->setMinimumSize(25,25);
- QToolTip::add(m_textLabel1,m_textLabel1->text());
+ TQToolTip::add(m_textLabel1,m_textLabel1->text());
- QHBoxLayout* OLLayout = new QHBoxLayout(bulbsLayout);
+ TQHBoxLayout* OLLayout = new TQHBoxLayout(bulbsLayout);
OLLayout->addWidget(m_textLabel1);
OLLayout->addSpacing(10);
OLLayout->addWidget(m_frameOL);
@@ -92,13 +92,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
OLLayout->setStretchFactor(m_frameOL,5);
- m_textLabel2 = new QLabel( i18n("UPS On battery"), m_bulbsGroupBox);
+ m_textLabel2 = new TQLabel( i18n("UPS On battery"), m_bulbsGroupBox);
m_frameOB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOB->setMaximumSize(30,30);
m_frameOB->setMinimumSize(25,25);
- QToolTip::add(m_textLabel2,m_textLabel2->text());
+ TQToolTip::add(m_textLabel2,m_textLabel2->text());
- QHBoxLayout* OBLayout = new QHBoxLayout(bulbsLayout);
+ TQHBoxLayout* OBLayout = new TQHBoxLayout(bulbsLayout);
OBLayout->addWidget(m_textLabel2);
OBLayout->addSpacing(10);
OBLayout->addWidget(m_frameOB);
@@ -107,13 +107,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
OBLayout->setStretchFactor(m_frameOB,5);
- m_textLabel3 = new QLabel( i18n("UPS Overload"), m_bulbsGroupBox);
+ m_textLabel3 = new TQLabel( i18n("UPS Overload"), m_bulbsGroupBox);
m_frameOVER = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameOVER->setMaximumSize(30,30);
m_frameOVER->setMinimumSize(25,25);
- QToolTip::add(m_textLabel3,m_textLabel3->text());
+ TQToolTip::add(m_textLabel3,m_textLabel3->text());
- m_OLayout = new QHBoxLayout(bulbsLayout);
+ m_OLayout = new TQHBoxLayout(bulbsLayout);
m_OLayout->addWidget(m_textLabel3);
m_OLayout->addSpacing(10);
m_OLayout->addWidget(m_frameOVER);
@@ -121,13 +121,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_OLayout->setStretchFactor(m_textLabel3,20);
m_OLayout->setStretchFactor(m_frameOVER,5);
- m_textLabel4 = new QLabel( i18n("UPS Battery low"), m_bulbsGroupBox);
+ m_textLabel4 = new TQLabel( i18n("UPS Battery low"), m_bulbsGroupBox);
m_frameLB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameLB->setMaximumSize(30,30);
m_frameLB->setMinimumSize(25,25);
- QToolTip::add(m_textLabel4,m_textLabel4->text());
+ TQToolTip::add(m_textLabel4,m_textLabel4->text());
- m_LBLayout = new QHBoxLayout(bulbsLayout);
+ m_LBLayout = new TQHBoxLayout(bulbsLayout);
m_LBLayout->addWidget(m_textLabel4);
m_LBLayout->addSpacing(10);
m_LBLayout->addWidget(m_frameLB);
@@ -135,13 +135,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_LBLayout->setStretchFactor(m_textLabel4,20);
m_LBLayout->setStretchFactor(m_frameLB,5);
- m_textLabel5 = new QLabel( i18n("Replace battery"), m_bulbsGroupBox);
+ m_textLabel5 = new TQLabel( i18n("Replace battery"), m_bulbsGroupBox);
m_frameRB = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameRB->setMaximumSize(30,30);
m_frameRB->setMinimumSize(25,25);
- QToolTip::add(m_textLabel5,m_textLabel5->text());
+ TQToolTip::add(m_textLabel5,m_textLabel5->text());
- m_RBLayout = new QHBoxLayout(bulbsLayout);
+ m_RBLayout = new TQHBoxLayout(bulbsLayout);
m_RBLayout->addWidget(m_textLabel5);
m_RBLayout->addSpacing(10);
m_RBLayout->addWidget(m_frameRB);
@@ -149,13 +149,13 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_RBLayout->setStretchFactor(m_textLabel5,20);
m_RBLayout->setStretchFactor(m_frameRB,5);
- m_textLabel6 = new QLabel( i18n("UPS calibration"), m_bulbsGroupBox);
+ m_textLabel6 = new TQLabel( i18n("UPS calibration"), m_bulbsGroupBox);
m_frameCAL = new KLed (m_upsBackColor,KLed::Off,KLed::Sunken,KLed::Circular,m_bulbsGroupBox);
m_frameCAL->setMaximumSize(30,30);
m_frameCAL->setMinimumSize(25,25);
- QToolTip::add(m_textLabel6,m_textLabel6->text());
+ TQToolTip::add(m_textLabel6,m_textLabel6->text());
- m_CALLayout = new QHBoxLayout(bulbsLayout);
+ m_CALLayout = new TQHBoxLayout(bulbsLayout);
m_CALLayout->addWidget(m_textLabel6);
m_CALLayout->addSpacing(10);
m_CALLayout->addWidget(m_frameCAL);
@@ -164,81 +164,81 @@ KNutFrontPanel::KNutFrontPanel( QPalette* const paletteIn, QWidget *parent, cons
m_CALLayout->setStretchFactor(m_frameCAL,5);
- m_messGroupBox = new QGroupBox(this);
+ m_messGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_messGroupBox);
- m_messGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
-// m_messGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
+ m_messGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
+// m_messGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_messGroupBox->setLineWidth(2);
- QVBoxLayout* messLayout = new QVBoxLayout(m_messGroupBox);
+ TQVBoxLayout* messLayout = new TQVBoxLayout(m_messGroupBox);
messLayout->setMargin( 3 );
- m_textLabel7 = new QLabel( "", m_messGroupBox);
- QToolTip::add(m_textLabel7,m_textLabel7->text());
- m_manufacModelLayout = new QHBoxLayout(messLayout);
+ m_textLabel7 = new TQLabel( "", m_messGroupBox);
+ TQToolTip::add(m_textLabel7,m_textLabel7->text());
+ m_manufacModelLayout = new TQHBoxLayout(messLayout);
m_manufacModelLayout->addWidget(m_textLabel7);
m_manufacModelLayout->setMargin ( 3 );
- m_textLabelManufac = new QLabel( i18n("Manufac. : "), m_messGroupBox);
- m_textLabel8 = new QLabel( "", m_messGroupBox);
- QToolTip::add(m_textLabelManufac,m_textLabelManufac->text());
+ m_textLabelManufac = new TQLabel( i18n("Manufac. : "), m_messGroupBox);
+ m_textLabel8 = new TQLabel( "", m_messGroupBox);
+ TQToolTip::add(m_textLabelManufac,m_textLabelManufac->text());
- m_manufacLayout = new QHBoxLayout(messLayout);
+ m_manufacLayout = new TQHBoxLayout(messLayout);
m_manufacLayout->addWidget(m_textLabelManufac);
m_manufacLayout->addWidget(m_textLabel8);
m_manufacLayout->addStretch(20);
m_manufacLayout->setMargin ( 3 );
- m_textLabelName = new QLabel( i18n("Name")+" : ", m_messGroupBox);
- m_textLabel9 = new QLabel( "", m_messGroupBox);
- QToolTip::add(m_textLabelName,m_textLabelName->text());
+ m_textLabelName = new TQLabel( i18n("Name")+" : ", m_messGroupBox);
+ m_textLabel9 = new TQLabel( "", m_messGroupBox);
+ TQToolTip::add(m_textLabelName,m_textLabelName->text());
- m_nameLayout = new QHBoxLayout(messLayout);
+ m_nameLayout = new TQHBoxLayout(messLayout);
m_nameLayout->addWidget(m_textLabelName);
m_nameLayout->addWidget(m_textLabel9);
m_nameLayout->addStretch(20);
m_nameLayout->setMargin ( 3 );
- m_textLabelSerial = new QLabel( i18n("Serial : "), m_messGroupBox);
- m_textLabel10 = new QLabel( "", m_messGroupBox);
- QToolTip::add(m_textLabelSerial,m_textLabelSerial->text());
+ m_textLabelSerial = new TQLabel( i18n("Serial : "), m_messGroupBox);
+ m_textLabel10 = new TQLabel( "", m_messGroupBox);
+ TQToolTip::add(m_textLabelSerial,m_textLabelSerial->text());
- m_serialLayout = new QHBoxLayout(messLayout);
+ m_serialLayout = new TQHBoxLayout(messLayout);
m_serialLayout->addWidget(m_textLabelSerial);
m_serialLayout->addWidget(m_textLabel10);
m_serialLayout->addStretch(20);
m_serialLayout->setMargin ( 3 );
- m_textLabelFirm = new QLabel( i18n("Firm. rev. : "), m_messGroupBox);
- m_textLabel11 = new QLabel( "", m_messGroupBox);
- QToolTip::add(m_textLabelFirm,m_textLabelFirm->text());
+ m_textLabelFirm = new TQLabel( i18n("Firm. rev. : "), m_messGroupBox);
+ m_textLabel11 = new TQLabel( "", m_messGroupBox);
+ TQToolTip::add(m_textLabelFirm,m_textLabelFirm->text());
- m_firmLayout = new QHBoxLayout(messLayout);
+ m_firmLayout = new TQHBoxLayout(messLayout);
m_firmLayout->addWidget(m_textLabelFirm);
m_firmLayout->addWidget(m_textLabel11);
m_firmLayout->addStretch(20);
m_firmLayout->setMargin ( 3 );
- m_valGroupBox = new QGroupBox(this);
+ m_valGroupBox = new TQGroupBox(this);
m_mainLayout->addWidget(m_valGroupBox);
- m_valGroupBox->setFrameStyle( QFrame::Panel + QFrame::Raised);
-// m_bulbsGroupBox->setFrameStyle( QFrame::Panel + QFrame::Sunken);
+ m_valGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Raised);
+// m_bulbsGroupBox->setFrameStyle( TQFrame::Panel + TQFrame::Sunken);
m_valGroupBox->setLineWidth(2);
- QVBoxLayout* valLayout = new QVBoxLayout(m_valGroupBox);
+ TQVBoxLayout* valLayout = new TQVBoxLayout(m_valGroupBox);
valLayout->setMargin( 3 );
- m_textLabelRun = new QLabel( i18n("Runtime")+" : ", m_valGroupBox);
- QToolTip::add(m_textLabelRun,m_textLabelRun->text());
+ m_textLabelRun = new TQLabel( i18n("Runtime")+" : ", m_valGroupBox);
+ TQToolTip::add(m_textLabelRun,m_textLabelRun->text());
- m_LCDNumber1 = new QLCDNumber (5,m_valGroupBox);
- m_LCDNumber1->setSegmentStyle (QLCDNumber::Flat);
- m_LCDNumber1->setFrameStyle( QFrame::NoFrame );
+ m_LCDNumber1 = new TQLCDNumber (5,m_valGroupBox);
+ m_LCDNumber1->setSegmentStyle (TQLCDNumber::Flat);
+ m_LCDNumber1->setFrameStyle( TQFrame::NoFrame );
m_LCDNumber1->setMinimumSize(50,20);
- m_runLayout = new QHBoxLayout(valLayout);
+ m_runLayout = new TQHBoxLayout(valLayout);
m_runLayout->addWidget(m_textLabelRun);
m_runLayout->addStretch(20);
m_runLayout->addWidget(m_LCDNumber1);
@@ -404,34 +404,34 @@ unsigned int KNutFrontPanel::getPanelFlags( void) { return m_panelFlags; }
void KNutFrontPanel::setPanelFlags(const int upsPanelFlags) { m_panelFlags = upsPanelFlags; }
-void KNutFrontPanel::setAllNameUps(const QString panelUpsAllName ){
+void KNutFrontPanel::setAllNameUps(const TQString panelUpsAllName ){
m_textLabel7->setText(panelUpsAllName);
- QToolTip::remove(m_textLabel7);
- QToolTip::add(m_textLabel7,panelUpsAllName);
+ TQToolTip::remove(m_textLabel7);
+ TQToolTip::add(m_textLabel7,panelUpsAllName);
}
-void KNutFrontPanel::setMFRUps(const QString panelUpsFRM ){
+void KNutFrontPanel::setMFRUps(const TQString panelUpsFRM ){
m_textLabel8->setText(panelUpsFRM);
- QToolTip::remove(m_textLabelManufac);
- QToolTip::add(m_textLabelManufac,m_textLabelManufac->text()+panelUpsFRM);
+ TQToolTip::remove(m_textLabelManufac);
+ TQToolTip::add(m_textLabelManufac,m_textLabelManufac->text()+panelUpsFRM);
}
-void KNutFrontPanel::setNameUps(const QString panelUpsName ){
+void KNutFrontPanel::setNameUps(const TQString panelUpsName ){
m_textLabel9->setText(panelUpsName);
- QToolTip::remove(m_textLabelName);
- QToolTip::add(m_textLabelName,m_textLabelName->text()+panelUpsName);
+ TQToolTip::remove(m_textLabelName);
+ TQToolTip::add(m_textLabelName,m_textLabelName->text()+panelUpsName);
}
-void KNutFrontPanel::setSerialUps(const QString panelUpsSerial ){
+void KNutFrontPanel::setSerialUps(const TQString panelUpsSerial ){
m_textLabel10->setText(panelUpsSerial);
- QToolTip::remove(m_textLabelSerial);
- QToolTip::add(m_textLabelSerial,m_textLabelSerial->text()+panelUpsSerial);
+ TQToolTip::remove(m_textLabelSerial);
+ TQToolTip::add(m_textLabelSerial,m_textLabelSerial->text()+panelUpsSerial);
}
-void KNutFrontPanel::setFirmRevUps(const QString upsPanelFormRev ){
+void KNutFrontPanel::setFirmRevUps(const TQString upsPanelFormRev ){
m_textLabel11->setText(upsPanelFormRev);
- QToolTip::remove(m_textLabelFirm);
- QToolTip::add(m_textLabelFirm,m_textLabelFirm->text()+upsPanelFormRev);
+ TQToolTip::remove(m_textLabelFirm);
+ TQToolTip::add(m_textLabelFirm,m_textLabelFirm->text()+upsPanelFormRev);
}
@@ -460,12 +460,12 @@ void KNutFrontPanel::cleanPanel(void) {
}
void KNutFrontPanel::setRuntime(const int runtime) {
- QString runtimeString;
+ TQString runtimeString;
if (runtime != knc::numberVarError) {
int min = (int)floor(runtime/60);
int sec = runtime - (min*60);
- runtimeString=QString("%1:%2").arg(min,2).arg(sec,2);
+ runtimeString=TQString("%1:%2").tqarg(min,2).tqarg(sec,2);
if (runtimeString[3] == ' ') runtimeString[3]='0';
}
else runtimeString="-:--";
@@ -556,7 +556,7 @@ void KNutFrontPanel::setPanel(const int panelBulbs) {
/*********************************************************************************************/
-void KNutFrontPanel::slotSetPanelFont(QFont newPanelFont) {
+void KNutFrontPanel::slotSetPanelFont(TQFont newPanelFont) {
m_panelFont = newPanelFont; // nastavime font
m_panelBoldFont = newPanelFont; // pozdeji zmenime
@@ -580,20 +580,20 @@ void KNutFrontPanel::setLCDPalette (void) {
m_LCDPaletteOk = m_myPalette;
m_LCDPaletteErr = m_myPalette;
//Nastavime barvu pro OK system je online
- QColorGroup activeColorGroup = m_LCDPaletteOk.active();
- activeColorGroup.setColor( QColorGroup::Foreground, green);
+ TQColorGroup activeColorGroup = m_LCDPaletteOk.active();
+ activeColorGroup.setColor( TQColorGroup::Foreground, green);
m_LCDPaletteOk.setActive(activeColorGroup);
m_LCDPaletteOk.setInactive(activeColorGroup);
//Nastavime Barvu pro Error - System neni online
activeColorGroup = m_LCDPaletteErr.active();
- activeColorGroup.setColor( QColorGroup::Foreground, red);
+ activeColorGroup.setColor( TQColorGroup::Foreground, red);
m_LCDPaletteErr.setActive(activeColorGroup);
m_LCDPaletteErr.setInactive(activeColorGroup);
}
-void KNutFrontPanel::setPalette (const QPalette & p){
+void KNutFrontPanel::setPalette (const TQPalette & p){
m_myPalette = p;
setAllPalettes();
@@ -601,10 +601,10 @@ void KNutFrontPanel::setPalette (const QPalette & p){
void KNutFrontPanel::setAllPalettes (void){
- QColor myColor;
+ TQColor myColor;
- QFrame::setPalette (m_myPalette);
- //QColorGroup myColorGroup = myPalette.active();
+ TQFrame::setPalette (m_myPalette);
+ //TQColorGroup myColorGroup = myPalette.active();
// LCDPaletteOk = myPalette;
// LCDPaletteErr = myPalette;
@@ -615,7 +615,7 @@ void KNutFrontPanel::setAllPalettes (void){
m_frameOL->setPalette(m_bulbsPalette);
- // we must correct feature of KLed, KLed repaint background when color of item (function KLed::setColor()) is changed only
+ // we must correct feature of KLed, KLed tqrepaint background when color of item (function KLed::setColor()) is changed only
// when we change palette backround only, KLed ignore this change
myColor = m_frameOL->color();