author | sandman <sandman> | 2002-06-24 22:38:00 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-24 22:38:00 (UTC) |
commit | 1a3970869e87b41d475368e089a656de96a27561 (patch) (side-by-side diff) | |
tree | 8e247a5ea8092e7d3abfda0a4d42b5e24653f9f0 /library | |
parent | b5e6ed78ad6075550985b092211318da47904897 (diff) | |
download | opie-1a3970869e87b41d475368e089a656de96a27561.zip opie-1a3970869e87b41d475368e089a656de96a27561.tar.gz opie-1a3970869e87b41d475368e089a656de96a27561.tar.bz2 |
Default font should be helvetica (compatiblity and looks nicer IMHO)
Do not hard-code the encoding, let FontDatabase pick it, when not
explicitly specified
-rw-r--r-- | library/qpeapplication.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 1534b0b..87a9739 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -416,388 +416,388 @@ static void setScreenSaverIntervals(int i1, int i2, int i3) int v[4]; i1 = ssi(i1, config, "Dim","Interval_Dim", 30); i2 = ssi(i2, config, "LightOff","Interval_LightOff", 20); i3 = ssi(i3, config, "","Interval", 60); //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); v[0] = QMAX( 1000*i1, 100); v[1] = QMAX( 1000*i2, 100); v[2] = QMAX( 1000*i3, 100); v[3] = 0; dim_on = ( (i1 != 0) ? config.readNumEntry("Dim",1) : FALSE ); lightoff_on = ( (i2 != 0 ) ? config.readNumEntry("LightOff",1) : FALSE ); if ( !i1 && !i2 && !i3 ) QWSServer::setScreenSaverInterval(0); else QWSServer::setScreenSaverIntervals(v); } static void setScreenSaverInterval(int interval) { setScreenSaverIntervals(-1,-1,interval); } /*! \class QPEApplication qpeapplication.h \brief The QPEApplication class implements various system services that are available to all Qtopia applications. Simply by using QPEApplication instead of QApplication, a plain 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 current displayed document in response to the environment. */ /*! \fn void QPEApplication::clientMoused() \internal */ /*! \fn void QPEApplication::timeChanged(); This signal is emitted when the time jumps forward or backwards by more than the normal passage of time. */ /*! \fn void QPEApplication::clockChanged( bool ampm ); This signal is emitted when the user changes the style of clock. If \a ampm is TRUE, the user wants a 12-hour AM/PM close, otherwise, they want a 24-hour clock. */ /*! \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) This signal is emitted when a message is received on the QPE/Application/<i>appname</i> QCop channel for this application. The slot to which you connect this signal uses \a msg and \a data in the following way: \code void MyWidget::receive( const QCString& msg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "someMessage(int,int,int)" ) { int a,b,c; stream >> a >> b >> c; ... } else if ( msg == "otherMessage(QString)" ) { ... } } \endcode \sa qcop.html */ /*! Constructs a QPEApplication just as you would construct a QApplication, passing \a argc, \a argv, and \a t. */ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) : QApplication( hack(argc), argv, t ) { int dw = desktop()->width(); if ( dw < 200 ) { // setFont( QFont( "helvetica", 8 ) ); AppLnk::setSmallIconSize(10); AppLnk::setBigIconSize(28); } d = new QPEApplicationData; QMimeSourceFactory::setDefaultFactory(new ResourceMimeFactory); connect(this, SIGNAL(lastWindowClosed()), this, SLOT(hideOrQuit())); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) QString qcopfn("/tmp/qcop-msg-"); qcopfn += QString(argv[0]); // append command name QFile f(qcopfn); if ( f.open(IO_ReadOnly) ) { flock(f.handle(), LOCK_EX); } sysChannel = new QCopChannel( "QPE/System", this ); connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); QCString channel = QCString(argv[0]); channel.replace(QRegExp(".*/"),""); d->appName = channel; channel = "QPE/Application/" + channel; pidChannel = new QCopChannel( channel, this); connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), this, SLOT(pidMessage(const QCString &, const QByteArray &))); if ( f.isOpen() ) { d->keep_running = FALSE; QDataStream ds(&f); QCString channel, message; QByteArray data; while(!ds.atEnd()) { ds >> channel >> message >> data; d->enqueueQCop(channel,message,data); } flock(f.handle(), LOCK_UN); f.close(); f.remove(); } for (int a=0; a<argc; a++) { if ( qstrcmp(argv[a],"-preload")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; argc-=1; } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { argv[a] = argv[a+1]; a++; d->preloaded = TRUE; d->forceshow = TRUE; argc-=1; } } /* overide stored arguments */ setArgs(argc, argv); #endif qwsSetDecoration( new QPEDecoration() ); #ifndef QT_NO_TRANSLATION QStringList langs = Global::languageList(); for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { QString lang = *it; QTranslator * trans; QString tfn; trans = new QTranslator(this); tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; if ( trans->load( tfn )) installTranslator( trans ); else delete trans; trans = new QTranslator(this); tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; if ( trans->load( tfn )) installTranslator( trans ); else delete trans; //###language/font hack; should look it up somewhere if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); setFont( fn ); } else { Config config( "qpe" ); config.setGroup( "Appearance" ); - QString familyStr = config.readEntry( "FontFamily", "fixed" ); + QString familyStr = config.readEntry( "FontFamily", "helvetica" ); QString styleStr = config.readEntry( "FontStyle", "Regular" ); QString sizeStr = config.readEntry( "FontSize", "10" ); - QString charSetStr = config.readEntry( "FontCharSet", "iso10646-1" ); + QString charSetStr = config.readEntry( "FontCharSet", QString::null ); bool ok; int i_size = sizeStr.toInt( &ok, 10 ); FontDatabase fdb; QFont selectedFont = fdb.font( familyStr, styleStr, i_size, charSetStr ); setFont( selectedFont ); } } #endif applyStyle(); if ( type() == GuiServer ) { setScreenSaverInterval(-1); setVolume(); QWSServer::setScreenSaver(new QPEScreenSaver); } installEventFilter( this ); QPEMenuToolFocusManager::initialize(); #ifdef QT_NO_QWS_CURSOR // if we have no cursor, probably don't want tooltips QToolTip::setEnabled( FALSE ); #endif } static QPtrDict<void>* inputMethodDict=0; static void createInputMethodDict() { if ( !inputMethodDict ) inputMethodDict = new QPtrDict<void>; } /*! Returns the currently set hint to the system as to whether \a w has any use for text input methods. \sa setInputMethodHint() */ QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w ) { if ( inputMethodDict && w ) return (InputMethodHint)(int)inputMethodDict->find(w); return Normal; } /*! \enum QPEApplication::InputMethodHint \value Normal the application sometimes needs text input (the default). \value AlwaysOff the application never needs text input. \value AlwaysOn the application always needs text input. */ /*! Hints to the system that \a w has use for text input methods as specified by \a mode. \sa inputMethodHint() */ void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { createInputMethodDict(); if ( mode == Normal ) { inputMethodDict->remove(w); } else { inputMethodDict->insert(w,(void*)mode); } } class HackDialog : public QDialog { public: void acceptIt() { accept(); } void rejectIt() { reject(); } }; void QPEApplication::mapToDefaultAction( QWSKeyEvent *ke, int key ) { // specialised actions for certain widgets. May want to // add more stuff here. if ( activePopupWidget() && activePopupWidget()->inherits( "QListBox" ) && activePopupWidget()->parentWidget() && activePopupWidget()->parentWidget()->inherits( "QComboBox" ) ) key = Qt::Key_Return; if ( activePopupWidget() && activePopupWidget()->inherits( "QPopupMenu" ) ) key = Qt::Key_Return; ke->simpleData.keycode = key; } class HackWidget : public QWidget { public: bool needsOk() { return (getWState() & WState_Reserved1 ); } }; /*! \internal */ bool QPEApplication::qwsEventFilter( QWSEvent *e ) { if ( !d->notbusysent && e->type == QWSEvent::Focus ) { if ( qApp->type() != QApplication::GuiServer ) { QCopEnvelope e("QPE/System", "notBusy(QString)" ); e << d->appName; } d->notbusysent=TRUE; } if ( type() == GuiServer ) { switch ( e->type ) { case QWSEvent::Mouse: if ( e->asMouse()->simpleData.state && !QWidget::find(e->window()) ) emit clientMoused(); } } if ( e->type == QWSEvent::Key ) { if ( d->kbgrabber == 1 ) return TRUE; QWSKeyEvent *ke = (QWSKeyEvent *)e; if ( ke->simpleData.keycode == Qt::Key_F33 ) { // Use special "OK" key to press "OK" on top level widgets QWidget *active = activeWindow(); QWidget *popup = 0; if ( active && active->isPopup() ) { popup = active; active = active->parentWidget(); } if ( active && (int)active->winId() == ke->simpleData.window && !active->testWFlags( WStyle_Customize|WType_Popup|WType_Desktop )) { if ( ke->simpleData.is_press ) { if ( popup ) popup->close(); if ( active->inherits( "QDialog" ) ) { HackDialog *d = (HackDialog *)active; d->acceptIt(); return TRUE; } else if ( ((HackWidget *)active)->needsOk() ) { QSignal s; s.connect( active, SLOT( accept() ) ); s.activate(); } else { // do the same as with the select key: Map to the default action of the widget: mapToDefaultAction( ke, Qt::Key_Return ); } } } } else if ( ke->simpleData.keycode == Qt::Key_F30 ) { // Use special "select" key to do whatever default action a widget has mapToDefaultAction( ke, Qt::Key_Space ); } else if ( ke->simpleData.keycode == Qt::Key_Escape && ke->simpleData.is_press ) { // Escape key closes app if focus on toplevel QWidget *active = activeWindow(); if ( active && active->testWFlags( WType_TopLevel ) && (int)active->winId() == ke->simpleData.window && !active->testWFlags( WStyle_Dialog|WStyle_Customize|WType_Popup|WType_Desktop )) { if ( active->inherits( "QDialog" ) ) { HackDialog *d = (HackDialog *)active; d->rejectIt(); return TRUE; } else if ( strcmp( argv()[0], "embeddedkonsole") != 0 ) { active->close(); } } } #if QT_VERSION < 231 // Filter out the F4/Launcher key from apps // ### The launcher key may not always be F4 on all devices if ( ((QWSKeyEvent *)e)->simpleData.keycode == Qt::Key_F4 ) return TRUE; #endif } if ( e->type == QWSEvent::Focus ) { QWSFocusEvent *fe = (QWSFocusEvent*)e; QWidget* nfw = QWidget::find(e->window()); if ( !fe->simpleData.get_focus ) { QWidget *active = activeWindow(); while ( active && active->isPopup() ) { active->close(); active = activeWindow(); } if ( !nfw && d->kbgrabber == 2 ) { ungrabKeyboard(); d->kbregrab = TRUE; // want kb back when we're active } |