diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:28:08 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:28:08 +0000 |
commit | f9c5bc16e192997a25a9547b4173551bab70630a (patch) | |
tree | a701b520cf924c8588305b6e6fdd0748070bd542 /client | |
download | twin-style-crystal-f9c5bc16e192997a25a9547b4173551bab70630a.tar.gz twin-style-crystal-f9c5bc16e192997a25a9547b4173551bab70630a.zip |
Added KDE3 version of kwin Crystal style
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kwin-style-crystal@1095345 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'client')
-rw-r--r-- | client/Makefile.am | 22 | ||||
-rw-r--r-- | client/buttonimage.cpp | 244 | ||||
-rw-r--r-- | client/buttonimage.h | 66 | ||||
-rw-r--r-- | client/config/Makefile.am | 22 | ||||
-rw-r--r-- | client/config/configdialog.ui | 2417 | ||||
-rw-r--r-- | client/config/crystalconfig.cc | 384 | ||||
-rw-r--r-- | client/config/crystalconfig.h | 67 | ||||
-rw-r--r-- | client/config/infodialog.ui | 284 | ||||
-rw-r--r-- | client/crystal.desktop | 5 | ||||
-rw-r--r-- | client/crystalbutton.cpp | 337 | ||||
-rw-r--r-- | client/crystalbutton.h | 73 | ||||
-rw-r--r-- | client/crystalclient.cc | 1643 | ||||
-rw-r--r-- | client/crystalclient.h | 204 | ||||
-rw-r--r-- | client/imageholder.cpp | 171 | ||||
-rw-r--r-- | client/imageholder.h | 62 | ||||
-rw-r--r-- | client/myrootpixmap.cc | 200 | ||||
-rw-r--r-- | client/myrootpixmap.h | 98 |
17 files changed, 6299 insertions, 0 deletions
diff --git a/client/Makefile.am b/client/Makefile.am new file mode 100644 index 0000000..fd2076c --- /dev/null +++ b/client/Makefile.am @@ -0,0 +1,22 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = config + +KDE_CXXFLAGS = -DQT_PLUGIN + +INCLUDES = $(all_includes) -I$(kde_includes)/kwin + +kwindir = $(kde_datadir)/kwin/ +kwin_DATA = crystal.desktop + +noinst_HEADERS = crystalclient.h crystalbutton.h imageholder.h buttonimage.h tiles.h overlays.h + +kde_module_LTLIBRARIES = kwin3_crystal.la +kwin3_crystal_la_SOURCES = crystalclient.cc myrootpixmap.cc crystalbutton.cpp \ + imageholder.cpp buttonimage.cpp tiles.h overlays.h +kwin3_crystal_la_LIBADD = $(kde_libraries)/libkdecorations.la $(LIB_QT) $(LIB_KDEUI) +kwin3_crystal_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +kwin3_crystal_la_METASOURCES = AUTO + +CLEANFILES = tiles.h overlays.h +DISTCLEANFILES = $(kwin3_crystal_la_METASOURCES) diff --git a/client/buttonimage.cpp b/client/buttonimage.cpp new file mode 100644 index 0000000..c195eed --- /dev/null +++ b/client/buttonimage.cpp @@ -0,0 +1,244 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 <qimage.h> +#include <math.h> +#include <kimageeffect.h> + +#include "buttonimage.h" + + + + + +ButtonImage::ButtonImage(const QRgb *d_normal,int w,int h) +{ + normal=hovered=pressed=animated=NULL; + image_width=w; + image_height=h; + normal_data=hovered_data=animated_data=pressed_data=NULL; + org_normal_data=org_hovered_data=NULL; + normal_color=hovered_color=pressed_color=QColor(255,255,255); + reset(); + if (d_normal)SetNormal(d_normal,w,h); +} + +ButtonImage::~ButtonImage() +{ + if (normal)delete normal; + if (hovered)delete hovered; + if (pressed)delete pressed; + if (animated)delete animated; + if (animated_data)delete[] animated_data; + if (pressed_data)delete[] pressed_data; + if (hovered_data)delete[] hovered_data; + if (normal_data)delete[] normal_data; + if (org_normal_data)delete[] org_normal_data; + if (org_hovered_data)delete[] org_hovered_data; +} + +QImage ButtonImage::CreateImage(QRgb *data,QColor color) +{ + tint(data,color); + QImage img=QImage((uchar*)data,image_width,image_height,32,NULL,0,QImage::LittleEndian),img2; + img.setAlphaBuffer(true); + + return img; +} + +void ButtonImage::reset() +{ + if (normal)delete normal; + if (hovered)delete hovered; + if (pressed)delete pressed; + if (animated)delete animated; + normal=hovered=pressed=animated=NULL; + + if (normal_data)delete[] normal_data; + if (hovered_data)delete[] hovered_data; + if (pressed_data)delete[] pressed_data; + if (animated_data)delete[] animated_data; + + if (org_hovered_data)delete[] org_hovered_data; + if (org_normal_data)delete[] org_normal_data; + normal_data=hovered_data=animated_data=pressed_data=NULL; + org_normal_data=org_hovered_data=NULL; + + hSpace=vSpace=2; + drawMode=0; +} + +void ButtonImage::SetNormal(const QRgb *d_normal,int w,int h) +{ + image_width=w; + image_height=h; + if (normal)delete normal; + if (animated)delete animated; + animated=NULL; + if (animated_data)delete[] animated_data; + animated_data=NULL; + if (hovered_data)delete[] hovered_data; + hovered_data=NULL; + if (pressed_data)delete[] pressed_data; + pressed_data=NULL; + if (normal_data)delete[] normal_data; + + org_normal_data=new QRgb[image_width*image_height]; + memcpy(org_normal_data,d_normal,sizeof(QRgb)*image_width*image_height); + normal_data=new QRgb[image_width*image_height]; + memcpy(normal_data,d_normal,sizeof(QRgb)*image_width*image_height); + normal=new QImage(CreateImage(normal_data,normal_color)); +} + +void ButtonImage::SetHovered(const QRgb *d_hovered) +{ + if (hovered)delete hovered; + if (hovered_data)delete[] hovered_data; + if (org_hovered_data)delete[] org_hovered_data; + if (d_hovered) + { + org_hovered_data=new QRgb[image_width*image_height]; + hovered_data=new QRgb[image_width*image_height]; + memcpy(hovered_data,d_hovered,sizeof(QRgb)*image_width*image_height); + memcpy(org_hovered_data,d_hovered,sizeof(QRgb)*image_width*image_height); + hovered=new QImage(CreateImage(hovered_data,hovered_color)); + }else{ + hovered=NULL; + hovered_data=NULL; + org_hovered_data=NULL; + } +} + +void ButtonImage::SetPressed(const QRgb *d_pressed) +{ + if (pressed)delete pressed; + if (pressed_data)delete[] pressed_data; + if (d_pressed) + { + pressed_data=new QRgb[image_width*image_height]; + memcpy(pressed_data,d_pressed,sizeof(QRgb)*image_width*image_height); + pressed=new QImage(CreateImage(pressed_data,pressed_color)); + }else{ + pressed=NULL; + pressed_data=NULL; + } +} + +bool ButtonImage::initialized() +{ + return ((org_normal_data!=NULL)&&(normal_data!=NULL)&&(normal!=NULL)); +} + +void ButtonImage::finish() +{ + if (!org_normal_data) + { +/* printf("ERROR: No org_normal_data set!\n"); */ + return; + } + + if (!hovered_data){ + hovered_data=new QRgb[image_width*image_height]; + float faktor=::factory->hovereffect?0.5:1.0; + for (int i=0;i<image_width*image_height;i++) + { + hovered_data[i]=qRgba(qRed(org_normal_data[i]),qGreen(org_normal_data[i]),qBlue(org_normal_data[i]), + (int)(255.0*pow((float)qAlpha(org_normal_data[i])/255.0,faktor))); + } + if (org_hovered_data)delete[] org_hovered_data; + org_hovered_data=new QRgb[image_width*image_height]; + memcpy(org_hovered_data,hovered_data,sizeof(QRgb)*image_width*image_height); + hovered=new QImage(CreateImage(hovered_data,hovered_color)); + } + + if (!pressed_data){ + float faktor=::factory->hovereffect?0.5:0.4; + pressed_data=new QRgb[image_width*image_height]; + if (!org_hovered_data) + { + org_hovered_data=hovered_data; + printf("ERROR: %s (@%d)\n",__FILE__,__LINE__); + } + + for (int i=0;i<image_width*image_height;i++) + { + pressed_data[i]=qRgba(qRed(org_hovered_data[i]),qGreen(org_hovered_data[i]),qBlue(org_hovered_data[i]), + (int)(255.0*pow((float)qAlpha(org_hovered_data[i])/255.0,faktor))); + } + pressed=new QImage(CreateImage(pressed_data,pressed_color)); + } + + if (!animated_data)animated_data=new QRgb[image_width*image_height]; + if (!animated) + { + animated=new QImage((uchar*)animated_data,image_width,image_height,32,NULL,0,QImage::LittleEndian); + animated->setAlphaBuffer(true); + } +} + +QImage* ButtonImage::getAnimated( float anim) +{ + if (!normal_data)return NULL; + if (!animated_data)return NULL; + + for (int i=0;i<image_width*image_height;i++) + { + const float r1=(float)qRed(normal_data[i])/255.0f; + const float r2=(float)qRed(hovered_data[i])/255.0f; + const float g1=(float)qGreen(normal_data[i])/255.0f; + const float g2=(float)qGreen(hovered_data[i])/255.0f; + const float b1=(float)qBlue(normal_data[i])/255.0f; + const float b2=(float)qBlue(hovered_data[i])/255.0f; + const float a1=(float)qAlpha(normal_data[i])/255.0f; + const float a2=(float)qAlpha(hovered_data[i])/255.0f; + + animated_data[i]=qRgba( + (int)((r1*(1.0f-anim)+r2*anim)*255.0f), + (int)((g1*(1.0f-anim)+g2*anim)*255.0f), + (int)((b1*(1.0f-anim)+b2*anim)*255.0f), + (int)((a1*(1.0f-anim)+a2*anim)*255.0f)); + } + + return animated; +} + +void ButtonImage::tint(QRgb *data,QColor color) +{ + float f_r=(float)color.red()/255.0; + float f_g=(float)color.green()/255.0; + float f_b=(float)color.blue()/255.0; + for (int i=0;i<image_width*image_height;i++) + { + float r=(float)qRed(data[i])/255.0; + float g=(float)qGreen(data[i])/255.0; + float b=(float)qBlue(data[i])/255.0; + + r*=f_r; + g*=f_g; + b*=f_b; + + data[i]=qRgba( + (int)(r*255.0), + (int)(g*255.0), + (int)(b*255.0), + qAlpha(data[i])); + } +} diff --git a/client/buttonimage.h b/client/buttonimage.h new file mode 100644 index 0000000..32284f6 --- /dev/null +++ b/client/buttonimage.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 _BUTTON_IMAGE_INCLUDED_ +#define _BUTTON_IMAGE_INCLUDED_ + +#include <qimage.h> +#include "crystalclient.h" + +#define DEFAULT_IMAGE_SIZE 14 + + +class ButtonImage +{ +public: + QImage *normal,*hovered,*pressed; + int image_width,image_height; + int hSpace,vSpace; + int drawMode; + QColor normal_color,hovered_color,pressed_color; + + QImage *animated; + QRgb *normal_data,*hovered_data,*animated_data,*pressed_data; + QRgb *org_normal_data,*org_hovered_data; + + ButtonImage(const QRgb *d_normal=NULL,int w=DEFAULT_IMAGE_SIZE,int h=DEFAULT_IMAGE_SIZE); + virtual ~ButtonImage(); + + void SetNormal(const QRgb *d_normal,int w=DEFAULT_IMAGE_SIZE,int h=DEFAULT_IMAGE_SIZE); + void SetHovered(const QRgb *d_hovered=NULL); + void SetPressed(const QRgb *d_pressed=NULL); + void reset(); + void finish(); + bool initialized(); + + void setSpace(int hS,int vS) { hSpace=hS; vSpace=vS; } + void setDrawMode(int dm) { drawMode=dm; } + void setColors(QColor n,QColor h,QColor p) { normal_color=n; hovered_color=h; pressed_color=p; } + + QImage* getAnimated(float anim); + +private: + QImage CreateImage(QRgb *data,QColor color); + void tint(QRgb *data,QColor color); +}; + +#endif diff --git a/client/config/Makefile.am b/client/config/Makefile.am new file mode 100644 index 0000000..d6547d3 --- /dev/null +++ b/client/config/Makefile.am @@ -0,0 +1,22 @@ +AUTOMAKE_OPTIONS = foreign + +KDE_CXXFLAGS = -DQT_PLUGIN + +INCLUDES = $(all_includes) + +noinst_HEADERS = crystalconfig.h + +kde_module_LTLIBRARIES = kwin_crystal_config.la +kwin_crystal_config_la_SOURCES = configdialog.ui infodialog.ui crystalconfig.cc crystalconfig.h +kwin_crystal_config_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +kwin_crystal_config_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) $(LIB_QT) +kwin_crystal_config_la_METASOURCES = AUTO + +DISTCLEANFILES = $(kwin_crystal_config_la_METASOURCES) + +crystalconfig.cc: configdialog.h infodialog.h + + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kwin_crystal_config.pot +METASOURCES = AUTO diff --git a/client/config/configdialog.ui b/client/config/configdialog.ui new file mode 100644 index 0000000..29025b8 --- /dev/null +++ b/client/config/configdialog.ui @@ -0,0 +1,2417 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ConfigDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>335</height> + </rect> + </property> + <property name="caption"> + <string>Config Dialog</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <property name="tabShape"> + <enum>Rounded</enum> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Ge&neral</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tooltip</cstring> + </property> + <property name="text"> + <string>Show tooltip o&ver caption</string> + </property> + <property name="accel"> + <string>Alt+V</string> + </property> + <property name="toolTip" stdset="0"> + <string>Shows a tooltip, if the mouse pointer is over the caption.</string> + </property> + </widget> + <spacer row="4" column="2"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>titlealign</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Title &Alignment</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use these buttons to set the alignment of the window title</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignLeft</cstring> + </property> + <property name="text"> + <string>&Left</string> + </property> + <property name="accel"> + <string>Alt+L</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignHCenter</cstring> + </property> + <property name="text"> + <string>&Centered</string> + </property> + <property name="accel"> + <string>Alt+C</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>AlignRight</cstring> + </property> + <property name="text"> + <string>&Right</string> + </property> + <property name="accel"> + <string>Alt+R</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QButtonGroup" row="0" column="1"> + <property name="name"> + <cstring>repaintMode</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Moving &repaints window</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>radioButton6</cstring> + </property> + <property name="text"> + <string>&When finished</string> + </property> + <property name="accel"> + <string>Alt+W</string> + </property> + <property name="buttonGroupId"> + <number>3</number> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>radioButton4</cstring> + </property> + <property name="text"> + <string>I&mmediately</string> + </property> + <property name="accel"> + <string>Alt+M</string> + </property> + <property name="buttonGroupId"> + <number>1</number> + </property> + </widget> + <widget class="QSpinBox" row="1" column="1"> + <property name="name"> + <cstring>updateTime</cstring> + </property> + <property name="suffix"> + <string> ms</string> + </property> + <property name="maxValue"> + <number>2000</number> + </property> + <property name="minValue"> + <number>20</number> + </property> + <property name="lineStep"> + <number>10</number> + </property> + <property name="value"> + <number>200</number> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>radioButton5</cstring> + </property> + <property name="text"> + <string>E&very</string> + </property> + <property name="accel"> + <string>Alt+V</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="buttonGroupId"> + <number>2</number> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>roundCorners</cstring> + </property> + <property name="title"> + <string>Round &Corners</string> + </property> + <property name="alignment"> + <set>AlignHCenter</set> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="0" column="2"> + <property name="name"> + <cstring>trc</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>blc</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + <property name="sizeHint"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="2" column="2"> + <property name="name"> + <cstring>brc</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>tlc</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + <property name="sizeHint"> + <size> + <width>10</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Border width:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>borderwidth</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>textLabel2_2_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Titlebar height:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titlebarheight</cstring> + </property> + </widget> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderwidth</cstring> + </property> + <property name="prefix"> + <string></string> + </property> + <property name="value"> + <number>5</number> + </property> + <property name="toolTip" stdset="0"> + <string>Width of the borders</string> + </property> + </widget> + <widget class="QSpinBox" row="2" column="3"> + <property name="name"> + <cstring>titlebarheight</cstring> + </property> + <property name="prefix"> + <string></string> + </property> + <property name="minValue"> + <number>5</number> + </property> + <property name="value"> + <number>20</number> + </property> + <property name="toolTip" stdset="0"> + <string>Height of the title par (independend to border width)</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>textshadow</cstring> + </property> + <property name="text"> + <string>Use shadowed &text</string> + </property> + <property name="accel"> + <string>Alt+T</string> + </property> + <property name="toolTip" stdset="0"> + <string>Draws a nice shadowed title bar text to improve visibility.</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>drawCaption</cstring> + </property> + <property name="text"> + <string>&Draw Caption</string> + </property> + <property name="accel"> + <string>Alt+D</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>wheelTask</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>C&ycle tasks with mouse wheel</string> + </property> + <property name="accel"> + <string>Alt+Y</string> + </property> + <property name="toolTip" stdset="0"> + <string>Wheel on titlebar cycles through visible windows. Does NOT work in compiz. Overrides settings in KDE.</string> + </property> + </widget> + <widget class="QPushButton" row="3" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>infoButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>I&nfo...</string> + </property> + <property name="accel"> + <string>Alt+N</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Bu&ttons</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="1"> + <property name="name"> + <cstring>animateHover</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Ani&mate hover</string> + </property> + <property name="accel"> + <string>Alt+M</string> + </property> + <property name="toolTip" stdset="0"> + <string>Smoothly animate the hover effect of the buttons</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>hover</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Ho&ver effect</string> + </property> + <property name="accel"> + <string>Alt+V</string> + </property> + <property name="toolTip" stdset="0"> + <string>Provides a mouse-over effect for the title bar buttons.</string> + </property> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tintButtons</cstring> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="midLineWidth"> + <number>0</number> + </property> + <property name="title"> + <string>Tint Buttons</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Tint some buttons to specific colors</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="spacing"> + <number>0</number> + </property> + <widget class="KColorButton" row="2" column="1"> + <property name="name"> + <cstring>minColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Minimize Button</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Other Buttons</string> + </property> + </widget> + <widget class="KColorButton" row="1" column="1"> + <property name="name"> + <cstring>buttonColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="1" column="3"> + <property name="name"> + <cstring>buttonColor3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="1" column="2"> + <property name="name"> + <cstring>buttonColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="2" column="2"> + <property name="name"> + <cstring>minColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Hovered</string> + </property> + </widget> + <widget class="QLabel" row="0" column="3"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="text"> + <string>Pressed</string> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel2_4</cstring> + </property> + <property name="text"> + <string>Normal</string> + </property> + </widget> + <widget class="KColorButton" row="2" column="3"> + <property name="name"> + <cstring>minColor3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="3" column="3"> + <property name="name"> + <cstring>maxColor3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="3" column="2"> + <property name="name"> + <cstring>maxColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>Maximize Button</string> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>maxColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Close Button</string> + </property> + </widget> + <widget class="KColorButton" row="4" column="1"> + <property name="name"> + <cstring>closeColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="4" column="2"> + <property name="name"> + <cstring>closeColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + <widget class="KColorButton" row="4" column="3"> + <property name="name"> + <cstring>closeColor3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toggleButton"> + <bool>false</bool> + </property> + <property name="color"> + <color> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </property> + <property name="toolTip" stdset="0"> + <string>The semi transparent buttons of the titlebar will be shaded in this color</string> + </property> + </widget> + </grid> + </widget> + <widget class="QComboBox" row="0" column="0"> + <item> + <property name="text"> + <string>Crystal Default</string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Crystal Aqua</string> + </property> + <property name="pixmap"> + <pixmap>image1</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Crystal Knifty</string> + </property> + <property name="pixmap"> + <pixmap>image2</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Handpainted</string> + </property> + <property name="pixmap"> + <pixmap>image3</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>SVG</string> + </property> + <property name="pixmap"> + <pixmap>image4</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Vista</string> + </property> + <property name="pixmap"> + <pixmap>image5</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Kubuntu Dapper</string> + </property> + <property name="pixmap"> + <pixmap>image6</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Kubuntu Edgy</string> + </property> + <property name="pixmap"> + <pixmap>image7</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Kubuntu Feisty</string> + </property> + <property name="pixmap"> + <pixmap>image8</pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Kubuntu Hardy</string> + </property> + <property name="pixmap"> + <pixmap>image9</pixmap> + </property> + </item> + <property name="name"> + <cstring>buttonTheme</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Select your favourite button theme here</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>menuimage</cstring> + </property> + <property name="text"> + <string>Theme &menu button</string> + </property> + <property name="accel"> + <string>Alt+M</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>The window menu is a button, if possible, or just an icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Bac&kground</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>tabWidget4</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>A&ctive</string> + </attribute> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>frame3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSpinBox" row="3" column="1"> + <property name="name"> + <cstring>shade1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="minValue"> + <number>-100</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="toolTip" stdset="0"> + <string>Amount of effect</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Amount:</string> + </property> + </widget> + <widget class="KColorButton" row="4" column="1"> + <property name="name"> + <cstring>frameColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>The color of the outline frame</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>userPicture1</cstring> + </property> + <property name="text"> + <string>Userdefined background:</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Use userdefined picture for background instead of current wallpaper</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="0" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + <item> + <property name="text"> + <string>Intensity</string> + </property> + </item> + <item> + <property name="text"> + <string>Brighten</string> + </property> + </item> + <item> + <property name="text"> + <string>Desaturate</string> + </property> + </item> + <item> + <property name="text"> + <string>Solarisation</string> + </property> + </item> + <property name="name"> + <cstring>type1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Select effect, that is to be applied to the image</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="4" column="0"> + <item> + <property name="text"> + <string>No outline</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple Outline</string> + </property> + </item> + <item> + <property name="text"> + <string>Sunken</string> + </property> + </item> + <item> + <property name="text"> + <string>Raised</string> + </property> + </item> + <property name="name"> + <cstring>frame1</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Draw outline frame</string> + </property> + </widget> + </grid> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame4</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>Blur Image:</string> + </property> + </widget> + <widget class="QSpinBox" row="2" column="1"> + <property name="name"> + <cstring>active_blur</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>inlineColor1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>The color of the inline frame</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="0"> + <item> + <property name="text"> + <string>No inline</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple inline</string> + </property> + </item> + <item> + <property name="text"> + <string>Sunken</string> + </property> + </item> + <item> + <property name="text"> + <string>Raised</string> + </property> + </item> + <property name="name"> + <cstring>inline1</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Draw inline frame around the window content</string> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer15_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>50</height> + </size> + </property> + </spacer> + <widget class="KURLRequester" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>activeFile</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Use userdefined picture for background instead of current wallpaper</string> + </property> + </widget> + </grid> + </widget> + </hbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Inacti&ve</string> + </attribute> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QFrame"> + <property name="name"> + <cstring>frame3_2</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="1" column="0" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>Fade</string> + </property> + </item> + <item> + <property name="text"> + <string>Intensity</string> + </property> + </item> + <item> + <property name="text"> + <string>Brighten</string> + </property> + </item> + <item> + <property name="text"> + <string>Desaturate</string> + </property> + </item> + <item> + <property name="text"> + <string>Solarisation</string> + </property> + </item> + <property name="name"> + <cstring>type2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Select effect, that is to be applied to the image</string> + </property> + </widget> + <widget class="KColorButton" row="4" column="1"> + <property name="name"> + <cstring>frameColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>The color of the outline frame</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>userPicture2</cstring> + </property> + <property name="text"> + <string>Userdefined background:</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Use userdefined picture for background instead of current wallpaper</string> + </property> + </widget> + <widget class="QSpinBox" row="3" column="1"> + <property name="name"> + <cstring>shade2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="minValue"> + <number>-100</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + <property name="value"> + <number>50</number> + </property> + <property name="toolTip" stdset="0"> + <string>Amount of effect</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="4" column="0"> + <item> + <property name="text"> + <string>No outline</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple Outline</string> + </property> + </item> + <item> + <property name="text"> + <string>Sunken</string> + </property> + </item> + <item> + <property name="text"> + <string>Raised</string> + </property> + </item> + <property name="name"> + <cstring>frame2</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Draw outline frame</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2_3</cstring> + </property> + <property name="text"> + <string>Amount:</string> + </property> + </widget> + </grid> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame4_2</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_5_2</cstring> + </property> + <property name="text"> + <string>Blur Image:</string> + </property> + </widget> + <widget class="QSpinBox" row="2" column="1"> + <property name="name"> + <cstring>inactive_blur</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KColorButton" row="3" column="1"> + <property name="name"> + <cstring>inlineColor2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + <property name="toolTip" stdset="0"> + <string>Color of the inline frame</string> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="3" column="0"> + <item> + <property name="text"> + <string>No inline</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple inline</string> + </property> + </item> + <item> + <property name="text"> + <string>Sunken</string> + </property> + </item> + <item> + <property name="text"> + <string>Raised</string> + </property> + </item> + <property name="name"> + <cstring>inline2</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Draw inline frame around the window content</string> + </property> + </widget> + <widget class="KURLRequester" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>inactiveFile</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>Use userdefined picture for background instead of current wallpaper</string> + </property> + </widget> + </grid> + </widget> + </hbox> + </widget> + </widget> + <widget class="QCheckBox" row="0" column="1"> + <property name="name"> + <cstring>trackdesktop</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Track desktop changes</string> + </property> + <property name="accel"> + <string>Alt+T</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check, if you have different wallpapers set on multiple desktops. Uncheck, when you just have one wallpaper for all desktops.</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Check, if you have different wallpapers set on multiple desktops. Uncheck, when you just have one wallpaper for all desktops.</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>enableTransparency</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoMask"> + <bool>true</bool> + </property> + <property name="text"> + <string>Enable Transparency</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>no, noo, nooooooooooo!</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>&Logo</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0" rowspan="2" colspan="2"> + <property name="name"> + <cstring>logoEnabled</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Draw Logo</string> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <property name="selectedId" stdset="0"> + <number>0</number> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>radioButton13</cstring> + </property> + <property name="autoMask"> + <bool>true</bool> + </property> + <property name="text"> + <string>Left</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton" row="0" column="1"> + <property name="name"> + <cstring>radioButton14_3</cstring> + </property> + <property name="text"> + <string>Disable</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="2"> + <property name="name"> + <cstring>radioButton15</cstring> + </property> + <property name="text"> + <string>Right</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>logoPreview</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>30</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string>Little preview</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="3"> + <item> + <property name="text"> + <string>Stretch</string> + </property> + </item> + <item> + <property name="text"> + <string>Centered</string> + </property> + </item> + <property name="name"> + <cstring>logoStretch</cstring> + </property> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="KURLRequester" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>logoFile</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel1_6</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Distance to the text:</string> + </property> + </widget> + <widget class="QSpinBox" row="0" column="3"> + <property name="name"> + <cstring>logoDistance</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="maxValue"> + <number>500</number> + </property> + <property name="lineStep"> + <number>5</number> + </property> + </widget> + <widget class="QCheckBox" row="1" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>logoActive</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Active &window only</string> + </property> + <property name="accel"> + <string>Alt+W</string> + </property> + <property name="toolTip" stdset="0"> + <string>Draw logo in the active window only</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>&Overlay</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Lets you put an transparent image on top of the title bar.</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>User defined should be a transparent png file, i.e. 1x64px</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <spacer row="5" column="1"> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_7</cstring> + </property> + <property name="text"> + <string>Overlay for active window:</string> + </property> + </widget> + <widget class="QLabel" row="1" column="1"> + <property name="name"> + <cstring>textLabel1_7_2</cstring> + </property> + <property name="text"> + <string>Overlay for inactive window:</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="0"> + <item> + <property name="text"> + <string>Disabled</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple Lighting</string> + </property> + </item> + <item> + <property name="text"> + <string>Glass</string> + </property> + </item> + <item> + <property name="text"> + <string>Steel</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <property name="name"> + <cstring>overlay_active</cstring> + </property> + </widget> + <widget class="KURLRequester" row="3" column="0"> + <property name="name"> + <cstring>overlay_active_file</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="KURLRequester" row="3" column="1"> + <property name="name"> + <cstring>overlay_inactive_file</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <item> + <property name="text"> + <string>Disabled</string> + </property> + </item> + <item> + <property name="text"> + <string>Simple Lighting</string> + </property> + </item> + <item> + <property name="text"> + <string>Glass</string> + </property> + </item> + <item> + <property name="text"> + <string>Steel</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <property name="name"> + <cstring>overlay_inactive</cstring> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="161">89504e470d0a1a0a0000000d494844520000000e0000000e08060000001f482dd100000068494441542891a590d10d80200c444fe3201d85c99ccd51ba49fd41adf5d0824d08c90b2fc77532b31503b3d47bebf4ca3c9206004c940c8ba2b8f3c6ce8ec7284990cad53f8c22931f12c03ba686250aaeefc5e4a6e8250dfc26b796a31f8c76d40cfbbd9cd22bee402315e540bd33360000000049454e44ae426082</data> + </image> + <image name="image1"> + <data format="PNG" length="926">89504e470d0a1a0a0000000d49484452000000100000001008060000001ff3ff610000036549444154388d3d93cd4fe2681c807fef573fb0022d5940100788ab6246e3817870e7660cd11b7fab9183c94e340a313a87494c76b666218cb85dc5015a282db4efdbee613f9ecb737b6e0f827f39393929954aa5cdededed7ab95c2ea4d36903001800004228b46d7bdceff72dd334bf0c06833f2e2f2f0700000400a0d16868aaaafebcb6b6562f954ab56ab5aaafafaf135dd7c1300c48a7d30463acb9ae9b9acd6664369b4dcbe5b2dded7603727a7a9a482412c562b1585b2fae570a85422a954a518c3108218073febf39e711e75cc471bc0c82c0ad542a3ea9d7eb99b542a196cfe53ee6f2b98d288e5241104808a1288aa298730ef3f91c0f8743c5f33c49511486104294525f703ea1695d3fc864325b3f65b3c5300c53575757bb711ce3a3a3a3dee6e6a60300d0ed76539d4ea78a108a3e7dfae5b75c2e578ca3681a8621504596f792c9d56c32994cf89e8701005cd7553a9d4e5508fe1d00c1fdfdfd07d775154dd37cc624a2695ac2f3bcd278329129a1b4863126aaa2b084aa2c1b8dc6ef93c924f1f0f050bebabade0600585959591c1f1f9b86ae7babc9e40221c4082159424986128c154a28489204b22445ba6ef8f97c3ef07dffb5dd6e6f0200ecededbdeeeeeedab22cf3907308830008a58c10c230210428fd2720c932608cf1cbcb4bd234cdbca2285c51146e9a66deb2ac5584109665192449024629104280628c178c32c2186300807bbd5eeaf6f6b64a308666b3692284e0d7cf9f3f5c5f5f5731c6bd72a5e230498a186321c1445000f88609ce72ceb39eef27dbed7619630c676767bdfdfd7d07610caaaa8a56ab55bdb9b9291b8661ae689a43081902c0902e97cbc7e974bae5388e06009aaeeb8bc3c3c3d783830347d3b408130cf57add0180dedddd5d7e190422b46dcf719cc172b97c225b5b5b2e00b0288e5753c964626767675eabd57c4dd322499280120a94d2d8308cc0c864ec300ca7cfcfcfcf7f59d6e3dbdbdb573a1a8da68bc5a2278458912509d2e97431122201000ce2f8bfd74044624909f1de5e5fff7c190cbef5fbfdde7c3e9f92a7a7a770636363190481afaaaa4f298d8510743c1eab3fde7f90e17008efefefe178341e5a96d51d0c068fdd6ed7b46ddb3a3f3f9f53008056abe5369bcd17cbb2a68410188d4632632c833166082188e358082186b3d9ecc9b2acaf9ee74d2f2e2e3c0080bf01fea1a46a851ec23c0000000049454e44ae426082</data> + </image> + <image name="image2"> + <data format="PNG" length="135">89504e470d0a1a0a0000000d494844520000000e0000000e08060000001f482dd10000004e494441542891636018bae0ffffff55c4883161512087ac109b1803030303230ed3e51818181e4185e41818181e313232b6e1d588a699019b260ca79202a8e354644d3085d8c4b00262a363080100cc4636fd3ab4855a0000000049454e44ae426082</data> + </image> + <image name="image3"> + <data format="PNG" length="362">89504e470d0a1a0a0000000d494844520000000e0000000e08060000001f482dd1000001314944415428918dd2cf4bd4511405f0cf9d19b34cd32809a155b9904257b60bc2959b68511bffc69685d2b284224482ca8d08420b43fa852efc49745dcc9de13b430b2f3cde83c339f79e735fb86465660bd7d0c2713480366e16f803e71191857570178f7082f54e437402cf711fafb09999e718c72c9ed6bd8a6c128ff0a554574af91b9ee031c6b08677386a8e1ab88ac5221e60070bf8830ff884c388c83eb1213081677594c04b7cc471cf77678814e5691aff90f88caf4d928ab6499ac412e6f11edbb8875bc393b51aef9ebf256ce135d671030f75d73448ac3dcde1057ee30df67453dd2f6cea7f1d6f63195774f7b41b117f715802d3b83e402c6f3378800d6c45c459e1a7f88991215bfd544ff01d6fab4bafceca6f1bbf06d2c9ccc8ccd1ccbc535e87b191cc1caf4fdeaf0bba6b74becef91ce80000000049454e44ae426082</data> + </image> + <image name="image4"> + <data format="PNG" length="667">89504e470d0a1a0a0000000d494844520000000e0000000e08060000001f482dd1000002624944415428917dd231481b611806e0f7bf24975e72dc2584cb3581b40a2de5701221b64390165cba3a0822e85491802011119c1414cfa1a066398d838ea2838b43a7664a9084b6d2e14068a425d08628489bdc71ffff1b9768b7bcf3f7f07dbc7c8410128fc7e31fd2e9f42b499244f488e3386ea954fade6c360bc4308c7cb15854344dbbeb851e727575e51b1919f9e94fa7d3294dd39a8d46c3679aa69a4824f8ecececdf70387c0700d7d7d7be9d9d1d050072b9dc6d5f5f9f373838f84200400138ebebebe1c9c9c9c8f0f0706c7a7a5aafd7ebd4b66d9ecd669f8e8d8d4533994c747b7b3b08c001c0fd8c310ec09165b9dd6ab590c964904aa5a46c36fb2c180c0af97c3ea8691a8e8f8f1189441c000e638cfb19631480b3b8b8f86b6a6a4a89c56211c330605996248a22a2d128cae5324e4e4e1a0707077500e09c738131c600b41545f9675956756161e1c6b66de8bafe883636367eefeded7d1345b10da0cd18e302a594016803685f5c5c4055d5502291786cb1bfbf1f8220c89797979d8739c6d8ff8d954a45d8dfdf7fb3bbbbfb445555148b4554ab55e8ba0ecbb2e4959595d7b55a8d7721133ccf63001cd3349fafadad856459c6d9d919363737ede5e5e55ab95c86a669585a5a524cd34c027028a5dcdf3dd5098542b7a7a7a7705db7737e7efee5e8e8a8e4ba2e999898783b3a3a6ab45aad8ea228b75dc8c8d0d0d0c74aa5f289734eb6b6b692c964d21d1f1fbf218474ba0d92c3c343cdf33c323333f3a7d3e990818181774492a4dcfcfcfccdeaeaea0f9fcfd7f3dd1863646e6ece28140a7704801fc0fb4020f032100808bd20a594534abf02f87c0f638020102f4b25e50000000049454e44ae426082</data> + </image> + <image name="image5"> + <data format="PNG" length="697">89504e470d0a1a0a0000000d494844520000001b0000000f08060000001593b4d80000028049444154388dbd94bd8a275510c57fa7baff1fc332b2b2080b6b32b8e007b2a1acc93e811b1af80006fa0206229818998aa04fa0e96a2808066a60e2266ae2202a18380e063b33ddb76f1d83db33ff1e1599c882dbdcae5b7d4f9daa53adbb6fbcffd9476fbe76fdcbdf12019290004062b73f772cccf6623fafc53b8bf3671e0f22fa9effcbfa884e25e1cff13c7b13da31fce58787fcfeeb21fa978f7df16876e3d601b79ebe43a62ff901ce2af4ea3acec142208482b9a4f0f34f877cf0fafd2b65feea7b9fb07f70075b730577880d4ca129e15169ce08130082881674553babf0683409a42fb31e2bf4001533643be9726616a00a535e1d6c320c066703f3026db21bd8f77f24ef7e3310822e4417102122200f278e8e8e78ea9d2fe01f9df3850a0fdfbac7831f0bda1fc9349997d52aafe8d5454ba5967697d5e84ba420fb56c77aadd2bdf812440b91c115a8905f7ddaa055910b54437249fa6447ef9a9009d3d0c042b8870ca1b5f07a621806723dc1b50177334103535b39c7783591dd00a3dbd912acf6f4761ad70b30f7c23328215285711c715798be7e80630196adaf042d460569c09a99d525b30dbd6b9dcb383667b48b4cb47d144a297cfbf2ddff14472905a2608dd8b9637ed1de4a9f597da9678025243516376ff2fcc79fc30a1c6a092c99a5a10023e8892781027213c752c939d1e734b5dae6041db88d353eff0f1edc46cfddc62ba10d7835eb07500106d06874063e019fd4a61efe366899f4c7c7c7a76c1fbb7eff8567db6c6d21f6047b823df01e7803ac446e80a5402a68066300ce8053e0c4706a3cecb0be9ba0dfdfae37afbcfd616b578036a0ad60cbbc84d74d38b9997b1aad8424c40014a39136d133a08739811d31fe02846e5eb578ac01db0000000049454e44ae426082</data> + </image> + <image name="image6"> + <data format="PNG" length="749">89504e470d0a1a0a0000000d494844520000001c000000110806000000ce93cc4a000002b449444154388db595b14beb401cc7bf7739b4a93554a4fab01d7448411e283a54510b2e1545c1518a2014bab8e9bf53d0426866174178011dd4a18b604002667051a10e22be607269ae7983547c3e63873ebfd3ddf7ee771fbe773f38b2bcbc4c1963e3849089300c87f10d228434c230348320b018636c9c31b6b4babada9fcfe7e3f1789cfe4fd8e3e3a3a8d7ebcad1d1d10f00609ee74d148bc5fe42a190705d17272727b06d1baeeb7605521405a3a3a398999991565656124110e0e0e060827a9e373c3535253b8e835aad06d334bb8601c0f3f3334cd384a669701c07b3b3b3b2e779c38c738ec1c141a95eaf439665c8b2dc35eca3aeaeae90cbe524ce3918e71c9224210c43a4d3e9c8a2a7a7a7427b9c4c268d4efe7bb55a2d489204ce3998effba09422994c46c26e6e6e0adbdbdb6a7bbebfbf8fb1b13123caffec0c4a297cdf7f4d4829452a958a04a65229a356ab616b6b4b058072b9ac6a9a8672b9fc06d334cdcee5729fc2da40ce39482693d9b9b8b818711c2712d8d6d9d95961737353fde8ebba6e2f2c2c44c200209148607a7afa9e359b4d48920445513a021963917ea77a42089acd26581004f07d1f9ee77d59707a7afa573a5dd7edf67c636343d5751df97c3e32652c16431004afc0979717dcdddda1d56a7dbaf9fafaba502a95d4f67ab55ab5b3d9acb1b7b78752a9a40240b15854abd52ab2d9ec3f504a29d2e934822000e9ebebdb393f3f1fb16d1b0f0f0f910939e76feddfdbdb6b74f2df6b686808aaaa627e7efe9e0921605996181818908e8f8fe1fb7e1433eababe6c969e9e1eacafafc3b22c2184001342342a958ab2bbbb9b989b9b836118b8bdbdedf8a69d148bc590c964b0b8b808dff751a9545c21448330c67e02589a9c9cec5f5b5b93555595ba227d906ddbe2f0f0d0bdbcbcfc0de01701400921e384900900dff21f0268846168866168fd019d6438f015f4928f0000000049454e44ae426082</data> + </image> + <image name="image7"> + <data format="PNG" length="431">89504e470d0a1a0a0000000d494844520000001c000000110806000000ce93cc4a0000017649444154388ddd93b14a23511486bf93491c91059b041fc02220e8ae45c0422b0b5f20855c181d9842304dc0764bdb853459d20c0402172ea4170b2b1b4bb530a4f00134d388166a8a6b61062c92dc01b329f6871fcef961cec7bde70e80c7fce4e5007f8e40ffff07e601df5abb3c0f9a88f879601170029bcde6695ad76ab5dfae7c82160136acb5ebd3dc6ab58cb5f631f5a89f984f32b02140c55aebdc631cc7275114ed7ce92fc7f47fa6cd10913701b6b3eeb0dd6e1f8761b83526bf0ac3f0afeb7b1179caf3f94a33013dcf5b007213f22c335ed3df62d965adf5511004154000d15adfa675100415adf55186397e26a031e64029b5393a5dce18d3534a9d19637a69a694da34c61cb88002ec5b6b7fbaeea2dbedeea575b55a3d77e5e3242237021c0e0683d562b1587441bfa324499252a9749f039e3b9d4e022cfd4b8f18cf02ac150a85dd288a5eeaf5ba94cbe585599eacdfefbf371a0d1bc7f18fe17078217c2e7d0df805accc12f6450fc03570f70132f7c875314776b20000000049454e44ae426082</data> + </image> + <image name="image8"> + <data format="PNG" length="346">89504e470d0a1a0a0000000d494844520000001c000000110806000000ce93cc4a0000012149444154388dcd95316b84301886df68a0500206a174291cd88283e026b80ac5d11fd2f9a61b9d9dfb431c5d247f41103ab42e2dd92a0a47af1dd44e4eada782297d20907c843c1fe12521002e1cc7b9b52ceb4ed7751d0ae8baaeabaaeab92ccb176adbb675381cbc288a7ac6d8a042783c1e499aa65e1cc703f13cef3ecbb29e73ae4436d2340d09c350a3755d779cf337953200e09ca3aeeb1b2aa5fc02f0aa5a080052ca2b7a3a9d7a42c8e7dce624491ec7f97ebf7f98ab4fd00380bf44360c831cc72899aa9fc15f249c3a7ca56c9df037e94a1900f8da52d996fcbf2bdd32347441573fe23eaea7ea732c0ecd06f8d4344d2dcff36bd7753b95a6a228f4200834ca187b1742f8bbddeec3300c250f78dbb6440871c9187b22f8e3fff01bc36efcafd63932e90000000049454e44ae426082</data> + </image> + <image name="image9"> + <data format="PNG" length="346">89504e470d0a1a0a0000000d494844520000001c000000110806000000ce93cc4a0000012149444154388dcd95316b84301886df68a0500206a174291cd88283e026b80ac5d11fd2f9a61b9d9dfb431c5d247f41103ab42e2dd92a0a47af1dd44e4eada782297d20907c843c1fe12521002e1cc7b9b52ceb4ed7751d0ae8baaeabaaeab92ccb176adbb675381cbc288a7ac6d8a042783c1e499aa65e1cc703f13cef3ecbb29e73ae4436d2340d09c350a3755d779cf337953200e09ca3aeeb1b2aa5fc02f0aa5a080052ca2b7a3a9d7a42c8e7dce624491ec7f97ebf7f98ab4fd00380bf44360c831cc72899aa9fc15f249c3a7ca56c9df037e94a1900f8da52d996fcbf2bdd32347441573fe23eaea7ea732c0ecd06f8d4344d2dcff36bd7753b95a6a228f4200834ca187b1742f8bbddeec3300c250f78dbb6440871c9187b22f8e3fff01bc36efcafd63932e90000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>radioButton5</sender> + <signal>toggled(bool)</signal> + <receiver>updateTime</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>hover</sender> + <signal>toggled(bool)</signal> + <receiver>animateHover</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>userPicture1</sender> + <signal>toggled(bool)</signal> + <receiver>activeFile</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>userPicture2</sender> + <signal>toggled(bool)</signal> + <receiver>inactiveFile</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>userPicture1</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>trackdesktop</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>repaintMode</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>radioButton14_3</sender> + <signal>toggled(bool)</signal> + <receiver>logoDistance</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>radioButton14_3</sender> + <signal>toggled(bool)</signal> + <receiver>logoActive</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>radioButton14_3</sender> + <signal>toggled(bool)</signal> + <receiver>logoFile</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>radioButton14_3</sender> + <signal>toggled(bool)</signal> + <receiver>logoStretch</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>radioButton14_3</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_6</receiver> + <slot>setDisabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>userPicture2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>activeFile</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>inactiveFile</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>type1</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>type2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>active_blur</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>inactive_blur</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>shade1</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>shade2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_2_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>enableTransparency</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel1_5_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>drawCaption</sender> + <signal>toggled(bool)</signal> + <receiver>titlealign</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>drawCaption</sender> + <signal>toggled(bool)</signal> + <receiver>textshadow</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="5"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/client/config/crystalconfig.cc b/client/config/crystalconfig.cc new file mode 100644 index 0000000..dedf8ec --- /dev/null +++ b/client/config/crystalconfig.cc @@ -0,0 +1,384 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <qbuttongroup.h> +#include <qlabel.h> +#include <qgroupbox.h> +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qwhatsthis.h> +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qwidgetstack.h> +#include <qlineedit.h> +#include <qfiledialog.h> +#include <kcolorbutton.h> +#include <kfiledialog.h> +#include <qpicture.h> +#include <kapplication.h> +#include <kurlrequester.h> + +#include "configdialog.h" +#include "infodialog.h" +#include "crystalconfig.h" + + +CrystalConfig::CrystalConfig(KConfig*, QWidget* parent) + : QObject(parent), config_(0), dialog_(0) +{ + config_ = new KConfig("kwincrystalrc"); + + dialog_ = new ConfigDialog(parent); + dialog_->show(); + + connect(dialog_->titlealign, SIGNAL(clicked(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->drawCaption, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->textshadow, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->tooltip,SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->wheelTask,SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + + connect(dialog_->trackdesktop, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->shade1, SIGNAL(valueChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->shade2, SIGNAL(valueChanged(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->frame1, SIGNAL(activated(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->frame2, SIGNAL(activated(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->frameColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->frameColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + + connect(dialog_->inline1, SIGNAL(activated(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->inline2, SIGNAL(activated(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->inlineColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->inlineColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + + connect(dialog_->type1,SIGNAL(activated(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->type2,SIGNAL(activated(int)),this,SLOT(selectionChanged(int))); + + connect(dialog_->enableTransparency,SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + + connect(dialog_->borderwidth, SIGNAL(valueChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->titlebarheight, SIGNAL(valueChanged(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->tlc, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->trc, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->blc, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->brc, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->buttonColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->buttonColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->buttonColor3, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->minColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->minColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->minColor3, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->maxColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->maxColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->maxColor3, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->closeColor1, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->closeColor2, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + connect(dialog_->closeColor3, SIGNAL(changed(const QColor&)),this,SLOT(colorChanged(const QColor&))); + + connect(dialog_->hover, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->animateHover, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->buttonTheme, SIGNAL(activated(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->tintButtons, SIGNAL(toggled(bool)),this,SLOT(boolChanged(bool))); + connect(dialog_->menuimage, SIGNAL(stateChanged(int)),this,SLOT(selectionChanged(int))); + + connect(dialog_->repaintMode, SIGNAL(clicked(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->updateTime, SIGNAL(valueChanged(int)),this, SLOT(selectionChanged(int))); + + connect(dialog_->infoButton, SIGNAL(clicked(void)),this,SLOT(infoDialog(void))); + + connect(dialog_->active_blur, SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + connect(dialog_->inactive_blur, SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + + connect(dialog_->userPicture1, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->userPicture2, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->activeFile,SIGNAL(textChanged(const QString&)),this,SLOT(textChanged( const QString& ))); + connect(dialog_->inactiveFile,SIGNAL(textChanged(const QString&)),this,SLOT(textChanged( const QString& ))); + + + connect(dialog_->overlay_active, SIGNAL(activated(int)),this, SLOT(overlay_active_changed(int))); + connect(dialog_->overlay_inactive, SIGNAL(activated(int)),this, SLOT(overlay_inactive_changed(int))); + + connect(dialog_->overlay_active_file,SIGNAL(textChanged(const QString&)),this,SLOT(textChanged(const QString &))); + connect(dialog_->overlay_inactive_file,SIGNAL(textChanged(const QString&)),this,SLOT(textChanged(const QString &))); + + + connect(dialog_->logoEnabled, SIGNAL(clicked(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->logoFile, SIGNAL(textChanged(const QString &)),this, SLOT(logoTextChanged(const QString&))); + connect(dialog_->logoStretch, SIGNAL(activated(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->logoActive, SIGNAL(stateChanged(int)),this, SLOT(selectionChanged(int))); + connect(dialog_->logoDistance,SIGNAL(valueChanged(int)),this,SLOT(selectionChanged(int))); + + load(config_); +} + +CrystalConfig::~CrystalConfig() +{ + if (dialog_) delete dialog_; + if (config_) delete config_; +} + +void CrystalConfig::selectionChanged(int) +{ + emit changed(); +} + +void CrystalConfig::load(KConfig*) +{ + QColor color(255,255,255); + + config_->setGroup("General"); + + QString value = config_->readEntry("TitleAlignment", "AlignHCenter"); + QRadioButton *button = (QRadioButton*)dialog_->titlealign->child(value); + if (button) button->setChecked(true); + + dialog_->drawCaption->setChecked(config_->readBoolEntry("DrawCaption",true)); + dialog_->textshadow->setChecked(config_->readBoolEntry("TextShadow",true)); + dialog_->tooltip->setChecked(config_->readBoolEntry("CaptionTooltip",true)); + dialog_->wheelTask->setChecked(config_->readBoolEntry("WheelTask",false)); + + dialog_->enableTransparency->setChecked(config_->readBoolEntry("EnableTransparency",true)); + dialog_->trackdesktop->setChecked(config_->readBoolEntry("TrackDesktop",false)); + + dialog_->frame1->setCurrentItem(config_->readNumEntry("ActiveFrame",1)); + color=QColor(192,192,192); + dialog_->frameColor1->setColor(config_->readColorEntry("FrameColor1",&color)); + dialog_->frame2->setCurrentItem(config_->readNumEntry("InactiveFrame",1)); + color=QColor(192,192,192); + dialog_->frameColor2->setColor(config_->readColorEntry("FrameColor2",&color)); + + dialog_->inline1->setCurrentItem(config_->readNumEntry("ActiveInline",0)); + color=QColor(192,192,192); + dialog_->inlineColor1->setColor(config_->readColorEntry("InlineColor1",&color)); + dialog_->inline2->setCurrentItem(config_->readNumEntry("InactiveInline",0)); + color=QColor(192,192,192); + dialog_->inlineColor2->setColor(config_->readColorEntry("InlineColor2",&color)); + + + dialog_->borderwidth->setValue(config_->readNumEntry("Borderwidth",5)); + dialog_->titlebarheight->setValue(config_->readNumEntry("Titlebarheight",19)); + + int active=config_->readNumEntry("ActiveShade",30); + dialog_->shade1->setValue(active); + + active=config_->readNumEntry("InactiveShade",-30); + dialog_->shade2->setValue(active); + + dialog_->type1->setCurrentItem(config_->readNumEntry("ActiveMode",0)); + dialog_->type2->setCurrentItem(config_->readNumEntry("InactiveMode",2)); + + int cornersFlag = config_->readNumEntry("RoundCorners",TOP_LEFT & TOP_RIGHT ); + dialog_->tlc->setChecked( cornersFlag & TOP_LEFT ); + dialog_->trc->setChecked( cornersFlag & TOP_RIGHT ); + dialog_->blc->setChecked( cornersFlag & BOT_LEFT ); + dialog_->brc->setChecked( cornersFlag & BOT_RIGHT ); + + dialog_->hover->setChecked(config_->readBoolEntry("HoverEffect",true)); + dialog_->animateHover->setChecked(config_->readBoolEntry("AnimateHover",true)); + dialog_->menuimage->setChecked(config_->readBoolEntry("MenuImage",true)); + + color=QColor(255,255,255); + dialog_->buttonColor1->setColor(config_->readColorEntry("ButtonColor",&color)); + dialog_->buttonColor2->setColor(config_->readColorEntry("ButtonColor2",&color)); + dialog_->buttonColor3->setColor(config_->readColorEntry("ButtonColor3",&color)); + dialog_->minColor1->setColor(config_->readColorEntry("MinColor",&color)); + dialog_->minColor2->setColor(config_->readColorEntry("MinColor2",&color)); + dialog_->minColor3->setColor(config_->readColorEntry("MinColor3",&color)); + dialog_->maxColor1->setColor(config_->readColorEntry("MaxColor",&color)); + dialog_->maxColor2->setColor(config_->readColorEntry("MaxColor2",&color)); + dialog_->maxColor3->setColor(config_->readColorEntry("MaxColor3",&color)); + dialog_->closeColor1->setColor(config_->readColorEntry("CloseColor",&color)); + dialog_->closeColor2->setColor(config_->readColorEntry("CloseColor2",&color)); + dialog_->closeColor3->setColor(config_->readColorEntry("CloseColor3",&color)); + + dialog_->tintButtons->setChecked(config_->readBoolEntry("TintButtons",dialog_->buttonColor1->color()!=QColor(255,255,255))); + + dialog_->buttonTheme->setCurrentItem(config_->readNumEntry("ButtonTheme",8)); + + dialog_->updateTime->setValue(config_->readNumEntry("RepaintTime",200)); + button=(QRadioButton*)dialog_->repaintMode->find(config_->readNumEntry("RepaintMode",1)); + if (button)button->setChecked(true); + + dialog_->active_blur->setValue(config_->readNumEntry("ActiveBlur",0)); + dialog_->inactive_blur->setValue(config_->readNumEntry("InactiveBlur",0)); + + + dialog_->activeFile->setURL(config_->readEntry("ActiveUserdefinedPicture","")); + dialog_->userPicture1->setChecked(config_->readBoolEntry("ActiveUserdefined",false)); + dialog_->inactiveFile->setURL(config_->readEntry("InactiveUserdefinedPicture","")); + dialog_->userPicture2->setChecked(config_->readBoolEntry("InactiveUserdefined",false)); + + + dialog_->overlay_active->setCurrentItem(config_->readNumEntry("OverlayModeActive",0)); + dialog_->overlay_active_file->setURL(config_->readEntry("OverlayFileActive","")); + overlay_active_changed(dialog_->overlay_active->currentItem()); + + dialog_->overlay_inactive->setCurrentItem(config_->readNumEntry("OverlayModeInactive",0)); + dialog_->overlay_inactive_file->setURL(config_->readEntry("OverlayFileInactive","")); + overlay_inactive_changed(dialog_->overlay_inactive->currentItem()); + + dialog_->logoEnabled->setButton(config_->readNumEntry("LogoAlignment",1)); + dialog_->logoFile->setURL(config_->readEntry("LogoFile","")); + dialog_->logoActive->setChecked(config_->readBoolEntry("LogoActive",1)); + dialog_->logoStretch->setCurrentItem(config_->readNumEntry("LogoStretch",0)); + dialog_->logoDistance->setValue(config_->readNumEntry("LogoDistance",0)); + updateLogo(); +} + +void CrystalConfig::save(KConfig*) +{ + config_->setGroup("General"); + + QRadioButton *button = (QRadioButton*)dialog_->titlealign->selected(); + if (button) config_->writeEntry("TitleAlignment", QString(button->name())); + config_->writeEntry("DrawCaption",dialog_->drawCaption->isChecked()); + config_->writeEntry("TextShadow",dialog_->textshadow->isChecked()); + config_->writeEntry("CaptionTooltip",dialog_->tooltip->isChecked()); + config_->writeEntry("WheelTask",dialog_->wheelTask->isChecked()); + + config_->writeEntry("EnableTransparency",dialog_->enableTransparency->isChecked()); + config_->writeEntry("TrackDesktop",dialog_->trackdesktop->isChecked()); + + config_->writeEntry("Borderwidth",dialog_->borderwidth->value()); + config_->writeEntry("Titlebarheight",dialog_->titlebarheight->value()); + + config_->writeEntry("ActiveShade",dialog_->shade1->value()); + config_->writeEntry("InactiveShade",dialog_->shade2->value()); + config_->writeEntry("ActiveFrame",dialog_->frame1->currentItem()); + config_->writeEntry("FrameColor1",dialog_->frameColor1->color()); + config_->writeEntry("InactiveFrame",dialog_->frame2->currentItem()); + config_->writeEntry("ActiveMode",dialog_->type1->currentItem()); + config_->writeEntry("InactiveMode",dialog_->type2->currentItem()); + config_->writeEntry("FrameColor2",dialog_->frameColor2->color()); + + config_->writeEntry("ActiveInline",dialog_->inline1->currentItem()); + config_->writeEntry("InlineColor1",dialog_->inlineColor1->color()); + config_->writeEntry("InactiveInline",dialog_->inline2->currentItem()); + config_->writeEntry("InlineColor2",dialog_->inlineColor2->color()); + + config_->writeEntry("ButtonColor",dialog_->buttonColor1->color()); + config_->writeEntry("ButtonColor2",dialog_->buttonColor2->color()); + config_->writeEntry("ButtonColor3",dialog_->buttonColor3->color()); + config_->writeEntry("MinColor",dialog_->minColor1->color()); + config_->writeEntry("MinColor2",dialog_->minColor2->color()); + config_->writeEntry("MinColor3",dialog_->minColor3->color()); + config_->writeEntry("MaxColor",dialog_->maxColor1->color()); + config_->writeEntry("MaxColor2",dialog_->maxColor2->color()); + config_->writeEntry("MaxColor3",dialog_->maxColor3->color()); + config_->writeEntry("CloseColor",dialog_->closeColor1->color()); + config_->writeEntry("CloseColor2",dialog_->closeColor2->color()); + config_->writeEntry("CloseColor3",dialog_->closeColor3->color()); + + int cornersFlag = 0; + if(dialog_->tlc->isChecked()) cornersFlag += TOP_LEFT; + if(dialog_->trc->isChecked()) cornersFlag += TOP_RIGHT; + if(dialog_->blc->isChecked()) cornersFlag += BOT_LEFT; + if(dialog_->brc->isChecked()) cornersFlag += BOT_RIGHT; + config_->writeEntry("RoundCorners", cornersFlag ); + + config_->writeEntry("HoverEffect",dialog_->hover->isChecked()); + config_->writeEntry("AnimateHover",dialog_->animateHover->isChecked()); + config_->writeEntry("TintButtons",dialog_->tintButtons->isChecked()); + config_->writeEntry("MenuImage",dialog_->menuimage->isChecked()); + + config_->writeEntry("ButtonTheme",dialog_->buttonTheme->currentItem()); + config_->writeEntry("RepaintMode",dialog_->repaintMode->selectedId()); + config_->writeEntry("RepaintTime",dialog_->updateTime->value()); + + config_->writeEntry("ActiveBlur",dialog_->active_blur->value()); + config_->writeEntry("InactiveBlur",dialog_->inactive_blur->value()); + + config_->writeEntry("ActiveUserdefined",dialog_->userPicture1->isChecked()); + config_->writeEntry("ActiveUserdefinedPicture",dialog_->activeFile->url()); + config_->writeEntry("InactiveUserdefined",dialog_->userPicture2->isChecked()); + config_->writeEntry("InactiveUserdefinedPicture",dialog_->inactiveFile->url()); + + config_->writeEntry("OverlayModeActive",dialog_->overlay_active->currentItem()); + config_->writeEntry("OverlayFileActive",dialog_->overlay_active_file->url()); + config_->writeEntry("OverlayModeInactive",dialog_->overlay_inactive->currentItem()); + config_->writeEntry("OverlayFileInactive",dialog_->overlay_inactive_file->url()); + + config_->writeEntry("LogoAlignment",dialog_->logoEnabled->selectedId()); + config_->writeEntry("LogoFile",dialog_->logoFile->url()); + config_->writeEntry("LogoActive",dialog_->logoActive->isChecked()); + config_->writeEntry("LogoStretch",dialog_->logoStretch->currentItem()); + config_->writeEntry("LogoDistance",dialog_->logoDistance->value()); + + config_->sync(); +} + +void CrystalConfig::infoDialog() +{ + InfoDialog d(dialog_); + connect((QLabel*)(d.kURLLabel1),SIGNAL(leftClickedURL(const QString&)),KApplication::kApplication(),SLOT(invokeBrowser(const QString &))); + d.exec(); +} + +void CrystalConfig::logoTextChanged(const QString&) +{ + updateLogo(); + emit changed(); +} + +void CrystalConfig::overlay_active_changed(int a) +{ + dialog_->overlay_active_file->setEnabled(a==4); + emit changed(); +} + +void CrystalConfig::overlay_inactive_changed(int a) +{ + dialog_->overlay_inactive_file->setEnabled(a==4); + emit changed(); +} + +void CrystalConfig::updateLogo() +{ + QPixmap pic; + pic.load(dialog_->logoFile->url()); + dialog_->logoPreview->setPixmap(pic); +} + +void CrystalConfig::defaults() +{ + QRadioButton *button = + (QRadioButton*)dialog_->titlealign->child("AlignHCenter"); + if (button) button->setChecked(true); + dialog_->shade1->setValue(50); + dialog_->shade2->setValue(50); +} + +extern "C" +{ + QObject* allocate_config(KConfig* config, QWidget* parent) { + return (new CrystalConfig(config, parent)); + } +} + +#include "crystalconfig.moc" diff --git a/client/config/crystalconfig.h b/client/config/crystalconfig.h new file mode 100644 index 0000000..5bdc0fb --- /dev/null +++ b/client/config/crystalconfig.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 CRYSTALCONFIG_H +#define CRYSTALCONFIG_H + +#include <qobject.h> + +#define TOP_LEFT 1 +#define TOP_RIGHT 2 +#define BOT_LEFT 4 +#define BOT_RIGHT 8 + +class KConfig; +class ConfigDialog; + +class CrystalConfig : public QObject +{ + Q_OBJECT +public: + CrystalConfig(KConfig* config, QWidget* parent); + ~CrystalConfig(); + +signals: + void changed(); + +public slots: + void load(KConfig*); + void save(KConfig*); + void defaults(); + void infoDialog(); + +protected slots: + void selectionChanged(int); + void overlay_active_changed(int); + void overlay_inactive_changed(int); + void boolChanged(bool) { selectionChanged(0); } + void colorChanged(const QColor&) { selectionChanged(0); } + void textChanged(const QString&) { selectionChanged(0); } + void logoTextChanged(const QString&); + +private: + KConfig *config_; + ConfigDialog *dialog_; + + void updateLogo(); +}; + +#endif // CRYSTALCONFIG_H diff --git a/client/config/infodialog.ui b/client/config/infodialog.ui new file mode 100644 index 0000000..f73a21c --- /dev/null +++ b/client/config/infodialog.ui @@ -0,0 +1,284 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>InfoDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>InfoDialog</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>457</width> + <height>340</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>Info about Crystal...</string> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="resizeMode"> + <enum>Minimum</enum> + </property> + <widget class="QGroupBox" row="0" column="0" rowspan="2" colspan="2"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>20</height> + </size> + </property> + <property name="frameShape"> + <enum>ToolBarPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="title"> + <string>About:</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="backgroundMode"> + <enum>PaletteBackground</enum> + </property> + <property name="text"> + <string>Crystal kwin decoration theme, +Sascha Hlusiak <spam84@nurfuerspam.de>, 2004-2007. + +You may look for the most recent version at kde-look.org:</string> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + <property name="alignment"> + <set>AlignTop|AlignLeft</set> + </property> + </widget> + <widget class="QLabel" row="1" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>pixmapLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + </widget> + <widget class="KURLLabel" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kURLLabel1</cstring> + </property> + <property name="text"> + <string>www.kde-look.org/content/show.php?content=13969</string> + </property> + <property name="url" stdset="0"> + <string>http://www.kde-look.org/content/show.php?content=13969</string> + </property> + </widget> + <widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox3_2</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>20</height> + </size> + </property> + <property name="frameShape"> + <enum>ToolBarPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="title"> + <string>Usage:</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Besides default features of most window decorations: +- Doubleclick the systemmenu button closes the window. +- Middleclick on the minimize button to send it below. +- Rightclick the minimize button shades the window. +- Rightclick on close button runs kdocker for this window to + dock it to the systemtray. kdocker needs to be installed + for this to work. +- Scroll over the title bar selects next/prev window. + If this is disabled AND the deco is compiled against + KDE-3.5, the default behaviour is used.</string> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + <widget class="Line" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QPushButton" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>pushButton1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoMask"> + <bool>true</bool> + </property> + <property name="text"> + <string>&Close</string> + </property> + <property name="accel"> + <string>Alt+C</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="5016">89504e470d0a1a0a0000000d4948445200000040000000400806000000aa6971de0000135f49444154789ced9b7b90e54775df3fa7bb7fbfdf7dce9dbbf3ded5ae9ee805228838066c4a084b162fa172253138b812aa30211563ec98522284ed601720d9048c6c0bd90ec93f8a31a4302104139c3260a8540436108c4158c5eab5ab7dce3e66e63e7fafee933fface2c244215b123f99f3d5577666edd7bfb9ef3edeeef39e7db3dc2df815d73c9c7ddd5ab9f586ca6a7e61233d5efaedf7af8cbdf7967b1fdfa4bae795fa30eedf4ece439c5234fdc523cd558e76bf24c0ebe6d2fbbfe573acf5bfdcfaf0cbefa1167ab9786505f6e4db12282f8a038936d95a1fb512bd39eaa7fb111bf2652377cb095e08e7bcd3eb5951ff8bd8f7ce97f1ddc6ddf9e3100f65df157f29397bcfd475af6b15fcbdcf455950faef61e1121044544a8bc923a415569a40e1f02a8e21554015574e6a635e2cb30fffef5f10b7ffd530f7c32df2d3f9f1100de74f3d5cf4dcdf077123bfa0941c507a10e1054f15e29aac09e8e65522a45a5749b86d21b0c01d5803186da2b8282083e28cdd4224090f61787d5c5affbc817be7c6a377cdd7500def2aa17fe64c6a18f9755d9abe3849258a883e055484c20286c8e3d958f5fdfca0411031a489de0ac90971e6785a0608cc108180111c5d9f4f1adf2e2d77cf48bfffb3baf7ed99bdaabd9d75f90dae2ca41b9fc9d2073dffad8e7fe74f27702c0eb6fbaf1f2a5f4db5f0fa1ec1565400c5435648920224c4b383df478aff81067da1a6865061183150f44005403ce1a5421c485803511046b40697cd7d8ce7d991dff1bb45c4a6c48820a5548cee661f903037ff9bd7ff2f94f0f9e5500de72cbbe7b8c0e7ea9ac95466a101423c2a961e0ec2806570783aac708a4ce90ba38c3edcc50d73588c187803371f69ba94181aa0e34530328650da913ac51ac8149a104153a0da1ac94c48198e663a52cff8bfff867dffef3a7f2d9ec2600d69a7d4660b16b67b32c3c71a66663e4292b286bc588e2acc11941647b8b188246d0b244986b1a1aa9214d2cd34a094149ac50d681a29aad000d84009517da0d432381e1d493570a08dee79726e1c89ffed39bafbef55903605a9b53751006d3c0a4504e6cd68c0a25af14453102a0586b9059f48a2046e2521489c487608ca19509bd56dcff75d85e0d8a0f4a50435ec1b4089c1d7ace8e021b6365942ba70635651dc88b3a6d9b13f7df78f3cff77fe0a4ed260057ec5fca08d39b6aafadbc544685527b09d6b9c21975424c7f4604e72c469434b191ec424089dbc6594b50f03e50d511a474e6a9b586c40a950f941e8a2a3ec645a0a8b6c18610226f8868b3c3a1e9df3c36f8d2330ec0770e9dfddbab2edb9f0c8ae4c834b41e1c27cfb9bbb4cbbfbb365757a9e43f2a1267d019c1398711c518217596080e2006110b048c1104c199084215e2aaf141f021eefdbc0c9475c0cf320ec4d5e26c7c4fa76140acffebc7c6f73f99cf6e370100f8f85f1cbcebdcb3c3005cf2f203afc1084602a93591d125e05c021a08c4341854499cc3071f3f3e63fc489c31bab2061f3c65ad4c4b9d650999cd36c0f6fb945ecbb035099026277f90bfbbca014f66d7bceec30631a9b106672dc92ccf1b14630dd61a8c18bc0ac62668880138137920102bc7b20a9495a7f681cac3c8b7bf5993e4ca76e0f1b711c11899116504b0d2e49b3fc8bf5ddd02ffb7fdf46b7e74e9b2e19ffc775f0c7e4644b14630c6628cd9c900eb932647361d0b1d83314a50b03b1922507b0585c233ab26859cf667bf7ec5276ee84cbef529abe55e6364cd4add30337e49acc41a02b02e3d3a6e5cfed6871f3d3c7a560178fdab9fdf6be58f7dae288a174fcab8efbdc67258101043ee1d8f6eb468cfafe95c56496603cec61510338601114a0f2707d048a0d6e478d93a70eb839fb97b78f4c813eb878e0f3e36ffdcdb3ea198e3364c178cc139139ad62585bae65f4d1b17bfe1b39ffbcb477e909fcf482f70fd1bef36d71fbfe7cf7d31f989711167156245a8c4aa10b1189b52772eaffee1ebde98fc8f3fbe8b3a1f61c4a321c4bdef953a28a706ca83c78417ecd7f1245dbbe58b5f39f8c0937d6ffb5f3e24d73cfaaebd597dba2bae218757de70f0f0fd3f5b3f95afcf08003ff78ad53bb51cdf55d630cc637d5f79217186666651353bdf6c6d42bb3b47594cf15501a1c6fb0a34327b592b473714044dfb17bde22f1ef8ee5356764fd7763d0bfccc6b9f7f9d991efe0d358257a5915a820a69221851c6d39a34892db0b306b186c97003d42362f0413126c18780570f1258ec2841556868b6dbfeee7a16e816477f4f5513626627b6f801434d5e7a2a1fd81cd5a882eaace5554f5d1580620c785fa3aa310ba8a1f00218b2f2cc5b76dbdf5d05e00db75e73b984fa650ae4b3b465c483c6a6c81940155bd74c4625c1eb391000f525d64406170255eda97dfcac220495175fffd6bb77d5e75d1dac596dfcb4aa42f084a031df8b600c80b2d416ae48a71c68d42c9902198e29f32acef62ced897a14f02a4ccb80ce54226b04138aa54b1ffcd04b77d3e7dd453314571bd159f102a98d85486a63cfdfd182d40a4e3ccdc4d04994b4c8990c4b1e598f6c3f9c54f8a06c4d02aa82b5dbdd9f8f636afe925df5793707c3d8c7ea10ff744e081a4bd5c4496475e370043227a446c92cb49dd2d382665d309c7a4e8c931387cfea5835d6f32282c8ac6b4421544fd9de3e6d977773b0e0ebc3d648accf7d9c419148878aa1c002b1b77746492ca4466958e5caf9c062c730d1ec84f8a21d9b23c588c1c4fd11e5310d7fef675f79c9dc6ef9bcab00884b0f8928551d7b51632075c416d808a5c2148735e044e376304a6294d4415a1658d1534600f55863081a76401081da87aee6c39b76cbe75da9033ef4d9076df2e8fffcc7270f7de386c7bff691a8e90133511791a8f806a06834709309891154888dbb0183d04b02890f9b6656396af0883118892df0763641c32dc02777c3f75d5901d36f7ee683a74e1efd58eeb39fb7d6c64626446d4e35aabd319d811acb28c928c36c6510653223b1914d9cfdb48a9d465123be26b0a31d0455ace8aef1c07903f0dbeffbc09badfab7a92afdfe322eed466142228125169c8d84b6adf1db66c2a66930aa842a282140e9e174e530d5f81d187b687bf5a0bab39d42887259f07edf1b5eb1ffeaf38e9ef3dc02ef79d7bb6edc3873e2f743803449d91a6c61b279c27083cc19ac11bc0f33198cb825664d4ea39352fa94ad418e0f4a298ecd3aa0d4d73a0b38d98e9da081cc19f22a3649828af5f92b8087ce17801f7a05bce38e77bed4c0674208aed7ede2aca1d968d0ec2c90d8487a551d83df113c2596bfa58f4d8e8a2169a768236558098138e121c45e49663d9370ae8df6b36335adca1bce37f81f1a803bde7efbb5ad24f96fe3f1b095b884c9648c9d05ea3a179126861094562a339d8f9d931dd5a8f6d45ec9abc0d971e0f8869f49e6329bf1f83d02d441b7671d13e5012a1f70465f7edbcfbdfed907e0f65ffca555217c3e4bd37e963666c205e465c9783261e4db68ba883150f918849d9157981d7a96b552d6ca6012256d9911e0395d8f9d03522351de0270263e4fe3c9517feec4d7ae7dd60108c1dfee5cb69ae7138ab2e6c8b1e3e4458100455545d576fe45547462c0c440343093b2a398b9358d87a4db41cbecdc60fb11c2b6bcb90d440400d85925aedcbafc5905e09ef7fff62f589bbe294d125485f17884b506671de3e9145fd75455854d5b5a79cfd62430ce95e1d433cc637dbf310a8c8a10f7768c3c3a22e7023533ae80738a4d98c969d628dbe5b6f8eac7ce1780ffef2cf0efdef3dedf6c27e91df37373ac9f3a41236be01287d2a4aa3dce6594554996660c07eb62fc242ab23e9ee4c06cffdb188c11a1d436c80423752436b6f5c0a804ebf60a22cebe88ec748eb136e0b9cf0a00effed53bef9450dd31186cb1b1718a6ebbcbe98d332c2fae70727892b2289829f45296158978828184a80128f13204c4d4b6adc42a2d346b63fd8918b8156a7f8e0bb69b29d55835eaac2d0e211645b5ca330bc03b6e7ffb7556c3bdd3c9e486d3a7cfb0d85fa4d96891650de6e77ab49a6d3aed0ebeae08c14b5955a46946b1758ad40a38282afdbe31839e3b13748d259d4e6ad1fa7824d36d069cad101ff89e0c22e73861f6c31a73dee5f09302f02b77de79739d8fdfd46b37ffd174324df3b2a2d3ee00b0bcbc97f17844bbd5e5ccc63a2230994ee8b43b8ca793a8eb6149b789cac6a0b6f7b89fe5f980219839b1694928529ca90076183fd6038acf3da1e930b30c202849f010ccc70ad37cc7ae0270fbedb7efabf3f11732d12b3b73f33cfce8412e5a5b63aedd623ccdc91a2d4288faddcad20a4539a5ae6b82af3976e21849e2c89294b2cc69cc8291593ad36db20302504997c97412753fd346d84424d608019d919f5095e04605cd464a926434e75769ae5d477bedcabb7ef5ddef7d4ac9fb6903d06f37ff79d2ceae440c93e9984b0e5cc6daf222478e3e41236b31cdc784e079e4f0e33cf8f0432ccecf6310ba9d391acd26c3d19866b38d1f8c63ddbe53d844e2f2dfb31b4c368fad9d66492a65d945fc6694cfac5287197728d074d438cce21a8b57bd8aa04ab3d1c057e51b81dbcf17809d34f86fdf79c77e138a7f65ad90b88403fbaf60756989c3471ec7b894e9748c88a12c26ec5b5de1a2d535e63a7338e7989fefd16db559595ac1b804a7d338b8d9beda223b854eacef053119cd46432aef83a4fd59ff14492eb1f1bd8985a6513ae2d1d180808de78465c9703c7aedf906ff7d002ccd757f2b4db25e23cbf0be646b739dc3471ec52bf8bac487c0bebd9750d615ad669bb5e535ac312c2fafa22aecd9b3ccdcdc7c24c5640f003ee8cee94e08e74a5c004f82af2bca323773f34b12481155a86b92aac24e0bccd463dd326ee5456497df8215e8b6bbb45a1dacc8fedd0060e76cf0a61b6ff88daa2c977d883738469309e3f198e1704a9aa4382b4c260312e768341ad441e9f71729cb9c4eab4350613c1e321a0f50d7a3181e4542be13f476190c50983eda3c8088d06c34190eb790e63ea653d5dacc8be95d4ee85f45e85f4977ef9574f6ecc5584bd05801f9bac63ae35f78fd0bfee82b5ffdfad6f900b0b3021a493699eff6485d8aaf3da973d4c1d3ed7628aa82da7beaaaa4d5ee6004aa7c4cb7dd62aed363301a90a68ea2cc198dc64ca663dafb6f82e6a554b5a1ac95e0959a26637719dabd16eb2ccd761711a1ddead0ebcdb3ffea174b67ef35e4b6cb99c198aa2aa9eb9abacc71d68106da8d26755d93e765a3d99e5b3d9fe0e17b56c08ffff88f0527e1b6aa2e99e6535acd0e8a50e453ba733d16e617d81c6c505405894b11312c2eac103490a6295555b16ff5224e9f3941bbd5a637bf4cd6bb18e95ec1c9a1a3cc0e60e7af266b2d689236a4d96820409a25582334d226ad76076b0ddd6e97d5854582065acd16ed76170d817eafcf649a93650daabafee5dffae03d9fd83500aebff195df6ee1ff497f7e61cf643a66fdec2996165768365bcccfcdb37eea1869d6249f8ce9f7faacadac8108599a9126c9ec5647acf6faf30bece92fd09fdf83b10eeb1cad5687b2aab5dd4c64b1d7a5ae6bc43a8c111a59834060ffde031c5f3f810fb1436c351b24899bd50e1e631d18a92679f1e6f7dffba13f38dfe0bf0f802f7fe9f3e1ee5f7f5f7773b071d3e66093229f329e8cc98b8276b3c1743261cf9e65aad919dec507aee0c4fa31d64faf73ece4517a733d9c31648d260ffeed5f53e423ce9e5da72c26f4e6e640a0dd6eab4b5239be7e8a7633e3ece6064684acd1e4c8b1a32cee59c05a4b963a504f508f7316f59eb96e171feae1349fbcf683f7fde1ae08a2df0700c0ab6ebd75b27976fd2d0bfd65f27cca427f916bae7c1ef97442abd9e2d4a963b45a2d5acd0e478e1da6d168b17efa180bfd45bef2d507c0087931a6dbee70f8e8218e9f381aeb8050b3391830994e25491cc65af2b2644fbf4fb3d5c60a9465c9f2d20a7be61798e6633687035a598356b3459666283c80753ff5817bffe02f772b787892fb01bff6af7ff958234dd63add1ee574843196c17848963631c690a50d7a737b489c63341e53d51eef2b4e9e3e41236b322d7236b6061c3ffe04fb5656b8feaaabf89b83079159b7381a4f585a5ca1aa72ca624a6f7e81507bac8bc01c3cf8104559f0bc6b9f5f9f3d73fc8bed56fbcf3686a34fdfffd18f7f773703dfb6ffa717e8f457df3fda3cf55e379d34961656f0de3337b787cde1805eb787b50921047abd3de44541b73bcf7832e01f5cff12f27ccae6600bf430a2957632270f3df6300bfd792695d26874b0ceea249f905a91b96e8fe170405595ac2cef656df50004add74f9fb8ffece6e9f77ce19b071f7bf45bdf7826e2deb127bd2172dfefdcf3bca3871f7ff7457bf7dfec8c7436079ba449c6818b2ee589a387a8eb8256abc36038c058c3e1238731c6b2b6b2c66432a1dd9a636b70868db3a759585c6530dca4d9ecd26a77180cce801826c301fdfe0283c1164962e9efd95bf77a8b7f24c6dcf5b6db7f61d7ff31e26901b06d7ff8fb1fce2ed9bfffd55ffbea03cf5d595c34a7cf9c90d5a5bd4c2723716966b7865ba3b31b1b997a7f5bf0f5dfaf8332df9da333b7c064b48907e6fb0b6c6e9c654f7f0541387aec112aef91a04ccb92f94e6778fcd4c90f369aed0fdffbefffc3916729ee1ddbb53b426ffbc5b71eb86475ff6d755dfed4683878b9af0b332d4a2e3970194b0bab646993339b6778e2c8c3f8a0386b0e3b97ddf78d871efcdd4ffe97ff3add2d3f9eae3d2397a4defce67fb6908fa72fbaeedaebaebbf4e22bae3ff2c4a1ebfabdfe73368783ada3c79f78a43fdfbfefa1470efef17ffac847cfbb9dbd6017ec825db00b76c12ed805bb6017ec87b3ff030b93d4562350d1a70000000049454e44ae426082</data> + </image> +</images> +<connections> + <connection> + <sender>pushButton1</sender> + <signal>clicked()</signal> + <receiver>InfoDialog</receiver> + <slot>close()</slot> + </connection> +</connections> +<slots> + <slot>kURLLabel1_leftURL()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurllabel.h</includehint> +</includehints> +</UI> diff --git a/client/crystal.desktop b/client/crystal.desktop new file mode 100644 index 0000000..167e51f --- /dev/null +++ b/client/crystal.desktop @@ -0,0 +1,5 @@ +# KDE Desktop Entry +[Desktop Entry] +Encoding=UTF-8 +Name=Crystal +X-KDE-Library=kwin3_crystal diff --git a/client/crystalbutton.cpp b/client/crystalbutton.cpp new file mode 100644 index 0000000..8566e41 --- /dev/null +++ b/client/crystalbutton.cpp @@ -0,0 +1,337 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 <qimage.h> +#include <qtooltip.h> +#include <qpainter.h> + +#include "crystalclient.h" +#include "crystalbutton.h" +#include "buttonimage.h" +#include "imageholder.h" + + +CrystalButton::CrystalButton(CrystalClient *parent, const char *name, + const QString& tip, ButtonType type, + ButtonImage *vimage) +: QButton(parent->widget(), name), client_(parent), type_(type), image(vimage), lastmouse_(0) +{ + setBackgroundMode(NoBackground); + resetSize(false); + setCursor(arrowCursor); + + hover=first=last=false; + animation=0.0; + QToolTip::add(this, tip); + connect ( &animation_timer,SIGNAL(timeout()),this,SLOT(animate())); +} + +CrystalButton::~CrystalButton() +{ +} + +void CrystalButton::resetSize(bool FullSize) +{ + if (FullSize || (image && image->drawMode==1)) + { + setFixedSize(buttonSizeH(),factory->titlesize); + }else setFixedSize(buttonSizeH(),buttonSizeV()); +} + +void CrystalButton::setBitmap(ButtonImage *newimage) +{ + image=newimage; + repaint(false); +} + +QSize CrystalButton::sizeHint() const +{ + return QSize(buttonSizeH(),buttonSizeV()); +} + +int CrystalButton::buttonSizeH() const +{ + int w=image?image->image_width:DEFAULT_IMAGE_SIZE; + int h=image?image->image_height:DEFAULT_IMAGE_SIZE; + int vS=image?image->vSpace:2; + int hS=image?image->hSpace:2; + return (factory->titlesize-1-vS>=h)? + w+hS*2: + (int)(((float)buttonSizeV()/(float)h)*(float)w)+hS; +} + +int CrystalButton::buttonSizeV() const +{ + int h=image?image->image_height:DEFAULT_IMAGE_SIZE; + int vS=image?image->vSpace:2; + return (factory->titlesize-1-vS>h)?h:factory->titlesize-1-vS; +} + +void CrystalButton::enterEvent(QEvent *e) +{ + hover=true; + if (factory->hovereffect)repaint(false); + if (factory->animateHover)animation_timer.start(60); + QButton::enterEvent(e); +} + +void CrystalButton::leaveEvent(QEvent *e) +{ + hover=false; + if (factory->hovereffect)repaint(false); + if (factory->animateHover)animation_timer.start(80); + QButton::leaveEvent(e); +} + +void CrystalButton::mousePressEvent(QMouseEvent* e) +{ + lastmouse_ = e->button(); + int button; + switch(e->button()) + { + case LeftButton: + button=LeftButton; + break; + case RightButton: + if ((type_ == ButtonMax) || (type_ == ButtonMin) || (type_ == ButtonMenu) || (type_ == ButtonClose)) + button=LeftButton; else button=NoButton; + break; + case MidButton: + if ((type_ == ButtonMax) || (type_ == ButtonMin)) + button=LeftButton; else button=NoButton; + break; + + default:button=NoButton; + break; + } + QMouseEvent me(e->type(), e->pos(), e->globalPos(),button, e->state()); + QButton::mousePressEvent(&me); +} + +void CrystalButton::mouseReleaseEvent(QMouseEvent* e) +{ + lastmouse_ = e->button(); + int button; + switch(e->button()) + { + case LeftButton: + button=LeftButton; + break; + case RightButton: + if ((type_ == ButtonMax) || (type_ == ButtonMin) || (type_ == ButtonMenu) || (type_==ButtonClose)) + button=LeftButton; else button=NoButton; + break; + case MidButton: + if ((type_ == ButtonMax) || (type_ == ButtonMin)) + button=LeftButton; else button=NoButton; + break; + + default:button=NoButton; + break; + } + QMouseEvent me(e->type(), e->pos(), e->globalPos(), button, e->state()); + QButton::mouseReleaseEvent(&me); +} + +void CrystalButton::drawButton(QPainter *painter) +{ + if (!CrystalFactory::initialized()) return; + + QColorGroup group; + float dx, dy; + int dm=0; + + QPixmap pufferPixmap; + pufferPixmap.resize(width(), height()); + QPainter pufferPainter(&pufferPixmap); + + CrystalFactory *f=((CrystalFactory*)client_->factory()); + QPixmap *background; + if (f->transparency)background=f->image_holder->image(client_->isActive()); + else background=NULL; + WND_CONFIG *wndcfg=client_->isActive()?&f->active:&f->inactive; + + if (background && !background->isNull()) + { + QRect r=rect(); + QPoint p=mapToGlobal(QPoint(0,0)); + r.moveBy(p.x(),p.y()); + + pufferPainter.drawPixmap(QPoint(0,0),*background,r); + }else{ + group = client_->options()->colorGroup(KDecoration::ColorTitleBar, client_->isActive()); + pufferPainter.fillRect(rect(), group.background()); + } + + if (!wndcfg->overlay.isNull()) + { + pufferPainter.drawTiledPixmap(rect(),wndcfg->overlay,QPoint(x(),y())); + } + + dm=0; + if (image && (image->drawMode==1))dm=1; + if (wndcfg->outlineMode) + { + // outline the frame + pufferPainter.setPen(wndcfg->frameColor); + + if (wndcfg->outlineMode==2)pufferPainter.setPen(wndcfg->frameColor.dark(150)); + if (wndcfg->outlineMode==3)pufferPainter.setPen(wndcfg->frameColor.light(150)); + // top + if ((client_->FullMax && client_->isShade() && (dm==0)) || + ((dm==1)&&(!client_->FullMax || client_->isShade()))) pufferPainter.drawLine(0,0,width(),0); + // left + if (first && client_->FullMax && client_->isShade())pufferPainter.drawLine(0,0,0,height()); + + if (wndcfg->outlineMode==2)pufferPainter.setPen(wndcfg->frameColor.light(150)); + if (wndcfg->outlineMode==3)pufferPainter.setPen(wndcfg->frameColor.dark(150)); + // bottom + if (client_->isShade() && ((dm==1)||(client_->FullMax)))pufferPainter.drawLine(0,height()-1,width(),height()-1); + + // right + if (last && client_->FullMax && client_->isShade())pufferPainter.drawLine(width()-1,0,width()-1,height()); + } + if (wndcfg->inlineMode && (client_->FullMax||dm==1) && !client_->isShade()) + { + // inline the frame + if (wndcfg->inlineMode==1)pufferPainter.setPen(wndcfg->inlineColor); + if (wndcfg->inlineMode==2)pufferPainter.setPen(wndcfg->inlineColor.dark(150)); + if (wndcfg->inlineMode==3)pufferPainter.setPen(wndcfg->inlineColor.light(150)); + // buttons just need to draw the bottom line + pufferPainter.drawLine(0,height()-1,width(),height()-1); + } + + + if (type_ == ButtonMenu && (!::factory->menuImage || image==NULL || (image!=NULL && !image->initialized()))) { + // we paint the mini icon (which is 16 pixels high) + dx = float(width() - 16) / 2.0; + dy = float(height() - 16) / 2.0; + + if (dx<1 || dy<=1) + { + int m=(rect().width()-2<rect().height())?rect().width()-2:rect().height(); + QRect r((rect().width()-m)/2,(rect().height()-m)/2,m,m); +// if (isDown()) { r.moveBy(1,1); } + pufferPainter.drawPixmap(r, client_->icon().pixmap(QIconSet::Small, + QIconSet::Normal)); + }else{ +// if (isDown()) { dx++; dy++; } + pufferPainter.drawPixmap((int)dx, (int)dy, client_->icon().pixmap(QIconSet::Small, + QIconSet::Normal)); + } + } else if (image && image->initialized()) { + // otherwise we paint the deco + dx = float(width() - image->image_width) / 2.0; + dy = float(height() - image->image_height) / 2.0; + + QImage *img=image->normal; + + if (::factory->hovereffect) + { + if (hover) + { + img=image->hovered; + } + if (::factory->animateHover) + { + img=image->getAnimated(animation); + } + } + if (isDown()) + { + img=image->pressed; + } + + if (img) + if (dx<image->hSpace/2 || dy<0) + { // Deco size is smaller than image, we need to stretch it + int w,h; + + if (rect().width()-image->hSpace<rect().height()) + { + w=rect().width()-image->hSpace; + h=(int)((float)w*(float)image->image_height/(float)image->image_width); + }else{ + h=rect().height(); + w=(int)((float)h*(float)image->image_width/(float)image->image_height); + } + + QRect r((rect().width()-w)/2,(rect().height()-h)/2,w,h); + + pufferPainter.drawImage(r,*img); + if (type_ == ButtonMenu) drawMenuImage(&pufferPainter, r); + }else{ + // Otherwise we just paint it + if (image->drawMode==1)dy=0; + pufferPainter.drawImage(QPoint((int)dx,(int)dy),*img); + + if (type_ == ButtonMenu) drawMenuImage(&pufferPainter, + QRect((int)dx,(int)dy,image->image_width,image->image_height)); + } + } + + pufferPainter.end(); + painter->drawPixmap(0,0, pufferPixmap); +} + +void CrystalButton::drawMenuImage(QPainter* painter, QRect r) +{ + if (type_ != ButtonMenu) return; + // we paint the mini icon (which is 16 pixels high) + r.setTop(r.top()+1); + r.setBottom(r.bottom()-1); + float dx = float(r.width() - 16) / 2.0; + float dy = float(r.height() - 16) / 2.0; + + if (dx<1 || dy<=1) + { + int m=(r.width()-2<r.height())?r.width()-2:r.height(); + QRect r2(r.left()+(r.width()-m)/2,r.top()+(r.height()-m)/2,m,m); + painter->drawPixmap(r2, client_->icon().pixmap(QIconSet::Small, + QIconSet::Normal)); + }else{ + painter->drawPixmap(r.left()+(int)dx, r.top()+(int)dy, client_->icon().pixmap(QIconSet::Small, + QIconSet::Normal)); + } +} + +void CrystalButton::animate() +{ + if (hover) + { + animation+=0.25; + if (animation>1.0) + { + animation=1.0; + animation_timer.stop(); + } + }else{ + animation-=0.15; + if (animation<0.0) + { + animation=0.0; + animation_timer.stop(); + } + } + repaint(false); +} + +#include "crystalbutton.moc" diff --git a/client/crystalbutton.h b/client/crystalbutton.h new file mode 100644 index 0000000..c1f55c5 --- /dev/null +++ b/client/crystalbutton.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 _CRYSTALBUTTON_INCLUDED_ +#define _CRYSTALBUTTON_INCLUDED_ + +#include <qbutton.h> + +class CrystalClient; +class ButtonImage; + +class CrystalButton : public QButton +{ + Q_OBJECT + +public: + CrystalButton(CrystalClient *parent=0, const char *name=0, + const QString &tip=NULL, + ButtonType type=ButtonHelp, + ButtonImage *vimage=NULL); + virtual ~CrystalButton(); + + void setBitmap(ButtonImage *newimage); + QSize sizeHint() const; + int lastMousePress() const { return lastmouse_; } + void reset() { repaint(false); } + void setFirstLast(bool vfirst,bool vlast) { first|=vfirst; last|=vlast; } + void resetSize(bool FullSize); +private: + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void drawButton(QPainter *painter); + void drawMenuImage(QPainter *painter, QRect r); + + int buttonSizeH() const; + int buttonSizeV() const; + +private slots: + void animate(); + +private: + QTimer animation_timer; + bool first,last; + bool hover; + float animation; + CrystalClient *client_; + ButtonType type_; + ButtonImage *image; + int lastmouse_; +}; + +#endif diff --git a/client/crystalclient.cc b/client/crystalclient.cc new file mode 100644 index 0000000..5e8e533 --- /dev/null +++ b/client/crystalclient.cc @@ -0,0 +1,1643 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 <kconfig.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <kdebug.h> + +#include <qbitmap.h> +#include <qlabel.h> +#include <qpainter.h> +#include <qtooltip.h> +#include <qapplication.h> +#include <qimage.h> +#include <qpopupmenu.h> +#include <kwin.h> +#include <kprocess.h> + +#include "crystalclient.h" +#include "crystalbutton.h" +#include "buttonimage.h" +#include "imageholder.h" +#include "overlays.h" + +// Button themes +#include "tiles.h" + + +CrystalFactory* factory=NULL; + +bool CrystalFactory::initialized_ = false; +Qt::AlignmentFlags CrystalFactory::titlealign_ = Qt::AlignHCenter; + + +extern "C" KDecorationFactory* create_factory() +{ + return new CrystalFactory(); +} + + +/***************** + * Tooltip class for the titlebar + **/ +class CCrystalTooltip:public QToolTip +{ +private: + CrystalClient *client; +public: + CCrystalTooltip(QWidget *widget,CrystalClient *vc):QToolTip(widget),client(vc) {} + virtual void maybeTip(const QPoint& p) + { + if (client->titlebar_->geometry().contains(p)) + { + tip(client->titlebar_->geometry(),client->caption()); + } + } +}; + + + + +CrystalFactory::CrystalFactory() +{ + for (int i=0;i<ButtonImageCount;i++) + buttonImages[i]=NULL; + + ::factory=this; + readConfig(); + initialized_ = true; + + if (transparency)image_holder=new QImageHolder(active.userdefinedPicture,inactive.userdefinedPicture); + else image_holder=NULL; + CreateButtonImages(); +} + +CrystalFactory::~CrystalFactory() +{ + initialized_ = false; + ::factory=NULL; + if (image_holder)delete image_holder; + for (int i=0;i<ButtonImageCount;i++) + { + if (buttonImages[i])delete buttonImages[i]; + buttonImages[i]=NULL; + } +} + +KDecoration* CrystalFactory::createDecoration(KDecorationBridge* b) +{ + return new CrystalClient(b,factory ); +} + +bool CrystalFactory::reset(unsigned long /*changed*/) +{ + initialized_ = false; + readConfig(); + initialized_ = true; + + if (transparency) + { + if (!image_holder)image_holder=new QImageHolder(active.userdefinedPicture,inactive.userdefinedPicture); + image_holder->setUserdefinedPictures(active.userdefinedPicture,inactive.userdefinedPicture); + image_holder->repaint(true); + }else{ + if (image_holder)delete image_holder; + image_holder=NULL; + } + CreateButtonImages(); + + return true; +} + +bool CrystalFactory::supports(Ability ability) +{ + switch (ability) + { +#if KDE_IS_VERSION(3,4,0) + case AbilityButtonResize: return false; +#endif + default: + return true; + } +} + +void setupOverlay(WND_CONFIG *cfg,int mode,QString filename) +{ + cfg->overlay.resize(0,0); + switch(mode) + { + case 0: break; + case 1:{ + cfg->overlay.resize(0,0); + QImage img=QImage((uchar*)lighting_overlay_data,1,60,32,NULL,0,QImage::LittleEndian); + img.setAlphaBuffer(true); + cfg->overlay.convertFromImage(img.smoothScale(256,::factory->titlesize)); + break; + } + case 2:{ + cfg->overlay.resize(0,0); + QImage img=QImage((uchar*)glass_overlay_data,20,64,32,NULL,0,QImage::LittleEndian); + img.setAlphaBuffer(true); + cfg->overlay.convertFromImage(img.smoothScale(256,::factory->titlesize)); + break; + } + case 3:{ + cfg->overlay.resize(0,0); + QImage img=QImage((uchar*)steel_overlay_data,28,64,32,NULL,0,QImage::LittleEndian); + img.setAlphaBuffer(true); + cfg->overlay.convertFromImage(img.smoothScale(256,::factory->titlesize)); + break; + } + case 4:{ + QImage img; + if (img.load(filename)) + { + img.setAlphaBuffer(true); + cfg->overlay.convertFromImage(img.smoothScale(256,::factory->titlesize)); + } + break; + } + } +} + +bool CrystalFactory::readConfig() +{ + // create a config object + KConfig config("kwincrystalrc"); + config.setGroup("General"); + QColor c; + + QString value = config.readEntry("TitleAlignment", "AlignHCenter"); + if (value == "AlignLeft") titlealign_ = Qt::AlignLeft; + else if (value == "AlignHCenter") titlealign_ = Qt::AlignHCenter; + else if (value == "AlignRight") titlealign_ = Qt::AlignRight; + + drawcaption=(bool)config.readBoolEntry("DrawCaption",true); + textshadow=(bool)config.readBoolEntry("TextShadow",true); + captiontooltip=(bool)config.readBoolEntry("CaptionTooltip",true); + wheelTask=(bool)config.readBoolEntry("WheelTask",false); + transparency=(bool)config.readBoolEntry("EnableTransparency",true); + trackdesktop=(bool)config.readBoolEntry("TrackDesktop",false); + + active.mode=config.readNumEntry("ActiveMode",0); + inactive.mode=config.readNumEntry("InactiveMode",1); + active.amount=(double)config.readNumEntry("ActiveShade",30)/100.0; + inactive.amount=(double)config.readNumEntry("InactiveShade",-30)/100.0; + active.outlineMode=(int)config.readNumEntry("ActiveFrame",1); + inactive.outlineMode=(int)config.readNumEntry("InactiveFrame",1); + c=QColor(160,160,160); + active.frameColor=config.readColorEntry("FrameColor1",&c); + c=QColor(128,128,128); + inactive.frameColor=config.readColorEntry("FrameColor2",&c); + + active.inlineMode=(int)config.readNumEntry("ActiveInline",0); + inactive.inlineMode=(int)config.readNumEntry("InactiveInline",0); + c=QColor(160,160,160); + active.inlineColor=config.readColorEntry("InlineColor1",&c); + c=QColor(160,160,160); + inactive.inlineColor=config.readColorEntry("InlineColor2",&c); + + active.blur=config.readNumEntry("ActiveBlur",0); + inactive.blur=config.readNumEntry("InactiveBlur",0); + + active.userdefinedPicture=QImage(); + inactive.userdefinedPicture=QImage(); + if ((bool)config.readBoolEntry("ActiveUserdefined",false)) + { + active.userdefinedPicture.load(config.readEntry("ActiveUserdefinedPicture")); + } + if ((bool)config.readBoolEntry("InactiveUserdefined",false)) + { + inactive.userdefinedPicture.load(config.readEntry("InactiveUserdefinedPicture")); + } + + borderwidth=config.readNumEntry("Borderwidth",5); + titlesize=config.readNumEntry("Titlebarheight",21); + + buttonColor_normal=QColor(255,255,255); + buttonColor_normal=config.readColorEntry("ButtonColor",&buttonColor_normal); + buttonColor_hovered=config.readColorEntry("ButtonColor2",&buttonColor_normal); + buttonColor_pressed=config.readColorEntry("ButtonColor3",&buttonColor_normal); + minColor_normal=QColor(255,255,255); + minColor_normal=config.readColorEntry("MinColor",&buttonColor_normal); + minColor_hovered=config.readColorEntry("MinColor2",&buttonColor_normal); + minColor_pressed=config.readColorEntry("MinColor3",&buttonColor_normal); + maxColor_normal=QColor(255,255,255); + maxColor_normal=config.readColorEntry("MaxColor",&buttonColor_normal); + maxColor_hovered=config.readColorEntry("MaxColor2",&buttonColor_normal); + maxColor_pressed=config.readColorEntry("MaxColor3",&buttonColor_normal); + closeColor_normal=QColor(255,255,255); + closeColor_normal=config.readColorEntry("CloseColor",&closeColor_normal); + closeColor_hovered=config.readColorEntry("CloseColor2",&closeColor_normal); + closeColor_pressed=config.readColorEntry("CloseColor3",&closeColor_normal); + + roundCorners=config.readNumEntry("RoundCorners",TOP_LEFT & TOP_RIGHT); + + hovereffect=config.readBoolEntry("HoverEffect",true); + animateHover=config.readBoolEntry("AnimateHover",true); + tintButtons=config.readBoolEntry("TintButtons",false); + menuImage=config.readBoolEntry("MenuImage",true); + repaintMode=config.readNumEntry("RepaintMode",1); + repaintTime=config.readNumEntry("RepaintTime",200); + buttontheme=config.readNumEntry("ButtonTheme",8); + + + setupOverlay(&active,config.readNumEntry("OverlayModeActive",0),config.readEntry("OverlayFileActive","")); + setupOverlay(&inactive,config.readNumEntry("OverlayModeInactive",0),config.readEntry("OverlayFileInactive","")); + + logoEnabled=config.readNumEntry("LogoAlignment",1); + logoStretch=config.readNumEntry("LogoStretch",0); + logoActive=config.readBoolEntry("LogoActive",0); + logoDistance=config.readNumEntry("LogoDistance",0); + QString filename=config.readEntry("LogoFile",""); + if (!filename.isNull() && logoEnabled!=1) + { + if (logo.load(filename)) + { + if (logoStretch==0) + { + logo=logo.convertToImage().smoothScale((titlesize*logo.width())/logo.height(),titlesize); + } + }else logoEnabled=1; + }else logo.resize(0,0); + return true; +} + +void CrystalFactory::CreateButtonImages() +{ + for (int i=0;i<ButtonImageCount;i++) + { + if (buttonImages[i])buttonImages[i]->reset(); else + buttonImages[i]=new ButtonImage; + if (!tintButtons)buttonImages[i]->setColors(Qt::white,Qt::white,Qt::white); + else switch(i) + { + case ButtonImageMin: + buttonImages[i]->setColors(minColor_normal,minColor_hovered,minColor_pressed); + break; + case ButtonImageMax: + buttonImages[i]->setColors(maxColor_normal,maxColor_hovered,maxColor_pressed); + break; + case ButtonImageClose: + buttonImages[i]->setColors(closeColor_normal,closeColor_hovered,closeColor_pressed); + break; + + default: + buttonImages[i]->setColors(buttonColor_normal,buttonColor_hovered,buttonColor_pressed); + break; + } + } + + switch(buttontheme) + { + default: + case 0: // Crystal default + buttonImages[ButtonImageMenu]->SetNormal(crystal_menu_data); + buttonImages[ButtonImageHelp]->SetNormal(crystal_help_data); + buttonImages[ButtonImageMax]->SetNormal(crystal_max_data); + buttonImages[ButtonImageRestore]->SetNormal(crystal_restore_data); + buttonImages[ButtonImageMin]->SetNormal(crystal_min_data); + buttonImages[ButtonImageClose]->SetNormal(crystal_close_data); + buttonImages[ButtonImageSticky]->SetNormal(crystal_sticky_data); + buttonImages[ButtonImageUnSticky]->SetNormal(crystal_un_sticky_data); + buttonImages[ButtonImageShade]->SetNormal(crystal_shade_data); + buttonImages[ButtonImageUnShade]->SetNormal(crystal_shade_data); + + buttonImages[ButtonImageAbove]->SetNormal(crystal_above_data); + buttonImages[ButtonImageUnAbove]->SetNormal(crystal_unabove_data); + buttonImages[ButtonImageBelow]->SetNormal(crystal_below_data); + buttonImages[ButtonImageUnBelow]->SetNormal(crystal_unbelow_data); + break; + case 1: // Aqua buttons + buttonImages[ButtonImageMenu]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageHelp]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageMax]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageRestore]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageMin]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageClose]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageSticky]->SetNormal(aqua_sticky_data,16,16); + buttonImages[ButtonImageUnSticky]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageShade]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageUnShade]->SetNormal(aqua_default_data,16,16); + + buttonImages[ButtonImageAbove]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageUnAbove]->SetNormal(aqua_above_data,16,16); + buttonImages[ButtonImageBelow]->SetNormal(aqua_default_data,16,16); + buttonImages[ButtonImageUnBelow]->SetNormal(aqua_below_data,16,16); + + buttonImages[ButtonImageClose]->SetHovered(aqua_close_data); + buttonImages[ButtonImageMax]->SetHovered(aqua_max_data); + buttonImages[ButtonImageMin]->SetHovered(aqua_min_data); + buttonImages[ButtonImageRestore]->SetHovered(aqua_max_data); + buttonImages[ButtonImageUnSticky]->SetHovered(aqua_un_sticky_data); + buttonImages[ButtonImageHelp]->SetHovered(aqua_help_data); + buttonImages[ButtonImageAbove]->SetHovered(aqua_above_data); + buttonImages[ButtonImageBelow]->SetHovered(aqua_below_data); + buttonImages[ButtonImageShade]->SetHovered(aqua_shade_data); + buttonImages[ButtonImageUnShade]->SetHovered(aqua_shade_data); + break; + case 2: // Knifty buttons + buttonImages[ButtonImageHelp]->SetNormal(knifty_help_data); + buttonImages[ButtonImageMax]->SetNormal(knifty_max_data); + buttonImages[ButtonImageRestore]->SetNormal(knifty_restore_data); + buttonImages[ButtonImageMin]->SetNormal(knifty_min_data); + buttonImages[ButtonImageClose]->SetNormal(knifty_close_data); + buttonImages[ButtonImageSticky]->SetNormal(knifty_sticky_data); + buttonImages[ButtonImageUnSticky]->SetNormal(knifty_un_sticky_data); + buttonImages[ButtonImageShade]->SetNormal(knifty_shade_data); + buttonImages[ButtonImageUnShade]->SetNormal(knifty_shade_data); + + buttonImages[ButtonImageAbove]->SetNormal(knifty_above_data); + buttonImages[ButtonImageUnAbove]->SetNormal(knifty_unabove_data); + buttonImages[ButtonImageBelow]->SetNormal(knifty_below_data); + buttonImages[ButtonImageUnBelow]->SetNormal(knifty_unbelow_data); + break; + + case 3: // Handpainted + buttonImages[ButtonImageHelp]->SetNormal(handpainted_help_data); + buttonImages[ButtonImageMax]->SetNormal(handpainted_max_data); + buttonImages[ButtonImageRestore]->SetNormal(handpainted_restore_data); + buttonImages[ButtonImageMin]->SetNormal(handpainted_min_data); + buttonImages[ButtonImageClose]->SetNormal(handpainted_close_data); + buttonImages[ButtonImageSticky]->SetNormal(handpainted_sticky_data); + buttonImages[ButtonImageUnSticky]->SetNormal(handpainted_un_sticky_data); + buttonImages[ButtonImageShade]->SetNormal(handpainted_shade_data); + buttonImages[ButtonImageUnShade]->SetNormal(handpainted_un_shade_data); + + buttonImages[ButtonImageAbove]->SetNormal(handpainted_above_data); + buttonImages[ButtonImageUnAbove]->SetNormal(handpainted_unabove_data); + buttonImages[ButtonImageBelow]->SetNormal(handpainted_below_data); + buttonImages[ButtonImageUnBelow]->SetNormal(handpainted_unbelow_data); + break; + case 4: // SVG + buttonImages[ButtonImageMenu]->SetNormal(svg_menu_data); + buttonImages[ButtonImageHelp]->SetNormal(svg_help_data); + buttonImages[ButtonImageMax]->SetNormal(svg_max_data); + buttonImages[ButtonImageRestore]->SetNormal(svg_restore_data); + buttonImages[ButtonImageMin]->SetNormal(svg_min_data); + buttonImages[ButtonImageClose]->SetNormal(svg_close_data); + buttonImages[ButtonImageSticky]->SetNormal(svg_sticky_data); + buttonImages[ButtonImageUnSticky]->SetNormal(svg_unsticky_data); + buttonImages[ButtonImageShade]->SetNormal(svg_shade_data); + buttonImages[ButtonImageUnShade]->SetNormal(svg_shade_data); + + buttonImages[ButtonImageAbove]->SetNormal(svg_above_data); + buttonImages[ButtonImageUnAbove]->SetNormal(svg_above_data); + buttonImages[ButtonImageBelow]->SetNormal(svg_below_data); + buttonImages[ButtonImageUnBelow]->SetNormal(svg_below_data); + break; + case 5: // Vista + buttonImages[ButtonImageMenu]->SetNormal(vista_menu_data,26,15); + buttonImages[ButtonImageMenu]->SetHovered(vista_menu_hovered_data); + buttonImages[ButtonImageMenu]->SetPressed(vista_menu_pressed_data); + + buttonImages[ButtonImageHelp]->SetNormal(vista_help_data,26,15); + buttonImages[ButtonImageHelp]->SetHovered(vista_help_hovered_data); + buttonImages[ButtonImageHelp]->SetPressed(vista_help_pressed_data); + + buttonImages[ButtonImageMax]->SetNormal(vista_max_data,27,15); + buttonImages[ButtonImageMax]->SetHovered(vista_max_hovered_data); + buttonImages[ButtonImageMax]->SetPressed(vista_max_pressed_data); + buttonImages[ButtonImageRestore]->SetNormal(vista_restore_data,27,15); + buttonImages[ButtonImageRestore]->SetHovered(vista_restore_hovered_data); + buttonImages[ButtonImageRestore]->SetPressed(vista_restore_pressed_data); + buttonImages[ButtonImageMin]->SetNormal(vista_min_data,26,15); + buttonImages[ButtonImageMin]->SetHovered(vista_min_hovered_data); + buttonImages[ButtonImageMin]->SetPressed(vista_min_pressed_data); + buttonImages[ButtonImageClose]->SetNormal(vista_close_data,40,15); + buttonImages[ButtonImageClose]->SetHovered(vista_close_hovered_data); + buttonImages[ButtonImageClose]->SetPressed(vista_close_pressed_data); + + buttonImages[ButtonImageSticky]->SetNormal(vista_sticky_data,26,15); + buttonImages[ButtonImageSticky]->SetHovered(vista_sticky_hovered_data); + buttonImages[ButtonImageSticky]->SetPressed(vista_sticky_pressed_data); + buttonImages[ButtonImageUnSticky]->SetNormal(vista_un_sticky_data,26,15); + buttonImages[ButtonImageUnSticky]->SetHovered(vista_un_sticky_hovered_data); + buttonImages[ButtonImageUnSticky]->SetPressed(vista_un_sticky_pressed_data); + + buttonImages[ButtonImageAbove]->SetNormal(vista_above_data,26,15); + buttonImages[ButtonImageAbove]->SetHovered(vista_above_hovered_data); + buttonImages[ButtonImageAbove]->SetPressed(vista_above_pressed_data); + buttonImages[ButtonImageUnAbove]->SetNormal(vista_un_above_data,26,15); + buttonImages[ButtonImageUnAbove]->SetHovered(vista_un_above_hovered_data); + buttonImages[ButtonImageUnAbove]->SetPressed(vista_un_above_pressed_data); + + buttonImages[ButtonImageBelow]->SetNormal(vista_below_data,26,15); + buttonImages[ButtonImageBelow]->SetHovered(vista_below_hovered_data); + buttonImages[ButtonImageBelow]->SetPressed(vista_below_pressed_data); + buttonImages[ButtonImageUnBelow]->SetNormal(vista_un_below_data,26,15); + buttonImages[ButtonImageUnBelow]->SetHovered(vista_un_below_hovered_data); + buttonImages[ButtonImageUnBelow]->SetPressed(vista_un_below_pressed_data); + + buttonImages[ButtonImageShade]->SetNormal(vista_shade_data,26,15); + buttonImages[ButtonImageShade]->SetHovered(vista_shade_hovered_data); + buttonImages[ButtonImageShade]->SetPressed(vista_shade_pressed_data); + buttonImages[ButtonImageUnShade]->SetNormal(vista_un_shade_data,26,15); + buttonImages[ButtonImageUnShade]->SetHovered(vista_un_shade_hovered_data); + buttonImages[ButtonImageUnShade]->SetPressed(vista_un_shade_pressed_data); + + for (int i=0;i<ButtonImageCount;i++) + { + buttonImages[i]->setSpace(1,0); + buttonImages[i]->setDrawMode(1); + } + buttonImages[ButtonImageMax]->setSpace(0,0); + buttonImages[ButtonImageRestore]->setSpace(0,0); + buttonImages[ButtonImageMin]->setSpace(0,0); + buttonImages[ButtonImageClose]->setSpace(0,0); + + break; + case 6: // Kubuntu Dapper + buttonImages[ButtonImageMenu]->SetNormal(dapper_menu_data,28,17); + buttonImages[ButtonImageMenu]->SetHovered(dapper_menu_hovered_data); + buttonImages[ButtonImageMenu]->SetPressed(dapper_menu_pressed_data); + + buttonImages[ButtonImageHelp]->SetNormal(dapper_help_data,28,17); + buttonImages[ButtonImageHelp]->SetHovered(dapper_help_hovered_data); + buttonImages[ButtonImageHelp]->SetPressed(dapper_help_pressed_data); + + buttonImages[ButtonImageMax]->SetNormal(dapper_max_data,28,17); + buttonImages[ButtonImageMax]->SetHovered(dapper_max_hovered_data); + buttonImages[ButtonImageMax]->SetPressed(dapper_max_pressed_data); + buttonImages[ButtonImageRestore]->SetNormal(dapper_restore_data,28,17); + buttonImages[ButtonImageRestore]->SetHovered(dapper_restore_hovered_data); + buttonImages[ButtonImageRestore]->SetPressed(dapper_restore_pressed_data); + buttonImages[ButtonImageMin]->SetNormal(dapper_min_data,28,17); + buttonImages[ButtonImageMin]->SetHovered(dapper_min_hovered_data); + buttonImages[ButtonImageMin]->SetPressed(dapper_min_pressed_data); + buttonImages[ButtonImageClose]->SetNormal(dapper_close_data,28,17); + buttonImages[ButtonImageClose]->SetHovered(dapper_close_hovered_data); + buttonImages[ButtonImageClose]->SetPressed(dapper_close_pressed_data); + + buttonImages[ButtonImageSticky]->SetNormal(dapper_sticky_data,28,17); + buttonImages[ButtonImageSticky]->SetHovered(dapper_sticky_hovered_data); + buttonImages[ButtonImageSticky]->SetPressed(dapper_sticky_pressed_data); + buttonImages[ButtonImageUnSticky]->SetNormal(dapper_un_sticky_data,28,17); + buttonImages[ButtonImageUnSticky]->SetHovered(dapper_un_sticky_hovered_data); + buttonImages[ButtonImageUnSticky]->SetPressed(dapper_un_sticky_pressed_data); + + buttonImages[ButtonImageAbove]->SetNormal(dapper_above_data,28,17); + buttonImages[ButtonImageAbove]->SetHovered(dapper_above_hovered_data); + buttonImages[ButtonImageAbove]->SetPressed(dapper_above_pressed_data); + buttonImages[ButtonImageUnAbove]->SetNormal(dapper_un_above_data,28,17); + buttonImages[ButtonImageUnAbove]->SetHovered(dapper_un_above_hovered_data); + buttonImages[ButtonImageUnAbove]->SetPressed(dapper_un_above_pressed_data); + + + buttonImages[ButtonImageBelow]->SetNormal(dapper_below_data,28,17); + buttonImages[ButtonImageBelow]->SetHovered(dapper_below_hovered_data); + buttonImages[ButtonImageBelow]->SetPressed(dapper_below_pressed_data); + + buttonImages[ButtonImageUnBelow]->SetNormal(dapper_un_below_data,28,17); + buttonImages[ButtonImageUnBelow]->SetHovered(dapper_un_below_hovered_data); + buttonImages[ButtonImageUnBelow]->SetPressed(dapper_un_below_pressed_data); + + buttonImages[ButtonImageShade]->SetNormal(dapper_shade_data,28,17); + buttonImages[ButtonImageShade]->SetHovered(dapper_shade_hovered_data); + buttonImages[ButtonImageShade]->SetPressed(dapper_shade_pressed_data); + buttonImages[ButtonImageUnShade]->SetNormal(dapper_un_shade_data,28,17); + buttonImages[ButtonImageUnShade]->SetHovered(dapper_un_shade_hovered_data); + buttonImages[ButtonImageUnShade]->SetPressed(dapper_un_shade_pressed_data); + + for (int i=0;i<ButtonImageCount;i++) + { + buttonImages[i]->setSpace(1,0); + buttonImages[i]->setDrawMode(0); + } + buttonImages[ButtonImageMax]->setSpace(0,0); + buttonImages[ButtonImageRestore]->setSpace(0,0); + buttonImages[ButtonImageMin]->setSpace(0,0); + buttonImages[ButtonImageClose]->setSpace(0,0); + break; + + case 7: // Kubuntu-Edgy + buttonImages[ButtonImageMenu]->SetNormal(edgy_menu_data,28,17); + buttonImages[ButtonImageMenu]->SetHovered(edgy_menu_hovered_data); + buttonImages[ButtonImageMenu]->SetPressed(edgy_menu_pressed_data); + + buttonImages[ButtonImageHelp]->SetNormal(edgy_help_data,28,17); + buttonImages[ButtonImageHelp]->SetHovered(edgy_help_hovered_data); + buttonImages[ButtonImageHelp]->SetPressed(edgy_help_pressed_data); + + buttonImages[ButtonImageMax]->SetNormal(edgy_max_data,28,17); + buttonImages[ButtonImageMax]->SetHovered(edgy_max_hovered_data); + buttonImages[ButtonImageMax]->SetPressed(edgy_max_pressed_data); + buttonImages[ButtonImageRestore]->SetNormal(edgy_restore_data,28,17); + buttonImages[ButtonImageRestore]->SetHovered(edgy_restore_hovered_data); + buttonImages[ButtonImageRestore]->SetPressed(edgy_restore_pressed_data); + buttonImages[ButtonImageMin]->SetNormal(edgy_min_data,28,17); + buttonImages[ButtonImageMin]->SetHovered(edgy_min_hovered_data); + buttonImages[ButtonImageMin]->SetPressed(edgy_min_pressed_data); + buttonImages[ButtonImageClose]->SetNormal(edgy_close_data,28,17); + buttonImages[ButtonImageClose]->SetHovered(edgy_close_hovered_data); + buttonImages[ButtonImageClose]->SetPressed(edgy_close_pressed_data); + + buttonImages[ButtonImageSticky]->SetNormal(edgy_sticky_data,28,17); + buttonImages[ButtonImageSticky]->SetHovered(edgy_sticky_hovered_data); + buttonImages[ButtonImageSticky]->SetPressed(edgy_sticky_pressed_data); + buttonImages[ButtonImageUnSticky]->SetNormal(edgy_un_sticky_data,28,17); + buttonImages[ButtonImageUnSticky]->SetHovered(edgy_un_sticky_hovered_data); + buttonImages[ButtonImageUnSticky]->SetPressed(edgy_un_sticky_pressed_data); + + buttonImages[ButtonImageAbove]->SetNormal(edgy_above_data,28,17); + buttonImages[ButtonImageAbove]->SetHovered(edgy_above_hovered_data); + buttonImages[ButtonImageAbove]->SetPressed(edgy_above_pressed_data); + buttonImages[ButtonImageUnAbove]->SetNormal(edgy_un_above_data,28,17); + buttonImages[ButtonImageUnAbove]->SetHovered(edgy_un_above_hovered_data); + buttonImages[ButtonImageUnAbove]->SetPressed(edgy_un_above_pressed_data); + + + buttonImages[ButtonImageBelow]->SetNormal(edgy_below_data,28,17); + buttonImages[ButtonImageBelow]->SetHovered(edgy_below_hovered_data); + buttonImages[ButtonImageBelow]->SetPressed(edgy_below_pressed_data); + + buttonImages[ButtonImageUnBelow]->SetNormal(edgy_un_below_data,28,17); + buttonImages[ButtonImageUnBelow]->SetHovered(edgy_un_below_hovered_data); + buttonImages[ButtonImageUnBelow]->SetPressed(edgy_un_below_pressed_data); + + buttonImages[ButtonImageShade]->SetNormal(edgy_shade_data,28,17); + buttonImages[ButtonImageShade]->SetHovered(edgy_shade_hovered_data); + buttonImages[ButtonImageShade]->SetPressed(edgy_shade_pressed_data); + buttonImages[ButtonImageUnShade]->SetNormal(edgy_un_shade_data,28,17); + buttonImages[ButtonImageUnShade]->SetHovered(edgy_un_shade_hovered_data); + buttonImages[ButtonImageUnShade]->SetPressed(edgy_un_shade_pressed_data); + + for (int i=0;i<ButtonImageCount;i++) + { + buttonImages[i]->setSpace(1,0); + buttonImages[i]->setDrawMode(0); + } + buttonImages[ButtonImageMax]->setSpace(0,0); + buttonImages[ButtonImageRestore]->setSpace(0,0); + buttonImages[ButtonImageMin]->setSpace(0,0); + buttonImages[ButtonImageClose]->setSpace(0,0); + + break; + case 8: // Kubuntu-Feisty + buttonImages[ButtonImageMenu]->SetNormal(feisty_menu_data,21,17); + buttonImages[ButtonImageMenu]->SetHovered(feisty_menu_hovered_data); + buttonImages[ButtonImageMenu]->SetPressed(feisty_menu_pressed_data); + + buttonImages[ButtonImageHelp]->SetNormal(feisty_help_data,28,17); + buttonImages[ButtonImageHelp]->SetHovered(feisty_help_hovered_data); + buttonImages[ButtonImageHelp]->SetPressed(feisty_help_pressed_data); + + buttonImages[ButtonImageMax]->SetNormal(feisty_max_data,28,17); + buttonImages[ButtonImageMax]->SetHovered(feisty_max_hovered_data); + buttonImages[ButtonImageMax]->SetPressed(feisty_max_pressed_data); + buttonImages[ButtonImageRestore]->SetNormal(feisty_restore_data,28,17); + buttonImages[ButtonImageRestore]->SetHovered(feisty_restore_hovered_data); + buttonImages[ButtonImageRestore]->SetPressed(feisty_restore_pressed_data); + buttonImages[ButtonImageMin]->SetNormal(feisty_min_data,28,17); + buttonImages[ButtonImageMin]->SetHovered(feisty_min_hovered_data); + buttonImages[ButtonImageMin]->SetPressed(feisty_min_pressed_data); + buttonImages[ButtonImageClose]->SetNormal(feisty_close_data,28,17); + buttonImages[ButtonImageClose]->SetHovered(feisty_close_hovered_data); + buttonImages[ButtonImageClose]->SetPressed(feisty_close_pressed_data); + + buttonImages[ButtonImageSticky]->SetNormal(feisty_sticky_data,28,17); + buttonImages[ButtonImageSticky]->SetHovered(feisty_sticky_hovered_data); + buttonImages[ButtonImageSticky]->SetPressed(feisty_sticky_pressed_data); + buttonImages[ButtonImageUnSticky]->SetNormal(feisty_un_sticky_data,28,17); + buttonImages[ButtonImageUnSticky]->SetHovered(feisty_un_sticky_hovered_data); + buttonImages[ButtonImageUnSticky]->SetPressed(feisty_un_sticky_pressed_data); + + buttonImages[ButtonImageAbove]->SetNormal(feisty_above_data,28,17); + buttonImages[ButtonImageAbove]->SetHovered(feisty_above_hovered_data); + buttonImages[ButtonImageAbove]->SetPressed(feisty_above_pressed_data); + buttonImages[ButtonImageUnAbove]->SetNormal(feisty_un_above_data,28,17); + buttonImages[ButtonImageUnAbove]->SetHovered(feisty_un_above_hovered_data); + buttonImages[ButtonImageUnAbove]->SetPressed(feisty_un_above_pressed_data); + + + buttonImages[ButtonImageBelow]->SetNormal(feisty_below_data,28,17); + buttonImages[ButtonImageBelow]->SetHovered(feisty_below_hovered_data); + buttonImages[ButtonImageBelow]->SetPressed(feisty_below_pressed_data); + + buttonImages[ButtonImageUnBelow]->SetNormal(feisty_un_below_data,28,17); + buttonImages[ButtonImageUnBelow]->SetHovered(feisty_un_below_hovered_data); + buttonImages[ButtonImageUnBelow]->SetPressed(feisty_un_below_pressed_data); + + buttonImages[ButtonImageShade]->SetNormal(feisty_shade_data,28,17); + buttonImages[ButtonImageShade]->SetHovered(feisty_shade_hovered_data); + buttonImages[ButtonImageShade]->SetPressed(feisty_shade_pressed_data); + buttonImages[ButtonImageUnShade]->SetNormal(feisty_un_shade_data,28,17); + buttonImages[ButtonImageUnShade]->SetHovered(feisty_un_shade_hovered_data); + buttonImages[ButtonImageUnShade]->SetPressed(feisty_un_shade_pressed_data); + + for (int i=0;i<ButtonImageCount;i++) + { + buttonImages[i]->setSpace(1,0); + buttonImages[i]->setDrawMode(0); + } + buttonImages[ButtonImageMax]->setSpace(0,0); + buttonImages[ButtonImageRestore]->setSpace(0,0); + buttonImages[ButtonImageMin]->setSpace(0,0); + buttonImages[ButtonImageClose]->setSpace(0,0); + + break; + case 9: // Kubuntu-hardy + buttonImages[ButtonImageMenu]->SetNormal(hardy_menu_data,28,17); + buttonImages[ButtonImageMenu]->SetHovered(hardy_menu_hovered_data); + buttonImages[ButtonImageMenu]->SetPressed(hardy_menu_pressed_data); + + buttonImages[ButtonImageHelp]->SetNormal(hardy_help_data,28,17); + buttonImages[ButtonImageHelp]->SetHovered(hardy_help_hovered_data); + buttonImages[ButtonImageHelp]->SetPressed(hardy_help_pressed_data); + + buttonImages[ButtonImageMax]->SetNormal(hardy_max_data,28,17); + buttonImages[ButtonImageMax]->SetHovered(hardy_max_hovered_data); + buttonImages[ButtonImageMax]->SetPressed(hardy_max_pressed_data); + buttonImages[ButtonImageRestore]->SetNormal(hardy_restore_data,28,17); + buttonImages[ButtonImageRestore]->SetHovered(hardy_restore_hovered_data); + buttonImages[ButtonImageRestore]->SetPressed(hardy_restore_pressed_data); + buttonImages[ButtonImageMin]->SetNormal(hardy_min_data,28,17); + buttonImages[ButtonImageMin]->SetHovered(hardy_min_hovered_data); + buttonImages[ButtonImageMin]->SetPressed(hardy_min_pressed_data); + buttonImages[ButtonImageClose]->SetNormal(hardy_close_data,28,17); + buttonImages[ButtonImageClose]->SetHovered(hardy_close_hovered_data); + buttonImages[ButtonImageClose]->SetPressed(hardy_close_pressed_data); + + buttonImages[ButtonImageSticky]->SetNormal(hardy_sticky_data,28,17); + buttonImages[ButtonImageSticky]->SetHovered(hardy_sticky_hovered_data); + buttonImages[ButtonImageSticky]->SetPressed(hardy_sticky_pressed_data); + buttonImages[ButtonImageUnSticky]->SetNormal(hardy_un_sticky_data,28,17); + buttonImages[ButtonImageUnSticky]->SetHovered(hardy_un_sticky_hovered_data); + buttonImages[ButtonImageUnSticky]->SetPressed(hardy_un_sticky_pressed_data); + + buttonImages[ButtonImageAbove]->SetNormal(hardy_above_data,28,17); + buttonImages[ButtonImageAbove]->SetHovered(hardy_above_hovered_data); + buttonImages[ButtonImageAbove]->SetPressed(hardy_above_pressed_data); + buttonImages[ButtonImageUnAbove]->SetNormal(hardy_un_above_data,28,17); + buttonImages[ButtonImageUnAbove]->SetHovered(hardy_un_above_hovered_data); + buttonImages[ButtonImageUnAbove]->SetPressed(hardy_un_above_pressed_data); + + + buttonImages[ButtonImageBelow]->SetNormal(hardy_below_data,28,17); + buttonImages[ButtonImageBelow]->SetHovered(hardy_below_hovered_data); + buttonImages[ButtonImageBelow]->SetPressed(hardy_below_pressed_data); + + buttonImages[ButtonImageUnBelow]->SetNormal(hardy_un_below_data,28,17); + buttonImages[ButtonImageUnBelow]->SetHovered(hardy_un_below_hovered_data); + buttonImages[ButtonImageUnBelow]->SetPressed(hardy_un_below_pressed_data); + + buttonImages[ButtonImageShade]->SetNormal(hardy_shade_data,28,17); + buttonImages[ButtonImageShade]->SetHovered(hardy_shade_hovered_data); + buttonImages[ButtonImageShade]->SetPressed(hardy_shade_pressed_data); + buttonImages[ButtonImageUnShade]->SetNormal(hardy_un_shade_data,28,17); + buttonImages[ButtonImageUnShade]->SetHovered(hardy_un_shade_hovered_data); + buttonImages[ButtonImageUnShade]->SetPressed(hardy_un_shade_pressed_data); + + for (int i=0;i<ButtonImageCount;i++) + { + buttonImages[i]->setSpace(1,0); + buttonImages[i]->setDrawMode(0); + } + buttonImages[ButtonImageMax]->setSpace(0,0); + buttonImages[ButtonImageRestore]->setSpace(0,0); + buttonImages[ButtonImageMin]->setSpace(0,0); + buttonImages[ButtonImageClose]->setSpace(0,0); + + break; + + } + + + for (int i=0;i<ButtonImageCount;i++)buttonImages[i]->finish(); +} + + + + + + + + +CrystalClient::CrystalClient(KDecorationBridge *b,CrystalFactory *f) +: KDecoration(b,f) +{ + ::factory->clients.append(this); +} + +CrystalClient::~CrystalClient() +{ + ::factory->clients.remove(this); + for (int n=0; n<ButtonTypeCount; n++) { + if (button[n]) delete button[n]; + } +} + +void CrystalClient::init() +{ + createMainWidget(WResizeNoErase | WRepaintNoErase); + widget()->installEventFilter(this); + + FullMax=false; + if (!options()->moveResizeMaximizedWindows()) + FullMax=(maximizeMode()==MaximizeFull); + + // for flicker-free redraws + widget()->setBackgroundMode(NoBackground); + + // setup layout + mainlayout = new QGridLayout(widget(), 4, 3); // 4x3 grid + titlelayout = new QHBoxLayout(); + titlebar_ = new QSpacerItem(1, ::factory->titlesize-1, QSizePolicy::Expanding, + QSizePolicy::Fixed); + + mainlayout->setResizeMode(QLayout::FreeResize); + mainlayout->setRowSpacing(0, (::factory->buttontheme==5)?0:1); + mainlayout->setRowSpacing(3, ::factory->borderwidth*1); + + mainlayout->setColSpacing(2,borderSpacing()); + mainlayout->setColSpacing(0,borderSpacing()); + mainlayout->addLayout(titlelayout, 1, 1); + + if (isPreview()) { + char c[512]; + sprintf(c,"<center><b>Crystal %s Preview</b><br>Built: %s</center>",VERSION,__DATE__); + mainlayout->addItem(new QSpacerItem(1, 1,QSizePolicy::Expanding,QSizePolicy::Fixed), 0, 1); + mainlayout->addItem(new QSpacerItem(1, ::factory->borderwidth,QSizePolicy::Expanding,QSizePolicy::Expanding), 3, 1); + mainlayout->addWidget(new QLabel(i18n(c),widget()), 2, 1); + } else { + mainlayout->addItem(new QSpacerItem(0, 0), 2, 1); + } + + mainlayout->setRowStretch(2, 10); + mainlayout->setColStretch(1, 10); + + updateMask(); + + for (int n=0; n<ButtonTypeCount; n++) button[n] = 0; + addButtons(titlelayout, options()->titleButtonsLeft()); + titlelayout->addItem(titlebar_); + { + CrystalButton* lastbutton=addButtons(titlelayout, options()->titleButtonsRight()); + if (lastbutton)lastbutton->setFirstLast(false,true); + } + + if (::factory->captiontooltip) new CCrystalTooltip(widget(),this); + + connect( this, SIGNAL( keepAboveChanged( bool )), SLOT( keepAboveChange( bool ))); + connect( this, SIGNAL( keepBelowChanged( bool )), SLOT( keepBelowChange( bool ))); + + if (::factory->transparency)connect ( ::factory->image_holder,SIGNAL(repaintNeeded()),this,SLOT(Repaint())); + if (::factory->transparency)connect ( &timer,SIGNAL(timeout()),this,SLOT(Repaint())); + + updateLayout(); +} + +void CrystalClient::updateMask() +{ + if ((::factory->roundCorners==0)|| (!options()->moveResizeMaximizedWindows() && maximizeMode() & MaximizeFull ) ) + { + setMask(QRegion(widget()->rect())); + return; + } + + int cornersFlag = ::factory->roundCorners; + int r(width()); + int b(height()); + QRegion mask; + + mask=QRegion(widget()->rect()); + + // Remove top-left corner. + if(cornersFlag & TOP_LEFT) { + mask -= QRegion(0, 0, 5, 1); + mask -= QRegion(0, 1, 3, 1); + mask -= QRegion(0, 2, 2, 1); + mask -= QRegion(0, 3, 1, 2); + } + // Remove top-right corner. + if(cornersFlag & TOP_RIGHT) { + mask -= QRegion(r - 5, 0, 5, 1); + mask -= QRegion(r - 3, 1, 3, 1); + mask -= QRegion(r - 2, 2, 2, 1); + mask -= QRegion(r - 1, 3, 1, 2); + } + // Remove bottom-left corner. + if(cornersFlag & BOT_LEFT) { + mask -= QRegion(0, b - 5, 1, 3); + mask -= QRegion(0, b - 3, 2, 1); + mask -= QRegion(0, b - 2, 3, 1); + mask -= QRegion(0, b - 1, 5, 1); + } + // Remove bottom-right corner. + if(cornersFlag & BOT_RIGHT) { + mask -= QRegion(r - 5, b - 1, 5, 1); + mask -= QRegion(r - 3, b - 2, 3, 1); + mask -= QRegion(r - 2, b - 3, 2, 1); + mask -= QRegion(r - 1, b - 5, 1, 2); + } + + setMask(mask); +} + +CrystalButton* CrystalClient::addButtons(QBoxLayout *layout, const QString& s) +{ + ButtonImage *bitmap; + QString tip; + CrystalButton *lastone=NULL; + + if (s.length() > 0) + { + for (unsigned n=0; n < s.length(); n++) + { + CrystalButton *current=NULL; + switch (s[n]) { + case 'M': // Menu button + if (!button[ButtonMenu]) { + button[ButtonMenu] = current = new CrystalButton(this, "menu", i18n("Menu"), ButtonMenu, ::factory->buttonImages[ButtonImageMenu]); + connect(button[ButtonMenu], SIGNAL(pressed()), this, SLOT(menuButtonPressed())); + } + break; + + case 'S': // Sticky button + if (!button[ButtonSticky]) { + if (isOnAllDesktops()) { + bitmap = ::factory->buttonImages[ButtonImageSticky]; + tip = i18n("Not on all desktops"); + } else { + bitmap = ::factory->buttonImages[ButtonImageUnSticky]; + tip = i18n("On All Desktops"); + } + button[ButtonSticky] =current=new CrystalButton(this, "sticky", tip,ButtonSticky, bitmap); + connect(button[ButtonSticky], SIGNAL(clicked()),this, SLOT(toggleOnAllDesktops())); + } + break; + + case 'H': // Help button + if (providesContextHelp()) { + button[ButtonHelp] =current= + new CrystalButton(this, "help", i18n("Help"),ButtonHelp, ::factory->buttonImages[ButtonImageHelp]); + connect(button[ButtonHelp], SIGNAL(clicked()),this, SLOT(showContextHelp())); + } + break; + + case 'I': // Minimize button + if ((!button[ButtonMin]) && isMinimizable()) { + button[ButtonMin] =current= + new CrystalButton(this, "iconify", i18n("Minimize"),ButtonMin, ::factory->buttonImages[ButtonImageMin]); + connect(button[ButtonMin], SIGNAL(clicked()),this, SLOT(minButtonPressed())); + } + break; + + case 'F': // Above button + if (!button[ButtonAbove]) { + button[ButtonAbove] =current= + new CrystalButton(this, "above", i18n("Keep Above Others"),ButtonAbove, ::factory->buttonImages[keepAbove()?ButtonImageUnAbove:ButtonImageAbove]); + connect(button[ButtonAbove], SIGNAL(clicked()),this, SLOT(aboveButtonPressed())); + } + break; + + case 'B': // Below button + if ((!button[ButtonBelow])) { + button[ButtonBelow] =current= + new CrystalButton(this, "below", i18n("Keep Below Others"),ButtonBelow, ::factory->buttonImages[keepBelow()?ButtonImageUnBelow:ButtonImageBelow]); + connect(button[ButtonBelow], SIGNAL(clicked()),this, SLOT(belowButtonPressed())); + } + break; + + case 'L': // Shade button + if ((!button[ButtonShade]) && isShadeable()) { + button[ButtonShade] =current= + new CrystalButton(this, "shade", i18n("Shade"),ButtonShade, ::factory->buttonImages[ButtonImageShade]); + connect(button[ButtonShade], SIGNAL(clicked()),this, SLOT(shadeButtonPressed())); + } + break; + + case 'A': // Maximize button + if ((!button[ButtonMax]) && isMaximizable()) + { + if (maximizeMode() == MaximizeFull) + { + bitmap = ::factory->buttonImages[ButtonImageRestore]; + tip = i18n("Restore"); + } else { + bitmap = ::factory->buttonImages[ButtonImageMax]; + tip = i18n("Maximize"); + } + button[ButtonMax] =current= + new CrystalButton(this, "maximize", tip,ButtonMax, bitmap); + connect(button[ButtonMax], SIGNAL(clicked()),this, SLOT(maxButtonPressed())); + } + break; + + case 'X': // Close button + if (isCloseable()) { + button[ButtonClose] =current= + new CrystalButton(this, "close", i18n("Close"),ButtonClose, ::factory->buttonImages[ButtonImageClose]); + connect(button[ButtonClose], SIGNAL(clicked()),this, SLOT(closeButtonPressed())); + } + break; + + case '_': // Spacer item + layout->addSpacing(4); + current=NULL; + break; + } + + if (current) + { + layout->addWidget(current); + if (layout->findWidget(current)==0)current->setFirstLast(true,false); + } + lastone=current; + } + } + return lastone; +} + +void CrystalClient::activeChange() +{ + Repaint(); + if (isActive()) ::factory->clients.at(::factory->clients.find(this)); +} + +void CrystalClient::captionChange() +{ + if (::factory->drawcaption) widget()->repaint(titlebar_->geometry(), false); +} + +void CrystalClient::desktopChange() +{ + bool d = isOnAllDesktops(); + if (button[ButtonSticky]) { + button[ButtonSticky]->setBitmap(::factory->buttonImages[d ? ButtonImageSticky : ButtonImageUnSticky ]); + QToolTip::remove(button[ButtonSticky]); + QToolTip::add(button[ButtonSticky], d ? i18n("Not on all desktops") : i18n("On All Desktops")); + } +} + +void CrystalClient::iconChange() +{ + if (button[ButtonMenu]) { + button[ButtonMenu]->setBitmap(::factory->buttonImages[ButtonImageMenu]); + } +} + +void CrystalClient::maximizeChange() +{ + bool m = (maximizeMode() == MaximizeFull); + if (button[ButtonMax]) { + button[ButtonMax]->setBitmap(::factory->buttonImages[ m ? ButtonImageRestore : ButtonImageMax ]); + QToolTip::remove(button[ButtonMax]); + QToolTip::add(button[ButtonMax], m ? i18n("Restore") : i18n("Maximize")); + } + + if (!options()->moveResizeMaximizedWindows()) + { + FullMax=m; + updateLayout(); + Repaint(); + } +} + +void CrystalClient::updateLayout() +{ + if (FullMax) + { + mainlayout->setColSpacing(0,0); + mainlayout->setColSpacing(2,0); + }else{ + mainlayout->setColSpacing(2,borderSpacing()); + mainlayout->setColSpacing(0,borderSpacing()); + } + + mainlayout->setRowSpacing(0, (FullMax||::factory->buttontheme==5)?0:1); + for (int i=0;i<ButtonTypeCount;i++)if (button[i]) + button[i]->resetSize(FullMax); + widget()->layout()->activate(); +} + +int CrystalClient::borderSpacing() +{ + if (::factory->roundCorners) + return (::factory->borderwidth<=5)?5: ::factory->borderwidth; + return (::factory->borderwidth<=1)?1: ::factory->borderwidth; +} + +void CrystalClient::shadeChange() +{ + if (button[ButtonShade]) + { + button[ButtonShade]->setBitmap(::factory->buttonImages[isShade()?ButtonImageUnShade:ButtonImageShade]); + } + if (!::factory->transparency)Repaint(); + return; +} + +void CrystalClient::borders(int &l, int &r, int &t, int &b) const +{ + l = r = ::factory->borderwidth; + t = ::factory->titlesize; + if (!isShade())b = ::factory->borderwidth; else b=0; + + if (!options()->moveResizeMaximizedWindows() ) + { + if ( maximizeMode() & MaximizeHorizontal )l=r=1; + if ( maximizeMode() & MaximizeVertical ) + { + b=isShade()?0:1; + if (!isShade() && ( maximizeMode() & MaximizeHorizontal ))b=0; + } + if ( (maximizeMode() & MaximizeFull)==MaximizeFull) + l=r=0; + } +} + +void CrystalClient::resize(const QSize &size) +{ + widget()->resize(size); +} + +QSize CrystalClient::minimumSize() const +{ + return widget()->minimumSize(); +} + +KDecoration::Position CrystalClient::mousePosition(const QPoint &point) const +{ + const int corner = 20; + Position pos; + const int RESIZESIZE=::factory->borderwidth; + + if (isShade() || !isResizable()) pos=PositionCenter; + else if (point.y() <= 3) { + // inside top frame + if (point.x() <= corner) pos = PositionTopLeft; + else if (point.x() >= (width()-corner)) pos = PositionTopRight; + else pos = PositionTop; + } else if (point.y() >= (height()-RESIZESIZE)) { + // inside handle + if (point.x() <= corner) pos = PositionBottomLeft; + else if (point.x() >= (width()-corner)) pos = PositionBottomRight; + else pos = PositionBottom; + } else if (point.x() <= RESIZESIZE) { + // on left frame + if (point.y() <= corner) pos = PositionTopLeft; + else if (point.y() >= (height()-corner)) pos = PositionBottomLeft; + else pos = PositionLeft; + } else if (point.x() >= width()-RESIZESIZE) { + // on right frame + if (point.y() <= corner) pos = PositionTopRight; + else if (point.y() >= (height()-corner)) pos = PositionBottomRight; + else pos = PositionRight; + } else { + // inside the frame + pos = PositionCenter; + } + return pos; +} + +bool CrystalClient::eventFilter(QObject *obj, QEvent *e) +{ + if (obj != widget()) return false; + + switch (e->type()) { + case QEvent::MouseButtonDblClick: + mouseDoubleClickEvent(static_cast<QMouseEvent *>(e)); + return true; + case QEvent::MouseButtonPress: + processMousePressEvent(static_cast<QMouseEvent *>(e)); + return true; + case QEvent::Paint: + paintEvent(static_cast<QPaintEvent *>(e)); + return true; + case QEvent::Wheel: + mouseWheelEvent(static_cast<QWheelEvent *>(e)); + return true; + + case QEvent::Resize: + resizeEvent(static_cast<QResizeEvent *>(e)); + return true; + + case QEvent::Show: + showEvent(static_cast<QShowEvent *>(e)); + return true; + case QEvent::Move: + moveEvent(static_cast<QMoveEvent *>(e)); + return true; + default:return false; + } + + return false; +} + +void CrystalClient::ClientWindows(Window* v_frame,Window* v_wrapper,Window *v_client) +{ + Window root=0,frame=0,wrapper=0,client=0,parent=0,*children=NULL; + uint numc; + if (v_frame) *v_frame=0; + if (v_wrapper) *v_wrapper=0; + if (v_client) *v_client=0; + // Our Deco is the child of a frame, get our parent + if (XQueryTree(qt_xdisplay(),widget()->winId(),&root,&frame,&children,&numc) == 0) + return; + if (children!=NULL)XFree(children); + children=NULL; + + // frame has two children, us and a wrapper, get the wrapper + if (XQueryTree(qt_xdisplay(),frame,&root,&parent,&children,&numc)==0) + return; + + for (uint i=0;i<numc;i++) + { + if (children[i]!=widget()->winId())wrapper=children[i]; + } + if (children!=NULL)XFree(children); + children=NULL; + + // wrapper has only one child, which is the client. We want this!! + if (XQueryTree(qt_xdisplay(),wrapper,&root,&parent,&children,&numc)==0) + return; + if (numc==1)client=children[0]; + if (children!=NULL)XFree(children); + children=NULL; + if (v_client) *v_client=client; + if (v_wrapper) *v_wrapper=wrapper; + if (v_frame) *v_frame=frame; +} + +void CrystalClient::mouseDoubleClickEvent(QMouseEvent *e) +{ + if (/*(titlebar_->geometry().contains(e->pos()))&&*/(e->button()==LeftButton)) titlebarDblClickOperation(); + else { + QMouseEvent me(QEvent::MouseButtonPress,e->pos(),e->button(),e->state()); + processMousePressEvent(&me); + } +} + +void CrystalClient::mouseWheelEvent(QWheelEvent *e) +{ + if (::factory->wheelTask) + { + QPtrList <CrystalClient> *l=&(::factory->clients); + + if (l->current()==NULL) for (unsigned int i=0;i<l->count();i++) if ((l->at(i))->isActive()) break; + + CrystalClient *n=this; + Window client,frame,wrapper; + do + { + if(e->delta()>0) + { + n=l->next(); + if (n==NULL)n=l->first(); + }else{ + n=l->prev(); + if (n==NULL)n=l->last(); + } + + n->ClientWindows(&frame,&wrapper,&client); + if (client == 0) { /* FALLBACK */ +#if KDE_IS_VERSION(3,5,0) + titlebarMouseWheelOperation(e->delta()); +#endif + return; + } + KWin::WindowInfo info=KWin::windowInfo(client); + if ((n->desktop()==desktop()) && !info.isMinimized())break; + }while(n!=this); + + KWin::activateWindow(client); + }else{ +#if KDE_IS_VERSION(3,5,0) + titlebarMouseWheelOperation(e->delta()); +#endif + } +} + +void CrystalClient::paintEvent(QPaintEvent*) +{ + if (!CrystalFactory::initialized()) return; + + QColorGroup group; + QPainter painter(widget()); + + // draw the titlebar + group = options()->colorGroup(KDecoration::ColorTitleBar, isActive()); + WND_CONFIG* wndcfg=(isActive()?&::factory->active:&::factory->inactive); + + if (::factory->transparency && ::factory->trackdesktop) + ::factory->image_holder->repaint(false); // If other desktop than the last, regrab the root image + QPixmap *background=::factory->transparency?::factory->image_holder->image(isActive()):NULL; + int drawFrame; + + { + QRect r; + QPoint p=widget()->mapToGlobal(QPoint(0,0)); + int bl,br,bt,bb; + borders(bl,br,bt,bb); + + QPixmap pufferPixmap; + pufferPixmap.resize(widget()->width(), bt); + QPainter pufferPainter(&pufferPixmap); + + r=QRect(p.x(),p.y(),widget()->width(),bt); + if (background && !background->isNull())pufferPainter.drawPixmap(QPoint(0,0),*background,r); + else + { + pufferPainter.fillRect(widget()->rect(),group.background()); + } + if (!wndcfg->overlay.isNull()) + { + pufferPainter.drawTiledPixmap(0,0,widget()->width(),bt,wndcfg->overlay); + } + + if (::factory->drawcaption) + { + // draw title text + pufferPainter.setFont(options()->font(isActive(), false)); + + QColor color=options()->color(KDecoration::ColorFont, isActive()); + r=titlebar_->geometry(); + r.moveBy(0,-1); + int logowidth=::factory->logo.width()+::factory->logoDistance; + if (::factory->logoEnabled!=1 && (isActive()||!::factory->logoActive)) + { + r.setWidth(r.width()-logowidth); + if (::factory->logoEnabled==0)r.moveLeft(r.left()+logowidth); + } + QFontMetrics metrics(options()->font(isActive(), false)); + int textwidth=metrics.width(caption()); + int textalign=CrystalFactory::titleAlign(); + if (textwidth>r.width()) + textalign=AlignLeft, textwidth=r.width(); + if (::factory->textshadow && isActive()) + { + pufferPainter.translate(1,1); + pufferPainter.setPen(color.dark(300)); + pufferPainter.drawText(r,textalign | AlignVCenter,caption()); + pufferPainter.translate(-1,-1); + } + + pufferPainter.setPen(color); + pufferPainter.drawText(r, + textalign | AlignVCenter, + caption()); + + if (::factory->logoEnabled!=1 && (isActive()||!::factory->logoActive)) + { + int x=0; + if (::factory->logoEnabled==0 && textalign==AlignLeft)x=r.left()-logowidth; + if (::factory->logoEnabled==2 && textalign==AlignLeft)x=r.left()+textwidth+::factory->logoDistance; + + if (::factory->logoEnabled==0 && textalign==AlignRight)x=r.right()-textwidth-logowidth; + if (::factory->logoEnabled==2 && textalign==AlignRight)x=r.right()+::factory->logoDistance; + + if (::factory->logoEnabled==0 && textalign==AlignHCenter)x=(r.right()+r.left()-textwidth)/2-logowidth; + if (::factory->logoEnabled==2 && textalign==AlignHCenter)x=(r.right()+r.left()+textwidth)/2+::factory->logoDistance; + pufferPainter.drawPixmap(x,(::factory->titlesize-::factory->logo.height())/2,::factory->logo); + } + }else if (::factory->logoEnabled!=1 && (isActive()||!::factory->logoActive)) { + int x=0; + r=titlebar_->geometry(); + if (::factory->logoEnabled==0) x=r.left(); + if (::factory->logoEnabled==2) x=r.right()-::factory->logo.width(); + pufferPainter.drawPixmap(x,(::factory->titlesize-::factory->logo.height())/2,::factory->logo); + + } + + pufferPainter.end(); + painter.drawPixmap(0,0,pufferPixmap); + + drawFrame=0; + if (wndcfg->outlineMode && (options()->moveResizeMaximizedWindows() || isShade() || (maximizeMode() & MaximizeFull)!=MaximizeFull)) + drawFrame=1; + + if (::factory->borderwidth>0) + { + if (background && !background->isNull()) + { // Draw the side and bottom of the window with transparency + // Left + r=QRect(p.x()+drawFrame,p.y()+bt,bl-drawFrame,widget()->height()-bt-drawFrame); + painter.drawPixmap(QPoint(drawFrame,bt),*background,r); + + // Right + r=QRect(widget()->width()-br+p.x(),p.y()+bt,br-drawFrame,widget()->height()-bt-drawFrame); + painter.drawPixmap(QPoint(widget()->width()-br,bt),*background,r); + + // Bottom + r=QRect(p.x()+bl,p.y()+widget()->height()-bb,widget()->width()-bl-br,bb-drawFrame); + painter.drawPixmap(QPoint(bl,widget()->height()-bb),*background,r); + }else{ + r=QRect(drawFrame,bt,bl-drawFrame,widget()->height()-bt-drawFrame); + painter.fillRect(r,group.background()); + + r=QRect(widget()->width()-br,bt,br-drawFrame,widget()->height()-bt-drawFrame); + painter.fillRect(r,group.background()); + + r=QRect(bl,widget()->height()-bb,widget()->width()-bl-br,bb-drawFrame); + painter.fillRect(r,group.background()); + } + } + + if (!isShade()) + { + if (wndcfg->inlineMode==1) { + painter.setPen(wndcfg->inlineColor); + painter.drawRect(bl-1,bt-1,widget()->width()-bl-br+2,widget()->height()-bt-bb+2); + } + if (wndcfg->inlineMode==2) { + painter.setPen(wndcfg->inlineColor.dark(150)); + painter.drawLine(bl-1,bt-1,widget()->width()-br,bt-1); + painter.drawLine(bl-1,bt-1,bl-1,widget()->height()-bb); + painter.setPen(wndcfg->inlineColor.light(150)); + painter.drawLine(widget()->width()-br,bt-1,widget()->width()-br,widget()->height()-bb); + painter.drawLine(bl-1,widget()->height()-bb,widget()->width()-br-1,widget()->height()-bb); + } + if (wndcfg->inlineMode==3) { + painter.setPen(wndcfg->inlineColor.light(150)); + painter.drawLine(bl-1,bt-1,widget()->width()-br,bt-1); + painter.drawLine(bl-1,bt-1,bl-1,widget()->height()-bb); + painter.setPen(wndcfg->inlineColor.dark(150)); + painter.drawLine(widget()->width()-br,bt-1,widget()->width()-br,widget()->height()-bb); + painter.drawLine(bl-1,widget()->height()-bb,widget()->width()-br-1,widget()->height()-bb); + } + } + } + if (background==NULL && ::factory->transparency) + { // We don't have a background image, draw a solid rectangle + // And notify image_holder that we need an update asap + if (::factory)if (::factory->image_holder) + // UnInit image_holder, on next Repaint it will be Init'ed again. + QTimer::singleShot(500,::factory->image_holder,SLOT(CheckSanity())); + } + + if (drawFrame) + { + // outline the frame + QRect r=widget()->rect(); + QColor c1,c2; + c1=c2=wndcfg->frameColor; + if (wndcfg->outlineMode==2)c1=c1.dark(140),c2=c2.light(140); + if (wndcfg->outlineMode==3)c1=c1.light(140),c2=c2.dark(140); + + painter.setPen(c1); + painter.drawLine(r.left(),r.top(),r.right(),r.top()); + painter.drawLine(r.left(),r.top(),r.left(),r.bottom()); + + painter.setPen(c2); + painter.drawLine(r.right(),r.top(),r.right(),r.bottom()); + painter.drawLine(r.left(),r.bottom(),r.right(),r.bottom()); + + if ((::factory->roundCorners) && !(!options()->moveResizeMaximizedWindows() && maximizeMode() & MaximizeFull)) + { + int cornersFlag = ::factory->roundCorners; + int r=(width()); + int b=(height()); + + // Draw edge of top-left corner inside the area removed by the mask. + if(cornersFlag & TOP_LEFT) { + painter.setPen(c1); + painter.drawPoint(3, 1); + painter.drawPoint(4, 1); + painter.drawPoint(2, 2); + painter.drawPoint(1, 3); + painter.drawPoint(1, 4); + } + + // Draw edge of top-right corner inside the area removed by the mask. + if(cornersFlag & TOP_RIGHT) { + painter.setPen(c1); + painter.drawPoint(r - 5, 1); + painter.drawPoint(r - 4, 1); + painter.drawPoint(r - 3, 2); + painter.drawPoint(r - 2, 3); + painter.drawPoint(r - 2, 4); + } + + // Draw edge of bottom-left corner inside the area removed by the mask. + if(cornersFlag & BOT_LEFT) { + painter.setPen(c2); + painter.drawPoint(1, b - 5); + painter.drawPoint(1, b - 4); + painter.drawPoint(2, b - 3); + painter.drawPoint(3, b - 2); + painter.drawPoint(4, b - 2); + } + + // Draw edge of bottom-right corner inside the area removed by the mask. + if(cornersFlag & BOT_RIGHT) { + painter.setPen(c2); + painter.drawPoint(r - 2, b - 5); + painter.drawPoint(r - 2, b - 4); + painter.drawPoint(r - 3, b - 3); + painter.drawPoint(r - 4, b - 2); + painter.drawPoint(r - 5, b - 2); + } + } + } +} + +void CrystalClient::resizeEvent(QResizeEvent *e) +{ + if (widget()->isShown()) + { + if (!::factory->transparency) ; + else if (::factory->repaintMode==1) + { + if (!timer.isActive())timer.start(0,true); +// Repaint(); + } + // repaint only every xxx ms + else if (::factory->repaintMode==3 || !timer.isActive()) + { + // Repaint only, when mode!=fade || amount<100 + WND_CONFIG* wnd=isActive()?&::factory->active:&::factory->inactive; + if (wnd->mode!=0 || wnd->amount<100) + timer.start(::factory->repaintTime,true); + } + } + if (e->size()!=e->oldSize()) + { + updateMask(); + } +} + +void CrystalClient::moveEvent(QMoveEvent *) +{ + if (widget()->isShown()) + { + if (!::factory->transparency) return; + else if (::factory->repaintMode==1) + { + Repaint(); + } + // repaint every xxx ms, so constant moving does not take too much CPU + else if (::factory->repaintMode==3 || !timer.isActive()) + { + // Repaint only, when mode!=fade || value<100, because otherwise it is a plain color + WND_CONFIG* wnd=isActive()?&::factory->active:&::factory->inactive; + if (wnd->mode!=0 || wnd->amount<100) + timer.start(::factory->repaintTime,true); + } + } +} + +void CrystalClient::showEvent(QShowEvent *) +{ + if (widget()->isShown()) + Repaint(); +} + +void CrystalClient::Repaint() +{ + widget()->repaint(false); + for (int n=0; n<ButtonTypeCount; n++) + if (button[n]) button[n]->reset(); +} + +void CrystalClient::maxButtonPressed() +{ + if (button[ButtonMax]) + { + switch (button[ButtonMax]->lastMousePress()) + { + case MidButton: + maximize(maximizeMode() ^ MaximizeVertical); + break; + case RightButton: + maximize(maximizeMode() ^ MaximizeHorizontal); + break; + default: + maximize((maximizeMode() == MaximizeFull) ? MaximizeRestore: MaximizeFull); + } + } +} + +void CrystalClient::minButtonPressed() +{ + if (button[ButtonMin]) { + switch (button[ButtonMin]->lastMousePress()) { + case MidButton:{ + performWindowOperation(LowerOp); + break; + } + case RightButton: + if (isShadeable()) setShade(!isShade()); + break; + default: + minimize(); + } + } +} + +void CrystalClient::aboveButtonPressed() +{ + setKeepAbove(!keepAbove()); +} + +void CrystalClient::belowButtonPressed() +{ + setKeepBelow(!keepBelow()); +} + +void CrystalClient::keepAboveChange(bool /*set*/) +{ + if (button[ButtonAbove]) + { + button[ButtonAbove]->setBitmap(::factory->buttonImages[keepAbove()?ButtonImageUnAbove:ButtonImageAbove]); + } +} + +void CrystalClient::keepBelowChange(bool /*set*/) +{ + if (button[ButtonBelow]) + { + button[ButtonBelow]->setBitmap(::factory->buttonImages[keepBelow()?ButtonImageUnBelow:ButtonImageBelow]); + } +} + +void CrystalClient::closeButtonPressed() +{ + if (button[ButtonClose]) + switch (button[ButtonClose]->lastMousePress()) { + case RightButton: + { + Window frame,wrapper,client; + char param[20]; + ClientWindows(&frame,&wrapper,&client); + if (client != 0) { + KProcess *proc = new KProcess; + + *proc << "kdocker"; + sprintf(param,"0x%lx",client); + *proc << "-d" << "-w" << param; + proc->start(KProcess::DontCare); + } else { /* Sorry man */ } + break; + } + default: + closeWindow(); + break; + } +} + +void CrystalClient::shadeButtonPressed() +{ + if (button[ButtonShade]) { + switch (button[ButtonShade]->lastMousePress()) { + case MidButton: + case RightButton: + break; + default: + if (isShadeable()) setShade(!isShade()); + } + } +} + +void CrystalClient::menuButtonPressed() +{ + if (!button[ButtonMenu])return; + + static QTime* t = 0; + static CrystalClient* lastClient = 0; + if (t == 0) + t = new QTime; + bool dbl = (lastClient == this && t->elapsed() <= QApplication::doubleClickInterval()); + lastClient = this; + t->start(); + + if (dbl) + { // Double Click on Symbol, close window + closeWindow(); + return; + } + + menuPopUp(); +} + +void CrystalClient::menuPopUp() +{ + QPoint p(button[ButtonMenu]->rect().bottomLeft().x(), + button[ButtonMenu]->rect().bottomLeft().y()+2); + KDecorationFactory* f = factory(); + showWindowMenu(button[ButtonMenu]->mapToGlobal(p)); + if (!f->exists(this)) return; // decoration was destroyed + button[ButtonMenu]->setDown(false); +} + +#include "crystalclient.moc" diff --git a/client/crystalclient.h b/client/crystalclient.h new file mode 100644 index 0000000..12b2bab --- /dev/null +++ b/client/crystalclient.h @@ -0,0 +1,204 @@ +////////////////////////////////////////////////////////////////////////////// +// crystalclient.h +// ------------------- +// Crystal window decoration for KDE +// ------------------- +// Copyright (c) 2006 Sascha Hlusiak <spam84@gmx.de> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +////////////////////////////////////////////////////////////////////////////// + +#ifndef CRYSTALCLIENT_H +#define CRYSTALCLIENT_H + +#include <qlayout.h> +#include <kdecoration.h> +#include <kdecorationfactory.h> +#include <qtimer.h> +#include <qptrlist.h> +#include <X11/Xlib.h> + + +class QSpacerItem; +class QPoint; + +class CrystalClient; +class CrystalFactory; +class CrystalButton; +class CrystalTray; +class QImageHolder; +class ButtonImage; + +extern CrystalFactory *factory; + +#define TOP_LEFT 1 +#define TOP_RIGHT 2 +#define BOT_LEFT 4 +#define BOT_RIGHT 8 + +struct WND_CONFIG +{ + int mode; // The mode (fade, emboss, ...) + + double amount; + int outlineMode,inlineMode; + QColor frameColor,inlineColor; + QPixmap overlay; + QImage userdefinedPicture; // Userdefined background image, instead of wallpaper + int blur; +}; + + +enum ButtonType { + ButtonHelp=0, + ButtonMax, + ButtonMin, + ButtonClose, + ButtonMenu, + ButtonSticky, + ButtonShade, + ButtonAbove, + ButtonBelow, + ButtonTypeCount +}; + + +enum ButtonImageTypes { + ButtonImageMenu=0, + ButtonImageHelp, + ButtonImageMax, + ButtonImageRestore, + ButtonImageMin, + ButtonImageClose, + ButtonImageSticky, + ButtonImageUnSticky, + ButtonImageShade, + ButtonImageUnShade, + ButtonImageBelow, + ButtonImageUnBelow, + ButtonImageAbove, + ButtonImageUnAbove, + ButtonImageCount +}; + + +class CrystalFactory: public KDecorationFactory +{ +public: + CrystalFactory(); + virtual ~CrystalFactory(); + virtual KDecoration *createDecoration(KDecorationBridge *b); + virtual bool reset(unsigned long changed); + virtual bool supports(Ability ability); + + static bool initialized() { return initialized_; } + static Qt::AlignmentFlags titleAlign() { return titlealign_; } +public: + QImageHolder *image_holder; + + QPixmap logo; + int logoEnabled,logoStretch,logoActive,logoDistance; + + int titlesize; + bool hovereffect,tintButtons,animateHover,menuImage,wheelTask; + + QColor buttonColor_normal,buttonColor_hovered,buttonColor_pressed; + QColor minColor_normal,minColor_hovered,minColor_pressed; + QColor maxColor_normal,maxColor_hovered,maxColor_pressed; + QColor closeColor_normal,closeColor_hovered,closeColor_pressed; + + int borderwidth; + bool drawcaption,textshadow,captiontooltip; + bool trackdesktop,transparency; + int roundCorners; + int repaintMode,repaintTime; + WND_CONFIG active,inactive; + int buttontheme; + + ButtonImage *buttonImages[ButtonImageCount]; + QPtrList <CrystalClient> clients; +private: + bool readConfig(); + void CreateButtonImages(); +private: + static bool initialized_; + static Qt::AlignmentFlags titlealign_; +}; + + +class CrystalClient : public KDecoration +{ + Q_OBJECT +public: + CrystalClient(KDecorationBridge *b,CrystalFactory *f); + virtual ~CrystalClient(); + + virtual void init(); + + virtual void activeChange(); + virtual void desktopChange(); + virtual void captionChange(); + virtual void iconChange(); + virtual void maximizeChange(); + virtual void shadeChange(); + + virtual void borders(int &l, int &r, int &t, int &b) const; + virtual void resize(const QSize &size); + virtual QSize minimumSize() const; + virtual Position mousePosition(const QPoint &point) const; + + void ClientWindows(Window* frame,Window* wrapper,Window* client); +private: + CrystalButton* addButtons(QBoxLayout* layout, const QString& buttons); + void updateMask(); + int borderSpacing(); + void updateLayout(); + + bool eventFilter(QObject *obj, QEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + void paintEvent(QPaintEvent *e); + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + void showEvent(QShowEvent *); + void mouseWheelEvent(QWheelEvent *e); + +private slots: + void Repaint(); + void maxButtonPressed(); + void minButtonPressed(); + void shadeButtonPressed(); + void aboveButtonPressed(); + void belowButtonPressed(); + void menuButtonPressed(); + void closeButtonPressed(); + + void keepAboveChange( bool ); + void keepBelowChange( bool ); + void menuPopUp(); +private: + CrystalButton *button[ButtonTypeCount]; + QGridLayout *mainlayout; + QHBoxLayout *titlelayout; + QTimer timer; +public: + bool FullMax; + QSpacerItem *titlebar_; +}; + +#endif diff --git a/client/imageholder.cpp b/client/imageholder.cpp new file mode 100644 index 0000000..c24844e --- /dev/null +++ b/client/imageholder.cpp @@ -0,0 +1,171 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 <kapp.h> +#include <qimage.h> +#include <kimageeffect.h> +#include <qapplication.h> +#include <qdesktopwidget.h> +#include "imageholder.h" +#include "crystalclient.h" + + +QImageHolder::QImageHolder(QImage act,QImage inact) +:img_active(NULL),img_inactive(NULL) +{ + rootpixmap=NULL; + setUserdefinedPictures( act,inact); + initialized=userdefinedActive && userdefinedInactive; + + emit repaintNeeded(); +} + +QImageHolder::~QImageHolder() +{ + if (rootpixmap)delete rootpixmap; + if (img_active && !userdefinedActive)delete img_active; + if (img_inactive && !userdefinedInactive)delete img_inactive; +} + +void QImageHolder::setUserdefinedPictures( QImage act,QImage inact) +{ + int w=QApplication::desktop()->width(); + int h=QApplication::desktop()->height(); + if (img_active && !userdefinedActive) + { + delete img_active; + img_active=NULL; + } + if (img_inactive && !userdefinedInactive) + { + delete img_inactive; + img_inactive=NULL; + } + + if (!act.isNull()) + { + act=act.smoothScale(w,h); + img_active=ApplyEffect(act,&::factory->active,factory->options()->colorGroup(KDecoration::ColorTitleBar, true)); + }else img_active=NULL; + if (!inact.isNull()) + { + inact=inact.smoothScale(w,h); + img_inactive=ApplyEffect(inact,&::factory->inactive,factory->options()->colorGroup(KDecoration::ColorTitleBar, false)); + }else img_inactive=NULL; + + userdefinedActive=(img_active!=NULL); + userdefinedInactive=(img_inactive!=NULL); + + CheckSanity(); +} + +void QImageHolder::Init() +{ + if (initialized)return; + + rootpixmap=new KMyRootPixmap(NULL/*,this*/); + rootpixmap->start(); + rootpixmap->repaint(true); + connect( rootpixmap,SIGNAL(backgroundUpdated(const QImage*)),this, SLOT(BackgroundUpdated(const QImage*))); + connect(kapp, SIGNAL(backgroundChanged(int)),SLOT(handleDesktopChanged(int))); + + initialized=true; +} + +void QImageHolder::repaint(bool force) +{ + Init(); + if (rootpixmap)rootpixmap->repaint(force); +} + +void QImageHolder::handleDesktopChanged(int) +{ + repaint(true); +} + +void QImageHolder::CheckSanity() +{ + if (!initialized)return; + if (userdefinedActive && userdefinedInactive)return; + if (img_active!=NULL && !userdefinedActive)return; + if (img_inactive!=NULL && !userdefinedInactive)return; + + if (rootpixmap)delete rootpixmap; + rootpixmap=NULL; + + initialized=false; +} + +QPixmap* QImageHolder::ApplyEffect(QImage &src,WND_CONFIG* cfg,QColorGroup colorgroup) +{ + QImage dst; + + switch(cfg->mode) + { + case 0: if (cfg->amount>0.99)return new QPixmap(); + dst=KImageEffect::fade(src, cfg->amount, colorgroup.background()); + break; + case 1:dst=KImageEffect::channelIntensity(src,cfg->amount,KImageEffect::All); + break; + case 2:dst=KImageEffect::intensity(src,cfg->amount); + break; + case 3:dst=KImageEffect::desaturate(src,cfg->amount); + break; + case 4: dst=src; + KImageEffect::solarize(dst,cfg->amount*100.0); + break; + + default:dst=src; + break; + } + + if (cfg->blur>0)dst=KImageEffect::blur(dst,0,cfg->blur); + + return new QPixmap(dst); +} + +void QImageHolder::BackgroundUpdated(const QImage *src) +{ + if (img_active && !userdefinedActive) + { + delete img_active; + img_active=NULL; + } + if (img_inactive && !userdefinedInactive) + { + delete img_inactive; + img_inactive=NULL; + } + + if (src && !src->isNull()) + { + QImage tmp=src->copy(); + + if (!userdefinedInactive) + img_inactive=ApplyEffect(tmp,&::factory->inactive,factory->options()->colorGroup(KDecoration::ColorTitleBar, false)); + + tmp=src->copy(); + if (!userdefinedActive) + img_active=ApplyEffect(tmp,&::factory->active,factory->options()->colorGroup(KDecoration::ColorTitleBar, true)); + } + + emit repaintNeeded(); +} diff --git a/client/imageholder.h b/client/imageholder.h new file mode 100644 index 0000000..b88ac87 --- /dev/null +++ b/client/imageholder.h @@ -0,0 +1,62 @@ +/*************************************************************************** + * Copyright (C) 2006 by Sascha Hlusiak * + * Spam84@gmx.de * + * * + * 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 _IMAGEHOLDER_INCLUDED_ +#define _IMAGEHOLDER_INCLUDED_ + + +#include <kwinmodule.h> +#include "myrootpixmap.h" + +struct WND_CONFIG; + +class QImageHolder:public QObject +{ + Q_OBJECT +public: + QImageHolder(QImage act,QImage inact); + virtual ~QImageHolder(); + + void Init(); + QPixmap *image(bool active) { Init(); return active?img_active:img_inactive; } + void repaint(bool force); + + void setUserdefinedPictures(QImage act,QImage inact); + +private: + bool initialized; + KMyRootPixmap *rootpixmap; + QPixmap *img_active,*img_inactive; + bool userdefinedActive,userdefinedInactive; + + QPixmap* ApplyEffect(QImage &src,WND_CONFIG* cfg,QColorGroup colorgroup); + +public slots: + void BackgroundUpdated(const QImage *); + void handleDesktopChanged(int desk); + void CheckSanity(); + +signals: + void repaintNeeded(); +}; + + +#endif diff --git a/client/myrootpixmap.cc b/client/myrootpixmap.cc new file mode 100644 index 0000000..9412256 --- /dev/null +++ b/client/myrootpixmap.cc @@ -0,0 +1,200 @@ +/* vi: ts=8 sts=4 sw=4 + * + * $Id: krootpixmap.cpp,v 1.20 2003/06/01 01:49:31 hadacek Exp $ + * + * This file is part of the KDE project, module kdeui. + * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org> + * + * You can Freely distribute this program under the GNU Library + * General Public License. See the file "COPYING.LIB" for the exact + * licensing terms. + */ + +/* Modified by Sascha Hlusiak */ + +#include <qwidget.h> +#include <qtimer.h> +#include <qrect.h> +#include <qimage.h> + +#ifndef Q_WS_QWS //FIXME +#include <kapplication.h> +#include <kimageeffect.h> +#include <kpixmapio.h> +#include <kwinmodule.h> +#include <kdebug.h> +#include <netwm.h> +#include <dcopclient.h> +#include <qpainter.h> + +#include <ksharedpixmap.h> +#include "myrootpixmap.h" + + + +KMyRootPixmap::KMyRootPixmap( QWidget * widget, const char *name ) + : QObject(widget, name ? name : "KMyRootPixmap" ) +{ + init(); +} + +KMyRootPixmap::KMyRootPixmap( QWidget *, QObject *parent, const char *name ) + : QObject( parent, name ? name : "KMyRootPixmap" ) +{ + init(); +} + +void KMyRootPixmap::init() +{ +// d = new KMyRootPixmapData; +// m_Fade = 0; + m_pPixmap = new KSharedPixmap; +// m_pTimer = new QTimer( this ); + m_bInit = false; + m_bActive = false; + m_Desk=-1; +// m_bCustomPaint = false; + +// connect(kapp, SIGNAL(backgroundChanged(int)), SLOT(slotBackgroundChanged(int))); + connect(m_pPixmap, SIGNAL(done(bool)), SLOT(slotDone(bool))); +// connect(m_pTimer, SIGNAL(timeout()), SLOT(repaint())); + +// d->toplevel = m_pWidget->topLevelWidget(); +// d->toplevel->installEventFilter(this); +} + +KMyRootPixmap::~KMyRootPixmap() +{ + delete m_pPixmap; +// delete d; +} + +int KMyRootPixmap::currentDesktop() const +{ + NETRootInfo rinfo( qt_xdisplay(), NET::CurrentDesktop ); + rinfo.activate(); + return rinfo.currentDesktop(); +} + +void KMyRootPixmap::start() +{ + if (m_bActive) + return; + + m_bActive = true; + enableExports(); + return; +// if (m_bInit) +// repaint(true); +} + +void KMyRootPixmap::stop() +{ + m_bActive = false; +// m_pTimer->stop(); +} + + +void KMyRootPixmap::repaint() +{ + repaint(false); +} + +void KMyRootPixmap::repaint(bool force) +{ +// printf("KMyRootPixmap::repaint(%s)\n",force?"true":"false"); + if ((!force) && (m_Desk==currentDesktop()))return; + + m_Desk = currentDesktop(); + + if (!isAvailable()) + { + emit backgroundUpdated(NULL); + }else{ + // KSharedPixmap will correctly generate a tile for us. + m_pPixmap->loadFromShared(pixmapName(m_Desk)); + updateBackground( m_pPixmap ); + } +} + +bool KMyRootPixmap::isAvailable() +{ + return m_pPixmap->isAvailable(pixmapName(m_Desk)); +} + +QString KMyRootPixmap::pixmapName(int desk) +{ + QString pattern = QString("DESKTOP%1"); + int screen_number = DefaultScreen(qt_xdisplay()); + if (screen_number) { + pattern = QString("SCREEN%1-DESKTOP").arg(screen_number) + "%1"; + } + return pattern.arg( desk ); +} + + +void KMyRootPixmap::enableExports() +{ +// kdDebug(270) << k_lineinfo << "activating background exports.\n"; + DCOPClient *client = kapp->dcopClient(); + if (!client->isAttached()) + client->attach(); + QByteArray data; + QDataStream args( data, IO_WriteOnly ); + args << 1; + + QCString appname( "kdesktop" ); + int screen_number = DefaultScreen(qt_xdisplay()); + if ( screen_number ) + appname.sprintf("kdesktop-screen-%d", screen_number ); + + client->send( appname, "KBackgroundIface", "setExport(int)", data ); +} + + +void KMyRootPixmap::slotDone(bool success) +{ + if (!success) + { +// kdWarning(270) << k_lineinfo << "loading of desktop background failed.\n"; + return; + } + + // We need to test active as the pixmap might become available + // after the widget has been destroyed. + if ( m_bActive ) + updateBackground( m_pPixmap ); +} + +void KMyRootPixmap::updateBackground( KSharedPixmap *spm ) +{ +// printf("KMyRootPixmap::updateBackground(%p)\n",spm); + QPixmap *px=spm; + if (px->isNull() || px->width()==0 || px->height()==0) + { // This is NOT an image, something went wrong, update to plain + emit backgroundUpdated(NULL); + return; + } + KPixmapIO io; + QSize desktopsize(QApplication::desktop()->width(),QApplication::desktop()->height()); + + if (px->rect().size()==desktopsize) + { // Image has already the right dimension, make a quick update + QImage img = io.convertToImage(*spm); + emit backgroundUpdated(&img); + return; + }else{ // we need to create a tiled pixmap and then the image to update + QPixmap pix(desktopsize,spm->depth()); + QPainter pufferPainter(&pix); + + pufferPainter.drawTiledPixmap(pix.rect(),*spm); + + pufferPainter.end(); + + QImage img=io.convertToImage(pix); + emit backgroundUpdated(&img); + } +} + +// #include "krootpixmap.moc" +#endif diff --git a/client/myrootpixmap.h b/client/myrootpixmap.h new file mode 100644 index 0000000..dc0b72c --- /dev/null +++ b/client/myrootpixmap.h @@ -0,0 +1,98 @@ +/* vi: ts=8 sts=4 sw=4 + * + * $Id: krootpixmap.h,v 1.15 2003/05/19 08:02:48 coolo Exp $ + * This file is part of the KDE project, module kdesktop. + * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org> + * + * You can Freely distribute this program under the GNU Library General + * Public License. See the file "COPYING.LIB" for the exact licensing terms. + */ + +/* Modified by Sascha Hlusiak */ + + +#ifndef __KRootPixmap_h_Included__ +#define __KRootPixmap_h_Included__ + +#include <qobject.h> +#include <qcolor.h> + +#ifndef Q_WS_QWS //FIXME + +class QRect; +class QWidget; +class QTimer; +class KSharedPixmap; +class KMyRootPixmapData; + +class KMyRootPixmap: public QObject +{ + Q_OBJECT + +public: + KMyRootPixmap( QWidget *target=NULL, const char *name=0 ); + + KMyRootPixmap( QWidget *target, QObject *parent, const char *name=0 ); + + virtual ~KMyRootPixmap(); + + bool isAvailable(); + + bool isActive() const { return m_bActive; } + + int currentDesktop() const; + +// bool customPainting() const { return m_bCustomPaint; } + +#ifndef KDE_NO_COMPAT + + bool checkAvailable(bool) { return isAvailable(); } +#endif + +public slots: + virtual void start(); + + virtual void stop(); + +// void setFadeEffect(double strength, const QColor &color); + + void repaint( bool force ); + + void repaint(); + +// void setCustomPainting( bool enable ) { m_bCustomPaint = enable; } + + void enableExports(); + + static QString pixmapName(int desk); + +signals: + void backgroundUpdated( const QImage *pm ); + +protected: +// virtual bool eventFilter(QObject *, QEvent *); + + virtual void updateBackground( KSharedPixmap * ); + +private slots: +// void slotBackgroundChanged(int); + void slotDone(bool); + +private: + bool m_bActive, m_bInit/*, m_bCustomPaint*/; + int m_Desk; + +// double m_Fade; +// QColor m_FadeColor; + + QRect m_Rect; +// QWidget *m_pWidget; +// QTimer *m_pTimer; + KSharedPixmap *m_pPixmap; +// KMyRootPixmapData *d; + + void init(); +}; + +#endif // ! Q_WS_QWS +#endif // __KRootPixmap_h_Included__ |