summaryrefslogtreecommitdiff
path: root/core
authorsandman <sandman>2002-09-24 23:54:38 (UTC)
committer sandman <sandman>2002-09-24 23:54:38 (UTC)
commit64110f43896391053f662186228a4fad2280f717 (patch) (side-by-side diff)
treeb2f94a61a8de8b95a29c88d513525e7478b1d8c9 /core
parent5ae62a1def1d21c4827560607b208033d6054ed0 (diff)
downloadopie-64110f43896391053f662186228a4fad2280f717.zip
opie-64110f43896391053f662186228a4fad2280f717.tar.gz
opie-64110f43896391053f662186228a4fad2280f717.tar.bz2
beta version - not fully functional
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/launcher.pro7
-rw-r--r--core/settings/launcher/launchersettings.cpp2
-rw-r--r--core/settings/launcher/tabconfig.h25
-rw-r--r--core/settings/launcher/tabdialog.cpp381
-rw-r--r--core/settings/launcher/tabdialog.h40
-rw-r--r--core/settings/launcher/tabssettings.cpp170
-rw-r--r--core/settings/launcher/tabssettings.h31
7 files changed, 571 insertions, 85 deletions
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index a46a22f..484b159 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -1,17 +1,20 @@
TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = launchersettings.h \
tabssettings.h \
- taskbarsettings.h
+ taskbarsettings.h \
+ tabconfig.h \
+ tabdialog.h
SOURCES = main.cpp \
launchersettings.cpp \
tabssettings.cpp \
- taskbarsettings.cpp
+ taskbarsettings.cpp \
+ tabdialog.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = launchersettings
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index b794519..bcb9913 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -19,12 +19,14 @@ LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false
m_tabs = new TabsSettings ( tw );
m_taskbar = new TaskbarSettings ( tw );
tw-> addTab ( m_taskbar, "appearance/styletabicon.png", tr( "Taskbar" ));
tw-> addTab ( m_tabs, "appearance/styletabicon.png", tr( "Tabs" ));
+
+ tw-> setCurrentTab ( m_taskbar );
}
void LauncherSettings::accept ( )
{
m_taskbar-> accept ( );
m_tabs-> accept ( );
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
new file mode 100644
index 0000000..52ae81f
--- a/dev/null
+++ b/core/settings/launcher/tabconfig.h
@@ -0,0 +1,25 @@
+#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_bg_image;
+ QString m_bg_color;
+ QString m_text_color;
+ QString m_font_family;
+ int m_font_size;
+ bool m_changed;
+};
+
+#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
new file mode 100644
index 0000000..7b01cc7
--- a/dev/null
+++ b/core/settings/launcher/tabdialog.cpp
@@ -0,0 +1,381 @@
+
+#include <qpe/resource.h>
+#include <qpe/config.h>
+
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qtabbar.h>
+#include <qiconview.h>
+#include <qapplication.h>
+#include <qlabel.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+
+#include <opie/ofontselector.h>
+#include <opie/otabwidget.h>
+#include <opie/ocolorbutton.h>
+
+#include "tabdialog.h"
+
+
+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;
+};
+
+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, tr( "Sample 1" ), Resource::loadPixmap ( "DateBook" ));
+ new SampleItem ( this, tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" ));
+ new SampleItem ( this, tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" ));
+
+ setBackgroundType ( TabConfig::Ruled, QString::null );
+
+ setMaximumHeight ( firstItem ( )-> height ( ) + 16 );
+ }
+
+ void setViewMode ( TabConfig::ViewMode m )
+ {
+ viewport ( )-> setUpdatesEnabled ( false );
+
+ switch ( m ) {
+ case TabConfig::List:
+ setItemTextPos( QIconView::Right );
+ break;
+ case TabConfig::Icon:
+ setItemTextPos( QIconView::Bottom );
+ break;
+ }
+// hideOrShowItems ( false );
+
+ for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( ))
+ ((SampleItem *) it )-> sizeChange ( );
+ arrangeItemsInGrid ( true );
+ viewport ( )-> setUpdatesEnabled ( true );
+ update ( );
+ }
+
+
+ void setBackgroundType( TabConfig::BackgroundType t, const QString &val )
+ {
+ switch ( t ) {
+ case TabConfig::Ruled: {
+ QPixmap bg ( width ( ), 9 );
+ QPainter painter ( &bg );
+ for ( int i = 0; i < 3; i++ ) {
+ painter. setPen ( white );
+ painter. drawLine ( 0, i*3, width()-1, i*3 );
+ painter. drawLine ( 0, i*3+1, width()-1, i*3+1 );
+ painter. setPen ( colorGroup().background().light(105) );
+ painter. drawLine ( 0, i*3+2, width()-1, i*3+2 );
+ }
+ painter.end ( );
+ setBackgroundPixmap ( bg );
+ break;
+ }
+
+ case TabConfig::SolidColor: {
+ setBackgroundPixmap ( QPixmap ( ));
+ if ( val. isEmpty ( ))
+ setBackgroundColor ( colorGroup ( ). base ( ));
+ else
+ setBackgroundColor ( val );
+ break;
+ }
+
+ case TabConfig::Image: {
+ qDebug( "Loading image: %s", val.latin1() );
+ QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val ));
+ if ( bg. isNull ( )) {
+ QImageIO imgio;
+ imgio. setFileName ( val );
+ QSize ds = qApp-> desktop ( )-> size ( );
+ QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr
+ imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( ));
+ imgio. read ( );
+ bg = imgio. image ( );
+ }
+ setBackgroundPixmap ( bg );
+ break;
+ }
+ }
+ 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 );
+ }
+
+ 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 );
+ }
+ }
+
+ void paletteChange( const QPalette &p )
+ {
+ unsetPalette ( );
+ QIconView::paletteChange ( p );
+ if ( m_bgtype == TabConfig::Ruled )
+ setBackgroundType ( TabConfig::Ruled, QString::null );
+ QColorGroup cg = colorGroup ( );
+ cg.setColor ( QColorGroup::Text, m_textcolor );
+ setPalette ( QPalette ( cg, cg, cg ));
+ }
+
+ void setBackgroundPixmap ( const QPixmap &pm )
+ {
+ m_bgpix = pm;
+ }
+
+ void setBackgroundColor ( const QColor &c )
+ {
+ m_bgcolor = c;
+ }
+
+ void drawBackground ( QPainter *p, const QRect &r )
+ {
+ if ( !m_bgpix. isNull ( )) {
+ p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ),
+ ( r. y ( ) + contentsY ( )) % m_bgpix. height ( )));
+ }
+ else
+ p-> fillRect ( r, m_bgcolor );
+ }
+
+private:
+ QColor m_textcolor;
+ QColor m_bgcolor;
+ QPixmap m_bgpix;
+ TabConfig::BackgroundType m_bgtype;
+};
+
+
+
+TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *name, bool modal, WFlags fl )
+ : QDialog ( parent, name, modal, fl )
+{
+ setCaption ( tr( "Edit Tab" ));
+
+ QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
+
+ OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
+ QWidget *bgtab;
+
+ tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/backgroundtabicon.png", tr( "Background" ));
+ tw-> addTab ( createFontTab ( tw ), "appearance/fonttabicon.png", tr( "Font" ));
+ tw-> addTab ( createIconTab ( tw ), "appearance/colorstabicon.png", tr( "Icons" ) );
+
+ tw-> setCurrentTab ( bgtab );
+
+ QWidget *sample = new QVBox ( this );
+ QTabBar *tb = new QTabBar ( sample );
+ QString name ( tr( "Previewing %1" ). arg ( tabname ));
+
+ tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name ));
+
+ m_sample = new SampleView ( sample );
+
+ lay-> addWidget ( tw, 10 );
+ lay-> addWidget ( sample, 1 );
+}
+
+
+TabDialog::~TabDialog ( )
+{
+}
+
+QWidget *TabDialog::createFontTab ( QWidget *parent )
+{
+ Config config ( "qpe" );
+ config. setGroup ( "Appearance" );
+
+ QString familyStr = config.readEntry( "FontFamily", "Helvetica" );
+ QString styleStr = config.readEntry( "FontStyle", "Regular" );
+ int size = config.readNumEntry( "FontSize", 10 );
+
+ m_fontselect = new OFontSelector ( parent, "FontTab" );
+ m_fontselect-> setSelectedFont ( familyStr, styleStr, size );
+
+ connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
+ this, SLOT( fontClicked ( const QFont & )));
+
+ return m_fontselect;
+}
+
+QWidget *TabDialog::createBgTab ( QWidget *parent )
+{
+ QWidget *tab = new QWidget( parent, "AdvancedTab" );
+ QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
+
+ QGridLayout* gridLayout = new QGridLayout ( vertLayout );
+ gridLayout-> setColStretch ( 1, 10 );
+
+ QLabel* label = new QLabel( tr( "Type:" ), tab );
+ gridLayout-> addWidget ( label, 0, 0 );
+ m_bgtype = new QButtonGroup( tab, "buttongroup" );
+ m_bgtype-> hide ( );
+ m_bgtype-> setExclusive ( true );
+
+ QRadioButton *rb;
+ rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" );
+ m_bgtype-> insert ( rb, TabConfig::Ruled );
+ gridLayout-> addWidget( rb, 0, 1 );
+
+ QHBoxLayout *hb = new QHBoxLayout ( );
+ hb-> setSpacing ( 4 );
+
+ rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
+ m_bgtype-> insert ( rb, TabConfig::SolidColor );
+ hb-> addWidget ( rb );
+
+ m_solidcolor = new OColorButton ( tab );
+ connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( colorClicked ( const QColor & )));
+ hb-> addWidget ( m_solidcolor );
+ hb-> addStretch ( 10 );
+
+ gridLayout-> addLayout ( hb, 1, 1 );
+
+ rb = new QRadioButton( tr( "Image" ), tab, "image" );
+ m_bgtype-> insert ( rb, TabConfig::Image );
+ gridLayout-> addWidget( rb, 3, 1 );
+
+ QPushButton *p;
+
+ connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int )));
+
+ vertLayout-> addStretch ( 10 );
+
+ return tab;
+}
+
+QWidget *TabDialog::createIconTab ( QWidget *parent )
+{
+ QWidget *tab = new QWidget( parent, "AdvancedTab" );
+ QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
+
+ 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 )));
+
+ vertLayout-> addStretch ( 10 );
+
+ 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;
+
+ m_solidcolor-> setEnabled ( t == TabConfig::SolidColor );
+// m_imagebrowse-> setEnabled ( t == TabConfig::Image );
+// m_imagedefault-> setEnabled ( t == TabConfig::Image );
+
+ if ( t == TabConfig::SolidColor )
+ s = m_solidcolor-> color ( ). name ( );
+
+ m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s );
+}
+
+void TabDialog::colorClicked ( const QColor &col )
+{
+ m_sample-> setBackgroundType ( TabConfig::SolidColor, col. name ( ));
+}
diff --git a/core/settings/launcher/tabdialog.h b/core/settings/launcher/tabdialog.h
new file mode 100644
index 0000000..d602573
--- a/dev/null
+++ b/core/settings/launcher/tabdialog.h
@@ -0,0 +1,40 @@
+#ifndef __TABDIALOG_H__
+#define __TABDIALOG_H__
+
+#include <qdialog.h>
+#include "tabconfig.h"
+
+class QButtonGroup;
+class OFontSelector;
+class SampleView;
+class OColorButton;
+
+class TabDialog : public QDialog {
+ Q_OBJECT
+public:
+ TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &cfg, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags = 0 );
+ virtual ~TabDialog ( );
+
+protected slots:
+ void iconSizeClicked ( int );
+ void fontClicked ( const QFont & );
+ void bgTypeClicked ( int );
+ void colorClicked ( const QColor & );
+
+private:
+ QWidget *createBgTab ( QWidget *parent );
+ QWidget *createFontTab ( QWidget *parent );
+ QWidget *createIconTab ( QWidget *parent );
+
+
+private:
+ SampleView *m_sample;
+ QButtonGroup *m_iconsize;
+ OFontSelector *m_fontselect;
+ OColorButton *m_solidcolor;
+
+ QButtonGroup *m_bgtype;
+};
+
+
+#endif \ No newline at end of file
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index 292c615..fc2d2c9 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -24,154 +24,202 @@
#include <qpe/resource.h>
#include <qpe/applnk.h>
#include <qpe/mimetype.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
-#include <qlistview.h>
-#include <qheader.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
+#include "tabdialog.h"
+
#include <stdlib.h>
+#include <qmessagebox.h>
+
+
TabsSettings::TabsSettings ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
- QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
+ QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
- lay-> addWidget ( l );
+ lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
- m_list = new QListView ( this );
- m_list-> addColumn ( "foobar" );
- m_list-> header ( )-> hide ( );
-
- lay-> addWidget ( m_list );
+ m_list = new QListBox ( this );
+ lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
QWhatsThis::add ( m_list, tr( "foobar" ));
+
+ QPushButton *p;
+ p = new QPushButton ( tr( "New" ), this );
+ lay-> addWidget ( p, 1, 1 );
+ connect ( p, SIGNAL( clicked ( )), this, SLOT( newClicked ( )));
+
+ p = new QPushButton ( tr( "Edit" ), this );
+ lay-> addWidget ( p, 2, 1 );
+ connect ( p, SIGNAL( clicked ( )), this, SLOT( editClicked ( )));
+
+ p = new QPushButton ( tr( "Delete" ), this );
+ lay-> addWidget ( p, 3, 1 );
+ connect ( p, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( )));
+
+ lay-> setRowStretch ( 4, 10 );
init ( );
}
void TabsSettings::init ( )
{
- QListViewItem *lvi;
-
AppLnkSet rootFolder( MimeType::appsFolderName ( ));
QStringList types = rootFolder. types ( );
+
for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) {
- lvi = new QListViewItem ( m_list, rootFolder. typeName ( *it ));
- lvi-> setPixmap ( 0, rootFolder. typePixmap ( *it ));
+ m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it ));
m_ids << *it;
}
QImage img ( Resource::loadImage ( "DocsIcon" ));
QPixmap pix;
pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( ));
- lvi = new QListViewItem ( m_list, tr( "Documents" ));
- lvi-> setPixmap ( 0, pix );
+ m_list-> insertItem ( pix, tr( "Documents" ));
m_ids += "Documents"; // No tr
readTabSettings ( );
}
void TabsSettings::readTabSettings ( )
{
Config cfg ( "Launcher" );
QString grp ( "Tab %1" ); // No tr
m_tabs. clear ( );
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
- TabSettings ts;
- ts. m_view = Icon;
- ts. m_bg_type = Ruled;
- ts. m_changed = false;
+ TabConfig tc;
+ tc. m_view = TabConfig::Icon;
+ tc. m_bg_type = TabConfig::Ruled;
+ tc. m_changed = false;
cfg. setGroup ( grp. arg ( *it ));
QString view = cfg. readEntry ( "View", "Icon" );
if ( view == "List" ) // No tr
- ts. m_view = List;
+ tc. m_view = TabConfig::List;
QString bgType = cfg. readEntry ( "BackgroundType", "Ruled" );
if ( bgType == "SolidColor" )
- ts. m_bg_type = SolidColor;
+ tc. m_bg_type = TabConfig::SolidColor;
else if ( bgType == "Image" ) // No tr
- ts. m_bg_type = Image;
+ tc. m_bg_type = TabConfig::Image;
- ts. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" );
- ts. m_bg_color = cfg. readEntry ( "BackgroundColor" );
- ts. m_text_color = cfg. readEntry ( "TextColor" );
+ tc. m_bg_image = cfg. readEntry ( "BackgroundImage", "wallpaper/opie" );
+ tc. m_bg_color = cfg. readEntry ( "BackgroundColor" );
+ tc. m_text_color = cfg. readEntry ( "TextColor" );
QStringList f = cfg. readListEntry ( "Font", ',' );
if ( f. count ( ) == 4 ) {
- ts. m_font_family = f [0];
- ts. m_font_size = f [1]. toInt ( );
+ tc. m_font_family = f [0];
+ tc. m_font_size = f [1]. toInt ( );
} else {
- ts. m_font_family = font ( ). family ( );
- ts. m_font_size = font ( ). pointSize ( );
+ tc. m_font_family = font ( ). family ( );
+ tc. m_font_size = font ( ). pointSize ( );
}
- m_tabs [*it] = ts;
+ m_tabs [*it] = tc;
}
}
void TabsSettings::accept ( )
{
Config cfg ( "Launcher" );
// Launcher Tab
QString grp ( "Tab %1" ); // No tr
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
- TabSettings &tab = m_tabs [*it];
+ TabConfig &tc = m_tabs [*it];
cfg. setGroup ( grp. arg ( *it ));
- if ( !tab. m_changed )
+ if ( !tc. m_changed )
continue;
- switch ( tab. m_view ) {
- case Icon:
- cfg.writeEntry ( "View", "Icon" );
- break;
- case List:
- cfg.writeEntry ( "View", "List" );
- break;
+ 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 << tab. m_view;
+ e << *it << tc. m_view;
- cfg. writeEntry ( "BackgroundImage", tab. m_bg_image );
- cfg. writeEntry ( "BackgroundColor", tab. m_bg_color );
- cfg. writeEntry ( "TextColor", tab. m_text_color );
+ cfg. writeEntry ( "BackgroundImage", tc. m_bg_image );
+ cfg. writeEntry ( "BackgroundColor", tc. m_bg_color );
+ cfg. writeEntry ( "TextColor", tc. m_text_color );
- QString f = tab. m_font_family + "," + QString::number ( tab. m_font_size ) + ",50,0";
+ QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + ",50,0";
cfg. writeEntry ( "Font", f );
QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" );
- switch ( tab. m_bg_type ) {
- case Ruled:
- cfg.writeEntry( "BackgroundType", "Ruled" );
- be << *it << tab. m_bg_type << QString("");
- break;
- case SolidColor:
- cfg.writeEntry( "BackgroundType", "SolidColor" );
- be << *it << tab. m_bg_type << tab. m_bg_color;
- break;
- case Image:
- cfg.writeEntry( "BackgroundType", "Image" );
- be << *it << tab. m_bg_type << tab. m_bg_image;
- break;
+ 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;
+ break;
}
QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
- te << *it << tab. m_text_color;
+ te << *it << tc. m_text_color;
QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
- fe << *it << tab. m_font_family;
- fe << tab. m_font_size;
+ fe << *it << tc. m_font_family;
+ fe << tc. m_font_size;
fe << 50 << 0;
- tab. m_changed = false;
+ tc. m_changed = false;
}
}
+void TabsSettings::newClicked ( )
+{
+ QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
+}
+
+void TabsSettings::deleteClicked ( )
+{
+ int ind = m_list-> currentItem ( );
+
+ if ( ind < 0 )
+ return;
+
+ QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" ));
+}
+
+void TabsSettings::editClicked ( )
+{
+ int ind = m_list-> currentItem ( );
+
+ if ( ind < 0 )
+ return;
+
+ TabConfig tc = m_tabs [m_ids [ind]];
+
+ TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true );
+
+ d-> showMaximized ( );
+ if ( d-> exec ( ) == QDialog::Accepted ) {
+ tc. m_changed = true;
+ m_tabs [m_ids [ind]] = tc;
+ }
+
+ delete d;
+}
diff --git a/core/settings/launcher/tabssettings.h b/core/settings/launcher/tabssettings.h
index 17b6e25..76cae68 100644
--- a/core/settings/launcher/tabssettings.h
+++ b/core/settings/launcher/tabssettings.h
@@ -1,52 +1,39 @@
#ifndef __TABS_SETTINGS_H__
#define __TABS_SETTINGS_H__
#include <qwidget.h>
#include <qmap.h>
-class QListView;
+#include "tabconfig.h"
+
+class QListBox;
class TabsSettings : public QWidget {
Q_OBJECT
public:
TabsSettings ( QWidget *parent = 0, const char *name = 0 );
void accept ( );
- enum ViewMode {
- Icon,
- List
- };
- enum BackgroundType {
- Ruled,
- SolidColor,
- Image
- };
- struct TabSettings {
- ViewMode m_view;
- BackgroundType m_bg_type;
- QString m_bg_image;
- QString m_bg_color;
- QString m_text_color;
- QString m_font_family;
- int m_font_size;
- bool m_changed;
- };
+protected slots:
+ void newClicked ( );
+ void deleteClicked ( );
+ void editClicked ( );
protected:
void init ( );
void readTabSettings ( );
private:
- QListView *m_list;
+ QListBox *m_list;
// QString currentTab;
QStringList m_ids;
- QMap <QString, TabSettings> m_tabs;
+ QMap <QString, TabConfig> m_tabs;
};
#endif