summaryrefslogtreecommitdiff
path: root/library/qpeapplication.h
Unidiff
Diffstat (limited to 'library/qpeapplication.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 69e0058..729cf2b 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -1,209 +1,206 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef __QPE_APPLICATION_H__ 20#ifndef __QPE_APPLICATION_H__
21#define __QPE_APPLICATION_H__ 21#define __QPE_APPLICATION_H__
22 22
23#include <stdlib.h> // for setenv() 23#include <stdlib.h> // for setenv()
24 24
25#include <qglobal.h> 25#include <qglobal.h>
26#include <qapplication.h> 26#include <qapplication.h>
27#include <qdialog.h> 27#include <qdialog.h>
28#include <qwsdisplay_qws.h> 28#include <qwsdisplay_qws.h>
29#if defined(_WS_QWS_) && !defined(Q_WS_QWS) 29#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
30#define Q_WS_QWS 30#define Q_WS_QWS
31#endif 31#endif
32#include "qpedecoration_qws.h" 32#include "qpedecoration_qws.h"
33#include "timestring.h" 33#include "timestring.h"
34 34
35class QCopChannel; 35class QCopChannel;
36class QPEApplicationData; 36class QPEApplicationData;
37class QWSEvent; 37class QWSEvent;
38class QWSKeyEvent; 38class QWSKeyEvent;
39 39
40 40
41class QPEApplication : public QApplication 41class QPEApplication : public QApplication
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 QPEApplication( int& argc, char **argv, Type=GuiClient ); 45 QPEApplication( int& argc, char **argv, Type=GuiClient );
46 ~QPEApplication(); 46 ~QPEApplication();
47 47
48 static QString qpeDir(); 48 static QString qpeDir();
49 static QString documentDir(); 49 static QString documentDir();
50 void applyStyle(); 50 void applyStyle();
51 void reset(); 51 void reset();
52 static int defaultRotation(); 52 static int defaultRotation();
53 static void setDefaultRotation(int r); 53 static void setDefaultRotation(int r);
54 static void setCurrentRotation(int r); 54 static void setCurrentRotation(int r);
55 static void setCurrentMode(int x, int y, int depth ); 55 static void setCurrentMode(int x, int y, int depth );
56 static void grabKeyboard(); 56 static void grabKeyboard();
57 static void ungrabKeyboard(); 57 static void ungrabKeyboard();
58 58
59 enum StylusMode { 59 enum StylusMode {
60 LeftOnly, 60 LeftOnly,
61 RightOnHold 61 RightOnHold
62 // RightOnHoldLeftDelayed, etc. 62 // RightOnHoldLeftDelayed, etc.
63 }; 63 };
64 static void setStylusOperation( QWidget*, StylusMode ); 64 static void setStylusOperation( QWidget*, StylusMode );
65 static StylusMode stylusOperation( QWidget* ); 65 static StylusMode stylusOperation( QWidget* );
66 66
67 enum InputMethodHint { 67 enum InputMethodHint {
68 Normal, 68 Normal,
69 AlwaysOff, 69 AlwaysOff,
70 AlwaysOn 70 AlwaysOn
71 }; 71 };
72 72
73 enum screenSaverHint { 73 enum screenSaverHint {
74 Disable = 0, 74 Disable = 0,
75 DisableLightOff = 1, 75 DisableLightOff = 1,
76 DisableSuspend = 2, 76 DisableSuspend = 2,
77 Enable = 100 77 Enable = 100
78 }; 78 };
79 79
80 static void setInputMethodHint( QWidget *, InputMethodHint ); 80 static void setInputMethodHint( QWidget *, InputMethodHint );
81 static InputMethodHint inputMethodHint( QWidget * ); 81 static InputMethodHint inputMethodHint( QWidget * );
82 82
83 void showMainWidget( QWidget*, bool nomax=FALSE ); 83 void showMainWidget( QWidget*, bool nomax=FALSE );
84 void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); 84 void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
85 static void showDialog( QDialog*, bool nomax=FALSE ); 85 static void showDialog( QDialog*, bool nomax=FALSE );
86 static int execDialog( QDialog*, bool nomax=FALSE ); 86 static int execDialog( QDialog*, bool nomax=FALSE );
87 /* Merge setTempScreenSaverMode */ 87 /* Merge setTempScreenSaverMode */
88#ifdef QTOPIA_INTERNAL_INITAPP 88#ifdef QTOPIA_INTERNAL_INITAPP
89 void initApp( int argv, char **argv ); 89 void initApp( int argv, char **argv );
90#endif 90#endif
91 91
92 static void setKeepRunning(); 92 static void setKeepRunning();
93 bool keepRunning() const; 93 bool keepRunning() const;
94 94
95 bool keyboardGrabbed() const; 95 bool keyboardGrabbed() const;
96 96
97 int exec(); 97 int exec();
98 98
99signals: 99signals:
100 void clientMoused(); 100 void clientMoused();
101 void timeChanged(); 101 void timeChanged();
102 void clockChanged( bool pm ); 102 void clockChanged( bool pm );
103 void micChanged( bool muted ); 103 void micChanged( bool muted );
104 void volumeChanged( bool muted ); 104 void volumeChanged( bool muted );
105 void appMessage( const QCString& msg, const QByteArray& data); 105 void appMessage( const QCString& msg, const QByteArray& data);
106 void weekChanged( bool startOnMonday ); 106 void weekChanged( bool startOnMonday );
107 void dateFormatChanged( DateFormat ); 107 void dateFormatChanged( DateFormat );
108 void flush(); 108 void flush();
109 void reload(); 109 void reload();
110 /* linkChanged signal */ 110 /* linkChanged signal */
111 111
112private slots: 112private slots:
113 void systemMessage( const QCString &msg, const QByteArray &data ); 113 void systemMessage( const QCString &msg, const QByteArray &data );
114 void pidMessage( const QCString &msg, const QByteArray &data ); 114 void pidMessage( const QCString &msg, const QByteArray &data );
115 void removeSenderFromStylusDict(); 115 void removeSenderFromStylusDict();
116 void hideOrQuit(); 116 void hideOrQuit();
117 117
118private:
119 QWidget *nextWidget( QWidgetList*, QWidget* );
120
121protected: 118protected:
122 bool qwsEventFilter( QWSEvent * ); 119 bool qwsEventFilter( QWSEvent * );
123 void internalSetStyle( const QString &style ); 120 void internalSetStyle( const QString &style );
124 void prepareForTermination(bool willrestart); 121 void prepareForTermination(bool willrestart);
125 virtual void restart(); 122 virtual void restart();
126 virtual void shutdown(); 123 virtual void shutdown();
127 bool eventFilter( QObject *, QEvent * ); 124 bool eventFilter( QObject *, QEvent * );
128 void timerEvent( QTimerEvent * ); 125 void timerEvent( QTimerEvent * );
129 bool raiseAppropriateWindow(); 126 bool raiseAppropriateWindow();
130 virtual void tryQuit(); 127 virtual void tryQuit();
131#if QT_VERSION > 233 128#if QT_VERSION > 233
132 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) 129 virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
133#endif 130#endif
134private: 131private:
135#ifndef QT_NO_TRANSLATION 132#ifndef QT_NO_TRANSLATION
136 void installTranslation( const QString& baseName ); 133 void installTranslation( const QString& baseName );
137#endif 134#endif
138 void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); 135 void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
139 void processQCopFile(); 136 void processQCopFile();
140 137
141#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 138#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
142 QCopChannel *sysChannel; 139 QCopChannel *sysChannel;
143 QCopChannel *pidChannel; 140 QCopChannel *pidChannel;
144#endif 141#endif
145 QPEApplicationData *d; 142 QPEApplicationData *d;
146 143
147 bool reserved_sh; 144 bool reserved_sh;
148 145
149 146
150 147
151}; 148};
152 149
153inline void QPEApplication::showDialog( QDialog* d, bool nomax ) 150inline void QPEApplication::showDialog( QDialog* d, bool nomax )
154{ 151{
155 QSize sh = d->sizeHint(); 152 QSize sh = d->sizeHint();
156 int w = QMAX(sh.width(),d->width()); 153 int w = QMAX(sh.width(),d->width());
157 int h = QMAX(sh.height(),d->height()); 154 int h = QMAX(sh.height(),d->height());
158 if ( !nomax 155 if ( !nomax
159 && ( w > qApp->desktop()->width()*3/4 156 && ( w > qApp->desktop()->width()*3/4
160 || h > qApp->desktop()->height()*3/4 ) ) 157 || h > qApp->desktop()->height()*3/4 ) )
161 { 158 {
162 d->showMaximized(); 159 d->showMaximized();
163 } else { 160 } else {
164 d->resize(w,h); 161 d->resize(w,h);
165 d->show(); 162 d->show();
166 } 163 }
167} 164}
168 165
169inline int QPEApplication::execDialog( QDialog* d, bool nomax ) 166inline int QPEApplication::execDialog( QDialog* d, bool nomax )
170{ 167{
171 showDialog(d,nomax); 168 showDialog(d,nomax);
172 return d->exec(); 169 return d->exec();
173} 170}
174 171
175enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ 172enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
176 173
177inline int TransToDeg ( Transformation t ) 174inline int TransToDeg ( Transformation t )
178{ 175{
179 int d = static_cast<int>( t ); 176 int d = static_cast<int>( t );
180 return d * 90; 177 return d * 90;
181} 178}
182 179
183inline Transformation DegToTrans ( int d ) 180inline Transformation DegToTrans ( int d )
184{ 181{
185 Transformation t = static_cast<Transformation>( d / 90 ); 182 Transformation t = static_cast<Transformation>( d / 90 );
186 return t; 183 return t;
187} 184}
188 185
189/* 186/*
190 * Set current rotation of Opie, and rotation for newly started apps. 187 * Set current rotation of Opie, and rotation for newly started apps.
191 * Differs from setDefaultRotation in that 1) it rotates currently running apps, 188 * Differs from setDefaultRotation in that 1) it rotates currently running apps,
192 * and 2) does not set deforient or save orientation to qpe.conf. 189 * and 2) does not set deforient or save orientation to qpe.conf.
193 */ 190 */
194 191
195inline void QPEApplication::setCurrentRotation( int r ) 192inline void QPEApplication::setCurrentRotation( int r )
196{ 193{
197 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots 194 // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
198 // for compatibility with the SharpROM use fallback to setDefaultTransformation() 195 // for compatibility with the SharpROM use fallback to setDefaultTransformation()
199#if QT_VERSION > 233 196#if QT_VERSION > 233
200 Transformation e = DegToTrans( r ); 197 Transformation e = DegToTrans( r );
201 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 198 ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
202 qApp->desktop()->qwsDisplay()->setTransformation( e ); 199 qApp->desktop()->qwsDisplay()->setTransformation( e );
203#else 200#else
204 setDefaultRotation( r ); 201 setDefaultRotation( r );
205#endif 202#endif
206} 203}
207 204
208 205
209#endif 206#endif