diff options
author | onestone <onestone> | 2006-12-19 00:31:09 +0000 |
---|---|---|
committer | onestone <onestone> | 2006-12-19 00:31:09 +0000 |
commit | e44afc75929e20f93ed53bc9880d59d1feb66044 (patch) | |
tree | 33786a03bd64d8b75ae078ccc74da44887e17d20 | |
parent | 2f44397a29a96715e919bc5173e7dcfacbd16c78 (diff) | |
download | aquamarine-e44afc75929e20f93ed53bc9880d59d1feb66044.tar.gz aquamarine-e44afc75929e20f93ed53bc9880d59d1feb66044.tar.bz2 |
aquamarine: added aquamarine configuration to the kcontrol module
-rw-r--r-- | kcm/Makefile.am | 5 | ||||
-rw-r--r-- | kcm/aqsettings.kcfgc | 9 | ||||
-rw-r--r-- | kcm/aquamarine_ui.ui | 293 | ||||
-rw-r--r-- | kcm/beryl.desktop | 2 | ||||
-rw-r--r-- | kcm/main.cpp | 29 | ||||
-rw-r--r-- | kcm/main.h | 4 | ||||
-rw-r--r-- | src/aquamarine.kcfg | 4 | ||||
-rw-r--r-- | src/decorator.cpp | 14 | ||||
-rw-r--r-- | src/defaultShadow.cpp | 6 | ||||
-rw-r--r-- | src/window.cpp | 35 | ||||
-rw-r--r-- | src/window.h | 1 |
11 files changed, 387 insertions, 15 deletions
diff --git a/kcm/Makefile.am b/kcm/Makefile.am index 92d7acc..69bb3a6 100644 --- a/kcm/Makefile.am +++ b/kcm/Makefile.am @@ -2,7 +2,10 @@ INCLUDES = -I$(srcdir)/lib $(all_includes) kcm_beryl_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries) kcm_beryl_la_LIBADD = $(BERYLSETTINGS_LIBS) $(LIB_KDECORE) $(LIB_KDEUI) -kcm_beryl_la_SOURCES = main.cpp +kcm_beryl_la_SOURCES = main.cpp \ + aquamarine_ui.ui \ + aqsettings.kcfgc + KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS) diff --git a/kcm/aqsettings.kcfgc b/kcm/aqsettings.kcfgc new file mode 100644 index 0000000..51736df --- /dev/null +++ b/kcm/aqsettings.kcfgc @@ -0,0 +1,9 @@ +# Code generation options for kconfig_compiler +File=../src/aquamarine.kcfg +ClassName=AqSettings +Singleton=true +Mutators=false +# Inherits=KConfigSkeleton +# IncludeFiles= +# MemberVariables=public + diff --git a/kcm/aquamarine_ui.ui b/kcm/aquamarine_ui.ui new file mode 100644 index 0000000..b8592f3 --- /dev/null +++ b/kcm/aquamarine_ui.ui @@ -0,0 +1,293 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>AquamarineWidget</class> +<widget class="QWidget"> + <property name="name"> + <cstring>AquamarineWidget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>716</width> + <height>376</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>AquamarineWidget</string> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>Shadows</cstring> + </property> + <property name="geometry"> + <rect> + <x>310</x> + <y>20</y> + <width>280</width> + <height>210</height> + </rect> + </property> + <property name="title"> + <string>Shadows</string> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>80</y> + <width>151</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Shadow color:</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>110</y> + <width>161</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Shadow opacity:</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>140</y> + <width>171</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Shadow offset X:</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>150</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Shadow radius:</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>kcfg_DrawShadows</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>20</y> + <width>250</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Enab&le Shadows</string> + </property> + <property name="accel"> + <string>Alt+L</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_ShadowRadius</cstring> + </property> + <property name="geometry"> + <rect> + <x>180</x> + <y>50</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_ShadowOpacity</cstring> + </property> + <property name="geometry"> + <rect> + <x>180</x> + <y>110</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_ShadowOffsetX</cstring> + </property> + <property name="geometry"> + <rect> + <x>180</x> + <y>140</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>kcfg_ShadowColor</cstring> + </property> + <property name="geometry"> + <rect> + <x>180</x> + <y>80</y> + <width>60</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_ShadowOffsetY</cstring> + </property> + <property name="geometry"> + <rect> + <x>180</x> + <y>170</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>170</y> + <width>150</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Shadow offset Y:</string> + </property> + </widget> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>270</width> + <height>210</height> + </rect> + </property> + <property name="title"> + <string>Opacity</string> + </property> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_ActiveOpacity</cstring> + </property> + <property name="geometry"> + <rect> + <x>190</x> + <y>50</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>50</y> + <width>150</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Active window opacity:</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>kcfg_InactiveOpacity</cstring> + </property> + <property name="geometry"> + <rect> + <x>190</x> + <y>80</y> + <width>60</width> + <height>20</height> + </rect> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="geometry"> + <rect> + <x>10</x> + <y>80</y> + <width>140</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Inactive window opacity:</string> + </property> + </widget> + </widget> +</widget> +<customwidgets> +</customwidgets> +<slots> + <slot>kcfg_DrawShadows_clicked()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> +</includehints> +</UI> diff --git a/kcm/beryl.desktop b/kcm/beryl.desktop index 00a7b5b..c139022 100644 --- a/kcm/beryl.desktop +++ b/kcm/beryl.desktop @@ -8,4 +8,6 @@ X-KDE-Library=beryl X-KDE-FactoryName=beryl X-KDE-ParentApp=kcontrol +Name=Beryl + Categories=Qt;KDE;X-KDE-settings-looknfeel; diff --git a/kcm/main.cpp b/kcm/main.cpp index 4157bec..7cdfdc0 100644 --- a/kcm/main.cpp +++ b/kcm/main.cpp @@ -19,21 +19,27 @@ * */ +#include "aqsettings.h" + +#include <qtabwidget.h> +#include <qlayout.h> + #include <kapplication.h> #include <kaboutdata.h> #include <kconfig.h> +#include <kdialog.h> #include <kdebug.h> #include <dcopclient.h> #include <kgenericfactory.h> #include "main.h" +#include "aquamarine_ui.h" typedef KGenericFactory<KCMBeryl, QWidget> KCMBerylFactory; K_EXPORT_COMPONENT_FACTORY( kcm_beryl, KCMBerylFactory("kcmberyl")) KCMBeryl::~KCMBeryl( ) { - printf("Unload\n"); } KCMBeryl::KCMBeryl(QWidget *parent, const char *name, const QStringList &) @@ -47,17 +53,38 @@ KCMBeryl::KCMBeryl(QWidget *parent, const char *name, const QStringList &) about->addAuthor("Dennis Kasprzyk", 0, "onestone@beryl-project.org"); setAboutData( about ); + + m_tabs = new QTabWidget( this ); + + + AquamarineWidget *aq = new AquamarineWidget(m_tabs, "Aquamarine"); + m_tabs->addTab(aq, "Aquamarine"); + + addConfig(AqSettings::self(),aq); + + QVBoxLayout *top = new QVBoxLayout( this, 0, KDialog::spacingHint() ); + top->addWidget( m_tabs ); + + load(); } + void KCMBeryl::load() { + KCModule::load(); } void KCMBeryl::save() { + KCModule::save(); + DCOPClient *client = kapp->dcopClient(); + if (!client->isAttached()) + client->attach(); + client->send("kwin", "KWinInterface", "reconfigure()", ""); } void KCMBeryl::defaults() { + KCModule::defaults(); } @@ -24,7 +24,7 @@ #include <kcmodule.h> - +class QTabWidget; class KCMBeryl: public KCModule { @@ -40,6 +40,8 @@ public: private: + QTabWidget *m_tabs; + }; diff --git a/src/aquamarine.kcfg b/src/aquamarine.kcfg index ce89fa6..216642b 100644 --- a/src/aquamarine.kcfg +++ b/src/aquamarine.kcfg @@ -19,9 +19,9 @@ </entry> <entry name="ShadowOpacity" type="Double"> <label>Shadow opacity (darkness).</label> - <default>.5</default> + <default>80</default> <min>0</min> - <max>1</max> + <max>100</max> </entry> <entry name="ShadowOffsetX" type="Int"> <label>Shadow X offset (distance).</label> diff --git a/src/decorator.cpp b/src/decorator.cpp index 6e6fcd0..8da5808 100644 --- a/src/decorator.cpp +++ b/src/decorator.cpp @@ -419,20 +419,26 @@ Aquamarine::Decorator::reconfigure () m_config->reparseConfiguration (); unsigned long changed = m_options->updateSettings (); + for (QMap < WId, Aquamarine::Window * >::ConstIterator it = + m_windows.constBegin (); it != m_windows.constEnd (); ++it) + it.data ()->updateConfig (); + + + if (m_defShadow) + delete m_defShadow; + m_defShadow = (Settings::drawShadows())? new Aquamarine::DefaultShadow () : NULL; + #ifdef HAVE_BERYL_SETTINGS beryl_settings_send_reload_signal(); #endif - if (m_plugins->reset (changed)) + if (m_plugins->reset (changed)) { for (QMap < WId, Aquamarine::Window * >::ConstIterator it = m_windows.constBegin (); it != m_windows.constEnd (); ++it) it.data ()->reloadDecoration (); m_defDeco->reloadDecoration (); m_defDecoActive->reloadDecoration (); - if (m_defShadow) - delete m_defShadow; - m_defShadow = (Settings::drawShadows())? new Aquamarine::DefaultShadow () : NULL; m_plugins->destroyPreviousPlugin (); } } diff --git a/src/defaultShadow.cpp b/src/defaultShadow.cpp index c89119d..d44b437 100644 --- a/src/defaultShadow.cpp +++ b/src/defaultShadow.cpp @@ -57,12 +57,16 @@ Aquamarine::DefaultShadow::DefaultShadow () { + + double op = Settings::shadowOpacity() / 100.0; + op *= 0xffff; + m_sradius = Settings::shadowRadius(); QColor color = Settings::shadowColor(); m_scolor[0] = short((color.red() / 256.0) * 0xffff); m_scolor[1] = short((color.green() / 256.0) * 0xffff); m_scolor[2] = short((color.blue() / 256.0) * 0xffff); - m_scolor[3] = short(Settings::shadowOpacity() * 0xffff); + m_scolor[3] = short(op); // shifted shadows do not work now /* diff --git a/src/window.cpp b/src/window.cpp index 0453975..46debec 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -130,12 +130,15 @@ m_brightness_menu (0), m_saturation_menu (0), m_opacity_menu (0) setBackgroundColor(QColor(0,0)); + double op = Settings::shadowOpacity() / 100.0; + op *= 0xffff; + m_sradius = Settings::shadowRadius(); QColor color = Settings::shadowColor(); m_scolor[0] = short((color.red() / 256.0) * 0xffff); m_scolor[1] = short((color.green() / 256.0) * 0xffff); m_scolor[2] = short((color.blue() / 256.0) * 0xffff); - m_scolor[3] = short(Settings::shadowOpacity() * 0xffff); + m_scolor[3] = short(op); int offX = Settings::shadowOffsetX(); int offY = Settings::shadowOffsetY(); @@ -1101,29 +1104,51 @@ Aquamarine::Window::updateWindowGeometry () } void -Aquamarine::Window::reloadDecoration () +Aquamarine::Window::updateConfig () { - delete m_deco; - m_deco = 0; + if (!m_deco) return; + + double op = Settings::shadowOpacity() / 100.0; + op *= 0xffff; m_sradius = Settings::shadowRadius(); QColor color = Settings::shadowColor(); m_scolor[0] = short((color.red() / 256.0) * 0xffff); m_scolor[1] = short((color.green() / 256.0) * 0xffff); m_scolor[2] = short((color.blue() / 256.0) * 0xffff); - m_scolor[3] = short(Settings::shadowOpacity() * 0xffff); + m_scolor[3] = short(op); int offX = Settings::shadowOffsetX(); int offY = Settings::shadowOffsetY(); offX = KMAX(-m_sradius,KMIN(m_sradius,offX)); offY = KMAX(-m_sradius,KMIN(m_sradius,offY)); + m_deco->widget()->move(m_soffset.left(),m_soffset.top()); + if (Settings::drawShadows()) m_soffset.setCoords(-m_sradius + offX,-m_sradius + offY, m_sradius + offX,m_sradius + offY); else m_soffset.setCoords(0,0,0,0); + m_deco->widget()->move(-m_soffset.left(),-m_soffset.top()); + + resizeDecoration(); + updateWindowProperties(); + + if (m_shapeSet) + { + m_shapeChange = m_shape; + renderShadow(); + } +} + +void +Aquamarine::Window::reloadDecoration () +{ + delete m_deco; + m_deco = 0; + createDecoration (); } diff --git a/src/window.h b/src/window.h index 20b40df..bcdd4dc 100644 --- a/src/window.h +++ b/src/window.h @@ -117,6 +117,7 @@ namespace Aquamarine void moveWindow (QMouseEvent * qme); void reloadDecoration (); + void updateConfig (); void updateState (); void updateName (); |