summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--apps/Settings/Liquid.desktop7
-rw-r--r--noncore/styles/liquid/liquid.cpp57
-rw-r--r--noncore/styles/liquid/opie-liquid.control2
-rw-r--r--noncore/styles/liquid/settings/liquidset.cpp199
-rw-r--r--noncore/styles/liquid/settings/liquidset.h39
-rw-r--r--noncore/styles/liquid/settings/main.cpp34
-rw-r--r--noncore/styles/liquid/settings/settings.pro24
-rw-r--r--pics/liquid/Liquid.pngbin0 -> 2771 bytes
8 files changed, 357 insertions, 5 deletions
diff --git a/apps/Settings/Liquid.desktop b/apps/Settings/Liquid.desktop
new file mode 100644
index 0000000..8a1727f
--- a/dev/null
+++ b/apps/Settings/Liquid.desktop
@@ -0,0 +1,7 @@
1[Desktop Entry]
2Type=Application
3Exec=liquid-settings
4Icon=liquid/Liquid
5Name=Liquid-Settings
6Name[de]=Liquid-Einstellungen
7
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 5f014ad..4653639 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -83,12 +83,17 @@ void TransMenuHandler::reloadSettings()
83 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); 83 color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name()));
84 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); 84 fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name()));
85 opacity = config. readNumEntry("Opacity", 10); 85 opacity = config. readNumEntry("Opacity", 10);
86 if ( opacity < -20 )
87 opacity = 20;
88 else if ( opacity > 20 )
89 opacity = 20;
90
86 shadowText = config. readBoolEntry("ShadowText", true); 91 shadowText = config. readBoolEntry("ShadowText", true);
87} 92}
88 93
89bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) 94bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
90{ 95{
91 QPopupMenu *p = (QPopupMenu *)obj; 96 QWidget *p = (QWidget *)obj;
92 97
93 if(ev->type() == QEvent::Show){ 98 if(ev->type() == QEvent::Show){
94 if(type == TransStippleBg || type == TransStippleBtn || 99 if(type == TransStippleBg || type == TransStippleBtn ||
@@ -118,14 +123,50 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
118 else{ 123 else{
119 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); 124 QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
120 } 125 }
121 pixDict.insert(p->winId(), pix); 126
127 if (p->inherits("QPopupMenu"))
128 pixDict.insert(p->winId(), pix);
129 else {
130 p->setBackgroundPixmap(*pix);
131
132 QObjectList *ol = p-> queryList("QWidget");
133 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
134 QWidget *wid = (QWidget *) it.current ( );
135
136 wid-> setBackgroundPixmap(*pix);
137 wid-> setBackgroundOrigin(QWidget::ParentOrigin);
138 }
139 delete ol;
140 }
122 } 141 }
123 } 142 }
124 else if(ev->type() == QEvent::Hide){ 143 else if(ev->type() == QEvent::Hide){
125 if(type == TransStippleBg || type == TransStippleBtn || 144 if(type == TransStippleBg || type == TransStippleBtn ||
126 type == Custom){ 145 type == Custom){
127// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 146// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
128 pixDict.remove(p->winId()); 147
148 if (p->inherits("QPopupMenu"))
149 pixDict.remove(p->winId());
150 else {
151 p->setBackgroundMode(QWidget::PaletteBackground);
152
153 QObjectList *ol = p-> queryList("QWidget");
154 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
155 QWidget *wid = (QWidget *) it.current ( );
156
157 wid-> setBackgroundMode( QWidget::PaletteBackground );
158 }
159 delete ol;
160 }
161 }
162 }
163 else if(ev->type() == QEvent::Paint){
164 if(type == TransStippleBg || type == TransStippleBtn ||
165 type == Custom){
166// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
167
168 if (!p->inherits("QPopupMenu"))
169 p->erase();
129 } 170 }
130 } 171 }
131 return(false); 172 return(false);
@@ -796,10 +837,15 @@ void LiquidStyle::polish(QWidget *w)
796 } 837 }
797 if(w->inherits("QPopupMenu")) 838 if(w->inherits("QPopupMenu"))
798 w->setBackgroundMode(QWidget::NoBackground); 839 w->setBackgroundMode(QWidget::NoBackground);
799 840 else if(w-> testWFlags(Qt::WType_Popup)) {
841 printf("install popup: %s\n", w-> className ( ));
842 w->installEventFilter(menuHandler);
843 }
844
800 if(w->isTopLevel()){ 845 if(w->isTopLevel()){
801 return; 846 return;
802 } 847 }
848
803 849
804 w-> setBackgroundOrigin ( QWidget::ParentOrigin ); 850 w-> setBackgroundOrigin ( QWidget::ParentOrigin );
805 851
@@ -886,6 +932,9 @@ void LiquidStyle::unPolish(QWidget *w)
886 932
887 if(w->inherits("QPopupMenu")) 933 if(w->inherits("QPopupMenu"))
888 w->setBackgroundMode(QWidget::PaletteButton); 934 w->setBackgroundMode(QWidget::PaletteButton);
935 else if(w-> testWFlags(Qt::WType_Popup)) {
936 w->removeEventFilter(menuHandler);
937 }
889 938
890 if(w->isTopLevel()) 939 if(w->isTopLevel())
891 return; 940 return;
diff --git a/noncore/styles/liquid/opie-liquid.control b/noncore/styles/liquid/opie-liquid.control
index 7b6ae71..6311dee 100644
--- a/noncore/styles/liquid/opie-liquid.control
+++ b/noncore/styles/liquid/opie-liquid.control
@@ -1,4 +1,4 @@
1Files: plugins/styles/libliquid.so* 1Files: plugins/styles/libliquid.so* bin/liquid-settings apps/Settings/Liquid.desktop pics/liquid/Liquid.png
2Priority: optional 2Priority: optional
3Section: opie/system 3Section: opie/system
4Maintainer: Robert Griebl <sandman@handhelds.org> 4Maintainer: Robert Griebl <sandman@handhelds.org>
diff --git a/noncore/styles/liquid/settings/liquidset.cpp b/noncore/styles/liquid/settings/liquidset.cpp
new file mode 100644
index 0000000..0ef5dbe
--- a/dev/null
+++ b/noncore/styles/liquid/settings/liquidset.cpp
@@ -0,0 +1,199 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22
23#include "liquidset.h"
24#include "../liquid.h"
25
26#include <qpe/qpeapplication.h>
27#include <qpe/global.h>
28
29#include <qslider.h>
30#include <qtoolbutton.h>
31#include <qbuttongroup.h>
32#include <qradiobutton.h>
33#include <qcheckbox.h>
34#include <qlabel.h>
35#include <qlayout.h>
36#include <qpalette.h>
37
38#include <qpe/config.h>
39
40#include <opie/colorpopupmenu.h>
41
42
43static void changeButtonColor ( QWidget *btn, const QColor &col )
44{
45 QPalette pal = btn-> palette ( );
46
47 pal. setColor ( QPalette::Active, QColorGroup::Button, col );
48 pal. setColor ( QPalette::Disabled, QColorGroup::Button, col );
49 pal. setColor ( QPalette::Inactive, QColorGroup::Button, col );
50
51 btn-> setPalette ( pal );
52}
53
54
55LiquidSet::LiquidSet ( QWidget* parent, const char *name, WFlags fl )
56 : QDialog ( parent, name, fl )
57{
58 setCaption ( tr( "Liquid Style" ) );
59
60 Config config ( "qpe" );
61 config. setGroup ( "MosfetMenus" );
62
63 m_type = config. readNumEntry ( "Type", TransStippleBg );
64 m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( )));
65 m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( )));
66 int opacity = config. readNumEntry ( "Opacity", 10 );
67 m_shadow = config. readBoolEntry ( "ShadowText", true );
68
69 QVBoxLayout *vbox = new QVBoxLayout ( this );
70 vbox-> setSpacing ( 3 );
71 vbox-> setMargin ( 6 );
72
73 QButtonGroup *btngrp = new QButtonGroup ( this );
74 btngrp-> hide ( );
75
76 QRadioButton *rad;
77
78 rad = new QRadioButton ( tr( "No translucency" ), this );
79 btngrp-> insert ( rad, None );
80 vbox-> addWidget ( rad );
81
82 rad = new QRadioButton ( tr( "Stippled, background color" ), this );
83 btngrp-> insert ( rad, StippledBg );
84 vbox-> addWidget ( rad );
85
86 rad = new QRadioButton ( tr( "Stippled, button color" ), this );
87 btngrp-> insert ( rad, StippledBtn );
88 vbox-> addWidget ( rad );
89
90 rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this );
91 btngrp-> insert ( rad, TransStippleBg );
92 vbox-> addWidget ( rad );
93
94 rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this );
95 btngrp-> insert ( rad, TransStippleBtn );
96 vbox-> addWidget ( rad );
97
98 rad = new QRadioButton ( tr( "Custom translucency" ), this );
99 btngrp-> insert ( rad, Custom );
100 vbox-> addWidget ( rad );
101
102 btngrp-> setExclusive ( true );
103 btngrp-> setButton ( m_type );
104
105 QGridLayout *grid = new QGridLayout ( vbox );
106 grid-> addColSpacing ( 0, 16 );
107 grid-> addColSpacing ( 3, 8 );
108
109 grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 );
110 grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 );
111 grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 );
112
113 m_menubtn = new QToolButton ( this );
114 grid-> addWidget ( m_menubtn, 0, 2 );
115
116 QPopupMenu *popup;
117
118 popup = new ColorPopupMenu ( m_menucol, this );
119 m_menubtn-> setPopup ( popup );
120 m_menubtn-> setPopupDelay ( 0 );
121 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & )));
122 changeMenuColor ( m_menucol );
123
124 m_textbtn = new QToolButton ( this );
125 grid-> addWidget ( m_textbtn, 0, 5 );
126
127 popup = new ColorPopupMenu ( m_textcol, this );
128 m_textbtn-> setPopup ( popup );
129 m_textbtn-> setPopupDelay ( 0 );
130 connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & )));
131 changeTextColor ( m_textcol );
132
133 m_opacsld = new QSlider ( Horizontal, this );
134 m_opacsld-> setRange ( -20, 20 );
135 m_opacsld-> setValue ( opacity );
136 m_opacsld-> setTickmarks ( QSlider::Below );
137 grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 );
138
139 vbox-> addSpacing ( 4 );
140
141 QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed text" ), this );
142 shadow-> setChecked ( m_shadow );
143 vbox-> addWidget ( shadow );
144
145 vbox-> addStretch ( 10 );
146
147 connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) );
148 connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) );
149}
150
151void LiquidSet::changeType ( int t )
152{
153 bool custom = ( t == Custom );
154
155 m_menulbl-> setEnabled ( custom );
156 m_textlbl-> setEnabled ( custom );
157 m_opaclbl-> setEnabled ( custom );
158 m_menubtn-> setEnabled ( custom );
159 m_textbtn-> setEnabled ( custom );
160 m_opacsld-> setEnabled ( custom );
161
162 m_type = t;
163}
164
165void LiquidSet::changeMenuColor ( const QColor &col )
166{
167 m_menubtn-> setPalette ( col );
168 m_menucol = col;
169}
170
171void LiquidSet::changeTextColor ( const QColor &col )
172{
173 m_textbtn-> setPalette ( col );
174 m_textcol = col;
175}
176
177void LiquidSet::changeShadow ( bool b )
178{
179 m_shadow = b;
180}
181
182
183void LiquidSet::accept ( )
184{
185 Config config ( "qpe" );
186 config. setGroup ( "MosfetMenus" );
187
188 config. writeEntry ( "Type", m_type );
189 config. writeEntry ( "Color", m_menucol. name ( ));
190 config. writeEntry ( "TextColor", m_textcol. name ( ));
191 config. writeEntry ( "Opacity", m_opacsld-> value ( ));
192 config. writeEntry ( "ShadowText", m_shadow );
193 config. write ( );
194
195 Global::applyStyle ( );
196
197 QDialog::accept ( );
198}
199
diff --git a/noncore/styles/liquid/settings/liquidset.h b/noncore/styles/liquid/settings/liquidset.h
new file mode 100644
index 0000000..944b1ec
--- a/dev/null
+++ b/noncore/styles/liquid/settings/liquidset.h
@@ -0,0 +1,39 @@
1#ifndef __OPIE_LIQUID_SET_H__
2#define __OPIE_LIQUID_SET_H__
3
4#include <qdialog.h>
5#include <qcolor.h>
6
7class QLabel;
8class QToolButton;
9class QSlider;
10
11class LiquidSet : public QDialog {
12 Q_OBJECT
13
14public:
15 LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
16
17public slots:
18 void changeType ( int t );
19 void changeMenuColor ( const QColor &col );
20 void changeTextColor ( const QColor &col );
21 void changeShadow ( bool b );
22
23protected:
24 virtual void accept ( );
25
26private:
27 QColor m_menucol;
28 QColor m_textcol;
29 int m_type;
30 bool m_shadow;
31
32 QSlider * m_opacsld;
33 QLabel * m_menulbl;
34 QLabel * m_textlbl;
35 QLabel * m_opaclbl;
36 QToolButton *m_menubtn;
37 QToolButton *m_textbtn;
38};
39#endif
diff --git a/noncore/styles/liquid/settings/main.cpp b/noncore/styles/liquid/settings/main.cpp
new file mode 100644
index 0000000..fd69007
--- a/dev/null
+++ b/noncore/styles/liquid/settings/main.cpp
@@ -0,0 +1,34 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "liquidset.h"
22
23#include <qpe/qpeapplication.h>
24
25
26int main ( int argc, char** argv )
27{
28 QPEApplication a ( argc, argv );
29
30 LiquidSet dlg;
31 a. showMainWidget ( &dlg );
32
33 return a. exec ( );
34}
diff --git a/noncore/styles/liquid/settings/settings.pro b/noncore/styles/liquid/settings/settings.pro
new file mode 100644
index 0000000..b385d92
--- a/dev/null
+++ b/noncore/styles/liquid/settings/settings.pro
@@ -0,0 +1,24 @@
1 TEMPLATE= app
2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = liquidset.h
5 SOURCES = liquidset.cpp main.cpp
6INCLUDEPATH += $(OPIEDIR)/include
7 DEPENDPATH+= ../$(OPIEDIR)/include
8LIBS += -lqpe -lopie
9 TARGET = liquid-settings
10
11TRANSLATIONS = ../../../i18n/de/liquid-settings.ts \
12 ../../../i18n/en/liquid-settings.ts \
13 ../../../i18n/es/liquid-settings.ts \
14 ../../../i18n/fr/liquid-settings.ts \
15 ../../../i18n/hu/liquid-settings.ts \
16 ../../../i18n/ja/liquid-settings.ts \
17 ../../../i18n/ko/liquid-settings.ts \
18 ../../../i18n/no/liquid-settings.ts \
19 ../../../i18n/pl/liquid-settings.ts \
20 ../../../i18n/pt/liquid-settings.ts \
21 ../../../i18n/pt_BR/liquid-settings.ts \
22 ../../../i18n/sl/liquid-settings.ts \
23 ../../../i18n/zh_CN/liquid-settings.ts \
24 ../../../i18n/zh_TW/liquid-settings.ts
diff --git a/pics/liquid/Liquid.png b/pics/liquid/Liquid.png
new file mode 100644
index 0000000..67647d0
--- a/dev/null
+++ b/pics/liquid/Liquid.png
Binary files differ