summaryrefslogtreecommitdiff
path: root/core/launcher
authormickeyl <mickeyl>2005-01-23 20:30:10 (UTC)
committer mickeyl <mickeyl>2005-01-23 20:30:10 (UTC)
commitab0242ff1bbc40ec8bc38c3cb748a44797ffe3db (patch) (unidiff)
treef9d2e15eb124bf3d39a90c25811c9609d9fd1db0 /core/launcher
parent8f2fbef1de1b3803a21d51752fee1014c951cc12 (diff)
downloadopie-ab0242ff1bbc40ec8bc38c3cb748a44797ffe3db.zip
opie-ab0242ff1bbc40ec8bc38c3cb748a44797ffe3db.tar.gz
opie-ab0242ff1bbc40ec8bc38c3cb748a44797ffe3db.tar.bz2
New QWS_DISPLAY handling for gathering the default launcher rotation on startup:
1.) If QWS_DISPLAY is not set, then use ODevice::rotation() 2.) If QWS_DISPLAY is set, then just use whatever it is set to
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/main.cpp106
1 files changed, 47 insertions, 59 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index aa0dfdf..734d072 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -2,4 +2,3 @@
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3** Copyright (C) 2003-2005 The Opie Team <opie-devel@handhelds.org>
4** This file is part of the Qtopia Environment.
5** 4**
@@ -12,8 +11,2 @@
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/ 12**********************************************************************/
@@ -55,7 +48,8 @@ using namespace Opie::Core;
55#include <signal.h> 48#include <signal.h>
56#ifndef Q_OS_WIN32
57#include <unistd.h> 49#include <unistd.h>
58#else 50#include <errno.h>
59#include <process.h> 51#include <string.h>
60#endif 52
53void create_pidfile();
54void remove_pidfile();
61 55
@@ -72,13 +66,4 @@ static void cleanup()
72 66
73static void refreshTimeZoneConfig()
74{
75 /* ### FIXME timezone handling for qtopia */
76}
77
78void initEnvironment() 67void initEnvironment()
79{ 68{
80#ifdef Q_OS_WIN32
81 // Config file requires HOME dir which uses QDir which needs the winver
82 qt_init_winver();
83#endif
84 Config config("locale"); 69 Config config("locale");
@@ -87,6 +72,4 @@ void initEnvironment()
87 72
88 // if not timezone set, pick New York 73 // timezone
89 if (tz.isNull() || tz.isEmpty()) 74 if (tz.isNull() || tz.isEmpty()) tz = "America/New_York";
90 tz = "America/New_York";
91
92 setenv( "TZ", tz, 1 ); 75 setenv( "TZ", tz, 1 );
@@ -94,7 +77,6 @@ void initEnvironment()
94 77
78 // language
95 config.setGroup( "Language" ); 79 config.setGroup( "Language" );
96 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); 80 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace();
97 if( lang.isNull() || lang.isEmpty()) 81 if( lang.isNull() || lang.isEmpty()) lang = "en_US";
98 lang = "en_US";
99
100 setenv( "LANG", lang, 1 ); 82 setenv( "LANG", lang, 1 );
@@ -103,16 +85,19 @@ void initEnvironment()
103 85
86 // rotation
87 int t = ODevice::inst()->rotation();
88 odebug << "ODevice reports transformation to be " << t << oendl;
104 89
105 QString env(getenv("QWS_DISPLAY")); 90 QString env(getenv("QWS_DISPLAY"));
106 if (env.contains("Transformed")) { 91 if ( env.isEmpty() )
107 int rot; 92 {
108 // transformed driver default rotation is controlled by the hardware. 93 int rot = ODevice::inst()->rotation() * 90;
109 Config config("qpe"); 94 QString qws_display = QString("Transformed:Rot%1:0").arg(rot);
110 config.setGroup( "Rotation" ); 95 odebug << "setting QWS_DISPLAY to '" << qws_display << "'" << oendl;
111 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) 96 setenv("QWS_DISPLAY", (const char*) qws_display, 1);
112 rot = ODevice::inst ( )-> rotation ( ) * 90; 97 }
98 else
99 odebug << "QWS_DISPLAY already set as '" << env << "' - overriding ODevice transformation" << oendl;
113 100
114 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
115 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ 101 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */
116 } 102 }
117}
118 103
@@ -161,7 +146,4 @@ int initApplication( int argc, char ** argv )
161 cleanup(); 146 cleanup();
162
163
164 initEnvironment(); 147 initEnvironment();
165 148
166 //Don't flicker at startup:
167#ifdef QWS 149#ifdef QWS
@@ -170,9 +152,6 @@ int initApplication( int argc, char ** argv )
170 ServerApplication a( argc, argv, QApplication::GuiServer ); 152 ServerApplication a( argc, argv, QApplication::GuiServer );
171
172 refreshTimeZoneConfig();
173
174 initKeyboard(); 153 initKeyboard();
175 154
176 // Don't use first use under Windows 155 if ( firstUse() )
177 if ( firstUse() ) { 156 {
178 a.restart(); 157 a.restart();
@@ -181,4 +160,5 @@ int initApplication( int argc, char ** argv )
181 160
161#ifndef Q_OS_MACX
182 ODevice::inst ( )-> setSoftSuspend ( true ); 162 ODevice::inst ( )-> setSoftSuspend ( true );
183 163#endif
184 { 164 {
@@ -189,8 +169,4 @@ int initApplication( int argc, char ** argv )
189 AlarmServer::initialize(); 169 AlarmServer::initialize();
190
191
192
193 Server *s = new Server(); 170 Server *s = new Server();
194 171 new SysFileMonitor(s);
195 (void)new SysFileMonitor(s);
196#ifdef QWS 172#ifdef QWS
@@ -198,8 +174,11 @@ int initApplication( int argc, char ** argv )
198#endif 174#endif
199
200 s->show(); 175 s->show();
201 176
202 /* THE ARM rtc has problem holdings the time on reset */ 177#if 0
203 if ( QDate::currentDate ( ). year ( ) < 2000 ) { 178 if ( QDate::currentDate().year() < 2005 )
204 if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { 179 {
180 if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ),
181 ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" )
182 .arg( TimeString::dateString( QDate::currentDate())), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
183 {
205 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); 184 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" );
@@ -208,6 +187,10 @@ int initApplication( int argc, char ** argv )
208 } 187 }
188#endif
209 189
190 create_pidfile();
191 odebug << "--> mainloop in" << oendl;
210 int rv = a.exec(); 192 int rv = a.exec();
211 193 odebug << "<-- mainloop out" << oendl;
212 odebug << "exiting..." << oendl; 194 remove_pidfile();
195 odebug << "removing server object..." << oendl;
213 delete s; 196 delete s;
@@ -218,2 +201,3 @@ int initApplication( int argc, char ** argv )
218 201
202 odebug << "returning from qpe/initapplication..." << oendl;
219 return rv; 203 return rv;
@@ -231,2 +215,6 @@ void create_pidfile ( )
231 } 215 }
216 else
217 {
218 odebug << "couldn't create pidfile: " << strerror( errno ) << oendl;
219 }
232} 220}
@@ -238,4 +226,5 @@ void remove_pidfile ( )
238 226
239void handle_sigterm ( int /* sig */ ) 227void handle_sigterm( int sig )
240{ 228{
229 qDebug( "D'oh! QPE Server process got SIGNAL %d. Trying to exit gracefully...", sig );
241 ::signal( SIGCHLD, SIG_IGN ); 230 ::signal( SIGCHLD, SIG_IGN );
@@ -261,3 +250,2 @@ int main( int argc, char ** argv )
261 ::atexit( remove_pidfile ); 250 ::atexit( remove_pidfile );
262 create_pidfile();
263 251