summaryrefslogtreecommitdiffstats
path: root/src/detaileddialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/detaileddialog.cpp')
-rw-r--r--src/detaileddialog.cpp63
1 files changed, 36 insertions, 27 deletions
diff --git a/src/detaileddialog.cpp b/src/detaileddialog.cpp
index 6a24349..8390f29 100644
--- a/src/detaileddialog.cpp
+++ b/src/detaileddialog.cpp
@@ -27,12 +27,16 @@
* \date 2006-2007
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
// KDE headers:
#include <kled.h>
#include <kiconloader.h>
#include <tdelocale.h>
-// QT headers:
+// TQt headers:
#include <tqpushbutton.h>
#include <tqlayout.h>
#include <tqlabel.h>
@@ -93,12 +97,12 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, TQPixmap *_pixmap, Settin
BatteryFrame->adjustSize();
tl_powerConsDesc->hide();
tl_powerConsValue->hide();
- 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()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setBattery()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryChanged()), this, TQ_SLOT(setBattery()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryChargingStateChanged(int)), this,
+ TQ_SLOT(setPowerConsumption()));
+ connect(primaryBatteries, TQ_SIGNAL(batteryRateChanged()), this,
+ TQ_SLOT(setPowerConsumption()));
setBattery();
setPowerConsumption();
} else {
@@ -122,21 +126,21 @@ detaileddialog::detaileddialog( HardwareInfo *_hwinfo, TQPixmap *_pixmap, Settin
}
ProcessorFrame->adjustSize();
- connect(OkButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(closeDetailedDlg()));
- connect(hwinfo, TQT_SIGNAL(ACStatus(bool)), this, TQT_SLOT(setAC()));
+ connect(OkButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(closeDetailedDlg()));
+ connect(hwinfo, TQ_SIGNAL(ACStatus(bool)), this, TQ_SLOT(setAC()));
// TODO: replace event
- //connect(pd, TQT_SIGNAL(schemeDataChanged()), this, TQT_SLOT(setInfos()));
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setInfos()));
+ //connect(pd, TQ_SIGNAL(schemeDataChanged()), this, TQ_SLOT(setInfos()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setInfos()));
if (hwinfo->supportCPUFreq() || cpuInfo->cpuFreqHW) {
// Check if cpufreq is available
cpuInfo->getCPUMaxSpeed();
setProcessor();
- connect(hwinfo, TQT_SIGNAL(currentCPUFreqPolicyChanged()), this, TQT_SLOT(setInfos()));
+ connect(hwinfo, TQ_SIGNAL(currentCPUFreqPolicyChanged()), this, TQ_SLOT(setInfos()));
} else {
// .. if not, use cpu throttling
if (!cpuInfo->getCPUThrottlingState() || numOfCPUs <= 1) {
- connect(hwinfo, TQT_SIGNAL(generalDataChanged()), this, TQT_SLOT(setProcessorThrottling()));
+ connect(hwinfo, TQ_SIGNAL(generalDataChanged()), this, TQ_SLOT(setProcessorThrottling()));
}
setProcessorThrottling();
}
@@ -154,7 +158,7 @@ detaileddialog::~detaileddialog() {
}
/*!
- * \b TQT_SLOT called if the dialog is closed by the user.
+ * \b Slot called if the dialog is closed by the user.
* We do some cleanups here.
*/
void detaileddialog::closeDetailedDlg() {
@@ -165,7 +169,7 @@ void detaileddialog::closeDetailedDlg() {
}
/*!
- * \b TQT_SLOT to set up the battery progress widgets.
+ * \b Slot to set up the battery progress widgets.
*/
void detaileddialog::setBattery() {
kdDebugFuncIn(trace);
@@ -266,19 +270,24 @@ void detaileddialog::setBattery() {
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU progress bar widgets.
+ * \b Slot to set up the Processor/CPU progress bar widgets.
*/
void detaileddialog::setPowerConsumption() {
kdDebugFuncIn(trace);
// refresh battery collection
primaryBatteries = hwinfo->getPrimaryBatteries();
- int rate = primaryBatteries->getCurrentRate();
+ double rate = primaryBatteries->getCurrentRate();
- if (rate > 0 && !primaryBatteries->getChargeLevelUnit().isEmpty()) {
+ if (rate > 0 && !primaryBatteries->getChargeLevelUnit().isEmpty()) {
TQString _val;
- _val.setNum(rate);
+ if (rate > 100) {
+ _val = TQString("%L1").arg((int)rate);
+ }
+ else {
+ _val = TQString("%L1").arg(rate, 0, 'g', 3);
+ }
_val += " " + primaryBatteries->getChargeLevelUnit().remove('h');
tl_powerConsValue->setText(_val);
@@ -298,7 +307,7 @@ void detaileddialog::setPowerConsumption() {
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU progress bar widgets.
+ * \b Slot to set up the Processor/CPU progress bar widgets.
*/
void detaileddialog::setProcessor() {
kdDebugFuncIn(trace);
@@ -332,12 +341,12 @@ void detaileddialog::setProcessor() {
ProcessorPBar[i]->setEnabled(false);
}
}
- TQTimer::singleShot(333, this, TQT_SLOT(setProcessor()));
+ TQTimer::singleShot(333, this, TQ_SLOT(setProcessor()));
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT to set up the Processor/CPU bar widgets for cpu throttling machines.
+ * \b Slot to set up the Processor/CPU bar widgets for cpu throttling machines.
*/
void detaileddialog::setProcessorThrottling() {
kdDebugFuncOut(trace);
@@ -356,7 +365,7 @@ void detaileddialog::setProcessorThrottling() {
// get max cpu freq and set it to the max of the progressbar
ProcessorPBar[i]->setTotalSteps(100);
TQString ProgressString = TQString("%1% (%2 MHz)").arg(100 - cpuInfo->cpu_throttling[i]).arg(cpuInfo->cpufreq_speed[i]);
- ProcessorPBar[i]->setFormat(i18n(ProgressString.ascii()));
+ ProcessorPBar[i]->setFormat(i18n(ProgressString.utf8()));
ProcessorPBar[i]->setProgress(100 - cpuInfo->cpu_throttling[i]);
ProcessorPBar[i]->setEnabled(true);
} else if (cpuInfo->cpufreq_speed[i] < 0) {
@@ -375,14 +384,14 @@ 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
- TQTimer::singleShot(2000, this, TQT_SLOT(setProcessorThrottling()));
+ TQTimer::singleShot(2000, this, TQ_SLOT(setProcessorThrottling()));
}
kdDebugFuncOut(trace);
}
/*!
- * \b TQT_SLOT to set up the AC status within the Led widget.
+ * \b Slot to set up the AC status within the Led widget.
*/
void detaileddialog::setAC() {
kdDebugFuncIn(trace);
@@ -400,7 +409,7 @@ void detaileddialog::setAC() {
}
/*!
- * \b TQT_SLOT to set all additional informtation as e.g. CPUFrequency policy
+ * \b Slot to set all additional informtation as e.g. CPUFrequency policy
* or current scheme
*/
void detaileddialog::setInfos() {
@@ -411,7 +420,7 @@ void detaileddialog::setInfos() {
if(!config->currentScheme.isEmpty())
display += i18n("Current Scheme: ") + "\n";
- displayValue += i18n(config->currentScheme.ascii()) + "\n";
+ displayValue += i18n(config->currentScheme.utf8()) + "\n";
if(config->currentScheme == config->ac_scheme)
InfoPictogram->setPixmap(SmallIcon("scheme_power", 22));
else if(config->currentScheme == config->battery_scheme)