author | sandman <sandman> | 2002-06-27 20:23:25 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-27 20:23:25 (UTC) |
commit | c9871ef295afed6bc4f4cc5451f46bf3b6e8d462 (patch) (unidiff) | |
tree | 2fa3264c0a847100d1368df6e1eae2dd5b7a47ac | |
parent | 9cd1aef30015628e06e8f24b9b7e91acb631b52b (diff) | |
download | opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.zip opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.tar.gz opie-c9871ef295afed6bc4f4cc5451f46bf3b6e8d462.tar.bz2 |
Enhanced liquid style:
1) All WType_Popup's now get a transparent background (volume-applet)
2) Settings/Liquid Settings - a new app that acts like the KDE Control
Panel page for Liquid
-rw-r--r-- | apps/Settings/Liquid.desktop | 7 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 57 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.control | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/liquidset.cpp | 199 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/liquidset.h | 39 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/main.cpp | 34 | ||||
-rw-r--r-- | noncore/styles/liquid/settings/settings.pro | 24 | ||||
-rw-r--r-- | pics/liquid/Liquid.png | bin | 0 -> 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] | ||
2 | Type=Application | ||
3 | Exec=liquid-settings | ||
4 | Icon=liquid/Liquid | ||
5 | Name=Liquid-Settings | ||
6 | Name[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 | |||
@@ -62,91 +62,132 @@ void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | |||
62 | data[x] = qRgb(r, g, b); | 62 | data[x] = qRgb(r, g, b); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | pix.convertFromImage(img); | 65 | pix.convertFromImage(img); |
66 | } | 66 | } |
67 | 67 | ||
68 | TransMenuHandler::TransMenuHandler(QObject *parent) | 68 | TransMenuHandler::TransMenuHandler(QObject *parent) |
69 | : QObject(parent) | 69 | : QObject(parent) |
70 | { | 70 | { |
71 | pixDict.setAutoDelete(true); | 71 | pixDict.setAutoDelete(true); |
72 | reloadSettings(); | 72 | reloadSettings(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void TransMenuHandler::reloadSettings() | 75 | void TransMenuHandler::reloadSettings() |
76 | { | 76 | { |
77 | pixDict.clear(); | 77 | pixDict.clear(); |
78 | 78 | ||
79 | Config config ( "qpe" ); | 79 | Config config ( "qpe" ); |
80 | config. setGroup ( "MosfetMenus" ); | 80 | config. setGroup ( "MosfetMenus" ); |
81 | 81 | ||
82 | type = config. readNumEntry("Type", TransStippleBg); | 82 | type = config. readNumEntry("Type", TransStippleBg); |
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 | ||
89 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 94 | bool 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 || |
95 | type == Custom){ | 100 | type == Custom){ |
96 | QApplication::syncX(); | 101 | QApplication::syncX(); |
97 | QPixmap *pix = new QPixmap; | 102 | QPixmap *pix = new QPixmap; |
98 | if(p->testWFlags(Qt::WType_Popup)){ | 103 | if(p->testWFlags(Qt::WType_Popup)){ |
99 | QRect r(p->x(), p->y(), p->width(), p->height()); | 104 | QRect r(p->x(), p->y(), p->width(), p->height()); |
100 | QRect deskR = QApplication::desktop()->rect(); | 105 | QRect deskR = QApplication::desktop()->rect(); |
101 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ | 106 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ |
102 | r.setBottom(deskR.bottom()); | 107 | r.setBottom(deskR.bottom()); |
103 | r.setRight(deskR.right()); | 108 | r.setRight(deskR.right()); |
104 | } | 109 | } |
105 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 110 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
106 | r.width(), r.height()); | 111 | r.width(), r.height()); |
107 | } | 112 | } |
108 | else{ // tear off menu | 113 | else{ // tear off menu |
109 | pix->resize(p->width(), p->height()); | 114 | pix->resize(p->width(), p->height()); |
110 | pix->fill(Qt::black.rgb()); | 115 | pix->fill(Qt::black.rgb()); |
111 | } | 116 | } |
112 | if(type == TransStippleBg){ | 117 | if(type == TransStippleBg){ |
113 | stripePixmap(*pix, p->colorGroup().background()); | 118 | stripePixmap(*pix, p->colorGroup().background()); |
114 | } | 119 | } |
115 | else if(type == TransStippleBtn){ | 120 | else if(type == TransStippleBtn){ |
116 | stripePixmap(*pix, p->colorGroup().button()); | 121 | stripePixmap(*pix, p->colorGroup().button()); |
117 | } | 122 | } |
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); |
132 | } | 173 | } |
133 | 174 | ||
134 | 175 | ||
135 | LiquidStyle::LiquidStyle() | 176 | LiquidStyle::LiquidStyle() |
136 | :QWindowsStyle() | 177 | :QWindowsStyle() |
137 | { | 178 | { |
138 | setName ( "LiquidStyle" ); | 179 | setName ( "LiquidStyle" ); |
139 | 180 | ||
140 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 181 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
141 | btnMaskBmp.setMask(btnMaskBmp); | 182 | btnMaskBmp.setMask(btnMaskBmp); |
142 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 183 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
143 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); | 184 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); |
144 | headerHoverID = -1; | 185 | headerHoverID = -1; |
145 | highlightWidget = NULL; | 186 | highlightWidget = NULL; |
146 | setButtonDefaultIndicatorWidth(0); | 187 | setButtonDefaultIndicatorWidth(0); |
147 | btnDict.setAutoDelete(true); | 188 | btnDict.setAutoDelete(true); |
148 | bevelFillDict.setAutoDelete(true); | 189 | bevelFillDict.setAutoDelete(true); |
149 | smallBevelFillDict.setAutoDelete(true); | 190 | smallBevelFillDict.setAutoDelete(true); |
150 | customBtnColorList.setAutoDelete(true); | 191 | customBtnColorList.setAutoDelete(true); |
151 | customBtnIconList.setAutoDelete(true); | 192 | customBtnIconList.setAutoDelete(true); |
152 | customBtnLabelList.setAutoDelete(true); | 193 | customBtnLabelList.setAutoDelete(true); |
@@ -775,52 +816,57 @@ void LiquidStyle::polish(QPalette &appPal) | |||
775 | it.toFirst(); | 816 | it.toFirst(); |
776 | while ((w=it.current()) != 0 ){ | 817 | while ((w=it.current()) != 0 ){ |
777 | ++it; | 818 | ++it; |
778 | if(w->inherits("QLineEdit")){ | 819 | if(w->inherits("QLineEdit")){ |
779 | QPalette pal = w->palette(); | 820 | QPalette pal = w->palette(); |
780 | pal.setBrush(QColorGroup::Base, baseBrush); | 821 | pal.setBrush(QColorGroup::Base, baseBrush); |
781 | w->setPalette(pal); | 822 | w->setPalette(pal); |
782 | } | 823 | } |
783 | else if(w->inherits("QPushButton")){ | 824 | else if(w->inherits("QPushButton")){ |
784 | applyCustomAttributes((QPushButton *)w); | 825 | applyCustomAttributes((QPushButton *)w); |
785 | } | 826 | } |
786 | } | 827 | } |
787 | 828 | ||
788 | } | 829 | } |
789 | 830 | ||
790 | void LiquidStyle::polish(QWidget *w) | 831 | void LiquidStyle::polish(QWidget *w) |
791 | { | 832 | { |
792 | if(w->inherits("QMenuBar")){ | 833 | if(w->inherits("QMenuBar")){ |
793 | //((QFrame*)w)->setLineWidth(0); | 834 | //((QFrame*)w)->setLineWidth(0); |
794 | w->setBackgroundMode(QWidget::PaletteBackground); | 835 | w->setBackgroundMode(QWidget::PaletteBackground); |
795 | return; | 836 | return; |
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 | ||
806 | if(w->inherits("QComboBox") || | 852 | if(w->inherits("QComboBox") || |
807 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 853 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
808 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 854 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
809 | w->installEventFilter(this); | 855 | w->installEventFilter(this); |
810 | } | 856 | } |
811 | if(w->inherits("QLineEdit")){ | 857 | if(w->inherits("QLineEdit")){ |
812 | QPalette pal = w->palette(); | 858 | QPalette pal = w->palette(); |
813 | pal.setBrush(QColorGroup::Base, baseBrush); | 859 | pal.setBrush(QColorGroup::Base, baseBrush); |
814 | w->setPalette(pal); | 860 | w->setPalette(pal); |
815 | } | 861 | } |
816 | if(w->inherits("QPushButton")){ | 862 | if(w->inherits("QPushButton")){ |
817 | applyCustomAttributes((QPushButton *)w); | 863 | applyCustomAttributes((QPushButton *)w); |
818 | w->installEventFilter(this); | 864 | w->installEventFilter(this); |
819 | } | 865 | } |
820 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 866 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
821 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 867 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
822 | } | 868 | } |
823 | 869 | ||
824 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 870 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
825 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 871 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
826 | bool isViewportChild = w->parent() && | 872 | bool isViewportChild = w->parent() && |
@@ -865,48 +911,51 @@ void LiquidStyle::polish(QWidget *w) | |||
865 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 911 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
866 | if(w->backgroundMode() == QWidget::PaletteBackground || | 912 | if(w->backgroundMode() == QWidget::PaletteBackground || |
867 | w->backgroundMode() == QWidget::PaletteButton){ | 913 | w->backgroundMode() == QWidget::PaletteButton){ |
868 | w->setBackgroundMode(QWidget::X11ParentRelative); | 914 | w->setBackgroundMode(QWidget::X11ParentRelative); |
869 | } | 915 | } |
870 | } | 916 | } |
871 | if(w->inherits("QToolBar")){ | 917 | if(w->inherits("QToolBar")){ |
872 | w->installEventFilter(this); | 918 | w->installEventFilter(this); |
873 | w->setBackgroundMode(QWidget::PaletteBackground); | 919 | w->setBackgroundMode(QWidget::PaletteBackground); |
874 | return; | 920 | return; |
875 | } | 921 | } |
876 | 922 | ||
877 | } | 923 | } |
878 | 924 | ||
879 | void LiquidStyle::unPolish(QWidget *w) | 925 | void LiquidStyle::unPolish(QWidget *w) |
880 | { | 926 | { |
881 | if(w->inherits("QMenuBar")){ | 927 | if(w->inherits("QMenuBar")){ |
882 | ((QFrame *)w)->setLineWidth(1); | 928 | ((QFrame *)w)->setLineWidth(1); |
883 | w->setBackgroundMode(QWidget::PaletteBackground); | 929 | w->setBackgroundMode(QWidget::PaletteBackground); |
884 | return; | 930 | return; |
885 | } | 931 | } |
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; |
892 | 941 | ||
893 | // for viewport children, don't just check for NoBackground.... | 942 | // for viewport children, don't just check for NoBackground.... |
894 | bool isViewportChild = w->parent() && | 943 | bool isViewportChild = w->parent() && |
895 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 944 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
896 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 945 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
897 | 946 | ||
898 | w->setPalette(QApplication::palette()); | 947 | w->setPalette(QApplication::palette()); |
899 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 948 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
900 | if(w->inherits("QPushButton")) | 949 | if(w->inherits("QPushButton")) |
901 | w->setBackgroundMode(QWidget::PaletteButton); | 950 | w->setBackgroundMode(QWidget::PaletteButton); |
902 | else | 951 | else |
903 | w->setBackgroundMode(QWidget::PaletteBackground); | 952 | w->setBackgroundMode(QWidget::PaletteBackground); |
904 | } | 953 | } |
905 | 954 | ||
906 | if(isViewportChild) | 955 | if(isViewportChild) |
907 | w->setAutoMask(false); | 956 | w->setAutoMask(false); |
908 | 957 | ||
909 | if(w->inherits("QPushButton")){ | 958 | if(w->inherits("QPushButton")){ |
910 | unapplyCustomAttributes((QPushButton *)w); | 959 | unapplyCustomAttributes((QPushButton *)w); |
911 | w->removeEventFilter(this); | 960 | w->removeEventFilter(this); |
912 | } | 961 | } |
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,10 +1,10 @@ | |||
1 | Files: plugins/styles/libliquid.so* | 1 | Files: plugins/styles/libliquid.so* bin/liquid-settings apps/Settings/Liquid.desktop pics/liquid/Liquid.png |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/system | 3 | Section: opie/system |
4 | Maintainer: Robert Griebl <sandman@handhelds.org> | 4 | Maintainer: Robert Griebl <sandman@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: $QPE_VERSION-$SUB_VERSION.1 | 6 | Version: $QPE_VERSION-$SUB_VERSION.1 |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION) |
8 | Description: Liquid style by Mosfet. | 8 | Description: Liquid style by Mosfet. |
9 | Mosfet's well known Liquid GUI style from KDE, | 9 | Mosfet's well known Liquid GUI style from KDE, |
10 | ported to OPIE. | 10 | ported to OPIE. |
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 | |||
43 | static 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 | |||
55 | LiquidSet::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 | |||
151 | void 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 | |||
165 | void LiquidSet::changeMenuColor ( const QColor &col ) | ||
166 | { | ||
167 | m_menubtn-> setPalette ( col ); | ||
168 | m_menucol = col; | ||
169 | } | ||
170 | |||
171 | void LiquidSet::changeTextColor ( const QColor &col ) | ||
172 | { | ||
173 | m_textbtn-> setPalette ( col ); | ||
174 | m_textcol = col; | ||
175 | } | ||
176 | |||
177 | void LiquidSet::changeShadow ( bool b ) | ||
178 | { | ||
179 | m_shadow = b; | ||
180 | } | ||
181 | |||
182 | |||
183 | void 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 | |||
7 | class QLabel; | ||
8 | class QToolButton; | ||
9 | class QSlider; | ||
10 | |||
11 | class LiquidSet : public QDialog { | ||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | LiquidSet ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | ||
16 | |||
17 | public slots: | ||
18 | void changeType ( int t ); | ||
19 | void changeMenuColor ( const QColor &col ); | ||
20 | void changeTextColor ( const QColor &col ); | ||
21 | void changeShadow ( bool b ); | ||
22 | |||
23 | protected: | ||
24 | virtual void accept ( ); | ||
25 | |||
26 | private: | ||
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 | |||
26 | int 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 | ||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDPATH+= ../$(OPIEDIR)/include | ||
8 | LIBS += -lqpe -lopie | ||
9 | TARGET = liquid-settings | ||
10 | |||
11 | TRANSLATIONS = ../../../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 | |||