author | drw <drw> | 2005-04-24 21:32:37 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-24 21:32:37 (UTC) |
commit | 2391cfd9c79b87b3b00a4bb4a1d76981debb4486 (patch) (unidiff) | |
tree | 4ba271b1465881c0cce4ba5fd7a8c95bff5aca24 | |
parent | ead2586272813b8cab8092773376c690cdf1b906 (diff) | |
download | opie-2391cfd9c79b87b3b00a4bb4a1d76981debb4486.zip opie-2391cfd9c79b87b3b00a4bb4a1d76981debb4486.tar.gz opie-2391cfd9c79b87b3b00a4bb4a1d76981debb4486.tar.bz2 |
Resource -> OResource
-rw-r--r-- | core/applets/restartapplet2/opie-restartapplet2.control | 2 | ||||
-rw-r--r-- | core/applets/restartapplet2/restart.cpp | 42 | ||||
-rw-r--r-- | core/applets/restartapplet2/restartapplet.pro | 2 | ||||
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 54 | ||||
-rw-r--r-- | core/applets/vtapplet/opie-vtapplet.control | 2 | ||||
-rw-r--r-- | core/applets/vtapplet/vt.cpp | 10 | ||||
-rw-r--r-- | core/applets/vtapplet/vtapplet.pro | 2 |
7 files changed, 39 insertions, 75 deletions
diff --git a/core/applets/restartapplet2/opie-restartapplet2.control b/core/applets/restartapplet2/opie-restartapplet2.control index cec3b19..9cc8dac 100644 --- a/core/applets/restartapplet2/opie-restartapplet2.control +++ b/core/applets/restartapplet2/opie-restartapplet2.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-restartapplet2 | 1 | Package: opie-restartapplet2 |
2 | Files: plugins/applets/librestartapplet2.so* | 2 | Files: plugins/applets/librestartapplet2.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: L.J. Potter <lpotter@trolltech.com> | 5 | Maintainer: L.J. Potter <lpotter@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | Description: Restart Applet | 8 | Description: Restart Applet |
9 | A simple opie menu applet to restart the Opie environment | 9 | A simple opie menu applet to restart the Opie environment |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/applets/restartapplet2/restart.cpp b/core/applets/restartapplet2/restart.cpp index eda0005..42d814a 100644 --- a/core/applets/restartapplet2/restart.cpp +++ b/core/applets/restartapplet2/restart.cpp | |||
@@ -1,106 +1,72 @@ | |||
1 | // coptright Mon 10-21-2002 01:14:03 by L. Potter <ljp@llornkcor.com> | 1 | // coptright Mon 10-21-2002 01:14:03 by L. Potter <ljp@llornkcor.com> |
2 | 2 | ||
3 | #include "restart.h" | 3 | #include "restart.h" |
4 | 4 | ||
5 | #include <opie2/oresource.h> | ||
6 | |||
5 | #include <qpe/applnk.h> | 7 | #include <qpe/applnk.h> |
6 | #include <qpe/qpeapplication.h> | 8 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/resource.h> | ||
8 | #include <qpe/qcopenvelope_qws.h> | 9 | #include <qpe/qcopenvelope_qws.h> |
9 | 10 | ||
10 | /* XPM */ | ||
11 | static char *restart_xpm[] = { | ||
12 | "16 16 11 1", | ||
13 | " c None", | ||
14 | ". c #000000", | ||
15 | "+ c #DCDCDC", | ||
16 | "@ c #A0A0A0", | ||
17 | "# c #C3C3C3", | ||
18 | "$ c #808080", | ||
19 | "% c #FFA858", | ||
20 | "& c #FFDCA8", | ||
21 | "* c #FFFFC0", | ||
22 | "= c #FFFFFF", | ||
23 | "- c #585858", | ||
24 | " .. ", | ||
25 | " .. .++. .. ", | ||
26 | " .+@.@##@.@+. ", | ||
27 | " .@+$@%%@$+@. ", | ||
28 | " .$%%&%&%$. ", | ||
29 | " ..+@%&$$%&@+.. ", | ||
30 | ".+#@%&%@@&*%@#+.", | ||
31 | ".$@+$&*&&=*$+@$.", | ||
32 | " .--+$&*=&$+--. ", | ||
33 | " .$#++$$++#$. ", | ||
34 | " .@=$-$++$-$=@. ", | ||
35 | " .+@-..@@..-@+. ", | ||
36 | " ... .+=. ... ", | ||
37 | " .-$. ", | ||
38 | " .. ", | ||
39 | " "}; | ||
40 | |||
41 | RestartApplet::RestartApplet ( ) | 11 | RestartApplet::RestartApplet ( ) |
42 | : QObject ( 0, "RestartApplet" ) | 12 | : QObject ( 0, "RestartApplet" ) |
43 | { | 13 | { |
44 | } | 14 | } |
45 | 15 | ||
46 | RestartApplet::~RestartApplet ( ) | 16 | RestartApplet::~RestartApplet ( ) |
47 | { | 17 | { |
48 | } | 18 | } |
49 | 19 | ||
50 | int RestartApplet::position ( ) const | 20 | int RestartApplet::position ( ) const |
51 | { | 21 | { |
52 | return 4; | 22 | return 4; |
53 | } | 23 | } |
54 | 24 | ||
55 | QString RestartApplet::name ( ) const | 25 | QString RestartApplet::name ( ) const |
56 | { | 26 | { |
57 | return tr( "Restart" ); | 27 | return tr( "Restart" ); |
58 | } | 28 | } |
59 | 29 | ||
60 | QString RestartApplet::text ( ) const | 30 | QString RestartApplet::text ( ) const |
61 | { | 31 | { |
62 | return tr( "Restart Opie" ); | 32 | return tr( "Restart Opie" ); |
63 | } | 33 | } |
64 | 34 | ||
65 | QIconSet RestartApplet::icon ( ) const | 35 | QIconSet RestartApplet::icon ( ) const |
66 | { | 36 | { |
67 | QPixmap pix; | 37 | QPixmap pix = Opie::Core::OResource::loadPixmap( "exec", Opie::Core::OResource::SmallIcon ); |
68 | QImage img = ( const char** ) restart_xpm ;//Resource::loadImage ( "Run" ); | 38 | return pix; |
69 | |||
70 | if ( !img. isNull ( )) | ||
71 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
72 | return pix; | ||
73 | } | 39 | } |
74 | 40 | ||
75 | QPopupMenu *RestartApplet::popup ( QWidget * ) const | 41 | QPopupMenu *RestartApplet::popup ( QWidget * ) const |
76 | { | 42 | { |
77 | return 0; | 43 | return 0; |
78 | } | 44 | } |
79 | 45 | ||
80 | void RestartApplet::activated ( ) | 46 | void RestartApplet::activated ( ) |
81 | { | 47 | { |
82 | QCopEnvelope e("QPE/System", "restart()"); | 48 | QCopEnvelope e("QPE/System", "restart()"); |
83 | } | 49 | } |
84 | 50 | ||
85 | 51 | ||
86 | QRESULT RestartApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 52 | QRESULT RestartApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
87 | { | 53 | { |
88 | *iface = 0; | 54 | *iface = 0; |
89 | if ( uuid == IID_QUnknown ) | 55 | if ( uuid == IID_QUnknown ) |
90 | *iface = this; | 56 | *iface = this; |
91 | else if ( uuid == IID_MenuApplet ) | 57 | else if ( uuid == IID_MenuApplet ) |
92 | *iface = this; | 58 | *iface = this; |
93 | else | 59 | else |
94 | return QS_FALSE; | 60 | return QS_FALSE; |
95 | 61 | ||
96 | if ( *iface ) | 62 | if ( *iface ) |
97 | (*iface)-> addRef ( ); | 63 | (*iface)-> addRef ( ); |
98 | return QS_OK; | 64 | return QS_OK; |
99 | } | 65 | } |
100 | 66 | ||
101 | Q_EXPORT_INTERFACE( ) | 67 | Q_EXPORT_INTERFACE( ) |
102 | { | 68 | { |
103 | Q_CREATE_INSTANCE( RestartApplet ) | 69 | Q_CREATE_INSTANCE( RestartApplet ) |
104 | } | 70 | } |
105 | 71 | ||
106 | 72 | ||
diff --git a/core/applets/restartapplet2/restartapplet.pro b/core/applets/restartapplet2/restartapplet.pro index 60d34f2..d3c408d 100644 --- a/core/applets/restartapplet2/restartapplet.pro +++ b/core/applets/restartapplet2/restartapplet.pro | |||
@@ -1,17 +1,17 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | HEADERS = restart.h | 3 | HEADERS = restart.h |
4 | SOURCES = restart.cpp | 4 | SOURCES = restart.cpp |
5 | TARGET = restartapplet2 | 5 | TARGET = restartapplet2 |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | MOC_DIR=opieobj | 11 | MOC_DIR=opieobj |
12 | OBJECTS_DIR=opieobj | 12 | OBJECTS_DIR=opieobj |
13 | 13 | ||
14 | 14 | ||
15 | 15 | ||
16 | include( $(OPIEDIR)/include.pro ) | 16 | include( $(OPIEDIR)/include.pro ) |
17 | target.path = $$prefix/plugins/applets | 17 | target.path = $$prefix/plugins/applets |
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index d13c2c0..9abbde8 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -1,241 +1,241 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | |||
3 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> | 4 | Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> |
4 | Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net> | 5 | Copyright (C) 2003 Greg Gilbert <ggilbert@treke.net> |
5 | =. Copyright (C) 2004 Michael Lauer <mickey@Vanille.de> | 6 | Copyright (C) 2004 Michael Lauer <mickey@Vanille.de> |
6 | .=l. | 7 | =. |
7 | .>+-= | 8 | .=l. |
8 | _;:, .> :=|. This library is free software; you can | 9 | Â Â Â Â Â Â .>+-= |
9 | .> <, > . <= redistribute it and/or modify it under | 10 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
10 | :=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
11 | .="- .-=="i, .._ License as published by the Free Software | 12 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | .="- .-=="i, Â Â .._ License as published by the Free Software |
13 | ._= =} : or (at your option) any later version. | 14 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
14 | .%+i> _;_. | 15 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
15 | .i_,=:_. -<s. This library is distributed in the hope that | 16 | Â Â .%`+i> Â Â Â _;_. |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
17 | : .. .:, . . . without even the implied warranty of | 18 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
18 | =_ + =;=| MERCHANTABILITY or FITNESS FOR A | 19 | : .. Â Â .:, Â Â . . . without even the implied warranty of |
19 | _.=:. : :=>: PARTICULAR PURPOSE. See the GNU | 20 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | ..}^=.= = ; Library General Public License for more | 21 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ++= -. . .: details. | 22 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more |
22 | : = ...= . :.=- | 23 | ++= Â -. Â Â .` Â Â .: details. |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | : Â Â = Â ...= . :.=- |
24 | -_. . . )=. = Library General Public License along with | 25 | Â -. Â .:....=;==+<; You should have received a copy of the GNU |
25 | -- :-= this library; see the file COPYING.LIB. | 26 | Â -_. . . Â )=. Â = Library General Public License along with |
27 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
29 | */ | 31 | */ |
30 | 32 | ||
31 | #include "rotate.h" | 33 | #include "rotate.h" |
32 | 34 | ||
33 | /* OPIE */ | 35 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 36 | #include <opie2/odebug.h> |
35 | #include <opie2/odevice.h> | 37 | #include <opie2/odevice.h> |
38 | #include <opie2/oresource.h> | ||
39 | |||
36 | #include <qpe/applnk.h> | 40 | #include <qpe/applnk.h> |
37 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
38 | #include <qpe/power.h> | 42 | #include <qpe/power.h> |
39 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
40 | #include <qpe/resource.h> | ||
41 | using namespace Opie::Core; | 44 | using namespace Opie::Core; |
42 | 45 | ||
43 | /* STD */ | 46 | /* STD */ |
44 | #include <time.h> | 47 | #include <time.h> |
45 | 48 | ||
46 | RotateApplet::RotateApplet() | 49 | RotateApplet::RotateApplet() |
47 | :QObject( 0, "RotateApplet" ), m_flipped( false ) | 50 | :QObject( 0, "RotateApplet" ), m_flipped( false ) |
48 | { | 51 | { |
49 | 52 | ||
50 | #if !defined(QT_NO_COP) | 53 | #if !defined(QT_NO_COP) |
51 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); | 54 | QCopChannel *rotateChannel = new QCopChannel( "QPE/Rotation" , this ); |
52 | connect ( rotateChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 55 | connect ( rotateChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
53 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); | 56 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); |
54 | #endif | 57 | #endif |
55 | 58 | ||
56 | } | 59 | } |
57 | 60 | ||
58 | RotateApplet::~RotateApplet ( ) | 61 | RotateApplet::~RotateApplet ( ) |
59 | {} | 62 | {} |
60 | 63 | ||
61 | /** | 64 | /** |
62 | * Qcop receive method. | 65 | * Qcop receive method. |
63 | */ | 66 | */ |
64 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) | 67 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) |
65 | { | 68 | { |
66 | odebug << "RotateApplet::channelReceived( '" << msg << "' )" << oendl; | 69 | odebug << "RotateApplet::channelReceived( '" << msg << "' )" << oendl; |
67 | 70 | ||
68 | if ( ODevice::inst()->hasHingeSensor() ) | 71 | if ( ODevice::inst()->hasHingeSensor() ) |
69 | { | 72 | { |
70 | struct timespec interval; | 73 | struct timespec interval; |
71 | struct timespec remain; | 74 | struct timespec remain; |
72 | interval.tv_sec = 0; | 75 | interval.tv_sec = 0; |
73 | interval.tv_nsec = 600000; | 76 | interval.tv_nsec = 600000; |
74 | ::nanosleep( &interval, &remain ); | 77 | ::nanosleep( &interval, &remain ); |
75 | OHingeStatus status = ODevice::inst()->readHingeSensor(); | 78 | OHingeStatus status = ODevice::inst()->readHingeSensor(); |
76 | odebug << "RotateApplet::readHingeSensor = " << (int) status << "" << oendl; | 79 | odebug << "RotateApplet::readHingeSensor = " << (int) status << "" << oendl; |
77 | 80 | ||
78 | Config cfg( "apm" ); | 81 | Config cfg( "apm" ); |
79 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); | 82 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); |
80 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); | 83 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); |
81 | 84 | ||
82 | if ( status == CASE_CLOSED ) | 85 | if ( status == CASE_CLOSED ) |
83 | { | 86 | { |
84 | switch ( action ) | 87 | switch ( action ) |
85 | { | 88 | { |
86 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; | 89 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 0 ); break; |
87 | case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; | 90 | case 2: /* SUSPEND */ ODevice::inst()->suspend(); break; |
88 | default: /* IGNORE */ break; | 91 | default: /* IGNORE */ break; |
89 | } | 92 | } |
90 | } | 93 | } |
91 | else /* status != CASE_CLOSED */ | 94 | else /* status != CASE_CLOSED */ |
92 | { | 95 | { |
93 | switch ( action ) | 96 | switch ( action ) |
94 | { | 97 | { |
95 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; | 98 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; |
96 | case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; | 99 | case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; |
97 | default: /* IGNORE */ break; | 100 | default: /* IGNORE */ break; |
98 | } | 101 | } |
99 | } | 102 | } |
100 | odebug << "RotateApplet::switchAction " << cfg.readNumEntry( "CloseHingeAction" ) << " performed." << oendl; | 103 | odebug << "RotateApplet::switchAction " << cfg.readNumEntry( "CloseHingeAction" ) << " performed." << oendl; |
101 | } | 104 | } |
102 | 105 | ||
103 | QDataStream stream( data, IO_ReadOnly ); | 106 | QDataStream stream( data, IO_ReadOnly ); |
104 | if ( msg == "flip()" ) | 107 | if ( msg == "flip()" ) |
105 | { | 108 | { |
106 | activated ( ); | 109 | activated ( ); |
107 | } | 110 | } |
108 | else if ( msg == "rotateDefault()") | 111 | else if ( msg == "rotateDefault()") |
109 | { | 112 | { |
110 | rotateDefault(); | 113 | rotateDefault(); |
111 | } | 114 | } |
112 | } | 115 | } |
113 | 116 | ||
114 | int RotateApplet::position() const | 117 | int RotateApplet::position() const |
115 | { | 118 | { |
116 | return 3; | 119 | return 3; |
117 | } | 120 | } |
118 | 121 | ||
119 | QString RotateApplet::name() const | 122 | QString RotateApplet::name() const |
120 | { | 123 | { |
121 | return tr( "Rotate shortcut" ); | 124 | return tr( "Rotate shortcut" ); |
122 | } | 125 | } |
123 | 126 | ||
124 | QString RotateApplet::text() const | 127 | QString RotateApplet::text() const |
125 | { | 128 | { |
126 | return tr( "Rotate" ); | 129 | return tr( "Rotate" ); |
127 | } | 130 | } |
128 | 131 | ||
129 | /*QString RotateApplet::tr( const char* s ) const | 132 | /*QString RotateApplet::tr( const char* s ) const |
130 | { | 133 | { |
131 | return qApp->translate( "RotateApplet", s, 0 ); | 134 | return qApp->translate( "RotateApplet", s, 0 ); |
132 | } | 135 | } |
133 | 136 | ||
134 | QString RotateApplet::tr( const char* s, const char* p ) const | 137 | QString RotateApplet::tr( const char* s, const char* p ) const |
135 | { | 138 | { |
136 | return qApp->translate( "RotateApplet", s, p ); | 139 | return qApp->translate( "RotateApplet", s, p ); |
137 | } | 140 | } |
138 | */ | 141 | */ |
139 | 142 | ||
140 | QIconSet RotateApplet::icon() const | 143 | QIconSet RotateApplet::icon() const |
141 | { | 144 | { |
142 | QPixmap pix; | 145 | QPixmap pix = Opie::Core::OResource::loadPixmap( "Rotation", Opie::Core::OResource::SmallIcon ); |
143 | QImage img = Resource::loadImage( "Rotation" ); | ||
144 | if ( !img.isNull() ) | ||
145 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
146 | return pix; | 146 | return pix; |
147 | } | 147 | } |
148 | 148 | ||
149 | QPopupMenu* RotateApplet::popup(QWidget*) const | 149 | QPopupMenu* RotateApplet::popup(QWidget*) const |
150 | { | 150 | { |
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | void RotateApplet::rotateDefault() | 154 | void RotateApplet::rotateDefault() |
155 | { | 155 | { |
156 | int rot = ODevice::inst()->rotation(); | 156 | int rot = ODevice::inst()->rotation(); |
157 | 157 | ||
158 | switch (rot) | 158 | switch (rot) |
159 | { | 159 | { |
160 | case Rot0: rot=0; break; | 160 | case Rot0: rot=0; break; |
161 | case Rot90: rot=90; break; | 161 | case Rot90: rot=90; break; |
162 | case Rot180: rot=180; break; | 162 | case Rot180: rot=180; break; |
163 | case Rot270: rot=270; break; | 163 | case Rot270: rot=270; break; |
164 | default: rot=0; break; | 164 | default: rot=0; break; |
165 | } | 165 | } |
166 | 166 | ||
167 | Config cfg( "qpe" ); | 167 | Config cfg( "qpe" ); |
168 | cfg.setGroup( "Appearance" ); | 168 | cfg.setGroup( "Appearance" ); |
169 | 169 | ||
170 | bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true ); | 170 | bool rotateEnabled = cfg.readBoolEntry( "rotateEnabled",true ); |
171 | 171 | ||
172 | if ( !rotateEnabled) return; | 172 | if ( !rotateEnabled) return; |
173 | 173 | ||
174 | // hide inputs methods before rotation | 174 | // hide inputs methods before rotation |
175 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | 175 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); |
176 | 176 | ||
177 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | 177 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); |
178 | env << rot; | 178 | env << rot; |
179 | 179 | ||
180 | m_flipped = false; | 180 | m_flipped = false; |
181 | 181 | ||
182 | } | 182 | } |
183 | void RotateApplet::activated() | 183 | void RotateApplet::activated() |
184 | { | 184 | { |
185 | int defaultRotation = QPEApplication::defaultRotation(); | 185 | int defaultRotation = QPEApplication::defaultRotation(); |
186 | int newRotation = defaultRotation; | 186 | int newRotation = defaultRotation; |
187 | 187 | ||
188 | Config cfg( "qpe" ); | 188 | Config cfg( "qpe" ); |
189 | cfg.setGroup( "Appearance" ); | 189 | cfg.setGroup( "Appearance" ); |
190 | 190 | ||
191 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 191 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
192 | ODirection rot = CW; | 192 | ODirection rot = CW; |
193 | 193 | ||
194 | if (rotDirection == -1) | 194 | if (rotDirection == -1) |
195 | { | 195 | { |
196 | rot = ODevice::inst()->direction(); | 196 | rot = ODevice::inst()->direction(); |
197 | } | 197 | } |
198 | else | 198 | else |
199 | { | 199 | { |
200 | rot = (ODirection) rotDirection; | 200 | rot = (ODirection) rotDirection; |
201 | } | 201 | } |
202 | 202 | ||
203 | // hide inputs methods before rotation | 203 | // hide inputs methods before rotation |
204 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); | 204 | QCopEnvelope en( "QPE/TaskBar", "hideInputMethod()" ); |
205 | 205 | ||
206 | if ( m_flipped ) | 206 | if ( m_flipped ) |
207 | { | 207 | { |
208 | // if flipped, flip back to the original state, | 208 | // if flipped, flip back to the original state, |
209 | // regardless of rotation direction | 209 | // regardless of rotation direction |
210 | newRotation = defaultRotation; | 210 | newRotation = defaultRotation; |
211 | } | 211 | } |
212 | else | 212 | else |
213 | { | 213 | { |
214 | if ( rot == CCW ) | 214 | if ( rot == CCW ) |
215 | { | 215 | { |
216 | newRotation = ( defaultRotation + 90 ) % 360; | 216 | newRotation = ( defaultRotation + 90 ) % 360; |
217 | } | 217 | } |
218 | else if ( rot == CW ) | 218 | else if ( rot == CW ) |
219 | { | 219 | { |
220 | newRotation = ( defaultRotation + 270 ) % 360; | 220 | newRotation = ( defaultRotation + 270 ) % 360; |
221 | } | 221 | } |
222 | else if ( rot == Flip ) | 222 | else if ( rot == Flip ) |
223 | { | 223 | { |
224 | newRotation = ( defaultRotation + 180 ) % 360; | 224 | newRotation = ( defaultRotation + 180 ) % 360; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | 227 | ||
228 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); | 228 | QCopEnvelope env( "QPE/System", "setCurrentRotation(int)" ); |
229 | env << newRotation; | 229 | env << newRotation; |
230 | 230 | ||
231 | m_flipped = !m_flipped; | 231 | m_flipped = !m_flipped; |
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 235 | QRESULT RotateApplet::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
236 | { | 236 | { |
237 | *iface = 0; | 237 | *iface = 0; |
238 | if ( uuid == IID_QUnknown ) | 238 | if ( uuid == IID_QUnknown ) |
239 | *iface = this; | 239 | *iface = this; |
240 | else if ( uuid == IID_MenuApplet ) | 240 | else if ( uuid == IID_MenuApplet ) |
241 | *iface = this; | 241 | *iface = this; |
diff --git a/core/applets/vtapplet/opie-vtapplet.control b/core/applets/vtapplet/opie-vtapplet.control index a1662f1..ae504a9 100644 --- a/core/applets/vtapplet/opie-vtapplet.control +++ b/core/applets/vtapplet/opie-vtapplet.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-vtapplet | 1 | Package: opie-vtapplet |
2 | Files: plugins/applets/libvtapplet.so* | 2 | Files: plugins/applets/libvtapplet.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | Description: Switch to another virtual terminal | 8 | Description: Switch to another virtual terminal |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp index ae89635..0d4e657 100644 --- a/core/applets/vtapplet/vt.cpp +++ b/core/applets/vtapplet/vt.cpp | |||
@@ -1,171 +1,169 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> | 2 | ** Copyright (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
3 | ** | 3 | ** |
4 | ** This file may be distributed and/or modified under the terms of the | 4 | ** This file may be distributed and/or modified under the terms of the |
5 | ** GNU General Public License version 2 as published by the Free Software | 5 | ** GNU General Public License version 2 as published by the Free Software |
6 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
7 | ** packaging of this file. | 7 | ** packaging of this file. |
8 | ** | 8 | ** |
9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
11 | ** | 11 | ** |
12 | **********************************************************************/ | 12 | **********************************************************************/ |
13 | 13 | ||
14 | #include "vt.h" | 14 | #include "vt.h" |
15 | 15 | ||
16 | /* OPIE */ | 16 | /* OPIE */ |
17 | #include <opie2/odebug.h> | 17 | #include <opie2/odebug.h> |
18 | #include <opie2/oresource.h> | ||
19 | |||
18 | #include <qpe/applnk.h> | 20 | #include <qpe/applnk.h> |
19 | #include <qpe/resource.h> | 21 | |
20 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
21 | 23 | ||
22 | /* QT */ | 24 | /* QT */ |
23 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
24 | 26 | ||
25 | /* STD */ | 27 | /* STD */ |
26 | #include <fcntl.h> | 28 | #include <fcntl.h> |
27 | #include <unistd.h> | 29 | #include <unistd.h> |
28 | #include <sys/types.h> | 30 | #include <sys/types.h> |
29 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
30 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
31 | #include <linux/vt.h> | 33 | #include <linux/vt.h> |
32 | 34 | ||
33 | VTApplet::VTApplet ( ) | 35 | VTApplet::VTApplet ( ) |
34 | : QObject ( 0, "VTApplet" ) | 36 | : QObject ( 0, "VTApplet" ) |
35 | { | 37 | { |
36 | } | 38 | } |
37 | 39 | ||
38 | VTApplet::~VTApplet ( ) | 40 | VTApplet::~VTApplet ( ) |
39 | { | 41 | { |
40 | } | 42 | } |
41 | 43 | ||
42 | int VTApplet::position ( ) const | 44 | int VTApplet::position ( ) const |
43 | { | 45 | { |
44 | return 2; | 46 | return 2; |
45 | } | 47 | } |
46 | 48 | ||
47 | QString VTApplet::name ( ) const | 49 | QString VTApplet::name ( ) const |
48 | { | 50 | { |
49 | return tr( "VT shortcut" ); | 51 | return tr( "VT shortcut" ); |
50 | } | 52 | } |
51 | 53 | ||
52 | QString VTApplet::text ( ) const | 54 | QString VTApplet::text ( ) const |
53 | { | 55 | { |
54 | return tr( "Terminal" ); | 56 | return tr( "Terminal" ); |
55 | } | 57 | } |
56 | 58 | ||
57 | /* | 59 | /* |
58 | QString VTApplet::tr( const char* s ) const | 60 | QString VTApplet::tr( const char* s ) const |
59 | { | 61 | { |
60 | return qApp->translate( "VTApplet", s, 0 ); | 62 | return qApp->translate( "VTApplet", s, 0 ); |
61 | } | 63 | } |
62 | 64 | ||
63 | QString VTApplet::tr( const char* s, const char* p ) const | 65 | QString VTApplet::tr( const char* s, const char* p ) const |
64 | { | 66 | { |
65 | return qApp->translate( "VTApplet", s, p ); | 67 | return qApp->translate( "VTApplet", s, p ); |
66 | } | 68 | } |
67 | */ | 69 | */ |
68 | 70 | ||
69 | QIconSet VTApplet::icon ( ) const | 71 | QIconSet VTApplet::icon ( ) const |
70 | { | 72 | { |
71 | QPixmap pix; | 73 | QPixmap pix = Opie::Core::OResource::loadPixmap( "terminal", Opie::Core::OResource::SmallIcon ); |
72 | QImage img = Resource::loadImage ( "terminal" ); | ||
73 | |||
74 | if ( !img. isNull ( )) | ||
75 | pix.convertFromImage( img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
76 | return pix; | 74 | return pix; |
77 | } | 75 | } |
78 | 76 | ||
79 | QPopupMenu *VTApplet::popup ( QWidget* parent ) const | 77 | QPopupMenu *VTApplet::popup ( QWidget* parent ) const |
80 | { | 78 | { |
81 | odebug << "VTApplet::popup" << oendl; | 79 | odebug << "VTApplet::popup" << oendl; |
82 | 80 | ||
83 | struct vt_stat vtstat; | 81 | struct vt_stat vtstat; |
84 | #ifdef QT_QWS_DEVFS | 82 | #ifdef QT_QWS_DEVFS |
85 | int fd = ::open( "/dev/vc/0", O_RDWR ); | 83 | int fd = ::open( "/dev/vc/0", O_RDWR ); |
86 | #else | 84 | #else |
87 | int fd = ::open( "/dev/tty0", O_RDWR ); | 85 | int fd = ::open( "/dev/tty0", O_RDWR ); |
88 | #endif | 86 | #endif |
89 | if ( fd == -1 ) return 0; | 87 | if ( fd == -1 ) return 0; |
90 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; | 88 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; |
91 | 89 | ||
92 | m_subMenu = new QPopupMenu( parent ); | 90 | m_subMenu = new QPopupMenu( parent ); |
93 | m_subMenu->setCheckable( true ); | 91 | m_subMenu->setCheckable( true ); |
94 | for ( int i = 1; i < 10; ++i ) | 92 | for ( int i = 1; i < 10; ++i ) |
95 | { | 93 | { |
96 | int id = m_subMenu->insertItem( QString::number( i ), 500+i ); | 94 | int id = m_subMenu->insertItem( QString::number( i ), 500+i ); |
97 | m_subMenu->setItemChecked( id, id-500 == vtstat.v_active ); | 95 | m_subMenu->setItemChecked( id, id-500 == vtstat.v_active ); |
98 | } | 96 | } |
99 | ::close( fd ); | 97 | ::close( fd ); |
100 | 98 | ||
101 | connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); | 99 | connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); |
102 | connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); | 100 | connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); |
103 | 101 | ||
104 | return m_subMenu; | 102 | return m_subMenu; |
105 | } | 103 | } |
106 | 104 | ||
107 | 105 | ||
108 | void VTApplet::changeVT( int index ) | 106 | void VTApplet::changeVT( int index ) |
109 | { | 107 | { |
110 | //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl; | 108 | //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl; |
111 | 109 | ||
112 | #ifdef QT_QWS_DEVFS | 110 | #ifdef QT_QWS_DEVFS |
113 | int fd = ::open("/dev/vc/0", O_RDWR); | 111 | int fd = ::open("/dev/vc/0", O_RDWR); |
114 | #else | 112 | #else |
115 | int fd = ::open("/dev/tty0", O_RDWR); | 113 | int fd = ::open("/dev/tty0", O_RDWR); |
116 | #endif | 114 | #endif |
117 | if ( fd == -1 ) return; | 115 | if ( fd == -1 ) return; |
118 | ioctl( fd, VT_ACTIVATE, index-500 ); | 116 | ioctl( fd, VT_ACTIVATE, index-500 ); |
119 | } | 117 | } |
120 | 118 | ||
121 | 119 | ||
122 | void VTApplet::updateMenu() | 120 | void VTApplet::updateMenu() |
123 | { | 121 | { |
124 | //odebug << "VTApplet::updateMenu()" << oendl; | 122 | //odebug << "VTApplet::updateMenu()" << oendl; |
125 | 123 | ||
126 | int fd = ::open( "/dev/console", O_RDONLY ); | 124 | int fd = ::open( "/dev/console", O_RDONLY ); |
127 | if ( fd == -1 ) return; | 125 | if ( fd == -1 ) return; |
128 | 126 | ||
129 | for ( int i = 1; i < 10; ++i ) | 127 | for ( int i = 1; i < 10; ++i ) |
130 | { | 128 | { |
131 | int result = ioctl( fd, VT_DISALLOCATE, i ); | 129 | int result = ioctl( fd, VT_DISALLOCATE, i ); |
132 | 130 | ||
133 | /* | 131 | /* |
134 | if ( result == -1 ) | 132 | if ( result == -1 ) |
135 | odebug << "VT " << i << " disallocated == free" << oendl; | 133 | odebug << "VT " << i << " disallocated == free" << oendl; |
136 | else | 134 | else |
137 | odebug << "VT " << i << " _not_ disallocated == busy" << oendl; | 135 | odebug << "VT " << i << " _not_ disallocated == busy" << oendl; |
138 | */ | 136 | */ |
139 | 137 | ||
140 | m_subMenu->setItemEnabled( 500+i, result == -1 ); | 138 | m_subMenu->setItemEnabled( 500+i, result == -1 ); |
141 | } | 139 | } |
142 | 140 | ||
143 | ::close( fd ); | 141 | ::close( fd ); |
144 | } | 142 | } |
145 | 143 | ||
146 | 144 | ||
147 | void VTApplet::activated() | 145 | void VTApplet::activated() |
148 | { | 146 | { |
149 | odebug << "VTApplet::activated()" << oendl; | 147 | odebug << "VTApplet::activated()" << oendl; |
150 | } | 148 | } |
151 | 149 | ||
152 | 150 | ||
153 | QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 151 | QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
154 | { | 152 | { |
155 | *iface = 0; | 153 | *iface = 0; |
156 | if ( uuid == IID_QUnknown ) | 154 | if ( uuid == IID_QUnknown ) |
157 | *iface = this; | 155 | *iface = this; |
158 | else if ( uuid == IID_MenuApplet ) | 156 | else if ( uuid == IID_MenuApplet ) |
159 | *iface = this; | 157 | *iface = this; |
160 | else | 158 | else |
161 | return QS_FALSE; | 159 | return QS_FALSE; |
162 | 160 | ||
163 | if ( *iface ) | 161 | if ( *iface ) |
164 | (*iface)-> addRef ( ); | 162 | (*iface)-> addRef ( ); |
165 | return QS_OK; | 163 | return QS_OK; |
166 | } | 164 | } |
167 | 165 | ||
168 | Q_EXPORT_INTERFACE( ) | 166 | Q_EXPORT_INTERFACE( ) |
169 | { | 167 | { |
170 | Q_CREATE_INSTANCE( VTApplet ) | 168 | Q_CREATE_INSTANCE( VTApplet ) |
171 | } | 169 | } |
diff --git a/core/applets/vtapplet/vtapplet.pro b/core/applets/vtapplet/vtapplet.pro index 6c4873c..912af58 100644 --- a/core/applets/vtapplet/vtapplet.pro +++ b/core/applets/vtapplet/vtapplet.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | HEADERS = vt.h | 3 | HEADERS = vt.h |
4 | SOURCES = vt.cpp | 4 | SOURCES = vt.cpp |
5 | TARGET = vtapplet | 5 | TARGET = vtapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | 11 | ||
12 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |