summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-10 23:47:36 (UTC)
committer mickeyl <mickeyl>2005-01-10 23:47:36 (UTC)
commit32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e (patch) (unidiff)
tree7b8bcf86b76b4c44ca96f60e2c2594995c74fbb6
parentdd649f98d0010711ed3d0fac433bd9fafa4002db (diff)
downloadopie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.zip
opie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.tar.gz
opie-32e8aa951218c0bd6118ee04bb22ef83b3b7ec2e.tar.bz2
make number of icon columns in the launcher customizable per-tab
TODO: add GUI for that
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--core/launcher/launcher.cpp1
-rw-r--r--core/launcher/launcherview.cpp38
-rw-r--r--core/launcher/launcherview.h5
4 files changed, 32 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 8847714..fdaaa25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,16 +1,17 @@
1 2005-??-??Opie 1.2.0 1 2005-??-??Opie 1.2.0
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl)
5 6
6 Fixed Bugs 7 Fixed Bugs
7 ---------- 8 ----------
8 * #1501 - Fixed bug in todo sql backend (eilers) 9 * #1501 - Fixed bug in todo sql backend (eilers)
9 * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) 10 * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
10 11
11 Internal 12 Internal
12 -------- 13 --------
13 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 14 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
14 15
15 2004-11-26Opie 1.1.8 16 2004-11-26Opie 1.1.8
16 17
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 970b8cb..4f81076 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -280,24 +280,25 @@ void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg )
280 QString c = cfg.readEntry( "BackgroundColor" ); 280 QString c = cfg.readEntry( "BackgroundColor" );
281 v->setBackgroundType( LauncherView::SolidColor, c ); 281 v->setBackgroundType( LauncherView::SolidColor, c );
282 } else { 282 } else {
283 v->setBackgroundType( LauncherView::Ruled, QString::null ); 283 v->setBackgroundType( LauncherView::Ruled, QString::null );
284 } 284 }
285 QString textCol = cfg.readEntry( "TextColor" ); 285 QString textCol = cfg.readEntry( "TextColor" );
286 if ( textCol.isEmpty() ) 286 if ( textCol.isEmpty() )
287 v->setTextColor( QColor() ); 287 v->setTextColor( QColor() );
288 else 288 else
289 v->setTextColor( QColor(textCol) ); 289 v->setTextColor( QColor(textCol) );
290// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); 290// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE );
291 291
292 v->setColNumber( cfg.readNumEntry( "Columns", 0 ) );
292 293
293 QStringList font = cfg.readListEntry( "Font", ',' ); 294 QStringList font = cfg.readListEntry( "Font", ',' );
294 if ( font.count() == 4 ) 295 if ( font.count() == 4 )
295 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 296 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
296 297
297 // ### FIXME TabColor TabTextColor 298 // ### FIXME TabColor TabTextColor
298 299
299} 300}
300 301
301// ### Could move to LauncherTab 302// ### Could move to LauncherTab
302void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg ) 303void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg )
303{ 304{
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index dc4c57f..9d78c0d 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -13,24 +13,25 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "launcherview.h" 21#include "launcherview.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qpe/config.h>
25#include <qtopia/qpeapplication.h> 26#include <qtopia/qpeapplication.h>
26#include <qtopia/private/categories.h> 27#include <qtopia/private/categories.h>
27#include <qtopia/categoryselect.h> 28#include <qtopia/categoryselect.h>
28#include <qtopia/mimetype.h> 29#include <qtopia/mimetype.h>
29#include <qtopia/resource.h> 30#include <qtopia/resource.h>
30using namespace Opie::Core; 31using namespace Opie::Core;
31 32
32#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
33 34
34/* QT */ 35/* QT */
35#include <qtimer.h> 36#include <qtimer.h>
36#include <qfileinfo.h> 37#include <qfileinfo.h>
@@ -273,25 +274,25 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon)
273 if (!isEyeImage()) return; 274 if (!isEyeImage()) return;
274 setPixmap(aIcon); 275 setPixmap(aIcon);
275 m_EyeImageSet = EYE_ICON; 276 m_EyeImageSet = EYE_ICON;
276} 277}
277 278
278//=========================================================================== 279//===========================================================================
279// Implemantation of LauncherIconview start 280// Implemantation of LauncherIconview start
280//=========================================================================== 281//===========================================================================
281 282
282QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; 283QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0;
283 284
284LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) 285LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
285 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) 286 : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white),numColumns(0)
286{ 287{
287 m_EyeCallBack = 0; 288 m_EyeCallBack = 0;
288 if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); 289 if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>();
289 sortmeth = Name; 290 sortmeth = Name;
290 hidden.setAutoDelete(TRUE); 291 hidden.setAutoDelete(TRUE);
291 ike = FALSE; 292 ike = FALSE;
292 calculateGrid( Bottom ); 293 calculateGrid( Bottom );
293 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); 294 connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
294} 295}
295 296
296LauncherIconView::~LauncherIconView() 297LauncherIconView::~LauncherIconView()
297{ 298{
@@ -616,40 +617,40 @@ void LauncherIconView::setBigIcons( bool bi )
616QIconViewItem* LauncherIconView::busyItem() const 617QIconViewItem* LauncherIconView::busyItem() const
617{ 618{
618 return bsy; 619 return bsy;
619} 620}
620 621
621void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 622void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
622 623
623void LauncherIconView::calculateGrid( ItemTextPos pos ) 624void LauncherIconView::calculateGrid( ItemTextPos pos )
624{ 625{
625 int dw = QApplication::desktop()->width(); 626 int dw = QApplication::desktop()->width();
626 int viewerWidth = dw-style().scrollBarExtent().width(); 627 int viewerWidth = dw-style().scrollBarExtent().width();
627 if ( pos == Bottom ) { 628 if ( pos == Bottom ) {
628 int cols = 3; 629 if( !numColumns ) {
629 if ( viewerWidth <= 200 ) 630 if ( viewerWidth <= 200 ) numColumns = 2;
630 cols = 2; 631 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96;
631 else if ( viewerWidth >= 400 ) 632 else numColumns = 3;
632 cols = viewerWidth/96; 633 }
633 setSpacing( 4 ); 634 setSpacing( 4 );
634 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 635 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
635 setGridY( fontMetrics().height()*2+24 ); 636 setGridY( fontMetrics().height()*2+24 );
636 } else { 637 } else {
637 int cols = 2; 638 if( !numColumns ) {
638 if ( viewerWidth < 150 ) 639 if ( viewerWidth < 150 ) numColumns = 1;
639 cols = 1; 640 else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150;
640 else if ( viewerWidth >= 400 ) 641 else numColumns = 2;
641 cols = viewerWidth/150; 642 }
642 setSpacing( 2 ); 643 setSpacing( 2 );
643 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 644 setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns );
644 setGridY( fontMetrics().height()+2 ); 645 setGridY( fontMetrics().height()+2 );
645 } 646 }
646} 647}
647 648
648void LauncherIconView::styleChange( QStyle &old ) 649void LauncherIconView::styleChange( QStyle &old )
649{ 650{
650 QIconView::styleChange( old ); 651 QIconView::styleChange( old );
651 calculateGrid( itemTextPos() ); 652 calculateGrid( itemTextPos() );
652} 653}
653 654
654void LauncherIconView::keyPressEvent(QKeyEvent* e) 655void LauncherIconView::keyPressEvent(QKeyEvent* e)
655{ 656{
@@ -994,24 +995,35 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val )
994 w->setBackgroundOrigin( ParentOrigin ); 995 w->setBackgroundOrigin( ParentOrigin );
995 } 996 }
996 } 997 }
997 } 998 }
998 delete list; 999 delete list;
999 1000
1000 bgType = t; 1001 bgType = t;
1001 icons->viewport()->update(); 1002 icons->viewport()->update();
1002 1003
1003 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) ); 1004 QTimer::singleShot( 1000, this, SLOT(flushBgCache()) );
1004} 1005}
1005 1006
1007void LauncherView::setColNumber( int num )
1008{
1009 icons->setColNumber( num );
1010}
1011
1012void LauncherIconView::setColNumber( int num )
1013{
1014 numColumns = num;
1015 calculateGrid( Bottom );
1016}
1017
1006void LauncherView::setTextColor( const QColor &tc ) 1018void LauncherView::setTextColor( const QColor &tc )
1007{ 1019{
1008 textCol = tc; 1020 textCol = tc;
1009 QColorGroup cg = icons->colorGroup(); 1021 QColorGroup cg = icons->colorGroup();
1010 cg.setColor( QColorGroup::Text, tc ); 1022 cg.setColor( QColorGroup::Text, tc );
1011 icons->setPalette( QPalette(cg,cg,cg) ); 1023 icons->setPalette( QPalette(cg,cg,cg) );
1012 icons->viewport()->update(); 1024 icons->viewport()->update();
1013} 1025}
1014 1026
1015void LauncherView::setViewFont( const QFont &f ) 1027void LauncherView::setViewFont( const QFont &f )
1016{ 1028{
1017 icons->setFont( f ); 1029 icons->setFont( f );
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 05073ab..e2869eb 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -73,24 +73,26 @@ public:
73 void setViewMode( ViewMode m ); 73 void setViewMode( ViewMode m );
74 ViewMode viewMode() const { return vmode; } 74 ViewMode viewMode() const { return vmode; }
75 75
76 enum BackgroundType { Ruled, SolidColor, Image }; 76 enum BackgroundType { Ruled, SolidColor, Image };
77 void setBackgroundType( BackgroundType t, const QString & ); 77 void setBackgroundType( BackgroundType t, const QString & );
78 BackgroundType backgroundType() const { return bgType; } 78 BackgroundType backgroundType() const { return bgType; }
79 79
80 void setTextColor( const QColor & ); 80 void setTextColor( const QColor & );
81 QColor textColor() const { return textCol; } 81 QColor textColor() const { return textCol; }
82 82
83 void setViewFont( const QFont & ); 83 void setViewFont( const QFont & );
84 void clearViewFont(); 84 void clearViewFont();
85
86 void setColNumber( int );
85 87
86 void relayout(void); 88 void relayout(void);
87 89
88signals: 90signals:
89 void clicked( const AppLnk * ); 91 void clicked( const AppLnk * );
90 void rightPressed( AppLnk * ); 92 void rightPressed( AppLnk * );
91 93
92protected slots: 94protected slots:
93 void selectionChanged(); 95 void selectionChanged();
94 void returnPressed( QIconViewItem *item ); 96 void returnPressed( QIconViewItem *item );
95 void itemClicked( int, QIconViewItem * ); 97 void itemClicked( int, QIconViewItem * );
96 void itemPressed( int, QIconViewItem * ); 98 void itemPressed( int, QIconViewItem * );
@@ -187,24 +189,26 @@ public:
187 void addCatsAndMimes(AppLnk* app); 189 void addCatsAndMimes(AppLnk* app);
188 190
189 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {} 191 void setBackgroundOrigin( QWidget::BackgroundOrigin ) {}
190 192
191 void setBackgroundPixmap( const QPixmap &pm ) { 193 void setBackgroundPixmap( const QPixmap &pm ) {
192 bgPixmap = pm; 194 bgPixmap = pm;
193 } 195 }
194 196
195 void setBackgroundColor( const QColor &c ) { 197 void setBackgroundColor( const QColor &c ) {
196 bgColor = c; 198 bgColor = c;
197 } 199 }
198 200
201 void setColNumber( int );
202
199 void drawBackground( QPainter *p, const QRect &r ); 203 void drawBackground( QPainter *p, const QRect &r );
200 void setItemTextPos( ItemTextPos pos ); 204 void setItemTextPos( ItemTextPos pos );
201 void hideOrShowItems(bool resort); 205 void hideOrShowItems(bool resort);
202 206
203 void setTypeFilter(const QString& typefilter, bool resort); 207 void setTypeFilter(const QString& typefilter, bool resort);
204 void setCategoryFilter( int catfilter, bool resort ); 208 void setCategoryFilter( int catfilter, bool resort );
205 209
206 enum SortMethod { Name, Date, Type }; 210 enum SortMethod { Name, Date, Type };
207 211
208 void setSortMethod( SortMethod m ); 212 void setSortMethod( SortMethod m );
209 int compare(const AppLnk* a, const AppLnk* b); 213 int compare(const AppLnk* a, const AppLnk* b);
210 void requestEyePix(const LauncherItem*which); 214 void requestEyePix(const LauncherItem*which);
@@ -236,15 +240,16 @@ private:
236 LauncherItem* bsy; 240 LauncherItem* bsy;
237 int busyTimer; 241 int busyTimer;
238 bool ike; 242 bool ike;
239 bool bigIcns; 243 bool bigIcns;
240 QPixmap bgPixmap; 244 QPixmap bgPixmap;
241 QColor bgColor; 245 QColor bgColor;
242 LauncherThumbReceiver*m_EyeCallBack; 246 LauncherThumbReceiver*m_EyeCallBack;
243#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 247#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
244 QPixmap busyPix; 248 QPixmap busyPix;
245#endif 249#endif
246 BusyIndicatorType busyType; 250 BusyIndicatorType busyType;
247 QTimer m_eyeTimer; 251 QTimer m_eyeTimer;
252 int numColumns;
248}; 253};
249 254
250#endif // LAUNCHERVIEW_H 255#endif // LAUNCHERVIEW_H