author | mickeyl <mickeyl> | 2005-01-11 16:46:50 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-11 16:46:50 (UTC) |
commit | f82173157bdba4fa99afde9cc999bfe9b511ce07 (patch) (side-by-side diff) | |
tree | 5285a7aef75f2acf78c40d8a992193d029c55446 | |
parent | 0619c844b8a3054c6d6e480ba1c90e3f42e63873 (diff) | |
download | opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.zip opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.gz opie-f82173157bdba4fa99afde9cc999bfe9b511ce07.tar.bz2 |
number of icon columns now also customizable through LauncherSettings
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabconfig.h | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 14 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.h | 16 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 3 |
5 files changed, 26 insertions, 9 deletions
@@ -1,29 +1,30 @@ 2005-??-?? Opie 1.2.0 New Features ------------ * Number of icon columns in Launcher is customizable through Launcher.conf (hrw,zecke,mickeyl) + * Number of icon columns in Launcher is customizable through LauncherSettings (mickeyl) Fixed Bugs ---------- * #1501 - Fixed bug in todo sql backend (eilers) * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl) Internal -------- * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 2004-11-26 Opie 1.1.8 New Features ------------ * PackageManager supports installation of local ipkg files (drw) * PackageManager supports linking of applications to root (drw) * PackageManager supports src/gz feeds (drw,wimpie) * Added a syslog information tab to sysinfo (mickeyl) * Added new, more consistent, PIM icons + a GIMP teplate (ar) Fixed Bugs ---------- * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) * #1269 - VCards were imported into personal area if it was activated (eilers) diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 84ba073..7844673 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h @@ -22,48 +22,49 @@ -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __TABCONFIG_H__ #define __TABCONFIG_H__ struct TabConfig { enum ViewMode { Icon, List }; enum BackgroundType { Ruled, SolidColor, Image }; ViewMode m_view; BackgroundType m_bg_type; QString m_last_directory; QString m_bg_image; QString m_bg_color; + int m_iconcolumns; QString m_text_color; bool m_font_use; QString m_font_family; int m_font_size; int m_font_weight; bool m_font_italic; bool m_changed; bool operator == ( const TabConfig &tc ) { return ( m_view == tc. m_view ) && ( m_bg_type == tc. m_bg_type ) && ( m_bg_image == tc. m_bg_image ) && ( m_bg_color == tc. m_bg_color ) && ( m_text_color == tc. m_text_color ) && ( m_font_use == tc. m_font_use ) && ( m_font_use ? ( ( m_font_family == tc. m_font_family ) && ( m_font_size == tc. m_font_size ) && ( m_font_weight == tc. m_font_weight ) && ( m_font_italic == tc. m_font_italic ) ) : true ); } diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index cef92d9..abe310f 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp @@ -30,77 +30,80 @@ /* OPIE */ #include <opie2/ofontselector.h> #include <opie2/otabwidget.h> #include <opie2/ocolorbutton.h> #include <opie2/ofiledialog.h> #include <opie2/odebug.h> /* QPE */ #include <qpe/resource.h> #include <qpe/qpeapplication.h> /* QT */ #include <qlayout.h> #include <qvbox.h> #include <qtabbar.h> #include <qiconview.h> #include <qapplication.h> #include <qlabel.h> #include <qfileinfo.h> #include <qradiobutton.h> #include <qbuttongroup.h> #include <qwhatsthis.h> #include <qcheckbox.h> +#include <qspinbox.h> using namespace Opie::Ui; class SampleItem : public QIconViewItem { public: SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) { m_large = pix; m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); } void sizeChange ( ) { calcRect ( ); repaint ( ); } QPixmap *pixmap ( ) const { if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) return (QPixmap *) &m_small; else return (QPixmap *) &m_large; } private: QPixmap m_large, m_small; }; +//FIXME: Why not derive SampleView from LauncherView ??? + class SampleView : public QIconView { public: SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) { setItemsMovable ( false ); setAutoArrange ( true ); setSorting ( true ); setFrameStyle ( QFrame::NoFrame ); setSpacing ( 4 ); setMargin ( 0 ); setSelectionMode ( QIconView::NoSelection ); setBackgroundMode ( PaletteBase ); setViewMode ( TabConfig::Icon ); calculateGrid ( Bottom ); new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); setBackgroundType ( TabConfig::Ruled, QString::null ); setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); } @@ -173,48 +176,49 @@ public: m_bgtype = t; viewport ( )-> update ( ); } void setTextColor ( const QColor &tc ) { m_textcolor = tc; QColorGroup cg = colorGroup ( ); cg. setColor ( QColorGroup::Text, tc ); setPalette ( QPalette ( cg, cg, cg )); viewport ( )-> update ( ); } void setViewFont ( const QFont &f ) { setFont ( f ); } void setItemTextPos ( ItemTextPos pos ) { calculateGrid ( pos ); QIconView::setItemTextPos( pos ); } + //FIXME: Add per-tab column handling from launcherview.cpp void calculateGrid ( ItemTextPos pos ) { int dw = QApplication::desktop ( )-> width ( ); int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); if ( pos == Bottom ) { int cols = 3; if ( viewerWidth <= 200 ) cols = 2; else if ( viewerWidth >= 400 ) cols = viewerWidth/96; setSpacing ( 4 ); setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); } else { int cols = 2; if ( viewerWidth < 150 ) cols = 1; else if ( viewerWidth >= 400 ) cols = viewerWidth / 150; setSpacing ( 2 ); setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); setGridY ( fontMetrics ( ). height ( ) + 2 ); } @@ -395,60 +399,65 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) } QWidget *TabDialog::createIconTab ( QWidget *parent ) { QWidget *tab = new QWidget( parent, "IconTab" ); QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); QGridLayout* gridLayout = new QGridLayout ( vertLayout ); gridLayout-> setColStretch ( 1, 10 ); QLabel* label = new QLabel( tr( "Size:" ), tab ); gridLayout-> addWidget ( label, 0, 0 ); m_iconsize = new QButtonGroup( tab, "buttongroup" ); m_iconsize-> hide ( ); m_iconsize-> setExclusive ( true ); QRadioButton *rb; rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); m_iconsize-> insert ( rb, TabConfig::List ); gridLayout-> addWidget( rb, 0, 1 ); rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); m_iconsize-> insert ( rb, TabConfig::Icon ); gridLayout-> addWidget( rb, 1, 1 ); - connect ( m_iconsize, SIGNAL( clicked(int)), this, SLOT( iconSizeClicked(int))); - gridLayout-> addRowSpacing ( 2, 8 ); label = new QLabel ( tr( "Color:" ), tab ); gridLayout-> addWidget ( label, 3, 0 ); + gridLayout-> addRowSpacing ( 3, 8 ); m_iconcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_text_color ) ); connect ( m_iconcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( iconColorClicked(const QColor&))); gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); + label = new QLabel( tr( "Columns:" ), tab ); + gridLayout->addWidget( label, 4, 0 ); + m_iconcolumns = new QSpinBox( 0, 10, 1, tab, "iconspinbox" ); + m_iconcolumns->setSpecialValueText( tr( "Automatic" ) ); + gridLayout->addWidget( m_iconcolumns, 4, 1, AlignLeft ); + vertLayout-> addStretch ( 10 ); if ( m_tc.m_last_directory == QString::null ) { m_tc.m_last_directory = QPEApplication::documentDir(); } return tab; } void TabDialog::iconSizeClicked ( int s ) { m_sample-> setViewMode ((TabConfig::ViewMode) s ); } void TabDialog::fontClicked ( const QFont &f ) { m_sample-> setViewFont ( f ); } void TabDialog::bgTypeClicked ( int t ) { QString s; @@ -485,40 +494,41 @@ void TabDialog::bgImageClicked ( ) QStringList list; list << "image/*"; types. insert ( "Images", list ); QString file = OFileDialog::getOpenFileName ( 1, m_tc.m_last_directory, QString::null, types ); if ( !file. isEmpty ( )) { m_tc.m_last_directory = QFileInfo( file ).dirPath(); m_bgimage = DocLnk ( file ). file ( ); bgTypeClicked ( TabConfig::Image ); } } void TabDialog::bgDefaultClicked ( ) { m_bgimage = "launcher/opie-background"; bgTypeClicked ( TabConfig::Image ); } void TabDialog::accept ( ) { m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); + m_tc. m_iconcolumns = m_iconcolumns-> value( ); m_tc. m_bg_image = m_bgimage; m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); m_tc. m_font_use = m_fontuse-> isChecked ( ); if ( m_tc. m_font_use ) { QFont f = m_fontselect-> selectedFont ( ); m_tc. m_font_family = f. family ( ); m_tc. m_font_size = f. pointSize ( ); m_tc. m_font_weight = f. weight ( ); m_tc. m_font_italic = f. italic ( ); } QDialog::accept ( ); } diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h index 46b7ae9..9381237 100644 --- a/core/settings/launcher/tabdialog.h +++ b/core/settings/launcher/tabdialog.h @@ -1,81 +1,83 @@ /* =. This file is part of the OPIE Project - .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> + .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. -++= -. .` .: +++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __TABDIALOG_H__ #define __TABDIALOG_H__ #include <qdialog.h> #include "tabconfig.h" class QButtonGroup; namespace Opie {namespace Ui {class OFontSelector;}} class SampleView; namespace Opie {class OColorButton;} class QPushButton; class QCheckBox; +class QSpinBox; class TabDialog : public QDialog { Q_OBJECT public: TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *dname = 0, bool modal = false, WFlags = 0 ); - virtual ~TabDialog ( ); + virtual ~TabDialog ( ); public slots: virtual void accept ( ); protected slots: void iconSizeClicked ( int ); void fontClicked ( const QFont & ); void bgTypeClicked ( int ); void bgColorClicked ( const QColor & ); void iconColorClicked ( const QColor & ); void bgImageClicked ( ); void bgDefaultClicked ( ); private: QWidget *createBgTab ( QWidget *parent ); QWidget *createFontTab ( QWidget *parent ); QWidget *createIconTab ( QWidget *parent ); - - + + private: SampleView *m_sample; QButtonGroup *m_iconsize; Opie::Ui::OFontSelector *m_fontselect; Opie::OColorButton *m_solidcolor; Opie::OColorButton *m_iconcolor; + QSpinBox *m_iconcolumns; QPushButton *m_imagebrowse; - QString m_bgimage; + QString m_bgimage; QButtonGroup *m_bgtype; QCheckBox *m_fontuse; - + TabConfig &m_tc; }; #endif diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index 5ac625b..ab64331 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp @@ -114,81 +114,83 @@ void TabsSettings::init ( ) pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); m_list-> insertItem ( pix, tr( "Documents" )); m_ids += "Documents"; // No tr Config cfg ( "Launcher" ); readTabSettings ( cfg ); cfg. setGroup ( "GUI" ); m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); } void TabsSettings::readTabSettings ( Config &cfg ) { QString grp ( "Tab %1" ); // No tr m_tabs. clear ( ); TabConfig global_def; global_def. m_view = TabConfig::Icon; global_def. m_bg_type = TabConfig::Ruled; global_def. m_bg_image = "launcher/opie-background"; global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); + global_def. m_iconcolumns = 0; // automatic global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); global_def. m_font_use = false; global_def. m_font_family = font ( ). family ( ); global_def. m_font_size = font ( ). pointSize ( ); global_def. m_font_weight = 50; global_def. m_font_italic = false; global_def. m_changed = false; Config cfg2 = Config( "Launchersettings" ); for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; cfg. setGroup ( grp. arg ( *it )); cfg2. setGroup( grp. arg ( *it )); QString view = cfg. readEntry ( "View" ); if ( view == "Icon" ) // No tr tc. m_view = TabConfig::Icon; if ( view == "List" ) // No tr tc. m_view = TabConfig::List; QString bgType = cfg. readEntry ( "BackgroundType" ); if ( bgType == "Image" ) tc. m_bg_type = TabConfig::Image; else if ( bgType == "SolidColor" ) tc. m_bg_type = TabConfig::SolidColor; else if ( bgType == "Image" ) // No tr tc. m_bg_type = TabConfig::Image; tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); + tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); QStringList f = cfg. readListEntry ( "Font", ',' ); if ( f. count ( ) == 4 ) { tc. m_font_use = true; tc. m_font_family = f [0]; tc. m_font_size = f [1]. toInt ( ); tc. m_font_weight = f [2]. toInt ( ); tc. m_font_italic = ( f [3]. toInt ( )); } m_tabs [*it] = tc; } // if all tabs have the same config, then initialize the GLOBALID tab to these values TabConfig *first = 0; bool same = true; for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { if ( *it == GLOBALID ) continue; else if ( !first ) first = &m_tabs [*it]; else same &= ( *first == m_tabs [*it] ); @@ -209,48 +211,49 @@ void TabsSettings::accept ( ) QString grp ( "Tab %1" ); // No tr for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { TabConfig &tc = m_tabs [*it]; if ( !tc. m_changed ) continue; cfg. setGroup ( grp. arg ( *it )); cfg2. setGroup ( grp. arg ( *it )); switch ( tc. m_view ) { case TabConfig::Icon: cfg.writeEntry ( "View", "Icon" ); break; case TabConfig::List: cfg.writeEntry ( "View", "List" ); break; } QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); e << *it << tc. m_view; cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); + cfg. writeEntry ( "Columns", tc. m_iconcolumns ); cfg. writeEntry ( "TextColor", tc. m_text_color ); cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); if ( tc. m_font_use ) { QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); cfg. writeEntry ( "Font", f ); } else cfg. removeEntry ( "Font" ); QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); switch ( tc. m_bg_type ) { case TabConfig::Ruled: cfg.writeEntry( "BackgroundType", "Ruled" ); be << *it << tc. m_bg_type << QString(""); break; case TabConfig::SolidColor: cfg.writeEntry( "BackgroundType", "SolidColor" ); be << *it << tc. m_bg_type << tc. m_bg_color; break; case TabConfig::Image: cfg.writeEntry( "BackgroundType", "Image" ); be << *it << tc. m_bg_type << tc. m_bg_image; |