summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-04-19 22:07:06 (UTC)
committer kergoth <kergoth>2003-04-19 22:07:06 (UTC)
commit29c556ffc9b1497cd996ceb46d646b1eaf1288be (patch) (side-by-side diff)
treeb89c424de93f541bc80908c93172eb4e601e8c02
parentc502394063598e63591e06072802f1c5a9e0c266 (diff)
downloadopie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.zip
opie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.tar.gz
opie-29c556ffc9b1497cd996ceb46d646b1eaf1288be.tar.bz2
Split calibrate out as a standalone application, and ensure taskbar depends
on it. This makes ts debugging easier, having a seperate calibration tool around, and as a side affect fixes calibration on the C700, which previously required a reboot to take effect.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/calibrate/main.cpp20
-rw-r--r--core/apps/calibrate/opie-calibrate.control8
-rw-r--r--core/launcher/desktop.cpp2
-rw-r--r--core/launcher/launcher.pro4
-rw-r--r--core/launcher/main.cpp15
-rw-r--r--core/launcher/opie-taskbar.control4
-rw-r--r--core/launcher/taskbar.cpp17
-rw-r--r--core/launcher/taskbar.h2
8 files changed, 32 insertions, 40 deletions
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp
index d1ad083..1c295eb 100644
--- a/core/apps/calibrate/main.cpp
+++ b/core/apps/calibrate/main.cpp
@@ -2,41 +2,45 @@
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "calibrate.h"
#include <qfile.h>
#include <qpe/qpeapplication.h>
+#ifdef QWS
+#include <qwindowsystem_qws.h>
+#endif
+
int main( int argc, char ** argv )
{
QPEApplication a( argc, argv );
int retval = 0;
-#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
- if ( !QFile::exists( "/etc/pointercal" ) ) {
+#ifdef QWS
+ if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
+#endif
// Make sure calibration widget starts on top.
- Calibrate *cal = new Calibrate;
- a.setMainWidget(cal);
- a.showMainWidget(cal);
- retval = a.exec();
- delete cal;
+ Calibrate cal;
+ a.setMainWidget(&cal);
+ a.showMainWidget(&cal);
+ return a.exec();
+#ifdef QWS
}
#endif
- return retval;
}
diff --git a/core/apps/calibrate/opie-calibrate.control b/core/apps/calibrate/opie-calibrate.control
new file mode 100644
index 0000000..6eafb94
--- a/dev/null
+++ b/core/apps/calibrate/opie-calibrate.control
@@ -0,0 +1,8 @@
+Files: bin/calibrate apps/Settings/Calibrate.desktop
+Priority: required
+Section: opie/system
+Maintainer: Project Opie <opie@handhelds.org>
+Architecture: arm
+Version: $QPE_VERSION-$SUB_VERSION.3
+Depends: libqpe1, libqt2-emb
+Description: Opie calibration tool
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 6def126..ef0bf4c 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -77,49 +77,48 @@ public:
return keyCode;
}
QCString getChannel() const
{
return channel;
}
QCString getMessage() const
{
return message;
}
private:
int keyCode;
QCString channel, message;
};
typedef QValueList<QCopKeyRegister> KeyRegisterList;
KeyRegisterList keyRegisterList;
static Desktop* qpedesktop = 0;
static int loggedin = 0;
static void login( bool at_poweron )
{
if ( !loggedin ) {
- Global::terminateBuiltin( "calibrate" );
Password::authenticate( at_poweron );
loggedin = 1;
QCopEnvelope e( "QPE/Desktop", "unlocked()" );
}
}
bool Desktop::screenLocked()
{
return loggedin == 0;
}
/*
Priority is number of alerts that are needed to pop up
alert.
*/
class DesktopPowerAlerter : public QMessageBox
{
public:
DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
: QMessageBox( tr( "Battery Status" ), "Low Battery",
QMessageBox::Critical,
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::NoButton, QMessageBox::NoButton,
parent, name, FALSE )
@@ -601,49 +600,48 @@ static bool isVisibleWindow( int wid )
}
#endif
return FALSE;
}
static bool hasVisibleWindow( const QString& clientname )
{
#ifdef QWS
const QList<QWSWindow> &list = qwsServer->clientWindows();
QWSWindow* w;
for ( QListIterator<QWSWindow> it( list ); ( w = it.current() ); ++it ) {
if ( w->client() ->identity() == clientname && !w->isFullyObscured() )
return TRUE;
}
#endif
return FALSE;
}
void Desktop::executeOrModify( const QString& appLnkFile )
{
AppLnk lnk( MimeType::appsFolderName() + "/" + appLnkFile );
if ( lnk.isValid() ) {
QCString app = lnk.exec().utf8();
- Global::terminateBuiltin( "calibrate" );
if ( QCopChannel::isRegistered( "QPE/Application/" + app ) ) {
// MRUList::addTask( &lnk );
if ( hasVisibleWindow( app ) )
QCopChannel::send( "QPE/Application/" + app, "nextView()" );
else
QCopChannel::send( "QPE/Application/" + app, "raise()" );
}
else {
lnk.execute();
}
}
}
// autoStarts apps on resume and start
void Desktop::execAutoStart()
{
QString appName;
int delay;
QDateTime now = QDateTime::currentDateTime();
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
appName = cfg.readEntry( "Apps", "" );
delay = ( cfg.readEntry( "Delay", "0" ) ).toInt();
// If the time between suspend and resume was longer then the
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
index d0a573b..007e48c 100644
--- a/core/launcher/launcher.pro
+++ b/core/launcher/launcher.pro
@@ -1,122 +1,118 @@
TEMPLATE = app
CONFIG = qt warn_on release
DESTDIR = ../../bin
HEADERS = background.h \
desktop.h \
screensaver.h \
mediummountgui.h \
info.h \
appicons.h \
taskbar.h \
sidething.h \
runningappbar.h \
stabmon.h \
inputmethods.h \
systray.h \
wait.h \
shutdownimpl.h \
launcher.h \
launcherview.h \
- ../../core/apps/calibrate/calibrate.h \
startmenu.h \
transferserver.h \
qcopbridge.h \
packageslave.h \
irserver.h \
../../rsync/buf.h \
../../rsync/checksum.h \
../../rsync/command.h \
../../rsync/emit.h \
../../rsync/job.h \
../../rsync/netint.h \
../../rsync/protocol.h \
../../rsync/prototab.h \
../../rsync/rsync.h \
../../rsync/search.h \
../../rsync/stream.h \
../../rsync/sumset.h \
../../rsync/trace.h \
../../rsync/types.h \
../../rsync/util.h \
../../rsync/whole.h \
../../rsync/config_rsync.h \
../../rsync/qrsync.h \
quicklauncher.h
SOURCES = background.cpp \
desktop.cpp \
screensaver.cpp \
mediummountgui.cpp \
info.cpp \
appicons.cpp \
taskbar.cpp \
sidething.cpp \
runningappbar.cpp \
stabmon.cpp \
inputmethods.cpp \
systray.cpp \
wait.cpp \
shutdownimpl.cpp \
launcher.cpp \
launcherview.cpp \
- ../../core/apps/calibrate/calibrate.cpp \
transferserver.cpp \
packageslave.cpp \
irserver.cpp \
qcopbridge.cpp \
startmenu.cpp \
main.cpp \
../../rsync/base64.c \
../../rsync/buf.c \
../../rsync/checksum.c \
../../rsync/command.c \
../../rsync/delta.c \
../../rsync/emit.c \
../../rsync/hex.c \
../../rsync/job.c \
../../rsync/mdfour.c \
../../rsync/mksum.c \
../../rsync/msg.c \
../../rsync/netint.c \
../../rsync/patch.c \
../../rsync/prototab.c \
../../rsync/readsums.c \
../../rsync/scoop.c \
../../rsync/search.c \
../../rsync/stats.c \
../../rsync/stream.c \
../../rsync/sumset.c \
../../rsync/trace.c \
../../rsync/tube.c \
../../rsync/util.c \
../../rsync/version.c \
../../rsync/whole.c \
../../rsync/qrsync.cpp
INTERFACES = syncdialog.ui
INCLUDEPATH += ../../include
DEPENDPATH += ../../include .
-INCLUDEPATH += ../../core/apps/calibrate
-DEPENDPATH += ../../core/apps/calibrate
INCLUDEPATH += ../../rsync
DEPENDPATH += ../../rsync
TARGET = qpe
LIBS += -lqpe -lcrypt -lopie
TRANSLATIONS = ../../i18n/de/qpe.ts \
../../i18n/xx/qpe.ts \
../../i18n/en/qpe.ts \
../../i18n/es/qpe.ts \
../../i18n/fr/qpe.ts \
../../i18n/hu/qpe.ts \
../../i18n/ja/qpe.ts \
../../i18n/ko/qpe.ts \
../../i18n/no/qpe.ts \
../../i18n/pl/qpe.ts \
../../i18n/pt/qpe.ts \
../../i18n/pt_BR/qpe.ts \
../../i18n/sl/qpe.ts \
../../i18n/zh_CN/qpe.ts \
../../i18n/it/qpe.ts \
../../i18n/zh_TW/qpe.ts \
../../i18n/da/qpe.ts
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 20a1ecd..e96eeae 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -9,64 +9,63 @@
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "desktop.h"
#include "taskbar.h"
#include "stabmon.h"
#include <qpe/qpeapplication.h>
#include <qpe/network.h>
#include <qpe/config.h>
#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ )
#include <qpe/custom.h>
#endif
#include <opie/odevice.h>
+#include <opie/oprocess.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qimage.h>
#include <qwindowsystem_qws.h>
#include <qwsmouse_qws.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/alarmserver.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
-#include "../calibrate/calibrate.h"
-
using namespace Opie;
void initEnvironment()
{
int rot;
Config config("locale");
config.setGroup( "Location" );
QString tz = config.readEntry( "Timezone", getenv("TZ") );
// if not timezone set, pick New York
if (tz.isNull())
tz = "America/New_York";
setenv( "TZ", tz, 1 );
config.writeEntry( "Timezone", tz);
config.setGroup( "Language" );
QString lang = config.readEntry( "Language", getenv("LANG") );
if ( !lang.isNull() )
setenv( "LANG", lang, 1 );
#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX)
setenv( "QWS_SIZE", "240x320", 0 );
@@ -97,52 +96,56 @@ int initApplication( int argc, char ** argv )
ODevice::inst ( )-> setSoftSuspend ( true );
{ // init backlight
QCopEnvelope e("QPE/System", "setBacklight(int)" );
e << -3; // Forced on
}
AlarmServer::initialize();
Desktop *d = new Desktop();
QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
(void)new SysFileMonitor(d);
Network::createServer(d);
if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
if ( !QFile::exists( "/etc/pointercal" ) ) {
- // Make sure calibration widget starts on top.
- Calibrate *cal = new Calibrate;
- cal->exec();
- delete cal;
+ OProcess cal;
+ cal << "calibrate";
+
+ if ( ! cal.start(OProcess::Block, OProcess::NoCommunication) ) {
+ QMessageBox::warning( 0, "Unable to calibrate",
+ "Failed to start the calibration tool.\n"
+ );
+ }
}
}
d->show();
if ( QDate::currentDate ( ). year ( ) < 2000 ) {
if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::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 ) {
QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" );
e << QString ( );
}
}
int rv = a.exec();
delete d;
ODevice::inst ( )-> setSoftSuspend ( false );
return rv;
}
static const char *pidfile_path = "/var/run/opie.pid";
void create_pidfile ( )
diff --git a/core/launcher/opie-taskbar.control b/core/launcher/opie-taskbar.control
index c0430b7..db66a05 100644
--- a/core/launcher/opie-taskbar.control
+++ b/core/launcher/opie-taskbar.control
@@ -1,9 +1,9 @@
-Files: 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
+Files: bin/qpe 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
Priority: required
Section: opie/system
Maintainer: Project Opie <opie@handhelds.org>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION.3
-Depends: opie-base
+Depends: opie-base, opie-calibrate
Replaces: opie-rotation
Description: Launcher for Opie
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 8af568d..8158128 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,49 +1,48 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
*********************************************************************/
#include "startmenu.h"
#include "inputmethods.h"
#include "runningappbar.h"
#include "systray.h"
-#include "calibrate.h"
#include "wait.h"
#include "appicons.h"
#include "taskbar.h"
#include "desktop.h"
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/global.h>
#if defined( QT_QWS_SL5XXX ) || defined( QT_QWS_IPAQ )
#include <qpe/custom.h>
#endif
#include <opie/odevice.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qtimer.h>
#include <qwindowsystem_qws.h>
#include <qwidgetstack.h>
#if defined( Q_WS_QWS )
#include <qwsdisplay_qws.h>
@@ -61,57 +60,54 @@ using namespace Opie;
w->showMaximized(); \
} else { \
w->resize( QSize( 300, 300 ) ); \
} \
} \
w->show(); \
return w; \
}
#ifdef SINGLE_APP
#define APP(a,b,c,d) FACTORY(b)
#include "../launcher/apps.h"
#undef APP
#endif // SINGLE_APP
static Global::Command builtins[] = {
#ifdef SINGLE_APP
#define APP(a,b,c,d) { a, new##b, c },
#include "../launcher/apps.h"
#undef APP
#endif
-#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX)
- { "calibrate", TaskBar::calibrate, 1, 0 },
-#endif
#if !defined(QT_QWS_CASSIOPEIA)
{ "shutdown", Global::shutdown, 1, 0 },
// { "run", run, 1, 0 },
#endif
- { 0, TaskBar::calibrate, 0, 0 },
+ { 0, 0, 0, 0 },
};
static bool initNumLock()
{
#ifdef QPE_INITIAL_NUMLOCK_STATE
QPE_INITIAL_NUMLOCK_STATE
#endif
return FALSE;
}
class LockKeyState : public QWidget
{
public:
LockKeyState( QWidget *parent ) :
QWidget(parent),
nl(initNumLock()), cl(FALSE)
{
nl_pm = Resource::loadPixmap("numlock");
cl_pm = Resource::loadPixmap("capslock");
}
QSize sizeHint() const
{
return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
}
@@ -285,59 +281,48 @@ void TaskBar::receive( const QCString &msg, const QByteArray &data )
else if ( msg == "setLed(int,bool)" ) {
int led, status;
stream >> led >> status;
QValueList <OLed> ll = ODevice::inst ( )-> ledList ( );
if ( ll. count ( )) {
OLed l = ll. contains ( Led_Mail ) ? Led_Mail : ll [0];
bool canblink = ODevice::inst ( )-> ledStateList ( l ). contains ( Led_BlinkSlow );
ODevice::inst ( )-> setLedState ( l, status ? ( canblink ? Led_BlinkSlow : Led_On ) : Led_Off );
}
}
else if ( msg == "toggleMenu()" ) {
if ( sm-> launchMenu-> isVisible ( ))
sm-> launch ( );
else {
QCopEnvelope e ( "QPE/System", "toggleApplicationMenu()" );
}
}
else if ( msg == "toggleStartMenu()" ) {
sm-> launch ( );
}
}
-QWidget *TaskBar::calibrate(bool)
-{
-#ifdef Q_WS_QWS
- Calibrate *c = new Calibrate;
- c->show();
- return c;
-#else
- return 0;
-#endif
-}
-
void TaskBar::toggleNumLockState()
{
if ( lockState ) lockState->toggleNumLockState();
}
void TaskBar::toggleCapsLockState()
{
if ( lockState ) lockState->toggleCapsLockState();
}
void TaskBar::toggleSymbolInput()
{
if ( inputMethods->currentShown() == "Unicode" ) {
inputMethods->hideInputMethod();
} else {
inputMethods->showInputMethod("Unicode");
}
}
bool TaskBar::recoverMemory()
{
//eturn mru->quitOldApps();
return true;
}
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index a0bf395..575a8c9 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -21,50 +21,48 @@
#ifndef __TASKBAR_H__
#define __TASKBAR_H__
#include <qhbox.h>
class QLabel;
class QTimer;
class InputMethods;
class Wait;
class SysTray;
//class MRUList;
class RunningAppBar;
class QWidgetStack;
class QTimer;
class QLabel;
class StartMenu;
class LockKeyState;
class TaskBar : public QHBox {
Q_OBJECT
public:
TaskBar();
~TaskBar();
- static QWidget *calibrate( bool );
-
bool recoverMemory();
StartMenu *startMenu() const { return sm; }
public slots:
void startWait();
void stopWait(const QString&);
void stopWait();
void clearStatusBar();
void toggleNumLockState();
void toggleCapsLockState();
void toggleSymbolInput();
protected:
void resizeEvent( QResizeEvent * );
void styleChange( QStyle & );
void setStatusMessage( const QString &text );
public slots:
void calcMaxWindowRect();
private slots:
void receive( const QCString &msg, const QByteArray &data );
private: