Back to index

kdeartwork  4.3.2
Public Slots | Signals | Public Member Functions | Protected Slots | Private Types | Private Slots | Private Attributes
GlowConfigDialog Class Reference

#include <glowconfigdialog.h>

List of all members.

Public Slots

void load (KConfig *conf)
void save (KConfig *conf)
void defaults ()

Signals

void changed ()

Public Member Functions

 GlowConfigDialog (KConfig *conf, QWidget *parent)
 ~GlowConfigDialog ()

Protected Slots

void slotTitleButtonClicked (int)
void slotColorButtonChanged (const QColor &)
void slotTitlebarGradientTypeChanged (int)
void slotResizeHandleCheckBoxChanged ()
void slotThemeListViewSelectionChanged ()

Private Types

enum  ButtonType {
  stickyButton, helpButton, iconifyButton, maximizeButton,
  closeButton
}

Private Slots

void slotLoadThemeList ()

Private Attributes

KConfig * _glowConfig
bool _showResizeHandle
KPixmapEffect::GradientType _titlebarGradientType
QString _theme_name
QWidget * _main_group_box
Q3GroupBox * _button_glow_color_group_box
Q3GroupBox * _theme_group_box
Q3ListView * _theme_list_view
QCheckBox * _showResizeHandleCheckBox
QComboBox * _titlebarGradientTypeComboBox
QPushButton * _stickyButton
QPushButton * _helpButton
QPushButton * _iconifyButton
QPushButton * _maximizeButton
QPushButton * _closeButton
QSignalMapper * _titleButtonMapper
QColor * _buttonConfigMap
Q3ValueVector< QPushButton * > _titleButtonList
KColorButton * _colorButton

Detailed Description

Definition at line 32 of file glowconfigdialog.h.


Member Enumeration Documentation

Enumerator:
stickyButton 
helpButton 
iconifyButton 
maximizeButton 
closeButton 

Definition at line 59 of file glowconfigdialog.h.


Constructor & Destructor Documentation

GlowConfigDialog::GlowConfigDialog ( KConfig *  conf,
QWidget *  parent 
)

Definition at line 59 of file glowconfigdialog.cpp.

       : QObject(parent)
{
       _glowConfig = new KConfig("kwinglowrc");
       KGlobal::locale()->insertCatalog("kwin_glow_config");

       _main_group_box = new QWidget(parent);
       QVBoxLayout *main_group_boxLayout = new QVBoxLayout(_main_group_box);
       main_group_boxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
       main_group_boxLayout->setSpacing(6);

       //-------------------------------------------------------------------------
       // themes

       _theme_list_view = new Q3ListView (_main_group_box, "theme_list_view");
       _theme_list_view->addColumn (i18n("Theme"));
       _theme_list_view->addColumn (i18n("Button Size"));
        _theme_list_view->setAllColumnsShowFocus(true);
        _theme_list_view->setResizeMode(Q3ListView::AllColumns);

       main_group_boxLayout->addWidget (_theme_list_view);
       QObject::connect (_theme_list_view, SIGNAL(selectionChanged()),
                     this, SLOT(slotThemeListViewSelectionChanged()));
       slotLoadThemeList();

       _button_glow_color_group_box = new Q3GroupBox(
              0, Qt::Horizontal, i18n("Button Glow Colors"), _main_group_box);
       QHBoxLayout *colorHBoxLayout =
              new QHBoxLayout(_button_glow_color_group_box->layout());

       // create buttons
       QSize buttonSize(BITMAP_SIZE, BITMAP_SIZE);
       QPixmap pm(buttonSize);
       pm.fill(Qt::black);

       _stickyButton = new QPushButton(_button_glow_color_group_box);
       pm.setMask(QBitmap(buttonSize, stickyoff_bits, true));
       _stickyButton->setPixmap(pm);
       colorHBoxLayout->addWidget(_stickyButton);
       _titleButtonList.push_back(_stickyButton);

       _helpButton = new QPushButton(_button_glow_color_group_box);
       pm.setMask(QBitmap(buttonSize, help_bits, true));
       _helpButton->setPixmap(pm);
       colorHBoxLayout->addWidget(_helpButton);
       _titleButtonList.push_back(_helpButton);

       _iconifyButton = new QPushButton(_button_glow_color_group_box);
       pm.setMask(QBitmap(buttonSize, minimize_bits, true));
       _iconifyButton->setPixmap(pm);
       colorHBoxLayout->addWidget(_iconifyButton);
       _titleButtonList.push_back(_iconifyButton);

       _maximizeButton = new QPushButton(_button_glow_color_group_box);
       pm.setMask(QBitmap(buttonSize, maximizeoff_bits, true));
       _maximizeButton->setPixmap(pm);
       colorHBoxLayout->addWidget(_maximizeButton);
       _titleButtonList.push_back(_maximizeButton);

       _closeButton = new QPushButton(_button_glow_color_group_box);
       pm.setMask(QBitmap(buttonSize, close_bits, true));
       _closeButton->setPixmap(pm);
       colorHBoxLayout->addWidget(_closeButton);
       _titleButtonList.push_back(_closeButton);

       // create signal mapper
       _titleButtonMapper = new QSignalMapper(this);
       for( uint i=0; i<_titleButtonList.size(); i++ ) {
              _titleButtonMapper->setMapping(_titleButtonList[i], i);
              connect(_titleButtonList[i], SIGNAL(clicked()),_titleButtonMapper, SLOT(map()));
       }
       connect(_titleButtonMapper, SIGNAL(mapped(int)),this, SLOT(slotTitleButtonClicked(int)));

       _colorButton = new KColorButton(_button_glow_color_group_box);
       _colorButton->setEnabled(false);
       connect(_colorButton, SIGNAL(changed(const QColor&)),
              this, SLOT(slotColorButtonChanged(const QColor&)));

       colorHBoxLayout->addItem(new QSpacerItem(
              200, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
       colorHBoxLayout->addWidget(_colorButton);

       main_group_boxLayout->addWidget(_button_glow_color_group_box);

       QHBoxLayout *titlebarGradientTypeLayout = new QHBoxLayout();
       _titlebarGradientTypeComboBox = new QComboBox(_main_group_box);

    KSharedConfig::Ptr c = KGlobal::config();
    KConfigGroupSaver cgs( c, QString::fromLatin1("WM") );
    QColor activeBackground = c->readColorEntry("activeBackground");
    QColor activeBlend = c->readColorEntry("activeBlend");

       // If the colors are equal, change one to get a gradient effect
       if (activeBackground==activeBlend) {
              activeBackground = activeBackground.dark();
       }
       for (int i=0; i< KPixmapEffect::EllipticGradient; i++ ) {
              KPixmap gradPixmap(QSize(196,20));
              KPixmapEffect::gradient(gradPixmap, activeBackground,
                                                        activeBlend, (KPixmapEffect::GradientType) i);

              _titlebarGradientTypeComboBox->insertItem(gradPixmap, i);
       }

       connect(_titlebarGradientTypeComboBox, SIGNAL(activated(int)),
              this, SLOT(slotTitlebarGradientTypeChanged(int)));
       titlebarGradientTypeLayout->addWidget(
              new QLabel(i18n("Titlebar gradient:"), _main_group_box));
       titlebarGradientTypeLayout->addWidget(_titlebarGradientTypeComboBox, 0, Qt::AlignLeft);
        titlebarGradientTypeLayout->addStretch(10);
       main_group_boxLayout->addLayout(titlebarGradientTypeLayout);


       _showResizeHandleCheckBox = new QCheckBox(
                     i18n("Show resize handle"), _main_group_box);
       connect(_showResizeHandleCheckBox, SIGNAL(clicked()),
              this, SLOT(slotResizeHandleCheckBoxChanged()));
       main_group_boxLayout->addWidget(_showResizeHandleCheckBox);

       // load config and update user interface
       load(conf);

       _main_group_box->show();
}

Here is the call graph for this function:

Definition at line 184 of file glowconfigdialog.cpp.

{
       delete _main_group_box;
       delete _glowConfig;
       delete[] _buttonConfigMap;
}

Member Function Documentation

void GlowConfigDialog::changed ( ) [signal]

Here is the caller graph for this function:

void GlowConfigDialog::defaults ( ) [slot]

Definition at line 255 of file glowconfigdialog.cpp.

{
       const QColor defaultCloseButtonColor = DEFAULT_CLOSE_BUTTON_COLOR;
       const QColor defaultMaximizeButtonColor(DEFAULT_MAXIMIZE_BUTTON_COLOR);
       const QColor defaultIconifyButtonColor(DEFAULT_ICONIFY_BUTTON_COLOR);
       const QColor defaultHelpButtonColor(DEFAULT_HELP_BUTTON_COLOR);
       const QColor defaultStickyButtonColor(DEFAULT_STICKY_BUTTON_COLOR);

       _buttonConfigMap[stickyButton] = defaultStickyButtonColor;
       _buttonConfigMap[helpButton] = defaultHelpButtonColor;
       _buttonConfigMap[iconifyButton] = defaultIconifyButtonColor;
       _buttonConfigMap[maximizeButton] = defaultMaximizeButtonColor;
       _buttonConfigMap[closeButton] = defaultCloseButtonColor;

       _showResizeHandle = true;
       _titlebarGradientType = KPixmapEffect::DiagonalGradient;

       _showResizeHandleCheckBox->setChecked(_showResizeHandle);
       _titlebarGradientTypeComboBox->setCurrentItem(_titlebarGradientType);

       _theme_list_view->setSelected (
                     _theme_list_view->findItem("default", 0), true);
}
void GlowConfigDialog::load ( KConfig *  conf) [slot]

Definition at line 191 of file glowconfigdialog.cpp.

{
       QColor color;
       const QColor defaultCloseButtonColor(DEFAULT_CLOSE_BUTTON_COLOR);
       const QColor defaultMaximizeButtonColor(DEFAULT_MAXIMIZE_BUTTON_COLOR);
       const QColor defaultIconifyButtonColor(DEFAULT_ICONIFY_BUTTON_COLOR);
       const QColor defaultHelpButtonColor(DEFAULT_HELP_BUTTON_COLOR);
       const QColor defaultStickyButtonColor(DEFAULT_STICKY_BUTTON_COLOR);

       _glowConfig->setGroup("General");

       _buttonConfigMap = new QColor[NUMBER_OF_BUTTONS];
       color = _glowConfig->readColorEntry("stickyButtonGlowColor",
                     &defaultStickyButtonColor);
       _buttonConfigMap[stickyButton] = color;

       color = _glowConfig->readColorEntry("helpButtonGlowColor",
                     &defaultHelpButtonColor);
       _buttonConfigMap[helpButton] = color;

       color = _glowConfig->readColorEntry("iconifyButtonGlowColor",
                     &defaultIconifyButtonColor);
       _buttonConfigMap[iconifyButton] = color;

       color = _glowConfig->readColorEntry("maximizeButtonGlowColor",
                     &defaultMaximizeButtonColor);
       _buttonConfigMap[maximizeButton] = color;

       color = _glowConfig->readColorEntry("closeButtonGlowColor",
                     &defaultCloseButtonColor);
       _buttonConfigMap[closeButton] = color;

       _showResizeHandle = _glowConfig->readEntry("showResizeHandle", true);
       _titlebarGradientType = static_cast<KPixmapEffect::GradientType>
                                                 (_glowConfig->readNumEntry("titlebarGradientType",
                                                 KPixmapEffect::DiagonalGradient));

       _showResizeHandleCheckBox->setChecked(_showResizeHandle);
       _titlebarGradientTypeComboBox->setCurrentItem(_titlebarGradientType);

       _theme_name = _glowConfig->readEntry ("themeName", "default");
       _theme_list_view->setSelected (
                     _theme_list_view->findItem (_theme_name, 0), true);
        slotTitleButtonClicked(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GlowConfigDialog::save ( KConfig *  conf) [slot]

Definition at line 237 of file glowconfigdialog.cpp.

{
       _glowConfig->setGroup("General");

       _glowConfig->writeEntry("stickyButtonGlowColor", _buttonConfigMap[stickyButton]);
       _glowConfig->writeEntry("helpButtonGlowColor", _buttonConfigMap[helpButton]);
       _glowConfig->writeEntry("iconifyButtonGlowColor", _buttonConfigMap[iconifyButton]);
       _glowConfig->writeEntry("maximizeButtonGlowColor", _buttonConfigMap[maximizeButton]);
       _glowConfig->writeEntry("closeButtonGlowColor", _buttonConfigMap[closeButton]);

       _glowConfig->writeEntry("showResizeHandle", _showResizeHandle);
       _glowConfig->writeEntry("titlebarGradientType", _titlebarGradientType);

       _glowConfig->writeEntry ("themeName", _theme_name);

       _glowConfig->sync();
}
void GlowConfigDialog::slotColorButtonChanged ( const QColor &  glowColor) [protected, slot]

Definition at line 349 of file glowconfigdialog.cpp.

{
       if( _stickyButton->isDown() ) {
              _buttonConfigMap[stickyButton] = glowColor;
       } else if( _helpButton->isDown() ) {
              _buttonConfigMap[helpButton] = glowColor;
       } else if( _iconifyButton->isDown() ) {
              _buttonConfigMap[iconifyButton] = glowColor;
       } else if( _maximizeButton->isDown() ) {
              _buttonConfigMap[maximizeButton] = glowColor;
       } else {
              _buttonConfigMap[closeButton] = glowColor;
       }
       emit changed();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GlowConfigDialog::slotLoadThemeList ( ) [private, slot]

Definition at line 279 of file glowconfigdialog.cpp.

{
       QStringList dir_list=KGlobal::dirs()->findDirs("data", "kwin/glow-themes");

       QStringList::ConstIterator it;

       _theme_list_view->clear();
       new Q3ListViewItem (_theme_list_view, "default", "17x17");

       for (it=dir_list.begin(); it!=dir_list.end(); ++it)
       {
              QDir dir (*it, QString("*"), QDir::Unsorted,
                            QDir::Dirs | QDir::Readable);
              if (dir.exists())
              {
                     QFileInfoListIterator it2(*dir.entryInfoList());
                     QFileInfo * finfo;

                     while ((finfo=it2.current()))
                     {
                            if (finfo->fileName() == "." || finfo->fileName() == "..") {
                                   ++it2;
                                   continue;
                            }

                            if (! _theme_list_view->findItem (finfo->fileName(), 0))
                            {
                                   KConfig conf (dir.path() + "/" + finfo->fileName() + "/" +
                                                 finfo->fileName() + ".theme");
                                   QSize button_size = conf.readSizeEntry (
                                          "buttonSize", new QSize (-1, -1));
                                   if (button_size.width() == -1)
                                   {
                                          ++it2;
                                          continue;
                                   }
                                   QString size_string = QString("") +
                                          QString::number(button_size.width()) +
                                          "x" + QString::number(button_size.height());
                                   new Q3ListViewItem (_theme_list_view,
                                                 finfo->fileName(), size_string);
                            }

                            ++it2;
                     }
              }
       }
}

Here is the caller graph for this function:

Definition at line 334 of file glowconfigdialog.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 365 of file glowconfigdialog.cpp.

{
       if( _theme_list_view->selectedItem() != 0 ) {
              _theme_name = _theme_list_view->selectedItem()->text (0);

              emit changed();
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GlowConfigDialog::slotTitlebarGradientTypeChanged ( int  index) [protected, slot]

Definition at line 328 of file glowconfigdialog.cpp.

{
       _titlebarGradientType = static_cast<KPixmapEffect::GradientType>(index);
       emit changed();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void GlowConfigDialog::slotTitleButtonClicked ( int  index) [protected, slot]

Definition at line 340 of file glowconfigdialog.cpp.

{
       for( int i=0; i< ((int) _titleButtonList.size()); i++ ) {
              _titleButtonList[i]->setDown(i==index);
       }
       _colorButton->setEnabled(true);
       _colorButton->setColor(_buttonConfigMap[index]);
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 69 of file glowconfigdialog.h.

Definition at line 84 of file glowconfigdialog.h.

QPushButton* GlowConfigDialog::_closeButton [private]

Definition at line 81 of file glowconfigdialog.h.

KColorButton* GlowConfigDialog::_colorButton [private]

Definition at line 87 of file glowconfigdialog.h.

KConfig* GlowConfigDialog::_glowConfig [private]

Definition at line 62 of file glowconfigdialog.h.

QPushButton* GlowConfigDialog::_helpButton [private]

Definition at line 78 of file glowconfigdialog.h.

QPushButton* GlowConfigDialog::_iconifyButton [private]

Definition at line 79 of file glowconfigdialog.h.

Definition at line 68 of file glowconfigdialog.h.

QPushButton* GlowConfigDialog::_maximizeButton [private]

Definition at line 80 of file glowconfigdialog.h.

Definition at line 64 of file glowconfigdialog.h.

Definition at line 74 of file glowconfigdialog.h.

QPushButton* GlowConfigDialog::_stickyButton [private]

Definition at line 77 of file glowconfigdialog.h.

Q3GroupBox* GlowConfigDialog::_theme_group_box [private]

Definition at line 70 of file glowconfigdialog.h.

Q3ListView* GlowConfigDialog::_theme_list_view [private]

Definition at line 72 of file glowconfigdialog.h.

QString GlowConfigDialog::_theme_name [private]

Definition at line 66 of file glowconfigdialog.h.

KPixmapEffect::GradientType GlowConfigDialog::_titlebarGradientType [private]

Definition at line 65 of file glowconfigdialog.h.

Definition at line 75 of file glowconfigdialog.h.

Q3ValueVector<QPushButton*> GlowConfigDialog::_titleButtonList [private]

Definition at line 85 of file glowconfigdialog.h.

QSignalMapper* GlowConfigDialog::_titleButtonMapper [private]

Definition at line 82 of file glowconfigdialog.h.


The documentation for this class was generated from the following files: