From c35d57256c61f97d2b4221e11e39b1fb9bac2a7e Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 7 May 2010 03:43:19 +0000 Subject: Added backend for panel icon maximum size control Polished frontend for panel icon size configuration git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1123840 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/icons/icons.cpp | 73 +++++++++++++++++++++++++++++------------------- kcontrol/icons/icons.h | 3 +- 2 files changed, 47 insertions(+), 29 deletions(-) (limited to 'kcontrol/icons') diff --git a/kcontrol/icons/icons.cpp b/kcontrol/icons/icons.cpp index 8ad71540e..43b529ff1 100644 --- a/kcontrol/icons/icons.cpp +++ b/kcontrol/icons/icons.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "icons.h" @@ -101,29 +102,30 @@ KIconConfig::KIconConfig(QWidget *parent, const char *name) QGroupBox *gboxpnl = new QGroupBox(i18n("Panel Settings"), this); //top->addMultiCellWidget(gboxpnl, 4, 4, 0, 1); top->addMultiCellWidget(gboxpnl, 4, 4, 0, 0); - QGridLayout *gpnl_lay = new QGridLayout(gboxpnl, 3, 3, KDialog::marginHint(), KDialog::spacingHint()); + QGridLayout *gpnl_lay = new QGridLayout(gboxpnl, 3, 2, KDialog::marginHint(), KDialog::spacingHint()); gpnl_lay->addRowSpacing(0, fontMetrics().lineSpacing()); + QLabel *lbl3 = new QLabel(i18n("Maximum icon size:"), gboxpnl); + lbl3->setFixedSize(lbl3->sizeHint()); + gpnl_lay->addWidget(lbl3, 1, 0, Qt::AlignLeft); + mpQuickLaunchSizeBox = new QComboBox(gboxpnl); + connect(mpQuickLaunchSizeBox, SIGNAL(activated(int)), SLOT(changed())); + lbl3->setBuddy(mpQuickLaunchSizeBox); + gpnl_lay->addWidget(mpQuickLaunchSizeBox, 1, 1, Qt::AlignCenter); + QLabel *lbl2 = new QLabel(i18n("System tray icon size:"), gboxpnl); lbl2->setFixedSize(lbl2->sizeHint()); - gpnl_lay->addWidget(lbl2, 1, 0, Qt::AlignLeft); + gpnl_lay->addWidget(lbl2, 2, 0, Qt::AlignLeft); mpSysTraySizeBox = new QComboBox(gboxpnl); connect(mpSysTraySizeBox, SIGNAL(activated(int)), SLOT(changed())); lbl2->setBuddy(mpSysTraySizeBox); - gpnl_lay->addWidget(mpSysTraySizeBox, 1, 1, Qt::AlignCenter); + gpnl_lay->addWidget(mpSysTraySizeBox, 2, 1, Qt::AlignCenter); - QLabel *lbl3 = new QLabel(i18n("Quick launch icon size:"), gboxpnl); - lbl3->setFixedSize(lbl3->sizeHint()); - gpnl_lay->addWidget(lbl3, 2, 0, Qt::AlignLeft); - mpQuickLaunchSizeBox = new QComboBox(gboxpnl); - connect(mpQuickLaunchSizeBox, SIGNAL(activated(int)), SLOT(changed())); - lbl3->setBuddy(mpQuickLaunchSizeBox); - gpnl_lay->addWidget(mpQuickLaunchSizeBox, 2, 1, Qt::AlignCenter); + QSpacerItem *thisSpacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + top->addItem(thisSpacer, 5, 0); - mQLSizeLocked = new QCheckBox(i18n("Lock to panel size"), gboxpnl); - mQLSizeLocked->setFixedSize(mQLSizeLocked->sizeHint()); - connect(mQLSizeLocked, SIGNAL(toggled(bool)), SLOT(QLSizeLockedChanged(bool))); - gpnl_lay->addWidget(mQLSizeLocked, 2, 2, Qt::AlignRight); + mpSystrayConfig = new KSimpleConfig( QString::fromLatin1( "systemtray_panelappletrc" )); + mpKickerConfig = new KSimpleConfig( QString::fromLatin1( "kickerrc" )); init(); read(); @@ -133,6 +135,7 @@ KIconConfig::KIconConfig(QWidget *parent, const char *name) KIconConfig::~KIconConfig() { + delete mpSystrayConfig; delete mpEffect; } @@ -308,26 +311,33 @@ void KIconConfig::read() mpQuickLaunchSizeBox->insertItem(QString().setNum(48)); mpSysTraySizeBox->insertItem(QString().setNum(64)); mpQuickLaunchSizeBox->insertItem(QString().setNum(64)); - - // FIXME - // For now, disable mpQuickLaunchSizeBox as the required backend code does not exist yet - // This will change in the near future however - mpQuickLaunchSizeBox->setEnabled(false); - mQLSizeLocked->setEnabled(false); - mQLSizeLocked->setChecked(true); - - // FIXME - // Due to issues with the system tray handling code, mpSysTraySizeBox also needs to be disabled - // This should be fixed ASAP - mpSysTraySizeBox->setEnabled(false); + mpSysTraySizeBox->insertItem(QString().setNum(128)); + mpQuickLaunchSizeBox->insertItem(QString().setNum(128)); mpConfig->setGroup("System Tray"); mSysTraySize = mpConfig->readNumEntry("systrayIconWidth", 22); + + mpSystrayConfig->setGroup("System Tray"); + mSysTraySize = mpSystrayConfig->readNumEntry("systrayIconWidth", 22); for (i=0;i<(mpSysTraySizeBox->count());i++) { if (mpSysTraySizeBox->text(i) == QString().setNum(mSysTraySize)) { mpSysTraySizeBox->setCurrentItem(i); } } + + mpKickerConfig->setGroup("General"); + mQuickLaunchSize = mpKickerConfig->readNumEntry("panelIconWidth", KIcon::SizeLarge); + for (i=0;i<(mpQuickLaunchSizeBox->count());i++) { + if (mpQuickLaunchSizeBox->text(i) == QString().setNum(mQuickLaunchSize)) { + mpQuickLaunchSizeBox->setCurrentItem(i); + } + } + + // FIXME + // Due to issues with the system tray handling code, mpSysTraySizeBox should be be disabled + // This should be fixed ASAP + // Specifically, kicker does not automatically reconfigure the system tray icon sizes on its configure() DCOP call + mpSysTraySizeBox->setEnabled(false); } void KIconConfig::apply() @@ -450,10 +460,14 @@ void KIconConfig::save() } } - mpConfig->setGroup("System Tray"); - mpConfig->writeEntry("systrayIconWidth", mpSysTraySizeBox->currentText()); + mpSystrayConfig->setGroup("System Tray"); + mpSystrayConfig->writeEntry("systrayIconWidth", mpSysTraySizeBox->currentText()); + mpKickerConfig->setGroup("General"); + mpKickerConfig->writeEntry("panelIconWidth", mpQuickLaunchSizeBox->currentText()); mpConfig->sync(); + mpSystrayConfig->sync(); + mpKickerConfig->sync(); emit changed(false); @@ -466,6 +480,9 @@ void KIconConfig::save() mbChanged[i] = false; } } + + // Signal kicker to reload icon configuration + kapp->dcopClient()->send("kicker", "kicker", "configure()", QByteArray()); } void KIconConfig::defaults() diff --git a/kcontrol/icons/icons.h b/kcontrol/icons/icons.h index b1f167066..2e8d4c6fe 100644 --- a/kcontrol/icons/icons.h +++ b/kcontrol/icons/icons.h @@ -104,6 +104,8 @@ private: KIconTheme *mpTheme; KIconLoader *mpLoader; KConfig *mpConfig; + KSimpleConfig *mpSystrayConfig; + KSimpleConfig *mpKickerConfig; typedef QLabel *QLabelPtr; QLabelPtr mpPreview[3]; @@ -112,7 +114,6 @@ private: QComboBox *mpSizeBox; QComboBox *mpSysTraySizeBox; QComboBox *mpQuickLaunchSizeBox; - QCheckBox *mQLSizeLocked; QCheckBox *mpDPCheck, *wordWrapCB, *underlineCB, *mpAnimatedCheck; QTabWidget *m_pTabWidget; QWidget *m_pTab1; -- cgit v1.2.1