diff options
Diffstat (limited to 'kcontrol/icons')
-rw-r--r-- | kcontrol/icons/CMakeLists.txt | 37 | ||||
-rw-r--r-- | kcontrol/icons/Makefile.am | 25 | ||||
-rw-r--r-- | kcontrol/icons/icons.cpp | 822 | ||||
-rw-r--r-- | kcontrol/icons/icons.desktop | 249 | ||||
-rw-r--r-- | kcontrol/icons/icons.h | 161 | ||||
-rw-r--r-- | kcontrol/icons/iconthemes.cpp | 452 | ||||
-rw-r--r-- | kcontrol/icons/iconthemes.h | 73 | ||||
-rw-r--r-- | kcontrol/icons/main.cpp | 105 | ||||
-rw-r--r-- | kcontrol/icons/main.h | 55 | ||||
-rw-r--r-- | kcontrol/icons/testicons.cpp | 13 | ||||
-rw-r--r-- | kcontrol/icons/uninstall.desktop | 2 |
11 files changed, 1994 insertions, 0 deletions
diff --git a/kcontrol/icons/CMakeLists.txt b/kcontrol/icons/CMakeLists.txt new file mode 100644 index 000000000..a8c434f9b --- /dev/null +++ b/kcontrol/icons/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${LIBART_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${LIBART_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES icons.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES uninstall.desktop DESTINATION ${APPS_INSTALL_DIR}/Settings/LookNFeel/Themes RENAME iconthemes.desktop ) + + +##### kcm_icons (module) ######################## + +tde_add_kpart( kcm_icons AUTOMOC + SOURCES iconthemes.cpp icons.cpp main.cpp + LINK tdeio-shared ${LIBART_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/icons/Makefile.am b/kcontrol/icons/Makefile.am new file mode 100644 index 000000000..87fd4f0d9 --- /dev/null +++ b/kcontrol/icons/Makefile.am @@ -0,0 +1,25 @@ +AM_CPPFLAGS = $(all_includes) + +kde_module_LTLIBRARIES = kcm_icons.la + +kcm_icons_la_SOURCES = iconthemes.cpp icons.cpp main.cpp +kcm_icons_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined +kcm_icons_la_LIBADD = $(LIB_TDEIO) + +METASOURCES = AUTO + +noinst_HEADERS = icons.h iconthemes.h main.h + +check_PROGRAMS = testicons +testicons_SOURCES = testicons.cpp +testicons_LDFLAGS = $(all_libraries) +testicons_LDADD = $(LIB_TDEUI) icons.lo + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kcmicons.pot + +xdg_apps_DATA = icons.desktop + +install-data-local: uninstall.desktop + $(mkinstalldirs) $(DESTDIR)$(kde_appsdir)/Settings/LookNFeel/Themes + $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_appsdir)/Settings/LookNFeel/Themes/iconthemes.desktop diff --git a/kcontrol/icons/icons.cpp b/kcontrol/icons/icons.cpp new file mode 100644 index 000000000..56df77a51 --- /dev/null +++ b/kcontrol/icons/icons.cpp @@ -0,0 +1,822 @@ +/* vi: ts=8 sts=4 sw=4 + * + * This file is part of the KDE project, module kcmdisplay. + * Copyright (C) 2000 Geert Jansen <jansen@kde.org> + * with minor additions and based on ideas from + * Torsten Rahn <torsten@kde.org> * + * + * You can Freely distribute this program under the GNU General Public + * License. See the file "COPYING" for the exact licensing terms. + */ + +#include <stdlib.h> + +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqgroupbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqslider.h> + +#include <tdeapplication.h> +#include <kcolorbutton.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kiconeffect.h> +#include <kiconloader.h> +#include <kipc.h> +#include <tdelocale.h> +#include <kseparator.h> +#include <tdeglobalsettings.h> +#include <dcopclient.h> + +#include "icons.h" + +/**** TDEIconConfig ****/ + +TDEIconConfig::TDEIconConfig(TQWidget *parent, const char *name) + : TDECModule(parent, name) +{ + + TQGridLayout *top = new TQGridLayout(this, 4, 2, + KDialog::marginHint(), + KDialog::spacingHint()); + top->setColStretch(0, 1); + top->setColStretch(1, 1); + + // Use of Icon at (0,0) - (1, 0) + TQGroupBox *gbox = new TQGroupBox(i18n("Use of Icon"), this); + top->addMultiCellWidget(gbox, 0, 1, 0, 0); + TQBoxLayout *g_vlay = new TQVBoxLayout(gbox, + KDialog::marginHint(), + KDialog::spacingHint()); + g_vlay->addSpacing(fontMetrics().lineSpacing()); + mpUsageList = new TQListBox(gbox); + connect(mpUsageList, TQT_SIGNAL(highlighted(int)), TQT_SLOT(slotUsage(int))); + g_vlay->addWidget(mpUsageList); + + KSeparator *sep = new KSeparator( KSeparator::HLine, this ); + top->addWidget(sep, 1, 1); + // Preview at (2,0) - (2, 1) + TQGridLayout *g_lay = new TQGridLayout(4, 3, KDialog::marginHint(), 0); + top->addMultiCellLayout(g_lay, 2, 2, 0, 1); + g_lay->addRowSpacing(0, fontMetrics().lineSpacing()); + + TQPushButton *push; + + mPreviewButton1 = addPreviewIcon(0, i18n("Default"), this, g_lay); + connect(mPreviewButton1, TQT_SIGNAL(clicked()), TQT_SLOT(slotEffectSetup0())); + mPreviewButton2 = addPreviewIcon(1, i18n("Active"), this, g_lay); + connect(mPreviewButton2, TQT_SIGNAL(clicked()), TQT_SLOT(slotEffectSetup1())); + mPreviewButton3 = addPreviewIcon(2, i18n("Disabled"), this, g_lay); + connect(mPreviewButton3, TQT_SIGNAL(clicked()), TQT_SLOT(slotEffectSetup2())); + + m_pTab1 = new TQWidget(this, "General Tab"); + top->addWidget(m_pTab1, 0, 1); + + TQGridLayout *grid = new TQGridLayout(m_pTab1, 4, 3, 10, 10); + grid->setColStretch(1, 1); + grid->setColStretch(2, 1); + + // Size + TQLabel *lbl = new TQLabel(i18n("Size:"), m_pTab1); + lbl->setFixedSize(lbl->sizeHint()); + grid->addWidget(lbl, 0, 0, Qt::AlignLeft); + mpSizeBox = new TQComboBox(m_pTab1); + connect(mpSizeBox, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSize(int))); + lbl->setBuddy(mpSizeBox); + grid->addWidget(mpSizeBox, 0, 1, Qt::AlignLeft); + + mpDPCheck = new TQCheckBox(i18n("Double-sized pixels"), m_pTab1); + connect(mpDPCheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotDPCheck(bool))); + grid->addMultiCellWidget(mpDPCheck, 1, 1, 0, 1, Qt::AlignLeft); + + mpAnimatedCheck = new TQCheckBox(i18n("Animate icons"), m_pTab1); + connect(mpAnimatedCheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotAnimatedCheck(bool))); + grid->addMultiCellWidget(mpAnimatedCheck, 2, 2, 0, 1, Qt::AlignLeft); + + mpRoundedCheck = new TQCheckBox(i18n("Rounded text selection"), m_pTab1); + connect(mpRoundedCheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotRoundedCheck(bool))); + grid->addMultiCellWidget(mpRoundedCheck, 3, 3, 0, 1, Qt::AlignLeft); + + mpActiveEffectCheck = new TQCheckBox(i18n("Show icon activation effect"), m_pTab1); + connect(mpActiveEffectCheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotActiveEffect(bool))); + grid->addMultiCellWidget(mpActiveEffectCheck, 4, 4, 0, 1, Qt::AlignLeft); + + top->activate(); + + mpSystrayConfig = new KSimpleConfig( TQString::fromLatin1( "systemtray_panelappletrc" )); + mpKickerConfig = new KSimpleConfig( TQString::fromLatin1( "kickerrc" )); + + init(); + read(); + apply(); + preview(); +} + +TDEIconConfig::~TDEIconConfig() +{ + delete mpSystrayConfig; + delete mpEffect; +} + +TQPushButton *TDEIconConfig::addPreviewIcon(int i, const TQString &str, TQWidget *parent, TQGridLayout *lay) +{ + TQLabel *lab = new TQLabel(str, parent); + lay->addWidget(lab, 1, i, Qt::AlignCenter); + mpPreview[i] = new TQLabel(parent); + mpPreview[i]->setAlignment(AlignCenter); + mpPreview[i]->setMinimumSize(105, 105); + lay->addWidget(mpPreview[i], 2, i); + TQPushButton *push = new TQPushButton(i18n("Set Effect..."), parent); + lay->addWidget(push, 3, i, Qt::AlignCenter); + return push; +} + +void TDEIconConfig::init() +{ + mpLoader = TDEGlobal::iconLoader(); + mpConfig = TDEGlobal::config(); + mpEffect = new TDEIconEffect; + mpTheme = mpLoader->theme(); + mUsage = 0; + for (int i=0; i<TDEIcon::LastGroup; i++) + mbChanged[i] = false; + + // Fill list/checkboxen + mpUsageList->insertItem(i18n("Desktop/File Manager")); + mpUsageList->insertItem(i18n("Toolbar")); + mpUsageList->insertItem(i18n("Main Toolbar")); + mpUsageList->insertItem(i18n("Small Icons")); + mpUsageList->insertItem(i18n("Panel")); + mpUsageList->insertItem(i18n("All Icons")); + mpUsageList->insertItem(i18n("Panel Buttons")); + mpUsageList->insertItem(i18n("System Tray Icons")); + + // For reading the configuration + mGroups += "Desktop"; + mGroups += "Toolbar"; + mGroups += "MainToolbar"; + mGroups += "Small"; + mGroups += "Panel"; + + mStates += "Default"; + mStates += "Active"; + mStates += "Disabled"; +} + +void TDEIconConfig::initDefaults() +{ + mDefaultEffect[0].type = TDEIconEffect::NoEffect; + mDefaultEffect[1].type = TDEIconEffect::NoEffect; + mDefaultEffect[2].type = TDEIconEffect::ToGray; + mDefaultEffect[0].transparant = false; + mDefaultEffect[1].transparant = false; + mDefaultEffect[2].transparant = true; + mDefaultEffect[0].value = 1.0; + mDefaultEffect[1].value = 1.0; + mDefaultEffect[2].value = 1.0; + mDefaultEffect[0].color = TQColor(144,128,248); + mDefaultEffect[1].color = TQColor(169,156,255); + mDefaultEffect[2].color = TQColor(34,202,0); + mDefaultEffect[0].color2 = TQColor(0,0,0); + mDefaultEffect[1].color2 = TQColor(0,0,0); + mDefaultEffect[2].color2 = TQColor(0,0,0); + + const int defDefSizes[] = { 32, 22, 22, 16, 32 }; + + TDEIcon::Group i; + TQStringList::ConstIterator it; + for(it=mGroups.begin(), i=TDEIcon::FirstGroup; it!=mGroups.end(); ++it, i++) + { + mbDP[i] = false; + mbChanged[i] = true; + mbAnimated[i] = false; + if (mpTheme) + mSizes[i] = mpTheme->defaultSize(i); + else + mSizes[i] = defDefSizes[i]; + + mEffects[i][0] = mDefaultEffect[0]; + mEffects[i][1] = mDefaultEffect[1]; + mEffects[i][2] = mDefaultEffect[2]; + } + // Animate desktop icons by default + int group = mGroups.findIndex( "Desktop" ); + if ( group != -1 ) + mbAnimated[group] = true; + + // This is the new default in KDE 2.2, in sync with the kiconeffect of tdelibs Nolden 2001/06/11 + int activeState = mStates.findIndex( "Active" ); + if ( activeState != -1 ) + { + int group = mGroups.findIndex( "Desktop" ); + if ( group != -1 ) + { + mEffects[ group ][ activeState ].type = TDEIconEffect::ToGamma; + mEffects[ group ][ activeState ].value = 0.7; + } + + group = mGroups.findIndex( "Panel" ); + if ( group != -1 ) + { + mEffects[ group ][ activeState ].type = TDEIconEffect::ToGamma; + mEffects[ group ][ activeState ].value = 0.7; + } + } +} + +void TDEIconConfig::read() +{ + if (mpTheme) + { + for (TDEIcon::Group i=TDEIcon::FirstGroup; i<TDEIcon::LastGroup; i++) + mAvSizes[i] = mpTheme->querySizes(i); + + mTheme = mpTheme->current(); + mExample = mpTheme->example(); + } + else + { + for (TDEIcon::Group i=TDEIcon::FirstGroup; i<TDEIcon::LastGroup; i++) + mAvSizes[i] = TQValueList<int>(); + + mTheme = TQString::null; + mExample = TQString::null; + } + + initDefaults(); + + int i, j, effect; + TQStringList::ConstIterator it, it2; + for (it=mGroups.begin(), i=0; it!=mGroups.end(); ++it, i++) + { + mbChanged[i] = false; + + mpConfig->setGroup(*it + "Icons"); + mSizes[i] = mpConfig->readNumEntry("Size", mSizes[i]); + mbDP[i] = mpConfig->readBoolEntry("DoublePixels", mbDP[i]); + mbAnimated[i] = mpConfig->readBoolEntry("Animated", mbAnimated[i]); + + for (it2=mStates.begin(), j=0; it2!=mStates.end(); ++it2, j++) + { + TQString tmp = mpConfig->readEntry(*it2 + "Effect"); + if (tmp == "togray") + effect = TDEIconEffect::ToGray; + else if (tmp == "colorize") + effect = TDEIconEffect::Colorize; + else if (tmp == "togamma") + effect = TDEIconEffect::ToGamma; + else if (tmp == "desaturate") + effect = TDEIconEffect::DeSaturate; + else if (tmp == "tomonochrome") + effect = TDEIconEffect::ToMonochrome; + else if (tmp == "none") + effect = TDEIconEffect::NoEffect; + else continue; + mEffects[i][j].type = effect; + mEffects[i][j].value = mpConfig->readDoubleNumEntry(*it2 + "Value"); + mEffects[i][j].color = mpConfig->readColorEntry(*it2 + "Color"); + mEffects[i][j].color2 = mpConfig->readColorEntry(*it2 + "Color2"); + mEffects[i][j].transparant = mpConfig->readBoolEntry(*it2 + "SemiTransparent"); + } + } + + + mpSystrayConfig->setGroup("System Tray"); + mSysTraySize = mpSystrayConfig->readNumEntry("systrayIconWidth", 22); + + mpKickerConfig->setGroup("General"); + mQuickLaunchSize = mpKickerConfig->readNumEntry("panelIconWidth", TDEIcon::SizeLarge); + + TDEConfigGroup g( TDEGlobal::config(), "KDE" ); + mpRoundedCheck->setChecked(g.readBoolEntry("IconUseRoundedRect", KDE_DEFAULT_ICONTEXTROUNDED)); + mpActiveEffectCheck->setChecked(g.readBoolEntry("ShowKonqIconActivationEffect", KDE_DEFAULT_KONQ_ACTIVATION_EFFECT)); +} + +void TDEIconConfig::apply() +{ + int i; + + mpUsageList->setCurrentItem(mUsage); + + if (mpUsageList->currentText() == i18n("Panel Buttons")) { + mpSizeBox->clear(); + mpSizeBox->insertItem(TQString().setNum(16)); + mpSizeBox->insertItem(TQString().setNum(22)); + mpSizeBox->insertItem(TQString().setNum(32)); + mpSizeBox->insertItem(TQString().setNum(48)); + mpSizeBox->insertItem(TQString().setNum(64)); + mpSizeBox->insertItem(TQString().setNum(128)); + for (i=0;i<(mpSizeBox->count());i++) { + if (mpSizeBox->text(i) == TQString().setNum(mQuickLaunchSize)) { + mpSizeBox->setCurrentItem(i); + } + } + } + else if (mpUsageList->currentText() == i18n("System Tray Icons")) { + mpSizeBox->clear(); + mpSizeBox->insertItem(TQString().setNum(16)); + mpSizeBox->insertItem(TQString().setNum(22)); + mpSizeBox->insertItem(TQString().setNum(32)); + mpSizeBox->insertItem(TQString().setNum(48)); + mpSizeBox->insertItem(TQString().setNum(64)); + mpSizeBox->insertItem(TQString().setNum(128)); + for (i=0;i<(mpSizeBox->count());i++) { + if (mpSizeBox->text(i) == TQString().setNum(mSysTraySize)) { + mpSizeBox->setCurrentItem(i); + } + } + } + else { + int delta = 1000, dw, index = -1, size = 0, i; + TQValueList<int>::Iterator it; + mpSizeBox->clear(); + if (mUsage < TDEIcon::LastGroup) { + for (it=mAvSizes[mUsage].begin(), i=0; it!=mAvSizes[mUsage].end(); ++it, i++) + { + mpSizeBox->insertItem(TQString().setNum(*it)); + dw = abs(mSizes[mUsage] - *it); + if (dw < delta) + { + delta = dw; + index = i; + size = *it; + } + } + if (index != -1) + { + mpSizeBox->setCurrentItem(index); + mSizes[mUsage] = size; // best or exact match + } + mpDPCheck->setChecked(mbDP[mUsage]); + mpAnimatedCheck->setChecked(mbAnimated[mUsage]); + } + } +} + +void TDEIconConfig::preview(int i) +{ + // Apply effects ourselves because we don't want to sync + // the configuration every preview. + + int viewedGroup; + if (mpUsageList->text(mUsage) == i18n("Panel Buttons")) { + viewedGroup = TDEIcon::FirstGroup; + } + else if (mpUsageList->text(mUsage) == i18n("System Tray Icons")) { + viewedGroup = TDEIcon::FirstGroup; + } + else { + viewedGroup = (mUsage == TDEIcon::LastGroup) ? TDEIcon::FirstGroup : mUsage; + } + + TQPixmap pm; + if (mpUsageList->text(mUsage) == i18n("Panel Buttons")) { + pm = mpLoader->loadIcon(mExample, TDEIcon::NoGroup, mQuickLaunchSize); + } + else if (mpUsageList->text(mUsage) == i18n("System Tray Icons")) { + pm = mpLoader->loadIcon(mExample, TDEIcon::NoGroup, mSysTraySize); + } + else { + pm = mpLoader->loadIcon(mExample, TDEIcon::NoGroup, mSizes[viewedGroup]); + } + TQImage img = pm.convertToImage(); + if (mbDP[viewedGroup]) + { + int w = img.width() * 2; + img = img.smoothScale(w, w); + } + + Effect &effect = mEffects[viewedGroup][i]; + + img = mpEffect->apply(img, effect.type, + effect.value, effect.color, effect.color2, effect.transparant); + pm.convertFromImage(img); + mpPreview[i]->setPixmap(pm); +} + +void TDEIconConfig::preview() +{ + preview(0); + preview(1); + preview(2); +} + +void TDEIconConfig::load() +{ + load( false ); +} + +void TDEIconConfig::load( bool useDefaults ) +{ + mpConfig = TDEGlobal::config(); + mpConfig->setReadDefaults( useDefaults ); + read(); + apply(); + for (int i=0; i<TDEIcon::LastGroup; i++) + mbChanged[i] = false; + preview(); + emit changed( useDefaults ); +} + + +void TDEIconConfig::save() +{ + int i, j; + TQStringList::ConstIterator it, it2; + for (it=mGroups.begin(), i=0; it!=mGroups.end(); ++it, i++) + { + mpConfig->setGroup(*it + "Icons"); + mpConfig->writeEntry("Size", mSizes[i], true, true); + mpConfig->writeEntry("DoublePixels", mbDP[i], true, true); + mpConfig->writeEntry("Animated", mbAnimated[i], true, true); + for (it2=mStates.begin(), j=0; it2!=mStates.end(); ++it2, j++) + { + TQString tmp; + switch (mEffects[i][j].type) + { + case TDEIconEffect::ToGray: + tmp = "togray"; + break; + case TDEIconEffect::ToGamma: + tmp = "togamma"; + break; + case TDEIconEffect::Colorize: + tmp = "colorize"; + break; + case TDEIconEffect::DeSaturate: + tmp = "desaturate"; + break; + case TDEIconEffect::ToMonochrome: + tmp = "tomonochrome"; + break; + default: + tmp = "none"; + break; + } + mpConfig->writeEntry(*it2 + "Effect", tmp, true, true); + mpConfig->writeEntry(*it2 + "Value", mEffects[i][j].value, true, true); + mpConfig->writeEntry(*it2 + "Color", mEffects[i][j].color, true, true); + mpConfig->writeEntry(*it2 + "Color2", mEffects[i][j].color2, true, true); + mpConfig->writeEntry(*it2 + "SemiTransparent", mEffects[i][j].transparant, true, true); + } + } + + // Reload kicker/systray configuration files; we have no way of knowing if any other parameters changed + // from initial read to this write request + mpSystrayConfig->reparseConfiguration(); + mpKickerConfig->reparseConfiguration(); + + mpSystrayConfig->setGroup("System Tray"); + mpSystrayConfig->writeEntry("systrayIconWidth", mSysTraySize); + mpKickerConfig->setGroup("General"); + mpKickerConfig->writeEntry("panelIconWidth", mQuickLaunchSize); + + TDEConfigGroup g( TDEGlobal::config(), "KDE" ); + g.writeEntry("IconUseRoundedRect", mpRoundedCheck->isChecked(), true, true); + g.writeEntry("ShowKonqIconActivationEffect", mpActiveEffectCheck->isChecked(), true, true); + + kapp->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", TQString("") ); + kapp->dcopClient()->send( "kdesktop", "KDesktopIface", "configure()", TQString("") ); + + mpConfig->sync(); + mpSystrayConfig->sync(); + mpKickerConfig->sync(); + + emit changed(false); + + // Emit KIPC change message. + for (int i=0; i<TDEIcon::LastGroup; i++) + { + if (mbChanged[i]) + { + KIPC::sendMessageAll(KIPC::IconChanged, i); + mbChanged[i] = false; + } + } + + // Signal kicker to reload icon configuration + kapp->dcopClient()->send("kicker", "kicker", "configure()", TQByteArray()); + + // Signal system tray to reload icon configuration + kapp->dcopClient()->send("kicker", "SystemTrayApplet", "iconSizeChanged()", TQByteArray()); +} + +void TDEIconConfig::defaults() +{ + load( true ); +} + +void TDEIconConfig::QLSizeLockedChanged(bool checked) { + emit changed(); +} + +void TDEIconConfig::slotUsage(int index) +{ + mUsage = index; + if (mpUsageList->text(index) == i18n("Panel Buttons")) { + mpSizeBox->setEnabled(true); + mpDPCheck->setEnabled(false); + mpAnimatedCheck->setEnabled(false); + mPreviewButton1->setEnabled(false); + mPreviewButton2->setEnabled(false); + mPreviewButton3->setEnabled(false); + } + else if (mpUsageList->text(index) == i18n("System Tray Icons")) { + mpSizeBox->setEnabled(true); + mpDPCheck->setEnabled(false); + mpAnimatedCheck->setEnabled(false); + mPreviewButton1->setEnabled(false); + mPreviewButton2->setEnabled(false); + mPreviewButton3->setEnabled(false); + } + else if ( mUsage == TDEIcon::Panel || mUsage == TDEIcon::LastGroup ) + { + mpSizeBox->setEnabled(false); + mpDPCheck->setEnabled(false); + mpAnimatedCheck->setEnabled( mUsage == TDEIcon::Panel ); + mPreviewButton1->setEnabled(true); + mPreviewButton2->setEnabled(true); + mPreviewButton3->setEnabled(true); + } + else + { + mpSizeBox->setEnabled(true); + mpDPCheck->setEnabled(true); + mpAnimatedCheck->setEnabled( mUsage == TDEIcon::Desktop ); + mPreviewButton1->setEnabled(true); + mPreviewButton2->setEnabled(true); + mPreviewButton3->setEnabled(true); + } + + apply(); + preview(); +} + +void TDEIconConfig::EffectSetup(int state) +{ + int viewedGroup = (mUsage == TDEIcon::LastGroup) ? TDEIcon::FirstGroup : mUsage; + + if (mpUsageList->currentText() == i18n("Panel Buttons")) { + return; + } + if (mpUsageList->currentText() == i18n("System Tray Icons")) { + return; + } + + TQPixmap pm = mpLoader->loadIcon(mExample, TDEIcon::NoGroup, mSizes[viewedGroup]); + TQImage img = pm.convertToImage(); + if (mbDP[viewedGroup]) + { + int w = img.width() * 2; + img = img.smoothScale(w, w); + } + + TQString caption; + switch (state) + { + case 0 : caption = i18n("Setup Default Icon Effect"); break; + case 1 : caption = i18n("Setup Active Icon Effect"); break; + case 2 : caption = i18n("Setup Disabled Icon Effect"); break; + } + + TDEIconEffectSetupDialog dlg(mEffects[viewedGroup][state], mDefaultEffect[state], caption, img); + + if (dlg.exec() == TQDialog::Accepted) + { + if (mUsage == TDEIcon::LastGroup) { + for (int i=0; i<TDEIcon::LastGroup; i++) + mEffects[i][state] = dlg.effect(); + } else { + mEffects[mUsage][state] = dlg.effect(); + } + + // AK - can this call be moved therefore removing + // code duplication? + + emit changed(true); + + if (mUsage == TDEIcon::LastGroup) { + for (int i=0; i<TDEIcon::LastGroup; i++) + mbChanged[i] = true; + } else { + mbChanged[mUsage] = true; + } + } + preview(state); +} + +void TDEIconConfig::slotSize(int index) +{ + if (mpUsageList->currentText() == i18n("Panel Buttons")) { + mQuickLaunchSize = mpSizeBox->currentText().toInt(); + preview(); + emit changed(true); + } + else if (mpUsageList->currentText() == i18n("System Tray Icons")) { + mSysTraySize = mpSizeBox->currentText().toInt(); + preview(); + emit changed(true); + } + else { + Q_ASSERT(mUsage < TDEIcon::LastGroup); + mSizes[mUsage] = mAvSizes[mUsage][index]; + preview(); + emit changed(true); + mbChanged[mUsage] = true; + } +} + +void TDEIconConfig::slotDPCheck(bool check) +{ + Q_ASSERT(mUsage < TDEIcon::LastGroup); + if (mbDP[mUsage] != check) + { + mbDP[mUsage] = check; + emit changed(true); + mbChanged[mUsage] = true; + } + preview(); + +} + +void TDEIconConfig::slotAnimatedCheck(bool check) +{ + Q_ASSERT(mUsage < TDEIcon::LastGroup); + if (mbAnimated[mUsage] != check) + { + mbAnimated[mUsage] = check; + emit changed(true); + mbChanged[mUsage] = true; + } +} + +void TDEIconConfig::slotRoundedCheck(bool check) +{ + emit changed(true); +} + +void TDEIconConfig::slotActiveEffect(bool check) +{ + emit changed(true); +} + +TDEIconEffectSetupDialog::TDEIconEffectSetupDialog(const Effect &effect, + const Effect &defaultEffect, + const TQString &caption, const TQImage &image, + TQWidget *parent, char *name) + : KDialogBase(parent, name, true, caption, + Default|Ok|Cancel, Ok, true), + mEffect(effect), + mDefaultEffect(defaultEffect), + mExample(image) +{ + mpEffect = new TDEIconEffect; + + TQLabel *lbl; + TQGroupBox *frame; + TQGridLayout *grid; + + TQWidget *page = new TQWidget(this); + setMainWidget(page); + + TQGridLayout *top = new TQGridLayout(page, 4, 2, 0, spacingHint()); + top->setColStretch(0,1); + top->addColSpacing(1,10); + top->setColStretch(2,2); + top->setRowStretch(1,1); + + lbl = new TQLabel(i18n("&Effect:"), page); + lbl->setFixedSize(lbl->sizeHint()); + top->addWidget(lbl, 0, 0, Qt::AlignLeft); + mpEffectBox = new TQListBox(page); + mpEffectBox->insertItem(i18n("No Effect")); + mpEffectBox->insertItem(i18n("To Gray")); + mpEffectBox->insertItem(i18n("Colorize")); + mpEffectBox->insertItem(i18n("Gamma")); + mpEffectBox->insertItem(i18n("Desaturate")); + mpEffectBox->insertItem(i18n("To Monochrome")); + mpEffectBox->setMinimumWidth( 100 ); + connect(mpEffectBox, TQT_SIGNAL(highlighted(int)), TQT_SLOT(slotEffectType(int))); + top->addMultiCellWidget(mpEffectBox, 1, 2, 0, 0, Qt::AlignLeft); + lbl->setBuddy(mpEffectBox); + + mpSTCheck = new TQCheckBox(i18n("&Semi-transparent"), page); + connect(mpSTCheck, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotSTCheck(bool))); + top->addWidget(mpSTCheck, 3, 0, Qt::AlignLeft); + + frame = new TQGroupBox(i18n("Preview"), page); + top->addMultiCellWidget(frame, 0, 1, 1, 1); + grid = new TQGridLayout(frame, 2, 1, marginHint(), spacingHint()); + grid->addRowSpacing(0, fontMetrics().lineSpacing()); + grid->setRowStretch(1, 1); + + mpPreview = new TQLabel(frame); + mpPreview->setAlignment(AlignCenter); + mpPreview->setMinimumSize(105, 105); + grid->addWidget(mpPreview, 1, 0); + + mpEffectGroup = new TQGroupBox(i18n("Effect Parameters"), page); + top->addMultiCellWidget(mpEffectGroup, 2, 3, 1, 1); + grid = new TQGridLayout(mpEffectGroup, 3, 2, marginHint(), spacingHint()); + grid->addRowSpacing(0, fontMetrics().lineSpacing()); + + mpEffectLabel = new TQLabel(i18n("&Amount:"), mpEffectGroup); + grid->addWidget(mpEffectLabel, 1, 0); + mpEffectSlider = new TQSlider(0, 100, 5, 10, Qt::Horizontal, mpEffectGroup); + mpEffectLabel->setBuddy( mpEffectSlider ); + connect(mpEffectSlider, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotEffectValue(int))); + grid->addWidget(mpEffectSlider, 1, 1); + + mpEffectColor = new TQLabel(i18n("Co&lor:"), mpEffectGroup); + grid->addWidget(mpEffectColor, 2, 0); + mpEColButton = new KColorButton(mpEffectGroup); + mpEffectColor->setBuddy( mpEColButton ); + connect(mpEColButton, TQT_SIGNAL(changed(const TQColor &)), + TQT_SLOT(slotEffectColor(const TQColor &))); + grid->addWidget(mpEColButton, 2, 1); + + mpEffectColor2 = new TQLabel(i18n("&Second color:"), mpEffectGroup); + grid->addWidget(mpEffectColor2, 3, 0); + mpECol2Button = new KColorButton(mpEffectGroup); + mpEffectColor2->setBuddy( mpECol2Button ); + connect(mpECol2Button, TQT_SIGNAL(changed(const TQColor &)), + TQT_SLOT(slotEffectColor2(const TQColor &))); + grid->addWidget(mpECol2Button, 3, 1); + + init(); + preview(); +} + +TDEIconEffectSetupDialog::~TDEIconEffectSetupDialog() +{ + delete mpEffect; +} + +void TDEIconEffectSetupDialog::init() +{ + mpEffectBox->setCurrentItem(mEffect.type); + mpEffectSlider->setEnabled(mEffect.type != TDEIconEffect::NoEffect); + mpEColButton->setEnabled(mEffect.type == TDEIconEffect::Colorize || mEffect.type == TDEIconEffect::ToMonochrome); + mpECol2Button->setEnabled(mEffect.type == TDEIconEffect::ToMonochrome); + mpEffectSlider->setValue((int) (100.0 * mEffect.value + 0.5)); + mpEColButton->setColor(mEffect.color); + mpECol2Button->setColor(mEffect.color2); + mpSTCheck->setChecked(mEffect.transparant); +} + +void TDEIconEffectSetupDialog::slotEffectValue(int value) +{ + mEffect.value = 0.01 * value; + preview(); +} + +void TDEIconEffectSetupDialog::slotEffectColor(const TQColor &col) +{ + mEffect.color = col; + preview(); +} + +void TDEIconEffectSetupDialog::slotEffectColor2(const TQColor &col) +{ + mEffect.color2 = col; + preview(); +} + +void TDEIconEffectSetupDialog::slotEffectType(int type) +{ + mEffect.type = type; + mpEffectGroup->setEnabled(mEffect.type != TDEIconEffect::NoEffect); + mpEffectSlider->setEnabled(mEffect.type != TDEIconEffect::NoEffect); + mpEffectColor->setEnabled(mEffect.type == TDEIconEffect::Colorize || mEffect.type == TDEIconEffect::ToMonochrome); + mpEColButton->setEnabled(mEffect.type == TDEIconEffect::Colorize || mEffect.type == TDEIconEffect::ToMonochrome); + mpEffectColor2->setEnabled(mEffect.type == TDEIconEffect::ToMonochrome); + mpECol2Button->setEnabled(mEffect.type == TDEIconEffect::ToMonochrome); + preview(); +} + +void TDEIconEffectSetupDialog::slotSTCheck(bool b) +{ + mEffect.transparant = b; + preview(); +} + +void TDEIconEffectSetupDialog::slotDefault() +{ + mEffect = mDefaultEffect; + init(); + preview(); +} + +void TDEIconEffectSetupDialog::preview() +{ + TQPixmap pm; + TQImage img = mExample.copy(); + img = mpEffect->apply(img, mEffect.type, + mEffect.value, mEffect.color, mEffect.color2, mEffect.transparant); + pm.convertFromImage(img); + mpPreview->setPixmap(pm); +} + +#include "icons.moc" diff --git a/kcontrol/icons/icons.desktop b/kcontrol/icons/icons.desktop new file mode 100644 index 000000000..721f2830a --- /dev/null +++ b/kcontrol/icons/icons.desktop @@ -0,0 +1,249 @@ +[Desktop Entry] +Type=Application +DocPath=kcontrol/icons/index.html +Icon=icons +Exec=tdecmshell icons + + +X-TDE-Library=icons +X-TDE-FactoryName=icons +X-TDE-ParentApp=kcontrol + +Name=Icons +Name[af]=Ikoone +Name[ar]=الأيقونات +Name[az]=Timsallar +Name[be]=Значкі +Name[bg]=Икони +Name[bn]=আইকন +Name[br]=Arlunioù +Name[bs]=Ikone +Name[ca]=Icones +Name[cs]=Ikony +Name[csb]=Ikònë +Name[cy]=Eicon +Name[da]=Ikoner +Name[de]=Symbole +Name[el]=Εικονίδια +Name[eo]=Piktogramoj +Name[es]=Iconos +Name[et]=Ikoonid +Name[eu]=Ikonoak +Name[fa]=شمایلها +Name[fi]=Kuvakkeet +Name[fr]=Icônes +Name[fy]=Byldkaikes +Name[ga]=Deilbhíní +Name[gl]=Iconas +Name[he]=סמלים +Name[hi]=प्रतीक +Name[hr]=Ikone +Name[hu]=Ikonok +Name[id]=Ikon +Name[is]=Táknmyndir +Name[it]=Icone +Name[ja]=アイコン +Name[ka]=ხატულები +Name[kk]=Таңбашалар +Name[km]=រូបតំណាង +Name[ko]=아이콘 +Name[lo]=ໄອຄອນ +Name[lt]=Ženkliukai +Name[lv]=Ikonas +Name[mk]=Икони +Name[mn]=Тэмдэг +Name[ms]=Ikon +Name[mt]=Ikoni +Name[nb]=Ikoner +Name[nds]=Lüttbiller +Name[ne]=प्रतिमा +Name[nl]=Pictogrammen +Name[nn]=Ikon +Name[nso]=Diemedi +Name[oc]=Icones +Name[pa]=ਆਈਕਾਨ +Name[pl]=Ikony +Name[pt]=Ícones +Name[pt_BR]=Ícones +Name[ro]=Iconițe +Name[ru]=Значки +Name[rw]=Agashushondanga +Name[se]=Govažat +Name[sk]=Ikony +Name[sl]=Ikone +Name[sr]=Иконе +Name[sr@Latn]=Ikone +Name[ss]=Timeleli +Name[sv]=Ikoner +Name[ta]=சின்னங்கள் +Name[te]=ప్రతిమలు +Name[tg]=Нишонаҳо +Name[th]=ไอคอน +Name[tr]=Simgeler +Name[tt]=Tamğalar +Name[uk]=Піктограми +Name[uz]=Nishonchalar +Name[uz@cyrillic]=Нишончалар +Name[ven]=Aikhono +Name[vi]=Biểu tượng +Name[wa]=Imådjetes +Name[xh]=Imphawu zemmifanekiso +Name[zh_CN]=图标 +Name[zh_TW]=圖示 +Name[zu]=Izimpawu zezithombe + +Comment=Customize TDE Icons +Comment[af]=Pasmaak Kde Ikoone +Comment[ar]=تخصيص أيقونات TDE الإعتيادية +Comment[az]=TDE Timsallarını Xüsusiləşdirir +Comment[be]=Настаўленні значак TDE +Comment[bg]=Настройване и избор на тема с икони +Comment[bn]=কে.ডি.ই. আইকন বেছে নিন +Comment[br]=Neuziañ arlunioù TDE +Comment[bs]=Podesite TDE ikone +Comment[ca]=Configura les icones del TDE +Comment[cs]=Přizpůsobení ikon TDE +Comment[csb]=Dopasëjë ikònë TDE +Comment[cy]=Addasu Eiconau TDE +Comment[da]=Brugerdefinér TDE-ikoner +Comment[de]=TDE-Symbole einrichten +Comment[el]=Προσαρμογή των εικονιδίων του TDE +Comment[en_GB]=Customise TDE Icons +Comment[eo]=Agordo de TDE-piktogramoj +Comment[es]=Personaliza los iconos de TDE +Comment[et]=TDE ikoonide kohandamine +Comment[eu]=Pertsonalizatu TDEren ikonoak +Comment[fa]=سفارشیسازی شمایلهای TDE +Comment[fi]=Muokkaa TDE:n kuvakkeita +Comment[fr]=Personnalisation des icônes de TDE +Comment[fy]=TDE-byldkaikes oanpasse +Comment[ga]=Saincheap Deilbhíní TDE +Comment[gl]=Personaliza as Iconas de TDE +Comment[he]=שינוי הגדרות הסמלים של TDE +Comment[hi]=केडीई प्रतीक मनपसंद बनाएँ +Comment[hr]=Prilagođavanje TDE ikona +Comment[hu]=A TDE ikonok testreszabása +Comment[id]=Customize Ikon TDE +Comment[is]=Stilla táknmyndir TDE +Comment[it]=Personalizza le icone di TDE +Comment[ja]=TDE アイコンをカスタマイズ +Comment[ka]=TDE–ს ხატულების კონფიგურაცია +Comment[kk]=TDE таңбашаларын баптау +Comment[km]=ប្ដូររូបតំណាង TDE តាមបំណង +Comment[ko]=TDE 아이콘 사용자 정의 +Comment[lo]=ເລືອກໄອຄອນຂອງ TDE ເອງ +Comment[lt]=TDE ženkliukų derinimas +Comment[lv]=Pielāgot TDE Ikonas +Comment[mk]=Прилагоди ги иконите на TDE +Comment[mn]=КДЭ-Тэмдэг тохируулах +Comment[ms]=Ikon TDE Langganan +Comment[mt]=Agħżel ikoni ġodda għal TDE +Comment[nb]=Tilpass ikonene i TDE +Comment[nds]=Lüttbiller för TDE utsöken +Comment[ne]=केडीई प्रतिमा अनुकूलन गर्नुहोस् +Comment[nl]=TDE-pictogrammen aanpassen +Comment[nn]=Tilpass TDE-ikon +Comment[nso]=Amanya Diemedi tsa TDE +Comment[oc]=Configura les icones TDE +Comment[pa]=TDE ਆਈਕਾਨ ਪਸੰਦ +Comment[pl]=Dostosuj ikony TDE +Comment[pt]=Alterar os Ícones do TDE +Comment[pt_BR]=Personalizar os ícones do TDE +Comment[ro]=Personalizează iconițele TDE +Comment[ru]=Настройка значков +Comment[rw]=Kugena imiterere y'udushushondanga twa TDE +Comment[se]=Heivet TDE-govažiid +Comment[sk]=Zmena ikon v TDE +Comment[sl]=Nastavitve ikon za TDE +Comment[sr]=Прилагоди TDE иконе +Comment[sr@Latn]=Prilagodi TDE ikone +Comment[sv]=Anpassa TDE:s ikoner +Comment[ta]=TDE சின்னங்களை தனதாக்கு +Comment[tg]=Мизроб кардани нишонаҳои TDE +Comment[th]=กำหนดไอคอนของ TDE +Comment[tr]=TDE Simgelerini Özelleştirir +Comment[tt]=TDE İkonnarın caylaw +Comment[uk]=Налаштування піктограм TDE +Comment[uz]=TDE nishonchalarini moslash +Comment[uz@cyrillic]=TDE нишончаларини мослаш +Comment[ven]=Customize dziaikhonu dza TDE +Comment[vi]=Tuỳ chọn các Biểu tượng của TDE +Comment[wa]=Imådjetes TDE da vosse +Comment[xh]=Yenza Imphawu zomfanekiso ze TDE Ngokwemfuneko +Comment[zh_CN]=定制 TDE 图标 +Comment[zh_TW]=自訂 TDE 圖示 +Comment[zu]=Yenza Izimpawu zezithombe ze-TDE ngokwemfuneko + +Keywords=icons,effects,size,hicolor,locolor +Keywords[ar]=icons,effects,size,hicolor,locolor,أيقونات,تأثيرات,حجم لون عالي,لون مخفض,الحجم,التأثيرات,الأيقونات +Keywords[az]=timsallar,effektlər,böyüklük,yüksək rəng,alçaq rəng +Keywords[be]=значкі,эфекты,памер,кантраст,высокі кантраст,нізкі кантраст,icons,effects,size,hicolor,locolor +Keywords[bg]=икона, икони, icons, effects, size, hicolor, locolor +Keywords[br]=arlunioù,efedoù,ment,liv,liv izel +Keywords[bs]=icons,effects,size,hicolor,locolor,ikone,efekti,veličina +Keywords[ca]=icones,efectes,mida,hicolor,locolor +Keywords[cs]=Ikony,Efekty,Velikost,HiColor,LoColor +Keywords[csb]=ikònë,efektë,miara,wiele farwów,mało farwów +Keywords[cy]=eicon,effeithiau,maint,lliw uchel,lliw isel +Keywords[da]=ikoner,effekter,størrelse,højfarve,lavfarve +Keywords[de]=Symbole,Icons,Effekte,Größe,64000-Farben,8-Bit-Farben +Keywords[el]=εικονίδια,εφέ,μέγεθος,hicolor,locolor +Keywords[en_GB]=icons,effects,size,hicolour,locolour +Keywords[eo]=piktogramoj,efektoj,grandeco,koloro +Keywords[es]=iconos,efectos,tamaño,alta profundidad,baja profundidad +Keywords[et]=ikoonid,efektid,suurus,värv +Keywords[eu]=ikonoak,efektuak,neurria,hicolor,locolor +Keywords[fa]=شمایلها، جلوهها، اندازه، پررنگ، کمرنگ +Keywords[fi]=kuvakkeet,tehosteet,koko,korkeaväri,matalaväri +Keywords[fr]=icônes,effets,taille,hicolor,locolor,coloré +Keywords[fy]=iconen,byldkaikes,effekten,grutte,ôfmjiting,formaat,kleuren,hege,lege +Keywords[gl]=iconas,efeitos,tamaño,moitas cores,poucas cores +Keywords[he]=סמלים,אפקטים,גודל,צבע גבוה,צבע נמוך,icons,effects,size,hicolor,locolor +Keywords[hi]=प्रतीक,प्रभाव,आकार,अधिक-रंग,कम-रंग +Keywords[hr]=icons,effects,size,hicolor,locolor,ikone,efekti,veličina,boja +Keywords[hu]=ikonok,effektek,méret,sokszínű,színszegény,színes +Keywords[id]=ikon,efek,ukuran,hicolor,locolor +Keywords[is]=táknmynd,tákn,teikn,áhrif,stærð,hágæði,lágæði,litur,litir +Keywords[it]=icone,effetti,dimensione,molti colori,pochi colori +Keywords[ja]=アイコン,効果,サイズ,ハイカラー,ローカラー +Keywords[ka]=ხატულები,ეფექტები,ზომა,მაღალი გარჩევადობა,დაბალი გარჩევადობა +Keywords[km]=រូបតំណាង,បែបបទ,ទំហំ,ពណ៌ខ្ពស់,ពណ៌ទាប +Keywords[lo]=ໄອຄອນ,ເອຟເຟັກ,ຂະຫນາດ,ຄວາມລະອງດສີ ຫລາຍ,ຄວາມລະອງດສີຫນ້ອຍ +Keywords[lt]=ženkliukai,piktogramos,efektai,dydis,hispalva,lospalva +Keywords[lv]=ikonas,efekti,lielums,hicolor,locolor +Keywords[mk]=icons,effects,size,hicolor,locolor,икони,ефекти,големина,високи бои,ниски бои +Keywords[mn]=Тэмдэг,Icons,Нөлөө,Хэмжээ,64000-Өнгө,8бит-Өнгө +Keywords[nb]=ikoner,effekter,størrelse,mange farger,få farger +Keywords[nds]=Lüttbiller,Effekten,Grött,hicolor,locolor +Keywords[ne]=प्रतिमा, प्रभाव, साइज, हाइकलर, लोकलर +Keywords[nl]=iconen,pictogrammen,effecten,grootte,afmeting,formaat,kleuren +Keywords[nn]=ikon,effektar,storleik,mange fargar,få fargar +Keywords[nso]=diemedi,dikamego,bogolo,mmala wa godimo,mmala wa tlase +Keywords[oc]=icones,efectes,talha,hicolor,locolor +Keywords[pa]=icons,effects,size,hicolor,locolor,ਆਈਕਾਨ,ਪਰਭਾਵ,ਅਕਾਰ +Keywords[pl]=ikony,efekty,rozmiar,wiele kolorów,mało kolorów +Keywords[pt]=ícones,efeitos,tamanho,muitas cores,poucas cores +Keywords[pt_BR]=ícones,efeitos,tamanho,alta resolução,baixa resolução +Keywords[ro]=iconițe,efecte,mărime,culori multe,culori puține +Keywords[rw]=Udushushondanga,ingaruka,ingano,ibara-hejuru,ibara-hasi +Keywords[se]=govažat,effects,sturrodat,máŋga ivnni,unnan ivnnit +Keywords[sk]=ikony,ikonky,veľkosť,hicolor,locolor +Keywords[sl]=ikone,efekti,velikost,barve +Keywords[sr]=icons,effects,size,hicolor,locolor,иконе,ефекти,величина,пуно боја,мало боја +Keywords[sr@Latn]=icons,effects,size,hicolor,locolor,ikone,efekti,veličina,puno boja,malo boja +Keywords[sv]=ikoner,effekter,storlek,många färger,få färger +Keywords[ta]=சின்னங்கள்,விளைவுகள்,அளவு,அதிக வண்ணம்,குறைந்த வண்ணம் +Keywords[th]=ไอคอน,เอฟเฟ็กต์,ขนาด,ความละเอียดสีมาก,ความละเอียดสีน้อย +Keywords[tr]=simgeler,efektler,boyut,yüksek renk,düşük renk +Keywords[uk]=піктограми,icons,ефекти,розмір,кольори +Keywords[uz]=nishonchalar,effektlar,oʻlchami +Keywords[uz@cyrillic]=нишончалар,эффектлар,ўлчами +Keywords[ven]=dziaikhono,zwivhangi,saizi,muvhala wa ntha,muvhala wa fhasi +Keywords[vi]=biểu tượng,hiệu ứng,cỡ,màu tươi,màu thẫm +Keywords[wa]=imådjetes,efets,grandeu,hicolor,locolor +Keywords[xh]=imphawu zomfanekiso,iziphumo,ubungakanani,hicolor,locolor +Keywords[zh_CN]=icons,effects,size,hicolor,locolor,图标,效果,大小,高色彩,低色彩 +Keywords[zh_TW]=icons,effects,size,hicolor,locolor,圖示,效果,大小,高彩,低彩 +Keywords[zu]=izimpawu,imiphumela,usayizi,umbala ophezulu,umbala ophansi + +Categories=Qt;TDE;X-TDE-settings-looknfeel; diff --git a/kcontrol/icons/icons.h b/kcontrol/icons/icons.h new file mode 100644 index 000000000..1438a9f1a --- /dev/null +++ b/kcontrol/icons/icons.h @@ -0,0 +1,161 @@ +/* vi: ts=8 sts=4 sw=4 + * + * This file is part of the KDE project, module kcmdisplay. + * Copyright (C) 2000 Geert Jansen <jansen@kde.org> + * with minor additions and based on ideas from + * Torsten Rahn <torsten@kde.org> + * + * You can Freely distribute this program under the GNU General Public + * License. See the file "COPYING" for the exact licensing terms. + */ + +#ifndef __icons_h__ +#define __icons_h__ + +#include <tqcolor.h> +#include <tqimage.h> +#include <tqvaluelist.h> + +#include <tdecmodule.h> +#include <kdialogbase.h> +#include <ksimpleconfig.h> + +class TQCheckBox; +class TQColor; +class TQComboBox; +class TQGridLayout; +class TQGroupBox; +class TQIconView; +class TQLabel; +class TQListBox; +class TQListView; +class TQPushButton; +class TQSlider; +class TQTabWidget; +class TQWidget; + +class KColorButton; +class TDEConfig; +class TDEIconEffect; +class TDEIconLoader; +class TDEIconTheme; + +struct Effect +{ + int type; + float value; + TQColor color; + TQColor color2; + bool transparant; +}; + + +/** + * The General Icons tab in kcontrol. + */ +class TDEIconConfig: public TDECModule +{ + Q_OBJECT + +public: + TDEIconConfig(TQWidget *parent, const char *name=0); + ~TDEIconConfig(); + + virtual void load(); + virtual void load( bool useDefaults ); + virtual void save(); + virtual void defaults(); + void preview(); + +private slots: + void slotEffectSetup0() { EffectSetup(0); } + void slotEffectSetup1() { EffectSetup(1); } + void slotEffectSetup2() { EffectSetup(2); } + + void slotUsage(int index); + void slotSize(int index); + void slotDPCheck(bool check); + void slotAnimatedCheck(bool check); + void slotRoundedCheck(bool check); + void slotActiveEffect(bool check); + void QLSizeLockedChanged(bool checked); + +private: + void preview(int i); + void EffectSetup(int state); + TQPushButton *addPreviewIcon(int i, const TQString &str, TQWidget *parent, TQGridLayout *lay); + void init(); + void initDefaults(); + void read(); + void apply(); + + + bool mbDP[6], mbChanged[6], mbAnimated[6]; + int mSizes[6]; + TQValueList<int> mAvSizes[6]; + + Effect mEffects[6][3]; + Effect mDefaultEffect[3]; + + int mUsage; + TQString mTheme, mExample; + TQStringList mGroups, mStates; + int mSysTraySize; + int mQuickLaunchSize; + + TDEIconEffect *mpEffect; + TDEIconTheme *mpTheme; + TDEIconLoader *mpLoader; + TDEConfig *mpConfig; + KSimpleConfig *mpSystrayConfig; + KSimpleConfig *mpKickerConfig; + + typedef TQLabel *QLabelPtr; + QLabelPtr mpPreview[3]; + + TQListBox *mpUsageList; + TQComboBox *mpSizeBox; + TQCheckBox *mpDPCheck, *wordWrapCB, *underlineCB, *mpAnimatedCheck, *mpRoundedCheck, *mpActiveEffectCheck; + TQTabWidget *m_pTabWidget; + TQWidget *m_pTab1; + TQPushButton *mPreviewButton1, *mPreviewButton2, *mPreviewButton3; +}; + +class TDEIconEffectSetupDialog: public KDialogBase +{ + Q_OBJECT + +public: + TDEIconEffectSetupDialog(const Effect &, const Effect &, + const TQString &, const TQImage &, + TQWidget *parent=0L, char *name=0L); + ~TDEIconEffectSetupDialog(); + Effect effect() { return mEffect; } + +protected: + void preview(); + void init(); + +protected slots: + void slotEffectValue(int value); + void slotEffectColor(const TQColor &col); + void slotEffectColor2(const TQColor &col); + void slotEffectType(int type); + void slotSTCheck(bool b); + void slotDefault(); + +private: + TDEIconEffect *mpEffect; + TQListBox *mpEffectBox; + TQCheckBox *mpSTCheck; + TQSlider *mpEffectSlider; + KColorButton *mpEColButton; + KColorButton *mpECol2Button; + Effect mEffect; + Effect mDefaultEffect; + TQImage mExample; + TQGroupBox *mpEffectGroup; + TQLabel *mpPreview, *mpEffectLabel, *mpEffectColor, *mpEffectColor2; +}; + +#endif diff --git a/kcontrol/icons/iconthemes.cpp b/kcontrol/icons/iconthemes.cpp new file mode 100644 index 000000000..fe0a59ee7 --- /dev/null +++ b/kcontrol/icons/iconthemes.cpp @@ -0,0 +1,452 @@ +/** + * Copyright (c) 2000 Antonio Larrosa <larrosa@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <config.h> + +#include <stdlib.h> +#include <unistd.h> + +#include <tqfileinfo.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqpushbutton.h> + +#include <kdebug.h> +#include <tdeapplication.h> +#include <kstandarddirs.h> +#include <kservice.h> +#include <tdelocale.h> +#include <ksimpleconfig.h> +#undef Unsorted +#include <kipc.h> + +#include <tdelistview.h> +#include <kurlrequesterdlg.h> +#include <tdemessagebox.h> +#include <kprogress.h> +#include <kiconloader.h> + +#include <tdeio/job.h> +#include <tdeio/netaccess.h> +#include <ktar.h> + +#ifdef HAVE_LIBART +#include <ksvgiconengine.h> +#endif + +#include "iconthemes.h" + +IconThemesConfig::IconThemesConfig(TQWidget *parent, const char *name) + : TDECModule(parent, name) +{ + TQVBoxLayout *topLayout = new TQVBoxLayout(this, KDialog::marginHint(), + KDialog::spacingHint()); + + TQFrame *m_preview=new TQFrame(this); + m_preview->setMinimumHeight(50); + + TQHBoxLayout *lh2=new TQHBoxLayout( m_preview ); + m_previewExec=new TQLabel(m_preview); + m_previewExec->setPixmap(DesktopIcon("exec")); + m_previewFolder=new TQLabel(m_preview); + m_previewFolder->setPixmap(DesktopIcon("folder")); + m_previewDocument=new TQLabel(m_preview); + m_previewDocument->setPixmap(DesktopIcon("document")); + + lh2->addStretch(10); + lh2->addWidget(m_previewExec); + lh2->addStretch(1); + lh2->addWidget(m_previewFolder); + lh2->addStretch(1); + lh2->addWidget(m_previewDocument); + lh2->addStretch(10); + + + m_iconThemes=new TDEListView(this,"IconThemeList"); + m_iconThemes->addColumn(i18n("Name")); + m_iconThemes->addColumn(i18n("Description")); + m_iconThemes->setAllColumnsShowFocus( true ); + m_iconThemes->setFullWidth(true); + connect(m_iconThemes,TQT_SIGNAL(selectionChanged(TQListViewItem *)), + TQT_SLOT(themeSelected(TQListViewItem *))); + + TQPushButton *installButton=new TQPushButton( i18n("Install New Theme..."), + this, "InstallNewTheme"); + connect(installButton,TQT_SIGNAL(clicked()),TQT_SLOT(installNewTheme())); + m_removeButton=new TQPushButton( i18n("Remove Theme"), + this, "RemoveTheme"); + connect(m_removeButton,TQT_SIGNAL(clicked()),TQT_SLOT(removeSelectedTheme())); + + topLayout->addWidget( + new TQLabel(i18n("Select the icon theme you want to use:"), this)); + topLayout->addWidget(m_preview); + topLayout->addWidget(m_iconThemes); + TQHBoxLayout *lg = new TQHBoxLayout(topLayout, KDialog::spacingHint()); + lg->addWidget(installButton); + lg->addWidget(m_removeButton); + + loadThemes(); + + load(); + + m_iconThemes->setFocus(); +} + +IconThemesConfig::~IconThemesConfig() +{ +} + +TQListViewItem *IconThemesConfig::iconThemeItem(const TQString &name) +{ + TQListViewItem *item; + for ( item=m_iconThemes->firstChild(); item ; item=item->nextSibling() ) + if (m_themeNames[item->text(0)]==name) return item; + + return 0L; +} + +void IconThemesConfig::loadThemes() +{ + m_iconThemes->clear(); + m_themeNames.clear(); + TQStringList themelist(TDEIconTheme::list()); + TQString name; + TQString tname; + TQStringList::Iterator it; + for (it=themelist.begin(); it != themelist.end(); ++it) + { + TDEIconTheme icontheme(*it); + if (!icontheme.isValid()) kdDebug() << "notvalid\n"; + if (icontheme.isHidden()) continue; + + name=icontheme.name(); + tname=name; + + // Just in case we have duplicated icon theme names on separate directories + for (int i=2; m_themeNames.find(tname)!=m_themeNames.end() ; i++) + tname=TQString("%1-%2").arg(name).arg(i); + + m_iconThemes->insertItem(new TQListViewItem(m_iconThemes,name, + icontheme.description())); + + m_themeNames.insert(name,*it); + + } +} + +void IconThemesConfig::installNewTheme() +{ + KURL themeURL = KURLRequesterDlg::getURL(TQString::null, this, + i18n("Drag or Type Theme URL")); + kdDebug() << themeURL.prettyURL() << endl; + + if (themeURL.url().isEmpty()) return; + + TQString themeTmpFile; + // themeTmpFile contains the name of the downloaded file + + if (!TDEIO::NetAccess::download(themeURL, themeTmpFile, this)) { + TQString sorryText; + if (themeURL.isLocalFile()) + sorryText = i18n("Unable to find the icon theme archive %1."); + else + sorryText = i18n("Unable to download the icon theme archive;\n" + "please check that address %1 is correct."); + KMessageBox::sorry(this, sorryText.arg(themeURL.prettyURL())); + return; + } + + TQStringList themesNames = findThemeDirs(themeTmpFile); + if (themesNames.isEmpty()) { + TQString invalidArch(i18n("The file is not a valid icon theme archive.")); + KMessageBox::error(this, invalidArch); + + TDEIO::NetAccess::removeTempFile(themeTmpFile); + return; + } + + if (!installThemes(themesNames, themeTmpFile)) { + //FIXME: make me able to know what is wrong.... + // TQStringList instead of bool? + TQString somethingWrong = + i18n("A problem occurred during the installation process; " + "however, most of the themes in the archive have been installed"); + KMessageBox::error(this, somethingWrong); + } + + TDEIO::NetAccess::removeTempFile(themeTmpFile); + + TDEGlobal::instance()->newIconLoader(); + loadThemes(); + + TQListViewItem *item=iconThemeItem(TDEIconTheme::current()); + m_iconThemes->setSelected(item, true); + updateRemoveButton(); +} + +bool IconThemesConfig::installThemes(const TQStringList &themes, const TQString &archiveName) +{ + bool everythingOk = true; + TQString localThemesDir(locateLocal("icon", "./")); + + KProgressDialog progressDiag(this, "themeinstallprogress", + i18n("Installing icon themes"), + TQString::null, + true); + progressDiag.setAutoClose(true); + progressDiag.progressBar()->setTotalSteps(themes.count()); + progressDiag.show(); + + KTar archive(archiveName); + archive.open(IO_ReadOnly); + kapp->processEvents(); + + const KArchiveDirectory* rootDir = archive.directory(); + + KArchiveDirectory* currentTheme; + for (TQStringList::ConstIterator it = themes.begin(); + it != themes.end(); + ++it) { + progressDiag.setLabel( + i18n("<qt>Installing <strong>%1</strong> theme</qt>") + .arg(*it)); + kapp->processEvents(); + + if (progressDiag.wasCancelled()) + break; + + currentTheme = dynamic_cast<KArchiveDirectory*>( + const_cast<KArchiveEntry*>( + rootDir->entry(*it))); + if (currentTheme == NULL) { + // we tell back that something went wrong, but try to install as much + // as possible + everythingOk = false; + continue; + } + + currentTheme->copyTo(localThemesDir + *it); + progressDiag.progressBar()->advance(1); + } + + archive.close(); + return everythingOk; +} + +TQStringList IconThemesConfig::findThemeDirs(const TQString &archiveName) +{ + TQStringList foundThemes; + + KTar archive(archiveName); + archive.open(IO_ReadOnly); + const KArchiveDirectory* themeDir = archive.directory(); + + KArchiveEntry* possibleDir = 0L; + KArchiveDirectory* subDir = 0L; + + // iterate all the dirs looking for an index.theme or index.desktop file + TQStringList entries = themeDir->entries(); + for (TQStringList::Iterator it = entries.begin(); + it != entries.end(); + ++it) { + possibleDir = const_cast<KArchiveEntry*>(themeDir->entry(*it)); + if (possibleDir->isDirectory()) { + subDir = dynamic_cast<KArchiveDirectory*>( possibleDir ); + if (subDir && (subDir->entry("index.theme") != NULL || + subDir->entry("index.desktop") != NULL)) + foundThemes.append(subDir->name()); + } + } + + archive.close(); + return foundThemes; +} + +void IconThemesConfig::removeSelectedTheme() +{ + TQListViewItem *selected = m_iconThemes->selectedItem(); + if (!selected) + return; + + TQString question=i18n("<qt>Are you sure you want to remove the " + "<strong>%1</strong> icon theme?<br>" + "<br>" + "This will delete the files installed by this theme.</qt>"). + arg(selected->text(0)); + + bool deletingCurrentTheme=(selected==iconThemeItem(TDEIconTheme::current())); + + int r=KMessageBox::warningContinueCancel(this,question,i18n("Confirmation"),KStdGuiItem::del()); + if (r!=KMessageBox::Continue) return; + + TDEIconTheme icontheme(m_themeNames[selected->text(0)]); + + // delete the index file before the async TDEIO::del so loadThemes() will + // ignore that dir. + unlink(TQFile::encodeName(icontheme.dir()+"/index.theme").data()); + unlink(TQFile::encodeName(icontheme.dir()+"/index.desktop").data()); + TDEIO::del(KURL( icontheme.dir() )); + + TDEGlobal::instance()->newIconLoader(); + + loadThemes(); + + TQListViewItem *item=0L; + //Fallback to the default if we've deleted the current theme + if (!deletingCurrentTheme) + item=iconThemeItem(TDEIconTheme::current()); + if (!item) + item=iconThemeItem(TDEIconTheme::defaultThemeName()); + + m_iconThemes->setSelected(item, true); + updateRemoveButton(); + + if (deletingCurrentTheme) // Change the configuration + save(); +} + +void IconThemesConfig::updateRemoveButton() +{ + TQListViewItem *selected = m_iconThemes->selectedItem(); + bool enabled = false; + if (selected) + { + TDEIconTheme icontheme(m_themeNames[selected->text(0)]); + TQFileInfo fi(icontheme.dir()); + enabled = fi.isWritable(); + // Don't let users remove the current theme. + if(m_themeNames[selected->text(0)] == TDEIconTheme::current() || + m_themeNames[selected->text(0)] == TDEIconTheme::defaultThemeName()) + enabled = false; + } + m_removeButton->setEnabled(enabled); +} + +void IconThemesConfig::themeSelected(TQListViewItem *item) +{ +#ifdef HAVE_LIBART + KSVGIconEngine engine; +#endif + TQString dirName(m_themeNames[item->text(0)]); + TDEIconTheme icontheme(dirName); + if (!icontheme.isValid()) kdDebug() << "notvalid\n"; + + updateRemoveButton(); + const int size = icontheme.defaultSize(TDEIcon::Desktop); + + TDEIcon icon=icontheme.iconPath("exec.png", size, TDEIcon::MatchBest); + if (!icon.isValid()) { +#ifdef HAVE_LIBART + icon=icontheme.iconPath("exec.svg", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewExec->setPixmap(*engine.image()); + else { + icon=icontheme.iconPath("exec.svgz", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewExec->setPixmap(*engine.image()); + } +#endif + } + else + m_previewExec->setPixmap(TQPixmap(icon.path)); + + icon=icontheme.iconPath("folder.png",size,TDEIcon::MatchBest); + if (!icon.isValid()) { +#ifdef HAVE_LIBART + icon=icontheme.iconPath("folder.svg", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewFolder->setPixmap(*engine.image()); + else { + icon=icontheme.iconPath("folder.svgz", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewFolder->setPixmap(*engine.image()); + } +#endif + } + else + m_previewFolder->setPixmap(TQPixmap(icon.path)); + + icon=icontheme.iconPath("txt.png",size,TDEIcon::MatchBest); + if (!icon.isValid()) { +#ifdef HAVE_LIBART + icon=icontheme.iconPath("txt.svg", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewDocument->setPixmap(*engine.image()); + else { + icon=icontheme.iconPath("txt.svgz", size, TDEIcon::MatchBest); + if(engine.load(size, size, icon.path)) + m_previewDocument->setPixmap(*engine.image()); + } +#endif + } + else + m_previewDocument->setPixmap(TQPixmap(icon.path)); + + emit changed(true); + m_bChanged = true; +} + +void IconThemesConfig::load() +{ + m_defaultTheme=iconThemeItem(TDEIconTheme::current()); + m_iconThemes->setSelected(m_defaultTheme, true); + updateRemoveButton(); + + emit changed(false); + m_bChanged = false; +} + +void IconThemesConfig::save() +{ + if (!m_bChanged) + return; + TQListViewItem *selected = m_iconThemes->selectedItem(); + if (!selected) + return; + + KSimpleConfig *config = new KSimpleConfig("kdeglobals", false); + config->setGroup("Icons"); + config->writeEntry("Theme", m_themeNames[selected->text(0)]); + delete config; + + TDEIconTheme::reconfigure(); + emit changed(false); + + for (int i=0; i<TDEIcon::LastGroup; i++) + { + KIPC::sendMessageAll(KIPC::IconChanged, i); + } + + KService::rebuildKSycoca(this); + + m_bChanged = false; + m_removeButton->setEnabled(false); +} + +void IconThemesConfig::defaults() +{ + if (m_iconThemes->currentItem()==m_defaultTheme) return; + + m_iconThemes->setSelected(m_defaultTheme, true); + updateRemoveButton(); + + emit changed(true); + m_bChanged = true; +} + +#include "iconthemes.moc" diff --git a/kcontrol/icons/iconthemes.h b/kcontrol/icons/iconthemes.h new file mode 100644 index 000000000..ccb914846 --- /dev/null +++ b/kcontrol/icons/iconthemes.h @@ -0,0 +1,73 @@ +/** + * Copyright (c) 2000 Antonio Larrosa <larrosa@kde.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef ICONTHEMES_H +#define ICONTHEMES_H + +#include <tqimage.h> +#include <tdecmodule.h> +#include <tqmap.h> +#include <tdelistview.h> + +class TQPushButton; +class DeviceManager; +class TQCheckBox; +class TQStringList; + + +class IconThemesConfig : public TDECModule +{ + Q_OBJECT + +public: + IconThemesConfig(TQWidget *parent = 0L, const char *name = 0L); + virtual ~IconThemesConfig(); + + void loadThemes(); + bool installThemes(const TQStringList &themes, const TQString &archiveName); + TQStringList findThemeDirs(const TQString &archiveName); + + void updateRemoveButton(); + + void load(); + void save(); + void defaults(); + + int buttons(); + +protected slots: + void themeSelected(TQListViewItem *item); + void installNewTheme(); + void removeSelectedTheme(); + +private: + TQListViewItem *iconThemeItem(const TQString &name); + + TDEListView *m_iconThemes; + TQPushButton *m_removeButton; + + TQLabel *m_previewExec; + TQLabel *m_previewFolder; + TQLabel *m_previewDocument; + TQListViewItem *m_defaultTheme; + TQMap <TQString, TQString>m_themeNames; + bool m_bChanged; +}; + +#endif // ICONTHEMES_H + diff --git a/kcontrol/icons/main.cpp b/kcontrol/icons/main.cpp new file mode 100644 index 000000000..7afaf7df7 --- /dev/null +++ b/kcontrol/icons/main.cpp @@ -0,0 +1,105 @@ +/* + * main.cpp + * + * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <tqlayout.h> + +#include <kgenericfactory.h> +#include <tdeaboutdata.h> + +#include "icons.h" +#include "iconthemes.h" +#include "main.h" + +/**** DLL Interface ****/ +typedef KGenericFactory<IconModule, TQWidget> IconsFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_icons, IconsFactory("kcmicons") ) + +/**** IconModule ****/ + +IconModule::IconModule(TQWidget *parent, const char *name, const TQStringList &) + : TDECModule(IconsFactory::instance(), parent, name) +{ + TQVBoxLayout *layout = new TQVBoxLayout(this); + tab = new TQTabWidget(this); + layout->addWidget(tab); + + tab1 = new IconThemesConfig(this, "themes"); + tab->addTab(tab1, i18n("&Theme")); + connect(tab1, TQT_SIGNAL(changed(bool)), this, TQT_SLOT(moduleChanged(bool))); + + tab2 = new TDEIconConfig(this, "effects"); + tab->addTab(tab2, i18n("Ad&vanced")); + connect(tab2, TQT_SIGNAL(changed(bool)), this, TQT_SLOT(moduleChanged(bool))); + + TDEAboutData* about = new TDEAboutData("kcmicons", I18N_NOOP("Icons"), "3.0", + I18N_NOOP("Icons Control Panel Module"), + TDEAboutData::License_GPL, + I18N_NOOP("(c) 2000-2003 Geert Jansen"), 0, 0); + about->addAuthor("Geert Jansen", 0, "jansen@kde.org"); + about->addAuthor("Antonio Larrosa Jimenez", 0, "larrosa@kde.org"); + about->addCredit("Torsten Rahn", 0, "torsten@kde.org"); + setAboutData( about ); +} + + +void IconModule::load() +{ + tab1->load(); + tab2->load(); +} + + +void IconModule::save() +{ + tab1->save(); + tab2->save(); +} + + +void IconModule::defaults() +{ + tab1->defaults(); + tab2->defaults(); +} + + +void IconModule::moduleChanged(bool state) +{ + emit changed(state); +} + +TQString IconModule::quickHelp() const +{ + return i18n("<h1>Icons</h1>" + "This module allows you to choose the icons for your desktop.<p>" + "To choose an icon theme, click on its name and apply your choice by pressing the \"Apply\" button below. If you do not want to apply your choice you can press the \"Reset\" button to discard your changes.</p>" + "<p>By pressing the \"Install New Theme\" button you can install your new icon theme by writing its location in the box or browsing to the location." + " Press the \"OK\" button to finish the installation.</p>" + "<p>The \"Remove Theme\" button will only be activated if you select a theme that you installed using this module." + " You are not able to remove globally installed themes here.</p>" + "<p>You can also specify effects that should be applied to the icons.</p>"); +} + + + +#include "main.moc" diff --git a/kcontrol/icons/main.h b/kcontrol/icons/main.h new file mode 100644 index 000000000..515cc47e9 --- /dev/null +++ b/kcontrol/icons/main.h @@ -0,0 +1,55 @@ +/* + * main.h + * + * Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org> + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#ifndef __MAIN_H__ +#define __MAIN_H__ + + +#include <tqtabwidget.h> +#include <tdecmodule.h> + +class IconModule : public TDECModule +{ + Q_OBJECT + +public: + IconModule(TQWidget *parent, const char *name, const TQStringList &); + + void load(); + void save(); + void defaults(); + TQString quickHelp() const; + +protected slots: + void moduleChanged(bool state); + +private: + TQTabWidget *tab; + + TDECModule *tab1; + TDECModule *tab2; +}; + + +#endif diff --git a/kcontrol/icons/testicons.cpp b/kcontrol/icons/testicons.cpp new file mode 100644 index 000000000..2eebd0117 --- /dev/null +++ b/kcontrol/icons/testicons.cpp @@ -0,0 +1,13 @@ +/* Test programme for icons setup module. */ + +#include <tdeapplication.h> +#include "icons.h" + +int main(int argc, char **argv) +{ + TDEApplication app(argc, argv, "testicons"); + TDEIconConfig *w = new TDEIconConfig(0L, "testicons"); + app.setMainWidget(w); + w->show(); + return app.exec(); +} diff --git a/kcontrol/icons/uninstall.desktop b/kcontrol/icons/uninstall.desktop new file mode 100644 index 000000000..e1e3e1732 --- /dev/null +++ b/kcontrol/icons/uninstall.desktop @@ -0,0 +1,2 @@ +[Desktop Entry] +Hidden=true |