Diffstat (limited to 'core/settings/launcher/tabdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
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 @@ -36,12 +36,13 @@ #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> @@ -264,13 +265,13 @@ private: 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" )); @@ -294,37 +295,47 @@ TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig 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 ); @@ -335,13 +346,13 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) 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 ); @@ -350,13 +361,13 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) 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 ); @@ -377,14 +388,14 @@ QWidget *TabDialog::createBgTab ( QWidget *parent ) 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 ); @@ -487,15 +498,19 @@ 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 ( ); 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 ( ); } |