summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/launcher/tabconfig.h13
-rw-r--r--core/settings/launcher/tabdialog.cpp45
-rw-r--r--core/settings/launcher/tabdialog.h2
-rw-r--r--core/settings/launcher/tabssettings.cpp69
-rw-r--r--core/settings/launcher/taskbarsettings.cpp3
5 files changed, 86 insertions, 46 deletions
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h
index eebfd36..9086341 100644
--- a/core/settings/launcher/tabconfig.h
+++ b/core/settings/launcher/tabconfig.h
@@ -34,33 +34,38 @@ struct TabConfig {
};
enum BackgroundType {
Ruled,
SolidColor,
Image
};
ViewMode m_view;
BackgroundType m_bg_type;
QString m_bg_image;
QString m_bg_color;
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_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 );
+ ( 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 );
+
}
};
#endif
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp
index a90ba7d..d20412a 100644
--- a/core/settings/launcher/tabdialog.cpp
+++ b/core/settings/launcher/tabdialog.cpp
@@ -30,24 +30,25 @@
#include <qpe/applnk.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 <qpushbutton.h>
#include <qwhatsthis.h>
+#include <qcheckbox.h>
#include <opie/ofontselector.h>
#include <opie/otabwidget.h>
#include <opie/ocolorbutton.h>
#include <opie/ofiledialog.h>
#include "tabdialog.h"
class SampleItem : public QIconViewItem {
public:
SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text )
@@ -258,25 +259,25 @@ private:
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 | WStyle_ContextHelp ), m_tc ( tc )
{
setCaption ( tr( "Edit Tab" ));
- QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
+ QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 );
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 );
@@ -288,81 +289,91 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig
lay-> addWidget ( tw, 10 );
lay-> addWidget ( sample, 1 );
m_iconsize-> setButton ( tc. m_view );
iconSizeClicked ( tc. m_view );
m_iconcolor-> setColor ( QColor ( m_tc. m_text_color ));
iconColorClicked ( m_iconcolor-> color ( ));
m_bgtype-> setButton ( tc. m_bg_type );
m_solidcolor-> setColor ( QColor ( tc. m_bg_color ));
m_bgimage = tc. m_bg_image;
bgTypeClicked ( tc. m_bg_type );
+ m_fontuse-> setChecked ( tc. m_font_use );
m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic ));
+ m_fontselect-> setEnabled ( m_fontuse-> isChecked ( ));
fontClicked ( m_fontselect-> selectedFont ( ));
QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." ));
}
TabDialog::~TabDialog ( )
{
}
QWidget *TabDialog::createFontTab ( QWidget *parent )
{
- m_fontselect = new OFontSelector ( false, parent, "FontTab" );
+ QWidget *tab = new QWidget ( parent, "FontTab" );
+ QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 );
+
+ m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab );
+ vertLayout-> addWidget ( m_fontuse );
+
+ m_fontselect = new OFontSelector ( false, tab, "fontsel" );
+ vertLayout-> addWidget ( m_fontselect );
+ connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool )));
connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )),
this, SLOT( fontClicked ( const QFont & )));
- return m_fontselect;
+ return tab;
}
QWidget *TabDialog::createBgTab ( QWidget *parent )
{
- QWidget *tab = new QWidget( parent, "AdvancedTab" );
- QVBoxLayout *vertLayout = new QVBoxLayout( tab, 4, 4 );
+ QWidget *tab = new QWidget( parent, "BgTab" );
+ QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 );
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 );
+ hb-> setSpacing ( 3 );
rb = new QRadioButton( tr( "Solid color" ), tab, "solid" );
m_bgtype-> insert ( rb, TabConfig::SolidColor );
hb-> addWidget ( rb );
hb-> addSpacing ( 10 );
m_solidcolor = new OColorButton ( tab );
connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & )));
hb-> addWidget ( m_solidcolor );
hb-> addStretch ( 10 );
gridLayout-> addLayout ( hb, 1, 1 );
hb = new QHBoxLayout ( );
- hb-> setSpacing ( 4 );
+ hb-> setSpacing ( 3 );
rb = new QRadioButton( tr( "Image" ), tab, "image" );
m_bgtype-> insert ( rb, TabConfig::Image );
hb-> addWidget( rb );
hb-> addSpacing ( 10 );
m_imagebrowse = new QPushButton ( tr( "Select..." ), tab );
connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( )));
hb-> addWidget ( m_imagebrowse );
hb-> addStretch ( 10 );
gridLayout-> addLayout ( hb, 2, 1 );
@@ -371,26 +382,26 @@ QWidget *TabDialog::createBgTab ( QWidget *parent )
connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( )));
gridLayout-> addWidget ( p, 3, 1 );
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 );
+ 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" );
@@ -480,22 +491,26 @@ 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_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 ( );
- 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 ( );
+ 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 b0afd47..892a3ad 100644
--- a/core/settings/launcher/tabdialog.h
+++ b/core/settings/launcher/tabdialog.h
@@ -27,24 +27,25 @@
#ifndef __TABDIALOG_H__
#define __TABDIALOG_H__
#include <qdialog.h>
#include "tabconfig.h"
class QButtonGroup;
class OFontSelector;
class SampleView;
class OColorButton;
class QPushButton;
+class QCheckBox;
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 ( );
public slots:
virtual void accept ( );
protected slots:
@@ -62,18 +63,19 @@ private:
QWidget *createIconTab ( QWidget *parent );
private:
SampleView *m_sample;
QButtonGroup *m_iconsize;
OFontSelector *m_fontselect;
OColorButton *m_solidcolor;
OColorButton *m_iconcolor;
QPushButton *m_imagebrowse;
QString m_bgimage;
QButtonGroup *m_bgtype;
+ QCheckBox *m_fontuse;
TabConfig &m_tc;
};
#endif \ No newline at end of file
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp
index a5afaf2..9d6e8c1 100644
--- a/core/settings/launcher/tabssettings.cpp
+++ b/core/settings/launcher/tabssettings.cpp
@@ -38,25 +38,25 @@
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qwhatsthis.h>
#include <qcheckbox.h>
#include "tabdialog.h"
#include <stdlib.h>
#include <qmessagebox.h>
-#define GLOBALID "_launchersettings_global_dummy_"
+#define GLOBALID ".global."
TabsSettings::TabsSettings ( QWidget *parent, const char *name )
: QWidget ( parent, name )
{
QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 );
QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this );
lay-> addMultiCellWidget ( l, 0, 0, 0, 1 );
m_list = new QListBox ( this );
lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 );
@@ -115,137 +115,154 @@ void TabsSettings::init ( )
readTabSettings ( cfg );
cfg. setGroup ( "GUI" );
m_busyblink-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "blink" );
}
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_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;
+
+
for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) {
- TabConfig tc;
- tc. m_view = TabConfig::Icon;
- tc. m_bg_type = TabConfig::Ruled;
- tc. m_changed = false;
+ TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def;
cfg. setGroup ( grp. arg ( *it ));
- if ( *it == GLOBALID )
- cfg. clearGroup ( );
- QString view = cfg. readEntry ( "View", "Icon" );
+ 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", "Image" );
- if ( bgType == "SolidColor" )
+ 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", "launcher/opie-background" );
- tc. m_bg_color = cfg. readEntry ( "BackgroundColor", colorGroup ( ). color ( QColorGroup::Base ). name ( ));
- tc. m_text_color = cfg. readEntry ( "TextColor", colorGroup ( ). color ( QColorGroup::Text ). name ( ));
+ tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image );
+ tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color );
+ 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 ( ));
- } else {
- tc. m_font_family = font ( ). family ( );
- tc. m_font_size = font ( ). pointSize ( );
- tc. m_font_weight = 50;
- tc. m_font_italic = false;
- }
-
+ }
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] );
}
- if ( same )
+ if ( same ) {
m_tabs [GLOBALID] = *first;
+ m_tabs [GLOBALID]. m_changed = true;
+ }
}
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 ) {
TabConfig &tc = m_tabs [*it];
- if ( !tc. m_changed || ( *it == GLOBALID ))
+ if ( !tc. m_changed )
continue;
cfg. 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 ( "TextColor", tc. m_text_color );
- 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 );
+ 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;
break;
}
QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" );
te << *it << tc. m_text_color;
QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" );
- fe << *it << tc. m_font_family;
+ fe << *it;
+ fe << ( tc. m_font_use ? tc. m_font_family : QString::null );
fe << tc. m_font_size;
- fe << tc. m_font_weight << ( tc. m_font_italic ? 1 : 0 );
+ fe << tc. m_font_weight;
+ fe << ( tc. m_font_italic ? 1 : 0 );
tc. m_changed = false;
}
cfg. setGroup ( "GUI" );
QString busytype = QString ( m_busyblink-> isChecked ( ) ? "blink" : "" );
cfg. writeEntry ( "BusyType", busytype );
{
QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" );
e << busytype;
}
}
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index 5bc5ad2..b3e302a 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -126,30 +126,31 @@ void TaskbarSettings::init ( )
}
}
void TaskbarSettings::appletChanged()
{
m_applets_changed = true;
}
void TaskbarSettings::accept ( )
{
Config cfg ( "Taskbar" );
cfg. setGroup ( "Applets" );
+
if ( m_applets_changed ) {
QStringList exclude;
QMap <QString, QCheckListItem *>::Iterator it;
for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
if ( !(*it)-> isOn ( ))
exclude << it. key ( );
}
cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
}
cfg. writeEntry ( "SafeMode", false );
cfg. write ( );
if ( m_applets_changed ) {
- QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
+ QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
m_applets_changed = false;
}
}