summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-25 22:03:41 (UTC)
committer harlekin <harlekin>2003-03-25 22:03:41 (UTC)
commitc03e0f1199be7b2be111059b57f9e8ce965f5828 (patch) (unidiff)
tree85d30d63f4823def6bc405c55e52133661c7640b
parent8e685661d962c10c13efd3c442742c1afe1afd1b (diff)
downloadopie-c03e0f1199be7b2be111059b57f9e8ce965f5828.zip
opie-c03e0f1199be7b2be111059b57f9e8ce965f5828.tar.gz
opie-c03e0f1199be7b2be111059b57f9e8ce965f5828.tar.bz2
here comes the rotate startmenu applet .-)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/rotateapplet/config.in4
-rw-r--r--core/applets/rotateapplet/rotate.cpp127
-rw-r--r--core/applets/rotateapplet/rotate.h62
-rw-r--r--core/applets/rotateapplet/rotateapplet.pro12
-rw-r--r--core/launcher/opie-taskbar.control2
-rw-r--r--packages1
6 files changed, 207 insertions, 1 deletions
diff --git a/core/applets/rotateapplet/config.in b/core/applets/rotateapplet/config.in
new file mode 100644
index 0000000..1a0d923
--- a/dev/null
+++ b/core/applets/rotateapplet/config.in
@@ -0,0 +1,4 @@
1 config ROTATEAPPLET
2 boolean "Rotate"
3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp
new file mode 100644
index 0000000..8f323d6
--- a/dev/null
+++ b/core/applets/rotateapplet/rotate.cpp
@@ -0,0 +1,127 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29
30#include <qpe/resource.h>
31#include <qpe/qcopenvelope_qws.h>
32
33#include <qpe/qpeapplication.h>
34#include <qiconset.h>
35#include <qpopupmenu.h>
36
37#include "rotate.h"
38
39
40RotateApplet::RotateApplet ( )
41 : QObject ( 0, "RotateApplet" ), ref ( 0 )
42{
43 m_native = true;
44 m_startupRot = QPEApplication::defaultRotation();
45}
46
47RotateApplet::~RotateApplet ( )
48{
49}
50
51int RotateApplet::position ( ) const
52{
53 return 2;
54}
55
56QString RotateApplet::name ( ) const
57{
58 return tr( "Rotate shortcut" );
59}
60
61QString RotateApplet::text ( ) const
62{
63 return tr( "Rotate" );
64}
65
66QString RotateApplet::tr( const char* s ) const
67{
68 return qApp->translate( "RotateApplet", s, 0 );
69}
70
71QString RotateApplet::tr( const char* s, const char* p ) const
72{
73 return qApp->translate( "RotateApplet", s, p );
74}
75
76QIconSet RotateApplet::icon ( ) const
77{
78 QPixmap pix;
79 QImage img = Resource::loadImage ( "Rotation" );
80
81 if ( !img. isNull ( ))
82 pix. convertFromImage ( img. smoothScale ( 14, 14 ));
83 return pix;
84}
85
86QPopupMenu *RotateApplet::popup ( QWidget * ) const
87{
88 return 0;
89}
90
91void RotateApplet::activated ( )
92{
93 int newRotation;
94 if ( m_native == true ) {
95 newRotation = m_startupRot + 90;
96 } else {
97 newRotation = m_startupRot;
98 }
99 QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" );
100 env << newRotation;
101 QCopEnvelope env2( "QPE/System", "setDefaultRotation(int)" );
102 env2 << newRotation;
103
104 m_native = !m_native;
105
106}
107
108
109QRESULT RotateApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
110{
111 *iface = 0;
112 if ( uuid == IID_QUnknown )
113 *iface = this;
114 else if ( uuid == IID_MenuApplet )
115 *iface = this;
116
117 if ( *iface )
118 (*iface)-> addRef ( );
119 return QS_OK;
120}
121
122Q_EXPORT_INTERFACE( )
123{
124 Q_CREATE_INSTANCE( RotateApplet )
125}
126
127
diff --git a/core/applets/rotateapplet/rotate.h b/core/applets/rotateapplet/rotate.h
new file mode 100644
index 0000000..11e2ec9
--- a/dev/null
+++ b/core/applets/rotateapplet/rotate.h
@@ -0,0 +1,62 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Maximilian Reiss <harlekin@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This library is free software; you can
6.> <_,   >  .   <= redistribute it and/or modify it under
7:=1 )Y*s>-.--   : the terms of the GNU Library General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%+i>       _;_.
12    .i_,=:_.      -<s. This library is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=| MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; Library General Public License for more
18++=   -.     .     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = Library General Public License along with
22    --        :-= this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29
30
31#ifndef __OPIE_ROTATE_APPLET_H__
32#define __OPIE_ROTATE_APPLET_H__
33
34#include <qpe/menuappletinterface.h>
35
36class RotateApplet : public QObject, public MenuAppletInterface
37{
38public:
39 RotateApplet ( );
40 virtual ~RotateApplet ( );
41
42 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
43 Q_REFCOUNT
44
45 virtual int position() const;
46
47 virtual QString name ( ) const;
48 virtual QIconSet icon ( ) const;
49 virtual QString text ( ) const;
50 virtual QString tr( const char* ) const;
51 virtual QString tr( const char*, const char* ) const;
52 virtual QPopupMenu *popup ( QWidget *parent ) const;
53
54 virtual void activated ( );
55
56private:
57 bool m_native;
58 int m_startupRot;
59 ulong ref;
60};
61
62#endif
diff --git a/core/applets/rotateapplet/rotateapplet.pro b/core/applets/rotateapplet/rotateapplet.pro
new file mode 100644
index 0000000..abcca47
--- a/dev/null
+++ b/core/applets/rotateapplet/rotateapplet.pro
@@ -0,0 +1,12 @@
1TEMPLATE = lib
2CONFIG += qt warn_on release
3HEADERS = rotate.h
4SOURCES = rotate.cpp
5TARGET = rotateapplet
6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe
10VERSION = 1.0.0
11
12include ( $(OPIEDIR)/include.pro )
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index abe5fb8..411e511 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -1,4 +1,4 @@
1Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* root/etc/init.d/opie 1Files: bin/qpe apps/Settings/Calibrate.desktop pics/launcher pics/devicebuttons/*.png plugins/applets/libsuspendapplet.so* plugins/applets/libhomeapplet.so* plugins/applets/liblogoutapplet.so* plugins/applets/librotateapplet.so* root/etc/init.d/opie
2Priority: required 2Priority: required
3Section: opie/system 3Section: opie/system
4Maintainer: Project Opie <opie@handhelds.org> 4Maintainer: Project Opie <opie@handhelds.org>
diff --git a/packages b/packages
index c004b1a..a35b267 100644
--- a/packages
+++ b/packages
@@ -141,6 +141,7 @@ CONFIG_SOLITAIRE noncore/games/solitaire solitaire.pro
141 CONFIG_SOUND noncore/settings/soundsound.pro 141 CONFIG_SOUND noncore/settings/soundsound.pro
142 CONFIG_SSHKEYS noncore/settings/sshkeyssshkeys.pro 142 CONFIG_SSHKEYS noncore/settings/sshkeyssshkeys.pro
143 CONFIG_SUSPENDAPPLET core/applets/suspendappletsuspendapplet.pro 143 CONFIG_SUSPENDAPPLET core/applets/suspendappletsuspendapplet.pro
144 CONFIG_ROTATEAPPLET core/applets/rotateappletrotateapplet.pro
144 CONFIG_SYSINFO noncore/apps/sysinfosysinfo.pro 145 CONFIG_SYSINFO noncore/apps/sysinfosysinfo.pro
145 CONFIG_TABLEVIEWER noncore/apps/tableviewertableviewer.pro 146 CONFIG_TABLEVIEWER noncore/apps/tableviewertableviewer.pro
146 CONFIG_TABMANAGER noncore/settings/tabmanagertabmanager.pro 147 CONFIG_TABMANAGER noncore/settings/tabmanagertabmanager.pro