summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-08 23:12:16 (UTC)
committer sandman <sandman>2002-12-08 23:12:16 (UTC)
commit5f4bc1a6f31d713c97b8382b6e2acd12a7f9bfd6 (patch) (unidiff)
tree52c1fcf139914d41b8dfb03fc4e954f95e5e7aef
parent7b38c0424eca2f49a0c9a931766c816e21f1d86b (diff)
downloadopie-5f4bc1a6f31d713c97b8382b6e2acd12a7f9bfd6.zip
opie-5f4bc1a6f31d713c97b8382b6e2acd12a7f9bfd6.tar.gz
opie-5f4bc1a6f31d713c97b8382b6e2acd12a7f9bfd6.tar.bz2
removed some clumsy workarounds for old (unpatched) libqte's
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 4a65952..bac882c 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -147,61 +147,55 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
147 } 147 }
148 } 148 }
149 else if(ev->type() == QEvent::Hide){ 149 else if(ev->type() == QEvent::Hide){
150 if(type == TransStippleBg || type == TransStippleBtn || 150 if(type == TransStippleBg || type == TransStippleBtn ||
151 type == Custom){ 151 type == Custom){
152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); 152// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
153 153
154 pixDict.remove(p->winId()); 154 pixDict.remove(p->winId());
155 if ( !p->inherits("QPopupMenu")) 155 if ( !p->inherits("QPopupMenu"))
156 p->setBackgroundMode(QWidget::PaletteBackground); 156 p->setBackgroundMode(QWidget::PaletteBackground);
157 157
158 QObjectList *ol = p-> queryList("QWidget"); 158 QObjectList *ol = p-> queryList("QWidget");
159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { 159 for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
160 QWidget *wid = (QWidget *) it.current ( ); 160 QWidget *wid = (QWidget *) it.current ( );
161 161
162 wid-> setBackgroundMode( QWidget::PaletteBackground ); 162 wid-> setBackgroundMode( QWidget::PaletteBackground );
163 } 163 }
164 delete ol; 164 delete ol;
165 } 165 }
166 } 166 }
167 return(false); 167 return(false);
168} 168}
169 169
170 170
171static int qt_version ( )
172{
173 const char *qver = qVersion ( );
174 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
175}
176 171
177 172
178LiquidStyle::LiquidStyle() 173LiquidStyle::LiquidStyle()
179 :QWindowsStyle() 174 :QWindowsStyle()
180{ 175{
181 setName ( "LiquidStyle" ); 176 setName ( "LiquidStyle" );
182 177
183 oldqte = ( qt_version ( ) < 234 );
184 flatTBButtons = false; 178 flatTBButtons = false;
185 currentHeader = 0; 179 currentHeader = 0;
186 180
187 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); 181 btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true);
188 btnMaskBmp.setMask(btnMaskBmp); 182 btnMaskBmp.setMask(btnMaskBmp);
189 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); 183 htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true);
190 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp); 184 htmlBtnMaskBmp.setMask(htmlBtnMaskBmp);
191 headerHoverID = -1; 185 headerHoverID = -1;
192 highlightWidget = NULL; 186 highlightWidget = NULL;
193 setButtonDefaultIndicatorWidth(0); 187 setButtonDefaultIndicatorWidth(0);
194 btnDict.setAutoDelete(true); 188 btnDict.setAutoDelete(true);
195 bevelFillDict.setAutoDelete(true); 189 bevelFillDict.setAutoDelete(true);
196 smallBevelFillDict.setAutoDelete(true); 190 smallBevelFillDict.setAutoDelete(true);
197 191
198 rMatrix.rotate(270.0); 192 rMatrix.rotate(270.0);
199 btnBorderPix = new QPixmap; 193 btnBorderPix = new QPixmap;
200 btnBorderPix->convertFromImage(qembed_findImage("buttonfill")); 194 btnBorderPix->convertFromImage(qembed_findImage("buttonfill"));
201 btnBlendPix = new QPixmap; 195 btnBlendPix = new QPixmap;
202 btnBlendPix->convertFromImage(qembed_findImage("buttonborder")); 196 btnBlendPix->convertFromImage(qembed_findImage("buttonborder"));
203 bevelFillPix = new QPixmap; 197 bevelFillPix = new QPixmap;
204 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large")); 198 bevelFillPix->convertFromImage(qembed_findImage("clear_fill_large"));
205 smallBevelFillPix = new QPixmap; 199 smallBevelFillPix = new QPixmap;
206 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small")); 200 smallBevelFillPix->convertFromImage(qembed_findImage("clear_fill_small"));
207 // new stuff 201 // new stuff
@@ -686,52 +680,50 @@ void LiquidStyle::polish(QPalette &appPal)
686 for(i=0; i < BITMAP_ITEMS; ++i){ 680 for(i=0; i < BITMAP_ITEMS; ++i){
687 if(pixmaps[i]){ 681 if(pixmaps[i]){
688 delete pixmaps[i]; 682 delete pixmaps[i];
689 pixmaps[i] = NULL; 683 pixmaps[i] = NULL;
690 } 684 }
691 } 685 }
692 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; 686 lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10;
693 btnDict.clear(); 687 btnDict.clear();
694 btnBorderDict.clear(); 688 btnBorderDict.clear();
695 bevelFillDict.clear(); 689 bevelFillDict.clear();
696 smallBevelFillDict.clear(); 690 smallBevelFillDict.clear();
697 691
698 Config config ( "qpe" ); 692 Config config ( "qpe" );
699 config. setGroup ( "Liquid-Style" ); 693 config. setGroup ( "Liquid-Style" );
700 int contrast = config. readNumEntry ( "StippleContrast", 5 ); 694 int contrast = config. readNumEntry ( "StippleContrast", 5 );
701 if ( contrast < 0 ) 695 if ( contrast < 0 )
702 contrast = 0; 696 contrast = 0;
703 else if ( contrast > 10 ) 697 else if ( contrast > 10 )
704 contrast = 10; 698 contrast = 10;
705 699
706// QPalette pal = QApplication::palette(); 700// QPalette pal = QApplication::palette();
707 701
708 // button color stuff 702 // button color stuff
709 config. setGroup ( "Appearance" ); 703 config. setGroup ( "Appearance" );
710 QColor c = oldqte ? QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))) 704 QColor c = appPal. color ( QPalette::Active, QColorGroup::Button );
711 : appPal. color ( QPalette::Active, QColorGroup::Button ); 705 if ( c == appPal. color ( QPalette::Active, QColorGroup::Background )) {
712 if ( c == ( oldqte ? QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( )))
713 : appPal. color ( QPalette::Active, QColorGroup::Background ))) {
714 // force button color to be different from background 706 // force button color to be different from background
715 QBrush btnBrush(QColor(200, 202, 228)); 707 QBrush btnBrush(QColor(200, 202, 228));
716 appPal.setBrush(QColorGroup::Button, btnBrush); 708 appPal.setBrush(QColorGroup::Button, btnBrush);
717 } 709 }
718 c.hsv(&btnH, &btnS, &btnV); 710 c.hsv(&btnH, &btnS, &btnV);
719 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); 711 c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV);
720 712
721 // menu pixmap 713 // menu pixmap
722 if(!menuPix){ 714 if(!menuPix){
723 menuPix = new QPixmap; 715 menuPix = new QPixmap;
724 menuPix->resize(64, 64); 716 menuPix->resize(64, 64);
725 } 717 }
726 QPainter painter; 718 QPainter painter;
727 menuPix->fill(c.rgb()); 719 menuPix->fill(c.rgb());
728 painter.begin(menuPix); 720 painter.begin(menuPix);
729 painter.setPen(c.dark(105)); 721 painter.setPen(c.dark(105));
730 for(i=0; i < 63; i+=4){ 722 for(i=0; i < 63; i+=4){
731 painter.drawLine(0, i, 63, i); 723 painter.drawLine(0, i, 63, i);
732 painter.drawLine(0, i+1, 63, i+1); 724 painter.drawLine(0, i+1, 63, i+1);
733 }; 725 };
734 painter.end(); 726 painter.end();
735 menuBrush.setColor(c); 727 menuBrush.setColor(c);
736 menuBrush.setPixmap(*menuPix); 728 menuBrush.setPixmap(*menuPix);
737 729
@@ -740,50 +732,49 @@ void LiquidStyle::polish(QPalette &appPal)
740 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 732 QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
741 if(!pix){ 733 if(!pix){
742 int h, s, v; 734 int h, s, v;
743 c.hsv(&h, &s, &v); 735 c.hsv(&h, &s, &v);
744 pix = new QPixmap(*smallBevelFillPix); 736 pix = new QPixmap(*smallBevelFillPix);
745 adjustHSV(*pix, h, s, v); 737 adjustHSV(*pix, h, s, v);
746 smallBevelFillDict.insert(c.rgb(), pix); 738 smallBevelFillDict.insert(c.rgb(), pix);
747 } 739 }
748// pagerHoverBrush.setColor(c); 740// pagerHoverBrush.setColor(c);
749// pagerHoverBrush.setPixmap(*pix); 741// pagerHoverBrush.setPixmap(*pix);
750 742
751 c = c.dark(120); 743 c = c.dark(120);
752 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) 744 pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-)
753 if(!pix){ 745 if(!pix){
754 int h, s, v; 746 int h, s, v;
755 c.hsv(&h, &s, &v); 747 c.hsv(&h, &s, &v);
756 pix = new QPixmap(*smallBevelFillPix); 748 pix = new QPixmap(*smallBevelFillPix);
757 adjustHSV(*pix, h, s, v); 749 adjustHSV(*pix, h, s, v);
758 smallBevelFillDict.insert(c.rgb(), pix); 750 smallBevelFillDict.insert(c.rgb(), pix);
759 } 751 }
760// pagerBrush.setColor(c); 752// pagerBrush.setColor(c);
761// pagerBrush.setPixmap(*pix); 753// pagerBrush.setPixmap(*pix);
762 754
763 // background color stuff 755 // background color stuff
764 c = oldqte ? QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( ))) 756 c = appPal. color ( QPalette::Active, QColorGroup::Background );
765 : appPal. color ( QPalette::Active, QColorGroup::Background );
766 757
767 c.hsv(&bH, &bS, &bV); 758 c.hsv(&bH, &bS, &bV);
768 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); 759 c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV);
769 760
770 // FIXME? 761 // FIXME?
771 if(vsbSliderFillPix) 762 if(vsbSliderFillPix)
772 delete vsbSliderFillPix; 763 delete vsbSliderFillPix;
773 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); 764 vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix));
774 adjustHSV(*vsbSliderFillPix, bH, bS, bV); 765 adjustHSV(*vsbSliderFillPix, bH, bS, bV);
775 766
776 // background brush 767 // background brush
777 QPixmap wallPaper(32, 32); 768 QPixmap wallPaper(32, 32);
778 wallPaper.fill(c.rgb()); 769 wallPaper.fill(c.rgb());
779 painter.begin(&wallPaper); 770 painter.begin(&wallPaper);
780 for(i=0; i < 32; i+=4){ 771 for(i=0; i < 32; i+=4){
781 painter.setPen(c.dark(100 + contrast)); 772 painter.setPen(c.dark(100 + contrast));
782 painter.drawLine(0, i, 32, i); 773 painter.drawLine(0, i, 32, i);
783 painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); 774 painter.setPen(c.dark(100 + 3 * contrast / 5 ) );
784 painter.drawLine(0, i+1, 32, i+1); 775 painter.drawLine(0, i+1, 32, i+1);
785 }; 776 };
786 painter.end(); 777 painter.end();
787 bgBrush.setColor(c); 778 bgBrush.setColor(c);
788 bgBrush.setPixmap(wallPaper); 779 bgBrush.setPixmap(wallPaper);
789 appPal.setBrush(QColorGroup::Background, bgBrush); 780 appPal.setBrush(QColorGroup::Background, bgBrush);