- The decoration should be useable in reverse layout mode now.

- Readding the possibility to close windows by double clicking the menu
  button on request, setting disabled by default.

svn path=/trunk/kdeartwork/kwin-styles/plastik/; revision=253432
icc-effect-5.14.5
Sandro Giessl 2003-09-23 20:39:13 +00:00
parent 89601d5312
commit 863057e660
6 changed files with 189 additions and 150 deletions

View File

@ -53,6 +53,8 @@ PlastikConfig::PlastikConfig(KConfig* config, QWidget* parent)
this, SIGNAL(changed()));
connect(m_dialog->animateButtons, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(m_dialog->menuClose, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(m_dialog->titleShadow, SIGNAL(toggled(bool)),
this, SIGNAL(changed()));
connect(m_dialog->titlebarHeight, SIGNAL(valueChanged(int)),
@ -76,6 +78,8 @@ void PlastikConfig::load(KConfig*)
if (button) button->setChecked(true);
bool animateButtons = m_config->readBoolEntry("AnimateButtons", true);
m_dialog->animateButtons->setChecked(animateButtons);
bool menuClose = m_config->readBoolEntry("CloseOnMenuDoubleClick", true);
m_dialog->menuClose->setChecked(menuClose);
bool titleShadow = m_config->readBoolEntry("TitleShadow", true);
m_dialog->titleShadow->setChecked(titleShadow);
int titlebarHeight = m_config->readNumEntry("TitleHeightMin", 19);
@ -112,6 +116,7 @@ void PlastikConfig::save(KConfig*)
QRadioButton *button = (QRadioButton*)m_dialog->titleAlign->selected();
if (button) m_config->writeEntry("TitleAlignment", QString(button->name()));
m_config->writeEntry("AnimateButtons", m_dialog->animateButtons->isChecked() );
m_config->writeEntry("CloseOnMenuDoubleClick", m_dialog->menuClose->isChecked() );
m_config->writeEntry("TitleShadow", m_dialog->titleShadow->isChecked() );
switch(m_dialog->titlebarHeight->value())
{
@ -143,6 +148,7 @@ void PlastikConfig::defaults()
(QRadioButton*)m_dialog->titleAlign->child("AlignHCenter");
if (button) button->setChecked(true);
m_dialog->animateButtons->setChecked(true);
m_dialog->menuClose->setChecked(false);
m_dialog->titleShadow->setChecked(true);
m_dialog->titlebarHeight->setValue(2);
}

View File

@ -9,178 +9,179 @@
<x>0</x>
<y>0</y>
<width>541</width>
<height>188</height>
<height>214</height>
</rect>
</property>
<property name="caption">
<string>Config Dialog</string>
</property>
<hbox>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<widget class="QButtonGroup" row="0" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>layout1</cstring>
<cstring>titleAlign</cstring>
</property>
<grid>
<property name="title">
<string>Title &amp;Alignment</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QButtonGroup" row="0" column="0" rowspan="1" colspan="5">
<widget class="QRadioButton">
<property name="name">
<cstring>titleAlign</cstring>
</property>
<property name="title">
<string>Title &amp;Alignment</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QRadioButton">
<property name="name">
<cstring>AlignLeft</cstring>
</property>
<property name="text">
<string>Left</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>AlignHCenter</cstring>
</property>
<property name="text">
<string>Center</string>
</property>
</widget>
<widget class="QRadioButton">
<property name="name">
<cstring>AlignRight</cstring>
</property>
<property name="text">
<string>Right</string>
</property>
</widget>
</hbox>
</widget>
<spacer row="8" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>spacer5_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>270</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>animateButtons</cstring>
<cstring>AlignLeft</cstring>
</property>
<property name="text">
<string>Animate buttons</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want the buttons fade in/out when the mouse enters or leaves the button.</string>
<string>Left</string>
</property>
</widget>
<widget class="QSlider" row="7" column="1" rowspan="1" colspan="4">
<widget class="QRadioButton">
<property name="name">
<cstring>titlebarHeight</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="maxValue">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="tickmarks">
<enum>NoMarks</enum>
</property>
<property name="whatsThis" stdset="0">
<string>By adjusting this slider, you can modify the height of the title bar.
Note: This setting gets overwritten if the caption font is bigger than the title bar.</string>
</property>
</widget>
<widget class="QLabel" row="8" column="1">
<property name="name">
<cstring>textLabel2</cstring>
<cstring>AlignHCenter</cstring>
</property>
<property name="text">
<string>Small</string>
<string>Center</string>
</property>
</widget>
<widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="5">
<widget class="QRadioButton">
<property name="name">
<cstring>titleShadow</cstring>
<cstring>AlignRight</cstring>
</property>
<property name="text">
<string>Use shadowed &amp;text</string>
</property>
<property name="accel">
<string>Alt+T</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want the titlebar text to have a 3D look with a shadow behind it.</string>
<string>Right</string>
</property>
</widget>
<widget class="QLabel" row="7" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Tit&amp;le bar height:</string>
</property>
<property name="buddy" stdset="0">
<cstring>titlebarHeight</cstring>
</property>
<property name="whatsThis" stdset="0">
<string>By adjusting this slider, you can modify the height of the title bar.
Note: This setting gets overwritten if the caption font is bigger than the title bar.</string>
</property>
</widget>
<spacer row="8" column="0">
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>140</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLabel" row="8" column="4">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>Large</string>
</property>
</widget>
</grid>
</hbox>
</widget>
</hbox>
<spacer row="5" column="2">
<property name="name">
<cstring>spacer5_2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>270</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QSlider" row="4" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>titlebarHeight</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="maxValue">
<number>6</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="tickmarks">
<enum>NoMarks</enum>
</property>
<property name="whatsThis" stdset="0">
<string>By adjusting this slider, you can modify the height of the title bar.
Note: This setting gets overwritten if the caption font is bigger than the title bar.</string>
</property>
</widget>
<widget class="QLabel" row="5" column="1">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Small</string>
</property>
</widget>
<widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Tit&amp;le bar height:</string>
</property>
<property name="buddy" stdset="0">
<cstring>titlebarHeight</cstring>
</property>
<property name="whatsThis" stdset="0">
<string>By adjusting this slider, you can modify the height of the title bar.
Note: This setting gets overwritten if the caption font is bigger than the title bar.</string>
</property>
</widget>
<spacer row="5" column="0">
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>161</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLabel" row="5" column="3">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>Large</string>
</property>
</widget>
<widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>titleShadow</cstring>
</property>
<property name="text">
<string>Use shadowed &amp;text</string>
</property>
<property name="accel">
<string>Alt+T</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want the titlebar text to have a 3D look with a shadow behind it.</string>
</property>
</widget>
<widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>animateButtons</cstring>
</property>
<property name="text">
<string>Animate buttons</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want the buttons fade in/out when the mouse enters or leaves the button.</string>
</property>
</widget>
<widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>menuClose</cstring>
</property>
<property name="text">
<string>Close windows by double clicking the menu button</string>
</property>
<property name="whatsThis" stdset="0">
<string>Check this option if you want windows to be closed when you double click the menu button, similar to Microsoft Windows.</string>
</property>
</widget>
</grid>
</widget>
<tabstops>
<tabstop>AlignLeft</tabstop>

View File

@ -36,6 +36,8 @@ bool PlastikHandler::m_initialized = false;
bool PlastikHandler::m_animateButtons = true;
bool PlastikHandler::m_titleShadow = true;
bool PlastikHandler::m_shrinkBorders = true;
bool PlastikHandler::m_menuClose = false;
bool PlastikHandler::m_reverse = false;
int PlastikHandler::m_borderSize = 4;
int PlastikHandler::m_titleHeight = 19;
int PlastikHandler::m_titleHeightTool= 12;
@ -84,6 +86,9 @@ bool PlastikHandler::reset(unsigned long changed)
m_borderSize = 4;
}
// check if we are in reverse layout mode
m_reverse = QApplication::reverseLayout();
// read in the configuration
readConfig();
@ -136,6 +141,7 @@ void PlastikHandler::readConfig()
else if (value == "AlignRight") m_titleAlign = Qt::AlignRight;
m_animateButtons = config.readBoolEntry("AnimateButtons", true);
m_menuClose = config.readBoolEntry("CloseOnMenuDoubleClick", true);
}
QColor PlastikHandler::getColor(KWinPlastik::ColorType type, const bool active)

View File

@ -73,7 +73,9 @@ public:
static int borderSize() { return m_borderSize; }
static bool useHighContrastHoveredButtons() { return m_useHighContrastHoveredButtons; }
static bool animateButtons() { return m_animateButtons; }
static bool menuClose() { return m_menuClose; }
static Qt::AlignmentFlags titleAlign() { return m_titleAlign; }
static bool reverseLayout() { return m_reverse; }
static QColor getColor(KWinPlastik::ColorType type, const bool active = true);
private:
void readConfig();
@ -82,6 +84,8 @@ private:
static bool m_shrinkBorders;
static bool m_useHighContrastHoveredButtons;
static bool m_animateButtons;
static bool m_menuClose;
static bool m_reverse;
static int m_borderSize;
static int m_titleHeight;
static int m_titleHeightTool;

View File

@ -60,6 +60,7 @@ PlastikClient::PlastikClient(KDecorationBridge* bridge, KDecorationFactory* fact
aTitleBarTile(0), iTitleBarTile(0), aTitleBarTopTile(0), iTitleBarTopTile(0),
pixmaps_created(false),
captionBufferDirty(true),
closing(false),
s_titleHeight(0),
s_titleFont(QFont() )
{ }
@ -516,7 +517,7 @@ void PlastikClient::_resetLayout()
// sizeof(...) is calculated at compile time
memset(m_button, 0, sizeof(PlastikButton *) * NumButtons);
titleLayout_->addItem(leftTitleSpacer_);
titleLayout_->addItem(PlastikHandler::reverseLayout()?rightTitleSpacer_:leftTitleSpacer_);
addButtons(titleLayout_,
options()->customButtonPositions() ? options()->titleButtonsLeft() : QString(default_left),
s_titleHeight-1);
@ -524,16 +525,16 @@ void PlastikClient::_resetLayout()
addButtons(titleLayout_,
options()->customButtonPositions() ? options()->titleButtonsRight() : QString(default_right),
s_titleHeight-1);
titleLayout_->addItem(rightTitleSpacer_);
titleLayout_->addItem(PlastikHandler::reverseLayout()?leftTitleSpacer_:rightTitleSpacer_);
// deco
mainLayout_->addItem(decoSpacer_);
//Mid
QHBoxLayout * midLayout = new QHBoxLayout(mainLayout_, 0, 0);
midLayout->addItem(leftSpacer_);
midLayout->addItem(PlastikHandler::reverseLayout()?rightSpacer_:leftSpacer_);
midLayout->addWidget(new QLabel( i18n( "<center><b>Plastik</b></center>" ), widget()) );
midLayout->addItem(rightSpacer_);
midLayout->addItem(PlastikHandler::reverseLayout()?leftSpacer_:rightSpacer_);
//Bottom
mainLayout_->addItem(bottomSpacer_);
@ -550,6 +551,7 @@ void PlastikClient::addButtons(QBoxLayout *layout, const QString& s, int buttonS
if (!m_button[MenuButton]){
m_button[MenuButton] = new PlastikButton(this, "menu", i18n("Menu"), MenuButton, buttonSize);
connect(m_button[MenuButton], SIGNAL(pressed()), SLOT(menuButtonPressed()));
connect(m_button[MenuButton], SIGNAL(released()), this, SLOT(menuButtonReleased()));
layout->addWidget(m_button[MenuButton], 0, Qt::AlignHCenter | Qt::AlignTop);
}
break;
@ -756,9 +758,26 @@ void PlastikClient::slotMaximize()
void PlastikClient::menuButtonPressed()
{
QPoint pos = m_button[MenuButton]->mapToGlobal(m_button[MenuButton]->rect().bottomLeft() );
showWindowMenu( pos );
m_button[MenuButton]->setDown(false);
static QTime* t = NULL;
static PlastikClient* lastClient = NULL;
if (t == NULL)
t = new QTime;
bool dbl = (lastClient==this && t->elapsed() <= QApplication::doubleClickInterval());
lastClient = this;
t->start();
if (!dbl || !PlastikHandler::menuClose()) {
QPoint pos = m_button[MenuButton]->mapToGlobal(m_button[MenuButton]->rect().bottomLeft() );
showWindowMenu( pos );
m_button[MenuButton]->setDown(false);
}
else
closing = true;
}
void PlastikClient::menuButtonReleased()
{
if(closing)
closeWindow();
}
void PlastikClient::create_pixmaps()

View File

@ -75,6 +75,7 @@ protected:
private slots:
void slotMaximize();
void menuButtonPressed();
void menuButtonReleased();
bool isTool();
private:
void _resetLayout();
@ -100,6 +101,8 @@ private:
bool captionBufferDirty;
bool closing;
// settings...
int s_titleHeight;
QFont s_titleFont;