summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.cpp235
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.h81
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.pro13
-rw-r--r--noncore/applets/brightnessapplet/config.in6
-rw-r--r--packages1
-rw-r--r--pics/brightnessapplet/icon.pngbin0 -> 3280 bytes
7 files changed, 337 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8701a54..4833e0d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,29 +1,30 @@
1 2004-??-??Opie 1.1.x 1 2004-??-??Opie 1.1.x
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 * Ported opie-mediaplayer2 to recent libxine (brad,zecke) 5 * Ported opie-mediaplayer2 to recent libxine (brad,zecke)
6 * Ported brightnessapplet from Qtopia 1.7 (mickeyl)
6 7
7 Fixed Bugs 8 Fixed Bugs
8 ---------- 9 ----------
9 10
10 2004-09-17Opie 1.1.6 11 2004-09-17Opie 1.1.6
11 12
12 New Features 13 New Features
13 ------------ 14 ------------
14 * Fifteen gained configurable number of items (zecke) 15 * Fifteen gained configurable number of items (zecke)
15 * Fifteen can have custom background images (zecke) 16 * Fifteen can have custom background images (zecke)
16 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 17 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
17 * Integrated the new security framework into libopie2 (zecke,clem) 18 * Integrated the new security framework into libopie2 (zecke,clem)
18 * Converted the launcher to use the new security framework (zecke) 19 * Converted the launcher to use the new security framework (zecke)
19 * Backup can now handle custom locations for backup and restore (ar) 20 * Backup can now handle custom locations for backup and restore (ar)
20 * Implemented right-on-hold feedback (wimpie,zecke) 21 * Implemented right-on-hold feedback (wimpie,zecke)
21 * Lots of new features in opie-reader (tim,pohly) 22 * Lots of new features in opie-reader (tim,pohly)
22 * Build system cleanups (schurig) 23 * Build system cleanups (schurig)
23 24
24 Fixed Bugs 25 Fixed Bugs
25 -------- 26 --------
26 * #1005 - Fixed backup to CompactFlash (ar) 27 * #1005 - Fixed backup to CompactFlash (ar)
27 * #1167 - Fixed Opie write crashing on more text than one page (ar) 28 * #1167 - Fixed Opie write crashing on more text than one page (ar)
28 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 29 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
29 * #1359 - Fixed bookmarks in Gutenbrowser (ljp) 30 * #1359 - Fixed bookmarks in Gutenbrowser (ljp)
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.cpp b/noncore/applets/brightnessapplet/brightnessapplet.cpp
new file mode 100644
index 0000000..1ade35e
--- a/dev/null
+++ b/noncore/applets/brightnessapplet/brightnessapplet.cpp
@@ -0,0 +1,235 @@
1/*
2                 This file is part of the Opie Project
3
4 =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = General Public License along with
24    --        :-=` this application; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28
29*/
30
31#include "brightnessapplet.h"
32
33/* OPIE */
34#include <opie2/odebug.h>
35#include <opie2/odevice.h>
36#include <opie2/otaskbarapplet.h>
37#include <qpe/applnk.h>
38#include <qpe/config.h>
39#include <qpe/power.h>
40#include <qpe/qcopenvelope_qws.h>
41#include <qpe/resource.h>
42using namespace Opie::Core;
43using namespace Opie::Ui;
44
45/* QT */
46#include <qpainter.h>
47#include <qlabel.h>
48#include <qslider.h>
49#include <qlayout.h>
50
51/* STD */
52#include <assert.h>
53
54/* XPM */
55static const char * const light_on_xpm[] = {
56"9 16 5 1",
57" c None",
58". c #FFFFFFFF0000",
59"X c #000000000000",
60"o c #FFFFFFFFFFFF",
61"O c #FFFF6C6C0000",
62" ",
63" XXX ",
64" XoooX ",
65" Xoooo.X ",
66"Xoooooo.X",
67"Xoooo...X",
68"Xooo.o..X",
69" Xooo..X ",
70" Xoo...X ",
71" Xoo.X ",
72" Xoo.XX ",
73" XOOOXX ",
74" XOOOXX ",
75" XOXX ",
76" XX ",
77" "};
78
79
80/* XPM */
81static const char * const light_off_xpm[] = {
82"9 16 4 1",
83" c None",
84". c #000000000000",
85"X c #6B6B6C6C6C6C",
86"o c #FFFF6C6C0000",
87" ",
88" ",
89" ... ",
90" . . ",
91" . X. ",
92". X.",
93". XXX.",
94". X XX.",
95" . XX. ",
96" . XXX. ",
97" . X. ",
98" . X.. ",
99" .ooo.. ",
100" .ooo.. ",
101" .o.. ",
102" .. "};
103
104BrightnessAppletControl::BrightnessAppletControl( OTaskbarApplet* parent, const char* name )
105 :QFrame( parent, name, WStyle_StaysOnTop | WType_Popup )
106{
107 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
108 QGridLayout *gl = new QGridLayout( this, 3, 2, 6, 3 );
109 //gl->setRowStretch( 1, 100 );
110
111 int maxbright = ODevice::inst()->displayBrightnessResolution();
112 slider = new QSlider(this);
113 slider->setMaxValue(maxbright);
114 slider->setOrientation(QSlider::Vertical);
115 slider->setTickmarks(QSlider::Right);
116 slider->setTickInterval(QMAX(1, maxbright / 16));
117 slider->setLineStep(QMAX(1, maxbright / 16));
118 slider->setPageStep(QMAX(1, maxbright / 16));
119 gl->addMultiCellWidget( slider, 0, 2, 0, 0 );
120
121 QPixmap onPm( (const char **)light_on_xpm );
122 QLabel *l = new QLabel( this );
123 l->setPixmap( onPm );
124 gl->addWidget( l, 0, 1 );
125
126 QPixmap offPm( (const char **)light_off_xpm );
127 l = new QLabel( this );
128 l->setPixmap( offPm );
129 gl->addWidget( l, 2, 1 );
130
131 setFixedHeight( 100 );
132 setFixedWidth( gl->sizeHint().width() );
133 setFocusPolicy(QWidget::NoFocus);
134}
135
136
137BrightnessAppletControl::~BrightnessAppletControl()
138{
139}
140
141
142BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name )
143 :OTaskbarApplet( parent, name )
144{
145 setFixedHeight( AppLnk::smallIconSize() );
146 setFixedWidth( AppLnk::smallIconSize() );
147 _pixmap.convertFromImage( Resource::loadImage( "brightnessapplet/icon" ).smoothScale( height(), width() ) );
148 _control = new BrightnessAppletControl( this, "control" );
149}
150
151
152void BrightnessApplet::writeSystemBrightness(int brightness)
153{
154 PowerStatus ps = PowerStatusManager::readStatus();
155
156 Config cfg("qpe");
157 if (ps.acStatus() == PowerStatus::Online) {
158 cfg.setGroup("AC");
159 } else {
160 cfg.setGroup("Battery");
161 }
162 cfg.writeEntry("Brightness", brightness);
163}
164
165
166int BrightnessApplet::readSystemBrightness(void)
167{
168 PowerStatus ps = PowerStatusManager::readStatus();
169 Config cfg("qpe");
170
171 if (ps.acStatus() == PowerStatus::Online) {
172 cfg.setGroup("AC");
173 } else {
174 cfg.setGroup("Battery");
175 }
176
177 return cfg.readNumEntry("Brightness", 128);
178}
179
180
181BrightnessApplet::~BrightnessApplet()
182{
183}
184
185
186int BrightnessApplet::position()
187{
188 return 7;
189}
190
191
192void BrightnessApplet::paintEvent( QPaintEvent* )
193{
194 QPainter p(this);
195 p.drawPixmap(0, 0, _pixmap );
196}
197
198
199int BrightnessApplet::calcBrightnessValue()
200{
201 int v = _control->slider->maxValue() - _control->slider->value();
202 return (v * 255 + _control->slider->maxValue() / 2) / _control->slider->maxValue();
203}
204
205
206void BrightnessApplet::sliderMoved( int value )
207{
208#ifndef QT_NO_COP
209 QCopEnvelope e("QPE/System", "setBacklight(int)");
210 e << calcBrightnessValue();
211#else
212#error This Applet makes no sense without QCOP
213#endif // QT_NO_COP
214}
215
216
217void BrightnessApplet::mousePressEvent( QMouseEvent* )
218{
219 if ( !_control->isVisible() )
220 {
221 int v = 255 - readSystemBrightness();
222 popup( _control );
223 _control->slider->setValue((_control->slider->maxValue() * v + 128) / 255);
224 connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int)));
225 }
226 else
227 {
228 _control->hide();
229 writeSystemBrightness( calcBrightnessValue() );
230 }
231}
232
233
234EXPORT_OPIE_APPLET_v1( BrightnessApplet )
235
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.h b/noncore/applets/brightnessapplet/brightnessapplet.h
new file mode 100644
index 0000000..8b88bd1
--- a/dev/null
+++ b/noncore/applets/brightnessapplet/brightnessapplet.h
@@ -0,0 +1,81 @@
1/*
2                 This file is part of the Opie Project
3
4 =. (C) 2004 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. Based on Qtopia 1.7 Brightnessapplet (C) 2003-2004 TrollTech
6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; General Public License for more
20++=   -.     .`     .: details.
21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = General Public License along with
24    --        :-=` this application; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA.
28
29*/
30
31#ifndef NETWORKAPPLET_H
32#define NETWORKAPPLET_H
33
34#include <opie2/otaskbarapplet.h>
35#include <qframe.h>
36#include <qstring.h>
37#include <qtoolbutton.h>
38#include <qlineedit.h>
39#include <qpixmap.h>
40
41class QShowEvent;
42class QHideEvent;
43class QSlider;
44
45class BrightnessAppletControl : public QFrame
46{
47 public:
48 BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 );
49 ~BrightnessAppletControl();
50
51 QSlider* slider;
52};
53
54class BrightnessApplet : public Opie::Ui::OTaskbarApplet
55{
56 Q_OBJECT
57
58 public:
59 BrightnessApplet( QWidget* parent = 0, const char* name = 0 );
60 ~BrightnessApplet();
61
62 void writeSystemBrightness( int brightness );
63 int readSystemBrightness();
64 int calcBrightnessValue();
65
66 static int position();
67
68 public slots:
69 void sliderMoved( int value );
70
71 protected:
72 virtual void paintEvent( QPaintEvent* );
73 virtual void mousePressEvent( QMouseEvent* );
74
75 private:
76 BrightnessAppletControl* _control;
77 QPixmap _pixmap;
78};
79
80#endif
81
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.pro b/noncore/applets/brightnessapplet/brightnessapplet.pro
new file mode 100644
index 0000000..5044f38
--- a/dev/null
+++ b/noncore/applets/brightnessapplet/brightnessapplet.pro
@@ -0,0 +1,13 @@
1TEMPLATE = lib
2CONFIG += qt plugin warn_on
3HEADERS = brightnessapplet.h
4SOURCES = brightnessapplet.cpp
5TARGET = brightnessapplet
6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 -lopieui2
10VERSION = 0.1.0
11
12
13include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/brightnessapplet/config.in b/noncore/applets/brightnessapplet/config.in
new file mode 100644
index 0000000..ba88bf0
--- a/dev/null
+++ b/noncore/applets/brightnessapplet/config.in
@@ -0,0 +1,6 @@
1 config BRIGHTNESSAPPLET
2 boolean "opie-brightness (control lcd brightness on-the-fly)"
3 default "n"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI
5 comment "Network applet needs a libqpe and libopie2 (core, ui)"
6 depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI)
diff --git a/packages b/packages
index ab7b77a..275d2f9 100644
--- a/packages
+++ b/packages
@@ -1,41 +1,42 @@
1 CONFIG_ABOUTAPPLET core/applets/aboutappletaboutapplet.pro 1 CONFIG_ABOUTAPPLET core/applets/aboutappletaboutapplet.pro
2 CONFIG_ADDRESSBOOK core/pim/addressbookaddressbook.pro 2 CONFIG_ADDRESSBOOK core/pim/addressbookaddressbook.pro
3 CONFIG_ADVANCEDFM noncore/apps/advancedfmadvancedfm.pro 3 CONFIG_ADVANCEDFM noncore/apps/advancedfmadvancedfm.pro
4 CONFIG_APPEARANCE2 noncore/settings/appearance2appearance2.pro 4 CONFIG_APPEARANCE2 noncore/settings/appearance2appearance2.pro
5CONFIG_APPLET_EXAMPLE examples/applet example.pro 5CONFIG_APPLET_EXAMPLE examples/applet example.pro
6 CONFIG_APPSKEY noncore/settings/appskeyappskey.pro 6 CONFIG_APPSKEY noncore/settings/appskeyappskey.pro
7 CONFIG_AQPKG noncore/settings/aqpkgaqpkg.pro 7 CONFIG_AQPKG noncore/settings/aqpkgaqpkg.pro
8 CONFIG_AUTOROTATEAPPLET noncore/applets/autorotateappletautorotateapplet.pro 8 CONFIG_AUTOROTATEAPPLET noncore/applets/autorotateappletautorotateapplet.pro
9 CONFIG_BACKGAMMONnoncore/games/backgammon backgammon.pro 9 CONFIG_BACKGAMMONnoncore/games/backgammon backgammon.pro
10 CONFIG_BACKUP noncore/settings/backupbackup.pro 10 CONFIG_BACKUP noncore/settings/backupbackup.pro
11 CONFIG_BARTENDER noncore/apps/opie-bartenderbartender.pro 11 CONFIG_BARTENDER noncore/apps/opie-bartenderbartender.pro
12 CONFIG_BATTERYAPPLET core/applets/batteryappletbatteryapplet.pro 12 CONFIG_BATTERYAPPLET core/applets/batteryappletbatteryapplet.pro
13 CONFIG_BEND noncore/unsupported/mail2/bendbend.pro 13 CONFIG_BEND noncore/unsupported/mail2/bendbend.pro
14CONFIG_BIGSCREEN_EXAMPLE libopie/big-screen/example osplitter_mail.pro 14CONFIG_BIGSCREEN_EXAMPLE libopie/big-screen/example osplitter_mail.pro
15 CONFIG_BINARY noncore/tools/calc2/binarybinary.pro 15 CONFIG_BINARY noncore/tools/calc2/binarybinary.pro
16 CONFIG_BLUE-PIN noncore/net/opietooth/blue-pinblue-pin.pro 16 CONFIG_BLUE-PIN noncore/net/opietooth/blue-pinblue-pin.pro
17 CONFIG_BOUNCE noncore/games/bouncebounce.pro 17 CONFIG_BOUNCE noncore/games/bouncebounce.pro
18 CONFIG_BRIGHTNESSAPPLET noncore/applets/brightnessappletbrightnessapplet.pro
18 CONFIG_BUTTON-SETTINGS core/settings/buttonbutton.pro 19 CONFIG_BUTTON-SETTINGS core/settings/buttonbutton.pro
19 CONFIG_BUZZWORD noncore/games/buzzwordbuzzword.pro 20 CONFIG_BUZZWORD noncore/games/buzzwordbuzzword.pro
20 CONFIG_CALC2 noncore/tools/calc2calc.pro 21 CONFIG_CALC2 noncore/tools/calc2calc.pro
21 CONFIG_CALCULATOR noncore/tools/calculatorcalculator.pro 22 CONFIG_CALCULATOR noncore/tools/calculatorcalculator.pro
22 CONFIG_CALIBRATE core/apps/calibratecalibrate.pro 23 CONFIG_CALIBRATE core/apps/calibratecalibrate.pro
23 CONFIG_CAMERA noncore/multimedia/cameracamera.pro 24 CONFIG_CAMERA noncore/multimedia/cameracamera.pro
24 CONFIG_CARDMON core/applets/cardmoncardmon.pro 25 CONFIG_CARDMON core/applets/cardmoncardmon.pro
25 CONFIG_CHECKBOOK noncore/apps/checkbookcheckbook.pro 26 CONFIG_CHECKBOOK noncore/apps/checkbookcheckbook.pro
26 CONFIG_CITYTIME core/settings/citytimecitytime.pro 27 CONFIG_CITYTIME core/settings/citytimecitytime.pro
27 CONFIG_CLIPBOARDAPPLET core/applets/clipboardappletclipboardapplet.pro 28 CONFIG_CLIPBOARDAPPLET core/applets/clipboardappletclipboardapplet.pro
28 CONFIG_CLOCKAPPLET core/applets/clockappletclockapplet.pro 29 CONFIG_CLOCKAPPLET core/applets/clockappletclockapplet.pro
29 CONFIG_CLOCK noncore/tools/clockclock.pro 30 CONFIG_CLOCK noncore/tools/clockclock.pro
30 CONFIG_CONFEDIT noncore/apps/confeditconfedit.pro 31 CONFIG_CONFEDIT noncore/apps/confeditconfedit.pro
31CONFIG_DAGGER noncore/apps/dagger dagger.pro 32CONFIG_DAGGER noncore/apps/dagger dagger.pro
32 CONFIG_DASHER inputmethods/dasherdasher.pro 33 CONFIG_DASHER inputmethods/dasherdasher.pro
33 CONFIG_DATEBOOK2 core/pim/datebook2datebook2.pro 34 CONFIG_DATEBOOK2 core/pim/datebook2datebook2.pro
34 CONFIG_DATEBOOK core/pim/datebookdatebook.pro 35 CONFIG_DATEBOOK core/pim/datebookdatebook.pro
35 CONFIG_DECO_FLAT noncore/decorations/flatflat.pro 36 CONFIG_DECO_FLAT noncore/decorations/flatflat.pro
36 CONFIG_DECO_LIQUID noncore/decorations/liquidliquid.pro 37 CONFIG_DECO_LIQUID noncore/decorations/liquidliquid.pro
37 CONFIG_DECO_POLISHED noncore/decorations/polishedpolished.pro 38 CONFIG_DECO_POLISHED noncore/decorations/polishedpolished.pro
38 CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro 39 CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro
39CONFIG_DOCTAB noncore/settings/doctab doctab.pro 40CONFIG_DOCTAB noncore/settings/doctab doctab.pro
40 CONFIG_DRAWPAD noncore/graphics/drawpaddrawpad.pro 41 CONFIG_DRAWPAD noncore/graphics/drawpaddrawpad.pro
41 CONFIG_DVORAK inputmethods/dvorakdvorak.pro 42 CONFIG_DVORAK inputmethods/dvorakdvorak.pro
diff --git a/pics/brightnessapplet/icon.png b/pics/brightnessapplet/icon.png
new file mode 100644
index 0000000..c7765c9
--- a/dev/null
+++ b/pics/brightnessapplet/icon.png
Binary files differ