summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-02-08 22:59:18 (UTC)
committer zecke <zecke>2005-02-08 22:59:18 (UTC)
commitf24d8318de30b47ec8f877293fd175deaa0b914c (patch) (side-by-side diff)
tree980c18e803b7b85573e1ab11a9ade2b281273d3e /library
parent7cff42233a2e0e2761f54fea89db785c7b519c94 (diff)
downloadopie-f24d8318de30b47ec8f877293fd175deaa0b914c.zip
opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.gz
opie-f24d8318de30b47ec8f877293fd175deaa0b914c.tar.bz2
-Kill the need to compile Opie against a patched version of Qt/E
Remove the setStyle and setFont overrides as a result remove settings from the buildsystem and the Apperance GUI We do this as we won't run NeoCal or TKC Apps on a GCC3 (now default compiler) libqpe, to run these applications one can use oz-compat
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/library.pro6
-rw-r--r--library/qpeapplication.cpp40
-rw-r--r--library/qpeapplication.h5
-rw-r--r--library/qt_override.cpp170
-rw-r--r--library/qt_override_p.h25
5 files changed, 0 insertions, 246 deletions
diff --git a/library/library.pro b/library/library.pro
index 04e125f..95c18a2 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -1,145 +1,139 @@
TEMPLATE = lib
#CONFIG += qt warn_on release
CONFIG += qt warn_on debug
HEADERS = calendar.h \
global.h \
resource.h \
xmlreader.h \
mimetype.h \
menubutton.h \
network.h \
networkinterface.h \
filemanager.h \
fontmanager.h \
qdawg.h \
datebookmonth.h \
fileselector.h \
fileselector_p.h \
imageedit.h \
qcopenvelope_qws.h \
qpedecoration_qws.h \
qpeapplication.h \
qpestyle.h \
qpedialog.h \
lightstyle.h \
config.h \
applnk.h \
sound.h \
tzselect.h \
qmath.h \
datebookdb.h \
alarmserver.h \
process.h \
password.h \
timestring.h \
fontfactoryinterface.h \
fontdatabase.h \
power.h \
storage.h \
qpemessagebox.h \
timeconversion.h \
qpedebug.h \
qpemenubar.h \
qpetoolbar.h \
backend/categories.h \
stringutil.h \
backend/palmtoprecord.h \
backend/task.h \
backend/event.h \
backend/contact.h\
categorymenu.h \
categoryedit_p.h \
categoryselect.h \
categorywidget.h \
ir.h \
backend/vobject_p.h \
findwidget_p.h \
finddialog.h \
lnkproperties.h \
windowdecorationinterface.h \
textcodecinterface.h \
imagecodecinterface.h \
- qt_override_p.h \
qpeglobal.h
SOURCES = calendar.cpp \
global.cpp \
xmlreader.cpp \
mimetype.cpp \
menubutton.cpp \
network.cpp \
networkinterface.cpp \
filemanager.cpp \
fontmanager.cpp \
qdawg.cpp \
datebookmonth.cpp \
fileselector.cpp \
imageedit.cpp \
resource.cpp \
qpedecoration_qws.cpp \
qcopenvelope_qws.cpp \
qpeapplication.cpp \
qpestyle.cpp \
qpedialog.cpp \
lightstyle.cpp \
config.cpp \
applnk.cpp \
sound.cpp \
tzselect.cpp \
qmath.c \
datebookdb.cpp \
alarmserver.cpp \
password.cpp \
process.cpp \
process_unix.cpp \
timestring.cpp \
fontdatabase.cpp \
power.cpp \
storage.cpp \
qpemessagebox.cpp \
backend/timeconversion.cpp \
qpedebug.cpp \
qpemenubar.cpp \
qpetoolbar.cpp \
backend/categories.cpp \
backend/stringutil.cpp \
backend/palmtoprecord.cpp \
backend/task.cpp \
backend/event.cpp \
backend/contact.cpp \
categorymenu.cpp \
categoryedit_p.cpp \
categoryselect.cpp \
categorywidget.cpp \
ir.cpp \
backend/vcc_yacc.cpp \
backend/vobject.cpp \
findwidget_p.cpp \
finddialog.cpp \
lnkproperties.cpp \
- qt_override.cpp \
widget_showing.cpp
# Qt 3 compatibility
HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
INCLUDEPATH += $(OPIEDIR)/include backend
LIBS += -ldl -lcrypt -lm
INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
TARGET = qpe
DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
VERSION = 1.5.0.1
include( $(OPIEDIR)/include.pro )
-contains( CONFIG, no-override ){
- DEFINES += OPIE_NO_OVERRIDE_QT
-}
-
contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
DEFINES += OPIE_WITHROHFEEDBACK
SOURCES += backend/rohfeedback.cpp
HEADERS += backend/rohfeedback.h
}
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 1c5ced3..2bd7cbe 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1,291 +1,290 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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.
**
*/
#define QTOPIA_INTERNAL_LANGLIST
#include <stdlib.h>
#include <unistd.h>
#ifndef Q_OS_MACX
#include <linux/limits.h> // needed for some toolchains (PATH_MAX)
#endif
#include <qfile.h>
#include <qqueue.h>
#ifdef Q_WS_QWS
#ifndef QT_NO_COP
#if QT_VERSION <= 231
#define private public
#define sendLocally processEvent
#include "qcopenvelope_qws.h"
#undef private
#else
#include "qcopenvelope_qws.h"
#endif
#endif
#include <qwindowsystem_qws.h>
#endif
#include <qtextstream.h>
#include <qpalette.h>
#include <qbuffer.h>
#include <qptrdict.h>
#include <qregexp.h>
#include <qdir.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qdragobject.h>
#include <qtextcodec.h>
#include <qevent.h>
#include <qtooltip.h>
#include <qsignal.h>
#include <qmainwindow.h>
#include <qwidgetlist.h>
#include <qpixmapcache.h>
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#define QTOPIA_INTERNAL_INITAPP
#include "qpeapplication.h"
#include "qpestyle.h"
#include "styleinterface.h"
#if QT_VERSION >= 0x030000
#include <qstylefactory.h>
#else
#include <qplatinumstyle.h>
#include <qwindowsstyle.h>
#include <qmotifstyle.h>
#include <qmotifplusstyle.h>
#include "lightstyle.h"
#include <qpe/qlibrary.h>
#endif
#include "global.h"
#include "resource.h"
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
#include "qutfcodec.h"
#endif
#include "config.h"
#include "network.h"
#ifdef QWS
#include "fontmanager.h"
#include "fontdatabase.h"
#endif
#include "alarmserver.h"
#include "applnk.h"
#include "qpemenubar.h"
#include "textcodecinterface.h"
#include "imagecodecinterface.h"
#include <qtopia/qpeglobal.h>
#include <unistd.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#ifndef QT_NO_SOUND
#include <sys/soundcard.h>
#endif
-#include "qt_override_p.h"
#include <backend/rohfeedback.h>
static bool useBigPixmaps = 0;
class HackWidget : public QWidget
{
public:
bool needsOk()
{ return (getWState() & WState_Reserved1 ); }
QRect normalGeometry()
{ return topData()->normalGeometry; };
};
class QPEApplicationData
{
public:
QPEApplicationData ( ) :
presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
keep_running( true ), qcopQok( false ),
fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ),
bigIconSize( 32 ), qpe_main_widget( 0 )
{
Config cfg( "qpe" );
cfg.setGroup( "Appearance" );
useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false );
fontFamily = cfg.readEntry( "FontFamily", "Vera" );
fontSize = cfg.readNumEntry( "FontSize", 10 );
smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 );
bigIconSize = cfg.readNumEntry( "BigIconSize", 32 );
#ifdef OPIE_WITHROHFEEDBACK
RoH = 0;
#endif
}
int presstimer;
QWidget* presswidget;
QPoint presspos;
#ifdef OPIE_WITHROHFEEDBACK
Opie::Internal::RoHFeedback *RoH;
#endif
bool rightpressed : 1;
bool kbgrabbed : 1;
bool notbusysent : 1;
bool preloaded : 1;
bool forceshow : 1;
bool nomaximize : 1;
bool keep_running : 1;
bool qcopQok : 1;
QCString fontFamily;
int fontSize;
int smallIconSize;
int bigIconSize;
QString appName;
struct QCopRec
{
QCopRec( const QCString &ch, const QCString &msg,
const QByteArray &d ) :
channel( ch ), message( msg ), data( d )
{ }
QCString channel;
QCString message;
QByteArray data;
};
QWidget* qpe_main_widget;
QGuardedPtr<QWidget> lastraised;
QQueue<QCopRec> qcopq;
QString styleName;
QString decorationName;
void enqueueQCop( const QCString &ch, const QCString &msg,
const QByteArray &data )
{
qcopq.enqueue( new QCopRec( ch, msg, data ) );
}
void sendQCopQ()
{
if (!qcopQok )
return;
QCopRec * r;
while((r=qcopq.dequeue())) {
// remove from queue before sending...
// event loop can come around again before getting
// back from sendLocally
#ifndef QT_NO_COP
QCopChannel::sendLocally( r->channel, r->message, r->data );
#endif
delete r;
}
}
static void show_mx(QWidget* mw, bool nomaximize, QString &strName) {
if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") )
{
( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps );
}
QPoint p;
QSize s;
bool max;
if ( mw->isVisible() ) {
if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
mw->resize(s);
mw->move(p);
}
mw->raise();
} else {
if ( mw->layout() && mw->inherits("QDialog") ) {
if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
mw->resize(s);
mw->move(p);
if ( max && !nomaximize ) {
mw->showMaximized();
} else {
mw->show();
}
} else {
QPEApplication::showDialog((QDialog*)mw,nomaximize);
}
} else {
if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
mw->resize(s);
mw->move(p);
} else { //no stored rectangle, make an estimation
int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
mw->move( QMAX(x,0), QMAX(y,0) );
#ifdef Q_WS_QWS
if ( !nomaximize )
mw->showMaximized();
#endif
}
if ( max && !nomaximize )
mw->showMaximized();
else
mw->show();
}
}
}
static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
{
maximized = TRUE;
// 350 is the trigger in qwsdefaultdecoration for providing a resize button
if ( qApp->desktop()->width() <= 350 )
return FALSE;
Config cfg( "qpe" );
cfg.setGroup("ApplicationPositions");
QString str = cfg.readEntry( app, QString::null );
QStringList l = QStringList::split(",", str);
if ( l.count() == 5) {
p.setX( l[0].toInt() );
p.setY( l[1].toInt() );
s.setWidth( l[2].toInt() );
s.setHeight( l[3].toInt() );
maximized = l[4].toInt();
return TRUE;
}
return FALSE;
}
static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s)
{
#ifndef Q_WS_QWS
QRect qt_maxWindowRect = qApp->desktop()->geometry();
#endif
int maxX = qt_maxWindowRect.width();
int maxY = qt_maxWindowRect.height();
int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() );
int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() );
// total window size is not allowed to be larger than desktop window size
if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) )
@@ -1163,466 +1162,427 @@ bool QPEApplication::qwsEventFilter( QWSEvent * e )
}
return true;
}
}
if ( e->type == QWSEvent::Focus ) {
QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
if ( !fe->simpleData.get_focus ) {
QWidget * active = activeWindow();
while ( active && active->isPopup() ) {
active->close();
active = activeWindow();
}
}
else {
// make sure our modal widget is ALWAYS on top
QWidget *topm = activeModalWidget();
if ( topm && static_cast<int>( topm->winId() ) != fe->simpleData.window) {
topm->raise();
}
}
if ( fe->simpleData.get_focus && inputMethodDict ) {
InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
if ( m == AlwaysOff )
Global::hideInputMethod();
if ( m == AlwaysOn )
Global::showInputMethod();
}
}
return QApplication::qwsEventFilter( e );
}
#endif
/*!
Destroys the QPEApplication.
*/
QPEApplication::~QPEApplication()
{
ungrabKeyboard();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
// Need to delete QCopChannels early, since the display will
// be gone by the time we get to ~QObject().
delete sysChannel;
delete pidChannel;
#endif
#ifdef OPIE_WITHROHFEEDBACK
if( d->RoH )
delete d->RoH;
#endif
delete d;
}
/*!
Returns <tt>$OPIEDIR/</tt>.
*/
QString QPEApplication::qpeDir()
{
QString base, dir;
if (getenv( "OPIEDIR" ))
base = QString(getenv("OPIEDIR")).stripWhiteSpace();
if ( !base.isNull() && (base.length() > 0 )){
#ifdef Q_OS_WIN32
QString temp(base);
if (temp[(int)temp.length()-1] != QDir::separator())
temp.append(QDir::separator());
dir = temp;
#else
dir = QString( base ) + "/";
#endif
}else{
dir = QString( ".." ) + QDir::separator();
}
return dir;
}
/*!
Returns the user's current Document directory. There is a trailing "/".
.. well, it does now,, and there's no trailing '/'
*/
QString QPEApplication::documentDir()
{
const char* base = getenv( "HOME");
if ( base )
return QString( base ) + "/Documents";
return QString( "../Documents" );
}
static int deforient = -1;
/*!
\internal
*/
int QPEApplication::defaultRotation()
{
if ( deforient < 0 ) {
QString d = getenv( "QWS_DISPLAY" );
if ( d.contains( "Rot90" ) ) {
deforient = 90;
}
else if ( d.contains( "Rot180" ) ) {
deforient = 180;
}
else if ( d.contains( "Rot270" ) ) {
deforient = 270;
}
else {
deforient = 0;
}
}
return deforient;
}
/*!
\internal
*/
void QPEApplication::setDefaultRotation( int r )
{
if ( qApp->type() == GuiServer ) {
deforient = r;
setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
Config config("qpe");
config.setGroup( "Rotation" );
config.writeEntry( "Rot", r );
}
else {
#ifndef QT_NO_COP
{ QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
e << r;
}
#endif
}
}
#include <qgfx_qws.h>
#include <qwindowsystem_qws.h>
#if QT_VERSION > 236
extern void qws_clearLoadedFonts();
#endif
void QPEApplication::setCurrentMode( int x, int y, int depth )
{
// Reset the caches
#if QT_VERSION > 236
qws_clearLoadedFonts();
#endif
QPixmapCache::clear();
// Change the screen mode
qt_screen->setMode(x, y, depth);
if ( qApp->type() == GuiServer ) {
#if QT_VERSION > 236
// Reconfigure the GuiServer
qwsServer->beginDisplayReconfigure();
qwsServer->endDisplayReconfigure();
#endif
// Get all the running apps to reset
QCopEnvelope env( "QPE/System", "reset()" );
}
}
void QPEApplication::reset() {
// Reconnect to the screen
qt_screen->disconnect();
qt_screen->connect( QString::null );
// Redraw everything
applyStyle();
}
#if (QT_VERSION < 238) && defined Q_OS_MACX
bool qt_left_hand_scrollbars = false;
#else
extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL;
#endif
/*!
\internal
*/
void QPEApplication::applyStyle()
{
Config config( "qpe" );
config.setGroup( "Appearance" );
#if QT_VERSION > 233
-#if !defined(OPIE_NO_OVERRIDE_QT)
- // don't block ourselves ...
- Opie::force_appearance = 0;
-
- static QString appname = Opie::binaryName ( );
-
- QStringList ex = config. readListEntry ( "NoStyle", ';' );
- int nostyle = 0;
- for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
- if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
- nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
- break;
- }
- }
-#else
- int nostyle = 0;
-#endif
-
// Widget style
QString style = config.readEntry( "Style", "FlatStyle" );
- // don't set a custom style
- if ( nostyle & Opie::Force_Style )
- style = "FlatStyle";
-
internalSetStyle ( style );
// Colors - from /etc/colors/Liquid.scheme
QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
QPalette pal( btncolor, bgcolor );
QString color = config.readEntry( "Highlight", "#73adef" );
pal.setColor( QColorGroup::Highlight, QColor( color ) );
color = config.readEntry( "HighlightedText", "#FFFFFF" );
pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
color = config.readEntry( "Text", "#000000" );
pal.setColor( QColorGroup::Text, QColor( color ) );
color = config.readEntry( "ButtonText", "#000000" );
pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
color = config.readEntry( "Base", "#FFFFFF" );
pal.setColor( QColorGroup::Base, QColor( color ) );
pal.setColor( QPalette::Disabled, QColorGroup::Text,
pal.color( QPalette::Active, QColorGroup::Background ).dark() );
setPalette( pal, TRUE );
// Set the ScrollBar on the 'right' side but only if the weak symbol is present
if (&qt_left_hand_scrollbars )
qt_left_hand_scrollbars = config.readBoolEntry( "LeftHand", false );
// Window Decoration
QString dec = config.readEntry( "Decoration", "Flat" );
- // don't set a custom deco
- if ( nostyle & Opie::Force_Decoration )
- dec = "";
-
-
if ( dec != d->decorationName ) {
qwsSetDecoration( new QPEDecoration( dec ) );
d->decorationName = dec;
}
// Font
QString ff = config.readEntry( "FontFamily", font().family() );
int fs = config.readNumEntry( "FontSize", font().pointSize() );
- // don't set a custom font
- if ( nostyle & Opie::Force_Font ) {
- ff = "Vera";
- fs = 10;
- }
-
setFont ( QFont ( ff, fs ), true );
-
-#if !defined(OPIE_NO_OVERRIDE_QT)
- // revert to global blocking policy ...
- Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
- Opie::force_appearance &= ~nostyle;
-#endif
#endif
}
void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
{
#ifdef Q_WS_QWS
QDataStream stream( data, IO_ReadOnly );
if ( msg == "applyStyle()" ) {
applyStyle();
}
else if ( msg == "toggleApplicationMenu()" ) {
QWidget *active = activeWindow ( );
if ( active ) {
QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
bool oldactive = man-> isActive ( );
man-> setActive( !man-> isActive() );
if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
}
}
}
else if ( msg == "setDefaultRotation(int)" ) {
if ( type() == GuiServer ) {
int r;
stream >> r;
setDefaultRotation( r );
}
}
else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
if ( type() == GuiServer ) {
int x, y, depth;
stream >> x;
stream >> y;
stream >> depth;
setCurrentMode( x, y, depth );
}
}
else if ( msg == "reset()" ) {
if ( type() != GuiServer )
reset();
}
else if ( msg == "setCurrentRotation(int)" ) {
int r;
stream >> r;
setCurrentRotation( r );
}
else if ( msg == "shutdown()" ) {
if ( type() == GuiServer )
shutdown();
}
else if ( msg == "quit()" ) {
if ( type() != GuiServer )
tryQuit();
}
else if ( msg == "forceQuit()" ) {
if ( type() != GuiServer )
quit();
}
else if ( msg == "restart()" ) {
if ( type() == GuiServer )
restart();
}
else if ( msg == "language(QString)" ) {
if ( type() == GuiServer ) {
QString l;
stream >> l;
QString cl = getenv( "LANG" );
if ( cl != l ) {
if ( l.isNull() )
unsetenv( "LANG" );
else
setenv( "LANG", l.latin1(), 1 );
restart();
}
}
}
else if ( msg == "timeChange(QString)" ) {
QString t;
stream >> t;
if ( t.isNull() )
unsetenv( "TZ" );
else
setenv( "TZ", t.latin1(), 1 );
// emit the signal so everyone else knows...
emit timeChanged();
}
else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
if ( type() == GuiServer ) {
QDateTime when;
QCString channel, message;
int data;
stream >> when >> channel >> message >> data;
AlarmServer::addAlarm( when, channel, message, data );
}
}
else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
if ( type() == GuiServer ) {
QDateTime when;
QCString channel, message;
int data;
stream >> when >> channel >> message >> data;
AlarmServer::deleteAlarm( when, channel, message, data );
}
}
else if ( msg == "clockChange(bool)" ) {
int tmp;
stream >> tmp;
emit clockChanged( tmp );
}
else if ( msg == "weekChange(bool)" ) {
int tmp;
stream >> tmp;
emit weekChanged( tmp );
}
else if ( msg == "setDateFormat(DateFormat)" ) {
DateFormat tmp;
stream >> tmp;
emit dateFormatChanged( tmp );
}
else if ( msg == "setVolume(int,int)" ) {
int t, v;
stream >> t >> v;
setVolume( t, v );
emit volumeChanged( muted );
}
else if ( msg == "volumeChange(bool)" ) {
stream >> muted;
setVolume();
emit volumeChanged( muted );
}
else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
int t, v;
stream >> t >> v;
setMic( t, v );
emit micChanged( micMuted );
}
else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
stream >> micMuted;
setMic();
emit micChanged( micMuted );
}
else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
int t, v;
stream >> t >> v;
setBass( t, v );
}
else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
setBass();
}
else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
int t, v;
stream >> t >> v;
setTreble( t, v );
}
else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
setTreble();
} else if ( msg == "getMarkedText()" ) {
if ( type() == GuiServer ) {
const ushort unicode = 'C'-'@';
const int scan = Key_C;
qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
}
} else if ( msg == "newChannel(QString)") {
QString myChannel = "QPE/Application/" + d->appName;
QString channel;
stream >> channel;
if (channel == myChannel) {
processQCopFile();
d->sendQCopQ();
}
}
#endif
}
/*!
\internal
*/
bool QPEApplication::raiseAppropriateWindow()
{
bool r=FALSE;
// 1. Raise the main widget
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 849d5b3..167fe69 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -1,244 +1,239 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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.
**
**********************************************************************/
#ifndef __QPE_APPLICATION_H__
#define __QPE_APPLICATION_H__
#include <stdlib.h> // for setenv()
#include <qglobal.h>
#include <qapplication.h>
#include <qdialog.h>
#include <qwsdisplay_qws.h>
#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
#define Q_WS_QWS
#endif
#include "qpedecoration_qws.h"
#include "timestring.h"
#include "qpeglobal.h"
class QCopChannel;
class QPEApplicationData;
class QWSEvent;
class QWSKeyEvent;
/**
\brief The QPEApplication class implements various system services
that are available to all Qtopia applications.
Simply by using QPEApplication instead of QApplication, a standard Qt
application becomes a Qtopia application. It automatically follows
style changes, quits and raises, and in the
case of \link docwidget.html document-oriented\endlink applications,
changes the currently displayed document in response to the environment.
To create a \link docwidget.html document-oriented\endlink
application use showMainDocumentWidget(); to create a
non-document-oriented application use showMainWidget(). The
keepRunning() function indicates whether the application will
continue running after it's processed the last \link qcop.html
QCop\endlink message. This can be changed using setKeepRunning().
A variety of signals are emitted when certain events occur, for
example, timeChanged(), clockChanged(), weekChanged(),
dateFormatChanged() and volumeChanged(). If the application receives
a \link qcop.html QCop\endlink message on the application's
QPE/Application/\e{appname} channel, the appMessage() signal is
emitted. There are also flush() and reload() signals, which
are emitted when synching begins and ends respectively - upon these
signals, the application should save and reload any data
files that are involved in synching. Most of these signals will initially
be received and unfiltered through the appMessage() signal.
This class also provides a set of useful static functions. The
qpeDir() and documentDir() functions return the respective paths.
The grabKeyboard() and ungrabKeyboard() functions are used to
control whether the application takes control of the device's
physical buttons (e.g. application launch keys). The stylus' mode of
operation is set with setStylusOperation() and retrieved with
stylusOperation(). There are also setInputMethodHint() and
inputMethodHint() functions.
\ingroup qtopiaemb
*/
class QPEApplication : public QApplication
{
Q_OBJECT
public:
QPEApplication( int& argc, char **argv, Type=GuiClient );
~QPEApplication();
static QString qpeDir();
static QString documentDir();
void applyStyle();
void reset();
static int defaultRotation();
static void setDefaultRotation(int r);
static void setCurrentRotation(int r);
static void setCurrentMode(int x, int y, int depth );
static void grabKeyboard();
static void ungrabKeyboard();
enum StylusMode {
LeftOnly,
RightOnHold
// RightOnHoldLeftDelayed, etc.
};
static void setStylusOperation( QWidget*, StylusMode );
static StylusMode stylusOperation( QWidget* );
enum InputMethodHint {
Normal,
AlwaysOff,
AlwaysOn
};
enum screenSaverHint {
Disable = 0,
DisableLightOff = 1,
DisableSuspend = 2,
Enable = 100
};
static void setInputMethodHint( QWidget *, InputMethodHint );
static InputMethodHint inputMethodHint( QWidget * );
void showMainWidget( QWidget*, bool nomax=FALSE );
void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
/* Merge setTempScreenSaverMode */
#ifdef QTOPIA_INTERNAL_INITAPP
void initApp( int argv, char **argv );
#endif
static void setKeepRunning();
bool keepRunning() const;
bool keyboardGrabbed() const;
int exec();
signals:
void clientMoused();
void timeChanged();
void clockChanged( bool pm );
void micChanged( bool muted );
void volumeChanged( bool muted );
void appMessage( const QCString& msg, const QByteArray& data);
void weekChanged( bool startOnMonday );
void dateFormatChanged( DateFormat );
void flush();
void reload();
/* linkChanged signal */
private slots:
void systemMessage( const QCString &msg, const QByteArray &data );
void pidMessage( const QCString &msg, const QByteArray &data );
void removeSenderFromStylusDict();
void hideOrQuit();
protected:
bool qwsEventFilter( QWSEvent * );
void internalSetStyle( const QString &style );
void prepareForTermination(bool willrestart);
virtual void restart();
virtual void shutdown();
bool eventFilter( QObject *, QEvent * );
void timerEvent( QTimerEvent * );
bool raiseAppropriateWindow();
virtual void tryQuit();
-#ifndef OPIE_NO_ERASE_RECT_HACKFIX
- #if QT_VERSION > 233
- virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
- #endif
-#endif
private:
void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
void processQCopFile();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopChannel *sysChannel;
QCopChannel *pidChannel;
#endif
QPEApplicationData *d;
bool reserved_sh;
};
enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
inline int TransToDeg ( Transformation t )
{
int d = static_cast<int>( t );
return d * 90;
}
inline Transformation DegToTrans ( int d )
{
Transformation t = static_cast<Transformation>( d / 90 );
return t;
}
/*
* Set current rotation of Opie, and rotation for newly started apps.
* Differs from setDefaultRotation in that 1) it rotates currently running apps,
* and 2) does not set deforient or save orientation to qpe.conf.
*/
inline void QPEApplication::setCurrentRotation( int r )
{
// setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
// for compatibility with the SharpROM use fallback to setDefaultTransformation()
#if QT_VERSION > 233
Transformation e = DegToTrans( r );
::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
qApp->desktop()->qwsDisplay()->setTransformation( e );
#else
setDefaultRotation( r );
#endif
}
/*
* Qtopia 1.7 SDK compatibility macros
* FIXME: Support Opie Quicklaunch Interface
*/
#define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \
int main( int argc, char** argv ) \
{ \
QPEApplication app = QPEApplication( argc, argv ); \
IMPLEMENTATION* mw = new IMPLEMENTATION(); \
app.showMainWidget( mw ); \
app.exec(); \
}
#define QTOPIA_MAIN // Bee-Bop-Alula
/*
* -remove me
*/
#ifdef Q_WS_QWS
extern Q_EXPORT QRect qt_maxWindowRect;
#endif
#endif
diff --git a/library/qt_override.cpp b/library/qt_override.cpp
deleted file mode 100644
index a0d753b..0000000
--- a/library/qt_override.cpp
+++ b/dev/null
@@ -1,170 +0,0 @@
-
-#include <qpe/qpeapplication.h>
-#include <qfontdatabase.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-#include <sys/param.h> // for toolchains with old libc headers
-
-#include <qtopia/qpeglobal.h>
-#include "qt_override_p.h"
-
-#if QT_VERSION > 233
-
-#ifndef OPIE_NO_ERASE_RECT_HACKFIX
-struct color_fix_t {
- char *m_app;
- char *m_class;
- char *m_name;
- QColorGroup::ColorRole m_set;
- QColorGroup::ColorRole m_get;
-};
-
-
-
-static const color_fix_t apps_that_need_special_colors [] = {
- { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base },
- { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base },
-
- { 0, 0, 0, QColorGroup::Base, QColorGroup::Base }
-};
-
-#endif
-
-#ifndef OPIE_NO_OVERRIDE_QT
-
-static const char * const apps_that_need_pointsizes_times_10 [] = {
- "HancomMobileWord",
- "hancomsheet",
- "HancomPresenterViewer",
-
- 0
-};
-
-
-
-
-int Opie::force_appearance = 0;
-
-
-// Return the *real* name of the binary - not just a quick guess
-// by looking at argv [0] (which could be anything)
-
-static void binaryNameFree ( )
-{
- ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here
-}
-
-const char *Opie::binaryName ( )
-{
- static const char *appname = 0;
-
- if ( !appname ) {
- char dst [PATH_MAX + 1];
- int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX );
-
- if ( l <= 0 )
- l = 0;
-
- dst [l] = 0;
- const char *b = ::strrchr ( dst, '/' );
- appname = ::strdup ( b ? b + 1 : dst );
-
- ::atexit ( binaryNameFree );
- }
- return appname;
-}
-
-#else
-int Opie::force_appearance = 0;
-#endif
-
-// Fix for a toolchain incompatibility (binaries compiled with
-// old tcs using shared libs compiled with newer tcs)
-
-extern "C" {
-
-extern void __gmon_start__ ( ) QPE_WEAK_SYMBOL;
-extern void __gmon_start__ ( )
-{
-}
-
-}
-
-
-#ifndef OPIE_NO_ERASE_RECT_HACKFIX
-// Fix for apps, that use QPainter::eraseRect() which doesn't work with styles
-// that set a background pixmap (it would be easier to fix eraseRect(), but
-// TT made it an inline ...)
-
-void QPEApplication::polish ( QWidget *w )
-{
-#ifndef OPIE_NO_OVERRIDE_QT
- for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) {
- if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) &&
- ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) &&
- ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) {
- QPalette pal = w-> palette ( );
- pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get ));
- w-> setPalette ( pal );
- }
- }
-#endif
- QApplication::polish ( w );
-}
-#endif
-
-
-#ifndef OPIE_NO_OVERRIDE_QT
-// Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes
-// were multiplied by 10 (which was incorrect)
-
-QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset )
-{
- QValueList <int> sl = pointSizes_NonWeak ( family, style, charset );
-
- for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) {
- if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) {
- for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it )
- *it *= 10;
- }
- }
- return sl;
-}
-
-
-// Various style/font/color related overrides for weak symbols in Qt/E,
-// which allows us to force the usage of the global Opie appearance.
-
-void QApplication::setStyle ( QStyle *style )
-{
- if ( Opie::force_appearance & Opie::Force_Style )
- delete style;
- else
- QApplication::setStyle_NonWeak ( style );
-}
-
-void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className )
-{
- if (!( Opie::force_appearance & Opie::Force_Style ))
- QApplication::setPalette_NonWeak ( pal, informWidgets, className );
-}
-
-void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className )
-{
- if (!( Opie::force_appearance & Opie::Force_Font ))
- QApplication::setFont_NonWeak ( fnt, informWidgets, className );
-}
-
-
-void QApplication::qwsSetDecoration ( QWSDecoration *deco )
-{
- if ( Opie::force_appearance & Opie::Force_Decoration )
- delete deco;
- else
- QApplication::qwsSetDecoration_NonWeak ( deco );
-}
-#endif
-#endif
diff --git a/library/qt_override_p.h b/library/qt_override_p.h
deleted file mode 100644
index cb05d15..0000000
--- a/library/qt_override_p.h
+++ b/dev/null
@@ -1,25 +0,0 @@
-#ifndef __QT_OVERRIDE_H__
-#define __QT_OVERRIDE_H__
-
-#if QT_VERSION > 233
-
-namespace Opie {
-
-enum ForceAppearance {
- Force_Style = 0x01,
- Force_Font = 0x02,
- Force_Decoration = 0x04,
-
- Force_All = 0xff,
- Force_None = 0x00,
-};
-
-extern const char *binaryName ( );
-
-extern int force_appearance;
-
-}
-
-#endif // (QT_VERSION >233)
-
-#endif