KDE/kdebase/workspace/plasma/applets/battery
Sebastian Kügler
sebas at kde.org
Sat Jun 6 03:02:37 CEST 2009
SVN commit 978089 by sebas:
showing the remaining time is now opt-in for geeks
- Only show the time in the popup when m_showRemainingTime is true
- m_showRemainingTime can still be set manually in the config file
- Removed options from the config UI
I've disabled this feature for now since it doesn't work well enough
in a lot of cases. For those that really can't live without that
information, you can still enable it in the config, add a line such
as:
showRemainingTime=false
in the applet's configuration, and it comes back (as unreliable as
this information actually is).
CCMAIL:plasma-devel at kde.org
M +2 -18 battery.cpp
M +18 -109 batteryConfig.ui
--- trunk/KDE/kdebase/workspace/plasma/applets/battery/battery.cpp #978088:978089
@@ -192,7 +192,7 @@
setMinimumSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
}
- if (constraints & Plasma::FormFactorConstraint &&
+ if (constraints & Plasma::FormFactorConstraint &&
(formFactor() == Plasma::Planar || formFactor() == Plasma::MediaCenter) ) {
resize(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous);
}
@@ -245,11 +245,6 @@
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
ui.showBatteryStringCheckBox->setChecked(m_showBatteryString ? Qt::Checked : Qt::Unchecked);
- if (m_showRemainingTime) {
- ui.showTimeRadioButton->setChecked(Qt::Checked);
- } else {
- ui.showPercentageRadioButton->setChecked(Qt::Checked);
- }
ui.showMultipleBatteriesCheckBox->setChecked(m_showMultipleBatteries ? Qt::Checked : Qt::Unchecked);
}
@@ -257,16 +252,6 @@
{
KConfigGroup cg = config();
- if (m_showRemainingTime != ui.showTimeRadioButton->isChecked()) {
- // kDebug() << "config changed";
- m_showRemainingTime = !m_showRemainingTime;
- cg.writeEntry("showRemainingTime", m_showRemainingTime);
- // kDebug() << m_showRemainingTime;
- if (m_showBatteryString && m_showBatteryString == ui.showBatteryStringCheckBox->isChecked()) {
- showLabel(m_showBatteryString);
- }
- }
-
if (m_showBatteryString != ui.showBatteryStringCheckBox->isChecked()) {
m_showBatteryString = !m_showBatteryString;
cg.writeEntry("showBatteryString", m_showBatteryString);
@@ -544,13 +529,12 @@
QString state = battery_data.value()["State"].toString();
m_remainingMSecs = battery_data.value()["Remaining msec"].toInt();
kDebug() << "time left:" << m_remainingMSecs;
- if (state == "Discharging" && m_remainingMSecs > 0) {
+ if (state == "Discharging" && m_remainingMSecs > 0 && m_showRemainingTime) {
// FIXME: Somehow, m_extenderApplet is null here, so the label never becomes visible
if (m_extenderApplet) {
m_extenderApplet->showBatteryLabel(true);
}
-
// we don't have too much accuracy so only give hours and minutes
batteryLabelText.append(i18n("Time remaining: <b>%1</b><br />", KGlobal::locale()->prettyFormatDuration(m_remainingMSecs)));
} else {
--- trunk/KDE/kdebase/workspace/plasma/applets/battery/batteryConfig.ui #978088:978089
@@ -1,103 +1,45 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>batteryConfig</class>
- <widget class="QWidget" name="batteryConfig" >
- <property name="geometry" >
+ <widget class="QWidget" name="batteryConfig">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>363</width>
- <height>270</height>
+ <width>247</width>
+ <height>73</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>Configure Battery Monitor</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QCheckBox" name="showBatteryStringCheckBox" >
- <property name="toolTip" >
+ <widget class="QCheckBox" name="showBatteryStringCheckBox">
+ <property name="toolTip">
<string/>
</property>
- <property name="text" >
+ <property name="text">
<string>Show charge &information</string>
</property>
</widget>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="1" >
- <widget class="QRadioButton" name="showPercentageRadioButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Show &percentage</string>
- </property>
- <property name="checked" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0" >
- <spacer name="horizontalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="1" >
- <widget class="QRadioButton" name="showTimeRadioButton" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="text" >
- <string>Show remaining &time</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="showMultipleBatteriesCheckBox" >
- <property name="toolTip" >
+ <widget class="QCheckBox" name="showMultipleBatteriesCheckBox">
+ <property name="toolTip">
<string/>
</property>
- <property name="text" >
+ <property name="text">
<string>Show the state for &each battery present</string>
</property>
</widget>
</item>
<item>
- <spacer name="verticalSpacer" >
- <property name="orientation" >
+ <spacer name="verticalSpacer">
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0" >
+ <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>15</height>
@@ -108,38 +50,5 @@
</layout>
</widget>
<resources/>
- <connections>
- <connection>
- <sender>showBatteryStringCheckBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>showPercentageRadioButton</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>181</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel" >
- <x>195</x>
- <y>52</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>showBatteryStringCheckBox</sender>
- <signal>toggled(bool)</signal>
- <receiver>showTimeRadioButton</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>181</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel" >
- <x>195</x>
- <y>83</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
More information about the Plasma-devel
mailing list