author | mickeyl <mickeyl> | 2004-05-28 09:19:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-05-28 09:19:18 (UTC) |
commit | 568d43a21aa45c402bff7570202467f0e7631634 (patch) (unidiff) | |
tree | dff88c1aed244b622b791b7272d1266139cca760 | |
parent | 4f7c3c4d0d634706d13950b3827714b168e279e3 (diff) | |
download | opie-568d43a21aa45c402bff7570202467f0e7631634.zip opie-568d43a21aa45c402bff7570202467f0e7631634.tar.gz opie-568d43a21aa45c402bff7570202467f0e7631634.tar.bz2 |
add sceleton for the pyquicklaunchapplet, an applet which mimicks the quicklaunch
technology for PyQt applications hence giving them a startup boost
-rw-r--r-- | noncore/applets/pyquicklaunch/.cvsignore | 6 | ||||
-rw-r--r-- | noncore/applets/pyquicklaunch/config.in | 4 | ||||
-rw-r--r-- | noncore/applets/pyquicklaunch/pyquicklaunch.cpp | 109 | ||||
-rw-r--r-- | noncore/applets/pyquicklaunch/pyquicklaunch.h | 57 | ||||
-rw-r--r-- | noncore/applets/pyquicklaunch/pyquicklaunch.pro | 13 | ||||
-rw-r--r-- | packages | 1 |
6 files changed, 190 insertions, 0 deletions
diff --git a/noncore/applets/pyquicklaunch/.cvsignore b/noncore/applets/pyquicklaunch/.cvsignore new file mode 100644 index 0000000..0f79c04 --- a/dev/null +++ b/noncore/applets/pyquicklaunch/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | advancedconfigbase.cpp | ||
3 | advancedconfigbase.h | ||
4 | moc_* | ||
5 | .moc | ||
6 | .obj | ||
diff --git a/noncore/applets/pyquicklaunch/config.in b/noncore/applets/pyquicklaunch/config.in new file mode 100644 index 0000000..f4828d3 --- a/dev/null +++ b/noncore/applets/pyquicklaunch/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config WIRELESSAPPLET | ||
2 | boolean "opie-wirelessapplet (view wireless signal strength, and renew IP on AP change)" | ||
3 | default "y" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2NET | ||
diff --git a/noncore/applets/pyquicklaunch/pyquicklaunch.cpp b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp new file mode 100644 index 0000000..2ee8e17 --- a/dev/null +++ b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp | |||
@@ -0,0 +1,109 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@vanille.de> | ||
3 | ** All rights reserved. | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | ** | ||
13 | **********************************************************************/ | ||
14 | |||
15 | #include "pyquicklaunch.h" | ||
16 | |||
17 | /* OPIE */ | ||
18 | #include <opie2/odebug.h> | ||
19 | #include <opie2/otaskbarapplet.h> | ||
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <qpe/config.h> | ||
22 | using namespace Opie::Core; | ||
23 | |||
24 | /* QT */ | ||
25 | #include <qpainter.h> | ||
26 | #include <qframe.h> | ||
27 | |||
28 | PyQuicklaunchControl::PyQuicklaunchControl( PyQuicklaunchApplet *applet, QWidget *parent, const char *name ) | ||
29 | : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet ) | ||
30 | { | ||
31 | |||
32 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | ||
33 | setFixedSize( sizeHint() ); | ||
34 | setFocusPolicy( QWidget::NoFocus ); | ||
35 | } | ||
36 | |||
37 | |||
38 | void PyQuicklaunchControl::show( bool ) | ||
39 | { | ||
40 | QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) ); | ||
41 | |||
42 | int w = sizeHint().width(); | ||
43 | int x = curPos.x() - ( w / 2 ); | ||
44 | |||
45 | if ( ( x + w ) > QPEApplication::desktop() ->width() ) | ||
46 | x = QPEApplication::desktop ( ) -> width ( ) - w; | ||
47 | |||
48 | move( x, curPos.y () - sizeHint().height () ); | ||
49 | QFrame::show(); | ||
50 | } | ||
51 | |||
52 | void PyQuicklaunchControl::readConfig() | ||
53 | { | ||
54 | Config cfg( "qpe" ); | ||
55 | cfg.setGroup( "PyQuicklaunch" ); | ||
56 | |||
57 | // ... | ||
58 | } | ||
59 | |||
60 | void PyQuicklaunchControl::writeConfigEntry( const char *entry, int val ) | ||
61 | { | ||
62 | Config cfg( "qpe" ); | ||
63 | cfg.setGroup( "PyQuicklaunch" ); | ||
64 | cfg.writeEntry( entry, val ); | ||
65 | } | ||
66 | |||
67 | //=========================================================================== | ||
68 | |||
69 | PyQuicklaunchApplet::PyQuicklaunchApplet( QWidget *parent, const char *name ) | ||
70 | : QWidget( parent, name ) | ||
71 | { | ||
72 | setFixedHeight( 18 ); | ||
73 | setFixedWidth( 14 ); | ||
74 | status = new PyQuicklaunchControl( this, this, "Python Quicklaunch Status" ); | ||
75 | } | ||
76 | |||
77 | |||
78 | PyQuicklaunchApplet::~PyQuicklaunchApplet() | ||
79 | {} | ||
80 | |||
81 | |||
82 | void PyQuicklaunchApplet::timerEvent( QTimerEvent* ) | ||
83 | { | ||
84 | // FIXME | ||
85 | } | ||
86 | |||
87 | void PyQuicklaunchApplet::mousePressEvent( QMouseEvent * ) | ||
88 | { | ||
89 | status->isVisible() ? status->hide() : status->show( true ); | ||
90 | } | ||
91 | |||
92 | void PyQuicklaunchApplet::paintEvent( QPaintEvent* ) | ||
93 | { | ||
94 | QPainter p( this ); | ||
95 | int h = height(); | ||
96 | int w = width(); | ||
97 | |||
98 | // FIXME | ||
99 | |||
100 | } | ||
101 | |||
102 | |||
103 | int PyQuicklaunchApplet::position() | ||
104 | { | ||
105 | return 6; | ||
106 | } | ||
107 | |||
108 | EXPORT_OPIE_APPLET_v1( PyQuicklaunchApplet ) | ||
109 | |||
diff --git a/noncore/applets/pyquicklaunch/pyquicklaunch.h b/noncore/applets/pyquicklaunch/pyquicklaunch.h new file mode 100644 index 0000000..e99f780 --- a/dev/null +++ b/noncore/applets/pyquicklaunch/pyquicklaunch.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
3 | ** All rights reserved. | ||
4 | ** | ||
5 | ** This file may be distributed and/or modified under the terms of the | ||
6 | ** GNU General Public License version 2 as published by the Free Software | ||
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
8 | ** packaging of this file. | ||
9 | ** | ||
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | ** | ||
13 | **********************************************************************/ | ||
14 | |||
15 | #ifndef PYQUICKLAUNCHAPPLET_H | ||
16 | #define PYQUICKLAUNCHAPPLET_H | ||
17 | |||
18 | #include <qwidget.h> | ||
19 | #include <qframe.h> | ||
20 | #include <qpixmap.h> | ||
21 | |||
22 | class PyQuicklaunchApplet; | ||
23 | |||
24 | class PyQuicklaunchControl : public QFrame | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | public: | ||
28 | PyQuicklaunchControl( PyQuicklaunchApplet* icon, QWidget *parent=0, const char *name=0 ); | ||
29 | void show( bool ); | ||
30 | |||
31 | void readConfig(); | ||
32 | void writeConfigEntry( const char* entry, int val ); | ||
33 | |||
34 | public slots: | ||
35 | |||
36 | private: | ||
37 | PyQuicklaunchApplet* applet; | ||
38 | }; | ||
39 | |||
40 | class PyQuicklaunchApplet : public QWidget | ||
41 | { | ||
42 | Q_OBJECT | ||
43 | public: | ||
44 | PyQuicklaunchApplet( QWidget *parent = 0, const char *name=0 ); | ||
45 | ~PyQuicklaunchApplet(); | ||
46 | static int position(); | ||
47 | PyQuicklaunchControl* status; | ||
48 | |||
49 | virtual void timerEvent( QTimerEvent* ); | ||
50 | |||
51 | protected: | ||
52 | virtual void mousePressEvent( QMouseEvent * ); | ||
53 | virtual void paintEvent( QPaintEvent* ); | ||
54 | }; | ||
55 | |||
56 | #endif // PYQUICKLAUNCHAPPLET_H | ||
57 | |||
diff --git a/noncore/applets/pyquicklaunch/pyquicklaunch.pro b/noncore/applets/pyquicklaunch/pyquicklaunch.pro new file mode 100644 index 0000000..901781e --- a/dev/null +++ b/noncore/applets/pyquicklaunch/pyquicklaunch.pro | |||
@@ -0,0 +1,13 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qt plugin warn_on | ||
3 | HEADERS = pyquicklaunch.h | ||
4 | SOURCES = pyquicklaunch.cpp | ||
5 | INTERFACES = | ||
6 | TARGET = pyquicklaunch | ||
7 | DESTDIR = $(OPIEDIR)/plugins/applets | ||
8 | INCLUDEPATH += $(OPIEDIR)/include | ||
9 | DEPENDPATH += $(OPIEDIR)/include | ||
10 | LIBS += -lqpe -lopiecore2 | ||
11 | VERSION = 0.0.1 | ||
12 | |||
13 | include ( $(OPIEDIR)/include.pro ) | ||
@@ -146,4 +146,5 @@ CONFIG_PICKBOARD inputmethods/pickboard pickboard.pro | |||
146 | CONFIG_POWERCHORD noncore/multimedia/powerchordpowerchord.pro | 146 | CONFIG_POWERCHORD noncore/multimedia/powerchordpowerchord.pro |
147 | CONFIG_PPP noncore/settings/networksettings/ppp ppp.pro | 147 | CONFIG_PPP noncore/settings/networksettings/ppp ppp.pro |
148 | CONFIG_PYQUICKLAUNCH noncore/applets/pyquicklaunchpyquicklaunch.pro | ||
148 | CONFIG_QASHMONEY noncore/apps/qashmoneyqashmoney.pro | 149 | CONFIG_QASHMONEY noncore/apps/qashmoneyqashmoney.pro |
149 | CONFIG_QASTEROIDS noncore/games/qasteroidsqasteroids.pro | 150 | CONFIG_QASTEROIDS noncore/games/qasteroidsqasteroids.pro |