Merge lp:~debfx/kdebase-workspace/ubuntu into lp:~kubuntu-packagers/kubuntu-packaging/kde-workspace
- ubuntu
- Merge into kde-workspace
Proposed by
Felix Geyer
on 2010-03-20
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~debfx/kdebase-workspace/ubuntu |
| Merge into: | lp:~kubuntu-packagers/kubuntu-packaging/kde-workspace |
| Diff against target: |
550 lines (+303/-97) 1 file modified
debian/patches/kubuntu_101_brightness_fn_keys_and_osd.diff (+303/-97) |
| To merge this branch: | bzr merge lp:~debfx/kdebase-workspace/ubuntu |
| Related bugs: |
Commit Message
Description of the Change
Update the brightness OSD patch to make it work even if the
HAL property brightness_
an adapted version of the KMix 4.4 OSD.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'debian/patches/kubuntu_101_brightness_fn_keys_and_osd.diff' |
| 2 | --- debian/patches/kubuntu_101_brightness_fn_keys_and_osd.diff 2010-01-07 04:59:54 +0000 |
| 3 | +++ debian/patches/kubuntu_101_brightness_fn_keys_and_osd.diff 2010-03-20 22:50:31 +0000 |
| 4 | @@ -1,7 +1,6 @@ |
| 5 | -Index: kdebase-workspace-4.3.90/libs/solid/control/powermanager.cpp |
| 6 | -=================================================================== |
| 7 | ---- kdebase-workspace-4.3.90.orig/libs/solid/control/powermanager.cpp 2010-01-06 20:08:48.026004564 -0500 |
| 8 | -+++ kdebase-workspace-4.3.90/libs/solid/control/powermanager.cpp 2010-01-06 20:08:55.678005855 -0500 |
| 9 | +diff -Nur kdebase-workspace-4.4.1.orig/libs/solid/control/powermanager.cpp kdebase-workspace-4.4.1/libs/solid/control/powermanager.cpp |
| 10 | +--- kdebase-workspace-4.4.1.orig/libs/solid/control/powermanager.cpp 2010-01-06 18:00:01.000000000 +0100 |
| 11 | ++++ kdebase-workspace-4.4.1/libs/solid/control/powermanager.cpp 2010-03-20 14:26:05.000000000 +0100 |
| 12 | @@ -25,6 +25,8 @@ |
| 13 | #include "ifaces/powermanager.h" |
| 14 | #include <kdebug.h> |
| 15 | @@ -35,43 +34,43 @@ |
| 16 | } |
| 17 | else |
| 18 | { |
| 19 | -Index: kdebase-workspace-4.3.90/plasma/generic/applets/battery/battery.cpp |
| 20 | -=================================================================== |
| 21 | ---- kdebase-workspace-4.3.90.orig/plasma/generic/applets/battery/battery.cpp 2010-01-06 20:08:47.858007162 -0500 |
| 22 | -+++ kdebase-workspace-4.3.90/plasma/generic/applets/battery/battery.cpp 2010-01-06 20:08:55.678005855 -0500 |
| 23 | -@@ -31,9 +31,13 @@ |
| 24 | - #include <QGraphicsGridLayout> |
| 25 | - #include <QGraphicsLinearLayout> |
| 26 | - #include <QDBusPendingCall> |
| 27 | +diff -Nur kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/battery.cpp kdebase-workspace-4.4.1/plasma/generic/applets/battery/battery.cpp |
| 28 | +--- kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/battery.cpp 2010-02-04 10:28:44.000000000 +0100 |
| 29 | ++++ kdebase-workspace-4.4.1/plasma/generic/applets/battery/battery.cpp 2010-03-20 20:51:36.000000000 +0100 |
| 30 | +@@ -24,6 +24,7 @@ |
| 31 | + #include <QApplication> |
| 32 | + #include <QDBusConnection> |
| 33 | + #include <QDBusInterface> |
| 34 | +#include <QDesktopWidget> |
| 35 | + #include <QPainter> |
| 36 | + #include <QStyleOptionGraphicsItem> |
| 37 | + #include <QFont> |
| 38 | +@@ -34,6 +35,7 @@ |
| 39 | #include <QLabel> |
| 40 | -+#include <QProgressBar> |
| 41 | #include <QPropertyAnimation> |
| 42 | -+#include <QTimer> |
| 43 | |
| 44 | +#include <KApplication> |
| 45 | #include <KDebug> |
| 46 | #include <KIcon> |
| 47 | #include <KSharedConfig> |
| 48 | -@@ -86,7 +90,8 @@ |
| 49 | - m_labelAlpha(0), |
| 50 | - m_labelAnimation(0), |
| 51 | - m_acAlpha(0), |
| 52 | -- m_acAnimation(0) |
| 53 | -+ m_acAnimation(0), |
| 54 | -+ m_brightnessDisplay(0) |
| 55 | - { |
| 56 | - //kDebug() << "Loading applet battery"; |
| 57 | - setAcceptsHoverEvents(true); |
| 58 | -@@ -313,6 +318,7 @@ |
| 59 | +@@ -62,6 +64,8 @@ |
| 60 | + #include <Plasma/ComboBox> |
| 61 | + #include <Plasma/IconWidget> |
| 62 | + |
| 63 | ++#include "brightnessosdwidget.h" |
| 64 | ++ |
| 65 | + |
| 66 | + Battery::Battery(QObject *parent, const QVariantList &args) |
| 67 | + : Plasma::PopupApplet(parent, args), |
| 68 | +@@ -315,6 +319,7 @@ |
| 69 | |
| 70 | Battery::~Battery() |
| 71 | { |
| 72 | -+ delete m_brightnessDisplay; |
| 73 | ++ delete m_brightnessOSD; |
| 74 | } |
| 75 | |
| 76 | void Battery::suspend() |
| 77 | -@@ -333,13 +339,17 @@ |
| 78 | +@@ -335,13 +340,17 @@ |
| 79 | |
| 80 | void Battery::brightnessChanged(const int brightness) |
| 81 | { |
| 82 | @@ -93,17 +92,17 @@ |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | -@@ -362,6 +372,7 @@ |
| 87 | +@@ -364,6 +373,7 @@ |
| 88 | // as the battery applet is also embedded into the battery's extender. |
| 89 | if (!m_isEmbedded && item->name() == "powermanagement") { |
| 90 | int row = 0; |
| 91 | + m_ignoreBrightnessChange = false; |
| 92 | |
| 93 | - QGraphicsWidget *controls = new QGraphicsWidget(item); |
| 94 | - controls->setMinimumWidth(360); |
| 95 | -@@ -426,16 +437,12 @@ |
| 96 | + m_controls = new QGraphicsWidget(item); |
| 97 | + m_controls->setMinimumWidth(360); |
| 98 | +@@ -428,16 +438,12 @@ |
| 99 | |
| 100 | - m_brightnessSlider = new Plasma::Slider(controls); |
| 101 | + m_brightnessSlider = new Plasma::Slider(m_controls); |
| 102 | m_brightnessSlider->setRange(0, 100); |
| 103 | - m_brightnessSlider->setValue(Solid::Control::PowerManager::brightness()); |
| 104 | + updateSlider(Solid::Control::PowerManager::brightness()); |
| 105 | @@ -119,29 +118,18 @@ |
| 106 | m_controlsLayout->addItem(m_brightnessSlider, row, 1); |
| 107 | row++; |
| 108 | |
| 109 | -@@ -526,6 +533,21 @@ |
| 110 | +@@ -528,6 +534,10 @@ |
| 111 | item->setTitle(i18n("Power Management")); |
| 112 | |
| 113 | setupFonts(); |
| 114 | + |
| 115 | -+ m_brightnessDisplay = new QProgressBar(); |
| 116 | -+ m_brightnessDisplay->setWindowFlags(Qt::X11BypassWindowManagerHint); |
| 117 | -+ QDesktopWidget* desktop = KApplication::kApplication()->desktop(); |
| 118 | -+ //Getting QRect of the screen where cursor is positioned |
| 119 | -+ QRect rect = desktop->screenGeometry(QCursor::pos()); |
| 120 | -+ int width = (rect.width()/2) - (m_brightnessDisplay->width()/2); |
| 121 | -+ int height = (rect.height()/2) - (m_brightnessDisplay->height()/2); |
| 122 | -+ width += rect.x(); |
| 123 | -+ height += rect.y(); |
| 124 | -+ m_brightnessDisplay->move(width, height); |
| 125 | -+ m_brightnessDisplayTimer = new QTimer(this); |
| 126 | -+ connect(m_brightnessDisplayTimer, SIGNAL(timeout()), this, SLOT(hideOSD())); |
| 127 | ++ m_brightnessOSD = new BrightnessOSDWidget(); |
| 128 | + QDBusConnection::sessionBus().connect("org.kde.kded", "/modules/powerdevil", "org.kde.PowerDevil", |
| 129 | + "brightnessChanged", this, SLOT(showBrightnessOSD(int,bool))); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | -@@ -648,7 +670,7 @@ |
| 134 | +@@ -652,7 +662,7 @@ |
| 135 | } |
| 136 | |
| 137 | if (m_brightnessSlider) { |
| 138 | @@ -150,28 +138,23 @@ |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | -@@ -990,4 +1012,34 @@ |
| 143 | +@@ -990,4 +1000,24 @@ |
| 144 | return m_acAlpha; |
| 145 | } |
| 146 | |
| 147 | +void Battery::showBrightnessOSD(int brightness, bool byFnKey) |
| 148 | +{ |
| 149 | + if (byFnKey) { |
| 150 | -+ m_brightnessDisplay->setValue(brightness); |
| 151 | -+ m_brightnessDisplay->show(); |
| 152 | -+ |
| 153 | -+ //FIXME, how to get this to work before it is displayed for the first time? |
| 154 | -+ QDesktopWidget* desktop = KApplication::kApplication()->desktop(); |
| 155 | -+ //Getting QRect of the screen where cursor is positioned |
| 156 | -+ QRect rect = desktop->screenGeometry(QCursor::pos()); |
| 157 | -+ int width = (rect.width()/2) - (m_brightnessDisplay->width()/2); |
| 158 | -+ int height = (rect.height()/2) - (m_brightnessDisplay->height()/2); |
| 159 | -+ width += rect.x(); |
| 160 | -+ height += rect.y(); |
| 161 | -+ m_brightnessDisplay->move(width, height); |
| 162 | -+ |
| 163 | -+ m_brightnessDisplayTimer->setInterval(2000); |
| 164 | -+ m_brightnessDisplayTimer->start(); |
| 165 | ++ m_brightnessOSD->setCurrentBrightness(brightness); |
| 166 | ++ m_brightnessOSD->show(); |
| 167 | ++ m_brightnessOSD->activateOSD(); //Enable the hide timer |
| 168 | ++ |
| 169 | ++ //Center the OSD |
| 170 | ++ QRect rect = KApplication::kApplication()->desktop()->screenGeometry(QCursor::pos()); |
| 171 | ++ QSize size = m_brightnessOSD->sizeHint(); |
| 172 | ++ int posX = rect.x() + (rect.width() - size.width()) / 2; |
| 173 | ++ int posY = rect.y() + 4 * rect.height() / 5; |
| 174 | ++ m_brightnessOSD->setGeometry(posX, posY, size.width(), size.height()); |
| 175 | + |
| 176 | + if (m_extenderVisible && m_brightnessSlider) { |
| 177 | + updateSlider(brightness); |
| 178 | @@ -179,21 +162,15 @@ |
| 179 | + } |
| 180 | +} |
| 181 | + |
| 182 | -+void Battery::hideOSD() |
| 183 | -+{ |
| 184 | -+ m_brightnessDisplay->hide(); |
| 185 | -+} |
| 186 | -+ |
| 187 | #include "battery.moc" |
| 188 | -Index: kdebase-workspace-4.3.90/plasma/generic/applets/battery/battery.h |
| 189 | -=================================================================== |
| 190 | ---- kdebase-workspace-4.3.90.orig/plasma/generic/applets/battery/battery.h 2010-01-06 20:08:47.702007091 -0500 |
| 191 | -+++ kdebase-workspace-4.3.90/plasma/generic/applets/battery/battery.h 2010-01-06 20:08:55.682004688 -0500 |
| 192 | +diff -Nur kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/battery.h kdebase-workspace-4.4.1/plasma/generic/applets/battery/battery.h |
| 193 | +--- kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/battery.h 2010-01-20 00:19:14.000000000 +0100 |
| 194 | ++++ kdebase-workspace-4.4.1/plasma/generic/applets/battery/battery.h 2010-03-20 20:24:29.000000000 +0100 |
| 195 | @@ -39,6 +39,8 @@ |
| 196 | class Slider; |
| 197 | } |
| 198 | |
| 199 | -+class QProgressBar; |
| 200 | ++class BrightnessOSDWidget; |
| 201 | + |
| 202 | class Battery : public Plasma::PopupApplet |
| 203 | { |
| 204 | @@ -207,30 +184,258 @@ |
| 205 | void setFullBrightness(); |
| 206 | void openConfig(); |
| 207 | void setProfile(const QString &profile); |
| 208 | -@@ -91,6 +93,8 @@ |
| 209 | +@@ -91,6 +93,7 @@ |
| 210 | void hibernate(); |
| 211 | void updateBattery(); |
| 212 | void setupFonts(); |
| 213 | + void showBrightnessOSD(int brightness, bool byFnKey); |
| 214 | -+ void hideOSD(); |
| 215 | |
| 216 | private: |
| 217 | void connectSources(); |
| 218 | -@@ -171,6 +175,10 @@ |
| 219 | +@@ -172,6 +175,9 @@ |
| 220 | QPropertyAnimation *m_labelAnimation; |
| 221 | qreal m_acAlpha; |
| 222 | QPropertyAnimation *m_acAnimation; |
| 223 | + |
| 224 | + bool m_ignoreBrightnessChange; |
| 225 | -+ QProgressBar* m_brightnessDisplay; |
| 226 | -+ QTimer* m_brightnessDisplayTimer; |
| 227 | ++ BrightnessOSDWidget* m_brightnessOSD; |
| 228 | }; |
| 229 | |
| 230 | K_EXPORT_PLASMA_APPLET(battery, Battery) |
| 231 | -Index: kdebase-workspace-4.3.90/powerdevil/daemon/org.kde.PowerDevil.xml |
| 232 | -=================================================================== |
| 233 | ---- kdebase-workspace-4.3.90.orig/powerdevil/daemon/org.kde.PowerDevil.xml 2010-01-06 20:08:47.314008970 -0500 |
| 234 | -+++ kdebase-workspace-4.3.90/powerdevil/daemon/org.kde.PowerDevil.xml 2010-01-06 20:08:55.682004688 -0500 |
| 235 | +diff -Nur kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/brightnessosdwidget.cpp kdebase-workspace-4.4.1/plasma/generic/applets/battery/brightnessosdwidget.cpp |
| 236 | +--- kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/brightnessosdwidget.cpp 1970-01-01 01:00:00.000000000 +0100 |
| 237 | ++++ kdebase-workspace-4.4.1/plasma/generic/applets/battery/brightnessosdwidget.cpp 2010-03-20 22:03:21.000000000 +0100 |
| 238 | +@@ -0,0 +1,141 @@ |
| 239 | ++/******************************************************************* |
| 240 | ++* osdwidget.cpp |
| 241 | ++* Copyright 2009 Aurélien Gâteau <agateau@kde.org> |
| 242 | ++* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> |
| 243 | ++* Copyright 2009 Christian Esken <christian.esken@arcor.de> |
| 244 | ++* |
| 245 | ++* This program is free software; you can redistribute it and/or |
| 246 | ++* modify it under the terms of the GNU General Public License as |
| 247 | ++* published by the Free Software Foundation; either version 2 of |
| 248 | ++* the License, or (at your option) any later version. |
| 249 | ++* |
| 250 | ++* This program is distributed in the hope that it will be useful, |
| 251 | ++* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 252 | ++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 253 | ++* GNU General Public License for more details. |
| 254 | ++* |
| 255 | ++* You should have received a copy of the GNU General Public License |
| 256 | ++* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 257 | ++* |
| 258 | ++******************************************************************/ |
| 259 | ++ |
| 260 | ++#include "brightnessosdwidget.h" |
| 261 | ++ |
| 262 | ++// Qt |
| 263 | ++#include <QGraphicsLinearLayout> |
| 264 | ++#include <QPainter> |
| 265 | ++#include <QTimer> |
| 266 | ++#include <QLabel> |
| 267 | ++ |
| 268 | ++// KDE |
| 269 | ++#include <KIcon> |
| 270 | ++#include <KDialog> |
| 271 | ++#include <Plasma/FrameSvg> |
| 272 | ++#include <Plasma/Label> |
| 273 | ++#include <Plasma/Meter> |
| 274 | ++ |
| 275 | ++BrightnessOSDWidget::BrightnessOSDWidget(QWidget * parent) |
| 276 | ++ : QGraphicsView(parent), |
| 277 | ++ m_background(new Plasma::FrameSvg(this)), |
| 278 | ++ m_scene(new QGraphicsScene(this)), |
| 279 | ++ m_container(new QGraphicsWidget), |
| 280 | ++ m_iconLabel(new Plasma::Label), |
| 281 | ++ m_volumeLabel(new Plasma::Label), |
| 282 | ++ m_meter(new Plasma::Meter), |
| 283 | ++ m_hideTimer(new QTimer(this)) |
| 284 | ++{ |
| 285 | ++ //Setup the window properties |
| 286 | ++ setWindowFlags(Qt::X11BypassWindowManagerHint); |
| 287 | ++ setFrameStyle(QFrame::NoFrame); |
| 288 | ++ viewport()->setAutoFillBackground(false); |
| 289 | ++ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 290 | ++ setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 291 | ++ setAttribute(Qt::WA_TranslucentBackground); |
| 292 | ++ |
| 293 | ++ //Cache the icon pixmaps |
| 294 | ++ QSize iconSize = QSize(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium); |
| 295 | ++ m_brightnessPixmap = KIcon("video-display").pixmap(iconSize); |
| 296 | ++ /*m_volumeHighPixmap = KIcon("audio-volume-high").pixmap(iconSize); |
| 297 | ++ m_volumeMediumPixmap = KIcon("audio-volume-medium").pixmap(iconSize); |
| 298 | ++ m_volumeLowPixmap = KIcon("audio-volume-low").pixmap(iconSize);*/ |
| 299 | ++ |
| 300 | ++ //Setup the widgets |
| 301 | ++ m_background->setImagePath("widgets/tooltip"); |
| 302 | ++ |
| 303 | ++ m_iconLabel->nativeWidget()->setPixmap(m_brightnessPixmap); |
| 304 | ++ m_iconLabel->nativeWidget()->setFixedSize(iconSize); |
| 305 | ++ m_iconLabel->setMinimumSize(iconSize); |
| 306 | ++ m_iconLabel->setMaximumSize(iconSize); |
| 307 | ++ |
| 308 | ++ m_meter->setMeterType(Plasma::Meter::BarMeterHorizontal); |
| 309 | ++ m_meter->setMaximum(100); |
| 310 | ++ m_meter->setMaximumHeight(iconSize.height()); |
| 311 | ++ |
| 312 | ++ m_volumeLabel->setAlignment(Qt::AlignCenter); |
| 313 | ++ |
| 314 | ++ //Setup the auto-hide timer |
| 315 | ++ m_hideTimer->setInterval(2000); |
| 316 | ++ m_hideTimer->setSingleShot(true); |
| 317 | ++ connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide())); |
| 318 | ++ |
| 319 | ++ //Setup the OSD layout |
| 320 | ++ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(m_container); |
| 321 | ++ layout->addItem(m_iconLabel); |
| 322 | ++ layout->addItem(m_meter); |
| 323 | ++ |
| 324 | ++ m_scene->addItem(m_container); |
| 325 | ++ setScene(m_scene); |
| 326 | ++} |
| 327 | ++ |
| 328 | ++void BrightnessOSDWidget::activateOSD() |
| 329 | ++{ |
| 330 | ++ m_hideTimer->start(); |
| 331 | ++} |
| 332 | ++ |
| 333 | ++void BrightnessOSDWidget::setCurrentBrightness(int brightnessLevel) |
| 334 | ++{ |
| 335 | ++ m_meter->setValue(brightnessLevel); |
| 336 | ++ |
| 337 | ++ /*if (volumeLevel < 25) { |
| 338 | ++ m_iconLabel->nativeWidget()->setPixmap(m_volumeLowPixmap); |
| 339 | ++ } else if (volumeLevel < 75) { |
| 340 | ++ m_iconLabel->nativeWidget()->setPixmap(m_volumeMediumPixmap); |
| 341 | ++ } else { |
| 342 | ++ m_iconLabel->nativeWidget()->setPixmap(m_volumeHighPixmap); |
| 343 | ++ }*/ |
| 344 | ++ |
| 345 | ++ //Show the volume % |
| 346 | ++ //m_meter->setLabel(0, QString::number(volumeLevel) + " %"); |
| 347 | ++} |
| 348 | ++ |
| 349 | ++void BrightnessOSDWidget::drawBackground(QPainter *painter, const QRectF &/*rectF*/) |
| 350 | ++{ |
| 351 | ++ painter->save(); |
| 352 | ++ painter->setCompositionMode(QPainter::CompositionMode_Source); |
| 353 | ++ m_background->paintFrame(painter); |
| 354 | ++ painter->restore(); |
| 355 | ++} |
| 356 | ++ |
| 357 | ++QSize BrightnessOSDWidget::sizeHint() const |
| 358 | ++{ |
| 359 | ++ int iconSize = m_iconLabel->nativeWidget()->pixmap()->height(); |
| 360 | ++ int meterHeight = iconSize; |
| 361 | ++ int meterWidth = iconSize * 12; |
| 362 | ++ qreal left, top, right, bottom; |
| 363 | ++ m_background->getMargins(left, top, right, bottom); |
| 364 | ++ return QSize(meterWidth + iconSize + left + right, meterHeight + top + bottom); |
| 365 | ++} |
| 366 | ++ |
| 367 | ++void BrightnessOSDWidget::resizeEvent(QResizeEvent*) |
| 368 | ++{ |
| 369 | ++ m_background->resizeFrame(size()); |
| 370 | ++ m_container->setGeometry(0, 0, width(), height()); |
| 371 | ++ qreal left, top, right, bottom; |
| 372 | ++ m_background->getMargins(left, top, right, bottom); |
| 373 | ++ m_container->layout()->setContentsMargins(left, top, right, bottom); |
| 374 | ++ |
| 375 | ++ m_scene->setSceneRect(0, 0, width(), height()); |
| 376 | ++ setMask(m_background->mask()); |
| 377 | ++} |
| 378 | ++ |
| 379 | ++#include "brightnessosdwidget.moc" |
| 380 | +diff -Nur kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/brightnessosdwidget.h kdebase-workspace-4.4.1/plasma/generic/applets/battery/brightnessosdwidget.h |
| 381 | +--- kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/brightnessosdwidget.h 1970-01-01 01:00:00.000000000 +0100 |
| 382 | ++++ kdebase-workspace-4.4.1/plasma/generic/applets/battery/brightnessosdwidget.h 2010-03-20 19:24:37.000000000 +0100 |
| 383 | +@@ -0,0 +1,69 @@ |
| 384 | ++/******************************************************************* |
| 385 | ++* osdwidget.h |
| 386 | ++* Copyright 2009 Aurélien Gâteau <agateau@kde.org> |
| 387 | ++* Copyright 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com> |
| 388 | ++* Copyright 2009 Christian Esken <christian.esken@arcor.de> |
| 389 | ++* |
| 390 | ++* This program is free software; you can redistribute it and/or |
| 391 | ++* modify it under the terms of the GNU General Public License as |
| 392 | ++* published by the Free Software Foundation; either version 2 of |
| 393 | ++* the License, or (at your option) any later version. |
| 394 | ++* |
| 395 | ++* This program is distributed in the hope that it will be useful, |
| 396 | ++* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 397 | ++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 398 | ++* GNU General Public License for more details. |
| 399 | ++* |
| 400 | ++* You should have received a copy of the GNU General Public License |
| 401 | ++* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 402 | ++* |
| 403 | ++******************************************************************/ |
| 404 | ++ |
| 405 | ++#ifndef BRIGHTNESSOSDWIDGET__H |
| 406 | ++#define BRIGHTNESSOSDWIDGET__H |
| 407 | ++ |
| 408 | ++#include <QGraphicsView> |
| 409 | ++ |
| 410 | ++#include <QPixmap> |
| 411 | ++ |
| 412 | ++class QTimer; |
| 413 | ++class QGraphicsWidget; |
| 414 | ++ |
| 415 | ++namespace Plasma |
| 416 | ++{ |
| 417 | ++class FrameSvg; |
| 418 | ++class Label; |
| 419 | ++class Meter; |
| 420 | ++} |
| 421 | ++ |
| 422 | ++class BrightnessOSDWidget : public QGraphicsView |
| 423 | ++{ |
| 424 | ++Q_OBJECT |
| 425 | ++public: |
| 426 | ++ BrightnessOSDWidget(QWidget * parent = 0); |
| 427 | ++ |
| 428 | ++ void setCurrentBrightness(int brightnessLevel); |
| 429 | ++ void activateOSD(); |
| 430 | ++ |
| 431 | ++ virtual QSize sizeHint() const; |
| 432 | ++ |
| 433 | ++protected: |
| 434 | ++ virtual void drawBackground(QPainter *painter, const QRectF &rectF); |
| 435 | ++ virtual void resizeEvent(QResizeEvent *); |
| 436 | ++ |
| 437 | ++private: |
| 438 | ++ Plasma::FrameSvg *m_background; |
| 439 | ++ QGraphicsScene *m_scene; |
| 440 | ++ QGraphicsWidget *m_container; |
| 441 | ++ Plasma::Label *m_iconLabel; |
| 442 | ++ Plasma::Label *m_volumeLabel; |
| 443 | ++ Plasma::Meter *m_meter; |
| 444 | ++ QTimer *m_hideTimer; |
| 445 | ++ |
| 446 | ++ QPixmap m_brightnessPixmap; |
| 447 | ++ /*QPixmap m_volumeHighPixmap; |
| 448 | ++ QPixmap m_volumeMediumPixmap; |
| 449 | ++ QPixmap m_volumeLowPixmap;*/ |
| 450 | ++}; |
| 451 | ++ |
| 452 | ++#endif |
| 453 | +diff -Nur kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/CMakeLists.txt kdebase-workspace-4.4.1/plasma/generic/applets/battery/CMakeLists.txt |
| 454 | +--- kdebase-workspace-4.4.1.orig/plasma/generic/applets/battery/CMakeLists.txt 2009-09-16 13:40:55.000000000 +0200 |
| 455 | ++++ kdebase-workspace-4.4.1/plasma/generic/applets/battery/CMakeLists.txt 2010-03-20 19:27:09.000000000 +0100 |
| 456 | +@@ -1,7 +1,8 @@ |
| 457 | + project(plasma-battery) |
| 458 | + |
| 459 | + set(battery_SRCS |
| 460 | +- battery.cpp) |
| 461 | ++ battery.cpp |
| 462 | ++ brightnessosdwidget.cpp) |
| 463 | + |
| 464 | + kde4_add_ui_files(battery_SRCS batteryConfig.ui ) |
| 465 | + kde4_add_plugin(plasma_applet_battery ${battery_SRCS}) |
| 466 | +diff -Nur kdebase-workspace-4.4.1.orig/powerdevil/daemon/org.kde.PowerDevil.xml kdebase-workspace-4.4.1/powerdevil/daemon/org.kde.PowerDevil.xml |
| 467 | +--- kdebase-workspace-4.4.1.orig/powerdevil/daemon/org.kde.PowerDevil.xml 2009-09-04 13:30:55.000000000 +0200 |
| 468 | ++++ kdebase-workspace-4.4.1/powerdevil/daemon/org.kde.PowerDevil.xml 2010-03-20 14:26:05.000000000 +0100 |
| 469 | @@ -42,6 +42,10 @@ |
| 470 | <arg type="as" direction="out" /> |
| 471 | </method> |
| 472 | @@ -252,10 +457,9 @@ |
| 473 | + </signal> |
| 474 | </interface> |
| 475 | </node> |
| 476 | -Index: kdebase-workspace-4.3.90/powerdevil/daemon/PowerDevilDaemon.cpp |
| 477 | -=================================================================== |
| 478 | ---- kdebase-workspace-4.3.90.orig/powerdevil/daemon/PowerDevilDaemon.cpp 2010-01-06 20:08:47.586005621 -0500 |
| 479 | -+++ kdebase-workspace-4.3.90/powerdevil/daemon/PowerDevilDaemon.cpp 2010-01-06 20:08:55.682004688 -0500 |
| 480 | +diff -Nur kdebase-workspace-4.4.1.orig/powerdevil/daemon/PowerDevilDaemon.cpp kdebase-workspace-4.4.1/powerdevil/daemon/PowerDevilDaemon.cpp |
| 481 | +--- kdebase-workspace-4.4.1.orig/powerdevil/daemon/PowerDevilDaemon.cpp 2009-12-11 00:14:04.000000000 +0100 |
| 482 | ++++ kdebase-workspace-4.4.1/powerdevil/daemon/PowerDevilDaemon.cpp 2010-03-20 19:43:18.000000000 +0100 |
| 483 | @@ -26,6 +26,8 @@ |
| 484 | |
| 485 | #include <kdemacros.h> |
| 486 | @@ -319,7 +523,7 @@ |
| 487 | } |
| 488 | |
| 489 | PowerDevilDaemon::~PowerDevilDaemon() |
| 490 | -@@ -661,24 +689,40 @@ |
| 491 | +@@ -661,24 +689,43 @@ |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | @@ -331,6 +535,13 @@ |
| 496 | } |
| 497 | + |
| 498 | + int currentBrightness = (int) Solid::Control::PowerManager::brightness(); |
| 499 | ++ |
| 500 | ++ if (currentBrightness == -1) { |
| 501 | ++ return; // we are not able to determine the brightness level |
| 502 | ++ } |
| 503 | + |
| 504 | +- int currentBrightness = qMax(0, (int)(Solid::Control::PowerManager::brightness() - 10)); |
| 505 | +- Solid::Control::PowerManager::setBrightness(currentBrightness); |
| 506 | + if ((currentBrightness == d->cachedBrightness) && !d->brightnessInHardware) |
| 507 | + { |
| 508 | + int newBrightness; |
| 509 | @@ -340,16 +551,12 @@ |
| 510 | + else { |
| 511 | + newBrightness = qMax(0, currentBrightness - 10); |
| 512 | + } |
| 513 | - |
| 514 | -- int currentBrightness = qMax(0, (int)(Solid::Control::PowerManager::brightness() - 10)); |
| 515 | -- Solid::Control::PowerManager::setBrightness(currentBrightness); |
| 516 | ++ |
| 517 | + Solid::Control::PowerManager::setBrightness(newBrightness); |
| 518 | + currentBrightness = (int) Solid::Control::PowerManager::brightness(); |
| 519 | + } |
| 520 | + |
| 521 | -+ if (!d->brightnessInHardware) { |
| 522 | -+ emitBrightnessChanged(currentBrightness, true); |
| 523 | -+ } |
| 524 | ++ emitBrightnessChanged(currentBrightness, true); |
| 525 | } |
| 526 | |
| 527 | -void PowerDevilDaemon::increaseBrightness() |
| 528 | @@ -369,7 +576,7 @@ |
| 529 | } |
| 530 | |
| 531 | void PowerDevilDaemon::shutdownNotification(bool automated) |
| 532 | -@@ -1463,4 +1507,17 @@ |
| 533 | +@@ -1463,4 +1510,17 @@ |
| 534 | SLOT(refreshStatus())); |
| 535 | } |
| 536 | |
| 537 | @@ -387,10 +594,9 @@ |
| 538 | +} |
| 539 | + |
| 540 | #include "PowerDevilDaemon.moc" |
| 541 | -Index: kdebase-workspace-4.3.90/powerdevil/daemon/PowerDevilDaemon.h |
| 542 | -=================================================================== |
| 543 | ---- kdebase-workspace-4.3.90.orig/powerdevil/daemon/PowerDevilDaemon.h 2010-01-06 20:08:47.426005056 -0500 |
| 544 | -+++ kdebase-workspace-4.3.90/powerdevil/daemon/PowerDevilDaemon.h 2010-01-06 20:08:55.682004688 -0500 |
| 545 | +diff -Nur kdebase-workspace-4.4.1.orig/powerdevil/daemon/PowerDevilDaemon.h kdebase-workspace-4.4.1/powerdevil/daemon/PowerDevilDaemon.h |
| 546 | +--- kdebase-workspace-4.4.1.orig/powerdevil/daemon/PowerDevilDaemon.h 2009-12-01 01:30:27.000000000 +0100 |
| 547 | ++++ kdebase-workspace-4.4.1/powerdevil/daemon/PowerDevilDaemon.h 2010-03-20 14:26:05.000000000 +0100 |
| 548 | @@ -61,10 +61,13 @@ |
| 549 | |
| 550 | SuspensionLockHandler *lockHandler(); |
