-rw-r--r-- | library/qpeapplication.cpp | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 26e310a..4bc0c5f 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -93,12 +93,14 @@ | |||
93 | #include <sys/ioctl.h> | 93 | #include <sys/ioctl.h> |
94 | #ifndef QT_NO_SOUND | 94 | #ifndef QT_NO_SOUND |
95 | #include <sys/soundcard.h> | 95 | #include <sys/soundcard.h> |
96 | #endif | 96 | #endif |
97 | #include "qt_override_p.h" | 97 | #include "qt_override_p.h" |
98 | 98 | ||
99 | static bool useBigPixmaps = 0; | ||
100 | |||
99 | class HackWidget : public QWidget | 101 | class HackWidget : public QWidget |
100 | { | 102 | { |
101 | public: | 103 | public: |
102 | bool needsOk() | 104 | bool needsOk() |
103 | { return (getWState() & WState_Reserved1 ); } | 105 | { return (getWState() & WState_Reserved1 ); } |
104 | 106 | ||
@@ -109,15 +111,24 @@ public: | |||
109 | class QPEApplicationData | 111 | class QPEApplicationData |
110 | { | 112 | { |
111 | public: | 113 | public: |
112 | QPEApplicationData ( ) | 114 | QPEApplicationData ( ) |
113 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 115 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
114 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 116 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
115 | keep_running( true ), qcopQok( false ), qpe_main_widget( 0 ) | 117 | keep_running( true ), qcopQok( false ), |
116 | 118 | fontFamily( "Vera" ), fontSize( 10 ), smallIconSize( 14 ), | |
117 | {} | 119 | bigIconSize( 32 ), qpe_main_widget( 0 ) |
120 | { | ||
121 | Config cfg( "qpe" ); | ||
122 | cfg.setGroup( "Appearance" ); | ||
123 | useBigPixmaps = cfg.readBoolEntry( "useBigPixmaps", false ); | ||
124 | fontFamily = cfg.readEntry( "FontFamily", "Vera" ); | ||
125 | fontSize = cfg.readNumEntry( "FontSize", 10 ); | ||
126 | smallIconSize = cfg.readNumEntry( "SmallIconSize", 14 ); | ||
127 | bigIconSize = cfg.readNumEntry( "BigIconSize", 32 ); | ||
128 | } | ||
118 | 129 | ||
119 | int presstimer; | 130 | int presstimer; |
120 | QWidget* presswidget; | 131 | QWidget* presswidget; |
121 | QPoint presspos; | 132 | QPoint presspos; |
122 | 133 | ||
123 | bool rightpressed : 1; | 134 | bool rightpressed : 1; |
@@ -126,12 +137,16 @@ public: | |||
126 | bool preloaded : 1; | 137 | bool preloaded : 1; |
127 | bool forceshow : 1; | 138 | bool forceshow : 1; |
128 | bool nomaximize : 1; | 139 | bool nomaximize : 1; |
129 | bool keep_running : 1; | 140 | bool keep_running : 1; |
130 | bool qcopQok : 1; | 141 | bool qcopQok : 1; |
131 | 142 | ||
143 | QCString fontFamily; | ||
144 | int fontSize; | ||
145 | int smallIconSize; | ||
146 | int bigIconSize; | ||
132 | 147 | ||
133 | QStringList langs; | 148 | QStringList langs; |
134 | QString appName; | 149 | QString appName; |
135 | struct QCopRec | 150 | struct QCopRec |
136 | { | 151 | { |
137 | QCopRec( const QCString &ch, const QCString &msg, | 152 | QCopRec( const QCString &ch, const QCString &msg, |
@@ -170,24 +185,18 @@ public: | |||
170 | #endif | 185 | #endif |
171 | 186 | ||
172 | delete r; | 187 | delete r; |
173 | } | 188 | } |
174 | } | 189 | } |
175 | 190 | ||
176 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName/* = QString::null */) | 191 | static void show_mx(QWidget* mw, bool nomaximize, QString &strName) |
192 | { | ||
193 | if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) | ||
177 | { | 194 | { |
178 | // ugly hack, remove that later after finding a sane solution | 195 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps ); |
179 | // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, | ||
180 | // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has | ||
181 | // a (physically) large enough display to use the small icons | ||
182 | #if defined(OPIE_HIGH_RES_SMALL_PHY) | ||
183 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { | ||
184 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); | ||
185 | } | 196 | } |
186 | #endif | ||
187 | |||
188 | QPoint p; | 197 | QPoint p; |
189 | QSize s; | 198 | QSize s; |
190 | bool max; | 199 | bool max; |
191 | if ( mw->isVisible() ) { | 200 | if ( mw->isVisible() ) { |
192 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { | 201 | if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) { |
193 | mw->resize(s); | 202 | mw->resize(s); |
@@ -793,29 +802,15 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | |||
793 | 802 | ||
794 | d = new QPEApplicationData; | 803 | d = new QPEApplicationData; |
795 | d->loadTextCodecs(); | 804 | d->loadTextCodecs(); |
796 | d->loadImageCodecs(); | 805 | d->loadImageCodecs(); |
797 | int dw = desktop() ->width(); | 806 | int dw = desktop() ->width(); |
798 | 807 | ||
799 | if ( dw < 200 ) { | 808 | setFont( QFont( d->fontFamily, d->fontSize ) ); |
800 | setFont( QFont( "vera", 8 ) ); | 809 | AppLnk::setSmallIconSize( d->smallIconSize ); |
801 | AppLnk::setSmallIconSize( 10 ); | 810 | AppLnk::setBigIconSize( d->bigIconSize ); |
802 | AppLnk::setBigIconSize( 28 ); | ||
803 | } | ||
804 | #if defined(OPIE_HIGH_RES_SMALL_PHY) | ||
805 | else if ( dw > 600 ) { | ||
806 | setFont( QFont( "vera", 16 ) ); | ||
807 | AppLnk::setSmallIconSize( 24 ); | ||
808 | AppLnk::setBigIconSize( 48 ); | ||
809 | } | ||
810 | #endif | ||
811 | else if ( dw > 200 ) { | ||
812 | setFont( QFont( "vera", 10 ) ); | ||
813 | AppLnk::setSmallIconSize( 14 ); | ||
814 | AppLnk::setBigIconSize( 32 ); | ||
815 | } | ||
816 | 811 | ||
817 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 812 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
818 | 813 | ||
819 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 814 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
820 | 815 | ||
821 | 816 | ||