From 4304e8d9dab8e20513e38e71b0debdf6937b630c Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 16 Apr 2011 23:01:29 +0000 Subject: Finish TQt4 port of kpowersave This enables both Qt3 and Qt4 builds git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpowersave@1228282 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/detaileddialog.cpp | 96 +++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'src/detaileddialog.cpp') diff --git a/src/detaileddialog.cpp b/src/detaileddialog.cpp index b75fcc9..2925062 100644 --- a/src/detaileddialog.cpp +++ b/src/detaileddialog.cpp @@ -33,11 +33,11 @@ #include // QT headers: -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // own headers #include "detaileddialog.h" @@ -45,9 +45,9 @@ /*! * This is the default constructor of the class detaileddialog. */ -detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Settings *_set, - QWidget* parent, const char* name ) - : detailed_Dialog( parent, name, false, WDestructiveClose ) { +detaileddialog::detaileddialog( HardwareInfo *_hwinfo, TQPixmap *_pixmap, Settings *_set, + TQWidget* tqparent, const char* name ) + : detailed_Dialog( tqparent, name, false, WDestructiveClose ) { kdDebugFuncIn(trace); hwinfo = _hwinfo; config = _set; @@ -65,22 +65,22 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Setting GeneralGroup->setTitle(i18n("Miscellaneous")); ProcessorGroup->setTitle(i18n("CPUs")); - ProcessorGridLayout = new QGridLayout(ProcessorFrame, numOfCPUs, 2, 0, 5, "ProcessorGridLayout"); + ProcessorGridLayout = new TQGridLayout(ProcessorFrame, numOfCPUs, 2, 0, 5, "ProcessorGridLayout"); if (batteries > 0) { if (batteries > 1) batteries++; BatteryGroup->setTitle(i18n("Battery state:").remove(":")); - BatteryGridLayout = new QGridLayout(BatteryFrame, batteries, 2, 0, 5, "BatteryGridLayout"); + BatteryGridLayout = new TQGridLayout(BatteryFrame, batteries, 2, 0, 5, "BatteryGridLayout"); for (int i = 0; i < batteries; i++) { - QLabel *Label = new QLabel(BatteryFrame, "BatteryLabel"); + TQLabel *Label = new TQLabel(BatteryFrame, "BatteryLabel"); if ((primaryBatteries->getNumBatteries() > 1) && (i == 0)) Label->setText( i18n( "Total:" )); else if ((primaryBatteries->getNumBatteries() > 1) && (i > 0)) - Label->setText( i18n( "Battery %1" ).arg(i)); + Label->setText( i18n( "Battery %1" ).tqarg(i)); else - Label->setText( i18n( "Battery %1" ).arg(i + 1)); + Label->setText( i18n( "Battery %1" ).tqarg(i + 1)); BatteryGridLayout->addWidget( Label, i , 0); @@ -93,12 +93,12 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Setting BatteryFrame->adjustSize(); tl_powerConsDesc->hide(); tl_powerConsValue->hide(); - connect(hwinfo, SIGNAL(generalDataChanged()), this, SLOT(setBattery())); - connect(primaryBatteries, SIGNAL(batteryChanged()), this, SLOT(setBattery())); - connect(primaryBatteries, SIGNAL(batteryChargingStateChanged(int)), this, - SLOT(setPowerConsumption())); - connect(primaryBatteries, SIGNAL(batteryRateChanged()), this, - SLOT(setPowerConsumption())); + connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setBattery())); + connect(primaryBatteries, TQT_SIGNAL(batteryChanged()), this, TQT_SLOT(setBattery())); + connect(primaryBatteries, TQT_SIGNAL(batteryChargingStateChanged(int)), this, + TQT_SLOT(setPowerConsumption())); + connect(primaryBatteries, TQT_SIGNAL(batteryRateChanged()), this, + TQT_SLOT(setPowerConsumption())); setBattery(); setPowerConsumption(); } else { @@ -110,8 +110,8 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Setting ProcessorPictogram->setPixmap(SmallIcon("processor", 22)); for (int i = 0; i < numOfCPUs; i++) { - QLabel *Label = new QLabel(ProcessorFrame, "ProcessorLabel"); - Label->setText( i18n( "Processor %1" ).arg(i + 1)); + TQLabel *Label = new TQLabel(ProcessorFrame, "ProcessorLabel"); + Label->setText( i18n( "Processor %1" ).tqarg(i + 1)); ProcessorGridLayout->addWidget( Label, i , 0); KProgress *CPUPBar = new KProgress(ProcessorFrame, "ProcessorPBar"); @@ -122,21 +122,21 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Setting } ProcessorFrame->adjustSize(); - connect(OkButton, SIGNAL(clicked()), this, SLOT(closeDetailedDlg())); - connect(hwinfo, SIGNAL(ACStatus(bool)), this, SLOT(setAC())); + connect(OkButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(closeDetailedDlg())); + connect(hwinfo, TQT_SIGNAL(ACtqStatus(bool)), this, TQT_SLOT(setAC())); // TODO: replace event - //connect(pd, SIGNAL(schemeDataChanged()), this, SLOT(setInfos())); - connect(hwinfo, SIGNAL(generalDataChanged()), this, SLOT(setInfos())); + //connect(pd, TQT_SIGNAL(schemeDataChanged()), this, TQT_SLOT(setInfos())); + connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setInfos())); if (hwinfo->supportCPUFreq() || cpuInfo->cpuFreqHW) { // Check if cpufreq is available cpuInfo->getCPUMaxSpeed(); setProcessor(); - connect(hwinfo, SIGNAL(currentCPUFreqPolicyChanged()), this, SLOT(setInfos())); + connect(hwinfo, TQT_SIGNAL(currentCPUFreqPolicyChanged()), this, TQT_SLOT(setInfos())); } else { // .. if not, use cpu throttling if (!cpuInfo->getCPUThrottlingState() || numOfCPUs <= 1) { - connect(hwinfo, SIGNAL(generalDataChanged()), this, SLOT(setProcessorThrottling())); + connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setProcessorThrottling())); } setProcessorThrottling(); } @@ -150,11 +150,11 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, QPixmap *_pixmap, Setting /*! This is the default destructor of class detaileddialog. */ detaileddialog::~detaileddialog() { kdDebugFuncIn(trace); - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, TQt does it all for us } /*! - * \b SLOT called if the dialog is closed by the user. + * \b TQT_SLOT called if the dialog is closed by the user. * We do some cleanups here. */ void detaileddialog::closeDetailedDlg() { @@ -165,18 +165,18 @@ void detaileddialog::closeDetailedDlg() { } /*! - * \b SLOT to set up the battery progress widgets. + * \b TQT_SLOT to set up the battery progress widgets. */ void detaileddialog::setBattery() { kdDebugFuncIn(trace); - QString minutes; + TQString minutes; int batteries = 0; // refresh battery collection primaryBatteries = hwinfo->getPrimaryBatteries(); - QPtrList allBatteries = hwinfo->getAllBatteries(); + TQPtrList allBatteries = hwinfo->getAllBatteries(); batteries = primaryBatteries->getNumBatteries(); @@ -242,10 +242,10 @@ void detaileddialog::setBattery() { // this should fix apm, where we have no time info if charging BatteryPBar[i]->setFormat("%p% " + i18n("charged")); } else if (_c_state == CHARGING) { - QString temp = i18n("%1:%2 h until charged").arg(hours).arg(minutes); + TQString temp = i18n("%1:%2 h until charged").tqarg(hours).tqarg(minutes); BatteryPBar[i]->setFormat(temp); } else if (_c_state == DISCHARGING) { - QString temp = i18n("%1:%2 h remaining").arg(hours).arg(minutes); + TQString temp = i18n("%1:%2 h remaining").tqarg(hours).tqarg(minutes); BatteryPBar[i]->setFormat(temp); } else { @@ -266,7 +266,7 @@ void detaileddialog::setBattery() { } /*! - * \b SLOT to set up the Processor/CPU progress bar widgets. + * \b TQT_SLOT to set up the Processor/CPU progress bar widgets. */ void detaileddialog::setPowerConsumption() { kdDebugFuncIn(trace); @@ -277,7 +277,7 @@ void detaileddialog::setPowerConsumption() { if (rate > 0 && !primaryBatteries->getChargeLevelUnit().isEmpty()) { - QString _val; + TQString _val; _val.setNum(rate); _val += " " + primaryBatteries->getChargeLevelUnit().remove('h'); @@ -298,7 +298,7 @@ void detaileddialog::setPowerConsumption() { } /*! - * \b SLOT to set up the Processor/CPU progress bar widgets. + * \b TQT_SLOT to set up the Processor/CPU progress bar widgets. */ void detaileddialog::setProcessor() { kdDebugFuncIn(trace); @@ -332,12 +332,12 @@ void detaileddialog::setProcessor() { ProcessorPBar[i]->setEnabled(false); } } - QTimer::singleShot(333, this, SLOT(setProcessor())); + TQTimer::singleShot(333, this, TQT_SLOT(setProcessor())); kdDebugFuncOut(trace); } /*! - * \b SLOT to set up the Processor/CPU bar widgets for cpu throttling machines. + * \b TQT_SLOT to set up the Processor/CPU bar widgets for cpu throttling machines. */ void detaileddialog::setProcessorThrottling() { kdDebugFuncOut(trace); @@ -355,7 +355,7 @@ void detaileddialog::setProcessorThrottling() { if (throttling && cpuInfo->cpufreq_speed[i] > 0 && cpuInfo->cpu_throttling[i] >= 0) { // get max cpu freq and set it to the max of the progressbar ProcessorPBar[i]->setTotalSteps(100); - QString ProgressString = QString("%1% (%2 MHz)").arg(100 - cpuInfo->cpu_throttling[i]).arg(cpuInfo->cpufreq_speed[i]); + TQString ProgressString = TQString("%1% (%2 MHz)").tqarg(100 - cpuInfo->cpu_throttling[i]).tqarg(cpuInfo->cpufreq_speed[i]); ProcessorPBar[i]->setFormat(i18n(ProgressString.ascii())); ProcessorPBar[i]->setProgress(100 - cpuInfo->cpu_throttling[i]); ProcessorPBar[i]->setEnabled(true); @@ -375,24 +375,24 @@ void detaileddialog::setProcessorThrottling() { // currently there are no events we can use to get actual data // so we recheck data ever 2 secs to register changes in the // throttling state and if a CPU/core online state change - QTimer::singleShot(2000, this, SLOT(setProcessorThrottling())); + TQTimer::singleShot(2000, this, TQT_SLOT(setProcessorThrottling())); } kdDebugFuncOut(trace); } /*! - * \b SLOT to set up the AC status within the Led widget. + * \b TQT_SLOT to set up the AC status within the Led widget. */ void detaileddialog::setAC() { kdDebugFuncIn(trace); if (hwinfo->getAcAdapter()) { - LabelACStatus->setText( i18n("plugged in") ); + LabelACtqStatus->setText( i18n("plugged in") ); LedAC->on(); } else { LedAC->off(); - LabelACStatus->setText( i18n("unplugged") ); + LabelACtqStatus->setText( i18n("unplugged") ); } setInfos(); @@ -400,14 +400,14 @@ void detaileddialog::setAC() { } /*! - * \b SLOT to set all additional informtation as e.g. CPUFrequency policy + * \b TQT_SLOT to set all additional informtation as e.g. CPUFrequency policy * or current scheme */ void detaileddialog::setInfos() { kdDebugFuncOut(trace); - QString display; - QString displayValue; + TQString display; + TQString displayValue; if(!config->currentScheme.isEmpty()) display += i18n("Current Scheme: ") + "\n"; @@ -447,7 +447,7 @@ void detaileddialog::setInfos() { // refresh battery collection primaryBatteries = hwinfo->getPrimaryBatteries(); int batteries = primaryBatteries->getNumBatteries(); - QPtrList allBatteries = hwinfo->getAllBatteries(); + TQPtrList allBatteries = hwinfo->getAllBatteries(); if (batteries > 0 && primaryBatteries->getNumPresentBatteries() > 0) { -- cgit v1.2.3