-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 28 | ||||
-rw-r--r-- | noncore/styles/liquid/liquid.h | 1 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.cpp | 58 | ||||
-rw-r--r-- | noncore/styles/liquid/liquidset.h | 2 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 350 |
5 files changed, 313 insertions, 126 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 87b5488..22bf8af 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -76,192 +76,194 @@ TransMenuHandler::TransMenuHandler(QObject *parent) | |||
76 | void TransMenuHandler::reloadSettings() | 76 | void TransMenuHandler::reloadSettings() |
77 | { | 77 | { |
78 | pixDict.clear(); | 78 | pixDict.clear(); |
79 | 79 | ||
80 | Config config ( "qpe" ); | 80 | Config config ( "qpe" ); |
81 | config. setGroup ( "Liquid-Style" ); | 81 | config. setGroup ( "Liquid-Style" ); |
82 | 82 | ||
83 | type = config. readNumEntry("Type", TransStippleBg); | 83 | type = config. readNumEntry("Type", TransStippleBg); |
84 | color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | 84 | color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); |
85 | fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | 85 | fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); |
86 | opacity = config. readNumEntry("Opacity", 10); | 86 | opacity = config. readNumEntry("Opacity", 10); |
87 | if ( opacity < -20 ) | 87 | if ( opacity < -20 ) |
88 | opacity = 20; | 88 | opacity = 20; |
89 | else if ( opacity > 20 ) | 89 | else if ( opacity > 20 ) |
90 | opacity = 20; | 90 | opacity = 20; |
91 | 91 | ||
92 | shadowText = config. readBoolEntry("ShadowText", true); | 92 | shadowText = config. readBoolEntry("ShadowText", true); |
93 | } | 93 | } |
94 | 94 | ||
95 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 95 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) |
96 | { | 96 | { |
97 | QWidget *p = (QWidget *)obj; | 97 | QWidget *p = (QWidget *)obj; |
98 | 98 | ||
99 | if(ev->type() == QEvent::Show){ | 99 | if(ev->type() == QEvent::Show){ |
100 | if(type == TransStippleBg || type == TransStippleBtn || | 100 | if(type == TransStippleBg || type == TransStippleBtn || |
101 | type == Custom){ | 101 | type == Custom){ |
102 | QApplication::syncX(); | 102 | QApplication::syncX(); |
103 | QPixmap *pix = new QPixmap; | 103 | QPixmap *pix = new QPixmap; |
104 | if(p->testWFlags(Qt::WType_Popup)){ | 104 | if(p->testWFlags(Qt::WType_Popup)){ |
105 | QRect r(p->x(), p->y(), p->width(), p->height()); | 105 | QRect r(p->x(), p->y(), p->width(), p->height()); |
106 | QRect deskR = QApplication::desktop()->rect(); | 106 | QRect deskR = QApplication::desktop()->rect(); |
107 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ | 107 | if(r.right() > deskR.right() || r.bottom() > deskR.bottom()){ |
108 | r.setBottom(deskR.bottom()); | 108 | r.setBottom(deskR.bottom()); |
109 | r.setRight(deskR.right()); | 109 | r.setRight(deskR.right()); |
110 | } | 110 | } |
111 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 111 | *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
112 | r.width(), r.height()); | 112 | r.width(), r.height()); |
113 | } | 113 | } |
114 | else{ // tear off menu | 114 | else{ // tear off menu |
115 | pix->resize(p->width(), p->height()); | 115 | pix->resize(p->width(), p->height()); |
116 | pix->fill(Qt::black.rgb()); | 116 | pix->fill(Qt::black.rgb()); |
117 | } | 117 | } |
118 | if(type == TransStippleBg){ | 118 | if(type == TransStippleBg){ |
119 | stripePixmap(*pix, p->colorGroup().background()); | 119 | stripePixmap(*pix, p->colorGroup().background()); |
120 | } | 120 | } |
121 | else if(type == TransStippleBtn){ | 121 | else if(type == TransStippleBtn){ |
122 | stripePixmap(*pix, p->colorGroup().button()); | 122 | stripePixmap(*pix, p->colorGroup().button()); |
123 | } | 123 | } |
124 | else{ | 124 | else{ |
125 | QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 125 | QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
126 | } | 126 | } |
127 | 127 | ||
128 | pixDict.insert(p->winId(), pix); | 128 | pixDict.insert(p->winId(), pix); |
129 | 129 | ||
130 | if (!p->inherits("QPopupMenu")) { | 130 | if (!p->inherits("QPopupMenu")) { |
131 | p->setBackgroundPixmap(*pix); | 131 | p->setBackgroundPixmap(*pix); |
132 | 132 | ||
133 | QObjectList *ol = p-> queryList("QWidget"); | 133 | QObjectList *ol = p-> queryList("QWidget"); |
134 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 134 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
135 | QWidget *wid = (QWidget *) it.current ( ); | 135 | QWidget *wid = (QWidget *) it.current ( ); |
136 | 136 | ||
137 | wid-> setBackgroundPixmap(*pix); | 137 | wid-> setBackgroundPixmap(*pix); |
138 | wid-> setBackgroundOrigin(QWidget::ParentOrigin); | 138 | wid-> setBackgroundOrigin(QWidget::ParentOrigin); |
139 | } | 139 | } |
140 | delete ol; | 140 | delete ol; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | else if(ev->type() == QEvent::Hide){ | 144 | else if(ev->type() == QEvent::Hide){ |
145 | if(type == TransStippleBg || type == TransStippleBtn || | 145 | if(type == TransStippleBg || type == TransStippleBtn || |
146 | type == Custom){ | 146 | type == Custom){ |
147 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 147 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
148 | 148 | ||
149 | pixDict.remove(p->winId()); | 149 | pixDict.remove(p->winId()); |
150 | if (!p->inherits("QPopupMenu")) { | 150 | if (!p->inherits("QPopupMenu")) { |
151 | p->setBackgroundMode(QWidget::PaletteBackground); | 151 | p->setBackgroundMode(QWidget::PaletteBackground); |
152 | 152 | ||
153 | QObjectList *ol = p-> queryList("QWidget"); | 153 | QObjectList *ol = p-> queryList("QWidget"); |
154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
155 | QWidget *wid = (QWidget *) it.current ( ); | 155 | QWidget *wid = (QWidget *) it.current ( ); |
156 | 156 | ||
157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); | 157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); |
158 | } | 158 | } |
159 | delete ol; | 159 | delete ol; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | } | 162 | } |
163 | return(false); | 163 | return(false); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | LiquidStyle::LiquidStyle() | 167 | LiquidStyle::LiquidStyle() |
168 | :QWindowsStyle() | 168 | :QWindowsStyle() |
169 | { | 169 | { |
170 | setName ( "LiquidStyle" ); | 170 | setName ( "LiquidStyle" ); |
171 | 171 | ||
172 | flatTBButtons = false; | ||
173 | |||
172 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 174 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
173 | btnMaskBmp.setMask(btnMaskBmp); | 175 | btnMaskBmp.setMask(btnMaskBmp); |
174 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 176 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
175 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); | 177 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); |
176 | headerHoverID = -1; | 178 | headerHoverID = -1; |
177 | highlightWidget = NULL; | 179 | highlightWidget = NULL; |
178 | setButtonDefaultIndicatorWidth(0); | 180 | setButtonDefaultIndicatorWidth(0); |
179 | btnDict.setAutoDelete(true); | 181 | btnDict.setAutoDelete(true); |
180 | bevelFillDict.setAutoDelete(true); | 182 | bevelFillDict.setAutoDelete(true); |
181 | smallBevelFillDict.setAutoDelete(true); | 183 | smallBevelFillDict.setAutoDelete(true); |
182 | customBtnColorList.setAutoDelete(true); | 184 | customBtnColorList.setAutoDelete(true); |
183 | customBtnIconList.setAutoDelete(true); | 185 | customBtnIconList.setAutoDelete(true); |
184 | customBtnLabelList.setAutoDelete(true); | 186 | customBtnLabelList.setAutoDelete(true); |
185 | 187 | ||
186 | rMatrix.rotate(270.0); | 188 | rMatrix.rotate(270.0); |
187 | highcolor = QPixmap::defaultDepth() > 8; | 189 | highcolor = QPixmap::defaultDepth() > 8; |
188 | btnBorderPix = new QPixmap; | 190 | btnBorderPix = new QPixmap; |
189 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | 191 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); |
190 | btnBlendPix = new QPixmap; | 192 | btnBlendPix = new QPixmap; |
191 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); | 193 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); |
192 | bevelFillPix = new QPixmap; | 194 | bevelFillPix = new QPixmap; |
193 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); | 195 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); |
194 | smallBevelFillPix = new QPixmap; | 196 | smallBevelFillPix = new QPixmap; |
195 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); | 197 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); |
196 | // new stuff | 198 | // new stuff |
197 | vsbSliderFillPix = menuPix = NULL; | 199 | vsbSliderFillPix = menuPix = NULL; |
198 | menuHandler = new TransMenuHandler(this); | 200 | menuHandler = new TransMenuHandler(this); |
199 | setScrollBarExtent(15, 15); | 201 | setScrollBarExtent(15, 15); |
200 | int i; | 202 | int i; |
201 | for(i=0; i < BITMAP_ITEMS; ++i){ | 203 | for(i=0; i < BITMAP_ITEMS; ++i){ |
202 | pixmaps[i] = NULL; | 204 | pixmaps[i] = NULL; |
203 | } | 205 | } |
204 | oldSliderThickness = sliderThickness(); | 206 | oldSliderThickness = sliderThickness(); |
205 | setSliderThickness(11); | 207 | setSliderThickness(11); |
206 | } | 208 | } |
207 | 209 | ||
208 | LiquidStyle::~LiquidStyle() | 210 | LiquidStyle::~LiquidStyle() |
209 | { | 211 | { |
210 | if(btnBorderPix) | 212 | if(btnBorderPix) |
211 | delete btnBorderPix; | 213 | delete btnBorderPix; |
212 | if(btnBlendPix) | 214 | if(btnBlendPix) |
213 | delete btnBlendPix; | 215 | delete btnBlendPix; |
214 | if(bevelFillPix) | 216 | if(bevelFillPix) |
215 | delete bevelFillPix; | 217 | delete bevelFillPix; |
216 | if(smallBevelFillPix) | 218 | if(smallBevelFillPix) |
217 | delete smallBevelFillPix; | 219 | delete smallBevelFillPix; |
218 | if(vsbSliderFillPix) | 220 | if(vsbSliderFillPix) |
219 | delete vsbSliderFillPix; | 221 | delete vsbSliderFillPix; |
220 | if(menuPix) | 222 | if(menuPix) |
221 | delete menuPix; | 223 | delete menuPix; |
222 | 224 | ||
223 | setScrollBarExtent(16, 16); | 225 | setScrollBarExtent(16, 16); |
224 | setSliderThickness(oldSliderThickness); | 226 | setSliderThickness(oldSliderThickness); |
225 | int i; | 227 | int i; |
226 | for(i=0; i < BITMAP_ITEMS; ++i){ | 228 | for(i=0; i < BITMAP_ITEMS; ++i){ |
227 | if(pixmaps[i]) | 229 | if(pixmaps[i]) |
228 | delete pixmaps[i]; | 230 | delete pixmaps[i]; |
229 | } | 231 | } |
230 | } | 232 | } |
231 | 233 | ||
232 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, | 234 | void LiquidStyle::drawClearBevel(QPainter *p, int x, int y, int w, int h, |
233 | const QColor &c, const QColor &bg) | 235 | const QColor &c, const QColor &bg) |
234 | { | 236 | { |
235 | 237 | ||
236 | QPen oldPen = p->pen(); // headers need this | 238 | QPen oldPen = p->pen(); // headers need this |
237 | int x2 = x+w-1; | 239 | int x2 = x+w-1; |
238 | int y2 = y+h-1; | 240 | int y2 = y+h-1; |
239 | // outer dark rect | 241 | // outer dark rect |
240 | p->setPen(c.dark(130)); | 242 | p->setPen(c.dark(130)); |
241 | p->drawLine(x, y+2, x, y2-2); // l | 243 | p->drawLine(x, y+2, x, y2-2); // l |
242 | p->drawLine(x2, y+2, x2, y2-2); // r | 244 | p->drawLine(x2, y+2, x2, y2-2); // r |
243 | p->drawLine(x+2, y, x2-2, y); // t | 245 | p->drawLine(x+2, y, x2-2, y); // t |
244 | p->drawLine(x+2, y2, x2-2, y2); // b | 246 | p->drawLine(x+2, y2, x2-2, y2); // b |
245 | p->drawPoint(x+1, y+1); // tl | 247 | p->drawPoint(x+1, y+1); // tl |
246 | p->drawPoint(x2-1, y+1); // tr | 248 | p->drawPoint(x2-1, y+1); // tr |
247 | p->drawPoint(x+1, y2-1); // bl | 249 | p->drawPoint(x+1, y2-1); // bl |
248 | p->drawPoint(x2-1, y2-1); // br | 250 | p->drawPoint(x2-1, y2-1); // br |
249 | 251 | ||
250 | // inner top light lines | 252 | // inner top light lines |
251 | p->setPen(c.light(105)); | 253 | p->setPen(c.light(105)); |
252 | p->drawLine(x+2, y+1, x2-2, y+1); | 254 | p->drawLine(x+2, y+1, x2-2, y+1); |
253 | p->drawLine(x+1, y+2, x2-1, y+2); | 255 | p->drawLine(x+1, y+2, x2-1, y+2); |
254 | p->drawLine(x+1, y+3, x+2, y+3); | 256 | p->drawLine(x+1, y+3, x+2, y+3); |
255 | p->drawLine(x2-2, y+3, x2-1, y+3); | 257 | p->drawLine(x2-2, y+3, x2-1, y+3); |
256 | p->drawPoint(x+1, y+4); | 258 | p->drawPoint(x+1, y+4); |
257 | p->drawPoint(x2-1, y+4); | 259 | p->drawPoint(x2-1, y+4); |
258 | 260 | ||
259 | // inner bottom light lines | 261 | // inner bottom light lines |
260 | p->setPen(c.light(110)); | 262 | p->setPen(c.light(110)); |
261 | p->drawLine(x+2, y2-1, x2-2, y2-1); | 263 | p->drawLine(x+2, y2-1, x2-2, y2-1); |
262 | p->drawLine(x+1, y2-2, x2-1, y2-2); | 264 | p->drawLine(x+1, y2-2, x2-1, y2-2); |
263 | p->drawLine(x+1, y2-3, x+2, y2-3); | 265 | p->drawLine(x+1, y2-3, x+2, y2-3); |
264 | p->drawLine(x2-2, y2-3, x2-1, y2-3); | 266 | p->drawLine(x2-2, y2-3, x2-1, y2-3); |
265 | p->drawPoint(x+1, y2-4); | 267 | p->drawPoint(x+1, y2-4); |
266 | p->drawPoint(x2-1, y2-4); | 268 | p->drawPoint(x2-1, y2-4); |
267 | 269 | ||
@@ -738,362 +740,368 @@ void LiquidStyle::polish(QPalette &appPal) | |||
738 | menuPix->fill(c.rgb()); | 740 | menuPix->fill(c.rgb()); |
739 | painter.begin(menuPix); | 741 | painter.begin(menuPix); |
740 | painter.setPen(c.dark(105)); | 742 | painter.setPen(c.dark(105)); |
741 | for(i=0; i < 63; i+=4){ | 743 | for(i=0; i < 63; i+=4){ |
742 | painter.drawLine(0, i, 63, i); | 744 | painter.drawLine(0, i, 63, i); |
743 | painter.drawLine(0, i+1, 63, i+1); | 745 | painter.drawLine(0, i+1, 63, i+1); |
744 | }; | 746 | }; |
745 | painter.end(); | 747 | painter.end(); |
746 | menuBrush.setColor(c); | 748 | menuBrush.setColor(c); |
747 | menuBrush.setPixmap(*menuPix); | 749 | menuBrush.setPixmap(*menuPix); |
748 | 750 | ||
749 | // pager brush | 751 | // pager brush |
750 | c = c.dark(120); | 752 | c = c.dark(120); |
751 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 753 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
752 | if(!pix){ | 754 | if(!pix){ |
753 | int h, s, v; | 755 | int h, s, v; |
754 | c.hsv(&h, &s, &v); | 756 | c.hsv(&h, &s, &v); |
755 | pix = new QPixmap(*smallBevelFillPix); | 757 | pix = new QPixmap(*smallBevelFillPix); |
756 | adjustHSV(*pix, h, s, v); | 758 | adjustHSV(*pix, h, s, v); |
757 | smallBevelFillDict.insert(c.rgb(), pix); | 759 | smallBevelFillDict.insert(c.rgb(), pix); |
758 | } | 760 | } |
759 | pagerHoverBrush.setColor(c); | 761 | pagerHoverBrush.setColor(c); |
760 | pagerHoverBrush.setPixmap(*pix); | 762 | pagerHoverBrush.setPixmap(*pix); |
761 | 763 | ||
762 | c = c.dark(120); | 764 | c = c.dark(120); |
763 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 765 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
764 | if(!pix){ | 766 | if(!pix){ |
765 | int h, s, v; | 767 | int h, s, v; |
766 | c.hsv(&h, &s, &v); | 768 | c.hsv(&h, &s, &v); |
767 | pix = new QPixmap(*smallBevelFillPix); | 769 | pix = new QPixmap(*smallBevelFillPix); |
768 | adjustHSV(*pix, h, s, v); | 770 | adjustHSV(*pix, h, s, v); |
769 | smallBevelFillDict.insert(c.rgb(), pix); | 771 | smallBevelFillDict.insert(c.rgb(), pix); |
770 | } | 772 | } |
771 | pagerBrush.setColor(c); | 773 | pagerBrush.setColor(c); |
772 | pagerBrush.setPixmap(*pix); | 774 | pagerBrush.setPixmap(*pix); |
773 | 775 | ||
774 | // background color stuff | 776 | // background color stuff |
775 | c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); | 777 | c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); |
776 | c.hsv(&bH, &bS, &bV); | 778 | c.hsv(&bH, &bS, &bV); |
777 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 779 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
778 | 780 | ||
779 | // FIXME? | 781 | // FIXME? |
780 | if(vsbSliderFillPix) | 782 | if(vsbSliderFillPix) |
781 | delete vsbSliderFillPix; | 783 | delete vsbSliderFillPix; |
782 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); | 784 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); |
783 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); | 785 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); |
784 | 786 | ||
785 | // background brush | 787 | // background brush |
786 | QPixmap wallPaper(32, 32); | 788 | QPixmap wallPaper(32, 32); |
787 | wallPaper.fill(c.rgb()); | 789 | wallPaper.fill(c.rgb()); |
788 | painter.begin(&wallPaper); | 790 | painter.begin(&wallPaper); |
789 | for(i=0; i < 32; i+=4){ | 791 | for(i=0; i < 32; i+=4){ |
790 | painter.setPen(c.dark(100 + contrast)); | 792 | painter.setPen(c.dark(100 + contrast)); |
791 | painter.drawLine(0, i, 32, i); | 793 | painter.drawLine(0, i, 32, i); |
792 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | 794 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); |
793 | painter.drawLine(0, i+1, 32, i+1); | 795 | painter.drawLine(0, i+1, 32, i+1); |
794 | }; | 796 | }; |
795 | painter.end(); | 797 | painter.end(); |
796 | bgBrush.setColor(c); | 798 | bgBrush.setColor(c); |
797 | bgBrush.setPixmap(wallPaper); | 799 | bgBrush.setPixmap(wallPaper); |
798 | appPal.setBrush(QColorGroup::Background, bgBrush); | 800 | appPal.setBrush(QColorGroup::Background, bgBrush); |
799 | 801 | ||
800 | // lineedits | 802 | // lineedits |
801 | c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); | 803 | c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); |
802 | QPixmap basePix; | 804 | QPixmap basePix; |
803 | basePix.resize(32, 32); | 805 | basePix.resize(32, 32); |
804 | basePix.fill(c.rgb()); | 806 | basePix.fill(c.rgb()); |
805 | painter.begin(&basePix); | 807 | painter.begin(&basePix); |
806 | painter.setPen(c.dark(105)); | 808 | painter.setPen(c.dark(105)); |
807 | for(i=0; i < 32; i+=4){ | 809 | for(i=0; i < 32; i+=4){ |
808 | painter.drawLine(0, i, 32, i); | 810 | painter.drawLine(0, i, 32, i); |
809 | painter.drawLine(0, i+1, 32, i+1); | 811 | painter.drawLine(0, i+1, 32, i+1); |
810 | }; | 812 | }; |
811 | painter.end(); | 813 | painter.end(); |
812 | baseBrush.setColor(c); | 814 | baseBrush.setColor(c); |
813 | baseBrush.setPixmap(basePix); | 815 | baseBrush.setPixmap(basePix); |
814 | it.toFirst(); | 816 | it.toFirst(); |
815 | while ((w=it.current()) != 0 ){ | 817 | while ((w=it.current()) != 0 ){ |
816 | ++it; | 818 | ++it; |
817 | if(w->inherits("QLineEdit")){ | 819 | if(w->inherits("QLineEdit")){ |
818 | QPalette pal = w->palette(); | 820 | QPalette pal = w->palette(); |
819 | pal.setBrush(QColorGroup::Base, baseBrush); | 821 | pal.setBrush(QColorGroup::Base, baseBrush); |
820 | w->setPalette(pal); | 822 | w->setPalette(pal); |
821 | } | 823 | } |
822 | else if(w->inherits("QPushButton")){ | 824 | else if(w->inherits("QPushButton")){ |
823 | applyCustomAttributes((QPushButton *)w); | 825 | applyCustomAttributes((QPushButton *)w); |
824 | } | 826 | } |
825 | } | 827 | } |
826 | 828 | ||
827 | } | 829 | } |
828 | 830 | ||
829 | void LiquidStyle::polish(QWidget *w) | 831 | void LiquidStyle::polish(QWidget *w) |
830 | { | 832 | { |
831 | if(w->inherits("QMenuBar")){ | 833 | if(w->inherits("QMenuBar")){ |
832 | //((QFrame*)w)->setLineWidth(0); | 834 | //((QFrame*)w)->setLineWidth(0); |
833 | w->setBackgroundMode(QWidget::PaletteBackground); | 835 | w->setBackgroundMode(QWidget::PaletteBackground); |
836 | w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
837 | return; | ||
838 | } | ||
839 | if(w->inherits("QToolBar")){ | ||
840 | w->installEventFilter(this); | ||
841 | w->setBackgroundMode(QWidget::PaletteBackground); | ||
842 | w->setBackgroundOrigin(QWidget::WidgetOrigin); | ||
834 | return; | 843 | return; |
835 | } | 844 | } |
836 | if(w->inherits("QPopupMenu")) | 845 | if(w->inherits("QPopupMenu")) |
837 | w->setBackgroundMode(QWidget::NoBackground); | 846 | w->setBackgroundMode(QWidget::NoBackground); |
838 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 847 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
839 | w->installEventFilter(menuHandler); | 848 | w->installEventFilter(menuHandler); |
840 | } | 849 | } |
841 | 850 | ||
842 | if(w->isTopLevel()){ | 851 | if(w->isTopLevel()){ |
843 | return; | 852 | return; |
844 | } | 853 | } |
845 | 854 | ||
846 | 855 | ||
847 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | 856 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) |
848 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 857 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); |
849 | 858 | ||
850 | if(w->inherits("QComboBox") || | 859 | if(w->inherits("QComboBox") || |
851 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 860 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
852 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 861 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
853 | w->installEventFilter(this); | 862 | w->installEventFilter(this); |
854 | } | 863 | } |
855 | if(w->inherits("QLineEdit")){ | 864 | if(w->inherits("QLineEdit")){ |
856 | QPalette pal = w->palette(); | 865 | QPalette pal = w->palette(); |
857 | pal.setBrush(QColorGroup::Base, baseBrush); | 866 | pal.setBrush(QColorGroup::Base, baseBrush); |
858 | w->setPalette(pal); | 867 | w->setPalette(pal); |
859 | } | 868 | } |
860 | if(w->inherits("QPushButton")){ | 869 | if(w->inherits("QPushButton")){ |
861 | applyCustomAttributes((QPushButton *)w); | 870 | applyCustomAttributes((QPushButton *)w); |
862 | w->installEventFilter(this); | 871 | w->installEventFilter(this); |
863 | } | 872 | } |
864 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 873 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
865 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 874 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
866 | } | 875 | } |
867 | 876 | ||
868 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 877 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
869 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 878 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
870 | bool isViewportChild = w->parent() && | 879 | bool isViewportChild = w->parent() && |
871 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 880 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
872 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 881 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
873 | 882 | ||
874 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ | 883 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ |
875 | w->setBackgroundMode(QWidget::X11ParentRelative); | 884 | w->setBackgroundMode(QWidget::X11ParentRelative); |
876 | return; | 885 | return; |
877 | } | 886 | } |
878 | if(isViewportChild){ | 887 | if(isViewportChild){ |
879 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 888 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
880 | if(w->parent()){ // heh, only way to test for KHTML children ;-) | 889 | if(w->parent()){ // heh, only way to test for KHTML children ;-) |
881 | if(w->parent()->parent()){ | 890 | if(w->parent()->parent()){ |
882 | if(w->parent()->parent()->parent() && | 891 | if(w->parent()->parent()->parent() && |
883 | w->parent()->parent()->parent()->inherits("KHTMLView")){ | 892 | w->parent()->parent()->parent()->inherits("KHTMLView")){ |
884 | w->setAutoMask(true); | 893 | w->setAutoMask(true); |
885 | w->setBackgroundMode(QWidget::NoBackground); | 894 | w->setBackgroundMode(QWidget::NoBackground); |
886 | } | 895 | } |
887 | } | 896 | } |
888 | } | 897 | } |
889 | return; | 898 | return; |
890 | } | 899 | } |
891 | } | 900 | } |
892 | if(w->inherits("QHeader")){ | 901 | if(w->inherits("QHeader")){ |
893 | w->setMouseTracking(true); | 902 | w->setMouseTracking(true); |
894 | w->installEventFilter(this); | 903 | w->installEventFilter(this); |
895 | } | 904 | } |
896 | if(w-> inherits("QToolButton")) { | 905 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
897 | ((QToolButton*)w)->setAutoRaise (false); | 906 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
907 | if ( flatTBButtons ) | ||
908 | w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
898 | } | 909 | } |
899 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 910 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
900 | return; | 911 | return; |
901 | } | 912 | } |
902 | 913 | ||
903 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 914 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
904 | palette().active().brush(QColorGroup::Background).pixmap()){ | 915 | palette().active().brush(QColorGroup::Background).pixmap()){ |
905 | qWarning("No parent pixmap for child widget %s", w->className()); | 916 | qWarning("No parent pixmap for child widget %s", w->className()); |
906 | return; | 917 | return; |
907 | } | 918 | } |
908 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 919 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
909 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 920 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
910 | if(w->backgroundMode() == QWidget::PaletteBackground || | 921 | if(w->backgroundMode() == QWidget::PaletteBackground || |
911 | w->backgroundMode() == QWidget::PaletteButton){ | 922 | w->backgroundMode() == QWidget::PaletteButton){ |
912 | w->setBackgroundMode(QWidget::X11ParentRelative); | 923 | w->setBackgroundMode(QWidget::X11ParentRelative); |
913 | } | 924 | } |
914 | } | 925 | } |
915 | if(w->inherits("QToolBar")){ | ||
916 | w->installEventFilter(this); | ||
917 | w->setBackgroundMode(QWidget::PaletteBackground); | ||
918 | return; | ||
919 | } | ||
920 | 926 | ||
921 | } | 927 | } |
922 | 928 | ||
923 | void LiquidStyle::unPolish(QWidget *w) | 929 | void LiquidStyle::unPolish(QWidget *w) |
924 | { | 930 | { |
925 | if(w->inherits("QMenuBar")){ | 931 | if(w->inherits("QMenuBar")){ |
926 | ((QFrame *)w)->setLineWidth(1); | 932 | ((QFrame *)w)->setLineWidth(1); |
927 | w->setBackgroundMode(QWidget::PaletteBackground); | 933 | w->setBackgroundMode(QWidget::PaletteBackground); |
928 | return; | 934 | return; |
929 | } | 935 | } |
930 | 936 | ||
931 | if(w->inherits("QPopupMenu")) | 937 | if(w->inherits("QPopupMenu")) |
932 | w->setBackgroundMode(QWidget::PaletteButton); | 938 | w->setBackgroundMode(QWidget::PaletteButton); |
933 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 939 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
934 | w->removeEventFilter(menuHandler); | 940 | w->removeEventFilter(menuHandler); |
935 | } | 941 | } |
936 | 942 | ||
937 | if(w->isTopLevel()) | 943 | if(w->isTopLevel()) |
938 | return; | 944 | return; |
939 | 945 | ||
940 | // for viewport children, don't just check for NoBackground.... | 946 | // for viewport children, don't just check for NoBackground.... |
941 | bool isViewportChild = w->parent() && | 947 | bool isViewportChild = w->parent() && |
942 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 948 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
943 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 949 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
944 | 950 | ||
945 | w->setPalette(QApplication::palette()); | 951 | w->setPalette(QApplication::palette()); |
946 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 952 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
947 | if(w->inherits("QPushButton")) | 953 | if(w->inherits("QPushButton")) |
948 | w->setBackgroundMode(QWidget::PaletteButton); | 954 | w->setBackgroundMode(QWidget::PaletteButton); |
949 | else | 955 | else |
950 | w->setBackgroundMode(QWidget::PaletteBackground); | 956 | w->setBackgroundMode(QWidget::PaletteBackground); |
951 | } | 957 | } |
952 | 958 | ||
953 | if(isViewportChild) | 959 | if(isViewportChild) |
954 | w->setAutoMask(false); | 960 | w->setAutoMask(false); |
955 | 961 | ||
956 | if(w->inherits("QPushButton")){ | 962 | if(w->inherits("QPushButton")){ |
957 | unapplyCustomAttributes((QPushButton *)w); | 963 | unapplyCustomAttributes((QPushButton *)w); |
958 | w->removeEventFilter(this); | 964 | w->removeEventFilter(this); |
959 | } | 965 | } |
960 | /* | 966 | /* |
961 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 967 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
962 | w-> setBackgroundMode ( PaletteBackground ); | 968 | w-> setBackgroundMode ( PaletteBackground ); |
963 | } | 969 | } |
964 | */ | 970 | */ |
965 | if(w->inherits("QComboBox") || | 971 | if(w->inherits("QComboBox") || |
966 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 972 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
967 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 973 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
968 | w->removeEventFilter(this); | 974 | w->removeEventFilter(this); |
969 | } | 975 | } |
970 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 976 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
971 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ | 977 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ |
972 | w->setAutoMask(false); | 978 | w->setAutoMask(false); |
973 | } | 979 | } |
974 | } | 980 | } |
975 | if(w->inherits("QToolBar")){ | 981 | if(w->inherits("QToolBar")){ |
976 | w->removeEventFilter(this); | 982 | w->removeEventFilter(this); |
977 | w->setBackgroundMode(QWidget::PaletteBackground); | 983 | w->setBackgroundMode(QWidget::PaletteBackground); |
978 | return; | 984 | return; |
979 | } | 985 | } |
980 | if(w->inherits("QHeader")){ | 986 | if(w->inherits("QHeader")){ |
981 | w->setMouseTracking(false); | 987 | w->setMouseTracking(false); |
982 | w->removeEventFilter(this); | 988 | w->removeEventFilter(this); |
983 | } | 989 | } |
984 | } | 990 | } |
985 | 991 | ||
986 | void LiquidStyle::polish(QApplication *app) | 992 | void LiquidStyle::polish(QApplication *app) |
987 | { | 993 | { |
988 | 994 | ||
989 | QWindowsStyle::polish(app); | 995 | QWindowsStyle::polish(app); |
990 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 996 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
991 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 997 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
992 | if(menuAni) | 998 | if(menuAni) |
993 | app->setEffectEnabled(UI_AnimateMenu, false); | 999 | app->setEffectEnabled(UI_AnimateMenu, false); |
994 | if(menuFade) | 1000 | if(menuFade) |
995 | app->setEffectEnabled(UI_FadeMenu, false); | 1001 | app->setEffectEnabled(UI_FadeMenu, false); |
996 | 1002 | ||
997 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 1003 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
998 | 1004 | ||
999 | Config config ( "qpe" ); | 1005 | Config config ( "qpe" ); |
1000 | config. setGroup ( "Liquid-Style" ); | 1006 | config. setGroup ( "Liquid-Style" ); |
1001 | 1007 | ||
1002 | if ( config. readBoolEntry ( "WinDecoration", true )) | 1008 | if ( config. readBoolEntry ( "WinDecoration", true )) |
1003 | QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 1009 | QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
1010 | |||
1011 | flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | ||
1004 | } | 1012 | } |
1005 | 1013 | ||
1006 | void LiquidStyle::unPolish(QApplication *app) | 1014 | void LiquidStyle::unPolish(QApplication *app) |
1007 | { | 1015 | { |
1008 | QWindowsStyle::unPolish(app); | 1016 | QWindowsStyle::unPolish(app); |
1009 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 1017 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
1010 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 1018 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
1011 | 1019 | ||
1012 | qt_set_draw_menu_bar_impl ( 0 ); | 1020 | qt_set_draw_menu_bar_impl ( 0 ); |
1013 | 1021 | ||
1014 | QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 1022 | QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
1015 | } | 1023 | } |
1016 | 1024 | ||
1017 | /* | 1025 | /* |
1018 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1026 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
1019 | * force everything to erase and repaint on resize. This is going away, I'm | 1027 | * force everything to erase and repaint on resize. This is going away, I'm |
1020 | * trying to get shaped widgets to work right without masking. QPushButton, | 1028 | * trying to get shaped widgets to work right without masking. QPushButton, |
1021 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order | 1029 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order |
1022 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and | 1030 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and |
1023 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and | 1031 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and |
1024 | * caches them in QPixmapCache, which is bad for doing things like hover | 1032 | * caches them in QPixmapCache, which is bad for doing things like hover |
1025 | * because the style methods aren't called in paintEvents if everything | 1033 | * because the style methods aren't called in paintEvents if everything |
1026 | * is cached. We use our own Paint event handler instead. Taskbuttons and | 1034 | * is cached. We use our own Paint event handler instead. Taskbuttons and |
1027 | * pager buttons draw into a pixmap buffer, so we handle those with palette | 1035 | * pager buttons draw into a pixmap buffer, so we handle those with palette |
1028 | * modifications. For QHeader, different header items are actually one widget | 1036 | * modifications. For QHeader, different header items are actually one widget |
1029 | * that draws multiple items, so we need to check which ID is hightlighted | 1037 | * that draws multiple items, so we need to check which ID is hightlighted |
1030 | * and draw it. Finally, we also check enter and leave events for QLineEdit, | 1038 | * and draw it. Finally, we also check enter and leave events for QLineEdit, |
1031 | * since if it's inside a combobox we want to highlight the combobox during | 1039 | * since if it's inside a combobox we want to highlight the combobox during |
1032 | * hovering in the edit. | 1040 | * hovering in the edit. |
1033 | */ | 1041 | */ |
1034 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 1042 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
1035 | { | 1043 | { |
1036 | if(obj->inherits("QToolBar")){ | 1044 | if(obj->inherits("QToolBar")){ |
1037 | if(ev->type() == QEvent::Resize){ | 1045 | if(ev->type() == QEvent::Resize){ |
1038 | const QObjectList *tbChildList = obj->children(); | 1046 | const QObjectList *tbChildList = obj->children(); |
1039 | QObjectListIt it(*tbChildList); | 1047 | QObjectListIt it(*tbChildList); |
1040 | QObject *child; | 1048 | QObject *child; |
1041 | while((child = it.current()) != NULL){ | 1049 | while((child = it.current()) != NULL){ |
1042 | ++it; | 1050 | ++it; |
1043 | if(child->isWidgetType()) | 1051 | if(child->isWidgetType()) |
1044 | ((QWidget *)child)->repaint(true); | 1052 | ((QWidget *)child)->repaint(true); |
1045 | } | 1053 | } |
1046 | 1054 | ||
1047 | } | 1055 | } |
1048 | } | 1056 | } |
1049 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 1057 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
1050 | QWidget *btn = (QWidget *)obj; | 1058 | QWidget *btn = (QWidget *)obj; |
1051 | if(ev->type() == QEvent::Enter){ | 1059 | if(ev->type() == QEvent::Enter){ |
1052 | if(btn->isEnabled()){ | 1060 | if(btn->isEnabled()){ |
1053 | highlightWidget = btn; | 1061 | highlightWidget = btn; |
1054 | btn->repaint(false); | 1062 | btn->repaint(false); |
1055 | } | 1063 | } |
1056 | } | 1064 | } |
1057 | else if(ev->type() == QEvent::Leave){ | 1065 | else if(ev->type() == QEvent::Leave){ |
1058 | if(btn == highlightWidget){ | 1066 | if(btn == highlightWidget){ |
1059 | highlightWidget = NULL; | 1067 | highlightWidget = NULL; |
1060 | btn->repaint(false); | 1068 | btn->repaint(false); |
1061 | } | 1069 | } |
1062 | } | 1070 | } |
1063 | } | 1071 | } |
1064 | else if(obj->inherits("QToolButton")){ | 1072 | else if(obj->inherits("QToolButton")){ |
1065 | QToolButton *btn = (QToolButton *)btn; | 1073 | QToolButton *btn = (QToolButton *)btn; |
1066 | if(!btn->autoRaise()){ | 1074 | if(!btn->autoRaise()){ |
1067 | if(btn->isEnabled()){ | 1075 | if(btn->isEnabled()){ |
1068 | highlightWidget = btn; | 1076 | highlightWidget = btn; |
1069 | btn->repaint(false); | 1077 | btn->repaint(false); |
1070 | } | 1078 | } |
1071 | } | 1079 | } |
1072 | else if(ev->type() == QEvent::Leave){ | 1080 | else if(ev->type() == QEvent::Leave){ |
1073 | QWidget *btn = (QWidget *)obj; | 1081 | QWidget *btn = (QWidget *)obj; |
1074 | if(btn == highlightWidget){ | 1082 | if(btn == highlightWidget){ |
1075 | highlightWidget = NULL; | 1083 | highlightWidget = NULL; |
1076 | btn->repaint(false); | 1084 | btn->repaint(false); |
1077 | } | 1085 | } |
1078 | } | 1086 | } |
1079 | else | 1087 | else |
1080 | highlightWidget = NULL; | 1088 | highlightWidget = NULL; |
1081 | } | 1089 | } |
1082 | else if(obj->inherits("QScrollBar")){ | 1090 | else if(obj->inherits("QScrollBar")){ |
1083 | QScrollBar *sb = (QScrollBar *)obj; | 1091 | QScrollBar *sb = (QScrollBar *)obj; |
1084 | if(ev->type() == QEvent::Enter){ | 1092 | if(ev->type() == QEvent::Enter){ |
1085 | if(sb->isEnabled()){ | 1093 | if(sb->isEnabled()){ |
1086 | highlightWidget = sb; | 1094 | highlightWidget = sb; |
1087 | sb->repaint(false); | 1095 | sb->repaint(false); |
1088 | } | 1096 | } |
1089 | } | 1097 | } |
1090 | else if(ev->type() == QEvent::Leave){ | 1098 | else if(ev->type() == QEvent::Leave){ |
1091 | if(sb == highlightWidget && !sb->draggingSlider()){ | 1099 | if(sb == highlightWidget && !sb->draggingSlider()){ |
1092 | highlightWidget = NULL; | 1100 | highlightWidget = NULL; |
1093 | sb->repaint(false); | 1101 | sb->repaint(false); |
1094 | } | 1102 | } |
1095 | } | 1103 | } |
1096 | else if(ev->type() == QEvent::MouseButtonRelease){ | 1104 | else if(ev->type() == QEvent::MouseButtonRelease){ |
1097 | QMouseEvent *me = (QMouseEvent *)ev; | 1105 | QMouseEvent *me = (QMouseEvent *)ev; |
1098 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | 1106 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ |
1099 | highlightWidget = NULL; | 1107 | highlightWidget = NULL; |
@@ -1905,194 +1913,196 @@ void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | |||
1905 | if(state == QButton::On){ | 1913 | if(state == QButton::On){ |
1906 | p->setPen(Qt::black); | 1914 | p->setPen(Qt::black); |
1907 | p->drawPixmap(3, 3, xBmp); | 1915 | p->drawPixmap(3, 3, xBmp); |
1908 | } | 1916 | } |
1909 | else{ | 1917 | else{ |
1910 | p->setPen(g.dark()); | 1918 | p->setPen(g.dark()); |
1911 | p->drawRect(x+2, y+2, w-4, h-4); | 1919 | p->drawRect(x+2, y+2, w-4, h-4); |
1912 | p->setPen(Qt::black); | 1920 | p->setPen(Qt::black); |
1913 | p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); | 1921 | p->drawLine(x+3, (y+h)/2-2, x+w-4, (y+h)/2-2); |
1914 | p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); | 1922 | p->drawLine(x+3, (y+h)/2, x+w-4, (y+h)/2); |
1915 | p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); | 1923 | p->drawLine(x+3, (y+h)/2+2, x+w-4, (y+h)/2+2); |
1916 | }*/ | 1924 | }*/ |
1917 | } | 1925 | } |
1918 | else | 1926 | else |
1919 | p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); | 1927 | p->drawPixmap(x, y, isHover ? *getPixmap(CBHover) : *getPixmap(CB)); |
1920 | } | 1928 | } |
1921 | } | 1929 | } |
1922 | 1930 | ||
1923 | void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 1931 | void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
1924 | int /*state*/) | 1932 | int /*state*/) |
1925 | { | 1933 | { |
1926 | // needed for some reason by KHtml, even tho it's all filled ;P | 1934 | // needed for some reason by KHtml, even tho it's all filled ;P |
1927 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); | 1935 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); |
1928 | 1936 | ||
1929 | } | 1937 | } |
1930 | 1938 | ||
1931 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, | 1939 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, |
1932 | const QColorGroup &/*g*/, Orientation orient, | 1940 | const QColorGroup &/*g*/, Orientation orient, |
1933 | bool, bool) | 1941 | bool, bool) |
1934 | { | 1942 | { |
1935 | QWidget *parent = (QWidget *)p->device(); | 1943 | QWidget *parent = (QWidget *)p->device(); |
1936 | p->setBrushOrigin(parent->pos()); | 1944 | p->setBrushOrigin(parent->pos()); |
1937 | parent->erase(x, y, w, h); | 1945 | parent->erase(x, y, w, h); |
1938 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : | 1946 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : |
1939 | *getPixmap(VSlider)); | 1947 | *getPixmap(VSlider)); |
1940 | } | 1948 | } |
1941 | 1949 | ||
1942 | void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 1950 | void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
1943 | Orientation orient, bool, bool) | 1951 | Orientation orient, bool, bool) |
1944 | { | 1952 | { |
1945 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : | 1953 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : |
1946 | *getPixmap(VSlider)->mask()); | 1954 | *getPixmap(VSlider)->mask()); |
1947 | } | 1955 | } |
1948 | 1956 | ||
1949 | int LiquidStyle::sliderLength() const | 1957 | int LiquidStyle::sliderLength() const |
1950 | { | 1958 | { |
1951 | return(10); | 1959 | return(10); |
1952 | } | 1960 | } |
1953 | 1961 | ||
1954 | #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) | 1962 | #define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2) |
1955 | 1963 | ||
1956 | void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, | 1964 | void LiquidStyle::drawArrow(QPainter *p, Qt::ArrowType type, bool on, int x, |
1957 | int y, int w, int h, const QColorGroup &g, | 1965 | int y, int w, int h, const QColorGroup &g, |
1958 | bool enabled, const QBrush *) | 1966 | bool enabled, const QBrush *) |
1959 | { | 1967 | { |
1960 | static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; | 1968 | static const QCOORD u_arrow[]={3,1, 4,1, 2,2, 5,2, 1,3, 6,3, 0,4, 7,4, 0,5, 7,5}; |
1961 | static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; | 1969 | static const QCOORD d_arrow[]={0,2, 7,2, 0,3, 7,3, 1,4, 6,4, 2,5, 5,5, 3,6, 4,6}; |
1962 | static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; | 1970 | static const QCOORD l_arrow[]={1,3, 1,4, 2,2, 2,5, 3,1, 3,6, 4,0, 4,7, 5,0, 5,7}; |
1963 | static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; | 1971 | static const QCOORD r_arrow[]={2,0, 2,7, 3,0, 3,7, 4,1, 4,6, 5,2, 5,5, 6,3, 6,4}; |
1964 | 1972 | ||
1965 | p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); | 1973 | p->setPen(enabled ? on ? g.light() : g.buttonText() : g.mid()); |
1966 | if(w > 8){ | 1974 | if(w > 8){ |
1967 | x = x + (w-8)/2; | 1975 | x = x + (w-8)/2; |
1968 | y = y + (h-8)/2; | 1976 | y = y + (h-8)/2; |
1969 | } | 1977 | } |
1970 | 1978 | ||
1971 | QPointArray a; | 1979 | QPointArray a; |
1972 | switch(type){ | 1980 | switch(type){ |
1973 | case Qt::UpArrow: | 1981 | case Qt::UpArrow: |
1974 | a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); | 1982 | a.setPoints(QCOORDARRLEN(u_arrow), u_arrow); |
1975 | break; | 1983 | break; |
1976 | case Qt::DownArrow: | 1984 | case Qt::DownArrow: |
1977 | a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); | 1985 | a.setPoints(QCOORDARRLEN(d_arrow), d_arrow); |
1978 | break; | 1986 | break; |
1979 | case Qt::LeftArrow: | 1987 | case Qt::LeftArrow: |
1980 | a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); | 1988 | a.setPoints(QCOORDARRLEN(l_arrow), l_arrow); |
1981 | break; | 1989 | break; |
1982 | default: | 1990 | default: |
1983 | a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); | 1991 | a.setPoints(QCOORDARRLEN(r_arrow), r_arrow); |
1984 | break; | 1992 | break; |
1985 | } | 1993 | } |
1986 | 1994 | ||
1987 | a.translate(x, y); | 1995 | a.translate(x, y); |
1988 | p->drawLineSegments(a); | 1996 | p->drawLineSegments(a); |
1989 | } | 1997 | } |
1990 | 1998 | ||
1991 | 1999 | ||
1992 | void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 2000 | void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
1993 | QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | 2001 | QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) |
1994 | { | 2002 | { |
1995 | if(active){ | 2003 | if(active){ |
1996 | x -= 2; // Bug in Qt/E | 2004 | x -= 2; // Bug in Qt/E |
1997 | y -= 2; | 2005 | y -= 2; |
1998 | w += 2; | 2006 | w += 2; |
1999 | h += 2; | 2007 | h += 2; |
2000 | } | 2008 | } |
2001 | 2009 | ||
2002 | p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); | 2010 | QWidget *parent = (QWidget *)p->device(); |
2011 | p->setBrushOrigin(parent->pos()); | ||
2012 | parent->erase(x, y, w, h); | ||
2003 | 2013 | ||
2004 | if(menuHandler->useShadowText()){ | 2014 | if(menuHandler->useShadowText()){ |
2005 | QColor shadow; | 2015 | QColor shadow; |
2006 | if(p->device() && p->device()->devType() == QInternal::Widget && | 2016 | if(p->device() && p->device()->devType() == QInternal::Widget && |
2007 | ((QWidget *)p->device())->inherits("QMenuBar")){ | 2017 | ((QWidget *)p->device())->inherits("QMenuBar")){ |
2008 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 2018 | shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
2009 | g.background().dark(130); | 2019 | g.background().dark(130); |
2010 | } | 2020 | } |
2011 | else | 2021 | else |
2012 | shadow = g.background().dark(130); | 2022 | shadow = g.background().dark(130); |
2013 | 2023 | ||
2014 | if(active){ | 2024 | if(active){ |
2015 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2025 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2016 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2026 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2017 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2027 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2018 | g, mi->isEnabled(), NULL, mi->text(), | 2028 | g, mi->isEnabled(), NULL, mi->text(), |
2019 | -1, &shadow); | 2029 | -1, &shadow); |
2020 | QApplication::style().drawItem(p, x, y, w, h, | 2030 | QApplication::style().drawItem(p, x, y, w, h, |
2021 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2031 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2022 | g, mi->isEnabled(), NULL, mi->text(), | 2032 | g, mi->isEnabled(), NULL, mi->text(), |
2023 | -1, &g.text()); | 2033 | -1, &g.text()); |
2024 | } | 2034 | } |
2025 | else{ | 2035 | else{ |
2026 | QApplication::style().drawItem(p, x+1, y+1, w, h, | 2036 | QApplication::style().drawItem(p, x+1, y+1, w, h, |
2027 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2037 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2028 | g, mi->isEnabled(), NULL, mi->text(), | 2038 | g, mi->isEnabled(), NULL, mi->text(), |
2029 | -1, &shadow); | 2039 | -1, &shadow); |
2030 | QApplication::style().drawItem(p, x, y, w, h, | 2040 | QApplication::style().drawItem(p, x, y, w, h, |
2031 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2041 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2032 | g, mi->isEnabled(), NULL, mi->text(), | 2042 | g, mi->isEnabled(), NULL, mi->text(), |
2033 | -1, &g.text()); | 2043 | -1, &g.text()); |
2034 | } | 2044 | } |
2035 | } | 2045 | } |
2036 | else{ | 2046 | else{ |
2037 | if(active) | 2047 | if(active) |
2038 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); | 2048 | drawClearBevel(p, x+1, y+1, w-1, h-1, g.button(), g.background()); |
2039 | QApplication::style().drawItem(p, x, y, w, h, | 2049 | QApplication::style().drawItem(p, x, y, w, h, |
2040 | AlignCenter|ShowPrefix|DontClip|SingleLine, | 2050 | AlignCenter|ShowPrefix|DontClip|SingleLine, |
2041 | g, mi->isEnabled(), NULL, mi->text(), | 2051 | g, mi->isEnabled(), NULL, mi->text(), |
2042 | -1, &g.text()); | 2052 | -1, &g.text()); |
2043 | } | 2053 | } |
2044 | } | 2054 | } |
2045 | 2055 | ||
2046 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 2056 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
2047 | const QColorGroup &g, int /*lineWidth*/, | 2057 | const QColorGroup &g, int /*lineWidth*/, |
2048 | const QBrush * /*fill*/) | 2058 | const QBrush * /*fill*/) |
2049 | { | 2059 | { |
2050 | QColor c; | 2060 | QColor c; |
2051 | switch(menuHandler->transType()){ | 2061 | switch(menuHandler->transType()){ |
2052 | case None: | 2062 | case None: |
2053 | case StippledBg: | 2063 | case StippledBg: |
2054 | case TransStippleBg: | 2064 | case TransStippleBg: |
2055 | c = g.background(); | 2065 | c = g.background(); |
2056 | break; | 2066 | break; |
2057 | case StippledBtn: | 2067 | case StippledBtn: |
2058 | case TransStippleBtn: | 2068 | case TransStippleBtn: |
2059 | c = g.button(); | 2069 | c = g.button(); |
2060 | break; | 2070 | break; |
2061 | default: | 2071 | default: |
2062 | c = menuHandler->bgColor(); | 2072 | c = menuHandler->bgColor(); |
2063 | } | 2073 | } |
2064 | p->setPen(c.dark(140)); | 2074 | p->setPen(c.dark(140)); |
2065 | p->drawRect(x, y, w, h); | 2075 | p->drawRect(x, y, w, h); |
2066 | p->setPen(c.light(120)); | 2076 | p->setPen(c.light(120)); |
2067 | p->drawRect(x+1, y+1, w-2, h-2); | 2077 | p->drawRect(x+1, y+1, w-2, h-2); |
2068 | } | 2078 | } |
2069 | 2079 | ||
2070 | void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, | 2080 | void LiquidStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, |
2071 | int tab, QMenuItem* mi, | 2081 | int tab, QMenuItem* mi, |
2072 | const QPalette& pal, bool act, | 2082 | const QPalette& pal, bool act, |
2073 | bool enabled, int x, int y, int w, int h) | 2083 | bool enabled, int x, int y, int w, int h) |
2074 | { | 2084 | { |
2075 | static const int motifItemFrame = 2; | 2085 | static const int motifItemFrame = 2; |
2076 | static const int motifItemHMargin = 3; | 2086 | static const int motifItemHMargin = 3; |
2077 | static const int motifItemVMargin = 2; | 2087 | static const int motifItemVMargin = 2; |
2078 | static const int motifArrowHMargin = 6; | 2088 | static const int motifArrowHMargin = 6; |
2079 | static const int windowsRightBorder = 12; | 2089 | static const int windowsRightBorder = 12; |
2080 | 2090 | ||
2081 | maxpmw = QMAX( maxpmw, 20 ); | 2091 | maxpmw = QMAX( maxpmw, 20 ); |
2082 | 2092 | ||
2083 | 2093 | ||
2084 | bool dis = !enabled; | 2094 | bool dis = !enabled; |
2085 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 2095 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
2086 | 2096 | ||
2087 | int checkcol = maxpmw; | 2097 | int checkcol = maxpmw; |
2088 | if(act){ | 2098 | if(act){ |
2089 | 2099 | ||
2090 | // FIXME | 2100 | // FIXME |
2091 | drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); | 2101 | drawClearBevel(p, x, y, w, h, itemg.button(), itemg.background()); |
2092 | } | 2102 | } |
2093 | //else if(((QWidget*)p->device())->backgroundPixmap()){ | 2103 | //else if(((QWidget*)p->device())->backgroundPixmap()){ |
2094 | // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), | 2104 | // p->drawPixmap(x, y, *((QWidget*)p->device())->backgroundPixmap(), |
2095 | // x, y, w, h); | 2105 | // x, y, w, h); |
2096 | //} | 2106 | //} |
2097 | else{ | 2107 | else{ |
2098 | if(menuHandler->transType() == None){ | 2108 | if(menuHandler->transType() == None){ |
diff --git a/noncore/styles/liquid/liquid.h b/noncore/styles/liquid/liquid.h index fb691ea..00cfb35 100644 --- a/noncore/styles/liquid/liquid.h +++ b/noncore/styles/liquid/liquid.h | |||
@@ -84,135 +84,136 @@ public: | |||
84 | QRect buttonRect(int x, int y, int w, int h); | 84 | QRect buttonRect(int x, int y, int w, int h); |
85 | void drawBevelButton(QPainter *p, int x, int y, int w, int h, | 85 | void drawBevelButton(QPainter *p, int x, int y, int w, int h, |
86 | const QColorGroup &g, bool sunken = FALSE, | 86 | const QColorGroup &g, bool sunken = FALSE, |
87 | const QBrush *fill = 0 ); | 87 | const QBrush *fill = 0 ); |
88 | void drawPushButton(QPushButton *btn, QPainter *p); | 88 | void drawPushButton(QPushButton *btn, QPainter *p); |
89 | virtual void drawPushButtonLabel (QPushButton *btn, QPainter *p); | 89 | virtual void drawPushButtonLabel (QPushButton *btn, QPainter *p); |
90 | void drawScrollBarControls(QPainter*, const QScrollBar*, int sliderStart, | 90 | void drawScrollBarControls(QPainter*, const QScrollBar*, int sliderStart, |
91 | uint controls, uint activeControl ); | 91 | uint controls, uint activeControl ); |
92 | QStyle::ScrollControl scrollBarPointOver(const QScrollBar *sb, | 92 | QStyle::ScrollControl scrollBarPointOver(const QScrollBar *sb, |
93 | int sliderStart, const QPoint &p); | 93 | int sliderStart, const QPoint &p); |
94 | void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax, | 94 | void scrollBarMetrics(const QScrollBar *sb, int &sliderMin, int &sliderMax, |
95 | int &sliderLength, int &buttonDim); | 95 | int &sliderLength, int &buttonDim); |
96 | QSize indicatorSize() const; | 96 | QSize indicatorSize() const; |
97 | void drawIndicator(QPainter* p, int x, int y, int w, int h, | 97 | void drawIndicator(QPainter* p, int x, int y, int w, int h, |
98 | const QColorGroup &g, int state, bool down = FALSE, | 98 | const QColorGroup &g, int state, bool down = FALSE, |
99 | bool enabled = TRUE ); | 99 | bool enabled = TRUE ); |
100 | void drawIndicatorMask(QPainter *p, int x, int y, int w, int h, int); | 100 | void drawIndicatorMask(QPainter *p, int x, int y, int w, int h, int); |
101 | QSize exclusiveIndicatorSize() const; | 101 | QSize exclusiveIndicatorSize() const; |
102 | void drawExclusiveIndicator(QPainter* p, int x, int y, int w, int h, | 102 | void drawExclusiveIndicator(QPainter* p, int x, int y, int w, int h, |
103 | const QColorGroup &g, bool on, | 103 | const QColorGroup &g, bool on, |
104 | bool down = FALSE, bool enabled = TRUE ); | 104 | bool down = FALSE, bool enabled = TRUE ); |
105 | void drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, | 105 | void drawExclusiveIndicatorMask(QPainter *p, int x, int y, int w, |
106 | int h, bool); | 106 | int h, bool); |
107 | void drawComboButton(QPainter *p, int x, int y, int w, int h, | 107 | void drawComboButton(QPainter *p, int x, int y, int w, int h, |
108 | const QColorGroup &g, bool sunken = FALSE, | 108 | const QColorGroup &g, bool sunken = FALSE, |
109 | bool editable = FALSE, bool enabled = TRUE, | 109 | bool editable = FALSE, bool enabled = TRUE, |
110 | const QBrush *fill = 0 ); | 110 | const QBrush *fill = 0 ); |
111 | QRect comboButtonRect(int x, int y, int w, int h); | 111 | QRect comboButtonRect(int x, int y, int w, int h); |
112 | QRect comboButtonFocusRect(int x, int y, int w, int h); | 112 | QRect comboButtonFocusRect(int x, int y, int w, int h); |
113 | int sliderLength() const; | 113 | int sliderLength() const; |
114 | void drawArrow(QPainter *p, Qt::ArrowType type, bool down, | 114 | void drawArrow(QPainter *p, Qt::ArrowType type, bool down, |
115 | int x, int y, int w, int h, const QColorGroup &g, | 115 | int x, int y, int w, int h, const QColorGroup &g, |
116 | bool enabled=true, const QBrush *fill = 0); | 116 | bool enabled=true, const QBrush *fill = 0); |
117 | void drawSlider(QPainter *p, int x, int y, int w, int h, | 117 | void drawSlider(QPainter *p, int x, int y, int w, int h, |
118 | const QColorGroup &g, Orientation orient, | 118 | const QColorGroup &g, Orientation orient, |
119 | bool tickAbove, bool tickBelow); | 119 | bool tickAbove, bool tickBelow); |
120 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, | 120 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, |
121 | Orientation orient, bool, bool); | 121 | Orientation orient, bool, bool); |
122 | void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 122 | void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
123 | QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); | 123 | QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); |
124 | 124 | ||
125 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, | 125 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, |
126 | int tab, QMenuItem *mi, const QPalette &pal, | 126 | int tab, QMenuItem *mi, const QPalette &pal, |
127 | bool act, bool enabled, int x, int y, int w, | 127 | bool act, bool enabled, int x, int y, int w, |
128 | int h); | 128 | int h); |
129 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); | 129 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); |
130 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, | 130 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, |
131 | const QColor *pen, bool atBorder); | 131 | const QColor *pen, bool atBorder); |
132 | int defaultFrameWidth() const {return(2);} | 132 | int defaultFrameWidth() const {return(2);} |
133 | void polishPopupMenu(QPopupMenu *mnu); | 133 | void polishPopupMenu(QPopupMenu *mnu); |
134 | void drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, | 134 | void drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, |
135 | bool selected); | 135 | bool selected); |
136 | void drawTabMask( QPainter*, const QTabBar*, QTab*, bool selected ); | 136 | void drawTabMask( QPainter*, const QTabBar*, QTab*, bool selected ); |
137 | void tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame, | 137 | void tabbarMetrics(const QTabBar *t, int &hFrame, int &vFrame, |
138 | int &overlap); | 138 | int &overlap); |
139 | 139 | ||
140 | void drawSplitter(QPainter *p, int x, int y, int w, int h, | 140 | void drawSplitter(QPainter *p, int x, int y, int w, int h, |
141 | const QColorGroup &g, Orientation orient); | 141 | const QColorGroup &g, Orientation orient); |
142 | int splitterWidth() const {return(6);} | 142 | int splitterWidth() const {return(6);} |
143 | void drawPanel(QPainter *p, int x, int y, int w, int h, | 143 | void drawPanel(QPainter *p, int x, int y, int w, int h, |
144 | const QColorGroup &g, bool sunken, int lineWidth, | 144 | const QColorGroup &g, bool sunken, int lineWidth, |
145 | const QBrush *fill); | 145 | const QBrush *fill); |
146 | void drawToolButton(QPainter *p, int x, int y, int w, | 146 | void drawToolButton(QPainter *p, int x, int y, int w, |
147 | int h, const QColorGroup &g, | 147 | int h, const QColorGroup &g, |
148 | bool sunken, const QBrush *fill); | 148 | bool sunken, const QBrush *fill); |
149 | // for repainting toolbuttons when the toolbar is resized | 149 | // for repainting toolbuttons when the toolbar is resized |
150 | bool eventFilter(QObject *obj, QEvent *ev); | 150 | bool eventFilter(QObject *obj, QEvent *ev); |
151 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | 151 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, |
152 | const QColorGroup &g, QCOORD c, Orientation); | 152 | const QColorGroup &g, QCOORD c, Orientation); |
153 | void drawSliderGrooveMask(QPainter * p, int x, int y, int w, int h, | 153 | void drawSliderGrooveMask(QPainter * p, int x, int y, int w, int h, |
154 | QCOORD c, Orientation); | 154 | QCOORD c, Orientation); |
155 | int buttonDefaultIndicatorWidth() const {return(2);} | 155 | int buttonDefaultIndicatorWidth() const {return(2);} |
156 | void drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 156 | void drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
157 | const QColorGroup &g, int lineWidth, | 157 | const QColorGroup &g, int lineWidth, |
158 | const QBrush * fill); | 158 | const QBrush * fill); |
159 | protected: | 159 | protected: |
160 | void adjustHSV(QPixmap &pix, int h, int s, int v); | 160 | void adjustHSV(QPixmap &pix, int h, int s, int v); |
161 | void intensity(QPixmap &pix, float percent); | 161 | void intensity(QPixmap &pix, float percent); |
162 | 162 | ||
163 | void drawRoundButton(QPainter *p, const QColor &c, const QColor &bg, int x, | 163 | void drawRoundButton(QPainter *p, const QColor &c, const QColor &bg, int x, |
164 | int y, int w, int h, bool supportPushDown = false, | 164 | int y, int w, int h, bool supportPushDown = false, |
165 | bool pushedDown = false, bool autoDefault = false, | 165 | bool pushedDown = false, bool autoDefault = false, |
166 | bool isMasked = false); | 166 | bool isMasked = false); |
167 | void drawClearBevel(QPainter *p, int x, int y, int w, int h, | 167 | void drawClearBevel(QPainter *p, int x, int y, int w, int h, |
168 | const QColor &c, const QColor &bg); | 168 | const QColor &c, const QColor &bg); |
169 | void drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, | 169 | void drawSBDeco(QPainter *p, const QRect &r, const QColorGroup &g, |
170 | bool horiz); | 170 | bool horiz); |
171 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, | 171 | void drawSBButton(QPainter *p, const QRect &r, const QColorGroup &g, |
172 | bool down=false, bool fast = true); | 172 | bool down=false, bool fast = true); |
173 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); | 173 | void drawRoundRect(QPainter *p, int x, int y, int w, int h); |
174 | void loadCustomButtons(); | 174 | void loadCustomButtons(); |
175 | void applyCustomAttributes(QPushButton *btn); | 175 | void applyCustomAttributes(QPushButton *btn); |
176 | void unapplyCustomAttributes(QPushButton *btn); | 176 | void unapplyCustomAttributes(QPushButton *btn); |
177 | QPixmap* getPixmap(BitmapData item); | 177 | QPixmap* getPixmap(BitmapData item); |
178 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | 178 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); |
179 | private: | 179 | private: |
180 | bool flatTBButtons; | ||
180 | bool highcolor; | 181 | bool highcolor; |
181 | QColorGroup radioOnGrp; | 182 | QColorGroup radioOnGrp; |
182 | QWidget *highlightWidget; | 183 | QWidget *highlightWidget; |
183 | QBrush wallpaper; | 184 | QBrush wallpaper; |
184 | QBitmap lightBmp; | 185 | QBitmap lightBmp; |
185 | QBitmap grayBmp; | 186 | QBitmap grayBmp; |
186 | QBitmap dgrayBmp; | 187 | QBitmap dgrayBmp; |
187 | QBitmap maskBmp; | 188 | QBitmap maskBmp; |
188 | QBitmap xBmp; | 189 | QBitmap xBmp; |
189 | QBitmap btnMaskBmp, htmlBtnMaskBmp; | 190 | QBitmap btnMaskBmp, htmlBtnMaskBmp; |
190 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; | 191 | QPixmap *btnBorderPix, *btnBlendPix, *bevelFillPix, *smallBevelFillPix, *menuPix; |
191 | QBitmap paper1, paper2, paper3; | 192 | QBitmap paper1, paper2, paper3; |
192 | QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; | 193 | QBrush baseBrush, menuBrush, pagerBrush, pagerHoverBrush, bgBrush; |
193 | bool menuAni, menuFade; | 194 | bool menuAni, menuFade; |
194 | 195 | ||
195 | QIntDict<QPixmap>btnDict; | 196 | QIntDict<QPixmap>btnDict; |
196 | QIntDict<QPixmap>btnBorderDict; | 197 | QIntDict<QPixmap>btnBorderDict; |
197 | QIntDict<QPixmap>bevelFillDict; | 198 | QIntDict<QPixmap>bevelFillDict; |
198 | QIntDict<QPixmap>smallBevelFillDict; | 199 | QIntDict<QPixmap>smallBevelFillDict; |
199 | 200 | ||
200 | QList<QColor>customBtnColorList; | 201 | QList<QColor>customBtnColorList; |
201 | QList<QPixmap>customBtnIconList; | 202 | QList<QPixmap>customBtnIconList; |
202 | QStrList customBtnLabelList; | 203 | QStrList customBtnLabelList; |
203 | QPixmap *vsbSliderFillPix; | 204 | QPixmap *vsbSliderFillPix; |
204 | TransMenuHandler *menuHandler; | 205 | TransMenuHandler *menuHandler; |
205 | QPixmap *pixmaps[BITMAP_ITEMS]; | 206 | QPixmap *pixmaps[BITMAP_ITEMS]; |
206 | QPixmap sbBuffer; | 207 | QPixmap sbBuffer; |
207 | int oldSliderThickness; | 208 | int oldSliderThickness; |
208 | int lowLightVal; | 209 | int lowLightVal; |
209 | QHeader *currentHeader; | 210 | QHeader *currentHeader; |
210 | int headerHoverID; | 211 | int headerHoverID; |
211 | QWMatrix rMatrix; | 212 | QWMatrix rMatrix; |
212 | int bH, bS, bV; | 213 | int bH, bS, bV; |
213 | int bHoverH, bHoverS, bHoverV; | 214 | int bHoverH, bHoverS, bHoverV; |
214 | int btnH, btnS, btnV; | 215 | int btnH, btnS, btnV; |
215 | int btnHoverH, btnHoverS, btnHoverV; | 216 | int btnHoverH, btnHoverS, btnHoverV; |
216 | }; | 217 | }; |
217 | 218 | ||
218 | #endif | 219 | #endif |
diff --git a/noncore/styles/liquid/liquidset.cpp b/noncore/styles/liquid/liquidset.cpp index 5ae19ba..1b9526f 100644 --- a/noncore/styles/liquid/liquidset.cpp +++ b/noncore/styles/liquid/liquidset.cpp | |||
@@ -1,232 +1,226 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | #include "liquidset.h" | 23 | #include "liquidset.h" |
24 | #include "liquid.h" | 24 | #include "liquid.h" |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/global.h> | 27 | #include <qpe/global.h> |
28 | 28 | ||
29 | #include <qslider.h> | 29 | #include <qslider.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qbuttongroup.h> | 31 | #include <qcombobox.h> |
32 | #include <qradiobutton.h> | 32 | #include <qradiobutton.h> |
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qpalette.h> | 36 | #include <qpalette.h> |
37 | 37 | ||
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | 39 | ||
40 | #include <opie/colorpopupmenu.h> | 40 | #include <opie/colorpopupmenu.h> |
41 | 41 | ||
42 | 42 | ||
43 | static void changeButtonColor ( QWidget *btn, const QColor &col ) | 43 | static void changeButtonColor ( QWidget *btn, const QColor &col ) |
44 | { | 44 | { |
45 | QPalette pal = btn-> palette ( ); | 45 | QPalette pal = btn-> palette ( ); |
46 | 46 | ||
47 | pal. setColor ( QPalette::Normal, QColorGroup::Button, col ); | 47 | pal. setColor ( QPalette::Normal, QColorGroup::Button, col ); |
48 | pal. setColor ( QPalette::Active, QColorGroup::Button, col ); | 48 | pal. setColor ( QPalette::Active, QColorGroup::Button, col ); |
49 | pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); | 49 | pal. setColor ( QPalette::Disabled, QColorGroup::Button, col ); |
50 | pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); | 50 | pal. setColor ( QPalette::Inactive, QColorGroup::Button, col ); |
51 | pal. setColor ( QPalette::Normal, QColorGroup::Background, col ); | 51 | pal. setColor ( QPalette::Normal, QColorGroup::Background, col ); |
52 | pal. setColor ( QPalette::Active, QColorGroup::Background, col ); | 52 | pal. setColor ( QPalette::Active, QColorGroup::Background, col ); |
53 | pal. setColor ( QPalette::Disabled, QColorGroup::Background, col ); | 53 | pal. setColor ( QPalette::Disabled, QColorGroup::Background, col ); |
54 | pal. setColor ( QPalette::Inactive, QColorGroup::Background, col ); | 54 | pal. setColor ( QPalette::Inactive, QColorGroup::Background, col ); |
55 | 55 | ||
56 | btn-> setPalette ( pal ); | 56 | btn-> setPalette ( pal ); |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) | 60 | LiquidSettings::LiquidSettings ( QWidget* parent, const char *name, WFlags fl ) |
61 | : QWidget ( parent, name, fl ) | 61 | : QWidget ( parent, name, fl ) |
62 | { | 62 | { |
63 | setCaption ( tr( "Liquid Style" ) ); | 63 | setCaption ( tr( "Liquid Style" ) ); |
64 | 64 | ||
65 | Config config ( "qpe" ); | 65 | Config config ( "qpe" ); |
66 | config. setGroup ( "Liquid-Style" ); | 66 | config. setGroup ( "Liquid-Style" ); |
67 | 67 | ||
68 | m_type = config. readNumEntry ( "Type", TransStippleBg ); | 68 | m_type = config. readNumEntry ( "Type", TransStippleBg ); |
69 | m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); | 69 | m_menucol = QColor ( config. readEntry ( "Color", QApplication::palette ( ). active ( ). button ( ). name ( ))); |
70 | m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); | 70 | m_textcol = QColor ( config. readEntry ( "TextColor", QApplication::palette ( ). active ( ). text ( ). name ( ))); |
71 | int opacity = config. readNumEntry ( "Opacity", 10 ); | 71 | int opacity = config. readNumEntry ( "Opacity", 10 ); |
72 | m_shadow = config. readBoolEntry ( "ShadowText", true ); | 72 | m_shadow = config. readBoolEntry ( "ShadowText", true ); |
73 | m_deco = config. readBoolEntry ( "WinDecoration", true ); | 73 | m_deco = config. readBoolEntry ( "WinDecoration", true ); |
74 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 74 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
75 | m_flat = config. readBoolEntry ( "FlatToolButtons", false ); | ||
75 | 76 | ||
76 | QVBoxLayout *vbox = new QVBoxLayout ( this ); | 77 | QVBoxLayout *vbox = new QVBoxLayout ( this ); |
77 | vbox-> setSpacing ( 3 ); | 78 | vbox-> setSpacing ( 3 ); |
78 | vbox-> setMargin ( 6 ); | 79 | vbox-> setMargin ( 4 ); |
79 | 80 | ||
80 | QButtonGroup *btngrp = new QButtonGroup ( this ); | 81 | QComboBox *cb = new QComboBox ( this ); |
81 | btngrp-> hide ( ); | 82 | cb-> insertItem ( tr( "No translucency" ), None ); |
82 | 83 | cb-> insertItem ( tr( "Stippled, background color" ), StippledBg ); | |
83 | QRadioButton *rad; | 84 | cb-> insertItem ( tr( "Stippled, button color" ), StippledBtn ); |
84 | 85 | cb-> insertItem ( tr( "Translucent stippled, background color" ), TransStippleBg ); | |
85 | rad = new QRadioButton ( tr( "No translucency" ), this ); | 86 | cb-> insertItem ( tr( "Translucent stippled, button color" ), TransStippleBtn ); |
86 | btngrp-> insert ( rad, None ); | 87 | cb-> insertItem ( tr( "Custom translucency" ), Custom ); |
87 | vbox-> addWidget ( rad ); | ||
88 | |||
89 | rad = new QRadioButton ( tr( "Stippled, background color" ), this ); | ||
90 | btngrp-> insert ( rad, StippledBg ); | ||
91 | vbox-> addWidget ( rad ); | ||
92 | |||
93 | rad = new QRadioButton ( tr( "Stippled, button color" ), this ); | ||
94 | btngrp-> insert ( rad, StippledBtn ); | ||
95 | vbox-> addWidget ( rad ); | ||
96 | |||
97 | rad = new QRadioButton ( tr( "Translucent stippled, background color" ), this ); | ||
98 | btngrp-> insert ( rad, TransStippleBg ); | ||
99 | vbox-> addWidget ( rad ); | ||
100 | |||
101 | rad = new QRadioButton ( tr( "Translucent stippled, button color" ), this ); | ||
102 | btngrp-> insert ( rad, TransStippleBtn ); | ||
103 | vbox-> addWidget ( rad ); | ||
104 | 88 | ||
105 | rad = new QRadioButton ( tr( "Custom translucency" ), this ); | 89 | cb-> setCurrentItem ( m_type ); |
106 | btngrp-> insert ( rad, Custom ); | 90 | vbox-> addWidget ( cb ); |
107 | vbox-> addWidget ( rad ); | ||
108 | 91 | ||
109 | btngrp-> setExclusive ( true ); | ||
110 | btngrp-> setButton ( m_type ); | ||
111 | 92 | ||
112 | QGridLayout *grid = new QGridLayout ( vbox ); | 93 | QGridLayout *grid = new QGridLayout ( vbox ); |
113 | grid-> addColSpacing ( 0, 16 ); | 94 | grid-> addColSpacing ( 0, 16 ); |
114 | grid-> addColSpacing ( 3, 8 ); | 95 | grid-> addColSpacing ( 3, 8 ); |
115 | 96 | ||
116 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); | 97 | grid-> addWidget ( m_menulbl = new QLabel ( tr( "Menu color" ), this ), 0, 1 ); |
117 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); | 98 | grid-> addWidget ( m_textlbl = new QLabel ( tr( "Text color" ), this ), 0, 4 ); |
118 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); | 99 | grid-> addWidget ( m_opaclbl = new QLabel ( tr( "Opacity" ), this ), 1, 1 ); |
119 | 100 | ||
120 | m_menubtn = new QToolButton ( this ); | 101 | m_menubtn = new QToolButton ( this ); |
121 | grid-> addWidget ( m_menubtn, 0, 2 ); | 102 | grid-> addWidget ( m_menubtn, 0, 2 ); |
122 | 103 | ||
123 | QPopupMenu *popup; | 104 | QPopupMenu *popup; |
124 | 105 | ||
125 | popup = new ColorPopupMenu ( m_menucol, 0 ); | 106 | popup = new ColorPopupMenu ( m_menucol, 0 ); |
126 | m_menubtn-> setPopup ( popup ); | 107 | m_menubtn-> setPopup ( popup ); |
127 | m_menubtn-> setPopupDelay ( 0 ); | 108 | m_menubtn-> setPopupDelay ( 0 ); |
128 | connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & ))); | 109 | connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeMenuColor ( const QColor & ))); |
129 | changeMenuColor ( m_menucol ); | 110 | changeMenuColor ( m_menucol ); |
130 | 111 | ||
131 | m_textbtn = new QToolButton ( this ); | 112 | m_textbtn = new QToolButton ( this ); |
132 | grid-> addWidget ( m_textbtn, 0, 5 ); | 113 | grid-> addWidget ( m_textbtn, 0, 5 ); |
133 | 114 | ||
134 | popup = new ColorPopupMenu ( m_textcol, 0 ); | 115 | popup = new ColorPopupMenu ( m_textcol, 0 ); |
135 | m_textbtn-> setPopup ( popup ); | 116 | m_textbtn-> setPopup ( popup ); |
136 | m_textbtn-> setPopupDelay ( 0 ); | 117 | m_textbtn-> setPopupDelay ( 0 ); |
137 | connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & ))); | 118 | connect ( popup, SIGNAL( colorSelected ( const QColor & )), this, SLOT( changeTextColor ( const QColor & ))); |
138 | changeTextColor ( m_textcol ); | 119 | changeTextColor ( m_textcol ); |
139 | 120 | ||
140 | m_opacsld = new QSlider ( Horizontal, this ); | 121 | m_opacsld = new QSlider ( Horizontal, this ); |
141 | m_opacsld-> setRange ( -20, 20 ); | 122 | m_opacsld-> setRange ( -20, 20 ); |
142 | m_opacsld-> setValue ( opacity ); | 123 | m_opacsld-> setValue ( opacity ); |
143 | m_opacsld-> setTickmarks ( QSlider::Below ); | 124 | m_opacsld-> setTickmarks ( QSlider::Below ); |
144 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); | 125 | grid-> addMultiCellWidget ( m_opacsld, 1, 1, 2, 5 ); |
145 | 126 | ||
146 | vbox-> addSpacing ( 4 ); | 127 | vbox-> addSpacing ( 4 ); |
147 | 128 | ||
148 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); | 129 | QCheckBox *shadow = new QCheckBox ( tr( "Use shadowed menu text" ), this ); |
149 | shadow-> setChecked ( m_shadow ); | 130 | shadow-> setChecked ( m_shadow ); |
150 | vbox-> addWidget ( shadow ); | 131 | vbox-> addWidget ( shadow ); |
151 | 132 | ||
152 | vbox-> addSpacing ( 4 ); | 133 | vbox-> addSpacing ( 4 ); |
153 | 134 | ||
154 | QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this ); | 135 | QCheckBox *windeco = new QCheckBox ( tr( "Draw liquid window title bars" ), this ); |
155 | windeco-> setChecked ( m_deco ); | 136 | windeco-> setChecked ( m_deco ); |
156 | vbox-> addWidget ( windeco ); | 137 | vbox-> addWidget ( windeco ); |
157 | 138 | ||
158 | vbox-> addSpacing ( 4 ); | 139 | vbox-> addSpacing ( 4 ); |
159 | 140 | ||
141 | QCheckBox *flattb = new QCheckBox ( tr( "Make toolbar buttons appear flat" ), this ); | ||
142 | flattb-> setChecked ( m_flat ); | ||
143 | vbox-> addWidget ( flattb ); | ||
144 | |||
145 | vbox-> addSpacing ( 4 ); | ||
146 | |||
160 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); | 147 | QHBoxLayout *hbox = new QHBoxLayout ( vbox ); |
161 | 148 | ||
162 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); | 149 | hbox-> addWidget ( new QLabel ( tr( "Stipple contrast" ), this )); |
163 | 150 | ||
164 | m_contsld = new QSlider ( Horizontal, this ); | 151 | m_contsld = new QSlider ( Horizontal, this ); |
165 | m_contsld-> setRange ( 0, 10 ); | 152 | m_contsld-> setRange ( 0, 10 ); |
166 | m_contsld-> setValue ( contrast ); | 153 | m_contsld-> setValue ( contrast ); |
167 | m_contsld-> setTickmarks ( QSlider::Below ); | 154 | m_contsld-> setTickmarks ( QSlider::Below ); |
168 | hbox-> addWidget ( m_contsld, 10 ); | 155 | hbox-> addWidget ( m_contsld, 10 ); |
169 | 156 | ||
170 | vbox-> addStretch ( 10 ); | 157 | vbox-> addStretch ( 10 ); |
171 | 158 | ||
172 | changeType ( m_type ); | 159 | changeType ( m_type ); |
173 | 160 | ||
174 | connect ( btngrp, SIGNAL( clicked ( int ) ), this, SLOT( changeType ( int ) ) ); | 161 | connect ( cb, SIGNAL( highlighted ( int ) ), this, SLOT( changeType ( int ) ) ); |
175 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); | 162 | connect ( shadow, SIGNAL( toggled ( bool ) ), this, SLOT( changeShadow ( bool ) ) ); |
176 | connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); | 163 | connect ( windeco, SIGNAL( toggled ( bool ) ), this, SLOT( changeDeco ( bool ) ) ); |
164 | connect ( flattb, SIGNAL( toggled ( bool ) ), this, SLOT( changeFlat ( bool ) ) ); | ||
177 | } | 165 | } |
178 | 166 | ||
179 | void LiquidSettings::changeType ( int t ) | 167 | void LiquidSettings::changeType ( int t ) |
180 | { | 168 | { |
181 | bool custom = ( t == Custom ); | 169 | bool custom = ( t == Custom ); |
182 | 170 | ||
183 | m_menulbl-> setEnabled ( custom ); | 171 | m_menulbl-> setEnabled ( custom ); |
184 | m_textlbl-> setEnabled ( custom ); | 172 | m_textlbl-> setEnabled ( custom ); |
185 | m_opaclbl-> setEnabled ( custom ); | 173 | m_opaclbl-> setEnabled ( custom ); |
186 | m_menubtn-> setEnabled ( custom ); | 174 | m_menubtn-> setEnabled ( custom ); |
187 | m_textbtn-> setEnabled ( custom ); | 175 | m_textbtn-> setEnabled ( custom ); |
188 | m_opacsld-> setEnabled ( custom ); | 176 | m_opacsld-> setEnabled ( custom ); |
189 | 177 | ||
190 | m_type = t; | 178 | m_type = t; |
191 | } | 179 | } |
192 | 180 | ||
193 | void LiquidSettings::changeMenuColor ( const QColor &col ) | 181 | void LiquidSettings::changeMenuColor ( const QColor &col ) |
194 | { | 182 | { |
195 | changeButtonColor ( m_menubtn, col ); | 183 | changeButtonColor ( m_menubtn, col ); |
196 | m_menucol = col; | 184 | m_menucol = col; |
197 | } | 185 | } |
198 | 186 | ||
199 | void LiquidSettings::changeTextColor ( const QColor &col ) | 187 | void LiquidSettings::changeTextColor ( const QColor &col ) |
200 | { | 188 | { |
201 | changeButtonColor ( m_textbtn, col ); | 189 | changeButtonColor ( m_textbtn, col ); |
202 | m_textcol = col; | 190 | m_textcol = col; |
203 | } | 191 | } |
204 | 192 | ||
205 | void LiquidSettings::changeShadow ( bool b ) | 193 | void LiquidSettings::changeShadow ( bool b ) |
206 | { | 194 | { |
207 | m_shadow = b; | 195 | m_shadow = b; |
208 | } | 196 | } |
209 | 197 | ||
210 | void LiquidSettings::changeDeco ( bool b ) | 198 | void LiquidSettings::changeDeco ( bool b ) |
211 | { | 199 | { |
212 | m_deco = b; | 200 | m_deco = b; |
213 | } | 201 | } |
214 | 202 | ||
203 | void LiquidSettings::changeFlat ( bool b ) | ||
204 | { | ||
205 | m_flat = b; | ||
206 | } | ||
207 | |||
215 | 208 | ||
216 | bool LiquidSettings::writeConfig ( ) | 209 | bool LiquidSettings::writeConfig ( ) |
217 | { | 210 | { |
218 | Config config ( "qpe" ); | 211 | Config config ( "qpe" ); |
219 | config. setGroup ( "Liquid-Style" ); | 212 | config. setGroup ( "Liquid-Style" ); |
220 | 213 | ||
221 | config. writeEntry ( "Type", m_type ); | 214 | config. writeEntry ( "Type", m_type ); |
222 | config. writeEntry ( "Color", m_menucol. name ( )); | 215 | config. writeEntry ( "Color", m_menucol. name ( )); |
223 | config. writeEntry ( "TextColor", m_textcol. name ( )); | 216 | config. writeEntry ( "TextColor", m_textcol. name ( )); |
224 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); | 217 | config. writeEntry ( "Opacity", m_opacsld-> value ( )); |
225 | config. writeEntry ( "ShadowText", m_shadow ); | 218 | config. writeEntry ( "ShadowText", m_shadow ); |
226 | config. writeEntry ( "WinDecoration", m_deco ); | 219 | config. writeEntry ( "WinDecoration", m_deco ); |
227 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); | 220 | config. writeEntry ( "StippleContrast", m_contsld-> value ( )); |
221 | config. writeEntry ( "FlatToolButtons", m_flat ); | ||
228 | config. write ( ); | 222 | config. write ( ); |
229 | 223 | ||
230 | return true; | 224 | return true; |
231 | } | 225 | } |
232 | 226 | ||
diff --git a/noncore/styles/liquid/liquidset.h b/noncore/styles/liquid/liquidset.h index 7843513..bb1846c 100644 --- a/noncore/styles/liquid/liquidset.h +++ b/noncore/styles/liquid/liquidset.h | |||
@@ -1,41 +1,43 @@ | |||
1 | #ifndef __OPIE_LIQUID_SET_H__ | 1 | #ifndef __OPIE_LIQUID_SET_H__ |
2 | #define __OPIE_LIQUID_SET_H__ | 2 | #define __OPIE_LIQUID_SET_H__ |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include <qcolor.h> | 5 | #include <qcolor.h> |
6 | 6 | ||
7 | class QLabel; | 7 | class QLabel; |
8 | class QToolButton; | 8 | class QToolButton; |
9 | class QSlider; | 9 | class QSlider; |
10 | 10 | ||
11 | class LiquidSettings : public QWidget { | 11 | class LiquidSettings : public QWidget { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | 13 | ||
14 | public: | 14 | public: |
15 | LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | 15 | LiquidSettings ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void changeType ( int t ); | 18 | void changeType ( int t ); |
19 | void changeMenuColor ( const QColor &col ); | 19 | void changeMenuColor ( const QColor &col ); |
20 | void changeTextColor ( const QColor &col ); | 20 | void changeTextColor ( const QColor &col ); |
21 | void changeShadow ( bool b ); | 21 | void changeShadow ( bool b ); |
22 | void changeDeco ( bool b ); | 22 | void changeDeco ( bool b ); |
23 | void changeFlat ( bool b ); | ||
23 | 24 | ||
24 | virtual bool writeConfig ( ); | 25 | virtual bool writeConfig ( ); |
25 | 26 | ||
26 | private: | 27 | private: |
27 | QColor m_menucol; | 28 | QColor m_menucol; |
28 | QColor m_textcol; | 29 | QColor m_textcol; |
29 | int m_type; | 30 | int m_type; |
30 | bool m_shadow; | 31 | bool m_shadow; |
31 | bool m_deco; | 32 | bool m_deco; |
33 | bool m_flat; | ||
32 | 34 | ||
33 | QSlider * m_opacsld; | 35 | QSlider * m_opacsld; |
34 | QSlider * m_contsld; | 36 | QSlider * m_contsld; |
35 | QLabel * m_menulbl; | 37 | QLabel * m_menulbl; |
36 | QLabel * m_textlbl; | 38 | QLabel * m_textlbl; |
37 | QLabel * m_opaclbl; | 39 | QLabel * m_opaclbl; |
38 | QToolButton *m_menubtn; | 40 | QToolButton *m_menubtn; |
39 | QToolButton *m_textbtn; | 41 | QToolButton *m_textbtn; |
40 | }; | 42 | }; |
41 | #endif | 43 | #endif |
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index bcbdc8d..7dfd868 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff | |||
@@ -1,1233 +1,1413 @@ | |||
1 | This is a patch to mosfet's liquid 0.7. | 1 | This is a patch to mosfet's liquid 0.7. |
2 | Features: | 2 | Features: |
3 | - Qt-only | 3 | - Qt-only |
4 | - works with Qt/E on QPE/OPIE | 4 | - works with Qt/E on QPE/OPIE |
5 | 5 | ||
6 | --- -Mon Jul 1 11:38:05 2002 | 6 | --- -Mon Jul 15 02:34:13 2002 |
7 | +++ liquid.hMon Jun 24 19:07:45 2002 | 7 | +++ liquid.hMon Jul 15 01:51:12 2002 |
8 | @@ -2,7 +2,7 @@ | 8 | @@ -2,7 +2,7 @@ |
9 | #define LIQUID_STYLE_H | 9 | #define LIQUID_STYLE_H |
10 | 10 | ||
11 | 11 | ||
12 | -#include <kstyle.h> | 12 | -#include <kstyle.h> |
13 | +#include <qwindowsstyle.h> | 13 | +#include <qwindowsstyle.h> |
14 | #include <qpainter.h> | 14 | #include <qpainter.h> |
15 | #include <qdrawutil.h> | 15 | #include <qdrawutil.h> |
16 | #include <qpalette.h> | 16 | #include <qpalette.h> |
17 | @@ -20,7 +20,7 @@ | 17 | @@ -20,7 +20,7 @@ |
18 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. | 18 | * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | -class KPixmap; | 21 | -class KPixmap; |
22 | +class QPixmap; | 22 | +class QPixmap; |
23 | 23 | ||
24 | #define BITMAP_ITEMS 41 | 24 | #define BITMAP_ITEMS 41 |
25 | #define LIQUID_MENU_CHANGE 667 | 25 | #define LIQUID_MENU_CHANGE 667 |
26 | @@ -50,24 +50,22 @@ | 26 | @@ -50,24 +50,22 @@ |
27 | ~TransMenuHandler(){;} | 27 | ~TransMenuHandler(){;} |
28 | void reloadSettings(); | 28 | void reloadSettings(); |
29 | int transType(){return(type);} | 29 | int transType(){return(type);} |
30 | - KPixmap *pixmap(WId id){return(pixDict.find(id));} | 30 | - KPixmap *pixmap(WId id){return(pixDict.find(id));} |
31 | + QPixmap *pixmap(WId id){return(pixDict.find(id));} | 31 | + QPixmap *pixmap(WId id){return(pixDict.find(id));} |
32 | const QColor& textColor(){return(fgColor);} | 32 | const QColor& textColor(){return(fgColor);} |
33 | const QColor& bgColor(){return(color);} | 33 | const QColor& bgColor(){return(color);} |
34 | bool useShadowText(){return(shadowText);} | 34 | bool useShadowText(){return(shadowText);} |
35 | -protected slots: | 35 | -protected slots: |
36 | - void slotKIPCMessage(int id, int arg); | 36 | - void slotKIPCMessage(int id, int arg); |
37 | protected: | 37 | protected: |
38 | bool eventFilter(QObject *obj, QEvent *ev); | 38 | bool eventFilter(QObject *obj, QEvent *ev); |
39 | - void stripePixmap(KPixmap &pix, const QColor &color); | 39 | - void stripePixmap(KPixmap &pix, const QColor &color); |
40 | + void stripePixmap(QPixmap &pix, const QColor &color); | 40 | + void stripePixmap(QPixmap &pix, const QColor &color); |
41 | 41 | ||
42 | QColor color, fgColor; | 42 | QColor color, fgColor; |
43 | int opacity; | 43 | int opacity; |
44 | int type; | 44 | int type; |
45 | bool shadowText; | 45 | bool shadowText; |
46 | - QIntDict<KPixmap>pixDict; | 46 | - QIntDict<KPixmap>pixDict; |
47 | + QIntDict<QPixmap>pixDict; | 47 | + QIntDict<QPixmap>pixDict; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | -class LiquidStyle : public KStyle | 50 | -class LiquidStyle : public KStyle |
51 | +class LiquidStyle : public QWindowsStyle | 51 | +class LiquidStyle : public QWindowsStyle |
52 | { | 52 | { |
53 | friend class TransMenuHandler; | 53 | friend class TransMenuHandler; |
54 | public: | 54 | public: |
55 | @@ -121,33 +119,14 @@ | 55 | @@ -121,33 +119,14 @@ |
56 | bool tickAbove, bool tickBelow); | 56 | bool tickAbove, bool tickBelow); |
57 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, | 57 | void drawSliderMask(QPainter *p, int x, int y, int w, int h, |
58 | Orientation orient, bool, bool); | 58 | Orientation orient, bool, bool); |
59 | - void drawKToolBar(QPainter *p, int x, int y, int w, int h, | 59 | - void drawKToolBar(QPainter *p, int x, int y, int w, int h, |
60 | - const QColorGroup &g, KToolBarPos type, | 60 | - const QColorGroup &g, KToolBarPos type, |
61 | - QBrush *fill=NULL); | 61 | - QBrush *fill=NULL); |
62 | - void drawKBarHandle(QPainter *p, int x, int y, int w, int h, | 62 | - void drawKBarHandle(QPainter *p, int x, int y, int w, int h, |
63 | - const QColorGroup &g, | 63 | - const QColorGroup &g, |
64 | - KToolBarPos type, QBrush *fill=NULL); | 64 | - KToolBarPos type, QBrush *fill=NULL); |
65 | - void drawKMenuBar(QPainter *p, int x, int y, int w, int h, | 65 | - void drawKMenuBar(QPainter *p, int x, int y, int w, int h, |
66 | - const QColorGroup &g, bool macMode, | 66 | - const QColorGroup &g, bool macMode, |
67 | - QBrush *fill=NULL); | 67 | - QBrush *fill=NULL); |
68 | - void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | 68 | - void drawKToolBarButton(QPainter *p, int x, int y, int w, int h, |
69 | - const QColorGroup &g, bool sunken=false, | 69 | - const QColorGroup &g, bool sunken=false, |
70 | - bool raised = true, bool enabled = true, | 70 | - bool raised = true, bool enabled = true, |
71 | - bool popup = false, | 71 | - bool popup = false, |
72 | - KToolButtonType icontext = Icon, | 72 | - KToolButtonType icontext = Icon, |
73 | - const QString& btext=QString::null, | 73 | - const QString& btext=QString::null, |
74 | - const QPixmap *icon=NULL, | 74 | - const QPixmap *icon=NULL, |
75 | - QFont *font=NULL, QWidget *btn=NULL); | 75 | - QFont *font=NULL, QWidget *btn=NULL); |
76 | - void drawKMenuItem(QPainter *p, int x, int y, int w, int h, | 76 | - void drawKMenuItem(QPainter *p, int x, int y, int w, int h, |
77 | - const QColorGroup &g, bool active, | 77 | - const QColorGroup &g, bool active, |
78 | - QMenuItem *item, QBrush *fill=NULL); | 78 | - QMenuItem *item, QBrush *fill=NULL); |
79 | +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 79 | +void drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
80 | + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); | 80 | + QMenuItem *mi, QColorGroup &g, bool enabled, bool active ); |
81 | + | 81 | + |
82 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, | 82 | void drawPopupMenuItem(QPainter *p, bool checkable, int maxpmw, |
83 | int tab, QMenuItem *mi, const QPalette &pal, | 83 | int tab, QMenuItem *mi, const QPalette &pal, |
84 | bool act, bool enabled, int x, int y, int w, | 84 | bool act, bool enabled, int x, int y, int w, |
85 | int h); | 85 | int h); |
86 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); | 86 | int popupMenuItemHeight(bool c, QMenuItem *mi, const QFontMetrics &fm); |
87 | - void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | 87 | - void drawKProgressBlock(QPainter *p, int x, int y, int w, int h, |
88 | - const QColorGroup &g, QBrush *fill); | 88 | - const QColorGroup &g, QBrush *fill); |
89 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, | 89 | void drawFocusRect(QPainter *p, const QRect &r, const QColorGroup &g, |
90 | const QColor *pen, bool atBorder); | 90 | const QColor *pen, bool atBorder); |
91 | int defaultFrameWidth() const {return(2);} | 91 | int defaultFrameWidth() const {return(2);} |
92 | @@ -167,12 +146,6 @@ | 92 | @@ -167,12 +146,6 @@ |
93 | void drawToolButton(QPainter *p, int x, int y, int w, | 93 | void drawToolButton(QPainter *p, int x, int y, int w, |
94 | int h, const QColorGroup &g, | 94 | int h, const QColorGroup &g, |
95 | bool sunken, const QBrush *fill); | 95 | bool sunken, const QBrush *fill); |
96 | - void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | 96 | - void drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, |
97 | - const QColorGroup &g, QBrush *); | 97 | - const QColorGroup &g, QBrush *); |
98 | - void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, | 98 | - void drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, |
99 | - const QColorGroup &g, | 99 | - const QColorGroup &g, |
100 | - const QString &title, bool active, | 100 | - const QString &title, bool active, |
101 | - QPixmap *icon, QBrush *fill); | 101 | - QPixmap *icon, QBrush *fill); |
102 | // for repainting toolbuttons when the toolbar is resized | 102 | // for repainting toolbuttons when the toolbar is resized |
103 | bool eventFilter(QObject *obj, QEvent *ev); | 103 | bool eventFilter(QObject *obj, QEvent *ev); |
104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, | 104 | void drawSliderGroove(QPainter * p, int x, int y, int w, int h, |
105 | --- -Mon Jul 1 11:38:05 2002 | 105 | @@ -204,6 +177,7 @@ |
106 | +++ liquid.cppMon Jul 1 03:45:28 2002 | 106 | QPixmap* getPixmap(BitmapData item); |
107 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | ||
108 | private: | ||
109 | +bool flatTBButtons; | ||
110 | bool highcolor; | ||
111 | QColorGroup radioOnGrp; | ||
112 | QWidget *highlightWidget; | ||
113 | --- -Mon Jul 15 02:34:13 2002 | ||
114 | +++ liquid.cppMon Jul 15 02:31:59 2002 | ||
107 | @@ -10,12 +10,10 @@ | 115 | @@ -10,12 +10,10 @@ |
108 | 116 | ||
109 | #include <qmenudata.h> | 117 | #include <qmenudata.h> |
110 | #include "liquid.h" | 118 | #include "liquid.h" |
111 | -#include <kapp.h> | 119 | -#include <kapp.h> |
112 | -#include <kglobal.h> | 120 | -#include <kglobal.h> |
113 | -#include <kconfig.h> | 121 | -#include <kconfig.h> |
114 | -#include <kdrawutil.h> | 122 | -#include <kdrawutil.h> |
115 | -#include <kglobalsettings.h> | 123 | -#include <kglobalsettings.h> |
116 | -#include <kpixmapeffect.h> | 124 | -#include <kpixmapeffect.h> |
117 | +#include "liquiddeco.h" | 125 | +#include "liquiddeco.h" |
118 | +#include <qapplication.h> | 126 | +#include <qapplication.h> |
119 | +#include <qpe/config.h> | 127 | +#include <qpe/config.h> |
120 | +#include "effects.h" | 128 | +#include "effects.h" |
121 | #include <qpalette.h> | 129 | #include <qpalette.h> |
122 | #include <qbitmap.h> | 130 | #include <qbitmap.h> |
123 | #include <qtabbar.h> | 131 | #include <qtabbar.h> |
124 | @@ -25,28 +23,29 @@ | 132 | @@ -25,28 +23,29 @@ |
125 | #include <qtimer.h> | 133 | #include <qtimer.h> |
126 | #include <qpixmapcache.h> | 134 | #include <qpixmapcache.h> |
127 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
128 | -#include <kimageeffect.h> | 136 | -#include <kimageeffect.h> |
129 | -#include <ktoolbar.h> | 137 | -#include <ktoolbar.h> |
130 | +#include <qcombobox.h> | 138 | +#include <qcombobox.h> |
131 | #include <qdrawutil.h> | 139 | #include <qdrawutil.h> |
132 | #include <qwidgetlist.h> | 140 | #include <qwidgetlist.h> |
133 | #include <qtoolbutton.h> | 141 | #include <qtoolbutton.h> |
134 | #include <qheader.h> | 142 | #include <qheader.h> |
135 | #include <unistd.h> | 143 | #include <unistd.h> |
136 | -#include <klocale.h> | 144 | -#include <klocale.h> |
137 | -#include <kiconloader.h> | 145 | -#include <kiconloader.h> |
138 | -#include <kmenubar.h> | 146 | -#include <kmenubar.h> |
139 | -#include <kipc.h> | 147 | -#include <kipc.h> |
140 | +#include <qmenubar.h> | 148 | +#include <qmenubar.h> |
141 | 149 | ||
142 | -#include <X11/X.h> | 150 | -#include <X11/X.h> |
143 | -#include <X11/Xlib.h> | 151 | -#include <X11/Xlib.h> |
144 | + | 152 | + |
145 | +#include <stdio.h> | 153 | +#include <stdio.h> |
146 | 154 | ||
147 | #include "htmlmasks.h" | 155 | #include "htmlmasks.h" |
148 | #include "embeddata.h" | 156 | #include "embeddata.h" |
149 | 157 | ||
150 | -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) | 158 | -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) |
151 | +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, | 159 | +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, |
152 | + QColorGroup &, bool, bool); | 160 | + QColorGroup &, bool, bool); |
153 | + | 161 | + |
154 | +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); | 162 | +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); |
155 | + | 163 | + |
156 | +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | 164 | +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) |
157 | { | 165 | { |
158 | QImage img(pix.convertToImage()); | 166 | QImage img(pix.convertToImage()); |
159 | - KImageEffect::fade(img, 0.9, color); | 167 | - KImageEffect::fade(img, 0.9, color); |
160 | + QImageEffect::fade(img, 0.9, color); | 168 | + QImageEffect::fade(img, 0.9, color); |
161 | int x, y; | 169 | int x, y; |
162 | int r, g, b; | 170 | int r, g, b; |
163 | for(y=0; y < img.height(); y+=3){ | 171 | for(y=0; y < img.height(); y+=3){ |
164 | @@ -71,35 +70,37 @@ | 172 | @@ -71,35 +70,37 @@ |
165 | : QObject(parent) | 173 | : QObject(parent) |
166 | { | 174 | { |
167 | pixDict.setAutoDelete(true); | 175 | pixDict.setAutoDelete(true); |
168 | - connect(kapp, SIGNAL(kipcMessage(int, int)), this, | 176 | - connect(kapp, SIGNAL(kipcMessage(int, int)), this, |
169 | - SLOT(slotKIPCMessage(int, int))); | 177 | - SLOT(slotKIPCMessage(int, int))); |
170 | reloadSettings(); | 178 | reloadSettings(); |
171 | } | 179 | } |
172 | 180 | ||
173 | void TransMenuHandler::reloadSettings() | 181 | void TransMenuHandler::reloadSettings() |
174 | { | 182 | { |
175 | pixDict.clear(); | 183 | pixDict.clear(); |
176 | - KConfig *config = KGlobal::config(); | 184 | - KConfig *config = KGlobal::config(); |
177 | - config->setGroup("MosfetMenus"); | 185 | - config->setGroup("MosfetMenus"); |
178 | 186 | ||
179 | - type = config->readNumEntry("Type", TransStippleBg); | 187 | - type = config->readNumEntry("Type", TransStippleBg); |
180 | - color = config->readColorEntry("Color", | 188 | - color = config->readColorEntry("Color", |
181 | - &QApplication::palette().active().button()); | 189 | - &QApplication::palette().active().button()); |
182 | - fgColor = config->readColorEntry("TextColor", | 190 | - fgColor = config->readColorEntry("TextColor", |
183 | - &QApplication::palette().active().text()); | 191 | - &QApplication::palette().active().text()); |
184 | - opacity = config->readNumEntry("Opacity", 10); | 192 | - opacity = config->readNumEntry("Opacity", 10); |
185 | - shadowText = config->readBoolEntry("ShadowText", true); | 193 | - shadowText = config->readBoolEntry("ShadowText", true); |
186 | + Config config ( "qpe" ); | 194 | + Config config ( "qpe" ); |
187 | + config. setGroup ( "MosfetMenus" ); | 195 | + config. setGroup ( "Liquid-Style" ); |
188 | + | 196 | + |
189 | + type = config. readNumEntry("Type", TransStippleBg); | 197 | + type = config. readNumEntry("Type", TransStippleBg); |
190 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | 198 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); |
191 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | 199 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); |
192 | + opacity = config. readNumEntry("Opacity", 10); | 200 | + opacity = config. readNumEntry("Opacity", 10); |
193 | + if ( opacity < -20 ) | 201 | + if ( opacity < -20 ) |
194 | + opacity = 20; | 202 | + opacity = 20; |
195 | + else if ( opacity > 20 ) | 203 | + else if ( opacity > 20 ) |
196 | + opacity = 20; | 204 | + opacity = 20; |
197 | + | 205 | + |
198 | + shadowText = config. readBoolEntry("ShadowText", true); | 206 | + shadowText = config. readBoolEntry("ShadowText", true); |
199 | } | 207 | } |
200 | 208 | ||
201 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 209 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) |
202 | { | 210 | { |
203 | - QPopupMenu *p = (QPopupMenu *)obj; | 211 | - QPopupMenu *p = (QPopupMenu *)obj; |
204 | + QWidget *p = (QWidget *)obj; | 212 | + QWidget *p = (QWidget *)obj; |
205 | 213 | ||
206 | if(ev->type() == QEvent::Show){ | 214 | if(ev->type() == QEvent::Show){ |
207 | if(type == TransStippleBg || type == TransStippleBtn || | 215 | if(type == TransStippleBg || type == TransStippleBtn || |
208 | type == Custom){ | 216 | type == Custom){ |
209 | QApplication::syncX(); | 217 | QApplication::syncX(); |
210 | - KPixmap *pix = new KPixmap; | 218 | - KPixmap *pix = new KPixmap; |
211 | + QPixmap *pix = new QPixmap; | 219 | + QPixmap *pix = new QPixmap; |
212 | if(p->testWFlags(Qt::WType_Popup)){ | 220 | if(p->testWFlags(Qt::WType_Popup)){ |
213 | QRect r(p->x(), p->y(), p->width(), p->height()); | 221 | QRect r(p->x(), p->y(), p->width(), p->height()); |
214 | QRect deskR = QApplication::desktop()->rect(); | 222 | QRect deskR = QApplication::desktop()->rect(); |
215 | @@ -107,7 +108,7 @@ | 223 | @@ -107,7 +108,7 @@ |
216 | r.setBottom(deskR.bottom()); | 224 | r.setBottom(deskR.bottom()); |
217 | r.setRight(deskR.right()); | 225 | r.setRight(deskR.right()); |
218 | } | 226 | } |
219 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), | 227 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), |
220 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 228 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
221 | r.width(), r.height()); | 229 | r.width(), r.height()); |
222 | } | 230 | } |
223 | else{ // tear off menu | 231 | else{ // tear off menu |
224 | @@ -121,82 +122,54 @@ | 232 | @@ -121,82 +122,55 @@ |
225 | stripePixmap(*pix, p->colorGroup().button()); | 233 | stripePixmap(*pix, p->colorGroup().button()); |
226 | } | 234 | } |
227 | else{ | 235 | else{ |
228 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 236 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
229 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 237 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
230 | } | 238 | } |
231 | + | 239 | + |
232 | + if (p->inherits("QPopupMenu")) | ||
233 | pixDict.insert(p->winId(), pix); | 240 | pixDict.insert(p->winId(), pix); |
234 | + else { | 241 | + |
242 | + if (!p->inherits("QPopupMenu")) { | ||
235 | + p->setBackgroundPixmap(*pix); | 243 | + p->setBackgroundPixmap(*pix); |
236 | + | 244 | + |
237 | + QObjectList *ol = p-> queryList("QWidget"); | 245 | + QObjectList *ol = p-> queryList("QWidget"); |
238 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 246 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
239 | + QWidget *wid = (QWidget *) it.current ( ); | 247 | + QWidget *wid = (QWidget *) it.current ( ); |
240 | + | 248 | + |
241 | + wid-> setBackgroundPixmap(*pix); | 249 | + wid-> setBackgroundPixmap(*pix); |
242 | + wid-> setBackgroundOrigin(QWidget::ParentOrigin); | 250 | + wid-> setBackgroundOrigin(QWidget::ParentOrigin); |
243 | + } | 251 | + } |
244 | + delete ol; | 252 | + delete ol; |
245 | + } | 253 | + } |
246 | } | 254 | } |
247 | } | 255 | } |
248 | else if(ev->type() == QEvent::Hide){ | 256 | else if(ev->type() == QEvent::Hide){ |
249 | if(type == TransStippleBg || type == TransStippleBtn || | 257 | if(type == TransStippleBg || type == TransStippleBtn || |
250 | type == Custom){ | 258 | type == Custom){ |
251 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 259 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
252 | - pixDict.remove(p->winId()); | 260 | - pixDict.remove(p->winId()); |
253 | - } | 261 | - } |
254 | - } | 262 | - } |
255 | - return(false); | 263 | - return(false); |
256 | -} | 264 | -} |
257 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 265 | - |
258 | |||
259 | -void TransMenuHandler::slotKIPCMessage(int id, int) | 266 | -void TransMenuHandler::slotKIPCMessage(int id, int) |
260 | -{ | 267 | -{ |
261 | - if(id == LIQUID_MENU_CHANGE){ | 268 | - if(id == LIQUID_MENU_CHANGE){ |
262 | - bool oldShadow = shadowText; | 269 | - bool oldShadow = shadowText; |
263 | - | 270 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
271 | |||
264 | - KConfig *config = KGlobal::config(); | 272 | - KConfig *config = KGlobal::config(); |
265 | - config->reparseConfiguration(); // in case KControl changed values | 273 | - config->reparseConfiguration(); // in case KControl changed values |
266 | - | 274 | - |
267 | - // Make sure no popupmenus are shown. There shouldn't be any because | 275 | - // Make sure no popupmenus are shown. There shouldn't be any because |
268 | - // the user just clicked "Apply", but there can be tear offs ;-) | 276 | - // the user just clicked "Apply", but there can be tear offs ;-) |
269 | - // We just close them so the pixmaps are deleted and regenerated. | 277 | - // We just close them so the pixmaps are deleted and regenerated. |
270 | - QWidgetList *list = QApplication::topLevelWidgets(); | 278 | - QWidgetList *list = QApplication::topLevelWidgets(); |
271 | - QWidgetListIt it( *list ); | 279 | - QWidgetListIt it( *list ); |
272 | - QWidget *w; | 280 | - QWidget *w; |
273 | - while ((w=it.current()) != 0 ){ | 281 | - while ((w=it.current()) != 0 ){ |
274 | - ++it; | 282 | - ++it; |
275 | - if(w->inherits("QPopupMenu")){ | 283 | - if(w->inherits("QPopupMenu")){ |
276 | - w->close(); | 284 | - w->close(); |
277 | - } | 285 | - } |
278 | - } | 286 | - } |
279 | + if (p->inherits("QPopupMenu")) | 287 | + pixDict.remove(p->winId()); |
280 | + pixDict.remove(p->winId()); | 288 | + if (!p->inherits("QPopupMenu")) { |
281 | + else { | 289 | + p->setBackgroundMode(QWidget::PaletteBackground); |
282 | + p->setBackgroundMode(QWidget::PaletteBackground); | ||
283 | 290 | ||
284 | - reloadSettings(); | 291 | - reloadSettings(); |
285 | + QObjectList *ol = p-> queryList("QWidget"); | 292 | + QObjectList *ol = p-> queryList("QWidget"); |
286 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 293 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
287 | + QWidget *wid = (QWidget *) it.current ( ); | 294 | + QWidget *wid = (QWidget *) it.current ( ); |
288 | 295 | ||
289 | - // Now repaint menubar if needed | 296 | - // Now repaint menubar if needed |
290 | - if(shadowText != oldShadow){ | 297 | - if(shadowText != oldShadow){ |
291 | - it.toFirst(); | 298 | - it.toFirst(); |
292 | - while ((w=it.current()) != 0 ){ | 299 | - while ((w=it.current()) != 0 ){ |
293 | - ++it; | 300 | - ++it; |
294 | - if(w->inherits("QMenuBar")){ | 301 | - if(w->inherits("QMenuBar")){ |
295 | - w->repaint(); | 302 | - w->repaint(); |
296 | - } | 303 | - } |
297 | - } | 304 | - } |
298 | - } | 305 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); |
306 | } | ||
299 | - } | 307 | - } |
300 | - else if(id == MOSFET_BUTTON_CHANGE){ | 308 | - else if(id == MOSFET_BUTTON_CHANGE){ |
301 | - qWarning("In mosfet button change"); | 309 | - qWarning("In mosfet button change"); |
302 | - // really, this should be in LiquidStyle, but what the hell? ;-) | 310 | - // really, this should be in LiquidStyle, but what the hell? ;-) |
303 | - QWidgetList *list = QApplication::allWidgets(); | 311 | - QWidgetList *list = QApplication::allWidgets(); |
304 | - QWidgetListIt it( *list ); | 312 | - QWidgetListIt it( *list ); |
305 | - QWidget *w; | 313 | - QWidget *w; |
306 | - while ((w=it.current()) != 0 ){ | 314 | - while ((w=it.current()) != 0 ){ |
307 | - ++it; | 315 | - ++it; |
308 | - if(w->inherits("QPushButton")){ | 316 | - if(w->inherits("QPushButton")){ |
309 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); | 317 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); |
310 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); | 318 | - } |
311 | } | ||
312 | - } | 319 | - } |
313 | - ((LiquidStyle*)parent())->loadCustomButtons(); | 320 | - ((LiquidStyle*)parent())->loadCustomButtons(); |
314 | - it.toFirst(); | 321 | - it.toFirst(); |
315 | - while ((w=it.current()) != 0 ){ | 322 | - while ((w=it.current()) != 0 ){ |
316 | - ++it; | 323 | - ++it; |
317 | - if(w->inherits("QPushButton")){ | 324 | - if(w->inherits("QPushButton")){ |
318 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); | 325 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); |
319 | + delete ol; | 326 | + delete ol; |
320 | } | 327 | } |
321 | } | 328 | } |
322 | - | 329 | - |
323 | } | 330 | } |
324 | + return(false); | 331 | + return(false); |
325 | } | 332 | } |
326 | 333 | ||
327 | + | 334 | + |
328 | LiquidStyle::LiquidStyle() | 335 | LiquidStyle::LiquidStyle() |
329 | - :KStyle() | 336 | - :KStyle() |
330 | + :QWindowsStyle() | 337 | + :QWindowsStyle() |
331 | { | 338 | { |
332 | + setName ( "LiquidStyle" ); | 339 | + setName ( "LiquidStyle" ); |
333 | + | 340 | + |
341 | +flatTBButtons = false; | ||
342 | + | ||
334 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 343 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
335 | btnMaskBmp.setMask(btnMaskBmp); | 344 | btnMaskBmp.setMask(btnMaskBmp); |
336 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 345 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
337 | @@ -730,20 +703,19 @@ | 346 | @@ -730,20 +704,26 @@ |
338 | } | 347 | } |
339 | 348 | ||
340 | loadCustomButtons(); | 349 | loadCustomButtons(); |
341 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; | 350 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; |
342 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 351 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
343 | btnDict.clear(); | 352 | btnDict.clear(); |
344 | btnBorderDict.clear(); | 353 | btnBorderDict.clear(); |
345 | bevelFillDict.clear(); | 354 | bevelFillDict.clear(); |
346 | smallBevelFillDict.clear(); | 355 | smallBevelFillDict.clear(); |
347 | 356 | ||
348 | - KConfig *config = KGlobal::config(); | 357 | - KConfig *config = KGlobal::config(); |
349 | - QString oldGrp = config->group(); | 358 | - QString oldGrp = config->group(); |
350 | + Config config ( "qpe" ); | 359 | + Config config ( "qpe" ); |
360 | + config. setGroup ( "Liquid-Style" ); | ||
361 | +int contrast = config. readNumEntry ( "StippleContrast", 5 ); | ||
362 | +if ( contrast < 0 ) | ||
363 | + contrast = 0; | ||
364 | +else if ( contrast > 10 ) | ||
365 | + contrast = 10; | ||
366 | + | ||
351 | QPalette pal = QApplication::palette(); | 367 | QPalette pal = QApplication::palette(); |
352 | 368 | ||
353 | // button color stuff | 369 | // button color stuff |
354 | - config->setGroup("General"); | 370 | - config->setGroup("General"); |
355 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); | 371 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); |
356 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ | 372 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ |
357 | + config. setGroup ( "Appearance" ); | 373 | + config. setGroup ( "Appearance" ); |
358 | + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 374 | + QColor c = QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
359 | + if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { | 375 | + if ( c == QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))) { |
360 | // force button color to be different from background | 376 | // force button color to be different from background |
361 | QBrush btnBrush(QColor(200, 202, 228)); | 377 | QBrush btnBrush(QColor(200, 202, 228)); |
362 | appPal.setBrush(QColorGroup::Button, btnBrush); | 378 | appPal.setBrush(QColorGroup::Button, btnBrush); |
363 | @@ -794,15 +766,7 @@ | 379 | @@ -794,15 +774,7 @@ |
364 | pagerBrush.setPixmap(*pix); | 380 | pagerBrush.setPixmap(*pix); |
365 | 381 | ||
366 | // background color stuff | 382 | // background color stuff |
367 | - c = config->readColorEntry("background", &Qt::lightGray); | 383 | - c = config->readColorEntry("background", &Qt::lightGray); |
368 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ | 384 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ |
369 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); | 385 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); |
370 | - appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); | 386 | - appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); |
371 | - appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); | 387 | - appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); |
372 | - appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); | 388 | - appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); |
373 | - menuBrush.setColor(c); // hack - used for kicker applets | 389 | - menuBrush.setColor(c); // hack - used for kicker applets |
374 | - appPal.setBrush(QColorGroup::Background, menuBrush); | 390 | - appPal.setBrush(QColorGroup::Background, menuBrush); |
375 | - } | 391 | - } |
376 | + c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); | 392 | + c = QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))); |
377 | c.hsv(&bH, &bS, &bV); | 393 | c.hsv(&bH, &bS, &bV); |
378 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 394 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
379 | 395 | ||
380 | @@ -825,13 +789,10 @@ | 396 | @@ -817,21 +789,18 @@ |
397 | wallPaper.fill(c.rgb()); | ||
398 | painter.begin(&wallPaper); | ||
399 | for(i=0; i < 32; i+=4){ | ||
400 | - painter.setPen(c.dark(105)); | ||
401 | + painter.setPen(c.dark(100 + contrast)); | ||
402 | painter.drawLine(0, i, 32, i); | ||
403 | - painter.setPen(c.dark(103)); | ||
404 | + painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | ||
405 | painter.drawLine(0, i+1, 32, i+1); | ||
406 | }; | ||
381 | painter.end(); | 407 | painter.end(); |
382 | bgBrush.setColor(c); | 408 | bgBrush.setColor(c); |
383 | bgBrush.setPixmap(wallPaper); | 409 | bgBrush.setPixmap(wallPaper); |
384 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && | 410 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && |
385 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ | 411 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ |
386 | appPal.setBrush(QColorGroup::Background, bgBrush); | 412 | appPal.setBrush(QColorGroup::Background, bgBrush); |
387 | - } | 413 | - } |
388 | 414 | ||
389 | // lineedits | 415 | // lineedits |
390 | - c = config->readColorEntry("windowBackground", &Qt::white); | 416 | - c = config->readColorEntry("windowBackground", &Qt::white); |
391 | + c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); | 417 | + c = QColor ( config. readEntry("Base", ( Qt::white). name ( ))); |
392 | QPixmap basePix; | 418 | QPixmap basePix; |
393 | basePix.resize(32, 32); | 419 | basePix.resize(32, 32); |
394 | basePix.fill(c.rgb()); | 420 | basePix.fill(c.rgb()); |
395 | @@ -857,51 +818,31 @@ | 421 | @@ -857,51 +826,39 @@ |
396 | } | 422 | } |
397 | } | 423 | } |
398 | 424 | ||
399 | - config->setGroup(oldGrp); | 425 | - config->setGroup(oldGrp); |
400 | } | 426 | } |
401 | 427 | ||
402 | void LiquidStyle::polish(QWidget *w) | 428 | void LiquidStyle::polish(QWidget *w) |
403 | { | 429 | { |
404 | if(w->inherits("QMenuBar")){ | 430 | if(w->inherits("QMenuBar")){ |
405 | - ((QFrame*)w)->setLineWidth(0); | 431 | - ((QFrame*)w)->setLineWidth(0); |
406 | - w->setBackgroundMode(QWidget::NoBackground); | 432 | - w->setBackgroundMode(QWidget::NoBackground); |
407 | + //((QFrame*)w)->setLineWidth(0); | 433 | + //((QFrame*)w)->setLineWidth(0); |
408 | + w->setBackgroundMode(QWidget::PaletteBackground); | 434 | + w->setBackgroundMode(QWidget::PaletteBackground); |
435 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
436 | + return; | ||
437 | + } | ||
438 | + if(w->inherits("QToolBar")){ | ||
439 | + w->installEventFilter(this); | ||
440 | + w->setBackgroundMode(QWidget::PaletteBackground); | ||
441 | + w->setBackgroundOrigin(QWidget::WidgetOrigin); | ||
409 | return; | 442 | return; |
410 | } | 443 | } |
411 | if(w->inherits("QPopupMenu")) | 444 | if(w->inherits("QPopupMenu")) |
412 | w->setBackgroundMode(QWidget::NoBackground); | 445 | w->setBackgroundMode(QWidget::NoBackground); |
413 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 446 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
414 | + w->installEventFilter(menuHandler); | 447 | + w->installEventFilter(menuHandler); |
415 | + } | 448 | + } |
416 | 449 | ||
417 | if(w->isTopLevel()){ | 450 | if(w->isTopLevel()){ |
418 | - if(!w->inherits("QPopupMenu") && | 451 | - if(!w->inherits("QPopupMenu") && |
419 | - qstrcmp(kapp->argv()[0], "kicker") == 0){ | 452 | - qstrcmp(kapp->argv()[0], "kicker") == 0){ |
420 | - qWarning("Got panel toplevel %s", w->className()); | 453 | - qWarning("Got panel toplevel %s", w->className()); |
421 | - // force extensions and child panels to use proper palette. | 454 | - // force extensions and child panels to use proper palette. |
422 | - if(w->inherits("Panel")){ | 455 | - if(w->inherits("Panel")){ |
423 | - qWarning("Setting panel palette"); | 456 | - qWarning("Setting panel palette"); |
424 | - w->setPalette(kapp->palette()); | 457 | - w->setPalette(kapp->palette()); |
425 | - } | 458 | - } |
426 | - else{ | 459 | - else{ |
427 | - // reset palette for everything else | 460 | - // reset palette for everything else |
428 | - QPalette pal = kapp->palette(); | 461 | - QPalette pal = kapp->palette(); |
429 | - pal.setBrush(QColorGroup::Background, bgBrush); | 462 | - pal.setBrush(QColorGroup::Background, bgBrush); |
430 | - pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); | 463 | - pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); |
431 | - pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); | 464 | - pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); |
432 | - pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); | 465 | - pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); |
433 | - pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); | 466 | - pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); |
434 | - w->setPalette(pal); | 467 | - w->setPalette(pal); |
435 | - } | 468 | - } |
436 | - } | 469 | - } |
437 | return; | 470 | return; |
438 | } | 471 | } |
439 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && | 472 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && |
440 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work | 473 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work |
441 | - w->setPalette(kapp->palette()); | 474 | - w->setPalette(kapp->palette()); |
442 | - } | 475 | - } |
443 | + | 476 | + |
444 | + | 477 | + |
445 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 478 | + if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) |
479 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
446 | 480 | ||
447 | if(w->inherits("QComboBox") || | 481 | if(w->inherits("QComboBox") || |
448 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 482 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
449 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 483 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
450 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 484 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
451 | - w->inherits("TaskContainer")){ | 485 | - w->inherits("TaskContainer")){ |
452 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 486 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
453 | w->installEventFilter(this); | 487 | w->installEventFilter(this); |
454 | } | 488 | } |
455 | if(w->inherits("QLineEdit")){ | 489 | if(w->inherits("QLineEdit")){ |
456 | @@ -913,6 +854,9 @@ | 490 | @@ -913,6 +870,9 @@ |
457 | applyCustomAttributes((QPushButton *)w); | 491 | applyCustomAttributes((QPushButton *)w); |
458 | w->installEventFilter(this); | 492 | w->installEventFilter(this); |
459 | } | 493 | } |
460 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 494 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
461 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); | 495 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); |
462 | + } | 496 | + } |
463 | 497 | ||
464 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 498 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
465 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 499 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
466 | @@ -942,11 +886,12 @@ | 500 | @@ -942,11 +902,14 @@ |
467 | w->setMouseTracking(true); | 501 | w->setMouseTracking(true); |
468 | w->installEventFilter(this); | 502 | w->installEventFilter(this); |
469 | } | 503 | } |
470 | + if(w-> inherits("QToolButton")) { | 504 | + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
471 | + ((QToolButton*)w)->setAutoRaise (false); | 505 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
506 | + if ( flatTBButtons ) | ||
507 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
472 | + } | 508 | + } |
473 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 509 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
474 | return; | 510 | return; |
475 | } | 511 | } |
476 | - if(w->inherits("PanelButtonBase")) | 512 | - if(w->inherits("PanelButtonBase")) |
477 | - return; | 513 | - return; |
478 | 514 | ||
479 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 515 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
480 | palette().active().brush(QColorGroup::Background).pixmap()){ | 516 | palette().active().brush(QColorGroup::Background).pixmap()){ |
481 | @@ -954,17 +899,18 @@ | 517 | @@ -954,17 +917,13 @@ |
482 | return; | 518 | return; |
483 | } | 519 | } |
484 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 520 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
485 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ | 521 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ |
486 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 522 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
487 | if(w->backgroundMode() == QWidget::PaletteBackground || | 523 | if(w->backgroundMode() == QWidget::PaletteBackground || |
488 | w->backgroundMode() == QWidget::PaletteButton){ | 524 | w->backgroundMode() == QWidget::PaletteButton){ |
489 | w->setBackgroundMode(QWidget::X11ParentRelative); | 525 | w->setBackgroundMode(QWidget::X11ParentRelative); |
490 | } | 526 | } |
491 | } | 527 | } |
492 | - if(w->inherits("KToolBar")){ | 528 | - if(w->inherits("KToolBar")){ |
493 | + if(w->inherits("QToolBar")){ | 529 | - w->installEventFilter(this); |
494 | w->installEventFilter(this); | ||
495 | - //w->setBackgroundMode(QWidget::NoBackground); | 530 | - //w->setBackgroundMode(QWidget::NoBackground); |
496 | + w->setBackgroundMode(QWidget::PaletteBackground); | 531 | - return; |
497 | return; | 532 | - } |
498 | } | ||
499 | + | 533 | + |
500 | } | 534 | } |
501 | 535 | ||
502 | void LiquidStyle::unPolish(QWidget *w) | 536 | void LiquidStyle::unPolish(QWidget *w) |
503 | @@ -977,6 +923,9 @@ | 537 | @@ -977,6 +936,9 @@ |
504 | 538 | ||
505 | if(w->inherits("QPopupMenu")) | 539 | if(w->inherits("QPopupMenu")) |
506 | w->setBackgroundMode(QWidget::PaletteButton); | 540 | w->setBackgroundMode(QWidget::PaletteButton); |
507 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 541 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
508 | + w->removeEventFilter(menuHandler); | 542 | + w->removeEventFilter(menuHandler); |
509 | + } | 543 | + } |
510 | 544 | ||
511 | if(w->isTopLevel()) | 545 | if(w->isTopLevel()) |
512 | return; | 546 | return; |
513 | @@ -1001,12 +950,14 @@ | 547 | @@ -1001,12 +963,14 @@ |
514 | unapplyCustomAttributes((QPushButton *)w); | 548 | unapplyCustomAttributes((QPushButton *)w); |
515 | w->removeEventFilter(this); | 549 | w->removeEventFilter(this); |
516 | } | 550 | } |
517 | - | 551 | - |
518 | +/* | 552 | +/* |
519 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 553 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
520 | + w-> setBackgroundMode ( PaletteBackground ); | 554 | + w-> setBackgroundMode ( PaletteBackground ); |
521 | + } | 555 | + } |
522 | +*/ | 556 | +*/ |
523 | if(w->inherits("QComboBox") || | 557 | if(w->inherits("QComboBox") || |
524 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 558 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
525 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 559 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
526 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 560 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
527 | - w->inherits("TaskContainer")){ | 561 | - w->inherits("TaskContainer")){ |
528 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 562 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
529 | w->removeEventFilter(this); | 563 | w->removeEventFilter(this); |
530 | } | 564 | } |
531 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 565 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
532 | @@ -1014,9 +965,9 @@ | 566 | @@ -1014,9 +978,9 @@ |
533 | w->setAutoMask(false); | 567 | w->setAutoMask(false); |
534 | } | 568 | } |
535 | } | 569 | } |
536 | - if(w->inherits("KToolBar")){ | 570 | - if(w->inherits("KToolBar")){ |
537 | + if(w->inherits("QToolBar")){ | 571 | + if(w->inherits("QToolBar")){ |
538 | w->removeEventFilter(this); | 572 | w->removeEventFilter(this); |
539 | - //w->setBackgroundMode(QWidget::PaletteBackground); | 573 | - //w->setBackgroundMode(QWidget::PaletteBackground); |
540 | + w->setBackgroundMode(QWidget::PaletteBackground); | 574 | + w->setBackgroundMode(QWidget::PaletteBackground); |
541 | return; | 575 | return; |
542 | } | 576 | } |
543 | if(w->inherits("QHeader")){ | 577 | if(w->inherits("QHeader")){ |
544 | @@ -1028,20 +979,28 @@ | 578 | @@ -1028,20 +992,34 @@ |
545 | void LiquidStyle::polish(QApplication *app) | 579 | void LiquidStyle::polish(QApplication *app) |
546 | { | 580 | { |
547 | 581 | ||
548 | - KStyle::polish(app); | 582 | - KStyle::polish(app); |
549 | + QWindowsStyle::polish(app); | 583 | + QWindowsStyle::polish(app); |
550 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 584 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
551 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 585 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
552 | if(menuAni) | 586 | if(menuAni) |
553 | app->setEffectEnabled(UI_AnimateMenu, false); | 587 | app->setEffectEnabled(UI_AnimateMenu, false); |
554 | if(menuFade) | 588 | if(menuFade) |
555 | app->setEffectEnabled(UI_FadeMenu, false); | 589 | app->setEffectEnabled(UI_FadeMenu, false); |
556 | + | 590 | + |
557 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 591 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
558 | + | 592 | + |
559 | + QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 593 | + Config config ( "qpe" ); |
594 | + config. setGroup ( "Liquid-Style" ); | ||
595 | + | ||
596 | + if ( config. readBoolEntry ( "WinDecoration", true )) | ||
597 | + QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | ||
598 | + | ||
599 | +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | ||
560 | } | 600 | } |
561 | 601 | ||
562 | void LiquidStyle::unPolish(QApplication *app) | 602 | void LiquidStyle::unPolish(QApplication *app) |
563 | { | 603 | { |
564 | - KStyle::unPolish(app); | 604 | - KStyle::unPolish(app); |
565 | + QWindowsStyle::unPolish(app); | 605 | + QWindowsStyle::unPolish(app); |
566 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 606 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
567 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 607 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
568 | + | 608 | + |
569 | + qt_set_draw_menu_bar_impl ( 0 ); | 609 | + qt_set_draw_menu_bar_impl ( 0 ); |
570 | + | 610 | + |
571 | + QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 611 | + QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
572 | } | 612 | } |
573 | 613 | ||
574 | /* | 614 | /* |
575 | @@ -1063,7 +1022,7 @@ | 615 | @@ -1063,7 +1041,7 @@ |
576 | */ | 616 | */ |
577 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 617 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
578 | { | 618 | { |
579 | - if(obj->inherits("KToolBar")){ | 619 | - if(obj->inherits("KToolBar")){ |
580 | + if(obj->inherits("QToolBar")){ | 620 | + if(obj->inherits("QToolBar")){ |
581 | if(ev->type() == QEvent::Resize){ | 621 | if(ev->type() == QEvent::Resize){ |
582 | const QObjectList *tbChildList = obj->children(); | 622 | const QObjectList *tbChildList = obj->children(); |
583 | QObjectListIt it(*tbChildList); | 623 | QObjectListIt it(*tbChildList); |
584 | @@ -1076,35 +1035,7 @@ | 624 | @@ -1076,35 +1054,7 @@ |
585 | 625 | ||
586 | } | 626 | } |
587 | } | 627 | } |
588 | - else if(obj->inherits("KMiniPagerButton")){ | 628 | - else if(obj->inherits("KMiniPagerButton")){ |
589 | - QButton *btn = (QButton *)obj; | 629 | - QButton *btn = (QButton *)obj; |
590 | - if(ev->type() == QEvent::Paint){ | 630 | - if(ev->type() == QEvent::Paint){ |
591 | - if(!(btn->isOn() || btn->isDown())){ | 631 | - if(!(btn->isOn() || btn->isDown())){ |
592 | - QPalette pal = btn->palette(); | 632 | - QPalette pal = btn->palette(); |
593 | - pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? | 633 | - pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? |
594 | - pagerHoverBrush : pagerBrush); | 634 | - pagerHoverBrush : pagerBrush); |
595 | - btn->setPalette(pal); | 635 | - btn->setPalette(pal); |
596 | - } | 636 | - } |
597 | - else{ | 637 | - else{ |
598 | - QPalette pal = btn->palette(); | 638 | - QPalette pal = btn->palette(); |
599 | - pal.setBrush(QColorGroup::Dark, | 639 | - pal.setBrush(QColorGroup::Dark, |
600 | - QApplication::palette().active().brush(QColorGroup::Dark)); | 640 | - QApplication::palette().active().brush(QColorGroup::Dark)); |
601 | - btn->setPalette(pal); | 641 | - btn->setPalette(pal); |
602 | - | 642 | - |
603 | - } | 643 | - } |
604 | - } | 644 | - } |
605 | - else if(ev->type() == QEvent::Enter){ | 645 | - else if(ev->type() == QEvent::Enter){ |
606 | - highlightWidget = btn; | 646 | - highlightWidget = btn; |
607 | - btn->repaint(false); | 647 | - btn->repaint(false); |
608 | - } | 648 | - } |
609 | - else if(ev->type() == QEvent::Leave){ | 649 | - else if(ev->type() == QEvent::Leave){ |
610 | - highlightWidget = NULL; | 650 | - highlightWidget = NULL; |
611 | - btn->repaint(false); | 651 | - btn->repaint(false); |
612 | - } | 652 | - } |
613 | - | 653 | - |
614 | - } | 654 | - } |
615 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || | 655 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || |
616 | - obj->isA("AppletHandle")){ | 656 | - obj->isA("AppletHandle")){ |
617 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 657 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
618 | QWidget *btn = (QWidget *)obj; | 658 | QWidget *btn = (QWidget *)obj; |
619 | if(ev->type() == QEvent::Enter){ | 659 | if(ev->type() == QEvent::Enter){ |
620 | if(btn->isEnabled()){ | 660 | if(btn->isEnabled()){ |
621 | @@ -1119,20 +1050,7 @@ | 661 | @@ -1119,20 +1069,7 @@ |
622 | } | 662 | } |
623 | } | 663 | } |
624 | } | 664 | } |
625 | - else if(obj->inherits("TaskContainer")){ | 665 | - else if(obj->inherits("TaskContainer")){ |
626 | - QButton *btn = (QButton *)obj; | 666 | - QButton *btn = (QButton *)obj; |
627 | - QPalette pal = btn->palette(); | 667 | - QPalette pal = btn->palette(); |
628 | - if(ev->type() == QEvent::Enter){ | 668 | - if(ev->type() == QEvent::Enter){ |
629 | - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); | 669 | - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); |
630 | - btn->setPalette(pal); | 670 | - btn->setPalette(pal); |
631 | - } | 671 | - } |
632 | - else if(ev->type() == QEvent::Leave){ | 672 | - else if(ev->type() == QEvent::Leave){ |
633 | - pal.setColor(QColorGroup::Background, | 673 | - pal.setColor(QColorGroup::Background, |
634 | - QApplication::palette().active().background()); | 674 | - QApplication::palette().active().background()); |
635 | - btn->setPalette(pal); | 675 | - btn->setPalette(pal); |
636 | - } | 676 | - } |
637 | - } | 677 | - } |
638 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ | 678 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ |
639 | + else if(obj->inherits("QToolButton")){ | 679 | + else if(obj->inherits("QToolButton")){ |
640 | QToolButton *btn = (QToolButton *)btn; | 680 | QToolButton *btn = (QToolButton *)btn; |
641 | if(!btn->autoRaise()){ | 681 | if(!btn->autoRaise()){ |
642 | if(btn->isEnabled()){ | 682 | if(btn->isEnabled()){ |
643 | @@ -1340,11 +1258,6 @@ | 683 | @@ -1340,11 +1277,6 @@ |
644 | QColorGroup g = btn->colorGroup(); | 684 | QColorGroup g = btn->colorGroup(); |
645 | 685 | ||
646 | 686 | ||
647 | - QColor testColor; | 687 | - QColor testColor; |
648 | - if(btn->parent() && btn->parent()->isWidgetType()){ | 688 | - if(btn->parent() && btn->parent()->isWidgetType()){ |
649 | - testColor = p->backgroundColor(); // remove me | 689 | - testColor = p->backgroundColor(); // remove me |
650 | - } | 690 | - } |
651 | - | 691 | - |
652 | //int dw = buttonDefaultIndicatorWidth(); | 692 | //int dw = buttonDefaultIndicatorWidth(); |
653 | if(btn->hasFocus() || btn->isDefault()){ | 693 | if(btn->hasFocus() || btn->isDefault()){ |
654 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 694 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
655 | @@ -1914,8 +1827,8 @@ | 695 | @@ -1596,7 +1528,7 @@ |
696 | if(sbBuffer.size() != sb->size()) | ||
697 | sbBuffer.resize(sb->size()); | ||
698 | } | ||
699 | - subB.setRect( subX,subY,buttonDim,buttonDim ); | ||
700 | + subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); | ||
701 | addB.setRect( addX,addY,buttonDim,buttonDim ); | ||
702 | if(horiz) | ||
703 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); | ||
704 | @@ -1624,7 +1556,7 @@ | ||
705 | QPainter painter; | ||
706 | if(!horiz){ | ||
707 | painter.begin(&sbBuffer); | ||
708 | - QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); | ||
709 | + QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); | ||
710 | if(sliderR.height() >= 8){ | ||
711 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, | ||
712 | 13, 8); | ||
713 | @@ -1690,7 +1622,7 @@ | ||
714 | } | ||
715 | else{ | ||
716 | painter.begin(&sbBuffer); | ||
717 | - QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); | ||
718 | + QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); | ||
719 | if(sliderR.width() >= 8){ | ||
720 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, | ||
721 | 8, 13); | ||
722 | @@ -1761,10 +1693,10 @@ | ||
723 | addB.width()-8, addB.height()-8, g, !maxed); | ||
724 | } | ||
725 | if ( controls & SubLine ) { | ||
726 | - drawSBButton(p, subB, g, activeControl == SubLine); | ||
727 | - drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
728 | - false, subB.x()+4, subB.y()+4, | ||
729 | - subB.width()-8, subB.height()-8, g, !maxed); | ||
730 | + // drawSBButton(p, subB, g, activeControl == SubLine); | ||
731 | + // drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
732 | + // false, subB.x()+4, subB.y()+4, | ||
733 | + // subB.width()-8, subB.height()-8, g, !maxed); | ||
734 | drawSBButton(p, subHC, g, activeControl == SubLine); | ||
735 | drawArrow( p, horiz ? LeftArrow : UpArrow, | ||
736 | false, subHC.x()+4, subHC.y()+4, | ||
737 | @@ -1865,8 +1797,8 @@ | ||
738 | else | ||
739 | buttonDim = ( length - b*2 )/2 - 1; | ||
740 | |||
741 | - sliderMin = b + buttonDim; | ||
742 | - maxLength = length - b*2 - buttonDim*3; | ||
743 | + sliderMin = b + 0; // buttonDim; | ||
744 | + maxLength = length - b*2 - buttonDim*2; // 3; | ||
745 | |||
746 | if ( sb->maxValue() == sb->minValue() ) { | ||
747 | sliderLength = maxLength; | ||
748 | @@ -1914,8 +1846,8 @@ | ||
656 | return(QSize(16, 16)); | 749 | return(QSize(16, 16)); |
657 | } | 750 | } |
658 | 751 | ||
659 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, | 752 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, |
660 | - int h, const QColorGroup &g, bool on, | 753 | - int h, const QColorGroup &g, bool on, |
661 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, | 754 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, |
662 | + int /*h*/, const QColorGroup &/*g*/, bool on, | 755 | + int /*h*/, const QColorGroup &/*g*/, bool on, |
663 | bool down, bool) | 756 | bool down, bool) |
664 | { | 757 | { |
665 | bool isHover = highlightWidget == p->device(); | 758 | bool isHover = highlightWidget == p->device(); |
666 | @@ -1957,8 +1870,8 @@ | 759 | @@ -1957,8 +1889,8 @@ |
667 | return(QSize(20, 22)); | 760 | return(QSize(20, 22)); |
668 | } | 761 | } |
669 | 762 | ||
670 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, | 763 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, |
671 | - const QColorGroup &g, int state, bool down, bool) | 764 | - const QColorGroup &g, int state, bool down, bool) |
672 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 765 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
673 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) | 766 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) |
674 | { | 767 | { |
675 | bool isHover = highlightWidget == p->device(); | 768 | bool isHover = highlightWidget == p->device(); |
676 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 769 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
677 | @@ -1996,8 +1909,8 @@ | 770 | @@ -1996,8 +1928,8 @@ |
678 | } | 771 | } |
679 | } | 772 | } |
680 | 773 | ||
681 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, | 774 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, |
682 | - int state) | 775 | - int state) |
683 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 776 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
684 | + int /*state*/) | 777 | + int /*state*/) |
685 | { | 778 | { |
686 | // needed for some reason by KHtml, even tho it's all filled ;P | 779 | // needed for some reason by KHtml, even tho it's all filled ;P |
687 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); | 780 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); |
688 | @@ -2005,18 +1918,17 @@ | 781 | @@ -2005,18 +1937,17 @@ |
689 | } | 782 | } |
690 | 783 | ||
691 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, | 784 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, |
692 | - const QColorGroup &g, Orientation orient, | 785 | - const QColorGroup &g, Orientation orient, |
693 | + const QColorGroup &/*g*/, Orientation orient, | 786 | + const QColorGroup &/*g*/, Orientation orient, |
694 | bool, bool) | 787 | bool, bool) |
695 | { | 788 | { |
696 | QWidget *parent = (QWidget *)p->device(); | 789 | QWidget *parent = (QWidget *)p->device(); |
697 | p->setBrushOrigin(parent->pos()); | 790 | p->setBrushOrigin(parent->pos()); |
698 | - p->fillRect(x, y, w, h, | 791 | - p->fillRect(x, y, w, h, |
699 | - QApplication::palette().active().brush(QColorGroup::Background)); | 792 | - QApplication::palette().active().brush(QColorGroup::Background)); |
700 | + parent->erase(x, y, w, h); | 793 | + parent->erase(x, y, w, h); |
701 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : | 794 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : |
702 | *getPixmap(VSlider)); | 795 | *getPixmap(VSlider)); |
703 | } | 796 | } |
704 | 797 | ||
705 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, | 798 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, |
706 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 799 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
707 | Orientation orient, bool, bool) | 800 | Orientation orient, bool, bool) |
708 | { | 801 | { |
709 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : | 802 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : |
710 | @@ -2065,203 +1977,24 @@ | 803 | @@ -2065,203 +1996,26 @@ |
711 | p->drawLineSegments(a); | 804 | p->drawLineSegments(a); |
712 | } | 805 | } |
713 | 806 | ||
714 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, | 807 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, |
715 | - const QColorGroup &g, KToolBarPos, | 808 | - const QColorGroup &g, KToolBarPos, |
716 | - QBrush *) | 809 | - QBrush *) |
717 | -{ | 810 | -{ |
718 | - p->setPen(g.button().dark(120)); | 811 | - p->setPen(g.button().dark(120)); |
719 | - int x2 = x+w-1; | 812 | - int x2 = x+w-1; |
720 | - int y2 = y+h-1; | 813 | - int y2 = y+h-1; |
721 | - p->drawLine(x+1, y, x2-1, y); | 814 | - p->drawLine(x+1, y, x2-1, y); |
722 | - p->drawLine(x+1, y2, x2-1, y2); | 815 | - p->drawLine(x+1, y2, x2-1, y2); |
723 | - p->drawLine(x, y+1, x, y2-1); | 816 | - p->drawLine(x, y+1, x, y2-1); |
724 | - p->drawLine(x2, y+1, x2, y2-1); | 817 | - p->drawLine(x2, y+1, x2, y2-1); |
725 | - | 818 | - |
726 | - p->setPen(g.background()); | 819 | - p->setPen(g.background()); |
727 | - p->drawPoint(x, y); | 820 | - p->drawPoint(x, y); |
728 | - p->drawPoint(x2, y); | 821 | - p->drawPoint(x2, y); |
729 | - p->drawPoint(x, y2); | 822 | - p->drawPoint(x, y2); |
730 | - p->drawPoint(x2, y2); | 823 | - p->drawPoint(x2, y2); |
731 | - | 824 | - |
732 | - | 825 | - |
733 | - | 826 | - |
734 | - // p->drawRect(x, y, w, h); | 827 | - // p->drawRect(x, y, w, h); |
735 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); | 828 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); |
736 | - if(!pix){ | 829 | - if(!pix){ |
737 | - int h, s, v; | 830 | - int h, s, v; |
738 | - g.button().hsv(&h, &s, &v); | 831 | - g.button().hsv(&h, &s, &v); |
739 | - pix = new QPixmap(*bevelFillPix); | 832 | - pix = new QPixmap(*bevelFillPix); |
740 | - adjustHSV(*pix, h, s, v); | 833 | - adjustHSV(*pix, h, s, v); |
741 | - bevelFillDict.insert(g.button().rgb(), pix); | 834 | - bevelFillDict.insert(g.button().rgb(), pix); |
742 | - } | 835 | - } |
743 | - | 836 | - |
744 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); | 837 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); |
745 | -} | 838 | -} |
746 | - | 839 | - |
747 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, | 840 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, |
748 | - const QColorGroup &g, bool mac, QBrush *) | 841 | - const QColorGroup &g, bool mac, QBrush *) |
749 | -{ | 842 | -{ |
750 | - if(p->device() && p->device()->devType() == QInternal::Widget && | 843 | - if(p->device() && p->device()->devType() == QInternal::Widget && |
751 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ | 844 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ |
752 | - p->setPen(Qt::black); | 845 | - p->setPen(Qt::black); |
753 | - p->drawRect(x, y, w, h); | 846 | - p->drawRect(x, y, w, h); |
754 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); | 847 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); |
755 | - // left | 848 | - // left |
756 | - p->drawLine(x+1, y+1, x+1, y+5); | 849 | - p->drawLine(x+1, y+1, x+1, y+5); |
757 | - p->drawLine(x+2, y+1, x+2, y+3); | 850 | - p->drawLine(x+2, y+1, x+2, y+3); |
758 | - p->drawLine(x+3, y+1, x+3, y+2); | 851 | - p->drawLine(x+3, y+1, x+3, y+2); |
759 | - p->drawLine(x+4, y+1, x+6, y+1); | 852 | - p->drawLine(x+4, y+1, x+6, y+1); |
760 | - // right | 853 | - // right |
761 | - int x2 = x+w-1; | 854 | - int x2 = x+w-1; |
762 | - p->drawLine(x2-1, y+1, x2-1, y+5); | 855 | - p->drawLine(x2-1, y+1, x2-1, y+5); |
763 | - p->drawLine(x2-2, y+1, x2-2, y+3); | 856 | - p->drawLine(x2-2, y+1, x2-2, y+3); |
764 | - p->drawLine(x2-3, y+1, x2-3, y+2); | 857 | - p->drawLine(x2-3, y+1, x2-3, y+2); |
765 | - p->drawLine(x2-4, y+1, x2-6, y+1); | 858 | - p->drawLine(x2-4, y+1, x2-6, y+1); |
766 | - } | 859 | - } |
767 | - else{ | 860 | - else{ |
768 | - qDrawShadePanel(p, x, y, w, h, g, false, 1, | 861 | - qDrawShadePanel(p, x, y, w, h, g, false, 1, |
769 | - &g.brush(QColorGroup::Background)); | 862 | - &g.brush(QColorGroup::Background)); |
770 | - } | 863 | - } |
771 | - | 864 | - |
772 | -} | 865 | -} |
773 | 866 | ||
774 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, | 867 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, |
775 | - const QColorGroup &g, KToolBarPos, QBrush *) | 868 | - const QColorGroup &g, KToolBarPos, QBrush *) |
776 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 869 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
777 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | 870 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) |
778 | { | 871 | { |
779 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 872 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
780 | -} | 873 | -} |
781 | + x -= 2; // Bug in Qt/E | 874 | - |
782 | + y -= 2; | ||
783 | + w += 2; | ||
784 | + h += 2; | ||
785 | |||
786 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | 875 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, |
787 | - const QColorGroup &g, bool sunken, | 876 | - const QColorGroup &g, bool sunken, |
788 | - bool raised, bool enabled, bool popup, | 877 | - bool raised, bool enabled, bool popup, |
789 | - KToolButtonType icontext, | 878 | - KToolButtonType icontext, |
790 | - const QString& btext, const QPixmap *pixmap, | 879 | - const QString& btext, const QPixmap *pixmap, |
791 | - QFont *font, QWidget *btn) | 880 | - QFont *font, QWidget *btn) |
792 | -{ | 881 | -{ |
793 | - int dx, dy; | 882 | - int dx, dy; |
794 | - | 883 | - |
795 | - QFontMetrics fm(*font); | 884 | - QFontMetrics fm(*font); |
796 | - | 885 | - |
797 | - QToolBar* toolbar = 0; | 886 | - QToolBar* toolbar = 0; |
798 | - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) | 887 | - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) |
799 | - toolbar = static_cast<QToolBar*>(btn->parent()); | 888 | - toolbar = static_cast<QToolBar*>(btn->parent()); |
800 | - | 889 | - |
801 | - --w, --h; | 890 | - --w, --h; |
802 | - if(sunken) | 891 | - if(sunken) |
803 | - ++x, ++y; | 892 | - ++x, ++y; |
804 | - | 893 | - |
805 | - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : | 894 | - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : |
806 | - g.background()); | 895 | - g.background()); |
807 | - drawClearBevel(p, x, y, w, h, btnColor, g.background()); | 896 | - drawClearBevel(p, x, y, w, h, btnColor, g.background()); |
808 | - | 897 | - |
809 | - p->setPen(g.text()); | 898 | - p->setPen(g.text()); |
810 | - | 899 | - |
811 | - if (icontext == Icon){ // icon only | 900 | - if (icontext == Icon){ // icon only |
812 | - if (pixmap){ | 901 | - if (pixmap){ |
813 | - dx = ( w - pixmap->width() ) / 2; | 902 | - dx = ( w - pixmap->width() ) / 2; |
814 | - dy = ( h - pixmap->height() ) / 2; | 903 | - dy = ( h - pixmap->height() ) / 2; |
815 | - if ( sunken ) | 904 | - if ( sunken ) |
816 | - { | 905 | - { |
817 | - ++dx; | 906 | - ++dx; |
818 | - ++dy; | 907 | - ++dy; |
819 | - } | 908 | - } |
820 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 909 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
821 | - } | 910 | - } |
822 | - } | 911 | - } |
823 | - else if (icontext == IconTextRight){ // icon and text (if any) | 912 | - else if (icontext == IconTextRight){ // icon and text (if any) |
824 | - if (pixmap){ | 913 | - if (pixmap){ |
825 | - dx = 4; | 914 | - dx = 4; |
826 | - dy = ( h - pixmap->height() ) / 2; | 915 | - dy = ( h - pixmap->height() ) / 2; |
827 | - if ( sunken ){ | 916 | - if ( sunken ){ |
828 | - ++dx; | 917 | - ++dx; |
829 | - ++dy; | 918 | - ++dy; |
830 | - } | 919 | - } |
831 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 920 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
832 | - } | 921 | - } |
833 | - if (!btext.isNull()){ | 922 | - if (!btext.isNull()){ |
834 | - int tf = AlignVCenter|AlignLeft; | 923 | - int tf = AlignVCenter|AlignLeft; |
835 | - if (pixmap) | 924 | - if (pixmap) |
836 | - dx= 4 + pixmap->width() + 2; | 925 | - dx= 4 + pixmap->width() + 2; |
837 | - else | 926 | - else |
838 | - dx= 4; | 927 | - dx= 4; |
839 | - dy = 0; | 928 | - dy = 0; |
840 | - if ( sunken ){ | 929 | - if ( sunken ){ |
841 | - ++dx; | 930 | - ++dx; |
842 | - ++dy; | 931 | - ++dy; |
843 | - } | 932 | - } |
844 | - if (font) | 933 | - if (font) |
845 | - p->setFont(*font); | 934 | - p->setFont(*font); |
846 | - if(raised) | 935 | - if(raised) |
847 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 936 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
848 | - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); | 937 | - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); |
849 | - } | 938 | - } |
850 | - } | 939 | - } |
851 | - else if (icontext == Text){ // only text, even if there is a icon | 940 | - else if (icontext == Text){ // only text, even if there is a icon |
852 | - if (!btext.isNull()){ | 941 | - if (!btext.isNull()){ |
853 | - int tf = AlignVCenter|AlignLeft; | 942 | - int tf = AlignVCenter|AlignLeft; |
854 | - if (!enabled) | 943 | - if (!enabled) |
855 | - p->setPen(g.dark()); | 944 | - p->setPen(g.dark()); |
856 | - dx= (w - fm.width(btext)) / 2; | 945 | - dx= (w - fm.width(btext)) / 2; |
857 | - dy= (h - fm.lineSpacing()) / 2; | 946 | - dy= (h - fm.lineSpacing()) / 2; |
858 | - if ( sunken ){ | 947 | - if ( sunken ){ |
859 | - ++dx; | 948 | - ++dx; |
860 | - ++dy; | 949 | - ++dy; |
861 | - } | 950 | - } |
862 | - if (font) | 951 | - if (font) |
863 | - p->setFont(*font); | 952 | - p->setFont(*font); |
864 | - if(raised) | 953 | - if(raised) |
865 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 954 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
866 | - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); | 955 | - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); |
867 | - } | 956 | - } |
868 | - } | 957 | - } |
869 | - else if (icontext == IconTextBottom){ | 958 | - else if (icontext == IconTextBottom){ |
870 | - if (pixmap){ | 959 | - if (pixmap){ |
871 | - dx = (w - pixmap->width()) / 2; | 960 | - dx = (w - pixmap->width()) / 2; |
872 | - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; | 961 | - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; |
873 | - if ( sunken ){ | 962 | - if ( sunken ){ |
874 | - ++dx; | 963 | - ++dx; |
875 | - ++dy; | 964 | - ++dy; |
876 | - } | 965 | - } |
877 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 966 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
878 | - } | 967 | - } |
879 | - if (!btext.isNull()){ | 968 | - if (!btext.isNull()){ |
880 | - int tf = AlignBottom|AlignHCenter; | 969 | - int tf = AlignBottom|AlignHCenter; |
881 | - dy= pixmap->height(); | 970 | - dy= pixmap->height(); |
882 | - dx = 2; | 971 | - dx = 2; |
883 | - if ( sunken ){ | 972 | - if ( sunken ){ |
884 | - ++dx; | 973 | - ++dx; |
885 | - ++dy; | 974 | - ++dy; |
886 | - } | 975 | - } |
887 | - if (font) | 976 | - if (font) |
888 | - p->setFont(*font); | 977 | - p->setFont(*font); |
889 | - if(raised) | 978 | - if(raised) |
890 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 979 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
891 | - p->drawText(x, y, w, h-3, tf, btext); | 980 | - p->drawText(x, y, w, h-3, tf, btext); |
892 | - } | 981 | - } |
893 | - } | 982 | - } |
894 | - if (popup){ | 983 | - if (popup){ |
895 | - if (enabled) | 984 | - if (enabled) |
896 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, | 985 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, |
897 | - g, true); | 986 | - g, true); |
898 | - else | 987 | - else |
899 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, | 988 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, |
900 | - 0, 0, g, false); | 989 | - 0, 0, g, false); |
901 | - } | 990 | + if(active){ |
991 | + x -= 2; // Bug in Qt/E | ||
992 | + y -= 2; | ||
993 | + w += 2; | ||
994 | + h += 2; | ||
995 | } | ||
902 | -} | 996 | -} |
903 | + p-> fillRect ( x, y, w, h, g.brush(QColorGroup::Background)); | ||
904 | |||
905 | - | 997 | - |
998 | |||
906 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, | 999 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, |
907 | - const QColorGroup &g, bool active, QMenuItem *mi, | 1000 | - const QColorGroup &g, bool active, QMenuItem *mi, |
908 | - QBrush *) | 1001 | - QBrush *) |
909 | -{ | 1002 | -{ |
910 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1003 | - if ( p->font() == KGlobalSettings::generalFont() ) |
911 | - p->setFont( KGlobalSettings::menuFont() ); | 1004 | - p->setFont( KGlobalSettings::menuFont() ); |
912 | + w -= 2; | 1005 | + QWidget *parent = (QWidget *)p->device(); |
1006 | + p->setBrushOrigin(parent->pos()); | ||
1007 | + parent->erase(x, y, w, h); | ||
913 | 1008 | ||
914 | if(menuHandler->useShadowText()){ | 1009 | if(menuHandler->useShadowText()){ |
915 | QColor shadow; | 1010 | QColor shadow; |
916 | if(p->device() && p->device()->devType() == QInternal::Widget && | 1011 | if(p->device() && p->device()->devType() == QInternal::Widget && |
917 | - ((QWidget *)p->device())->inherits("KMenuBar")){ | 1012 | - ((QWidget *)p->device())->inherits("KMenuBar")){ |
918 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1013 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
919 | + ((QWidget *)p->device())->inherits("QMenuBar")){ | 1014 | + ((QWidget *)p->device())->inherits("QMenuBar")){ |
920 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1015 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
921 | g.background().dark(130); | 1016 | g.background().dark(130); |
922 | } | 1017 | } |
923 | else | 1018 | else |
924 | @@ -2300,8 +2033,8 @@ | 1019 | @@ -2300,8 +2054,8 @@ |
925 | } | 1020 | } |
926 | 1021 | ||
927 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 1022 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
928 | - const QColorGroup &g, int lineWidth, | 1023 | - const QColorGroup &g, int lineWidth, |
929 | - const QBrush * fill) | 1024 | - const QBrush * fill) |
930 | + const QColorGroup &g, int /*lineWidth*/, | 1025 | + const QColorGroup &g, int /*lineWidth*/, |
931 | + const QBrush * /*fill*/) | 1026 | + const QBrush * /*fill*/) |
932 | { | 1027 | { |
933 | QColor c; | 1028 | QColor c; |
934 | switch(menuHandler->transType()){ | 1029 | switch(menuHandler->transType()){ |
935 | @@ -2336,8 +2069,6 @@ | 1030 | @@ -2336,8 +2090,6 @@ |
936 | 1031 | ||
937 | maxpmw = QMAX( maxpmw, 20 ); | 1032 | maxpmw = QMAX( maxpmw, 20 ); |
938 | 1033 | ||
939 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1034 | - if ( p->font() == KGlobalSettings::generalFont() ) |
940 | - p->setFont( KGlobalSettings::menuFont() ); | 1035 | - p->setFont( KGlobalSettings::menuFont() ); |
941 | 1036 | ||
942 | bool dis = !enabled; | 1037 | bool dis = !enabled; |
943 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 1038 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
944 | @@ -2363,7 +2094,7 @@ | 1039 | @@ -2363,7 +2115,7 @@ |
945 | p->fillRect(x, y, w, h, menuBrush); | 1040 | p->fillRect(x, y, w, h, menuBrush); |
946 | } | 1041 | } |
947 | else{ | 1042 | else{ |
948 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1043 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
949 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1044 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
950 | if(pix) | 1045 | if(pix) |
951 | p->drawPixmap(x, y, *pix, x, y, w, h); | 1046 | p->drawPixmap(x, y, *pix, x, y, w, h); |
952 | } | 1047 | } |
953 | @@ -2508,25 +2239,6 @@ | 1048 | @@ -2508,25 +2260,6 @@ |
954 | return h; | 1049 | return h; |
955 | } | 1050 | } |
956 | 1051 | ||
957 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | 1052 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, |
958 | - const QColorGroup &g, QBrush *fill) | 1053 | - const QColorGroup &g, QBrush *fill) |
959 | -{ | 1054 | -{ |
960 | - p->setPen(g.button().dark(130)); | 1055 | - p->setPen(g.button().dark(130)); |
961 | - p->drawRect(x, y, w, h); | 1056 | - p->drawRect(x, y, w, h); |
962 | - p->setPen(g.button().light(120)); | 1057 | - p->setPen(g.button().light(120)); |
963 | - p->drawRect(x+1, y+1, w-2, h-2); | 1058 | - p->drawRect(x+1, y+1, w-2, h-2); |
964 | - if(w >= 4 && h >= 4){ | 1059 | - if(w >= 4 && h >= 4){ |
965 | - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); | 1060 | - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); |
966 | - if(!pix){ | 1061 | - if(!pix){ |
967 | - int h, s, v; | 1062 | - int h, s, v; |
968 | - g.button().dark(120).hsv(&h, &s, &v); | 1063 | - g.button().dark(120).hsv(&h, &s, &v); |
969 | - pix = new QPixmap(*bevelFillPix); | 1064 | - pix = new QPixmap(*bevelFillPix); |
970 | - adjustHSV(*pix, h, s, v); | 1065 | - adjustHSV(*pix, h, s, v); |
971 | - bevelFillDict.insert(g.button().dark(120).rgb(), pix); | 1066 | - bevelFillDict.insert(g.button().dark(120).rgb(), pix); |
972 | - } | 1067 | - } |
973 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1068 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
974 | - } | 1069 | - } |
975 | -} | 1070 | -} |
976 | 1071 | ||
977 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 1072 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
978 | const QColorGroup &g, const QColor *c, | 1073 | const QColorGroup &g, const QColor *c, |
979 | @@ -2540,25 +2252,25 @@ | 1074 | @@ -2540,25 +2273,25 @@ |
980 | return; | 1075 | return; |
981 | } | 1076 | } |
982 | else{ | 1077 | else{ |
983 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | 1078 | - KStyle::drawFocusRect(p, r, g, c, atBorder); |
984 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | 1079 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); |
985 | } | 1080 | } |
986 | } | 1081 | } |
987 | else | 1082 | else |
988 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | 1083 | - KStyle::drawFocusRect(p, r, g, c, atBorder); |
989 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | 1084 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); |
990 | 1085 | ||
991 | } | 1086 | } |
992 | 1087 | ||
993 | void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) | 1088 | void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) |
994 | { | 1089 | { |
995 | mnu->installEventFilter(menuHandler); | 1090 | mnu->installEventFilter(menuHandler); |
996 | - KStyle::polishPopupMenu(mnu); | 1091 | - KStyle::polishPopupMenu(mnu); |
997 | + QWindowsStyle::polishPopupMenu(mnu); | 1092 | + QWindowsStyle::polishPopupMenu(mnu); |
998 | } | 1093 | } |
999 | 1094 | ||
1000 | void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, | 1095 | void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, |
1001 | bool selected) | 1096 | bool selected) |
1002 | { | 1097 | { |
1003 | if(tabBar->shape() != QTabBar::RoundedAbove){ | 1098 | if(tabBar->shape() != QTabBar::RoundedAbove){ |
1004 | - KStyle::drawTab(p, tabBar, tab, selected); | 1099 | - KStyle::drawTab(p, tabBar, tab, selected); |
1005 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); | 1100 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); |
1006 | return; | 1101 | return; |
1007 | } | 1102 | } |
1008 | QPixmap tilePix; | 1103 | QPixmap tilePix; |
1009 | @@ -2671,7 +2383,7 @@ | 1104 | @@ -2671,7 +2404,7 @@ |
1010 | vFrame = 8; // was 10 | 1105 | vFrame = 8; // was 10 |
1011 | } | 1106 | } |
1012 | else | 1107 | else |
1013 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1108 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1014 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1109 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1015 | } | 1110 | } |
1016 | 1111 | ||
1017 | 1112 | ||
1018 | @@ -2699,7 +2411,7 @@ | 1113 | @@ -2699,7 +2432,7 @@ |
1019 | p->drawLine(x+1, y+1, x+1, y2-1); | 1114 | p->drawLine(x+1, y+1, x+1, y2-1); |
1020 | } | 1115 | } |
1021 | else if(lineWidth != 2 || !sunken) | 1116 | else if(lineWidth != 2 || !sunken) |
1022 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1117 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1023 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1118 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1024 | else{ | 1119 | else{ |
1025 | QPen oldPen = p->pen(); | 1120 | QPen oldPen = p->pen(); |
1026 | int x2 = x+w-1; | 1121 | int x2 = x+w-1; |
1027 | @@ -2726,105 +2438,6 @@ | 1122 | @@ -2726,105 +2459,6 @@ |
1028 | } | 1123 | } |
1029 | } | 1124 | } |
1030 | 1125 | ||
1031 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | 1126 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, |
1032 | - const QColorGroup &g, QBrush *) | 1127 | - const QColorGroup &g, QBrush *) |
1033 | -{ | 1128 | -{ |
1034 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 1129 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
1035 | - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? | 1130 | - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? |
1036 | - g.button().light(120) : g.button(), g.button()); | 1131 | - g.button().light(120) : g.button(), g.button()); |
1037 | - /* | 1132 | - /* |
1038 | - if(h > w){ | 1133 | - if(h > w){ |
1039 | - int y2 = y+h-1; | 1134 | - int y2 = y+h-1; |
1040 | - | 1135 | - |
1041 | - p->setPen(g.light()); | 1136 | - p->setPen(g.light()); |
1042 | - | 1137 | - |
1043 | - p->drawLine(x+1, y+2, x+1, y2-2); | 1138 | - p->drawLine(x+1, y+2, x+1, y2-2); |
1044 | - p->drawLine(x+4, y+2, x+4, y2-2); | 1139 | - p->drawLine(x+4, y+2, x+4, y2-2); |
1045 | - | 1140 | - |
1046 | - p->setPen(g.dark()); | 1141 | - p->setPen(g.dark()); |
1047 | - p->drawLine(x+2, y+2, x+2, y2-2); | 1142 | - p->drawLine(x+2, y+2, x+2, y2-2); |
1048 | - p->drawLine(x+5, y+2, x+5, y2-2); | 1143 | - p->drawLine(x+5, y+2, x+5, y2-2); |
1049 | - | 1144 | - |
1050 | - } | 1145 | - } |
1051 | - else{ | 1146 | - else{ |
1052 | - int x2 = x+w-1; | 1147 | - int x2 = x+w-1; |
1053 | - | 1148 | - |
1054 | - p->setPen(g.light()); | 1149 | - p->setPen(g.light()); |
1055 | - | 1150 | - |
1056 | - p->drawLine(x+2, y+1, x2-2, y+1); | 1151 | - p->drawLine(x+2, y+1, x2-2, y+1); |
1057 | - p->drawLine(x+2, y+4, x2-2, y+4); | 1152 | - p->drawLine(x+2, y+4, x2-2, y+4); |
1058 | - | 1153 | - |
1059 | - p->setPen(g.dark()); | 1154 | - p->setPen(g.dark()); |
1060 | - p->drawLine(x+2, y+2, x2-2, y+2); | 1155 | - p->drawLine(x+2, y+2, x2-2, y+2); |
1061 | - p->drawLine(x+2, y+5, x2-2, y+5); | 1156 | - p->drawLine(x+2, y+5, x2-2, y+5); |
1062 | - }*/ | 1157 | - }*/ |
1063 | - | 1158 | - |
1064 | -} | 1159 | -} |
1065 | - | 1160 | - |
1066 | -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, | 1161 | -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, |
1067 | - const QColorGroup &g, | 1162 | - const QColorGroup &g, |
1068 | - const QString &text, bool sunken, | 1163 | - const QString &text, bool sunken, |
1069 | - QPixmap *pixmap, QBrush *) | 1164 | - QPixmap *pixmap, QBrush *) |
1070 | -{ | 1165 | -{ |
1071 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); | 1166 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); |
1072 | - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); | 1167 | - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); |
1073 | - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) | 1168 | - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) |
1074 | - | 1169 | - |
1075 | - if(text.isNull() && !pixmap) | 1170 | - if(text.isNull() && !pixmap) |
1076 | - return; | 1171 | - return; |
1077 | - | 1172 | - |
1078 | - const int pxWidth = 20; | 1173 | - const int pxWidth = 20; |
1079 | - int textPos = pxWidth; | 1174 | - int textPos = pxWidth; |
1080 | - QRect br(buttonRect(x, y, w, h)); | 1175 | - QRect br(buttonRect(x, y, w, h)); |
1081 | - | 1176 | - |
1082 | - if (sunken) | 1177 | - if (sunken) |
1083 | - p->translate(1,1); | 1178 | - p->translate(1,1); |
1084 | - | 1179 | - |
1085 | - if ( pixmap && !pixmap->isNull() ) { | 1180 | - if ( pixmap && !pixmap->isNull() ) { |
1086 | - int dx = ( pxWidth - pixmap->width() ) / 2; | 1181 | - int dx = ( pxWidth - pixmap->width() ) / 2; |
1087 | - int dy = ( h - pixmap->height() ) / 2; | 1182 | - int dy = ( h - pixmap->height() ) / 2; |
1088 | - p->drawPixmap( br.x()+dx, dy, *pixmap ); | 1183 | - p->drawPixmap( br.x()+dx, dy, *pixmap ); |
1089 | - } | 1184 | - } |
1090 | - | 1185 | - |
1091 | - QString s = text; | 1186 | - QString s = text; |
1092 | - static const QString &modStr = KGlobal::staticQString( | 1187 | - static const QString &modStr = KGlobal::staticQString( |
1093 | - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); | 1188 | - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); |
1094 | - | 1189 | - |
1095 | - int modStrPos = s.find(modStr); | 1190 | - int modStrPos = s.find(modStr); |
1096 | - | 1191 | - |
1097 | - if (-1 != modStrPos) { | 1192 | - if (-1 != modStrPos) { |
1098 | - | 1193 | - |
1099 | - // +1 because we include a space after the closing brace. | 1194 | - // +1 because we include a space after the closing brace. |
1100 | - s.remove(modStrPos, modStr.length()+1); | 1195 | - s.remove(modStrPos, modStr.length()+1); |
1101 | - | 1196 | - |
1102 | - QPixmap modPixmap = SmallIcon("modified"); | 1197 | - QPixmap modPixmap = SmallIcon("modified"); |
1103 | - | 1198 | - |
1104 | - int dx = (pxWidth - modPixmap.width()) / 2; | 1199 | - int dx = (pxWidth - modPixmap.width()) / 2; |
1105 | - int dy = (h - modPixmap.height()) / 2; | 1200 | - int dy = (h - modPixmap.height()) / 2; |
1106 | - | 1201 | - |
1107 | - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); | 1202 | - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); |
1108 | - | 1203 | - |
1109 | - textPos += pxWidth; | 1204 | - textPos += pxWidth; |
1110 | - } | 1205 | - } |
1111 | - | 1206 | - |
1112 | - if (!s.isEmpty()){ | 1207 | - if (!s.isEmpty()){ |
1113 | - if (p->fontMetrics().width(s) > br.width() - textPos) { | 1208 | - if (p->fontMetrics().width(s) > br.width() - textPos) { |
1114 | - | 1209 | - |
1115 | - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); | 1210 | - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); |
1116 | - | 1211 | - |
1117 | - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) | 1212 | - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) |
1118 | - s.truncate(s.length() - 1); | 1213 | - s.truncate(s.length() - 1); |
1119 | - | 1214 | - |
1120 | - s.append("..."); | 1215 | - s.append("..."); |
1121 | - } | 1216 | - } |
1122 | - | 1217 | - |
1123 | - p->setPen(g.buttonText()); | 1218 | - p->setPen(g.buttonText()); |
1124 | - | 1219 | - |
1125 | - p->drawText(br.x()+ textPos, -1, w-textPos, h, | 1220 | - p->drawText(br.x()+ textPos, -1, w-textPos, h, |
1126 | - AlignLeft|AlignVCenter, s); | 1221 | - AlignLeft|AlignVCenter, s); |
1127 | - } | 1222 | - } |
1128 | - | 1223 | - |
1129 | -} | 1224 | -} |
1130 | 1225 | ||
1131 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) | 1226 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) |
1132 | { | 1227 | { |
1133 | @@ -2998,22 +2611,22 @@ | 1228 | @@ -2998,22 +2632,22 @@ |
1134 | customBtnIconList.clear(); | 1229 | customBtnIconList.clear(); |
1135 | customBtnLabelList.clear(); | 1230 | customBtnLabelList.clear(); |
1136 | 1231 | ||
1137 | - KConfig *config = KGlobal::config(); | 1232 | - KConfig *config = KGlobal::config(); |
1138 | - QString oldGrp = config->group(); | 1233 | - QString oldGrp = config->group(); |
1139 | - config->setGroup("MosfetButtons"); | 1234 | - config->setGroup("MosfetButtons"); |
1140 | +// KConfig *config = KGlobal::config(); | 1235 | +// KConfig *config = KGlobal::config(); |
1141 | +// QString oldGrp = config->group(); | 1236 | +// QString oldGrp = config->group(); |
1142 | +// config->setGroup("MosfetButtons"); | 1237 | +// config->setGroup("MosfetButtons"); |
1143 | 1238 | ||
1144 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors | 1239 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors |
1145 | iconList.setAutoDelete(true); | 1240 | iconList.setAutoDelete(true); |
1146 | colorList.setAutoDelete(true); | 1241 | colorList.setAutoDelete(true); |
1147 | - config->readListEntry("Labels", customBtnLabelList); | 1242 | - config->readListEntry("Labels", customBtnLabelList); |
1148 | - config->readListEntry("Icons", iconList); | 1243 | - config->readListEntry("Icons", iconList); |
1149 | - config->readListEntry("Colors", colorList); | 1244 | - config->readListEntry("Colors", colorList); |
1150 | +// config->readListEntry("Labels", customBtnLabelList); | 1245 | +// config->readListEntry("Labels", customBtnLabelList); |
1151 | +// config->readListEntry("Icons", iconList); | 1246 | +// config->readListEntry("Icons", iconList); |
1152 | +// config->readListEntry("Colors", colorList); | 1247 | +// config->readListEntry("Colors", colorList); |
1153 | 1248 | ||
1154 | const char *labelStr = customBtnLabelList.first(); | 1249 | const char *labelStr = customBtnLabelList.first(); |
1155 | const char *colorStr = colorList.first(); | 1250 | const char *colorStr = colorList.first(); |
1156 | const char *iconStr = iconList.first(); | 1251 | const char *iconStr = iconList.first(); |
1157 | 1252 | ||
1158 | - KIconLoader *ldr = KGlobal::iconLoader(); | 1253 | - KIconLoader *ldr = KGlobal::iconLoader(); |
1159 | +// KIconLoader *ldr = KGlobal::iconLoader(); | 1254 | +// KIconLoader *ldr = KGlobal::iconLoader(); |
1160 | while(labelStr != NULL){ | 1255 | while(labelStr != NULL){ |
1161 | QColor *c = new QColor; | 1256 | QColor *c = new QColor; |
1162 | c->setNamedColor(QString(colorStr)); | 1257 | c->setNamedColor(QString(colorStr)); |
1163 | @@ -3022,7 +2635,7 @@ | 1258 | @@ -3022,7 +2656,7 @@ |
1164 | QString tmpStr(iconStr); | 1259 | QString tmpStr(iconStr); |
1165 | if(!tmpStr.isEmpty()){ | 1260 | if(!tmpStr.isEmpty()){ |
1166 | QPixmap *pixmap = | 1261 | QPixmap *pixmap = |
1167 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); | 1262 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); |
1168 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | 1263 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); |
1169 | if(pixmap->isNull()){ | 1264 | if(pixmap->isNull()){ |
1170 | delete pixmap; | 1265 | delete pixmap; |
1171 | customBtnIconList.append(NULL); | 1266 | customBtnIconList.append(NULL); |
1172 | @@ -3037,7 +2650,6 @@ | 1267 | @@ -3037,7 +2671,6 @@ |
1173 | colorStr = colorList.next(); | 1268 | colorStr = colorList.next(); |
1174 | iconStr = iconList.next(); | 1269 | iconStr = iconList.next(); |
1175 | } | 1270 | } |
1176 | - config->setGroup(oldGrp); | 1271 | - config->setGroup(oldGrp); |
1177 | } | 1272 | } |
1178 | 1273 | ||
1179 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | 1274 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) |
1180 | @@ -3087,7 +2699,7 @@ | 1275 | @@ -3087,7 +2720,7 @@ |
1181 | } | 1276 | } |
1182 | } | 1277 | } |
1183 | 1278 | ||
1184 | -#include "liquid.moc" | 1279 | -#include "liquid.moc" |
1185 | +// #include "liquid.moc" | 1280 | +// #include "liquid.moc" |
1186 | 1281 | ||
1187 | 1282 | ||
1188 | 1283 | ||
1189 | --- -Mon Jul 1 11:38:05 2002 | 1284 | --- -Mon Jul 15 02:34:13 2002 |
1190 | +++ plugin.cppFri Jun 28 13:25:25 2002 | 1285 | +++ plugin.cppFri Jul 12 00:41:40 2002 |
1191 | @@ -1,29 +1,29 @@ | 1286 | @@ -1,29 +1,113 @@ |
1192 | #include "liquid.h" | 1287 | #include "liquid.h" |
1193 | -#include <klocale.h> | 1288 | -#include <klocale.h> |
1194 | + | 1289 | +#include "liquidset.h" |
1290 | +#include "plugin.h" | ||
1195 | 1291 | ||
1196 | extern "C" { | 1292 | -extern "C" { |
1197 | - KStyle* allocate(); | 1293 | - KStyle* allocate(); |
1198 | - int minor_version(); | 1294 | - int minor_version(); |
1199 | - int major_version(); | 1295 | - int major_version(); |
1200 | - const char *description(); | 1296 | - const char *description(); |
1201 | + QStyle* allocate ( ); | 1297 | + |
1202 | + int minor_version ( ); | 1298 | + |
1203 | + int major_version ( ); | 1299 | +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) |
1204 | + const char *description ( ); | 1300 | +{ |
1301 | +} | ||
1302 | + | ||
1303 | +LiquidInterface::~LiquidInterface ( ) | ||
1304 | +{ | ||
1305 | +} | ||
1306 | + | ||
1307 | +QStyle *LiquidInterface::create ( ) | ||
1308 | +{ | ||
1309 | +return new LiquidStyle ( ); | ||
1310 | +} | ||
1311 | + | ||
1312 | +QString LiquidInterface::name ( ) | ||
1313 | +{ | ||
1314 | +return QObject::tr( "Liquid", "name" ); | ||
1205 | } | 1315 | } |
1206 | 1316 | ||
1207 | -KStyle* allocate() | 1317 | -KStyle* allocate() |
1208 | +QStyle* allocate ( ) | 1318 | +QString LiquidInterface::description ( ) |
1209 | { | 1319 | { |
1210 | - return(new LiquidStyle); | 1320 | - return(new LiquidStyle); |
1211 | + return new LiquidStyle ( ); | 1321 | +return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); |
1212 | } | 1322 | } |
1213 | 1323 | ||
1214 | -int minor_version() | 1324 | -int minor_version() |
1215 | +int minor_version ( ) | 1325 | +QCString LiquidInterface::key ( ) |
1216 | { | 1326 | { |
1217 | - return(0); | 1327 | - return(0); |
1218 | + return 0; | 1328 | +return QCString ( "liquid" ); |
1219 | } | 1329 | } |
1220 | 1330 | ||
1221 | -int major_version() | 1331 | -int major_version() |
1222 | +int major_version ( ) | 1332 | +unsigned int LiquidInterface::version ( ) |
1223 | { | 1333 | { |
1224 | - return(1); | 1334 | - return(1); |
1225 | + return 1; | 1335 | +return 100; // 1.0.0 (\d+.\d.\d) |
1226 | } | 1336 | } |
1227 | 1337 | ||
1228 | -const char *description() | 1338 | -const char *description() |
1229 | +const char *description ( ) | 1339 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
1340 | +{ | ||
1341 | +static LiquidSettingsInterface *setiface = 0; | ||
1342 | + | ||
1343 | +*iface = 0; | ||
1344 | + | ||
1345 | +if ( uuid == IID_QUnknown ) | ||
1346 | + *iface = this; | ||
1347 | +else if ( uuid == IID_Style ) | ||
1348 | + *iface = this; | ||
1349 | +else if ( uuid == IID_StyleSettings ) { | ||
1350 | + if ( !setiface ) | ||
1351 | + setiface = new LiquidSettingsInterface ( ); | ||
1352 | + *iface = setiface; | ||
1353 | +} | ||
1354 | + | ||
1355 | +if ( *iface ) | ||
1356 | + (*iface)-> addRef ( ); | ||
1357 | + | ||
1358 | +return QS_OK; | ||
1359 | +} | ||
1360 | + | ||
1361 | +Q_EXPORT_INTERFACE() | ||
1362 | +{ | ||
1363 | +Q_CREATE_INSTANCE( LiquidInterface ) | ||
1364 | +} | ||
1365 | + | ||
1366 | + | ||
1367 | +LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) | ||
1230 | { | 1368 | { |
1231 | - return(i18n("High performance liquid plugin").utf8()); | 1369 | - return(i18n("High performance liquid plugin").utf8()); |
1232 | + return "High Performance Liquid"; | 1370 | +m_widget = 0; |
1233 | } | 1371 | } |
1372 | + | ||
1373 | +LiquidSettingsInterface::~LiquidSettingsInterface ( ) | ||
1374 | +{ | ||
1375 | +} | ||
1376 | + | ||
1377 | +QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) | ||
1378 | +{ | ||
1379 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); | ||
1380 | + | ||
1381 | +return m_widget; | ||
1382 | +} | ||
1383 | + | ||
1384 | +bool LiquidSettingsInterface::accept ( ) | ||
1385 | +{ | ||
1386 | +if ( !m_widget ) | ||
1387 | + return false; | ||
1388 | + | ||
1389 | +return m_widget-> writeConfig ( ); | ||
1390 | +} | ||
1391 | + | ||
1392 | +void LiquidSettingsInterface::reject ( ) | ||
1393 | +{ | ||
1394 | +} | ||
1395 | + | ||
1396 | +QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
1397 | +{ | ||
1398 | +*iface = 0; | ||
1399 | + | ||
1400 | + | ||
1401 | +if ( uuid == IID_QUnknown ) | ||
1402 | + *iface = this; | ||
1403 | +else if ( uuid == IID_StyleSettings ) | ||
1404 | + *iface = this; | ||
1405 | + | ||
1406 | +if ( *iface ) | ||
1407 | + (*iface)-> addRef ( ); | ||
1408 | + | ||
1409 | +return QS_OK; | ||
1410 | +} | ||
1411 | + | ||
1412 | +// Hack for Retail Z experiments | ||
1413 | +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | ||