author | harlekin <harlekin> | 2002-09-21 21:15:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-21 21:15:59 (UTC) |
commit | 2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c (patch) (unidiff) | |
tree | 5f302398099f158e8df188420e817017b1acb160 | |
parent | 023b34ea1584474a0ba625be4b099cb9a2de376c (diff) | |
download | opie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.zip opie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.tar.gz opie-2e6dd40a0ba17ccf5503fa02bec810b0eeb82f8c.tar.bz2 |
code cleanups
-rw-r--r-- | core/pim/today/today.cpp | 6 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 901a61a..7673df5 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -164,100 +164,100 @@ void Today::loadPlugins() { | |||
164 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 164 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
165 | QPixmap plugPix; | 165 | QPixmap plugPix; |
166 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | 166 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); |
167 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 167 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
168 | plugIcon->setPixmap( plugPix ); | 168 | plugIcon->setPixmap( plugPix ); |
169 | // a scrollview for each plugin | 169 | // a scrollview for each plugin |
170 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 170 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
171 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 171 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
172 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | 172 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); |
173 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 173 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
174 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 174 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
175 | sv->setFrameShape( QFrame::NoFrame ); | 175 | sv->setFrameShape( QFrame::NoFrame ); |
176 | sv->addChild( plugWidget ); | 176 | sv->addChild( plugWidget ); |
177 | // make sure the icon is on the top alligned | 177 | // make sure the icon is on the top alligned |
178 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 178 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
179 | boxLayout->addWidget( sv, 0, AlignTop ); | 179 | boxLayout->addWidget( sv, 0, AlignTop ); |
180 | boxLayout->setStretchFactor( plugIcon, 1 ); | 180 | boxLayout->setStretchFactor( plugIcon, 1 ); |
181 | boxLayout->setStretchFactor( sv, 9 ); | 181 | boxLayout->setStretchFactor( sv, 9 ); |
182 | // "prebuffer" it in one more list, to get the sorting done | 182 | // "prebuffer" it in one more list, to get the sorting done |
183 | tempList.insert( plugin.name, plugin ); | 183 | tempList.insert( plugin.name, plugin ); |
184 | 184 | ||
185 | // on first start the list is off course empty | 185 | // on first start the list is off course empty |
186 | if ( m_allApplets.isEmpty() ) { | 186 | if ( m_allApplets.isEmpty() ) { |
187 | layout->addWidget( plugin.guiBox ); | 187 | layout->addWidget( plugin.guiBox ); |
188 | pluginList.append( plugin ); | 188 | pluginList.append( plugin ); |
189 | } | 189 | } |
190 | } else { | 190 | } else { |
191 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 191 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
192 | delete lib; | 192 | delete lib; |
193 | } | 193 | } |
194 | } | 194 | } |
195 | 195 | ||
196 | if ( !m_allApplets.isEmpty() ) { | 196 | if ( !m_allApplets.isEmpty() ) { |
197 | TodayPlugin tempPlugin; | 197 | TodayPlugin tempPlugin; |
198 | QStringList::Iterator stringit; | 198 | QStringList::Iterator stringit; |
199 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 199 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |
200 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 200 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
201 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 201 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
202 | layout->addWidget( tempPlugin.guiBox ); | 202 | layout->addWidget( tempPlugin.guiBox ); |
203 | pluginList.append( tempPlugin ); | 203 | pluginList.append( tempPlugin ); |
204 | } | 204 | } |
205 | } | 205 | } |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | /** | 210 | /** |
211 | * Repaint method. Reread all fields. | 211 | * Repaint method. Reread all fields. |
212 | */ | 212 | */ |
213 | void Today::draw() { | 213 | void Today::draw() { |
214 | 214 | ||
215 | if ( pluginList.count() == 0 ) { | 215 | if ( pluginList.count() == 0 ) { |
216 | QLabel *noPlugins = new QLabel( this ); | 216 | QLabel *noPlugins = new QLabel( this ); |
217 | noPlugins->setText( tr( "No plugins found" ) ); | 217 | noPlugins->setText( tr( "No plugins found" ) ); |
218 | layout->addWidget( noPlugins ); | 218 | layout->addWidget( noPlugins ); |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | 221 | ||
222 | uint count = 0; | 222 | uint count = 0; |
223 | TodayPlugin plugin; | 223 | TodayPlugin plugin; |
224 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 224 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
225 | plugin = pluginList[i]; | 225 | plugin = pluginList[i]; |
226 | 226 | ||
227 | if ( plugin.active ) { | 227 | if ( plugin.active ) { |
228 | qDebug( plugin.name + " is ACTIVE " ); | 228 | // qDebug( plugin.name + " is ACTIVE " ); |
229 | plugin.guiBox->show(); | 229 | plugin.guiBox->show(); |
230 | } else { | 230 | } else { |
231 | qDebug( plugin.name + " is INACTIVE" ); | 231 | // qDebug( plugin.name + " is INACTIVE" ); |
232 | plugin.guiBox->hide(); | 232 | plugin.guiBox->hide(); |
233 | } | 233 | } |
234 | count++; | 234 | count++; |
235 | } | 235 | } |
236 | 236 | ||
237 | if ( count == 0 ) { | 237 | if ( count == 0 ) { |
238 | QLabel *noPluginsActive = new QLabel( this ); | 238 | QLabel *noPluginsActive = new QLabel( this ); |
239 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 239 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
240 | layout->addWidget( noPluginsActive ); | 240 | layout->addWidget( noPluginsActive ); |
241 | } | 241 | } |
242 | layout->addStretch(0); | 242 | layout->addStretch(0); |
243 | } | 243 | } |
244 | 244 | ||
245 | 245 | ||
246 | /** | 246 | /** |
247 | * The method for the configuration dialog. | 247 | * The method for the configuration dialog. |
248 | */ | 248 | */ |
249 | void Today::startConfig() { | 249 | void Today::startConfig() { |
250 | 250 | ||
251 | TodayConfig conf( this, "dialog", true ); | 251 | TodayConfig conf( this, "dialog", true ); |
252 | 252 | ||
253 | TodayPlugin plugin; | 253 | TodayPlugin plugin; |
254 | QList<ConfigWidget> configWidgetList; | 254 | QList<ConfigWidget> configWidgetList; |
255 | 255 | ||
256 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 256 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
257 | plugin = pluginList[i]; | 257 | plugin = pluginList[i]; |
258 | 258 | ||
259 | // load the config widgets in the tabs | 259 | // load the config widgets in the tabs |
260 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 260 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
261 | ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 261 | ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
262 | configWidgetList.append( widget ); | 262 | configWidgetList.append( widget ); |
263 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | 263 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 800ca5d..1424b95 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -5,66 +5,64 @@ | |||
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todaybase.h" | 17 | #include "todaybase.h" |
18 | 18 | ||
19 | #include <qframe.h> | 19 | #include <qframe.h> |
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | 24 | ||
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | 26 | ||
27 | 27 | ||
28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | 28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) |
29 | : QWidget( parent, name, fl ) { | 29 | : QWidget( parent, name, fl ) { |
30 | 30 | ||
31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla | 32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla |
33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | 33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon |
34 | 34 | ||
35 | layout = new QVBoxLayout( this ); | 35 | layout = new QVBoxLayout( this ); |
36 | 36 | ||
37 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | ||
38 | |||
39 | QPalette pal = this->palette(); | 37 | QPalette pal = this->palette(); |
40 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 38 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
41 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 39 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
42 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 40 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
43 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 41 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
44 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 42 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
45 | this->setPalette( pal ); | 43 | this->setPalette( pal ); |
46 | 44 | ||
47 | // --- logo Section --- | 45 | // --- logo Section --- |
48 | QPalette pal2; | 46 | QPalette pal2; |
49 | QColorGroup cg; | 47 | QColorGroup cg; |
50 | cg.setColor( QColorGroup::Text, white ); | 48 | cg.setColor( QColorGroup::Text, white ); |
51 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); | 49 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); |
52 | pal2.setActive( cg ); | 50 | pal2.setActive( cg ); |
53 | // today logo | 51 | // today logo |
54 | Frame = new QLabel( this, "Frame" ); | 52 | Frame = new QLabel( this, "Frame" ); |
55 | Frame->setPalette( pal2 ); | 53 | Frame->setPalette( pal2 ); |
56 | Frame->setFrameShape( QFrame::StyledPanel ); | 54 | Frame->setFrameShape( QFrame::StyledPanel ); |
57 | Frame->setFrameShadow( QFrame::Raised ); | 55 | Frame->setFrameShadow( QFrame::Raised ); |
58 | Frame->setLineWidth( 0 ); | 56 | Frame->setLineWidth( 0 ); |
59 | Frame->setMaximumHeight( 50 ); | 57 | Frame->setMaximumHeight( 50 ); |
60 | Frame->setMinimumHeight( 50 ); | 58 | Frame->setMinimumHeight( 50 ); |
61 | 59 | ||
62 | // Today text | 60 | // Today text |
63 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); | 61 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); |
64 | TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); | 62 | TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); |
65 | QFont TodayLabel_font( TodayLabel->font() ); | 63 | QFont TodayLabel_font( TodayLabel->font() ); |
66 | TodayLabel_font.setBold( TRUE ); | 64 | TodayLabel_font.setBold( TRUE ); |
67 | TodayLabel_font.setPointSize( 40 ); | 65 | TodayLabel_font.setPointSize( 40 ); |
68 | TodayLabel->setFont( TodayLabel_font ); | 66 | TodayLabel->setFont( TodayLabel_font ); |
69 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 67 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
70 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" ); | 68 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" ); |