-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 1 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 38 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 5 |
4 files changed, 32 insertions, 13 deletions
@@ -4,2 +4,3 @@ | |||
4 | ------------ | 4 | ------------ |
5 | * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) | ||
5 | 6 | ||
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 | |||
@@ -291,2 +291,3 @@ void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) | |||
291 | 291 | ||
292 | v->setColNumber( cfg.readNumEntry( "Columns", 0 ) ); | ||
292 | 293 | ||
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 | |||
@@ -24,2 +24,3 @@ | |||
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> |
@@ -284,3 +285,3 @@ QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; | |||
284 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) | 285 | LauncherIconView::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 | { |
@@ -627,18 +628,18 @@ void LauncherIconView::calculateGrid( ItemTextPos pos ) | |||
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 ); |
@@ -1005,2 +1006,13 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | |||
1005 | 1006 | ||
1007 | void LauncherView::setColNumber( int num ) | ||
1008 | { | ||
1009 | icons->setColNumber( num ); | ||
1010 | } | ||
1011 | |||
1012 | void LauncherIconView::setColNumber( int num ) | ||
1013 | { | ||
1014 | numColumns = num; | ||
1015 | calculateGrid( Bottom ); | ||
1016 | } | ||
1017 | |||
1006 | void LauncherView::setTextColor( const QColor &tc ) | 1018 | void LauncherView::setTextColor( const QColor &tc ) |
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 | |||
@@ -84,2 +84,4 @@ public: | |||
84 | void clearViewFont(); | 84 | void clearViewFont(); |
85 | |||
86 | void setColNumber( int ); | ||
85 | 87 | ||
@@ -198,2 +200,4 @@ public: | |||
198 | 200 | ||
201 | void setColNumber( int ); | ||
202 | |||
199 | void drawBackground( QPainter *p, const QRect &r ); | 203 | void drawBackground( QPainter *p, const QRect &r ); |
@@ -247,2 +251,3 @@ private: | |||
247 | QTimer m_eyeTimer; | 251 | QTimer m_eyeTimer; |
252 | int numColumns; | ||
248 | }; | 253 | }; |