rpms/kdebase-workspace/devel kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime.patch, NONE, 1.1 kdebase-workspace-4.3.75-battery-plasmoid-trunk.patch, NONE, 1.1 kdebase-workspace-4.3.75-brightness-keys.patch, 1.1, 1.2 kdebase-workspace.spec, 1.317, 1.318 kdebase-workspace-4.3.0-battery-plasmoid-showremainingtime.patch, 1.1, NONE
Kevin Kofler
kkofler at fedoraproject.org
Sat Nov 28 01:44:15 UTC 2009
Author: kkofler
Update of /cvs/pkgs/rpms/kdebase-workspace/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8948/devel
Modified Files:
kdebase-workspace-4.3.75-brightness-keys.patch
kdebase-workspace.spec
Added Files:
kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime.patch
kdebase-workspace-4.3.75-battery-plasmoid-trunk.patch
Removed Files:
kdebase-workspace-4.3.0-battery-plasmoid-showremainingtime.patch
Log Message:
* Sat Nov 28 2009 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.75-0.4.svn1048496
- backport battery plasmoid from current pre-4.3.80 trunk for showremainingtime
- rebase battery-plasmoid-showremainingtime patch
- rebase brightness-keys patch for the above backport
kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime.patch:
battery.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- NEW FILE kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime.patch ---
diff -ur kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.cpp kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime/plasma/generic/applets/battery/battery.cpp
--- kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.cpp 2009-11-28 02:18:58.000000000 +0100
+++ kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime/plasma/generic/applets/battery/battery.cpp 2009-11-28 02:21:57.000000000 +0100
@@ -606,7 +606,11 @@
}
m_remainingMSecs = battery_data.value()["Remaining msec"].toInt();
//kDebug() << "time left:" << m_remainingMSecs;
- if ((state == "Discharging" || state == "Charging") && m_remainingMSecs > 0 && m_showRemainingTime) {
+ // Always show the remaining time in the popup (like KDE 4.2.x did).
+ // We don't just set m_showRemainingTime to true by default because
+ // that'd try to use the time also for the icon. That won't fit on
+ // small panels and wasn't the default in 4.2 either.
+ if ((state == "Discharging" || state == "Charging") && m_remainingMSecs > 0) {
m_remainingTimeLabel->show();
m_remainingInfoLabel->show();
// we don't have too much accuracy so only give hours and minutes
kdebase-workspace-4.3.75-battery-plasmoid-trunk.patch:
battery.cpp | 466 +++++++++++++++++++++++++++---------------------------------
battery.h | 43 +++--
2 files changed, 236 insertions(+), 273 deletions(-)
--- NEW FILE kdebase-workspace-4.3.75-battery-plasmoid-trunk.patch ---
Index: plasma/generic/applets/battery/battery.h
===================================================================
--- plasma/generic/applets/battery/battery.h (revision 1048496)
+++ plasma/generic/applets/battery/battery.h (revision 1055429)
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2007-2008 by Sebastian Kuegler <sebas at kde.org> *
+ * Copyright (C) 2007-2009 by Sebastian Kuegler <sebas at kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -22,6 +22,7 @@
#include <QGraphicsSceneHoverEvent>
#include <QGraphicsGridLayout>
+#include <QPropertyAnimation>
#include <Plasma/Applet>
#include <Plasma/Animator>
@@ -41,6 +42,9 @@
class Battery : public Plasma::PopupApplet
{
Q_OBJECT
+ Q_PROPERTY(qreal labelAlpha READ labelAlpha WRITE setLabelAlpha NOTIFY labelAlphaChanged)
+ Q_PROPERTY(qreal acAlpha READ acAlpha WRITE setAcAlpha)
+
public:
Battery(QObject *parent, const QVariantList &args);
~Battery();
@@ -54,7 +58,12 @@
void popupEvent(bool show);
void showBatteryLabel(bool show);
- public slots:
+ qreal labelAlpha();
+ void setLabelAlpha(qreal alpha);
+ qreal acAlpha();
+ void setAcAlpha(qreal alpha);
+
+ public Q_SLOTS:
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
protected Q_SLOTS:
@@ -67,10 +76,10 @@
void createConfigurationInterface(KConfigDialog *parent);
void setEmbedded(const bool embedded);
- private slots:
- void animationUpdate(qreal progress);
- void acAnimationUpdate(qreal progress);
- void batteryAnimationUpdate(qreal progress);
+ private Q_SLOTS:
+ //void animationUpdate(qreal progress);
+ //void acAnimationUpdate(qreal progress);
+ //void batteryAnimationUpdate(qreal progress);
void sourceAdded(const QString &source);
void sourceRemoved(const QString &source);
void brightnessChanged(const int brightness);
@@ -80,6 +89,8 @@
void setProfile(const QString &profile);
void suspend();
void hibernate();
+ void updateBattery();
+ void setupFonts();
private:
void connectSources();
@@ -98,6 +109,8 @@
Plasma::Label *m_batteryInfoLabel;
Plasma::Label *m_acLabelLabel;
Plasma::Label *m_acInfoLabel;
+ Plasma::Label *m_remainingTimeLabel;
+ Plasma::Label *m_remainingInfoLabel;
//QGraphicsGridLayout *m_brightnessLayout;
Plasma::Label *m_statusLabel;
//Plasma::Label *m_batteryLabel;
@@ -111,7 +124,7 @@
/* Paint a label on top of the battery */
void paintLabel(QPainter *p, const QRect &contentsRect, const QString& labelText);
/* Scale in/out Battery. */
- void showBattery(bool show);
+ //void showBattery(bool show);
/* Scale in/out Ac Adapter. */
void showAcAdapter(bool show);
/* Fade in/out the label above the battery. */
@@ -137,23 +150,12 @@
// Configuration dialog
Ui::batteryConfig ui;
- int m_animId;
- qreal m_alpha;
- bool m_fadeIn;
-
- int m_acAnimId;
- qreal m_acAlpha;
- bool m_acFadeIn;
-
int m_batteryAnimId;
- qreal m_batteryAlpha;
- bool m_batteryFadeIn;
// Internal data
QList<QVariant> batterylist, acadapterlist;
QHash<QString, QHash<QString, QVariant> > m_batteries_data;
QFont m_font;
- bool m_isHovered;
bool m_firstRun;
QColor m_boxColor;
QColor m_textColor;
@@ -163,6 +165,11 @@
int m_numOfBattery;
bool m_acAdapterPlugged;
int m_remainingMSecs;
+
+ qreal m_labelAlpha;
+ QPropertyAnimation *m_labelAnimation;
+ qreal m_acAlpha;
+ QPropertyAnimation *m_acAnimation;
};
K_EXPORT_PLASMA_APPLET(battery, Battery)
Index: plasma/generic/applets/battery/battery.cpp
===================================================================
--- plasma/generic/applets/battery/battery.cpp (revision 1048496)
+++ plasma/generic/applets/battery/battery.cpp (revision 1055429)
@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright 2007-2008 by Riccardo Iaconelli <riccardo at kde.org> *
- * Copyright 2007-2008 by Sebastian Kuegler <sebas at kde.org> *
+ * Copyright 2007-2009 by Sebastian Kuegler <sebas at kde.org> *
* Copyright 2007 by Luka Renko <lure at kubuntu.org> *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,6 +32,7 @@
#include <QGraphicsLinearLayout>
#include <QDBusPendingCall>
#include <QLabel>
+#include <QPropertyAnimation>
#include <KDebug>
#include <KIcon>
@@ -67,12 +68,10 @@
m_isEmbedded(false),
m_extenderVisible(false),
m_controlsLayout(0),
- //m_batteryLayout(0),
m_batteryLabelLabel(0),
m_batteryInfoLabel(0),
m_acLabelLabel(0),
m_acInfoLabel(0),
- //m_brightnessLayout(0),
m_profileLabel(0),
m_profileCombo(0),
m_brightnessSlider(0),
@@ -81,20 +80,13 @@
m_theme(0),
m_availableProfiles(QStringList()),
m_currentProfile(0),
- m_animId(-1),
- m_alpha(0),
- m_fadeIn(false),
- m_acAnimId(-1),
- m_acAlpha(0),
- m_acFadeIn(false),
- m_batteryAnimId(-1),
- m_batteryAlpha(0),
- m_batteryFadeIn(false),
- m_isHovered(false),
- m_firstRun(true),
m_numOfBattery(0),
m_acAdapterPlugged(false),
- m_remainingMSecs(0)
+ m_remainingMSecs(0),
+ m_labelAlpha(0),
+ m_labelAnimation(0),
+ m_acAlpha(0),
+ m_acAnimation(0)
{
//kDebug() << "Loading applet battery";
setAcceptsHoverEvents(true);
@@ -108,6 +100,20 @@
m_theme->setImagePath("widgets/battery-oxygen");
m_theme->setContainsMultipleImages(true);
setStatus(Plasma::ActiveStatus);
+ //setPassivePopup(true);
+
+ m_labelAnimation = new QPropertyAnimation(this, "labelAlpha");
+ m_labelAnimation->setDuration(200);
+ m_labelAnimation->setStartValue((qreal)(0.0));
+ m_labelAnimation->setEndValue((qreal)(1.0));
+ m_labelAnimation->setEasingCurve(QEasingCurve::OutQuad);
+ connect(m_labelAnimation, SIGNAL(finished()), this, SLOT(updateBattery()));
+ m_acAnimation = new QPropertyAnimation(this, "acAlpha");
+ m_acAnimation->setDuration(500);
+ m_acAnimation->setStartValue((qreal)(0.0));
+ m_acAnimation->setEndValue((qreal)(1.0));
+ m_acAnimation->setEasingCurve(QEasingCurve::OutBack);
+ connect(m_acAnimation, SIGNAL(finished()), this, SLOT(updateBattery()));
}
void Battery::init()
@@ -119,12 +125,6 @@
m_showMultipleBatteries = cg.readEntry("showMultipleBatteries", !m_isEmbedded);
m_theme->resize(contentsRect().size());
- if (m_acAdapterPlugged) {
- showAcAdapter(true);
- }
- showBattery(true);
-
- m_theme->resize(contentsRect().size());
m_font = QApplication::font();
m_font.setWeight(QFont::Bold);
@@ -134,14 +134,13 @@
readColors();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(readColors()));
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), SLOT(readColors()));
+ connect(KGlobalSettings::self(), SIGNAL(appearanceChanged()), SLOT(setupFonts()));
const QStringList& battery_sources = dataEngine("powermanagement")->query("Battery")["sources"].toStringList();
- //connect sources
connectSources();
foreach (const QString &battery_source, battery_sources) {
- //kDebug() << "BatterySource:" << battery_source;
dataUpdated(battery_source, dataEngine("powermanagement")->query(battery_source));
}
m_numOfBattery = battery_sources.size();
@@ -158,8 +157,17 @@
if (m_showBatteryString) {
showLabel(m_showBatteryString);
}
+ if (m_acAdapterPlugged) {
+ showAcAdapter(true);
+ }
+
}
+void Battery::updateBattery()
+{
+ update();
+}
+
void Battery::constraintsEvent(Plasma::Constraints constraints)
{
//kDebug() << "ConstraintsEvent, Dude." << contentsRect();
@@ -279,7 +287,7 @@
//kDebug() << "Show multiple battery changed: " << m_showMultipleBatteries;
emit sizeHintChanged(Qt::PreferredSize);
}
-
+
emit configNeedsSaving();
}
@@ -287,15 +295,14 @@
{
m_textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
m_boxColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
- m_boxColor.setAlpha(m_boxAlpha);
}
void Battery::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
- showLabel(true);
- //showAcAdapter(false); // to test the animation without constant plugging
- //showBattery(false); // to test the animation without constant plugging
- m_isHovered = true;
+ if (!m_showBatteryString) {
+ showLabel(true);
+ }
+ //showAcAdapter(true);
Applet::hoverEnterEvent(event);
}
@@ -304,9 +311,7 @@
if (!m_showBatteryString && !m_isEmbedded) {
showLabel(false);
}
- //showAcAdapter(true); // to test the animation without constant plugging
- //showBattery(true); // to test the animation without constant plugging
- //m_isHovered = false;
+ //showAcAdapter(false);
Applet::hoverLeaveEvent(event);
}
@@ -361,8 +366,6 @@
// as the battery applet is also embedded into the battery's extender.
if (!m_isEmbedded && item->name() == "powermanagement") {
int row = 0;
- int rowHeight = 20;
- int columnWidth = 120;
QGraphicsWidget *controls = new QGraphicsWidget(item);
controls->setMinimumWidth(360);
@@ -389,6 +392,15 @@
m_controlsLayout->addItem(m_acInfoLabel, row, 1);
row++;
+ m_remainingTimeLabel = new Plasma::Label(controls);
+ m_remainingTimeLabel->setAlignment(Qt::AlignRight);
+ //m_remainingTimeLabel->setText(i18nc("Label for remaining time", "Time Remaining:"));
+ m_remainingInfoLabel = new Plasma::Label(controls);
+ m_remainingInfoLabel->nativeWidget()->setWordWrap(false);
+ m_controlsLayout->addItem(m_remainingTimeLabel, row, 0);
+ m_controlsLayout->addItem(m_remainingInfoLabel, row, 1);
+ row++;
+
Battery *m_extenderApplet = static_cast<Battery*>(Plasma::Applet::load("battery"));
int s = 64;
if (m_extenderApplet) {
@@ -406,27 +418,10 @@
m_extenderApplet->updateConstraints(Plasma::StartupCompletedConstraint);
}
- Plasma::Label *spacer1 = new Plasma::Label(controls);
- spacer1->setMinimumHeight(8);
- spacer1->setMaximumHeight(8);
- m_controlsLayout->addItem(spacer1, row, 0);
- row++;
-
- Plasma::Separator *sep1 = new Plasma::Separator(controls);
- sep1->setMaximumWidth(controls->geometry().width()-s);
- m_controlsLayout->addItem(sep1, row, 0, 1, 2, Qt::AlignLeft);
- row++;
-
- Plasma::Label *spacer2 = new Plasma::Label(controls);
- spacer2->setMinimumHeight(8);
- spacer2->setMaximumHeight(8);
- m_controlsLayout->addItem(spacer2, row, 0);
- row++;
-
Plasma::Label *brightnessLabel = new Plasma::Label(controls);
brightnessLabel->setText(i18n("Screen Brightness"));
brightnessLabel->nativeWidget()->setWordWrap(false);
- brightnessLabel->setAlignment(Qt::AlignRight);
+ brightnessLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
m_controlsLayout->addItem(brightnessLabel, row, 0);
@@ -447,20 +442,50 @@
m_profileLabel = new Plasma::Label(controls);
m_profileLabel->setText(i18n("Power Profile"));
- m_profileLabel->setAlignment(Qt::AlignRight);
+ m_profileLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
m_controlsLayout->addItem(m_profileLabel, row, 0);
+ QGraphicsWidget *profileWidget = new QGraphicsWidget(controls);
+
+ QGraphicsLinearLayout *profileLayout = new QGraphicsLinearLayout(profileWidget);
+ profileLayout->setSpacing(0.0);
+
m_profileCombo = new Plasma::ComboBox(controls);
// This is necessary until Qt task #217874 is fixed
m_profileCombo->setZValue(100);
connect(m_profileCombo, SIGNAL(activated(QString)),
this, SLOT(setProfile(QString)));
- m_controlsLayout->addItem(m_profileCombo, row, 1);
- row++;
+ profileLayout->addItem(m_profileCombo);
int buttonsize = KIconLoader::SizeMedium + 4;
+ // Configure button
+ Plasma::IconWidget *configButton = new Plasma::IconWidget(profileWidget);
+ configButton->setToolTip(i18nc("tooltip on the config button in the popup", "Configure Power Management..."));
+ configButton->setOrientation(Qt::Horizontal);
+ configButton->setMaximumHeight(buttonsize);
+ configButton->setDrawBackground(false);
+ //configButton->setMinimumHeight(buttonsize);
+ configButton->setMaximumWidth(buttonsize);
+ //configButton->setMinimumWidth(buttonsize);
+ configButton->setDrawBackground(true);
+ configButton->setTextBackgroundColor(QColor());
+ configButton->setIcon("configure");
+ connect(configButton, SIGNAL(clicked()), this, SLOT(openConfig()));
+ configButton->setEnabled(hasAuthorization("LaunchApp"));
+
+ profileLayout->addItem(configButton);
+ profileLayout->setItemSpacing(0, 0.0);
+ profileLayout->setItemSpacing(1, 0.0);
+ profileLayout->setAlignment(m_profileCombo, Qt::AlignLeft|Qt::AlignVCenter);
+ profileLayout->setAlignment(configButton, Qt::AlignLeft|Qt::AlignVCenter);
+
+ profileWidget->setLayout(profileLayout);
+
+ m_controlsLayout->addItem(profileWidget, row, 1);
+ row++;
+
// Sleep and Hibernate buttons
QSet<Solid::PowerManagement::SleepState> sleepstates = Solid::PowerManagement::supportedSleepStates();
foreach (const Solid::PowerManagement::SleepState &sleepstate, sleepstates) {
@@ -478,9 +503,8 @@
suspendButton->setDrawBackground(true);
suspendButton->setTextBackgroundColor(QColor());
m_controlsLayout->addItem(suspendButton, row, 0);
- row++;
+ //row++;
connect(suspendButton, SIGNAL(clicked()), this, SLOT(suspend()));
- //actionsLayout->setColumnSpacing(0, 20);
} else if (sleepstate == Solid::PowerManagement::HibernateState) {
Plasma::IconWidget *hibernateButton = new Plasma::IconWidget(controls);
hibernateButton->setIcon("system-suspend-hibernate");
@@ -491,29 +515,17 @@
hibernateButton->setMinimumHeight(buttonsize);
hibernateButton->setDrawBackground(true);
hibernateButton->setTextBackgroundColor(QColor());
- m_controlsLayout->addItem(hibernateButton, row, 0);
+ m_controlsLayout->addItem(hibernateButton, row, 1);
connect(hibernateButton, SIGNAL(clicked()), this, SLOT(hibernate()));
}
}
- // Configure button
- Plasma::IconWidget *configButton = new Plasma::IconWidget(controls);
- configButton->setOrientation(Qt::Horizontal);
- configButton->setMaximumHeight(buttonsize);
- configButton->setMinimumHeight(buttonsize);
- configButton->setMaximumWidth(buttonsize);
- configButton->setMinimumWidth(buttonsize);
- configButton->setDrawBackground(true);
- configButton->setTextBackgroundColor(QColor());
- configButton->setIcon("configure");
- connect(configButton, SIGNAL(clicked()), this, SLOT(openConfig()));
- configButton->setEnabled(hasAuthorization("LaunchApp"));
- m_controlsLayout->addItem(configButton, row, 1, Qt::AlignRight);
-
controls->setLayout(m_controlsLayout);
item->setWidget(controls);
item->setTitle(i18n("Power Management"));
+
+ setupFonts();
}
}
@@ -523,6 +535,23 @@
updateStatus();
}
+void Battery::setupFonts()
+{
+ if (m_batteryLabelLabel) {
+ QFont infoFont = KGlobalSettings::generalFont();
+ infoFont.setPointSize(infoFont.pointSize()+1);
+ QFont labelFont = infoFont;
+ labelFont.setBold(true);
+
+ m_batteryLabelLabel->setFont(labelFont);
+ m_acLabelLabel->setFont(labelFont);
+ m_remainingTimeLabel->setFont(labelFont);
+
+ m_batteryInfoLabel->setFont(infoFont);
+ m_acInfoLabel->setFont(infoFont);
+ m_remainingInfoLabel->setFont(infoFont);
+ }
+}
void Battery::updateStatus()
{
if (!m_extenderVisible) {
@@ -534,58 +563,40 @@
if (m_numOfBattery && m_batteryLabelLabel) {
QHashIterator<QString, QHash<QString, QVariant > > battery_data(m_batteries_data);
int bnum = 0;
+ QString state;
while (battery_data.hasNext()) {
bnum++;
battery_data.next();
- 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 && 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 {
- */
- //if (m_extenderApplet) {
- // m_extenderApplet->showBatteryLabel(false);
- //}
- if (m_numOfBattery == 0) {
- //kDebug() << "zero batteries ...";
- } else if (m_numOfBattery == 1) {
- m_batteryLabelLabel->setText(i18n("Battery:"));
- if (battery_data.value()["Plugged in"].toBool()) {
- if (state == "NoCharge") {
- m_batteryInfoLabel->setText(i18n("%1% (charged)", battery_data.value()["Percent"].toString()));
- } else if (state == "Discharging") {
- m_batteryInfoLabel->setText(i18nc("Shown when a time estimate is not available", "%1% (discharging)\n", battery_data.value()["Percent"].toString()));
- } else {
- m_batteryInfoLabel->setText(i18n("%1% (charging)", battery_data.value()["Percent"].toString()));
- }
- } else {
- m_batteryInfoLabel->setText(i18nc("Battery is not plugged in", "Not present"));
- }
- } else {
- //kDebug() << "More batteries ...";
- // FIXME: we're overwriting the text
- if (bnum > 1) {
- batteriesLabel.append("<br />");
- batteriesInfo.append("<br />");
- }
- batteriesLabel.append(i18nc("Placeholder is the battery ID", "<b>Battery %1:</b> ", bnum));
+ state = battery_data.value()["State"].toString();
+ if (m_numOfBattery == 1) {
+ m_batteryLabelLabel->setText(i18n("Battery:"));
+ if (battery_data.value()["Plugged in"].toBool()) {
if (state == "NoCharge") {
- batteriesInfo.append(i18n("%1% (charged)", battery_data.value()["Percent"].toString()));
+ m_batteryInfoLabel->setText(i18n("%1% (charged)", battery_data.value()["Percent"].toString()));
} else if (state == "Discharging") {
- batteriesInfo.append(i18n("%2% (discharging)", bnum, battery_data.value()["Percent"].toString()));
+ m_batteryInfoLabel->setText(i18nc("Shown when a time estimate is not available", "%1% (discharging)", battery_data.value()["Percent"].toString()));
} else {
- batteriesInfo.append(i18n("%2% (charging)", bnum, battery_data.value()["Percent"].toString()));
+ m_batteryInfoLabel->setText(i18n("%1% (charging)", battery_data.value()["Percent"].toString()));
}
+ } else {
+ m_batteryInfoLabel->setText(i18nc("Battery is not plugged in", "Not present"));
}
- //}
+ } else {
+ //kDebug() << "More batteries ...";
+ // FIXME: we're overwriting the text
+ if (bnum > 1) {
+ batteriesLabel.append("<br />");
+ batteriesInfo.append("<br />");
+ }
+ batteriesLabel.append(i18nc("Placeholder is the battery ID", "<b>Battery %1:</b> ", bnum));
+ if (state == "NoCharge") {
+ batteriesInfo.append(i18n("%1% (charged)", battery_data.value()["Percent"].toString()));
+ } else if (state == "Discharging") {
+ batteriesInfo.append(i18n("%2% (discharging)", bnum, battery_data.value()["Percent"].toString()));
+ } else {
+ batteriesInfo.append(i18n("%2% (charging)", bnum, battery_data.value()["Percent"].toString()));
+ }
+ }
}
m_acLabelLabel->setText(i18n("AC Adapter:")); // ouch ...
if (m_acAdapterPlugged) {
@@ -593,6 +604,17 @@
} else {
m_acInfoLabel->setText(i18n("Not plugged in"));
}
+ m_remainingMSecs = battery_data.value()["Remaining msec"].toInt();
+ //kDebug() << "time left:" << m_remainingMSecs;
+ if ((state == "Discharging" || state == "Charging") && m_remainingMSecs > 0 && m_showRemainingTime) {
+ m_remainingTimeLabel->show();
+ m_remainingInfoLabel->show();
+ // we don't have too much accuracy so only give hours and minutes
+ m_remainingInfoLabel->setText(KGlobal::locale()->prettyFormatDuration(m_remainingMSecs));
+ } else {
+ m_remainingTimeLabel->hide();
+ m_remainingInfoLabel->hide();
+ }
} else {
m_batteryLabelLabel->setText(i18n("<b>Battery:</b> "));
m_batteryInfoLabel->setText(i18nc("Battery is not plugged in", "Not present"));
@@ -656,18 +678,32 @@
void Battery::showLabel(bool show)
{
- if (m_fadeIn == show) {
- return;
+ if (show) {
+ m_labelAnimation->setDirection(QAbstractAnimation::Forward);
+ if (m_labelAnimation->state() != QAbstractAnimation::Running) {
+ m_labelAnimation->start();
+ }
+ } else {
+ m_labelAnimation->setDirection(QAbstractAnimation::Backward);
+ if (m_labelAnimation->state() != QAbstractAnimation::Running) {
+ m_labelAnimation->start();
+ }
}
- m_fadeIn = show;
- const int FadeInDuration = 150;
+}
- if (m_animId != -1) {
- Plasma::Animator::self()->stopCustomAnimation(m_animId);
+void Battery::showAcAdapter(bool show)
+{
+ if (show) {
+ m_acAnimation->setDirection(QAbstractAnimation::Forward);
+ if (m_acAnimation->state() != QAbstractAnimation::Running) {
+ m_acAnimation->start();
+ }
+ } else {
+ m_acAnimation->setDirection(QAbstractAnimation::Backward);
+ if (m_acAnimation->state() != QAbstractAnimation::Running) {
+ m_acAnimation->start();
+ }
}
- m_animId = Plasma::Animator::self()->customAnimation(40 / (1000 / FadeInDuration), FadeInDuration,
- Plasma::Animator::EaseOutCurve, this,
- "animationUpdate");
}
QRectF Battery::scaleRectF(const qreal progress, QRectF rect)
@@ -690,95 +726,6 @@
return rect;
}
-void Battery::showAcAdapter(bool show)
-{
- if (m_acFadeIn == show) {
- return;
- }
- m_acFadeIn = show;
- const int FadeInDuration = 600;
- // As long as the animation is running, we fake it's still plugged in so it gets
- // painted in paintInterface()
- m_acAdapterPlugged = true;
-
- if (m_acAnimId != -1) {
- Plasma::Animator::self()->stopCustomAnimation(m_acAnimId);
- }
-
- m_acAnimId = Plasma::Animator::self()->customAnimation(40 / (1000 / FadeInDuration), FadeInDuration,
- Plasma::Animator::EaseOutCurve, this,
- "acAnimationUpdate");
-}
-
-void Battery::showBattery(bool show)
-{
- if (m_batteryFadeIn == show) {
- return;
- }
-
- m_batteryFadeIn = show;
- const int FadeInDuration = 300;
-
- if (m_batteryAnimId != -1) {
- Plasma::Animator::self()->stopCustomAnimation(m_batteryAnimId);
- }
-
- m_batteryAnimId = Plasma::Animator::self()->customAnimation(40 / (1000 / FadeInDuration), FadeInDuration,
- Plasma::Animator::EaseOutCurve, this,
- "batteryAnimationUpdate");
-}
-
-void Battery::animationUpdate(qreal progress)
-{
- if (qFuzzyCompare(progress, qreal(1))) {
- m_animId = -1;
- m_alpha = m_fadeIn ? 1 : 0;
- } else if (m_fadeIn) {
- m_alpha = progress;
- } else {
- m_alpha = qMin(1 - progress, m_alpha);
- }
-
- m_alpha = qBound(qreal(0), m_alpha, qreal(1));
- update();
-}
-
-void Battery::acAnimationUpdate(qreal progress)
-{
- if (qFuzzyCompare(progress, qreal(1))) {
- m_acAnimId = -1;
- m_acAlpha = m_acFadeIn ? 1 : 0;
- } else if (m_acFadeIn) {
- m_acAlpha = progress;
- } else {
- m_acAlpha = qMin(1 - progress, m_acAlpha);
- }
-
- m_acAlpha = qBound(qreal(0), m_acAlpha, qreal(1));
- // During the fadeout animation, we had set it to true (and lie)
- // now the animation has ended, we _really_ set it to not show the adapter
- if (!m_acFadeIn && qFuzzyCompare(progress, qreal(1))) {
- m_acAdapterPlugged = false;
- updateStatus();
- }
- update();
-}
-
-void Battery::batteryAnimationUpdate(qreal progress)
-{
- if (qFuzzyCompare(progress, qreal(1))) {
- m_batteryAnimId = -1;
- m_batteryAlpha = m_batteryFadeIn ? 1 : 0;
- } else if (m_batteryFadeIn) {
- m_batteryAlpha = progress;
- } else {
- m_batteryAlpha = qMin(1 - progress, m_batteryAlpha);
- }
-
- m_batteryAlpha = qBound(qreal(0), m_batteryAlpha, qreal(1));
- update();
-}
-
void Battery::paintLabel(QPainter *p, const QRect &contentsRect, const QString& labelText)
{
// Store font size, we want to restore it shortly
@@ -815,18 +762,11 @@
contentsRect.top() + ((contentsRect.height() - (int)fm.height()) / 2 * 0.9),
(int)(text_width),
fm.height() * 1.1 );
- //kDebug() << contentsRect << m_textRect;
- //p->setBrush(QColor("green"));
- //p->drawRect(m_textRect);
- if (m_firstRun) {
- m_firstRun = false;
- return;
- }
// Poor man's highlighting
- m_boxColor.setAlphaF(m_alpha);
+ m_boxColor.setAlphaF(m_labelAlpha);
p->setPen(m_boxColor);
- m_boxColor.setAlphaF(m_alpha*0.5);
+ m_boxColor.setAlphaF(m_labelAlpha*0.5);
p->setBrush(m_boxColor);
// Find sensible proportions for the rounded corners
@@ -836,19 +776,18 @@
qreal round_radius = 35.0;
p->drawRoundedRect(m_textRect, round_radius / round_prop, round_radius, Qt::RelativeSize);
- m_textColor.setAlphaF(m_alpha);
+ m_textColor.setAlphaF(m_labelAlpha);
p->setPen(m_textColor);
p->drawText(m_textRect, Qt::AlignCenter, labelText);
// Reset font and box
m_font.setPointSize(original_font_size);
- m_boxColor.setAlpha(m_boxAlpha);
}
void Battery::paintBattery(QPainter *p, const QRect &contentsRect, const int batteryPercent, const bool plugState)
{
if (m_theme->hasElement("Battery")) {
- m_theme->paint(p, scaleRectF(m_batteryAlpha, contentsRect), "Battery");
+ m_theme->paint(p, contentsRect, "Battery");
}
QString fill_element = QString();
@@ -872,19 +811,16 @@
// Now let's find out which fillstate to show
if (!fill_element.isEmpty()) {
if (m_theme->hasElement(fill_element)) {
- m_theme->paint(p, scaleRectF(m_batteryAlpha, contentsRect), fill_element);
+ m_theme->paint(p, contentsRect, fill_element);
} else {
kDebug() << fill_element << " does not exist in svg";
}
}
- if (m_acAdapterPlugged) {
- //QRectF ac_rect = QRectF(contentsRect.topLeft(), QSizeF(contentsRect.width()*m_acAlpha, contentsRect.height()*m_acAlpha));
- m_theme->paint(p, scaleRectF(m_acAlpha, contentsRect), "AcAdapter");
- }
+ m_theme->paint(p, scaleRectF(m_acAlpha, contentsRect), "AcAdapter");
if (plugState && m_theme->hasElement("Overlay")) {
- m_theme->paint(p, scaleRectF(m_batteryAlpha, contentsRect), "Overlay");
+ m_theme->paint(p, contentsRect, "Overlay");
}
}
@@ -904,7 +840,7 @@
return;
}
- if (m_isEmbedded || m_showMultipleBatteries || m_firstRun) {
+ if (m_isEmbedded || m_showMultipleBatteries) {
// paint each battery with own charge level
int battery_num = 0;
int height = contentsRect.height();
@@ -929,30 +865,28 @@
// paint battery with appropriate charge level
paintBattery(p, corect, battery_data.value()["Percent"].toInt(), battery_data.value()["Plugged in"].toBool());
- if (m_showBatteryString || m_isHovered || m_firstRun) {
// Show the charge percentage with a box on top of the battery
- QString batteryLabel;
- if (battery_data.value()["Plugged in"].toBool()) {
- int hours = m_remainingMSecs/1000/3600;
- int minutes = qRound(m_remainingMSecs/60000) % 60;
- if (!(minutes==0 && hours==0)) {
- m_minutes= minutes;
- m_hours= hours;
- }
- QString state = battery_data.value()["State"].toString();
+ QString batteryLabel;
+ if (battery_data.value()["Plugged in"].toBool()) {
+ int hours = m_remainingMSecs/1000/3600;
+ int minutes = qRound(m_remainingMSecs/60000) % 60;
+ if (!(minutes==0 && hours==0)) {
+ m_minutes= minutes;
+ m_hours= hours;
+ }
+ QString state = battery_data.value()["State"].toString();
- if (m_showRemainingTime && (state=="Charging" || state=="Discharging" )) {
- m_remainingMSecs = battery_data.value()["Remaining msec"].toInt();
- QTime t = QTime(m_hours, m_minutes);
- KLocale tmpLocale(*KGlobal::locale());
- tmpLocale.setTimeFormat("%k:%M");
- batteryLabel = tmpLocale.formatTime(t, false, true); // minutes, hours as duration
- } else {
- batteryLabel = battery_data.value()["Percent"].toString();
- batteryLabel.append("%");
- }
- paintLabel(p, corect, batteryLabel);
+ m_remainingMSecs = battery_data.value()["Remaining msec"].toInt();
+ if (m_remainingMSecs > 0 && (m_showRemainingTime && (state=="Charging" || state=="Discharging"))) {
+ QTime t = QTime(m_hours, m_minutes);
+ KLocale tmpLocale(*KGlobal::locale());
+ tmpLocale.setTimeFormat("%k:%M");
+ batteryLabel = tmpLocale.formatTime(t, false, true); // minutes, hours as duration
+ } else {
+ batteryLabel = battery_data.value()["Percent"].toString();
+ batteryLabel.append("%");
}
+ paintLabel(p, corect, batteryLabel);
}
++battery_num;
}
@@ -975,7 +909,7 @@
}
// paint battery with appropriate charge level
paintBattery(p, contentsRect, battery_charge, has_battery);
- if (m_showBatteryString || m_isHovered) {
+ if (m_showBatteryString) {
// Show the charge percentage with a box on top of the battery
QString batteryLabel;
if (has_battery) {
@@ -1038,4 +972,26 @@
}
}
+void Battery::setLabelAlpha(qreal alpha)
+{
+ m_labelAlpha = alpha;
+ update();
+}
+
+qreal Battery::labelAlpha()
+{
+ return m_labelAlpha;
+}
+
+void Battery::setAcAlpha(qreal alpha)
+{
+ m_acAlpha = alpha;
+ update();
+}
+
+qreal Battery::acAlpha()
+{
+ return m_acAlpha;
+}
+
#include "battery.moc"
kdebase-workspace-4.3.75-brightness-keys.patch:
libs/solid/control/powermanager.cpp | 11 +++-
plasma/generic/applets/battery/battery.cpp | 74 ++++++++++++++++++++++++----
plasma/generic/applets/battery/battery.h | 10 +++
powerdevil/daemon/PowerDevilDaemon.cpp | 75 +++++++++++++++++++++++++----
powerdevil/daemon/PowerDevilDaemon.h | 6 ++
powerdevil/daemon/org.kde.PowerDevil.xml | 8 +++
6 files changed, 161 insertions(+), 23 deletions(-)
Index: kdebase-workspace-4.3.75-brightness-keys.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace-4.3.75-brightness-keys.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- kdebase-workspace-4.3.75-brightness-keys.patch 24 Nov 2009 16:34:32 -0000 1.1
+++ kdebase-workspace-4.3.75-brightness-keys.patch 28 Nov 2009 01:44:15 -0000 1.2
@@ -1,9 +1,7 @@
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/libs/solid/control/powermanager.cpp kdebase-workspace-4.3.75svn1048496.brightness-keys/libs/solid/control/powermanager.cpp
---- kdebase-workspace-4.3.75svn1048496/libs/solid/control/powermanager.cpp 2009-02-12 05:23:46.000000000 -0500
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/libs/solid/control/powermanager.cpp 2009-11-21 17:56:42.000000000 -0500
-@@ -23,10 +23,12 @@
- #include "soliddefs_p.h"
- #include "managerbase_p.h"
+diff -ur kdebase-workspace-4.3.75/libs/solid/control/powermanager.cpp kdebase-workspace-4.3.75-brightness-keys/libs/solid/control/powermanager.cpp
+--- kdebase-workspace-4.3.75/libs/solid/control/powermanager.cpp 2009-02-12 11:23:46.000000000 +0100
++++ kdebase-workspace-4.3.75-brightness-keys/libs/solid/control/powermanager.cpp 2009-11-28 02:32:20.000000000 +0100
+@@ -25,6 +25,8 @@
#include "ifaces/powermanager.h"
#include <kdebug.h>
#include <kglobal.h>
@@ -12,11 +10,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
#include <QX11Info>
K_GLOBAL_STATIC(Solid::Control::PowerManagerPrivate, globalPowerManager)
-
- Solid::Control::PowerManagerPrivate::PowerManagerPrivate()
-@@ -158,22 +160,27 @@
- if(controls.size() == 0)
- {
+@@ -160,7 +162,8 @@
#ifdef Q_WS_WIN
return false;
#else
@@ -26,9 +20,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
#endif
}
else
- {
- foreach(const QString &device, controls.keys())
- {
+@@ -170,8 +173,12 @@
SOLID_CALL(Ifaces::PowerManager *, globalPowerManager->managerBackend(), setBrightness(brightness, device));
}
//TODO - This should be done better, it will return true even if one of the calls returns false. SOLID_CALL does not allow us to get the return value.
@@ -42,14 +34,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
}
else
{
- return_SOLID_CALL(Ifaces::PowerManager *, globalPowerManager->managerBackend(),
- false, setBrightness(brightness, device));
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/plasma/generic/applets/battery/battery.cpp kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery/battery.cpp
---- kdebase-workspace-4.3.75svn1048496/plasma/generic/applets/battery/battery.cpp 2009-11-13 05:57:50.000000000 -0500
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery/battery.cpp 2009-11-21 18:00:16.000000000 -0500
-@@ -22,19 +22,23 @@
- #include "battery.h"
-
+diff -ur kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.cpp kdebase-workspace-4.3.75-brightness-keys/plasma/generic/applets/battery/battery.cpp
+--- kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.cpp 2009-11-28 02:18:58.000000000 +0100
++++ kdebase-workspace-4.3.75-brightness-keys/plasma/generic/applets/battery/battery.cpp 2009-11-28 02:36:57.000000000 +0100
+@@ -24,7 +24,9 @@
#include <QApplication>
#include <QDBusConnection>
#include <QDBusInterface>
@@ -59,35 +47,27 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
#include <QStyleOptionGraphicsItem>
#include <QFont>
#include <QGraphicsSceneHoverEvent>
- #include <QGraphicsGridLayout>
- #include <QGraphicsLinearLayout>
+@@ -33,7 +35,9 @@
#include <QDBusPendingCall>
#include <QLabel>
+ #include <QPropertyAnimation>
+#include <QTimer>
+#include <KApplication>
#include <KDebug>
#include <KIcon>
#include <KSharedConfig>
- #include <KToolInvocation>
- #include <KColorScheme>
-@@ -92,11 +96,12 @@
- m_batteryFadeIn(false),
- m_isHovered(false),
- m_firstRun(true),
- m_numOfBattery(0),
- m_acAdapterPlugged(false),
-- m_remainingMSecs(0)
-+ m_remainingMSecs(0),
+@@ -86,7 +90,8 @@
+ m_labelAlpha(0),
+ m_labelAnimation(0),
+ m_acAlpha(0),
+- m_acAnimation(0)
++ m_acAnimation(0),
+ m_brightnessDisplay(0)
{
//kDebug() << "Loading applet battery";
setAcceptsHoverEvents(true);
- setPopupIcon(QIcon());
- resize(128, 128);
-@@ -310,10 +315,11 @@
- Applet::hoverLeaveEvent(event);
- }
+@@ -317,6 +322,7 @@
Battery::~Battery()
{
@@ -95,11 +75,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
}
void Battery::suspend()
- {
- hidePopup();
-@@ -330,17 +336,21 @@
- iface.asyncCall("suspend", Solid::Control::PowerManager::ToDisk);
- }
+@@ -337,13 +343,17 @@
void Battery::brightnessChanged(const int brightness)
{
@@ -121,23 +97,15 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
}
}
- void Battery::setFullBrightness()
- {
-@@ -361,10 +371,11 @@
+@@ -366,6 +376,7 @@
// as the battery applet is also embedded into the battery's extender.
if (!m_isEmbedded && item->name() == "powermanagement") {
int row = 0;
- int rowHeight = 20;
- int columnWidth = 120;
+ m_ignoreBrightnessChange = false;
QGraphicsWidget *controls = new QGraphicsWidget(item);
controls->setMinimumWidth(360);
- m_controlsLayout = new QGraphicsGridLayout(controls);
- m_controlsLayout->setColumnStretchFactor(1, 3);
-@@ -430,20 +441,16 @@
-
- m_controlsLayout->addItem(brightnessLabel, row, 0);
+@@ -427,16 +438,12 @@
m_brightnessSlider = new Plasma::Slider(controls);
m_brightnessSlider->setRange(0, 100);
@@ -155,15 +123,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
m_controlsLayout->addItem(m_brightnessSlider, row, 1);
row++;
- m_profileLabel = new Plasma::Label(controls);
- m_profileLabel->setText(i18n("Power Profile"));
-@@ -512,10 +519,25 @@
- m_controlsLayout->addItem(configButton, row, 1, Qt::AlignRight);
-
- controls->setLayout(m_controlsLayout);
+@@ -525,6 +532,21 @@
item->setWidget(controls);
item->setTitle(i18n("Power Management"));
-+
+
+ m_brightnessDisplay = new QProgressBar();
+ m_brightnessDisplay->setWindowFlags(Qt::X11BypassWindowManagerHint);
+ QDesktopWidget* desktop = KApplication::kApplication()->desktop();
@@ -178,14 +141,11 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
+ connect(m_brightnessDisplayTimer, SIGNAL(timeout()), this, SLOT(hideOSD()));
+ QDBusConnection::sessionBus().connect("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil",
+ "brightnessChanged", this, SLOT(showBrightnessOSD(int,bool)));
++
+ setupFonts();
}
}
-
- void Battery::popupEvent(bool show)
- {
-@@ -620,11 +642,11 @@
- m_profileLabel->show();
- }
+@@ -644,7 +666,7 @@
}
if (m_brightnessSlider) {
@@ -194,12 +154,8 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
//kDebug() << "Updating brightness:" << Solid::Control::PowerManager::brightness();
}
//kDebug() << "SIZE LABEL" << m_batteryLabel->size() << m_batteryLabel->preferredSize() << m_batteryLabel->preferredSize();
- //m_controlsLayout->setColumnMinimumWidth(1,280);
- //m_batteryLayout->setColumnMinimumWidth(0,200);
-@@ -1036,6 +1058,36 @@
- if (source == "PowerDevil") {
- dataEngine("powermanagement")->disconnectSource(source, this);
- }
+@@ -994,4 +1016,34 @@
+ return m_acAlpha;
}
+void Battery::showBrightnessOSD(int brightness, bool byFnKey)
@@ -233,14 +189,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
+}
+
#include "battery.moc"
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery: battery.cpp.orig
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery: battery.cpp.rej
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/plasma/generic/applets/battery/battery.h kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery/battery.h
---- kdebase-workspace-4.3.75svn1048496/plasma/generic/applets/battery/battery.h 2009-11-13 05:57:50.000000000 -0500
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery/battery.h 2009-11-21 17:57:10.000000000 -0500
-@@ -36,10 +36,12 @@
- class ExtenderItem;
- class ComboBox;
+diff -ur kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.h kdebase-workspace-4.3.75-brightness-keys/plasma/generic/applets/battery/battery.h
+--- kdebase-workspace-4.3.75/plasma/generic/applets/battery/battery.h 2009-11-28 02:18:58.000000000 +0100
++++ kdebase-workspace-4.3.75-brightness-keys/plasma/generic/applets/battery/battery.h 2009-11-28 02:38:34.000000000 +0100
+@@ -39,6 +39,8 @@
class Slider;
}
@@ -249,11 +201,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
class Battery : public Plasma::PopupApplet
{
Q_OBJECT
- public:
- Battery(QObject *parent, const QVariantList &args);
-@@ -72,16 +74,18 @@
- void acAnimationUpdate(qreal progress);
- void batteryAnimationUpdate(qreal progress);
+@@ -83,7 +85,7 @@
void sourceAdded(const QString &source);
void sourceRemoved(const QString &source);
void brightnessChanged(const int brightness);
@@ -262,21 +210,19 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
void setFullBrightness();
void openConfig();
void setProfile(const QString &profile);
- void suspend();
+@@ -91,6 +93,8 @@
void hibernate();
+ void updateBattery();
+ void setupFonts();
+ void showBrightnessOSD(int brightness, bool byFnKey);
+ void hideOSD();
private:
void connectSources();
- void initExtenderItem(Plasma::ExtenderItem *item);
- void updateStatus();
-@@ -161,10 +165,14 @@
- int m_boxAlpha;
- int m_boxHoverAlpha;
- int m_numOfBattery;
- bool m_acAdapterPlugged;
- int m_remainingMSecs;
+@@ -170,6 +174,10 @@
+ QPropertyAnimation *m_labelAnimation;
+ qreal m_acAlpha;
+ QPropertyAnimation *m_acAnimation;
+
+ bool m_ignoreBrightnessChange;
+ QProgressBar* m_brightnessDisplay;
@@ -284,15 +230,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
};
K_EXPORT_PLASMA_APPLET(battery, Battery)
-
- #endif
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/plasma/generic/applets/battery: battery.h.orig
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/org.kde.PowerDevil.xml kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/org.kde.PowerDevil.xml
---- kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/org.kde.PowerDevil.xml 2009-09-04 07:30:55.000000000 -0400
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/org.kde.PowerDevil.xml 2009-11-21 17:57:10.000000000 -0500
-@@ -40,10 +40,14 @@
- </method>
- <method name="getSupportedSchemes">
+diff -ur kdebase-workspace-4.3.75/powerdevil/daemon/org.kde.PowerDevil.xml kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/org.kde.PowerDevil.xml
+--- kdebase-workspace-4.3.75/powerdevil/daemon/org.kde.PowerDevil.xml 2009-09-04 13:30:55.000000000 +0200
++++ kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/org.kde.PowerDevil.xml 2009-11-28 02:32:20.000000000 +0100
+@@ -42,6 +42,10 @@
<arg type="as" direction="out" />
</method>
@@ -303,11 +244,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
<signal name="lidClosed">
<arg type="i" direction="out" />
<arg type="s" direction="out" />
- </signal>
- <signal name="stateChanged">
-@@ -54,7 +58,11 @@
- <arg type="s" direction="out" />
- <arg type="as" direction="out" />
+@@ -56,5 +60,9 @@
</signal>
<signal name="DPMSconfigUpdated">
</signal>
@@ -317,13 +254,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
+ </signal>
</interface>
</node>
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon: org.kde.PowerDevil.xml.orig
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/PowerDevilDaemon.cpp kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/PowerDevilDaemon.cpp
---- kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/PowerDevilDaemon.cpp 2009-09-23 15:21:36.000000000 -0400
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/PowerDevilDaemon.cpp 2009-11-21 17:57:10.000000000 -0500
-@@ -24,10 +24,12 @@
-
- #include "PowerDevilDaemon.h"
+diff -ur kdebase-workspace-4.3.75/powerdevil/daemon/PowerDevilDaemon.cpp kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/PowerDevilDaemon.cpp
+--- kdebase-workspace-4.3.75/powerdevil/daemon/PowerDevilDaemon.cpp 2009-09-23 21:21:36.000000000 +0200
++++ kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/PowerDevilDaemon.cpp 2009-11-28 02:32:20.000000000 +0100
+@@ -26,6 +26,8 @@
#include <kdemacros.h>
#include <KAboutData>
@@ -332,11 +266,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
#include <KPluginFactory>
#include <KNotification>
#include <KIcon>
- #include <KMessageBox>
- #include <kpluginfactory.h>
-@@ -91,10 +93,11 @@
- explicit Private()
- : notifier(Solid::Control::PowerManager::notifier())
+@@ -93,6 +95,7 @@
, battery(0)
, currentConfig(0)
, status(PowerDevilDaemon::NoAction)
@@ -344,11 +274,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
, ckSessionInterface(0) {}
Solid::Control::PowerManager::Notifier *notifier;
- QPointer<Solid::Battery> battery;
-
-@@ -117,11 +120,13 @@
-
- PowerDevilDaemon::IdleStatus status;
+@@ -119,7 +122,9 @@
int batteryPercent;
int brightness;
@@ -358,11 +284,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
// ConsoleKit stuff
QDBusInterface *ckSessionInterface;
- bool ckAvailable;
- };
-@@ -172,10 +177,22 @@
- "/ScreenSaver",
- QDBusConnection::sessionBus(), this);
+@@ -174,6 +179,18 @@
d->ksmServerIface = new OrgKdeKSMServerInterfaceInterface("org.kde.ksmserver", "/KSMServer",
QDBusConnection::sessionBus(), this);
@@ -381,11 +303,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
/* Not needed anymore; I am not sure if we will need that in a future, so I leave it here
* just in case.
*
- * d->kscreenSaverIface = new OrgKdeScreensaverInterface("org.freedesktop.ScreenSaver", "/ScreenSaver",
- * QDBusConnection::sessionBus(), this);
-@@ -196,10 +213,21 @@
-
- conn.interface()->registerService("org.freedesktop.Policy.Power");
+@@ -198,6 +215,17 @@
QDBusConnection::sessionBus().registerService("org.kde.powerdevil");
// All systems up Houston, let's go!
refreshStatus();
@@ -403,11 +321,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
}
PowerDevilDaemon::~PowerDevilDaemon()
- {
- delete d->ckSessionInterface;
-@@ -640,28 +668,44 @@
- break;
- }
+@@ -642,24 +670,40 @@
}
}
@@ -457,11 +371,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
}
void PowerDevilDaemon::shutdownNotification(bool automated)
- {
- if (!checkIfCurrentSessionActive()) {
-@@ -1441,6 +1485,19 @@
- QDBusConnection::systemBus().connect("org.freedesktop.ConsoleKit", sessionPath.value().path(),
- "org.freedesktop.ConsoleKit.Session", "ActiveChanged", this,
+@@ -1443,4 +1487,17 @@
SLOT(refreshStatus()));
}
@@ -479,13 +389,10 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
+}
+
#include "PowerDevilDaemon.moc"
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon: PowerDevilDaemon.cpp.orig
-diff -r -U5 kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/PowerDevilDaemon.h kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/PowerDevilDaemon.h
---- kdebase-workspace-4.3.75svn1048496/powerdevil/daemon/PowerDevilDaemon.h 2009-09-23 15:21:36.000000000 -0400
-+++ kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon/PowerDevilDaemon.h 2009-11-21 17:57:10.000000000 -0500
-@@ -60,14 +60,17 @@
- QStringList getSupportedSchemes();
- QVariantMap getSupportedSuspendMethods();
+diff -ur kdebase-workspace-4.3.75/powerdevil/daemon/PowerDevilDaemon.h kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/PowerDevilDaemon.h
+--- kdebase-workspace-4.3.75/powerdevil/daemon/PowerDevilDaemon.h 2009-09-23 21:21:36.000000000 +0200
++++ kdebase-workspace-4.3.75-brightness-keys/powerdevil/daemon/PowerDevilDaemon.h 2009-11-28 02:32:20.000000000 +0100
+@@ -62,10 +62,13 @@
SuspensionLockHandler *lockHandler();
@@ -499,11 +406,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
void decreaseBrightness();
void increaseBrightness();
- void shutdown(bool automated = false);
- void shutdownDialog();
-@@ -105,10 +108,11 @@
- void errorTriggered(const QString &error);
-
+@@ -107,6 +110,7 @@
void stateChanged(int, bool);
void profileChanged(const QString &, const QStringList &);
void DPMSconfigUpdated();
@@ -511,11 +414,7 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
private:
void lockScreen();
-
- void setUpDPMS();
-@@ -126,10 +130,12 @@
-
- void setUpConsoleKit();
+@@ -128,6 +132,8 @@
bool checkIfCurrentSessionActive();
@@ -524,6 +423,3 @@ diff -r -U5 kdebase-workspace-4.3.75svn1
public:
enum IdleAction {
None = 0,
- Standby = 1,
- S2Ram = 2,
-Only in kdebase-workspace-4.3.75svn1048496.brightness-keys/powerdevil/daemon: PowerDevilDaemon.h.orig
Index: kdebase-workspace.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdebase-workspace/devel/kdebase-workspace.spec,v
retrieving revision 1.317
retrieving revision 1.318
diff -u -p -r1.317 -r1.318
--- kdebase-workspace.spec 28 Nov 2009 01:12:18 -0000 1.317
+++ kdebase-workspace.spec 28 Nov 2009 01:44:15 -0000 1.318
@@ -9,7 +9,7 @@
Summary: K Desktop Environment - Workspace
Name: kdebase-workspace
Version: 4.3.75
-Release: 0.3.%{alphatag}%{?dist}
+Release: 0.4.%{alphatag}%{?dist}
Source0: ftp://ftp.kde.org/pub/kde/unstable/%{version}/src/kdebase-workspace-%{version}%{?alphatag}.tar.bz2
License: GPLv2
@@ -31,8 +31,8 @@ Patch13: kdebase-workspace-4.2.0-pykde4.
Patch14: kdebase-workspace-4.2.0-klipper-arora.patch
Patch15: kdebase-workspace-4.3.75-kio_sysinfo.patch
# show the remaining time in the battery plasmoid's popup (as in 4.2) (#515166)
-# FIXME: The code this patches is commented out
-#Patch16: kdebase-workspace-4.3.0-battery-plasmoid-showremainingtime.patch
+# currently requires backport from pre-4.3.80 trunk (Patch100)
+Patch16: kdebase-workspace-4.3.75-battery-plasmoid-showremainingtime.patch
# allow adding a "Leave..." button which brings up the complete shutdown dialog
# to the classic menu (as in KDE <= 4.2.x); the default is still the upstream
# default Leave submenu
@@ -47,9 +47,10 @@ Patch50: kdebase-workspace-4.3.3-kde#171
# FIXME: Not upstreamed yet --Ben (4.3.75)
#Patch51: http://bazaar.launchpad.net/~kubuntu-members/kdebase-workspace/ubuntu/annotate/head%3A/debian/patches/kubuntu_101_brightness_fn_keys_and_osd.diff
Patch51: kdebase-workspace-4.3.75-brightness-keys.patch
-# 4.3 branch
-# trunk
+# 4.4 trunk
+# backport battery plasmoid from current pre-4.3.80 trunk
+Patch100: kdebase-workspace-4.3.75-battery-plasmoid-trunk.patch
# moving to non-multilib hack
Obsoletes: kdebase-workspace < 4.3.0-2
@@ -278,7 +279,9 @@ Requires: akonadi
%patch13 -p1 -b .pykde4
# kio_sysinfo based on OpenSUSE's patch
%patch15 -p1 -b .kio_sysinfo
-#patch16 -p1 -b .showremainingtime
+# apply the backport first so the patch applies
+%patch100 -p0 -b .battery-trunk
+%patch16 -p1 -b .showremainingtime
%patch17 -p1 -b .classicmenu-logout
%patch18 -p1 -b .cmake-targets
@@ -619,6 +622,11 @@ fi
%changelog
+* Sat Nov 28 2009 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.75-0.4.svn1048496
+- backport battery plasmoid from current pre-4.3.80 trunk for showremainingtime
+- rebase battery-plasmoid-showremainingtime patch
+- rebase brightness-keys patch for the above backport
+
* Sat Nov 28 2009 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.3.75-0.3.svn1048496
- rebase plasma-konsole patch
--- kdebase-workspace-4.3.0-battery-plasmoid-showremainingtime.patch DELETED ---
More information about the scm-commits
mailing list