-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 4013981..eb1ec6e 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -82,127 +82,125 @@ void TransMenuHandler::reloadSettings() | |||
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 | } | ||
142 | } | 141 | } |
143 | } | 142 | } |
144 | else if(ev->type() == QEvent::Hide){ | 143 | else if(ev->type() == QEvent::Hide){ |
145 | if(type == TransStippleBg || type == TransStippleBtn || | 144 | if(type == TransStippleBg || type == TransStippleBtn || |
146 | type == Custom){ | 145 | type == Custom){ |
147 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 146 | // qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
148 | 147 | ||
149 | pixDict.remove(p->winId()); | 148 | pixDict.remove(p->winId()); |
150 | if (!p->inherits("QPopupMenu")) { | 149 | if ( !p->inherits("QPopupMenu")) |
151 | p->setBackgroundMode(QWidget::PaletteBackground); | 150 | p->setBackgroundMode(QWidget::PaletteBackground); |
152 | 151 | ||
153 | QObjectList *ol = p-> queryList("QWidget"); | 152 | QObjectList *ol = p-> queryList("QWidget"); |
154 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 153 | for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
155 | QWidget *wid = (QWidget *) it.current ( ); | 154 | QWidget *wid = (QWidget *) it.current ( ); |
156 | 155 | ||
157 | wid-> setBackgroundMode( QWidget::PaletteBackground ); | 156 | wid-> setBackgroundMode( QWidget::PaletteBackground ); |
158 | } | ||
159 | delete ol; | ||
160 | } | 157 | } |
158 | delete ol; | ||
161 | } | 159 | } |
162 | } | 160 | } |
163 | return(false); | 161 | return(false); |
164 | } | 162 | } |
165 | 163 | ||
166 | 164 | ||
167 | LiquidStyle::LiquidStyle() | 165 | LiquidStyle::LiquidStyle() |
168 | :QWindowsStyle() | 166 | :QWindowsStyle() |
169 | { | 167 | { |
170 | setName ( "LiquidStyle" ); | 168 | setName ( "LiquidStyle" ); |
171 | 169 | ||
172 | flatTBButtons = false; | 170 | flatTBButtons = false; |
173 | 171 | ||
174 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 172 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
175 | btnMaskBmp.setMask(btnMaskBmp); | 173 | btnMaskBmp.setMask(btnMaskBmp); |
176 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 174 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
177 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); | 175 | htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); |
178 | headerHoverID = -1; | 176 | headerHoverID = -1; |
179 | highlightWidget = NULL; | 177 | highlightWidget = NULL; |
180 | setButtonDefaultIndicatorWidth(0); | 178 | setButtonDefaultIndicatorWidth(0); |
181 | btnDict.setAutoDelete(true); | 179 | btnDict.setAutoDelete(true); |
182 | bevelFillDict.setAutoDelete(true); | 180 | bevelFillDict.setAutoDelete(true); |
183 | smallBevelFillDict.setAutoDelete(true); | 181 | smallBevelFillDict.setAutoDelete(true); |
184 | customBtnColorList.setAutoDelete(true); | 182 | customBtnColorList.setAutoDelete(true); |
185 | customBtnIconList.setAutoDelete(true); | 183 | customBtnIconList.setAutoDelete(true); |
186 | customBtnLabelList.setAutoDelete(true); | 184 | customBtnLabelList.setAutoDelete(true); |
187 | 185 | ||
188 | rMatrix.rotate(270.0); | 186 | rMatrix.rotate(270.0); |
189 | highcolor = QPixmap::defaultDepth() > 8; | 187 | highcolor = QPixmap::defaultDepth() > 8; |
190 | btnBorderPix = new QPixmap; | 188 | btnBorderPix = new QPixmap; |
191 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); | 189 | btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); |
192 | btnBlendPix = new QPixmap; | 190 | btnBlendPix = new QPixmap; |
193 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); | 191 | btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); |
194 | bevelFillPix = new QPixmap; | 192 | bevelFillPix = new QPixmap; |
195 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); | 193 | bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); |
196 | smallBevelFillPix = new QPixmap; | 194 | smallBevelFillPix = new QPixmap; |
197 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); | 195 | smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); |
198 | // new stuff | 196 | // new stuff |
199 | vsbSliderFillPix = menuPix = NULL; | 197 | vsbSliderFillPix = menuPix = NULL; |
200 | menuHandler = new TransMenuHandler(this); | 198 | menuHandler = new TransMenuHandler(this); |
201 | setScrollBarExtent(15, 15); | 199 | setScrollBarExtent(15, 15); |
202 | int i; | 200 | int i; |
203 | for(i=0; i < BITMAP_ITEMS; ++i){ | 201 | for(i=0; i < BITMAP_ITEMS; ++i){ |
204 | pixmaps[i] = NULL; | 202 | pixmaps[i] = NULL; |
205 | } | 203 | } |
206 | oldSliderThickness = sliderThickness(); | 204 | oldSliderThickness = sliderThickness(); |
207 | setSliderThickness(11); | 205 | setSliderThickness(11); |
208 | } | 206 | } |