-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 8 | ||||
-rw-r--r-- | noncore/styles/liquid/opie-liquid.diff | 389 |
2 files changed, 237 insertions, 160 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index eb1ec6e..6812d16 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -462,870 +462,874 @@ void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c, | |||
462 | // fills | 462 | // fills |
463 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top | 463 | p.fillRect(10, 0, w-20, 10, Qt::color1); // top |
464 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom | 464 | p.fillRect(10, y2-9, w-20, 10, Qt::color1); // bottom |
465 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle | 465 | p.fillRect(0, 10, w, h-20, Qt::color1); // middle |
466 | p.end(); | 466 | p.end(); |
467 | tmpPix.setMask(btnMask); | 467 | tmpPix.setMask(btnMask); |
468 | /*if(autoDefault){ | 468 | /*if(autoDefault){ |
469 | if(supportPushDown && pushedDown){ | 469 | if(supportPushDown && pushedDown){ |
470 | painter->drawPixmap(x+3, y+3, tmpPix); | 470 | painter->drawPixmap(x+3, y+3, tmpPix); |
471 | } | 471 | } |
472 | else{ | 472 | else{ |
473 | painter->drawPixmap(x+2, y+2, tmpPix); | 473 | painter->drawPixmap(x+2, y+2, tmpPix); |
474 | } | 474 | } |
475 | } | 475 | } |
476 | else */if(supportPushDown && pushedDown) | 476 | else */if(supportPushDown && pushedDown) |
477 | painter->drawPixmap(x+1, y+1, tmpPix); | 477 | painter->drawPixmap(x+1, y+1, tmpPix); |
478 | else | 478 | else |
479 | painter->drawPixmap(x, y, tmpPix); | 479 | painter->drawPixmap(x, y, tmpPix); |
480 | 480 | ||
481 | 481 | ||
482 | 482 | ||
483 | } | 483 | } |
484 | 484 | ||
485 | 485 | ||
486 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, | 486 | QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v, |
487 | bool blend) | 487 | bool blend) |
488 | { | 488 | { |
489 | QImage img(qembed_findImage(label)); | 489 | QImage img(qembed_findImage(label)); |
490 | img.detach(); | 490 | img.detach(); |
491 | if(img.isNull()){ // shouldn't happen, been tested | 491 | if(img.isNull()){ // shouldn't happen, been tested |
492 | qWarning("Invalid embedded label %s", label); | 492 | qWarning("Invalid embedded label %s", label); |
493 | return(NULL); | 493 | return(NULL); |
494 | } | 494 | } |
495 | if(img.depth() != 32) | 495 | if(img.depth() != 32) |
496 | img = img.convertDepth(32); | 496 | img = img.convertDepth(32); |
497 | unsigned int *data = (unsigned int *)img.bits(); | 497 | unsigned int *data = (unsigned int *)img.bits(); |
498 | int total = img.width()*img.height(); | 498 | int total = img.width()*img.height(); |
499 | int current; | 499 | int current; |
500 | QColor c; | 500 | QColor c; |
501 | int oldH, oldS, oldV; | 501 | int oldH, oldS, oldV; |
502 | int alpha; | 502 | int alpha; |
503 | if(v < 235) | 503 | if(v < 235) |
504 | v += 20; | 504 | v += 20; |
505 | else | 505 | else |
506 | v = 255; | 506 | v = 255; |
507 | float intensity = v/255.0; | 507 | float intensity = v/255.0; |
508 | 508 | ||
509 | for(current=0; current<total; ++current){ | 509 | for(current=0; current<total; ++current){ |
510 | alpha = qAlpha(data[current]); | 510 | alpha = qAlpha(data[current]); |
511 | c.setRgb(data[current]); | 511 | c.setRgb(data[current]); |
512 | c.hsv(&oldH, &oldS, &oldV); | 512 | c.hsv(&oldH, &oldS, &oldV); |
513 | oldV = (int)(oldV*intensity); | 513 | oldV = (int)(oldV*intensity); |
514 | c.setHsv(h, s, oldV); | 514 | c.setHsv(h, s, oldV); |
515 | if(blend && alpha != 255 && alpha != 0){ | 515 | if(blend && alpha != 255 && alpha != 0){ |
516 | float srcPercent = ((float)alpha)/255.0; | 516 | float srcPercent = ((float)alpha)/255.0; |
517 | float destPercent = 1.0-srcPercent; | 517 | float destPercent = 1.0-srcPercent; |
518 | oldH = (int)((srcPercent*h) + (destPercent*bH)); | 518 | oldH = (int)((srcPercent*h) + (destPercent*bH)); |
519 | oldS = (int)((srcPercent*s) + (destPercent*bS)); | 519 | oldS = (int)((srcPercent*s) + (destPercent*bS)); |
520 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); | 520 | oldV = (int)((srcPercent*oldV) + (destPercent*bV)); |
521 | c.setHsv(oldH, oldS, oldV); | 521 | c.setHsv(oldH, oldS, oldV); |
522 | alpha = 255; | 522 | alpha = 255; |
523 | } | 523 | } |
524 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); | 524 | data[current] = qRgba(c.red(), c.green(), c.blue(), alpha); |
525 | } | 525 | } |
526 | QPixmap *pix = new QPixmap; | 526 | QPixmap *pix = new QPixmap; |
527 | pix->convertFromImage(img); | 527 | pix->convertFromImage(img); |
528 | return(pix); | 528 | return(pix); |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | 532 | ||
533 | 533 | ||
534 | QPixmap* LiquidStyle::getPixmap(BitmapData item) | 534 | QPixmap* LiquidStyle::getPixmap(BitmapData item) |
535 | { | 535 | { |
536 | 536 | ||
537 | if(pixmaps[item]) | 537 | if(pixmaps[item]) |
538 | return(pixmaps[item]); | 538 | return(pixmaps[item]); |
539 | 539 | ||
540 | switch(item){ | 540 | switch(item){ |
541 | case HTMLBtnBorder: | 541 | case HTMLBtnBorder: |
542 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); | 542 | pixmaps[HTMLBtnBorder] = processEmbedded("htmlbtnborder", btnH, btnS, btnV); |
543 | break; | 543 | break; |
544 | case HTMLBtnBorderDown: | 544 | case HTMLBtnBorderDown: |
545 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); | 545 | pixmaps[HTMLBtnBorderDown] = processEmbedded("htmlbtnborder", btnHoverH, btnHoverS, btnHoverV); |
546 | break; | 546 | break; |
547 | case HTMLCB: | 547 | case HTMLCB: |
548 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); | 548 | pixmaps[HTMLCB] = processEmbedded("htmlcheckbox", bH, bS, bV); |
549 | break; | 549 | break; |
550 | case HTMLCBDown: | 550 | case HTMLCBDown: |
551 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); | 551 | pixmaps[HTMLCBDown] = processEmbedded("htmlcheckboxdown", btnH, btnS, btnV); |
552 | break; | 552 | break; |
553 | case HTMLCBHover: | 553 | case HTMLCBHover: |
554 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); | 554 | pixmaps[HTMLCBHover] = processEmbedded("htmlcheckbox", btnH, btnS, btnV); |
555 | break; | 555 | break; |
556 | case HTMLCBDownHover: | 556 | case HTMLCBDownHover: |
557 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", | 557 | pixmaps[HTMLCBDownHover] = processEmbedded("htmlcheckboxdown", |
558 | btnHoverH, btnHoverS, | 558 | btnHoverH, btnHoverS, |
559 | btnHoverV); | 559 | btnHoverV); |
560 | break; | 560 | break; |
561 | case HTMLRadio: | 561 | case HTMLRadio: |
562 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); | 562 | pixmaps[HTMLRadio] = processEmbedded("htmlradio", bH, bS, bV); |
563 | case HTMLRadioDown: | 563 | case HTMLRadioDown: |
564 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); | 564 | pixmaps[HTMLRadioDown] = processEmbedded("htmlradiodown", btnH, btnS, btnV); |
565 | case HTMLRadioHover: | 565 | case HTMLRadioHover: |
566 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); | 566 | pixmaps[HTMLRadioHover] = processEmbedded("htmlradio", btnH, btnS, btnV); |
567 | case HTMLRadioDownHover: | 567 | case HTMLRadioDownHover: |
568 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", | 568 | pixmaps[HTMLRadioDownHover] = processEmbedded("htmlradiodown", |
569 | btnHoverH, btnHoverS, | 569 | btnHoverH, btnHoverS, |
570 | btnHoverV); | 570 | btnHoverV); |
571 | case RadioOn: | 571 | case RadioOn: |
572 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); | 572 | pixmaps[RadioOn] = processEmbedded("radio_down", btnH, btnS, btnV, true); |
573 | break; | 573 | break; |
574 | case RadioOnHover: | 574 | case RadioOnHover: |
575 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, | 575 | pixmaps[RadioOnHover] = processEmbedded("radio_down", btnHoverH, btnHoverS, |
576 | btnHoverV, true); | 576 | btnHoverV, true); |
577 | break; | 577 | break; |
578 | case RadioOffHover: | 578 | case RadioOffHover: |
579 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); | 579 | pixmaps[RadioOffHover] = processEmbedded("radio", btnH, btnS, btnV, true); |
580 | break; | 580 | break; |
581 | case TabDown: | 581 | case TabDown: |
582 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); | 582 | pixmaps[TabDown] = processEmbedded("tab", btnH, btnS, btnV, true); |
583 | break; | 583 | break; |
584 | case TabFocus: | 584 | case TabFocus: |
585 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, | 585 | pixmaps[TabFocus] = processEmbedded("tab", btnHoverH, btnHoverS, |
586 | btnHoverS, true); | 586 | btnHoverS, true); |
587 | break; | 587 | break; |
588 | case CBDown: | 588 | case CBDown: |
589 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); | 589 | pixmaps[CBDown] = processEmbedded("checkboxdown", btnH, btnS, btnV, true); |
590 | break; | 590 | break; |
591 | case CBDownHover: | 591 | case CBDownHover: |
592 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, | 592 | pixmaps[CBDownHover] = processEmbedded("checkboxdown", btnHoverH, |
593 | btnHoverS, btnHoverV, true); | 593 | btnHoverS, btnHoverV, true); |
594 | break; | 594 | break; |
595 | case CBHover: | 595 | case CBHover: |
596 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); | 596 | pixmaps[CBHover] = processEmbedded("checkbox", btnH, btnS, btnV, true); |
597 | break; | 597 | break; |
598 | case HSlider: | 598 | case HSlider: |
599 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 599 | pixmaps[HSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
600 | break; | 600 | break; |
601 | case VSlider: | 601 | case VSlider: |
602 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); | 602 | pixmaps[VSlider] = processEmbedded("sliderarrow", btnH, btnS, btnV, true); |
603 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); | 603 | *pixmaps[VSlider] = pixmaps[VSlider]->xForm(rMatrix); |
604 | break; | 604 | break; |
605 | case RadioOff: | 605 | case RadioOff: |
606 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); | 606 | pixmaps[RadioOff] = processEmbedded("radio", bH, bS, bV, true); |
607 | break; | 607 | break; |
608 | case Tab: | 608 | case Tab: |
609 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); | 609 | pixmaps[Tab] = processEmbedded("tab", bH, bS, bV, true); |
610 | break; | 610 | break; |
611 | case CB: | 611 | case CB: |
612 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); | 612 | pixmaps[CB] = processEmbedded("checkbox", bH, bS, bV, true); |
613 | break; | 613 | break; |
614 | case VSBSliderTop: | 614 | case VSBSliderTop: |
615 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 615 | pixmaps[VSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
616 | break; | 616 | break; |
617 | case VSBSliderBtm: | 617 | case VSBSliderBtm: |
618 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 618 | pixmaps[VSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
619 | break; | 619 | break; |
620 | case VSBSliderMid: | 620 | case VSBSliderMid: |
621 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 621 | pixmaps[VSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
622 | break; | 622 | break; |
623 | case VSBSliderTopHover: | 623 | case VSBSliderTopHover: |
624 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 624 | pixmaps[VSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
625 | break; | 625 | break; |
626 | case VSBSliderBtmHover: | 626 | case VSBSliderBtmHover: |
627 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 627 | pixmaps[VSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
628 | break; | 628 | break; |
629 | case VSBSliderMidHover: | 629 | case VSBSliderMidHover: |
630 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 630 | pixmaps[VSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
631 | break; | 631 | break; |
632 | 632 | ||
633 | case HSBSliderTop: | 633 | case HSBSliderTop: |
634 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); | 634 | pixmaps[HSBSliderTop] = processEmbedded("sbslider_top", btnH, btnS, btnV, true); |
635 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); | 635 | *pixmaps[HSBSliderTop] = pixmaps[HSBSliderTop]->xForm(rMatrix); |
636 | break; | 636 | break; |
637 | case HSBSliderBtm: | 637 | case HSBSliderBtm: |
638 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); | 638 | pixmaps[HSBSliderBtm] = processEmbedded("sbslider_btm", btnH, btnS, btnV, true); |
639 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); | 639 | *pixmaps[HSBSliderBtm] = pixmaps[HSBSliderBtm]->xForm(rMatrix); |
640 | break; | 640 | break; |
641 | case HSBSliderMid: | 641 | case HSBSliderMid: |
642 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); | 642 | pixmaps[HSBSliderMid] = processEmbedded("sbslider_mid", btnH, btnS, btnV); |
643 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); | 643 | *pixmaps[HSBSliderMid] = pixmaps[HSBSliderMid]->xForm(rMatrix); |
644 | break; | 644 | break; |
645 | case HSBSliderTopHover: | 645 | case HSBSliderTopHover: |
646 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); | 646 | pixmaps[HSBSliderTopHover] = processEmbedded("sbslider_top", btnHoverH, btnHoverS, btnHoverV, true); |
647 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); | 647 | *pixmaps[HSBSliderTopHover] = pixmaps[HSBSliderTopHover]->xForm(rMatrix); |
648 | break; | 648 | break; |
649 | case HSBSliderBtmHover: | 649 | case HSBSliderBtmHover: |
650 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); | 650 | pixmaps[HSBSliderBtmHover] = processEmbedded("sbslider_btm", btnHoverH, btnHoverS, btnHoverV, true); |
651 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); | 651 | *pixmaps[HSBSliderBtmHover] = pixmaps[HSBSliderBtmHover]->xForm(rMatrix); |
652 | break; | 652 | break; |
653 | case HSBSliderMidHover: | 653 | case HSBSliderMidHover: |
654 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); | 654 | pixmaps[HSBSliderMidHover] = processEmbedded("sbslider_mid", btnHoverH, btnHoverS, btnHoverV); |
655 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); | 655 | *pixmaps[HSBSliderMidHover] = pixmaps[HSBSliderMidHover]->xForm(rMatrix); |
656 | break; | 656 | break; |
657 | case VSBSliderTopBg: | 657 | case VSBSliderTopBg: |
658 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 658 | pixmaps[VSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
659 | break; | 659 | break; |
660 | case VSBSliderBtmBg: | 660 | case VSBSliderBtmBg: |
661 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 661 | pixmaps[VSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
662 | break; | 662 | break; |
663 | case VSBSliderMidBg: | 663 | case VSBSliderMidBg: |
664 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 664 | pixmaps[VSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
665 | break; | 665 | break; |
666 | case HSBSliderTopBg: | 666 | case HSBSliderTopBg: |
667 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); | 667 | pixmaps[HSBSliderTopBg] = processEmbedded("sbslider_top", bH, bS, bV, true); |
668 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); | 668 | *pixmaps[HSBSliderTopBg] = pixmaps[HSBSliderTopBg]->xForm(rMatrix); |
669 | break; | 669 | break; |
670 | case HSBSliderBtmBg: | 670 | case HSBSliderBtmBg: |
671 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); | 671 | pixmaps[HSBSliderBtmBg] = processEmbedded("sbslider_btm", bH, bS, bV, true); |
672 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); | 672 | *pixmaps[HSBSliderBtmBg] = pixmaps[HSBSliderBtmBg]->xForm(rMatrix); |
673 | break; | 673 | break; |
674 | case HSBSliderMidBg: | 674 | case HSBSliderMidBg: |
675 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); | 675 | pixmaps[HSBSliderMidBg] = processEmbedded("sbslider_mid", bH, bS, bV); |
676 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); | 676 | *pixmaps[HSBSliderMidBg] = pixmaps[HSBSliderMidBg]->xForm(rMatrix); |
677 | break; | 677 | break; |
678 | default: | 678 | default: |
679 | break; | 679 | break; |
680 | } | 680 | } |
681 | return(pixmaps[item]); | 681 | return(pixmaps[item]); |
682 | } | 682 | } |
683 | 683 | ||
684 | void LiquidStyle::polish(QPalette &appPal) | 684 | void LiquidStyle::polish(QPalette &appPal) |
685 | { | 685 | { |
686 | int i; | 686 | int i; |
687 | for(i=0; i < BITMAP_ITEMS; ++i){ | 687 | for(i=0; i < BITMAP_ITEMS; ++i){ |
688 | if(pixmaps[i]){ | 688 | if(pixmaps[i]){ |
689 | delete pixmaps[i]; | 689 | delete pixmaps[i]; |
690 | pixmaps[i] = NULL; | 690 | pixmaps[i] = NULL; |
691 | } | 691 | } |
692 | } | 692 | } |
693 | QWidgetList *list = QApplication::allWidgets(); | 693 | QWidgetList *list = QApplication::allWidgets(); |
694 | QWidgetListIt it( *list ); | 694 | QWidgetListIt it( *list ); |
695 | QWidget *w; | 695 | QWidget *w; |
696 | while ((w=it.current()) != 0 ){ | 696 | while ((w=it.current()) != 0 ){ |
697 | ++it; | 697 | ++it; |
698 | if(w->inherits("QPushButton")){ | 698 | if(w->inherits("QPushButton")){ |
699 | unapplyCustomAttributes((QPushButton *)w); | 699 | unapplyCustomAttributes((QPushButton *)w); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | 702 | ||
703 | loadCustomButtons(); | 703 | loadCustomButtons(); |
704 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 704 | lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
705 | btnDict.clear(); | 705 | btnDict.clear(); |
706 | btnBorderDict.clear(); | 706 | btnBorderDict.clear(); |
707 | bevelFillDict.clear(); | 707 | bevelFillDict.clear(); |
708 | smallBevelFillDict.clear(); | 708 | smallBevelFillDict.clear(); |
709 | 709 | ||
710 | Config config ( "qpe" ); | 710 | Config config ( "qpe" ); |
711 | config. setGroup ( "Liquid-Style" ); | 711 | config. setGroup ( "Liquid-Style" ); |
712 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 712 | int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
713 | if ( contrast < 0 ) | 713 | if ( contrast < 0 ) |
714 | contrast = 0; | 714 | contrast = 0; |
715 | else if ( contrast > 10 ) | 715 | else if ( contrast > 10 ) |
716 | contrast = 10; | 716 | contrast = 10; |
717 | 717 | ||
718 | // QPalette pal = QApplication::palette(); | 718 | // QPalette pal = QApplication::palette(); |
719 | 719 | ||
720 | // button color stuff | 720 | // button color stuff |
721 | config. setGroup ( "Appearance" ); | 721 | config. setGroup ( "Appearance" ); |
722 | QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 722 | QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
723 | appPal. color ( QPalette::Active, QColorGroup::Button ); | 723 | appPal. color ( QPalette::Active, QColorGroup::Button ); |
724 | if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) | 724 | if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) |
725 | //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) | 725 | //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) |
726 | ) { | 726 | ) { |
727 | // force button color to be different from background | 727 | // force button color to be different from background |
728 | QBrush btnBrush(QColor(200, 202, 228)); | 728 | QBrush btnBrush(QColor(200, 202, 228)); |
729 | appPal.setBrush(QColorGroup::Button, btnBrush); | 729 | appPal.setBrush(QColorGroup::Button, btnBrush); |
730 | } | 730 | } |
731 | c.hsv(&btnH, &btnS, &btnV); | 731 | c.hsv(&btnH, &btnS, &btnV); |
732 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); | 732 | c.light(120).hsv(&btnHoverH, &btnHoverS, &btnHoverV); |
733 | 733 | ||
734 | // menu pixmap | 734 | // menu pixmap |
735 | if(!menuPix){ | 735 | if(!menuPix){ |
736 | menuPix = new QPixmap; | 736 | menuPix = new QPixmap; |
737 | menuPix->resize(64, 64); | 737 | menuPix->resize(64, 64); |
738 | } | 738 | } |
739 | QPainter painter; | 739 | QPainter painter; |
740 | menuPix->fill(c.rgb()); | 740 | menuPix->fill(c.rgb()); |
741 | painter.begin(menuPix); | 741 | painter.begin(menuPix); |
742 | painter.setPen(c.dark(105)); | 742 | painter.setPen(c.dark(105)); |
743 | for(i=0; i < 63; i+=4){ | 743 | for(i=0; i < 63; i+=4){ |
744 | painter.drawLine(0, i, 63, i); | 744 | painter.drawLine(0, i, 63, i); |
745 | painter.drawLine(0, i+1, 63, i+1); | 745 | painter.drawLine(0, i+1, 63, i+1); |
746 | }; | 746 | }; |
747 | painter.end(); | 747 | painter.end(); |
748 | menuBrush.setColor(c); | 748 | menuBrush.setColor(c); |
749 | menuBrush.setPixmap(*menuPix); | 749 | menuBrush.setPixmap(*menuPix); |
750 | 750 | ||
751 | // pager brush | 751 | // pager brush |
752 | c = c.dark(120); | 752 | c = c.dark(120); |
753 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 753 | QPixmap *pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
754 | if(!pix){ | 754 | if(!pix){ |
755 | int h, s, v; | 755 | int h, s, v; |
756 | c.hsv(&h, &s, &v); | 756 | c.hsv(&h, &s, &v); |
757 | pix = new QPixmap(*smallBevelFillPix); | 757 | pix = new QPixmap(*smallBevelFillPix); |
758 | adjustHSV(*pix, h, s, v); | 758 | adjustHSV(*pix, h, s, v); |
759 | smallBevelFillDict.insert(c.rgb(), pix); | 759 | smallBevelFillDict.insert(c.rgb(), pix); |
760 | } | 760 | } |
761 | pagerHoverBrush.setColor(c); | 761 | pagerHoverBrush.setColor(c); |
762 | pagerHoverBrush.setPixmap(*pix); | 762 | pagerHoverBrush.setPixmap(*pix); |
763 | 763 | ||
764 | c = c.dark(120); | 764 | c = c.dark(120); |
765 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) | 765 | pix = smallBevelFillDict.find(c.rgb()); // better be NULL ;-) |
766 | if(!pix){ | 766 | if(!pix){ |
767 | int h, s, v; | 767 | int h, s, v; |
768 | c.hsv(&h, &s, &v); | 768 | c.hsv(&h, &s, &v); |
769 | pix = new QPixmap(*smallBevelFillPix); | 769 | pix = new QPixmap(*smallBevelFillPix); |
770 | adjustHSV(*pix, h, s, v); | 770 | adjustHSV(*pix, h, s, v); |
771 | smallBevelFillDict.insert(c.rgb(), pix); | 771 | smallBevelFillDict.insert(c.rgb(), pix); |
772 | } | 772 | } |
773 | pagerBrush.setColor(c); | 773 | pagerBrush.setColor(c); |
774 | pagerBrush.setPixmap(*pix); | 774 | pagerBrush.setPixmap(*pix); |
775 | 775 | ||
776 | // background color stuff | 776 | // background color stuff |
777 | c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); | 777 | c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); |
778 | c.hsv(&bH, &bS, &bV); | 778 | c.hsv(&bH, &bS, &bV); |
779 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 779 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
780 | 780 | ||
781 | // FIXME? | 781 | // FIXME? |
782 | if(vsbSliderFillPix) | 782 | if(vsbSliderFillPix) |
783 | delete vsbSliderFillPix; | 783 | delete vsbSliderFillPix; |
784 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); | 784 | vsbSliderFillPix = new QPixmap(bevelFillPix->xForm(rMatrix)); |
785 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); | 785 | adjustHSV(*vsbSliderFillPix, bH, bS, bV); |
786 | 786 | ||
787 | // background brush | 787 | // background brush |
788 | QPixmap wallPaper(32, 32); | 788 | QPixmap wallPaper(32, 32); |
789 | wallPaper.fill(c.rgb()); | 789 | wallPaper.fill(c.rgb()); |
790 | painter.begin(&wallPaper); | 790 | painter.begin(&wallPaper); |
791 | for(i=0; i < 32; i+=4){ | 791 | for(i=0; i < 32; i+=4){ |
792 | painter.setPen(c.dark(100 + contrast)); | 792 | painter.setPen(c.dark(100 + contrast)); |
793 | painter.drawLine(0, i, 32, i); | 793 | painter.drawLine(0, i, 32, i); |
794 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | 794 | painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); |
795 | painter.drawLine(0, i+1, 32, i+1); | 795 | painter.drawLine(0, i+1, 32, i+1); |
796 | }; | 796 | }; |
797 | painter.end(); | 797 | painter.end(); |
798 | bgBrush.setColor(c); | 798 | bgBrush.setColor(c); |
799 | bgBrush.setPixmap(wallPaper); | 799 | bgBrush.setPixmap(wallPaper); |
800 | appPal.setBrush(QColorGroup::Background, bgBrush); | 800 | appPal.setBrush(QColorGroup::Background, bgBrush); |
801 | 801 | ||
802 | // lineedits | 802 | // lineedits |
803 | c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); | 803 | c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); |
804 | QPixmap basePix; | 804 | QPixmap basePix; |
805 | basePix.resize(32, 32); | 805 | basePix.resize(32, 32); |
806 | basePix.fill(c.rgb()); | 806 | basePix.fill(c.rgb()); |
807 | painter.begin(&basePix); | 807 | painter.begin(&basePix); |
808 | painter.setPen(c.dark(105)); | 808 | painter.setPen(c.dark(105)); |
809 | for(i=0; i < 32; i+=4){ | 809 | for(i=0; i < 32; i+=4){ |
810 | painter.drawLine(0, i, 32, i); | 810 | painter.drawLine(0, i, 32, i); |
811 | painter.drawLine(0, i+1, 32, i+1); | 811 | painter.drawLine(0, i+1, 32, i+1); |
812 | }; | 812 | }; |
813 | painter.end(); | 813 | painter.end(); |
814 | baseBrush.setColor(c); | 814 | baseBrush.setColor(c); |
815 | baseBrush.setPixmap(basePix); | 815 | baseBrush.setPixmap(basePix); |
816 | it.toFirst(); | 816 | it.toFirst(); |
817 | while ((w=it.current()) != 0 ){ | 817 | while ((w=it.current()) != 0 ){ |
818 | ++it; | 818 | ++it; |
819 | if(w->inherits("QLineEdit")){ | 819 | if(w->inherits("QLineEdit")){ |
820 | QPalette pal = w->palette(); | 820 | QPalette pal = w->palette(); |
821 | pal.setBrush(QColorGroup::Base, baseBrush); | 821 | pal.setBrush(QColorGroup::Base, baseBrush); |
822 | w->setPalette(pal); | 822 | w->setPalette(pal); |
823 | } | 823 | } |
824 | else if(w->inherits("QPushButton")){ | 824 | else if(w->inherits("QPushButton")){ |
825 | applyCustomAttributes((QPushButton *)w); | 825 | applyCustomAttributes((QPushButton *)w); |
826 | } | 826 | } |
827 | } | 827 | } |
828 | } | 828 | } |
829 | 829 | ||
830 | void LiquidStyle::polish(QWidget *w) | 830 | void LiquidStyle::polish(QWidget *w) |
831 | { | 831 | { |
832 | if(w->inherits("QMenuBar")){ | 832 | if(w->inherits("QMenuBar")){ |
833 | //((QFrame*)w)->setLineWidth(0); | 833 | //((QFrame*)w)->setLineWidth(0); |
834 | w->setBackgroundMode(QWidget::PaletteBackground); | 834 | w->setBackgroundMode(QWidget::PaletteBackground); |
835 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 835 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
836 | return; | 836 | return; |
837 | } | 837 | } |
838 | if(w->inherits("QToolBar")){ | 838 | if(w->inherits("QToolBar")){ |
839 | w->installEventFilter(this); | 839 | w->installEventFilter(this); |
840 | w->setBackgroundMode(QWidget::PaletteBackground); | 840 | w->setBackgroundMode(QWidget::PaletteBackground); |
841 | w->setBackgroundOrigin(QWidget::WidgetOrigin); | 841 | w->setBackgroundOrigin(QWidget::WidgetOrigin); |
842 | return; | 842 | return; |
843 | } | 843 | } |
844 | if(w->inherits("QPopupMenu")) | 844 | if(w->inherits("QPopupMenu")) |
845 | w->setBackgroundMode(QWidget::NoBackground); | 845 | w->setBackgroundMode(QWidget::NoBackground); |
846 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 846 | else if(w-> testWFlags(Qt::WType_Popup) && |
847 | !w->inherits("QListBox") && | ||
848 | ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { | ||
847 | w->installEventFilter(menuHandler); | 849 | w->installEventFilter(menuHandler); |
848 | } | 850 | } |
849 | 851 | ||
850 | if(w->isTopLevel()){ | 852 | if(w->isTopLevel()){ |
851 | return; | 853 | return; |
852 | } | 854 | } |
853 | 855 | ||
854 | if(w->inherits("QComboBox") || w->inherits("QProgressBar") || | 856 | if(w->inherits("QComboBox") || w->inherits("QProgressBar") || |
855 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 857 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
856 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 858 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
857 | w->installEventFilter(this); | 859 | w->installEventFilter(this); |
858 | } | 860 | } |
859 | if(w->inherits("QLineEdit")){ | 861 | if(w->inherits("QLineEdit")){ |
860 | QPalette pal = w->palette(); | 862 | QPalette pal = w->palette(); |
861 | pal.setBrush(QColorGroup::Base, baseBrush); | 863 | pal.setBrush(QColorGroup::Base, baseBrush); |
862 | w->setPalette(pal); | 864 | w->setPalette(pal); |
863 | } | 865 | } |
864 | if(w->inherits("QPushButton")){ | 866 | if(w->inherits("QPushButton")){ |
865 | applyCustomAttributes((QPushButton *)w); | 867 | applyCustomAttributes((QPushButton *)w); |
866 | w->installEventFilter(this); | 868 | w->installEventFilter(this); |
867 | } | 869 | } |
868 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 870 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
869 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 871 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
870 | w->setBackgroundOrigin ( QWidget::ParentOrigin); | 872 | w->setBackgroundOrigin ( QWidget::ParentOrigin); |
871 | } | 873 | } |
872 | 874 | ||
873 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 875 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
874 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 876 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
875 | bool isViewportChild = w->parent() && | 877 | bool isViewportChild = w->parent() && |
876 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 878 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
877 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 879 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
878 | 880 | ||
879 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ | 881 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ |
880 | w->setBackgroundMode(QWidget::X11ParentRelative); | 882 | w->setBackgroundMode(QWidget::X11ParentRelative); |
881 | return; | 883 | return; |
882 | } | 884 | } |
883 | if(isViewportChild){ | 885 | if(isViewportChild){ |
884 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 886 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
885 | if(w->parent()){ // heh, only way to test for KHTML children ;-) | 887 | if(w->parent()){ // heh, only way to test for KHTML children ;-) |
886 | if(w->parent()->parent()){ | 888 | if(w->parent()->parent()){ |
887 | if(w->parent()->parent()->parent() && | 889 | if(w->parent()->parent()->parent() && |
888 | w->parent()->parent()->parent()->inherits("KHTMLView")){ | 890 | w->parent()->parent()->parent()->inherits("KHTMLView")){ |
889 | w->setAutoMask(true); | 891 | w->setAutoMask(true); |
890 | w->setBackgroundMode(QWidget::NoBackground); | 892 | w->setBackgroundMode(QWidget::NoBackground); |
891 | } | 893 | } |
892 | } | 894 | } |
893 | } | 895 | } |
894 | return; | 896 | return; |
895 | } | 897 | } |
896 | } | 898 | } |
897 | if(w->inherits("QHeader")){ | 899 | if(w->inherits("QHeader")){ |
898 | w->setMouseTracking(true); | 900 | w->setMouseTracking(true); |
899 | w->installEventFilter(this); | 901 | w->installEventFilter(this); |
900 | } | 902 | } |
901 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 903 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
902 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 904 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
903 | if ( flatTBButtons ) | 905 | if ( flatTBButtons ) |
904 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 906 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
905 | } | 907 | } |
906 | if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { | 908 | if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { |
907 | ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); | 909 | ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); |
908 | } | 910 | } |
909 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 911 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
910 | return; | 912 | return; |
911 | } | 913 | } |
912 | 914 | ||
913 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 915 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
914 | palette().active().brush(QColorGroup::Background).pixmap()){ | 916 | palette().active().brush(QColorGroup::Background).pixmap()){ |
915 | qWarning("No parent pixmap for child widget %s", w->className()); | 917 | qWarning("No parent pixmap for child widget %s", w->className()); |
916 | return; | 918 | return; |
917 | } | 919 | } |
918 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 920 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
919 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 921 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
920 | if(w->backgroundMode() == QWidget::PaletteBackground || | 922 | if(w->backgroundMode() == QWidget::PaletteBackground || |
921 | w->backgroundMode() == QWidget::PaletteButton){ | 923 | w->backgroundMode() == QWidget::PaletteButton){ |
922 | w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); | 924 | w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); |
923 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 925 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
924 | // w->setBackgroundMode(QWidget::NoBackground); | 926 | // w->setBackgroundMode(QWidget::NoBackground); |
925 | } | 927 | } |
926 | } | 928 | } |
927 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | 929 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) |
928 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | 930 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); |
929 | else if ( w-> inherits("QFrame") ) | 931 | else if ( w-> inherits("QFrame") ) |
930 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | 932 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); |
931 | 933 | ||
932 | if ( w->parentWidget()->inherits ( "QWidgetStack" )) { | 934 | if ( w->parentWidget()->inherits ( "QWidgetStack" )) { |
933 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | 935 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); |
934 | } | 936 | } |
935 | } | 937 | } |
936 | 938 | ||
937 | void LiquidStyle::unPolish(QWidget *w) | 939 | void LiquidStyle::unPolish(QWidget *w) |
938 | { | 940 | { |
939 | if(w->inherits("QMenuBar")){ | 941 | if(w->inherits("QMenuBar")){ |
940 | ((QFrame *)w)->setLineWidth(1); | 942 | ((QFrame *)w)->setLineWidth(1); |
941 | w->setBackgroundMode(QWidget::PaletteBackground); | 943 | w->setBackgroundMode(QWidget::PaletteBackground); |
942 | return; | 944 | return; |
943 | } | 945 | } |
944 | 946 | ||
945 | if(w->inherits("QPopupMenu")) | 947 | if(w->inherits("QPopupMenu")) |
946 | w->setBackgroundMode(QWidget::PaletteButton); | 948 | w->setBackgroundMode(QWidget::PaletteButton); |
947 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 949 | else if(w-> testWFlags(Qt::WType_Popup) && |
950 | !w->inherits("QListBox") && | ||
951 | ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { | ||
948 | w->removeEventFilter(menuHandler); | 952 | w->removeEventFilter(menuHandler); |
949 | } | 953 | } |
950 | 954 | ||
951 | if(w->isTopLevel()) | 955 | if(w->isTopLevel()) |
952 | return; | 956 | return; |
953 | 957 | ||
954 | // for viewport children, don't just check for NoBackground.... | 958 | // for viewport children, don't just check for NoBackground.... |
955 | bool isViewportChild = w->parent() && | 959 | bool isViewportChild = w->parent() && |
956 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 960 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
957 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 961 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
958 | 962 | ||
959 | w->unsetPalette(); | 963 | w->unsetPalette(); |
960 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 964 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
961 | if(w->inherits("QPushButton")) | 965 | if(w->inherits("QPushButton")) |
962 | w->setBackgroundMode(QWidget::PaletteButton); | 966 | w->setBackgroundMode(QWidget::PaletteButton); |
963 | else | 967 | else |
964 | w->setBackgroundMode(QWidget::PaletteBackground); | 968 | w->setBackgroundMode(QWidget::PaletteBackground); |
965 | } | 969 | } |
966 | 970 | ||
967 | if(isViewportChild) | 971 | if(isViewportChild) |
968 | w->setAutoMask(false); | 972 | w->setAutoMask(false); |
969 | 973 | ||
970 | if(w->inherits("QPushButton")){ | 974 | if(w->inherits("QPushButton")){ |
971 | unapplyCustomAttributes((QPushButton *)w); | 975 | unapplyCustomAttributes((QPushButton *)w); |
972 | w->removeEventFilter(this); | 976 | w->removeEventFilter(this); |
973 | } | 977 | } |
974 | /* | 978 | /* |
975 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 979 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
976 | w-> setBackgroundMode ( PaletteBackground ); | 980 | w-> setBackgroundMode ( PaletteBackground ); |
977 | } | 981 | } |
978 | */ | 982 | */ |
979 | if(w->inherits("QComboBox") || | 983 | if(w->inherits("QComboBox") || |
980 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 984 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
981 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 985 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
982 | w->removeEventFilter(this); | 986 | w->removeEventFilter(this); |
983 | } | 987 | } |
984 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 988 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
985 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ | 989 | if(w->parent() && w->parent()->inherits("KHTMLPart")){ |
986 | w->setAutoMask(false); | 990 | w->setAutoMask(false); |
987 | } | 991 | } |
988 | } | 992 | } |
989 | if(w->inherits("QToolBar")){ | 993 | if(w->inherits("QToolBar")){ |
990 | w->removeEventFilter(this); | 994 | w->removeEventFilter(this); |
991 | w->setBackgroundMode(QWidget::PaletteBackground); | 995 | w->setBackgroundMode(QWidget::PaletteBackground); |
992 | return; | 996 | return; |
993 | } | 997 | } |
994 | if(w->inherits("QHeader")){ | 998 | if(w->inherits("QHeader")){ |
995 | w->setMouseTracking(false); | 999 | w->setMouseTracking(false); |
996 | w->removeEventFilter(this); | 1000 | w->removeEventFilter(this); |
997 | } | 1001 | } |
998 | } | 1002 | } |
999 | 1003 | ||
1000 | void LiquidStyle::polish(QApplication *app) | 1004 | void LiquidStyle::polish(QApplication *app) |
1001 | { | 1005 | { |
1002 | 1006 | ||
1003 | QWindowsStyle::polish(app); | 1007 | QWindowsStyle::polish(app); |
1004 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 1008 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
1005 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 1009 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
1006 | if(menuAni) | 1010 | if(menuAni) |
1007 | app->setEffectEnabled(UI_AnimateMenu, false); | 1011 | app->setEffectEnabled(UI_AnimateMenu, false); |
1008 | if(menuFade) | 1012 | if(menuFade) |
1009 | app->setEffectEnabled(UI_FadeMenu, false); | 1013 | app->setEffectEnabled(UI_FadeMenu, false); |
1010 | 1014 | ||
1011 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 1015 | qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
1012 | 1016 | ||
1013 | Config config ( "qpe" ); | 1017 | Config config ( "qpe" ); |
1014 | config. setGroup ( "Liquid-Style" ); | 1018 | config. setGroup ( "Liquid-Style" ); |
1015 | 1019 | ||
1016 | // if ( config. readBoolEntry ( "WinDecoration", true )) | 1020 | // if ( config. readBoolEntry ( "WinDecoration", true )) |
1017 | // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 1021 | // QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
1018 | 1022 | ||
1019 | flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | 1023 | flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); |
1020 | } | 1024 | } |
1021 | 1025 | ||
1022 | void LiquidStyle::unPolish(QApplication *app) | 1026 | void LiquidStyle::unPolish(QApplication *app) |
1023 | { | 1027 | { |
1024 | QWindowsStyle::unPolish(app); | 1028 | QWindowsStyle::unPolish(app); |
1025 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 1029 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
1026 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 1030 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
1027 | 1031 | ||
1028 | qt_set_draw_menu_bar_impl ( 0 ); | 1032 | qt_set_draw_menu_bar_impl ( 0 ); |
1029 | 1033 | ||
1030 | // QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 1034 | // QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
1031 | } | 1035 | } |
1032 | 1036 | ||
1033 | 1037 | ||
1034 | /* !! HACK !! Beware | 1038 | /* !! HACK !! Beware |
1035 | * | 1039 | * |
1036 | * TT forgot to make the QProgressBar widget styleable in Qt 2.x | 1040 | * TT forgot to make the QProgressBar widget styleable in Qt 2.x |
1037 | * So the only way to customize the drawing, is to intercept the | 1041 | * So the only way to customize the drawing, is to intercept the |
1038 | * paint event - since we have to use protected functions, we need | 1042 | * paint event - since we have to use protected functions, we need |
1039 | * to derive a "hack" class from QProgressBar and do the painting | 1043 | * to derive a "hack" class from QProgressBar and do the painting |
1040 | * in there. | 1044 | * in there. |
1041 | * | 1045 | * |
1042 | * - sandman | 1046 | * - sandman |
1043 | */ | 1047 | */ |
1044 | 1048 | ||
1045 | class HackProgressBar : public QProgressBar { | 1049 | class HackProgressBar : public QProgressBar { |
1046 | public: | 1050 | public: |
1047 | HackProgressBar ( ); | 1051 | HackProgressBar ( ); |
1048 | 1052 | ||
1049 | void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) | 1053 | void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) |
1050 | { | 1054 | { |
1051 | QPainter p( this ); | 1055 | QPainter p( this ); |
1052 | 1056 | ||
1053 | if ( !contentsRect().contains( event->rect() ) ) { | 1057 | if ( !contentsRect().contains( event->rect() ) ) { |
1054 | p.save(); | 1058 | p.save(); |
1055 | p.setClipRegion( event->region().intersect(frameRect()) ); | 1059 | p.setClipRegion( event->region().intersect(frameRect()) ); |
1056 | drawFrame( &p); | 1060 | drawFrame( &p); |
1057 | p.restore(); | 1061 | p.restore(); |
1058 | } | 1062 | } |
1059 | if ( event->rect().intersects( contentsRect() )) { | 1063 | if ( event->rect().intersects( contentsRect() )) { |
1060 | p.setClipRegion( event->region().intersect( contentsRect() ) ); | 1064 | p.setClipRegion( event->region().intersect( contentsRect() ) ); |
1061 | 1065 | ||
1062 | int x, y, w, h; | 1066 | int x, y, w, h; |
1063 | contentsRect ( ). rect ( &x, &y, &w, &h ); | 1067 | contentsRect ( ). rect ( &x, &y, &w, &h ); |
1064 | 1068 | ||
1065 | int prog = progress ( ); | 1069 | int prog = progress ( ); |
1066 | int total = totalSteps ( ); | 1070 | int total = totalSteps ( ); |
1067 | if ( prog < 0 ) | 1071 | if ( prog < 0 ) |
1068 | prog = 0; | 1072 | prog = 0; |
1069 | if ( total <= 0 ) | 1073 | if ( total <= 0 ) |
1070 | total = 1; | 1074 | total = 1; |
1071 | int bw = w * prog / total; | 1075 | int bw = w * prog / total; |
1072 | if ( bw > w ) | 1076 | if ( bw > w ) |
1073 | bw = w; | 1077 | bw = w; |
1074 | 1078 | ||
1075 | p.setPen(g.button().dark(130)); | 1079 | p.setPen(g.button().dark(130)); |
1076 | p.drawRect(x, y, bw, h); | 1080 | p.drawRect(x, y, bw, h); |
1077 | p.setPen(g.button().light(120)); | 1081 | p.setPen(g.button().light(120)); |
1078 | p.drawRect(x+1, y+1, bw-2, h-2); | 1082 | p.drawRect(x+1, y+1, bw-2, h-2); |
1079 | 1083 | ||
1080 | if(bw >= 4 && h >= 4 && pix) | 1084 | if(bw >= 4 && h >= 4 && pix) |
1081 | p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); | 1085 | p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); |
1082 | 1086 | ||
1083 | if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { | 1087 | if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { |
1084 | QString pstr; | 1088 | QString pstr; |
1085 | pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); | 1089 | pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); |
1086 | p. setPen ( g.text());//g.highlightedText ( )); | 1090 | p. setPen ( g.text());//g.highlightedText ( )); |
1087 | p. drawText (x,y,w-1,h-1,AlignCenter,pstr); | 1091 | p. drawText (x,y,w-1,h-1,AlignCenter,pstr); |
1088 | } | 1092 | } |
1089 | } | 1093 | } |
1090 | } | 1094 | } |
1091 | }; | 1095 | }; |
1092 | 1096 | ||
1093 | 1097 | ||
1094 | 1098 | ||
1095 | /* | 1099 | /* |
1096 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to | 1100 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
1097 | * force everything to erase and repaint on resize. This is going away, I'm | 1101 | * force everything to erase and repaint on resize. This is going away, I'm |
1098 | * trying to get shaped widgets to work right without masking. QPushButton, | 1102 | * trying to get shaped widgets to work right without masking. QPushButton, |
1099 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order | 1103 | * QComboBox, and Panel applet handles capture mouse enter and leaves in order |
1100 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and | 1104 | * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and |
1101 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and | 1105 | * RadioButtons need to do this differently. Qt buffers these in pixmaps and |
1102 | * caches them in QPixmapCache, which is bad for doing things like hover | 1106 | * caches them in QPixmapCache, which is bad for doing things like hover |
1103 | * because the style methods aren't called in paintEvents if everything | 1107 | * because the style methods aren't called in paintEvents if everything |
1104 | * is cached. We use our own Paint event handler instead. Taskbuttons and | 1108 | * is cached. We use our own Paint event handler instead. Taskbuttons and |
1105 | * pager buttons draw into a pixmap buffer, so we handle those with palette | 1109 | * pager buttons draw into a pixmap buffer, so we handle those with palette |
1106 | * modifications. For QHeader, different header items are actually one widget | 1110 | * modifications. For QHeader, different header items are actually one widget |
1107 | * that draws multiple items, so we need to check which ID is hightlighted | 1111 | * that draws multiple items, so we need to check which ID is hightlighted |
1108 | * and draw it. Finally, we also check enter and leave events for QLineEdit, | 1112 | * and draw it. Finally, we also check enter and leave events for QLineEdit, |
1109 | * since if it's inside a combobox we want to highlight the combobox during | 1113 | * since if it's inside a combobox we want to highlight the combobox during |
1110 | * hovering in the edit. | 1114 | * hovering in the edit. |
1111 | */ | 1115 | */ |
1112 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 1116 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
1113 | { | 1117 | { |
1114 | if(obj->inherits("QToolBar")){ | 1118 | if(obj->inherits("QToolBar")){ |
1115 | if(ev->type() == QEvent::Resize){ | 1119 | if(ev->type() == QEvent::Resize){ |
1116 | const QObjectList *tbChildList = obj->children(); | 1120 | const QObjectList *tbChildList = obj->children(); |
1117 | QObjectListIt it(*tbChildList); | 1121 | QObjectListIt it(*tbChildList); |
1118 | QObject *child; | 1122 | QObject *child; |
1119 | while((child = it.current()) != NULL){ | 1123 | while((child = it.current()) != NULL){ |
1120 | ++it; | 1124 | ++it; |
1121 | if(child->isWidgetType()) | 1125 | if(child->isWidgetType()) |
1122 | ((QWidget *)child)->repaint(true); | 1126 | ((QWidget *)child)->repaint(true); |
1123 | } | 1127 | } |
1124 | 1128 | ||
1125 | } | 1129 | } |
1126 | } | 1130 | } |
1127 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 1131 | else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
1128 | QWidget *btn = (QWidget *)obj; | 1132 | QWidget *btn = (QWidget *)obj; |
1129 | if(ev->type() == QEvent::Enter){ | 1133 | if(ev->type() == QEvent::Enter){ |
1130 | if(btn->isEnabled()){ | 1134 | if(btn->isEnabled()){ |
1131 | highlightWidget = btn; | 1135 | highlightWidget = btn; |
1132 | btn->repaint(false); | 1136 | btn->repaint(false); |
1133 | } | 1137 | } |
1134 | } | 1138 | } |
1135 | else if(ev->type() == QEvent::Leave){ | 1139 | else if(ev->type() == QEvent::Leave){ |
1136 | if(btn == highlightWidget){ | 1140 | if(btn == highlightWidget){ |
1137 | highlightWidget = NULL; | 1141 | highlightWidget = NULL; |
1138 | btn->repaint(false); | 1142 | btn->repaint(false); |
1139 | } | 1143 | } |
1140 | } | 1144 | } |
1141 | } | 1145 | } |
1142 | else if(obj->inherits("QToolButton")){ | 1146 | else if(obj->inherits("QToolButton")){ |
1143 | QToolButton *btn = (QToolButton *)btn; | 1147 | QToolButton *btn = (QToolButton *)btn; |
1144 | if(!btn->autoRaise()){ | 1148 | if(!btn->autoRaise()){ |
1145 | if(btn->isEnabled()){ | 1149 | if(btn->isEnabled()){ |
1146 | highlightWidget = btn; | 1150 | highlightWidget = btn; |
1147 | btn->repaint(false); | 1151 | btn->repaint(false); |
1148 | } | 1152 | } |
1149 | } | 1153 | } |
1150 | else if(ev->type() == QEvent::Leave){ | 1154 | else if(ev->type() == QEvent::Leave){ |
1151 | QWidget *btn = (QWidget *)obj; | 1155 | QWidget *btn = (QWidget *)obj; |
1152 | if(btn == highlightWidget){ | 1156 | if(btn == highlightWidget){ |
1153 | highlightWidget = NULL; | 1157 | highlightWidget = NULL; |
1154 | btn->repaint(false); | 1158 | btn->repaint(false); |
1155 | } | 1159 | } |
1156 | } | 1160 | } |
1157 | else | 1161 | else |
1158 | highlightWidget = NULL; | 1162 | highlightWidget = NULL; |
1159 | } | 1163 | } |
1160 | else if(obj->inherits("QScrollBar")){ | 1164 | else if(obj->inherits("QScrollBar")){ |
1161 | QScrollBar *sb = (QScrollBar *)obj; | 1165 | QScrollBar *sb = (QScrollBar *)obj; |
1162 | if(ev->type() == QEvent::Enter){ | 1166 | if(ev->type() == QEvent::Enter){ |
1163 | if(sb->isEnabled()){ | 1167 | if(sb->isEnabled()){ |
1164 | highlightWidget = sb; | 1168 | highlightWidget = sb; |
1165 | sb->repaint(false); | 1169 | sb->repaint(false); |
1166 | } | 1170 | } |
1167 | } | 1171 | } |
1168 | else if(ev->type() == QEvent::Leave){ | 1172 | else if(ev->type() == QEvent::Leave){ |
1169 | if(sb == highlightWidget && !sb->draggingSlider()){ | 1173 | if(sb == highlightWidget && !sb->draggingSlider()){ |
1170 | highlightWidget = NULL; | 1174 | highlightWidget = NULL; |
1171 | sb->repaint(false); | 1175 | sb->repaint(false); |
1172 | } | 1176 | } |
1173 | } | 1177 | } |
1174 | else if(ev->type() == QEvent::MouseButtonRelease){ | 1178 | else if(ev->type() == QEvent::MouseButtonRelease){ |
1175 | QMouseEvent *me = (QMouseEvent *)ev; | 1179 | QMouseEvent *me = (QMouseEvent *)ev; |
1176 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ | 1180 | if(sb == highlightWidget && !sb->rect().contains(me->pos())){ |
1177 | highlightWidget = NULL; | 1181 | highlightWidget = NULL; |
1178 | sb->repaint(false); | 1182 | sb->repaint(false); |
1179 | } | 1183 | } |
1180 | } | 1184 | } |
1181 | } | 1185 | } |
1182 | else if(obj->inherits("QLineEdit")){ | 1186 | else if(obj->inherits("QLineEdit")){ |
1183 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ | 1187 | if(obj->parent() && obj->parent()->inherits("QComboBox")){ |
1184 | QWidget *btn = (QComboBox *)obj->parent(); | 1188 | QWidget *btn = (QComboBox *)obj->parent(); |
1185 | if(ev->type() == QEvent::Enter){ | 1189 | if(ev->type() == QEvent::Enter){ |
1186 | if (btn->isEnabled()){ | 1190 | if (btn->isEnabled()){ |
1187 | highlightWidget = btn; | 1191 | highlightWidget = btn; |
1188 | btn->repaint(false); | 1192 | btn->repaint(false); |
1189 | } | 1193 | } |
1190 | } | 1194 | } |
1191 | else if(ev->type() == QEvent::Leave){ | 1195 | else if(ev->type() == QEvent::Leave){ |
1192 | if (btn == highlightWidget) | 1196 | if (btn == highlightWidget) |
1193 | highlightWidget = NULL; | 1197 | highlightWidget = NULL; |
1194 | btn->repaint(false); | 1198 | btn->repaint(false); |
1195 | } | 1199 | } |
1196 | } | 1200 | } |
1197 | } | 1201 | } |
1198 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ | 1202 | else if(obj->inherits("QRadioButton") || obj->inherits("QCheckBox")){ |
1199 | QButton *btn = (QButton *)obj; | 1203 | QButton *btn = (QButton *)obj; |
1200 | bool isRadio = obj->inherits("QRadioButton"); | 1204 | bool isRadio = obj->inherits("QRadioButton"); |
1201 | if(ev->type() == QEvent::Paint){ | 1205 | if(ev->type() == QEvent::Paint){ |
1202 | //if(btn->autoMask()) | 1206 | //if(btn->autoMask()) |
1203 | btn->erase(); | 1207 | btn->erase(); |
1204 | QPainter p; | 1208 | QPainter p; |
1205 | p.begin(btn); | 1209 | p.begin(btn); |
1206 | QFontMetrics fm = btn->fontMetrics(); | 1210 | QFontMetrics fm = btn->fontMetrics(); |
1207 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1211 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1208 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1212 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1209 | : indicatorSize(); | 1213 | : indicatorSize(); |
1210 | 1214 | ||
1211 | if(btn->hasFocus()){ | 1215 | if(btn->hasFocus()){ |
1212 | QRect r = QRect(0, 0, btn->width(), btn->height()); | 1216 | QRect r = QRect(0, 0, btn->width(), btn->height()); |
1213 | p.setPen(btn->colorGroup().button().dark(140)); | 1217 | p.setPen(btn->colorGroup().button().dark(140)); |
1214 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); | 1218 | p.drawLine(r.x()+1, r.y(), r.right()-1, r.y()); |
1215 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); | 1219 | p.drawLine(r.x(), r.y()+1, r.x(), r.bottom()-1); |
1216 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); | 1220 | p.drawLine(r.right(), r.y()+1, r.right(), r.bottom()-1); |
1217 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); | 1221 | p.drawLine(r.x()+1, r.bottom(), r.right()-1, r.bottom()); |
1218 | } | 1222 | } |
1219 | int x = 0; | 1223 | int x = 0; |
1220 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1224 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1221 | if(isRadio) | 1225 | if(isRadio) |
1222 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1226 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1223 | btn->colorGroup(), btn->isOn(), | 1227 | btn->colorGroup(), btn->isOn(), |
1224 | btn->isDown(), btn->isEnabled()); | 1228 | btn->isDown(), btn->isEnabled()); |
1225 | else | 1229 | else |
1226 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1230 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1227 | btn->colorGroup(), btn->state(), btn->isDown(), | 1231 | btn->colorGroup(), btn->state(), btn->isDown(), |
1228 | btn->isEnabled()); | 1232 | btn->isEnabled()); |
1229 | x = sz.width() + 6; | 1233 | x = sz.width() + 6; |
1230 | y = 0; | 1234 | y = 0; |
1231 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), | 1235 | drawItem(&p, sz.width()+6+1, 0, btn->width()-(sz.width()+6+1), |
1232 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, | 1236 | btn->height(), AlignLeft|AlignVCenter|ShowPrefix, |
1233 | btn->colorGroup(), btn->isEnabled(), | 1237 | btn->colorGroup(), btn->isEnabled(), |
1234 | btn->pixmap(), btn->text()); | 1238 | btn->pixmap(), btn->text()); |
1235 | p.end(); | 1239 | p.end(); |
1236 | return(true); | 1240 | return(true); |
1237 | } | 1241 | } |
1238 | // for hover, just redraw the indicator (not the text) | 1242 | // for hover, just redraw the indicator (not the text) |
1239 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || | 1243 | else if((ev->type() == QEvent::Enter && btn->isEnabled()) || |
1240 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ | 1244 | (ev->type() == QEvent::Leave && btn == highlightWidget)){ |
1241 | QButton *btn = (QButton *)obj; | 1245 | QButton *btn = (QButton *)obj; |
1242 | bool isRadio = obj->inherits("QRadioButton"); | 1246 | bool isRadio = obj->inherits("QRadioButton"); |
1243 | 1247 | ||
1244 | if(ev->type() == QEvent::Enter) | 1248 | if(ev->type() == QEvent::Enter) |
1245 | highlightWidget = btn; | 1249 | highlightWidget = btn; |
1246 | else | 1250 | else |
1247 | highlightWidget = NULL; | 1251 | highlightWidget = NULL; |
1248 | QFontMetrics fm = btn->fontMetrics(); | 1252 | QFontMetrics fm = btn->fontMetrics(); |
1249 | QSize lsz = fm.size(ShowPrefix, btn->text()); | 1253 | QSize lsz = fm.size(ShowPrefix, btn->text()); |
1250 | QSize sz = isRadio ? exclusiveIndicatorSize() | 1254 | QSize sz = isRadio ? exclusiveIndicatorSize() |
1251 | : indicatorSize(); | 1255 | : indicatorSize(); |
1252 | int x = 0; | 1256 | int x = 0; |
1253 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; | 1257 | int y = (btn->height()-lsz.height()+fm.height()-sz.height())/2; |
1254 | //if(btn->autoMask()) | 1258 | //if(btn->autoMask()) |
1255 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); | 1259 | // btn->erase(x+1, y+1, sz.width()-2, sz.height()-2); |
1256 | QPainter p; | 1260 | QPainter p; |
1257 | p.begin(btn); | 1261 | p.begin(btn); |
1258 | if(isRadio) | 1262 | if(isRadio) |
1259 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), | 1263 | drawExclusiveIndicator(&p, x, y, sz.width(), sz.height(), |
1260 | btn->colorGroup(), btn->isOn(), | 1264 | btn->colorGroup(), btn->isOn(), |
1261 | btn->isDown(), btn->isEnabled()); | 1265 | btn->isDown(), btn->isEnabled()); |
1262 | else | 1266 | else |
1263 | drawIndicator(&p, x, y, sz.width(), sz.height(), | 1267 | drawIndicator(&p, x, y, sz.width(), sz.height(), |
1264 | btn->colorGroup(), btn->state(), btn->isDown(), | 1268 | btn->colorGroup(), btn->state(), btn->isDown(), |
1265 | btn->isEnabled()); | 1269 | btn->isEnabled()); |
1266 | p.end(); | 1270 | p.end(); |
1267 | } | 1271 | } |
1268 | } | 1272 | } |
1269 | else if(obj->inherits("QHeader")){ | 1273 | else if(obj->inherits("QHeader")){ |
1270 | QHeader *hw = (QHeader *)obj; | 1274 | QHeader *hw = (QHeader *)obj; |
1271 | if(ev->type() == QEvent::Enter){ | 1275 | if(ev->type() == QEvent::Enter){ |
1272 | currentHeader = hw; | 1276 | currentHeader = hw; |
1273 | headerHoverID = -1; | 1277 | headerHoverID = -1; |
1274 | } | 1278 | } |
1275 | else if(ev->type() == QEvent::Leave){ | 1279 | else if(ev->type() == QEvent::Leave){ |
1276 | currentHeader = NULL; | 1280 | currentHeader = NULL; |
1277 | if(headerHoverID != -1){ | 1281 | if(headerHoverID != -1){ |
1278 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1282 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1279 | hw->sectionSize(headerHoverID), hw->height()); | 1283 | hw->sectionSize(headerHoverID), hw->height()); |
1280 | } | 1284 | } |
1281 | headerHoverID = -1; | 1285 | headerHoverID = -1; |
1282 | } | 1286 | } |
1283 | else if(ev->type() == QEvent::MouseMove){ | 1287 | else if(ev->type() == QEvent::MouseMove){ |
1284 | QMouseEvent *me = (QMouseEvent *)ev; | 1288 | QMouseEvent *me = (QMouseEvent *)ev; |
1285 | int oldHeader = headerHoverID; | 1289 | int oldHeader = headerHoverID; |
1286 | headerHoverID = hw->sectionAt(me->x()); | 1290 | headerHoverID = hw->sectionAt(me->x()); |
1287 | if(oldHeader != headerHoverID){ | 1291 | if(oldHeader != headerHoverID){ |
1288 | // reset old header | 1292 | // reset old header |
1289 | if(oldHeader != -1){ | 1293 | if(oldHeader != -1){ |
1290 | hw->repaint(hw->sectionPos(oldHeader), 0, | 1294 | hw->repaint(hw->sectionPos(oldHeader), 0, |
1291 | hw->sectionSize(oldHeader), hw->height()); | 1295 | hw->sectionSize(oldHeader), hw->height()); |
1292 | } | 1296 | } |
1293 | if(headerHoverID != -1){ | 1297 | if(headerHoverID != -1){ |
1294 | hw->repaint(hw->sectionPos(headerHoverID), 0, | 1298 | hw->repaint(hw->sectionPos(headerHoverID), 0, |
1295 | hw->sectionSize(headerHoverID), hw->height()); | 1299 | hw->sectionSize(headerHoverID), hw->height()); |
1296 | } | 1300 | } |
1297 | } | 1301 | } |
1298 | } | 1302 | } |
1299 | } | 1303 | } |
1300 | else if (obj-> inherits( "QProgressBar" )) { | 1304 | else if (obj-> inherits( "QProgressBar" )) { |
1301 | if ( ev->type() == QEvent::Paint ) { | 1305 | if ( ev->type() == QEvent::Paint ) { |
1302 | HackProgressBar *p = (HackProgressBar *) obj; | 1306 | HackProgressBar *p = (HackProgressBar *) obj; |
1303 | const QColorGroup &g = p-> colorGroup ( ); | 1307 | const QColorGroup &g = p-> colorGroup ( ); |
1304 | 1308 | ||
1305 | QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); | 1309 | QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); |
1306 | if(!pix){ | 1310 | if(!pix){ |
1307 | int h, s, v; | 1311 | int h, s, v; |
1308 | g.button().dark(120).hsv(&h, &s, &v); | 1312 | g.button().dark(120).hsv(&h, &s, &v); |
1309 | pix = new QPixmap(*bevelFillPix); | 1313 | pix = new QPixmap(*bevelFillPix); |
1310 | adjustHSV(*pix, h, s, v); | 1314 | adjustHSV(*pix, h, s, v); |
1311 | bevelFillDict.insert(g.button().dark(120).rgb(), pix); | 1315 | bevelFillDict.insert(g.button().dark(120).rgb(), pix); |
1312 | } | 1316 | } |
1313 | p-> paint ((QPaintEvent *) ev, g, pix ); | 1317 | p-> paint ((QPaintEvent *) ev, g, pix ); |
1314 | return true; | 1318 | return true; |
1315 | } | 1319 | } |
1316 | } | 1320 | } |
1317 | return false ; | 1321 | return false ; |
1318 | } | 1322 | } |
1319 | 1323 | ||
1320 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, | 1324 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, |
1321 | const QColorGroup &g, bool sunken, | 1325 | const QColorGroup &g, bool sunken, |
1322 | const QBrush *) | 1326 | const QBrush *) |
1323 | { | 1327 | { |
1324 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), | 1328 | drawRoundButton(p, sunken ? g.background() : g.button(), g.background(), |
1325 | x, y, w, h); | 1329 | x, y, w, h); |
1326 | } | 1330 | } |
1327 | 1331 | ||
1328 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, | 1332 | void LiquidStyle::drawToolButton(QPainter *p, int x, int y, int w, int h, |
1329 | const QColorGroup &g, bool sunken, | 1333 | const QColorGroup &g, bool sunken, |
1330 | const QBrush *) | 1334 | const QBrush *) |
1331 | { | 1335 | { |
diff --git a/noncore/styles/liquid/opie-liquid.diff b/noncore/styles/liquid/opie-liquid.diff index 90ece90..f3531e5 100644 --- a/noncore/styles/liquid/opie-liquid.diff +++ b/noncore/styles/liquid/opie-liquid.diff | |||
@@ -1,1435 +1,1508 @@ | |||
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 | --- -Sat Sep 21 05:31:47 2002 | 6 | --- -2002-10-24 03:19:30.000000000 +0200 |
7 | +++ liquid.hMon Jul 15 02:52:50 2002 | 7 | +++ liquid.h2002-07-15 02:52:50.000000000 +0200 |
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 | @@ -204,6 +177,7 @@ | 105 | @@ -204,6 +177,7 @@ |
106 | QPixmap* getPixmap(BitmapData item); | 106 | QPixmap* getPixmap(BitmapData item); |
107 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); | 107 | QPixmap* processEmbedded(const char *label, int h, int s, int v, bool blend=false); |
108 | private: | 108 | private: |
109 | +bool flatTBButtons; | 109 | +bool flatTBButtons; |
110 | bool highcolor; | 110 | bool highcolor; |
111 | QColorGroup radioOnGrp; | 111 | QColorGroup radioOnGrp; |
112 | QWidget *highlightWidget; | 112 | QWidget *highlightWidget; |
113 | --- -Sat Sep 21 05:31:48 2002 | 113 | --- -2002-10-24 03:19:31.000000000 +0200 |
114 | +++ liquid.cppSat Sep 21 05:18:54 2002 | 114 | +++ liquid.cpp2002-10-24 03:18:15.000000000 +0200 |
115 | @@ -10,12 +10,10 @@ | 115 | @@ -10,12 +10,10 @@ |
116 | 116 | ||
117 | #include <qmenudata.h> | 117 | #include <qmenudata.h> |
118 | #include "liquid.h" | 118 | #include "liquid.h" |
119 | -#include <kapp.h> | 119 | -#include <kapp.h> |
120 | -#include <kglobal.h> | 120 | -#include <kglobal.h> |
121 | -#include <kconfig.h> | 121 | -#include <kconfig.h> |
122 | -#include <kdrawutil.h> | 122 | -#include <kdrawutil.h> |
123 | -#include <kglobalsettings.h> | 123 | -#include <kglobalsettings.h> |
124 | -#include <kpixmapeffect.h> | 124 | -#include <kpixmapeffect.h> |
125 | +#include "liquiddeco.h" | 125 | +//#include "liquiddeco.h" |
126 | +#include <qapplication.h> | 126 | +#include <qapplication.h> |
127 | +#include <qpe/config.h> | 127 | +#include <qpe/config.h> |
128 | +#include "effects.h" | 128 | +#include "effects.h" |
129 | #include <qpalette.h> | 129 | #include <qpalette.h> |
130 | #include <qbitmap.h> | 130 | #include <qbitmap.h> |
131 | #include <qtabbar.h> | 131 | #include <qtabbar.h> |
132 | @@ -25,28 +23,29 @@ | 132 | @@ -25,28 +23,29 @@ |
133 | #include <qtimer.h> | 133 | #include <qtimer.h> |
134 | #include <qpixmapcache.h> | 134 | #include <qpixmapcache.h> |
135 | #include <qradiobutton.h> | 135 | #include <qradiobutton.h> |
136 | -#include <kimageeffect.h> | 136 | -#include <kimageeffect.h> |
137 | -#include <ktoolbar.h> | 137 | -#include <ktoolbar.h> |
138 | +#include <qcombobox.h> | 138 | +#include <qcombobox.h> |
139 | #include <qdrawutil.h> | 139 | #include <qdrawutil.h> |
140 | #include <qwidgetlist.h> | 140 | #include <qwidgetlist.h> |
141 | #include <qtoolbutton.h> | 141 | #include <qtoolbutton.h> |
142 | #include <qheader.h> | 142 | #include <qheader.h> |
143 | #include <unistd.h> | 143 | #include <unistd.h> |
144 | -#include <klocale.h> | 144 | -#include <klocale.h> |
145 | -#include <kiconloader.h> | 145 | -#include <kiconloader.h> |
146 | -#include <kmenubar.h> | 146 | -#include <kmenubar.h> |
147 | -#include <kipc.h> | 147 | -#include <kipc.h> |
148 | +#include <qmenubar.h> | 148 | +#include <qmenubar.h> |
149 | +#include <qprogressbar.h> | ||
149 | 150 | ||
150 | -#include <X11/X.h> | 151 | -#include <X11/X.h> |
151 | -#include <X11/Xlib.h> | 152 | -#include <X11/Xlib.h> |
152 | + | ||
153 | +#include <stdio.h> | 153 | +#include <stdio.h> |
154 | 154 | ||
155 | #include "htmlmasks.h" | 155 | #include "htmlmasks.h" |
156 | #include "embeddata.h" | 156 | #include "embeddata.h" |
157 | 157 | ||
158 | -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) | 158 | -void TransMenuHandler::stripePixmap(KPixmap &pix, const QColor &color) |
159 | +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, | 159 | +typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *, |
160 | + QColorGroup &, bool, bool); | 160 | + QColorGroup &, bool, bool); |
161 | + | 161 | + |
162 | +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); | 162 | +QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl); |
163 | + | 163 | + |
164 | +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) | 164 | +void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color) |
165 | { | 165 | { |
166 | QImage img(pix.convertToImage()); | 166 | QImage img(pix.convertToImage()); |
167 | - KImageEffect::fade(img, 0.9, color); | 167 | - KImageEffect::fade(img, 0.9, color); |
168 | + QImageEffect::fade(img, 0.9, color); | 168 | + QImageEffect::fade(img, 0.9, color); |
169 | int x, y; | 169 | int x, y; |
170 | int r, g, b; | 170 | int r, g, b; |
171 | for(y=0; y < img.height(); y+=3){ | 171 | for(y=0; y < img.height(); y+=3){ |
172 | @@ -71,35 +70,37 @@ | 172 | @@ -71,35 +70,37 @@ |
173 | : QObject(parent) | 173 | : QObject(parent) |
174 | { | 174 | { |
175 | pixDict.setAutoDelete(true); | 175 | pixDict.setAutoDelete(true); |
176 | - connect(kapp, SIGNAL(kipcMessage(int, int)), this, | 176 | - connect(kapp, SIGNAL(kipcMessage(int, int)), this, |
177 | - SLOT(slotKIPCMessage(int, int))); | 177 | - SLOT(slotKIPCMessage(int, int))); |
178 | reloadSettings(); | 178 | reloadSettings(); |
179 | } | 179 | } |
180 | 180 | ||
181 | void TransMenuHandler::reloadSettings() | 181 | void TransMenuHandler::reloadSettings() |
182 | { | 182 | { |
183 | pixDict.clear(); | 183 | pixDict.clear(); |
184 | - KConfig *config = KGlobal::config(); | 184 | - KConfig *config = KGlobal::config(); |
185 | - config->setGroup("MosfetMenus"); | 185 | - config->setGroup("MosfetMenus"); |
186 | 186 | ||
187 | - type = config->readNumEntry("Type", TransStippleBg); | 187 | - type = config->readNumEntry("Type", TransStippleBg); |
188 | - color = config->readColorEntry("Color", | 188 | - color = config->readColorEntry("Color", |
189 | - &QApplication::palette().active().button()); | 189 | - &QApplication::palette().active().button()); |
190 | - fgColor = config->readColorEntry("TextColor", | 190 | - fgColor = config->readColorEntry("TextColor", |
191 | - &QApplication::palette().active().text()); | 191 | - &QApplication::palette().active().text()); |
192 | - opacity = config->readNumEntry("Opacity", 10); | 192 | - opacity = config->readNumEntry("Opacity", 10); |
193 | - shadowText = config->readBoolEntry("ShadowText", true); | 193 | - shadowText = config->readBoolEntry("ShadowText", true); |
194 | + Config config ( "qpe" ); | 194 | + Config config ( "qpe" ); |
195 | + config. setGroup ( "Liquid-Style" ); | 195 | + config. setGroup ( "Liquid-Style" ); |
196 | + | 196 | + |
197 | + type = config. readNumEntry("Type", TransStippleBg); | 197 | + type = config. readNumEntry("Type", TransStippleBg); |
198 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); | 198 | + color = QColor ( config. readEntry("Color", QApplication::palette().active().button().name())); |
199 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); | 199 | + fgColor = QColor ( config. readEntry("TextColor", QApplication::palette().active().text().name())); |
200 | + opacity = config. readNumEntry("Opacity", 10); | 200 | + opacity = config. readNumEntry("Opacity", 10); |
201 | + if ( opacity < -20 ) | 201 | + if ( opacity < -20 ) |
202 | + opacity = 20; | 202 | + opacity = 20; |
203 | + else if ( opacity > 20 ) | 203 | + else if ( opacity > 20 ) |
204 | + opacity = 20; | 204 | + opacity = 20; |
205 | + | 205 | + |
206 | + shadowText = config. readBoolEntry("ShadowText", true); | 206 | + shadowText = config. readBoolEntry("ShadowText", true); |
207 | } | 207 | } |
208 | 208 | ||
209 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) | 209 | bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev) |
210 | { | 210 | { |
211 | - QPopupMenu *p = (QPopupMenu *)obj; | 211 | - QPopupMenu *p = (QPopupMenu *)obj; |
212 | + QWidget *p = (QWidget *)obj; | 212 | + QWidget *p = (QWidget *)obj; |
213 | 213 | ||
214 | if(ev->type() == QEvent::Show){ | 214 | if(ev->type() == QEvent::Show){ |
215 | if(type == TransStippleBg || type == TransStippleBtn || | 215 | if(type == TransStippleBg || type == TransStippleBtn || |
216 | type == Custom){ | 216 | type == Custom){ |
217 | QApplication::syncX(); | 217 | QApplication::syncX(); |
218 | - KPixmap *pix = new KPixmap; | 218 | - KPixmap *pix = new KPixmap; |
219 | + QPixmap *pix = new QPixmap; | 219 | + QPixmap *pix = new QPixmap; |
220 | if(p->testWFlags(Qt::WType_Popup)){ | 220 | if(p->testWFlags(Qt::WType_Popup)){ |
221 | QRect r(p->x(), p->y(), p->width(), p->height()); | 221 | QRect r(p->x(), p->y(), p->width(), p->height()); |
222 | QRect deskR = QApplication::desktop()->rect(); | 222 | QRect deskR = QApplication::desktop()->rect(); |
223 | @@ -107,7 +108,7 @@ | 223 | @@ -107,7 +108,7 @@ |
224 | r.setBottom(deskR.bottom()); | 224 | r.setBottom(deskR.bottom()); |
225 | r.setRight(deskR.right()); | 225 | r.setRight(deskR.right()); |
226 | } | 226 | } |
227 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), | 227 | - *pix = QPixmap::grabWindow(qt_xrootwin(), r.x(), r.y(), |
228 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), | 228 | + *pix = QPixmap::grabWindow(QApplication::desktop()-> winId(), r.x(), r.y(), |
229 | r.width(), r.height()); | 229 | r.width(), r.height()); |
230 | } | 230 | } |
231 | else{ // tear off menu | 231 | else{ // tear off menu |
232 | @@ -121,82 +122,55 @@ | 232 | @@ -121,82 +122,53 @@ |
233 | stripePixmap(*pix, p->colorGroup().button()); | 233 | stripePixmap(*pix, p->colorGroup().button()); |
234 | } | 234 | } |
235 | else{ | 235 | else{ |
236 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 236 | - KPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
237 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); | 237 | + QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color); |
238 | } | 238 | } |
239 | + | 239 | + |
240 | pixDict.insert(p->winId(), pix); | 240 | pixDict.insert(p->winId(), pix); |
241 | + | 241 | + |
242 | + if (!p->inherits("QPopupMenu")) { | 242 | + if ( !p->inherits("QPopupMenu")) |
243 | + p->setBackgroundPixmap(*pix); | 243 | + p->setBackgroundPixmap(*pix); |
244 | + | 244 | + |
245 | + QObjectList *ol = p-> queryList("QWidget"); | 245 | + QObjectList *ol = p-> queryList("QWidget"); |
246 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 246 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
247 | + QWidget *wid = (QWidget *) it.current ( ); | 247 | + QWidget *wid = (QWidget *) it.current ( ); |
248 | + | 248 | + |
249 | + wid-> setBackgroundPixmap(*pix); | 249 | + wid-> setBackgroundPixmap(*pix); |
250 | + wid-> setBackgroundOrigin(QWidget::ParentOrigin); | 250 | + wid-> setBackgroundOrigin(QWidget::ParentOrigin); |
251 | + } | 251 | + } |
252 | + delete ol; | 252 | + delete ol; |
253 | + } | ||
254 | } | 253 | } |
255 | } | 254 | } |
256 | else if(ev->type() == QEvent::Hide){ | 255 | else if(ev->type() == QEvent::Hide){ |
257 | if(type == TransStippleBg || type == TransStippleBtn || | 256 | if(type == TransStippleBg || type == TransStippleBtn || |
258 | type == Custom){ | 257 | type == Custom){ |
259 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 258 | - qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
260 | - pixDict.remove(p->winId()); | 259 | - pixDict.remove(p->winId()); |
261 | - } | 260 | - } |
262 | - } | 261 | - } |
263 | - return(false); | 262 | - return(false); |
264 | -} | 263 | -} |
265 | - | 264 | - |
266 | -void TransMenuHandler::slotKIPCMessage(int id, int) | 265 | -void TransMenuHandler::slotKIPCMessage(int id, int) |
267 | -{ | 266 | -{ |
268 | - if(id == LIQUID_MENU_CHANGE){ | 267 | - if(id == LIQUID_MENU_CHANGE){ |
269 | - bool oldShadow = shadowText; | 268 | - bool oldShadow = shadowText; |
270 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); | 269 | +// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width()); |
271 | 270 | ||
272 | - KConfig *config = KGlobal::config(); | 271 | - KConfig *config = KGlobal::config(); |
273 | - config->reparseConfiguration(); // in case KControl changed values | 272 | - config->reparseConfiguration(); // in case KControl changed values |
274 | - | 273 | - |
275 | - // Make sure no popupmenus are shown. There shouldn't be any because | 274 | - // Make sure no popupmenus are shown. There shouldn't be any because |
276 | - // the user just clicked "Apply", but there can be tear offs ;-) | 275 | - // the user just clicked "Apply", but there can be tear offs ;-) |
277 | - // We just close them so the pixmaps are deleted and regenerated. | 276 | - // We just close them so the pixmaps are deleted and regenerated. |
278 | - QWidgetList *list = QApplication::topLevelWidgets(); | 277 | - QWidgetList *list = QApplication::topLevelWidgets(); |
279 | - QWidgetListIt it( *list ); | 278 | - QWidgetListIt it( *list ); |
280 | - QWidget *w; | 279 | - QWidget *w; |
281 | - while ((w=it.current()) != 0 ){ | 280 | - while ((w=it.current()) != 0 ){ |
282 | - ++it; | 281 | - ++it; |
283 | - if(w->inherits("QPopupMenu")){ | 282 | - if(w->inherits("QPopupMenu")){ |
284 | - w->close(); | 283 | - w->close(); |
285 | - } | 284 | - } |
286 | - } | 285 | - } |
287 | + pixDict.remove(p->winId()); | 286 | + pixDict.remove(p->winId()); |
288 | + if (!p->inherits("QPopupMenu")) { | 287 | + if ( !p->inherits("QPopupMenu")) |
289 | + p->setBackgroundMode(QWidget::PaletteBackground); | 288 | + p->setBackgroundMode(QWidget::PaletteBackground); |
290 | 289 | ||
291 | - reloadSettings(); | 290 | - reloadSettings(); |
292 | + QObjectList *ol = p-> queryList("QWidget"); | 291 | + QObjectList *ol = p-> queryList("QWidget"); |
293 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { | 292 | + for ( QObjectListIt it( *ol ); it. current ( ); ++it ) { |
294 | + QWidget *wid = (QWidget *) it.current ( ); | 293 | + QWidget *wid = (QWidget *) it.current ( ); |
295 | 294 | ||
296 | - // Now repaint menubar if needed | 295 | - // Now repaint menubar if needed |
297 | - if(shadowText != oldShadow){ | 296 | - if(shadowText != oldShadow){ |
298 | - it.toFirst(); | 297 | - it.toFirst(); |
299 | - while ((w=it.current()) != 0 ){ | 298 | - while ((w=it.current()) != 0 ){ |
300 | - ++it; | 299 | - ++it; |
301 | - if(w->inherits("QMenuBar")){ | 300 | - if(w->inherits("QMenuBar")){ |
302 | - w->repaint(); | 301 | - w->repaint(); |
303 | - } | 302 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); |
304 | - } | 303 | } |
305 | + wid-> setBackgroundMode( QWidget::PaletteBackground ); | 304 | + delete ol; |
305 | } | ||
306 | } | 306 | } |
307 | - } | 307 | - } |
308 | - else if(id == MOSFET_BUTTON_CHANGE){ | 308 | - else if(id == MOSFET_BUTTON_CHANGE){ |
309 | - qWarning("In mosfet button change"); | 309 | - qWarning("In mosfet button change"); |
310 | - // really, this should be in LiquidStyle, but what the hell? ;-) | 310 | - // really, this should be in LiquidStyle, but what the hell? ;-) |
311 | - QWidgetList *list = QApplication::allWidgets(); | 311 | - QWidgetList *list = QApplication::allWidgets(); |
312 | - QWidgetListIt it( *list ); | 312 | - QWidgetListIt it( *list ); |
313 | - QWidget *w; | 313 | - QWidget *w; |
314 | - while ((w=it.current()) != 0 ){ | 314 | - while ((w=it.current()) != 0 ){ |
315 | - ++it; | 315 | - ++it; |
316 | - if(w->inherits("QPushButton")){ | 316 | - if(w->inherits("QPushButton")){ |
317 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); | 317 | - ((LiquidStyle*)parent())->unapplyCustomAttributes((QPushButton *)w); |
318 | - } | 318 | - } |
319 | - } | 319 | - } |
320 | - ((LiquidStyle*)parent())->loadCustomButtons(); | 320 | - ((LiquidStyle*)parent())->loadCustomButtons(); |
321 | - it.toFirst(); | 321 | - it.toFirst(); |
322 | - while ((w=it.current()) != 0 ){ | 322 | - while ((w=it.current()) != 0 ){ |
323 | - ++it; | 323 | - ++it; |
324 | - if(w->inherits("QPushButton")){ | 324 | - if(w->inherits("QPushButton")){ |
325 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); | 325 | - ((LiquidStyle*)parent())->applyCustomAttributes((QPushButton *)w); |
326 | + delete ol; | 326 | - } |
327 | } | 327 | - } |
328 | } | ||
329 | - | 328 | - |
330 | } | 329 | - } |
331 | + return(false); | 330 | + return(false); |
332 | } | 331 | } |
333 | 332 | ||
334 | + | 333 | + |
335 | LiquidStyle::LiquidStyle() | 334 | LiquidStyle::LiquidStyle() |
336 | - :KStyle() | 335 | - :KStyle() |
337 | + :QWindowsStyle() | 336 | + :QWindowsStyle() |
338 | { | 337 | { |
339 | + setName ( "LiquidStyle" ); | 338 | + setName ( "LiquidStyle" ); |
340 | + | 339 | + |
341 | +flatTBButtons = false; | 340 | +flatTBButtons = false; |
342 | + | 341 | + |
343 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); | 342 | btnMaskBmp = QBitmap(37, 26, buttonmask_bits, true); |
344 | btnMaskBmp.setMask(btnMaskBmp); | 343 | btnMaskBmp.setMask(btnMaskBmp); |
345 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); | 344 | htmlBtnMaskBmp = QBitmap(37, 26, htmlbuttonmask_bits, true); |
346 | @@ -711,7 +685,6 @@ | 345 | @@ -711,7 +683,6 @@ |
347 | 346 | ||
348 | void LiquidStyle::polish(QPalette &appPal) | 347 | void LiquidStyle::polish(QPalette &appPal) |
349 | { | 348 | { |
350 | - | 349 | - |
351 | int i; | 350 | int i; |
352 | for(i=0; i < BITMAP_ITEMS; ++i){ | 351 | for(i=0; i < BITMAP_ITEMS; ++i){ |
353 | if(pixmaps[i]){ | 352 | if(pixmaps[i]){ |
354 | @@ -730,20 +703,29 @@ | 353 | @@ -730,20 +701,29 @@ |
355 | } | 354 | } |
356 | 355 | ||
357 | loadCustomButtons(); | 356 | loadCustomButtons(); |
358 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; | 357 | - lowLightVal = 100 + (2*KGlobalSettings::contrast()+4)*10; |
359 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; | 358 | + lowLightVal = 100 + (2* /*KGlobalSettings::contrast()*/ 3 +4)*10; |
360 | btnDict.clear(); | 359 | btnDict.clear(); |
361 | btnBorderDict.clear(); | 360 | btnBorderDict.clear(); |
362 | bevelFillDict.clear(); | 361 | bevelFillDict.clear(); |
363 | smallBevelFillDict.clear(); | 362 | smallBevelFillDict.clear(); |
364 | 363 | ||
365 | - KConfig *config = KGlobal::config(); | 364 | - KConfig *config = KGlobal::config(); |
366 | - QString oldGrp = config->group(); | 365 | - QString oldGrp = config->group(); |
367 | - QPalette pal = QApplication::palette(); | 366 | - QPalette pal = QApplication::palette(); |
368 | + Config config ( "qpe" ); | 367 | + Config config ( "qpe" ); |
369 | + config. setGroup ( "Liquid-Style" ); | 368 | + config. setGroup ( "Liquid-Style" ); |
370 | +int contrast = config. readNumEntry ( "StippleContrast", 5 ); | 369 | +int contrast = config. readNumEntry ( "StippleContrast", 5 ); |
371 | +if ( contrast < 0 ) | 370 | +if ( contrast < 0 ) |
372 | + contrast = 0; | 371 | + contrast = 0; |
373 | +else if ( contrast > 10 ) | 372 | +else if ( contrast > 10 ) |
374 | + contrast = 10; | 373 | + contrast = 10; |
375 | + | 374 | + |
376 | +// QPalette pal = QApplication::palette(); | 375 | +// QPalette pal = QApplication::palette(); |
377 | 376 | ||
378 | // button color stuff | 377 | // button color stuff |
379 | - config->setGroup("General"); | 378 | - config->setGroup("General"); |
380 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); | 379 | - QColor c = config->readColorEntry("buttonBackground", &Qt::lightGray); |
381 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ | 380 | - if(c == config->readColorEntry("background", &Qt::lightGray)){ |
382 | + config. setGroup ( "Appearance" ); | 381 | + config. setGroup ( "Appearance" ); |
383 | + QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); | 382 | + QColor c = // QColor ( config. readEntry("Button", ( Qt::lightGray ). name ( ))); |
384 | + appPal. color ( QPalette::Active, QColorGroup::Button ); | 383 | + appPal. color ( QPalette::Active, QColorGroup::Button ); |
385 | + if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) | 384 | + if ( c == appPal. color ( QPalette::Active, QColorGroup::Background ) |
386 | + //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) | 385 | + //QColor ( config. readEntry ( "background", ( Qt::lightGray ). name ( ))) |
387 | + ) { | 386 | + ) { |
388 | // force button color to be different from background | 387 | // force button color to be different from background |
389 | QBrush btnBrush(QColor(200, 202, 228)); | 388 | QBrush btnBrush(QColor(200, 202, 228)); |
390 | appPal.setBrush(QColorGroup::Button, btnBrush); | 389 | appPal.setBrush(QColorGroup::Button, btnBrush); |
391 | @@ -794,15 +776,7 @@ | 390 | @@ -794,15 +774,7 @@ |
392 | pagerBrush.setPixmap(*pix); | 391 | pagerBrush.setPixmap(*pix); |
393 | 392 | ||
394 | // background color stuff | 393 | // background color stuff |
395 | - c = config->readColorEntry("background", &Qt::lightGray); | 394 | - c = config->readColorEntry("background", &Qt::lightGray); |
396 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ | 395 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0){ |
397 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); | 396 | - appPal.setColor(QColorGroup::Mid, menuBrush.color().dark(110)); |
398 | - appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); | 397 | - appPal.setColor(QColorGroup::Dark, menuBrush.color().dark(130)); |
399 | - appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); | 398 | - appPal.setColor(QColorGroup::Midlight, menuBrush.color().light(110)); |
400 | - appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); | 399 | - appPal.setColor(QColorGroup::Light, menuBrush.color().light(115)); |
401 | - menuBrush.setColor(c); // hack - used for kicker applets | 400 | - menuBrush.setColor(c); // hack - used for kicker applets |
402 | - appPal.setBrush(QColorGroup::Background, menuBrush); | 401 | - appPal.setBrush(QColorGroup::Background, menuBrush); |
403 | - } | 402 | - } |
404 | + c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); | 403 | + c = /*QColor ( config. readEntry ( "Background", ( Qt::lightGray ).name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Background ); |
405 | c.hsv(&bH, &bS, &bV); | 404 | c.hsv(&bH, &bS, &bV); |
406 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); | 405 | c.light(120).hsv(&bHoverH, &bHoverS, &bHoverV); |
407 | 406 | ||
408 | @@ -817,21 +791,18 @@ | 407 | @@ -817,21 +789,18 @@ |
409 | wallPaper.fill(c.rgb()); | 408 | wallPaper.fill(c.rgb()); |
410 | painter.begin(&wallPaper); | 409 | painter.begin(&wallPaper); |
411 | for(i=0; i < 32; i+=4){ | 410 | for(i=0; i < 32; i+=4){ |
412 | - painter.setPen(c.dark(105)); | 411 | - painter.setPen(c.dark(105)); |
413 | + painter.setPen(c.dark(100 + contrast)); | 412 | + painter.setPen(c.dark(100 + contrast)); |
414 | painter.drawLine(0, i, 32, i); | 413 | painter.drawLine(0, i, 32, i); |
415 | - painter.setPen(c.dark(103)); | 414 | - painter.setPen(c.dark(103)); |
416 | + painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); | 415 | + painter.setPen(c.dark(100 + 3 * contrast / 5 ) ); |
417 | painter.drawLine(0, i+1, 32, i+1); | 416 | painter.drawLine(0, i+1, 32, i+1); |
418 | }; | 417 | }; |
419 | painter.end(); | 418 | painter.end(); |
420 | bgBrush.setColor(c); | 419 | bgBrush.setColor(c); |
421 | bgBrush.setPixmap(wallPaper); | 420 | bgBrush.setPixmap(wallPaper); |
422 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && | 421 | - if(qstrcmp(kapp->argv()[0], "kicker") != 0 && |
423 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ | 422 | - qstrcmp(kapp->argv()[0], "ksplash") != 0){ |
424 | appPal.setBrush(QColorGroup::Background, bgBrush); | 423 | appPal.setBrush(QColorGroup::Background, bgBrush); |
425 | - } | 424 | - } |
426 | 425 | ||
427 | // lineedits | 426 | // lineedits |
428 | - c = config->readColorEntry("windowBackground", &Qt::white); | 427 | - c = config->readColorEntry("windowBackground", &Qt::white); |
429 | + c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); | 428 | + c = /*QColor ( config. readEntry("Base", ( Qt::white). name ( )));*/ appPal. color ( QPalette::Active, QColorGroup::Base ); |
430 | QPixmap basePix; | 429 | QPixmap basePix; |
431 | basePix.resize(32, 32); | 430 | basePix.resize(32, 32); |
432 | basePix.fill(c.rgb()); | 431 | basePix.fill(c.rgb()); |
433 | @@ -856,52 +827,39 @@ | 432 | @@ -856,52 +825,37 @@ |
434 | applyCustomAttributes((QPushButton *)w); | 433 | applyCustomAttributes((QPushButton *)w); |
435 | } | 434 | } |
436 | } | 435 | } |
437 | - | 436 | - |
438 | - config->setGroup(oldGrp); | 437 | - config->setGroup(oldGrp); |
439 | } | 438 | } |
440 | 439 | ||
441 | void LiquidStyle::polish(QWidget *w) | 440 | void LiquidStyle::polish(QWidget *w) |
442 | { | 441 | { |
443 | if(w->inherits("QMenuBar")){ | 442 | if(w->inherits("QMenuBar")){ |
444 | - ((QFrame*)w)->setLineWidth(0); | 443 | - ((QFrame*)w)->setLineWidth(0); |
445 | - w->setBackgroundMode(QWidget::NoBackground); | 444 | - w->setBackgroundMode(QWidget::NoBackground); |
446 | + //((QFrame*)w)->setLineWidth(0); | 445 | + //((QFrame*)w)->setLineWidth(0); |
447 | + w->setBackgroundMode(QWidget::PaletteBackground); | 446 | + w->setBackgroundMode(QWidget::PaletteBackground); |
448 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | 447 | + w->setBackgroundOrigin(QWidget::ParentOrigin); |
449 | + return; | 448 | + return; |
450 | + } | 449 | + } |
451 | + if(w->inherits("QToolBar")){ | 450 | + if(w->inherits("QToolBar")){ |
452 | + w->installEventFilter(this); | 451 | + w->installEventFilter(this); |
453 | + w->setBackgroundMode(QWidget::PaletteBackground); | 452 | + w->setBackgroundMode(QWidget::PaletteBackground); |
454 | + w->setBackgroundOrigin(QWidget::WidgetOrigin); | 453 | + w->setBackgroundOrigin(QWidget::WidgetOrigin); |
455 | return; | 454 | return; |
456 | } | 455 | } |
457 | if(w->inherits("QPopupMenu")) | 456 | if(w->inherits("QPopupMenu")) |
458 | w->setBackgroundMode(QWidget::NoBackground); | 457 | w->setBackgroundMode(QWidget::NoBackground); |
459 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 458 | + else if(w-> testWFlags(Qt::WType_Popup) && |
459 | + !w->inherits("QListBox") && | ||
460 | + ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { | ||
460 | + w->installEventFilter(menuHandler); | 461 | + w->installEventFilter(menuHandler); |
461 | + } | 462 | + } |
462 | 463 | ||
463 | if(w->isTopLevel()){ | 464 | if(w->isTopLevel()){ |
464 | - if(!w->inherits("QPopupMenu") && | 465 | - if(!w->inherits("QPopupMenu") && |
465 | - qstrcmp(kapp->argv()[0], "kicker") == 0){ | 466 | - qstrcmp(kapp->argv()[0], "kicker") == 0){ |
466 | - qWarning("Got panel toplevel %s", w->className()); | 467 | - qWarning("Got panel toplevel %s", w->className()); |
467 | - // force extensions and child panels to use proper palette. | 468 | - // force extensions and child panels to use proper palette. |
468 | - if(w->inherits("Panel")){ | 469 | - if(w->inherits("Panel")){ |
469 | - qWarning("Setting panel palette"); | 470 | - qWarning("Setting panel palette"); |
470 | - w->setPalette(kapp->palette()); | 471 | - w->setPalette(kapp->palette()); |
471 | - } | 472 | - } |
472 | - else{ | 473 | - else{ |
473 | - // reset palette for everything else | 474 | - // reset palette for everything else |
474 | - QPalette pal = kapp->palette(); | 475 | - QPalette pal = kapp->palette(); |
475 | - pal.setBrush(QColorGroup::Background, bgBrush); | 476 | - pal.setBrush(QColorGroup::Background, bgBrush); |
476 | - pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); | 477 | - pal.setColor(QColorGroup::Mid, bgBrush.color().dark(130)); |
477 | - pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); | 478 | - pal.setColor(QColorGroup::Dark, bgBrush.color().dark(150)); |
478 | - pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); | 479 | - pal.setColor(QColorGroup::Midlight, bgBrush.color().light(110)); |
479 | - pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); | 480 | - pal.setColor(QColorGroup::Light, bgBrush.color().light(120)); |
480 | - w->setPalette(pal); | 481 | - w->setPalette(pal); |
481 | - } | 482 | - } |
482 | - } | 483 | - } |
483 | return; | 484 | return; |
484 | } | 485 | } |
485 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && | 486 | - if(qstrcmp(kapp->argv()[0], "kicker") == 0 && |
486 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work | 487 | - w->inherits("KPanelExtension")){ // FIXME - doesn't work |
487 | - w->setPalette(kapp->palette()); | 488 | - w->setPalette(kapp->palette()); |
488 | - } | 489 | - } |
489 | + | ||
490 | + | ||
491 | + if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | ||
492 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
493 | 490 | ||
494 | if(w->inherits("QComboBox") || | 491 | - if(w->inherits("QComboBox") || |
492 | + if(w->inherits("QComboBox") || w->inherits("QProgressBar") || | ||
495 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 493 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
496 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 494 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
497 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 495 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
498 | - w->inherits("TaskContainer")){ | 496 | - w->inherits("TaskContainer")){ |
499 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 497 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
500 | w->installEventFilter(this); | 498 | w->installEventFilter(this); |
501 | } | 499 | } |
502 | if(w->inherits("QLineEdit")){ | 500 | if(w->inherits("QLineEdit")){ |
503 | @@ -913,6 +871,9 @@ | 501 | @@ -913,6 +867,10 @@ |
504 | applyCustomAttributes((QPushButton *)w); | 502 | applyCustomAttributes((QPushButton *)w); |
505 | w->installEventFilter(this); | 503 | w->installEventFilter(this); |
506 | } | 504 | } |
507 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 505 | + if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
508 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); | 506 | + w-> setBackgroundMode ( QWidget::PaletteBackground ); |
507 | + w->setBackgroundOrigin ( QWidget::ParentOrigin); | ||
509 | + } | 508 | + } |
510 | 509 | ||
511 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 510 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
512 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 511 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
513 | @@ -942,11 +903,14 @@ | 512 | @@ -942,11 +900,17 @@ |
514 | w->setMouseTracking(true); | 513 | w->setMouseTracking(true); |
515 | w->installEventFilter(this); | 514 | w->installEventFilter(this); |
516 | } | 515 | } |
517 | + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 516 | + if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
518 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 517 | + ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
519 | + if ( flatTBButtons ) | 518 | + if ( flatTBButtons ) |
520 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | 519 | + w->setBackgroundOrigin(QWidget::ParentOrigin); |
521 | + } | 520 | + } |
521 | + if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { | ||
522 | + ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); | ||
523 | + } | ||
522 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 524 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
523 | return; | 525 | return; |
524 | } | 526 | } |
525 | - if(w->inherits("PanelButtonBase")) | 527 | - if(w->inherits("PanelButtonBase")) |
526 | - return; | 528 | - return; |
527 | 529 | ||
528 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 530 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
529 | palette().active().brush(QColorGroup::Background).pixmap()){ | 531 | palette().active().brush(QColorGroup::Background).pixmap()){ |
530 | @@ -954,17 +918,13 @@ | 532 | @@ -954,16 +918,21 @@ |
531 | return; | 533 | return; |
532 | } | 534 | } |
533 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 535 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
534 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ | 536 | - !w->inherits("KDesktop") && !w->inherits("PasswordDlg")){ |
535 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 537 | + !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
536 | if(w->backgroundMode() == QWidget::PaletteBackground || | 538 | if(w->backgroundMode() == QWidget::PaletteBackground || |
537 | w->backgroundMode() == QWidget::PaletteButton){ | 539 | w->backgroundMode() == QWidget::PaletteButton){ |
538 | w->setBackgroundMode(QWidget::X11ParentRelative); | 540 | - w->setBackgroundMode(QWidget::X11ParentRelative); |
541 | + w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); | ||
542 | + w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
543 | +// w->setBackgroundMode(QWidget::NoBackground); | ||
539 | } | 544 | } |
540 | } | 545 | } |
541 | - if(w->inherits("KToolBar")){ | 546 | - if(w->inherits("KToolBar")){ |
542 | - w->installEventFilter(this); | 547 | - w->installEventFilter(this); |
543 | - //w->setBackgroundMode(QWidget::NoBackground); | 548 | - //w->setBackgroundMode(QWidget::NoBackground); |
544 | - return; | 549 | - return; |
545 | - } | 550 | + if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) |
551 | + w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
552 | +else if ( w-> inherits("QFrame") ) | ||
553 | + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | ||
546 | + | 554 | + |
555 | +if ( w->parentWidget()->inherits ( "QWidgetStack" )) { | ||
556 | + w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | ||
557 | } | ||
547 | } | 558 | } |
548 | 559 | ||
549 | void LiquidStyle::unPolish(QWidget *w) | 560 | @@ -977,6 +946,11 @@ |
550 | @@ -977,6 +937,9 @@ | ||
551 | 561 | ||
552 | if(w->inherits("QPopupMenu")) | 562 | if(w->inherits("QPopupMenu")) |
553 | w->setBackgroundMode(QWidget::PaletteButton); | 563 | w->setBackgroundMode(QWidget::PaletteButton); |
554 | + else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 564 | + else if(w-> testWFlags(Qt::WType_Popup) && |
565 | + !w->inherits("QListBox") && | ||
566 | + ( qstrcmp ( w-> name(), "automatic what's this? widget" ) != 0 )) { | ||
555 | + w->removeEventFilter(menuHandler); | 567 | + w->removeEventFilter(menuHandler); |
556 | + } | 568 | + } |
557 | 569 | ||
558 | if(w->isTopLevel()) | 570 | if(w->isTopLevel()) |
559 | return; | 571 | return; |
560 | @@ -986,7 +949,7 @@ | 572 | @@ -986,7 +960,7 @@ |
561 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 573 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
562 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 574 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
563 | 575 | ||
564 | - w->setPalette(QApplication::palette()); | 576 | - w->setPalette(QApplication::palette()); |
565 | + w->unsetPalette(); | 577 | + w->unsetPalette(); |
566 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 578 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
567 | if(w->inherits("QPushButton")) | 579 | if(w->inherits("QPushButton")) |
568 | w->setBackgroundMode(QWidget::PaletteButton); | 580 | w->setBackgroundMode(QWidget::PaletteButton); |
569 | @@ -1001,12 +964,14 @@ | 581 | @@ -1001,12 +975,14 @@ |
570 | unapplyCustomAttributes((QPushButton *)w); | 582 | unapplyCustomAttributes((QPushButton *)w); |
571 | w->removeEventFilter(this); | 583 | w->removeEventFilter(this); |
572 | } | 584 | } |
573 | - | 585 | - |
574 | +/* | 586 | +/* |
575 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 587 | + if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
576 | + w-> setBackgroundMode ( PaletteBackground ); | 588 | + w-> setBackgroundMode ( PaletteBackground ); |
577 | + } | 589 | + } |
578 | +*/ | 590 | +*/ |
579 | if(w->inherits("QComboBox") || | 591 | if(w->inherits("QComboBox") || |
580 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 592 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
581 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || | 593 | - w->inherits("QCheckBox") || w->inherits("QScrollBar") || |
582 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || | 594 | - w->isA("AppletHandle") || w->inherits("KMiniPagerButton") || |
583 | - w->inherits("TaskContainer")){ | 595 | - w->inherits("TaskContainer")){ |
584 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 596 | + w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
585 | w->removeEventFilter(this); | 597 | w->removeEventFilter(this); |
586 | } | 598 | } |
587 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 599 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
588 | @@ -1014,9 +979,9 @@ | 600 | @@ -1014,9 +990,9 @@ |
589 | w->setAutoMask(false); | 601 | w->setAutoMask(false); |
590 | } | 602 | } |
591 | } | 603 | } |
592 | - if(w->inherits("KToolBar")){ | 604 | - if(w->inherits("KToolBar")){ |
593 | + if(w->inherits("QToolBar")){ | 605 | + if(w->inherits("QToolBar")){ |
594 | w->removeEventFilter(this); | 606 | w->removeEventFilter(this); |
595 | - //w->setBackgroundMode(QWidget::PaletteBackground); | 607 | - //w->setBackgroundMode(QWidget::PaletteBackground); |
596 | + w->setBackgroundMode(QWidget::PaletteBackground); | 608 | + w->setBackgroundMode(QWidget::PaletteBackground); |
597 | return; | 609 | return; |
598 | } | 610 | } |
599 | if(w->inherits("QHeader")){ | 611 | if(w->inherits("QHeader")){ |
600 | @@ -1028,20 +993,34 @@ | 612 | @@ -1028,22 +1004,98 @@ |
601 | void LiquidStyle::polish(QApplication *app) | 613 | void LiquidStyle::polish(QApplication *app) |
602 | { | 614 | { |
603 | 615 | ||
604 | - KStyle::polish(app); | 616 | - KStyle::polish(app); |
605 | + QWindowsStyle::polish(app); | 617 | + QWindowsStyle::polish(app); |
606 | menuAni = app->isEffectEnabled(UI_AnimateMenu); | 618 | menuAni = app->isEffectEnabled(UI_AnimateMenu); |
607 | menuFade = app->isEffectEnabled(UI_FadeMenu); | 619 | menuFade = app->isEffectEnabled(UI_FadeMenu); |
608 | if(menuAni) | 620 | if(menuAni) |
609 | app->setEffectEnabled(UI_AnimateMenu, false); | 621 | app->setEffectEnabled(UI_AnimateMenu, false); |
610 | if(menuFade) | 622 | if(menuFade) |
611 | app->setEffectEnabled(UI_FadeMenu, false); | 623 | app->setEffectEnabled(UI_FadeMenu, false); |
612 | + | 624 | + |
613 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); | 625 | + qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); |
614 | + | 626 | + |
615 | + Config config ( "qpe" ); | 627 | + Config config ( "qpe" ); |
616 | + config. setGroup ( "Liquid-Style" ); | 628 | + config. setGroup ( "Liquid-Style" ); |
617 | + | 629 | + |
618 | +// if ( config. readBoolEntry ( "WinDecoration", true )) | 630 | +// if ( config. readBoolEntry ( "WinDecoration", true )) |
619 | +// QApplication::qwsSetDecoration ( new LiquidDecoration ( )); | 631 | +// QApplication::qwsSetDecoration ( new LiquidDecoration ( )); |
620 | + | 632 | + |
621 | +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); | 633 | +flatTBButtons = config. readBoolEntry ( "FlatToolButtons", false ); |
622 | } | 634 | } |
623 | 635 | ||
624 | void LiquidStyle::unPolish(QApplication *app) | 636 | void LiquidStyle::unPolish(QApplication *app) |
625 | { | 637 | { |
626 | - KStyle::unPolish(app); | 638 | - KStyle::unPolish(app); |
627 | + QWindowsStyle::unPolish(app); | 639 | + QWindowsStyle::unPolish(app); |
628 | app->setEffectEnabled(UI_AnimateMenu, menuAni); | 640 | app->setEffectEnabled(UI_AnimateMenu, menuAni); |
629 | app->setEffectEnabled(UI_FadeMenu, menuFade); | 641 | app->setEffectEnabled(UI_FadeMenu, menuFade); |
630 | + | 642 | + |
631 | + qt_set_draw_menu_bar_impl ( 0 ); | 643 | + qt_set_draw_menu_bar_impl ( 0 ); |
632 | + | 644 | + |
633 | +// QApplication::qwsSetDecoration ( new QPEDecoration ( )); | 645 | +// QApplication::qwsSetDecoration ( new QPEDecoration ( )); |
634 | } | 646 | } |
635 | 647 | ||
648 | + | ||
649 | +/* !! HACK !! Beware | ||
650 | + * | ||
651 | + * TT forgot to make the QProgressBar widget styleable in Qt 2.x | ||
652 | + * So the only way to customize the drawing, is to intercept the | ||
653 | + * paint event - since we have to use protected functions, we need | ||
654 | + * to derive a "hack" class from QProgressBar and do the painting | ||
655 | + * in there. | ||
656 | + * | ||
657 | + * - sandman | ||
658 | + */ | ||
659 | + | ||
660 | +class HackProgressBar : public QProgressBar { | ||
661 | +public: | ||
662 | +HackProgressBar ( ); | ||
663 | + | ||
664 | +void paint ( QPaintEvent *event, const QColorGroup &g, QPixmap *pix ) | ||
665 | +{ | ||
666 | + QPainter p( this ); | ||
667 | + | ||
668 | + if ( !contentsRect().contains( event->rect() ) ) { | ||
669 | + p.save(); | ||
670 | + p.setClipRegion( event->region().intersect(frameRect()) ); | ||
671 | + drawFrame( &p); | ||
672 | + p.restore(); | ||
673 | + } | ||
674 | + if ( event->rect().intersects( contentsRect() )) { | ||
675 | + p.setClipRegion( event->region().intersect( contentsRect() ) ); | ||
676 | + | ||
677 | + int x, y, w, h; | ||
678 | + contentsRect ( ). rect ( &x, &y, &w, &h ); | ||
679 | + | ||
680 | + int prog = progress ( ); | ||
681 | + int total = totalSteps ( ); | ||
682 | + if ( prog < 0 ) | ||
683 | + prog = 0; | ||
684 | + if ( total <= 0 ) | ||
685 | + total = 1; | ||
686 | + int bw = w * prog / total; | ||
687 | + if ( bw > w ) | ||
688 | + bw = w; | ||
689 | + | ||
690 | + p.setPen(g.button().dark(130)); | ||
691 | + p.drawRect(x, y, bw, h); | ||
692 | + p.setPen(g.button().light(120)); | ||
693 | + p.drawRect(x+1, y+1, bw-2, h-2); | ||
694 | + | ||
695 | + if(bw >= 4 && h >= 4 && pix) | ||
696 | + p.drawTiledPixmap(x+2, y+2, bw-4, h-4, *pix); | ||
697 | + | ||
698 | + if ( progress ( )>= 0 && totalSteps ( ) > 0 ) { | ||
699 | + QString pstr; | ||
700 | + pstr. sprintf ( "%d%%", 100 * progress()/totalSteps ()); | ||
701 | + p. setPen ( g.text());//g.highlightedText ( )); | ||
702 | + p. drawText (x,y,w-1,h-1,AlignCenter,pstr); | ||
703 | + } | ||
704 | + } | ||
705 | +} | ||
706 | +}; | ||
707 | + | ||
708 | + | ||
709 | + | ||
636 | /* | 710 | /* |
637 | @@ -1063,7 +1042,7 @@ | 711 | * This is a fun method ;-) Here's an overview. KToolBar grabs resize to |
712 | * force everything to erase and repaint on resize. This is going away, I'm | ||
713 | @@ -1063,7 +1115,7 @@ | ||
638 | */ | 714 | */ |
639 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) | 715 | bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) |
640 | { | 716 | { |
641 | - if(obj->inherits("KToolBar")){ | 717 | - if(obj->inherits("KToolBar")){ |
642 | + if(obj->inherits("QToolBar")){ | 718 | + if(obj->inherits("QToolBar")){ |
643 | if(ev->type() == QEvent::Resize){ | 719 | if(ev->type() == QEvent::Resize){ |
644 | const QObjectList *tbChildList = obj->children(); | 720 | const QObjectList *tbChildList = obj->children(); |
645 | QObjectListIt it(*tbChildList); | 721 | QObjectListIt it(*tbChildList); |
646 | @@ -1076,35 +1055,7 @@ | 722 | @@ -1076,35 +1128,7 @@ |
647 | 723 | ||
648 | } | 724 | } |
649 | } | 725 | } |
650 | - else if(obj->inherits("KMiniPagerButton")){ | 726 | - else if(obj->inherits("KMiniPagerButton")){ |
651 | - QButton *btn = (QButton *)obj; | 727 | - QButton *btn = (QButton *)obj; |
652 | - if(ev->type() == QEvent::Paint){ | 728 | - if(ev->type() == QEvent::Paint){ |
653 | - if(!(btn->isOn() || btn->isDown())){ | 729 | - if(!(btn->isOn() || btn->isDown())){ |
654 | - QPalette pal = btn->palette(); | 730 | - QPalette pal = btn->palette(); |
655 | - pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? | 731 | - pal.setBrush(QColorGroup::Dark, btn == highlightWidget ? |
656 | - pagerHoverBrush : pagerBrush); | 732 | - pagerHoverBrush : pagerBrush); |
657 | - btn->setPalette(pal); | 733 | - btn->setPalette(pal); |
658 | - } | 734 | - } |
659 | - else{ | 735 | - else{ |
660 | - QPalette pal = btn->palette(); | 736 | - QPalette pal = btn->palette(); |
661 | - pal.setBrush(QColorGroup::Dark, | 737 | - pal.setBrush(QColorGroup::Dark, |
662 | - QApplication::palette().active().brush(QColorGroup::Dark)); | 738 | - QApplication::palette().active().brush(QColorGroup::Dark)); |
663 | - btn->setPalette(pal); | 739 | - btn->setPalette(pal); |
664 | - | 740 | - |
665 | - } | 741 | - } |
666 | - } | 742 | - } |
667 | - else if(ev->type() == QEvent::Enter){ | 743 | - else if(ev->type() == QEvent::Enter){ |
668 | - highlightWidget = btn; | 744 | - highlightWidget = btn; |
669 | - btn->repaint(false); | 745 | - btn->repaint(false); |
670 | - } | 746 | - } |
671 | - else if(ev->type() == QEvent::Leave){ | 747 | - else if(ev->type() == QEvent::Leave){ |
672 | - highlightWidget = NULL; | 748 | - highlightWidget = NULL; |
673 | - btn->repaint(false); | 749 | - btn->repaint(false); |
674 | - } | 750 | - } |
675 | - | 751 | - |
676 | - } | 752 | - } |
677 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || | 753 | - else if(obj->inherits("QPushButton") || obj->inherits("QComboBox") || |
678 | - obj->isA("AppletHandle")){ | 754 | - obj->isA("AppletHandle")){ |
679 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ | 755 | + else if(obj->inherits("QPushButton") || obj->inherits("QComboBox")){ |
680 | QWidget *btn = (QWidget *)obj; | 756 | QWidget *btn = (QWidget *)obj; |
681 | if(ev->type() == QEvent::Enter){ | 757 | if(ev->type() == QEvent::Enter){ |
682 | if(btn->isEnabled()){ | 758 | if(btn->isEnabled()){ |
683 | @@ -1119,20 +1070,7 @@ | 759 | @@ -1119,20 +1143,7 @@ |
684 | } | 760 | } |
685 | } | 761 | } |
686 | } | 762 | } |
687 | - else if(obj->inherits("TaskContainer")){ | 763 | - else if(obj->inherits("TaskContainer")){ |
688 | - QButton *btn = (QButton *)obj; | 764 | - QButton *btn = (QButton *)obj; |
689 | - QPalette pal = btn->palette(); | 765 | - QPalette pal = btn->palette(); |
690 | - if(ev->type() == QEvent::Enter){ | 766 | - if(ev->type() == QEvent::Enter){ |
691 | - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); | 767 | - pal.setColor(QColorGroup::Background, pal.active().button().light(110)); |
692 | - btn->setPalette(pal); | 768 | - btn->setPalette(pal); |
693 | - } | 769 | - } |
694 | - else if(ev->type() == QEvent::Leave){ | 770 | - else if(ev->type() == QEvent::Leave){ |
695 | - pal.setColor(QColorGroup::Background, | 771 | - pal.setColor(QColorGroup::Background, |
696 | - QApplication::palette().active().background()); | 772 | - QApplication::palette().active().background()); |
697 | - btn->setPalette(pal); | 773 | - btn->setPalette(pal); |
698 | - } | 774 | - } |
699 | - } | 775 | - } |
700 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ | 776 | - else if(obj->inherits("QToolButton") && !obj->inherits("KToolBarButton")){ |
701 | + else if(obj->inherits("QToolButton")){ | 777 | + else if(obj->inherits("QToolButton")){ |
702 | QToolButton *btn = (QToolButton *)btn; | 778 | QToolButton *btn = (QToolButton *)btn; |
703 | if(!btn->autoRaise()){ | 779 | if(!btn->autoRaise()){ |
704 | if(btn->isEnabled()){ | 780 | if(btn->isEnabled()){ |
705 | @@ -1340,11 +1278,6 @@ | 781 | @@ -1290,7 +1301,24 @@ |
782 | } | ||
783 | } | ||
784 | } | ||
785 | - return(false); | ||
786 | + else if (obj-> inherits( "QProgressBar" )) { | ||
787 | + if ( ev->type() == QEvent::Paint ) { | ||
788 | + HackProgressBar *p = (HackProgressBar *) obj; | ||
789 | + const QColorGroup &g = p-> colorGroup ( ); | ||
790 | + | ||
791 | + QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); | ||
792 | + if(!pix){ | ||
793 | + int h, s, v; | ||
794 | + g.button().dark(120).hsv(&h, &s, &v); | ||
795 | + pix = new QPixmap(*bevelFillPix); | ||
796 | + adjustHSV(*pix, h, s, v); | ||
797 | + bevelFillDict.insert(g.button().dark(120).rgb(), pix); | ||
798 | + } | ||
799 | + p-> paint ((QPaintEvent *) ev, g, pix ); | ||
800 | + return true; | ||
801 | + } | ||
802 | + } | ||
803 | +return false ; | ||
804 | } | ||
805 | |||
806 | void LiquidStyle::drawButton(QPainter *p, int x, int y, int w, int h, | ||
807 | @@ -1340,11 +1368,6 @@ | ||
706 | QColorGroup g = btn->colorGroup(); | 808 | QColorGroup g = btn->colorGroup(); |
707 | 809 | ||
708 | 810 | ||
709 | - QColor testColor; | 811 | - QColor testColor; |
710 | - if(btn->parent() && btn->parent()->isWidgetType()){ | 812 | - if(btn->parent() && btn->parent()->isWidgetType()){ |
711 | - testColor = p->backgroundColor(); // remove me | 813 | - testColor = p->backgroundColor(); // remove me |
712 | - } | 814 | - } |
713 | - | 815 | - |
714 | //int dw = buttonDefaultIndicatorWidth(); | 816 | //int dw = buttonDefaultIndicatorWidth(); |
715 | if(btn->hasFocus() || btn->isDefault()){ | 817 | if(btn->hasFocus() || btn->isDefault()){ |
716 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); | 818 | QColor c = btn->hasFocus() ? g.button().light(110) : g.background(); |
717 | @@ -1596,7 +1529,7 @@ | 819 | @@ -1596,7 +1619,7 @@ |
718 | if(sbBuffer.size() != sb->size()) | 820 | if(sbBuffer.size() != sb->size()) |
719 | sbBuffer.resize(sb->size()); | 821 | sbBuffer.resize(sb->size()); |
720 | } | 822 | } |
721 | - subB.setRect( subX,subY,buttonDim,buttonDim ); | 823 | - subB.setRect( subX,subY,buttonDim,buttonDim ); |
722 | + subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); | 824 | + subB.setRect( subX,subY,0,0); // buttonDim,buttonDim ); |
723 | addB.setRect( addX,addY,buttonDim,buttonDim ); | 825 | addB.setRect( addX,addY,buttonDim,buttonDim ); |
724 | if(horiz) | 826 | if(horiz) |
725 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); | 827 | subHC.setRect(addX-buttonDim,addY,buttonDim,buttonDim ); |
726 | @@ -1624,7 +1557,7 @@ | 828 | @@ -1624,7 +1647,7 @@ |
727 | QPainter painter; | 829 | QPainter painter; |
728 | if(!horiz){ | 830 | if(!horiz){ |
729 | painter.begin(&sbBuffer); | 831 | painter.begin(&sbBuffer); |
730 | - QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); | 832 | - QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*3))+1); |
731 | + QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); | 833 | + QRect bgR(0, subB.bottom()+1, sb->width(), (len-(buttonDim*2))+1); |
732 | if(sliderR.height() >= 8){ | 834 | if(sliderR.height() >= 8){ |
733 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, | 835 | painter.drawPixmap(bgR.x()+1, bgR.y(), *vsbSliderFillPix, 0, 0, |
734 | 13, 8); | 836 | 13, 8); |
735 | @@ -1690,7 +1623,7 @@ | 837 | @@ -1690,7 +1713,7 @@ |
736 | } | 838 | } |
737 | else{ | 839 | else{ |
738 | painter.begin(&sbBuffer); | 840 | painter.begin(&sbBuffer); |
739 | - QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); | 841 | - QRect bgR(subB.right()+1, 0, (len-(buttonDim*3))+1, sb->height()); |
740 | + QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); | 842 | + QRect bgR(subB.right()+1, 0, (len-(buttonDim*2))+1, sb->height()); |
741 | if(sliderR.width() >= 8){ | 843 | if(sliderR.width() >= 8){ |
742 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, | 844 | painter.drawPixmap(bgR.x(), bgR.y()+1, *vsbSliderFillPix, 0, 0, |
743 | 8, 13); | 845 | 8, 13); |
744 | @@ -1761,10 +1694,10 @@ | 846 | @@ -1761,10 +1784,10 @@ |
745 | addB.width()-8, addB.height()-8, g, !maxed); | 847 | addB.width()-8, addB.height()-8, g, !maxed); |
746 | } | 848 | } |
747 | if ( controls & SubLine ) { | 849 | if ( controls & SubLine ) { |
748 | - drawSBButton(p, subB, g, activeControl == SubLine); | 850 | - drawSBButton(p, subB, g, activeControl == SubLine); |
749 | - drawArrow( p, horiz ? LeftArrow : UpArrow, | 851 | - drawArrow( p, horiz ? LeftArrow : UpArrow, |
750 | - false, subB.x()+4, subB.y()+4, | 852 | - false, subB.x()+4, subB.y()+4, |
751 | - subB.width()-8, subB.height()-8, g, !maxed); | 853 | - subB.width()-8, subB.height()-8, g, !maxed); |
752 | + // drawSBButton(p, subB, g, activeControl == SubLine); | 854 | + // drawSBButton(p, subB, g, activeControl == SubLine); |
753 | + // drawArrow( p, horiz ? LeftArrow : UpArrow, | 855 | + // drawArrow( p, horiz ? LeftArrow : UpArrow, |
754 | + // false, subB.x()+4, subB.y()+4, | 856 | + // false, subB.x()+4, subB.y()+4, |
755 | + // subB.width()-8, subB.height()-8, g, !maxed); | 857 | + // subB.width()-8, subB.height()-8, g, !maxed); |
756 | drawSBButton(p, subHC, g, activeControl == SubLine); | 858 | drawSBButton(p, subHC, g, activeControl == SubLine); |
757 | drawArrow( p, horiz ? LeftArrow : UpArrow, | 859 | drawArrow( p, horiz ? LeftArrow : UpArrow, |
758 | false, subHC.x()+4, subHC.y()+4, | 860 | false, subHC.x()+4, subHC.y()+4, |
759 | @@ -1865,8 +1798,8 @@ | 861 | @@ -1865,8 +1888,8 @@ |
760 | else | 862 | else |
761 | buttonDim = ( length - b*2 )/2 - 1; | 863 | buttonDim = ( length - b*2 )/2 - 1; |
762 | 864 | ||
763 | - sliderMin = b + buttonDim; | 865 | - sliderMin = b + buttonDim; |
764 | - maxLength = length - b*2 - buttonDim*3; | 866 | - maxLength = length - b*2 - buttonDim*3; |
765 | + sliderMin = b + 0; // buttonDim; | 867 | + sliderMin = b + 0; // buttonDim; |
766 | + maxLength = length - b*2 - buttonDim*2; // 3; | 868 | + maxLength = length - b*2 - buttonDim*2; // 3; |
767 | 869 | ||
768 | if ( sb->maxValue() == sb->minValue() ) { | 870 | if ( sb->maxValue() == sb->minValue() ) { |
769 | sliderLength = maxLength; | 871 | sliderLength = maxLength; |
770 | @@ -1914,8 +1847,8 @@ | 872 | @@ -1914,8 +1937,8 @@ |
771 | return(QSize(16, 16)); | 873 | return(QSize(16, 16)); |
772 | } | 874 | } |
773 | 875 | ||
774 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, | 876 | -void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int w, |
775 | - int h, const QColorGroup &g, bool on, | 877 | - int h, const QColorGroup &g, bool on, |
776 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, | 878 | +void LiquidStyle::drawExclusiveIndicator(QPainter *p, int x, int y, int /*w*/, |
777 | + int /*h*/, const QColorGroup &/*g*/, bool on, | 879 | + int /*h*/, const QColorGroup &/*g*/, bool on, |
778 | bool down, bool) | 880 | bool down, bool) |
779 | { | 881 | { |
780 | bool isHover = highlightWidget == p->device(); | 882 | bool isHover = highlightWidget == p->device(); |
781 | @@ -1957,8 +1890,8 @@ | 883 | @@ -1957,8 +1980,8 @@ |
782 | return(QSize(20, 22)); | 884 | return(QSize(20, 22)); |
783 | } | 885 | } |
784 | 886 | ||
785 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, | 887 | -void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int w, int h, |
786 | - const QColorGroup &g, int state, bool down, bool) | 888 | - const QColorGroup &g, int state, bool down, bool) |
787 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 889 | +void LiquidStyle::drawIndicator(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
788 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) | 890 | + const QColorGroup &/*g*/, int state, bool /*down*/, bool) |
789 | { | 891 | { |
790 | bool isHover = highlightWidget == p->device(); | 892 | bool isHover = highlightWidget == p->device(); |
791 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget | 893 | bool isMasked = p->device() && p->device()->devType() == QInternal::Widget |
792 | @@ -1996,8 +1929,8 @@ | 894 | @@ -1996,8 +2019,8 @@ |
793 | } | 895 | } |
794 | } | 896 | } |
795 | 897 | ||
796 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, | 898 | -void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int w, int h, |
797 | - int state) | 899 | - int state) |
798 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 900 | +void LiquidStyle::drawIndicatorMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
799 | + int /*state*/) | 901 | + int /*state*/) |
800 | { | 902 | { |
801 | // needed for some reason by KHtml, even tho it's all filled ;P | 903 | // needed for some reason by KHtml, even tho it's all filled ;P |
802 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); | 904 | p->drawPixmap(x, y, *getPixmap(HTMLCB)->mask()); |
803 | @@ -2005,18 +1938,17 @@ | 905 | @@ -2005,18 +2028,17 @@ |
804 | } | 906 | } |
805 | 907 | ||
806 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, | 908 | void LiquidStyle::drawSlider(QPainter *p, int x, int y, int w, int h, |
807 | - const QColorGroup &g, Orientation orient, | 909 | - const QColorGroup &g, Orientation orient, |
808 | + const QColorGroup &/*g*/, Orientation orient, | 910 | + const QColorGroup &/*g*/, Orientation orient, |
809 | bool, bool) | 911 | bool, bool) |
810 | { | 912 | { |
811 | QWidget *parent = (QWidget *)p->device(); | 913 | QWidget *parent = (QWidget *)p->device(); |
812 | p->setBrushOrigin(parent->pos()); | 914 | p->setBrushOrigin(parent->pos()); |
813 | - p->fillRect(x, y, w, h, | 915 | - p->fillRect(x, y, w, h, |
814 | - QApplication::palette().active().brush(QColorGroup::Background)); | 916 | - QApplication::palette().active().brush(QColorGroup::Background)); |
815 | + parent->erase(x, y, w, h); | 917 | + parent->erase(x, y, w, h); |
816 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : | 918 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider) : |
817 | *getPixmap(VSlider)); | 919 | *getPixmap(VSlider)); |
818 | } | 920 | } |
819 | 921 | ||
820 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, | 922 | -void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int w, int h, |
821 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, | 923 | +void LiquidStyle::drawSliderMask(QPainter *p, int x, int y, int /*w*/, int /*h*/, |
822 | Orientation orient, bool, bool) | 924 | Orientation orient, bool, bool) |
823 | { | 925 | { |
824 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : | 926 | p->drawPixmap(x, y, orient == Qt::Horizontal ? *getPixmap(HSlider)->mask() : |
825 | @@ -2065,203 +1997,26 @@ | 927 | @@ -2065,203 +2087,26 @@ |
826 | p->drawLineSegments(a); | 928 | p->drawLineSegments(a); |
827 | } | 929 | } |
828 | 930 | ||
829 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, | 931 | -void LiquidStyle::drawKBarHandle(QPainter *p, int x, int y, int w, int h, |
830 | - const QColorGroup &g, KToolBarPos, | 932 | - const QColorGroup &g, KToolBarPos, |
831 | - QBrush *) | 933 | - QBrush *) |
832 | -{ | 934 | -{ |
833 | - p->setPen(g.button().dark(120)); | 935 | - p->setPen(g.button().dark(120)); |
834 | - int x2 = x+w-1; | 936 | - int x2 = x+w-1; |
835 | - int y2 = y+h-1; | 937 | - int y2 = y+h-1; |
836 | - p->drawLine(x+1, y, x2-1, y); | 938 | - p->drawLine(x+1, y, x2-1, y); |
837 | - p->drawLine(x+1, y2, x2-1, y2); | 939 | - p->drawLine(x+1, y2, x2-1, y2); |
838 | - p->drawLine(x, y+1, x, y2-1); | 940 | - p->drawLine(x, y+1, x, y2-1); |
839 | - p->drawLine(x2, y+1, x2, y2-1); | 941 | - p->drawLine(x2, y+1, x2, y2-1); |
840 | - | 942 | - |
841 | - p->setPen(g.background()); | 943 | - p->setPen(g.background()); |
842 | - p->drawPoint(x, y); | 944 | - p->drawPoint(x, y); |
843 | - p->drawPoint(x2, y); | 945 | - p->drawPoint(x2, y); |
844 | - p->drawPoint(x, y2); | 946 | - p->drawPoint(x, y2); |
845 | - p->drawPoint(x2, y2); | 947 | - p->drawPoint(x2, y2); |
846 | - | 948 | - |
847 | - | 949 | |
848 | - | 950 | - |
849 | - // p->drawRect(x, y, w, h); | 951 | - // p->drawRect(x, y, w, h); |
850 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); | 952 | - QPixmap *pix = bevelFillDict.find(g.button().rgb()); |
851 | - if(!pix){ | 953 | - if(!pix){ |
852 | - int h, s, v; | 954 | - int h, s, v; |
853 | - g.button().hsv(&h, &s, &v); | 955 | - g.button().hsv(&h, &s, &v); |
854 | - pix = new QPixmap(*bevelFillPix); | 956 | - pix = new QPixmap(*bevelFillPix); |
855 | - adjustHSV(*pix, h, s, v); | 957 | - adjustHSV(*pix, h, s, v); |
856 | - bevelFillDict.insert(g.button().rgb(), pix); | 958 | - bevelFillDict.insert(g.button().rgb(), pix); |
857 | - } | 959 | - } |
858 | - | 960 | - |
859 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); | 961 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *pix); |
860 | -} | 962 | -} |
861 | - | 963 | - |
862 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, | 964 | -void LiquidStyle::drawKMenuBar(QPainter *p, int x, int y, int w, int h, |
863 | - const QColorGroup &g, bool mac, QBrush *) | 965 | - const QColorGroup &g, bool mac, QBrush *) |
864 | -{ | 966 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, |
967 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | ||
968 | { | ||
865 | - if(p->device() && p->device()->devType() == QInternal::Widget && | 969 | - if(p->device() && p->device()->devType() == QInternal::Widget && |
866 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ | 970 | - ((KMenuBar *)p->device())->isTopLevelMenu()){ |
867 | - p->setPen(Qt::black); | 971 | - p->setPen(Qt::black); |
868 | - p->drawRect(x, y, w, h); | 972 | - p->drawRect(x, y, w, h); |
869 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); | 973 | - p->drawTiledPixmap(x+1, y+1, w-2, h-2, *menuPix); |
870 | - // left | 974 | - // left |
871 | - p->drawLine(x+1, y+1, x+1, y+5); | 975 | - p->drawLine(x+1, y+1, x+1, y+5); |
872 | - p->drawLine(x+2, y+1, x+2, y+3); | 976 | - p->drawLine(x+2, y+1, x+2, y+3); |
873 | - p->drawLine(x+3, y+1, x+3, y+2); | 977 | - p->drawLine(x+3, y+1, x+3, y+2); |
874 | - p->drawLine(x+4, y+1, x+6, y+1); | 978 | - p->drawLine(x+4, y+1, x+6, y+1); |
875 | - // right | 979 | - // right |
876 | - int x2 = x+w-1; | 980 | - int x2 = x+w-1; |
877 | - p->drawLine(x2-1, y+1, x2-1, y+5); | 981 | - p->drawLine(x2-1, y+1, x2-1, y+5); |
878 | - p->drawLine(x2-2, y+1, x2-2, y+3); | 982 | - p->drawLine(x2-2, y+1, x2-2, y+3); |
879 | - p->drawLine(x2-3, y+1, x2-3, y+2); | 983 | - p->drawLine(x2-3, y+1, x2-3, y+2); |
880 | - p->drawLine(x2-4, y+1, x2-6, y+1); | 984 | - p->drawLine(x2-4, y+1, x2-6, y+1); |
881 | - } | 985 | - } |
882 | - else{ | 986 | - else{ |
883 | - qDrawShadePanel(p, x, y, w, h, g, false, 1, | 987 | - qDrawShadePanel(p, x, y, w, h, g, false, 1, |
884 | - &g.brush(QColorGroup::Background)); | 988 | - &g.brush(QColorGroup::Background)); |
885 | - } | 989 | - } |
886 | - | 990 | - |
887 | -} | 991 | -} |
888 | 992 | - | |
889 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, | 993 | -void LiquidStyle::drawKToolBar(QPainter *p, int x, int y, int w, int h, |
890 | - const QColorGroup &g, KToolBarPos, QBrush *) | 994 | - const QColorGroup &g, KToolBarPos, QBrush *) |
891 | +void LiquidStyle::drawMenuBarItem(QPainter *p, int x, int y, int w, int h, | 995 | -{ |
892 | + QMenuItem *mi, QColorGroup &g, bool /*enabled*/, bool active ) | ||
893 | { | ||
894 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 996 | - //p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
895 | -} | 997 | -} |
896 | - | 998 | - |
897 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, | 999 | -void LiquidStyle::drawKToolBarButton(QPainter *p, int x, int y, int w, int h, |
898 | - const QColorGroup &g, bool sunken, | 1000 | - const QColorGroup &g, bool sunken, |
899 | - bool raised, bool enabled, bool popup, | 1001 | - bool raised, bool enabled, bool popup, |
900 | - KToolButtonType icontext, | 1002 | - KToolButtonType icontext, |
901 | - const QString& btext, const QPixmap *pixmap, | 1003 | - const QString& btext, const QPixmap *pixmap, |
902 | - QFont *font, QWidget *btn) | 1004 | - QFont *font, QWidget *btn) |
903 | -{ | 1005 | -{ |
904 | - int dx, dy; | 1006 | - int dx, dy; |
905 | - | 1007 | - |
906 | - QFontMetrics fm(*font); | 1008 | - QFontMetrics fm(*font); |
907 | - | 1009 | - |
908 | - QToolBar* toolbar = 0; | 1010 | - QToolBar* toolbar = 0; |
909 | - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) | 1011 | - if(btn->parent() && btn->parent()->isWidgetType() && btn->parent()->inherits("QToolBar")) |
910 | - toolbar = static_cast<QToolBar*>(btn->parent()); | 1012 | - toolbar = static_cast<QToolBar*>(btn->parent()); |
911 | - | 1013 | - |
912 | - --w, --h; | 1014 | - --w, --h; |
913 | - if(sunken) | 1015 | - if(sunken) |
914 | - ++x, ++y; | 1016 | - ++x, ++y; |
915 | - | 1017 | - |
916 | - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : | 1018 | - QColor btnColor(sunken ? g.button() : raised ? g.button().light(110) : |
917 | - g.background()); | 1019 | - g.background()); |
918 | - drawClearBevel(p, x, y, w, h, btnColor, g.background()); | 1020 | - drawClearBevel(p, x, y, w, h, btnColor, g.background()); |
919 | - | 1021 | - |
920 | - p->setPen(g.text()); | 1022 | - p->setPen(g.text()); |
921 | - | 1023 | - |
922 | - if (icontext == Icon){ // icon only | 1024 | - if (icontext == Icon){ // icon only |
923 | - if (pixmap){ | 1025 | - if (pixmap){ |
924 | - dx = ( w - pixmap->width() ) / 2; | 1026 | - dx = ( w - pixmap->width() ) / 2; |
925 | - dy = ( h - pixmap->height() ) / 2; | 1027 | - dy = ( h - pixmap->height() ) / 2; |
926 | - if ( sunken ) | 1028 | - if ( sunken ) |
927 | - { | 1029 | - { |
928 | - ++dx; | 1030 | - ++dx; |
929 | - ++dy; | 1031 | - ++dy; |
930 | - } | 1032 | - } |
931 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 1033 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
932 | - } | 1034 | - } |
933 | - } | 1035 | - } |
934 | - else if (icontext == IconTextRight){ // icon and text (if any) | 1036 | - else if (icontext == IconTextRight){ // icon and text (if any) |
935 | - if (pixmap){ | 1037 | - if (pixmap){ |
936 | - dx = 4; | 1038 | - dx = 4; |
937 | - dy = ( h - pixmap->height() ) / 2; | 1039 | - dy = ( h - pixmap->height() ) / 2; |
938 | - if ( sunken ){ | 1040 | - if ( sunken ){ |
939 | - ++dx; | 1041 | - ++dx; |
940 | - ++dy; | 1042 | - ++dy; |
941 | - } | 1043 | - } |
942 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 1044 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
943 | - } | 1045 | - } |
944 | - if (!btext.isNull()){ | 1046 | - if (!btext.isNull()){ |
945 | - int tf = AlignVCenter|AlignLeft; | 1047 | - int tf = AlignVCenter|AlignLeft; |
946 | - if (pixmap) | 1048 | - if (pixmap) |
947 | - dx= 4 + pixmap->width() + 2; | 1049 | - dx= 4 + pixmap->width() + 2; |
948 | - else | 1050 | - else |
949 | - dx= 4; | 1051 | - dx= 4; |
950 | - dy = 0; | 1052 | - dy = 0; |
951 | - if ( sunken ){ | 1053 | - if ( sunken ){ |
952 | - ++dx; | 1054 | - ++dx; |
953 | - ++dy; | 1055 | - ++dy; |
954 | - } | 1056 | - } |
955 | - if (font) | 1057 | - if (font) |
956 | - p->setFont(*font); | 1058 | - p->setFont(*font); |
957 | - if(raised) | 1059 | - if(raised) |
958 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 1060 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
959 | - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); | 1061 | - p->drawText(x+dx, y+dy, w-dx, h, tf, btext); |
960 | - } | 1062 | - } |
961 | - } | 1063 | - } |
962 | - else if (icontext == Text){ // only text, even if there is a icon | 1064 | - else if (icontext == Text){ // only text, even if there is a icon |
963 | - if (!btext.isNull()){ | 1065 | - if (!btext.isNull()){ |
964 | - int tf = AlignVCenter|AlignLeft; | 1066 | - int tf = AlignVCenter|AlignLeft; |
965 | - if (!enabled) | 1067 | - if (!enabled) |
966 | - p->setPen(g.dark()); | 1068 | - p->setPen(g.dark()); |
967 | - dx= (w - fm.width(btext)) / 2; | 1069 | - dx= (w - fm.width(btext)) / 2; |
968 | - dy= (h - fm.lineSpacing()) / 2; | 1070 | - dy= (h - fm.lineSpacing()) / 2; |
969 | - if ( sunken ){ | 1071 | - if ( sunken ){ |
970 | - ++dx; | 1072 | - ++dx; |
971 | - ++dy; | 1073 | - ++dy; |
972 | - } | 1074 | - } |
973 | - if (font) | 1075 | - if (font) |
974 | - p->setFont(*font); | 1076 | - p->setFont(*font); |
975 | - if(raised) | 1077 | - if(raised) |
976 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 1078 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
977 | - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); | 1079 | - p->drawText(x+dx, y+dy, fm.width(btext), fm.lineSpacing(), tf, btext); |
978 | - } | 1080 | - } |
979 | - } | 1081 | - } |
980 | - else if (icontext == IconTextBottom){ | 1082 | - else if (icontext == IconTextBottom){ |
981 | - if (pixmap){ | 1083 | - if (pixmap){ |
982 | - dx = (w - pixmap->width()) / 2; | 1084 | - dx = (w - pixmap->width()) / 2; |
983 | - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; | 1085 | - dy = (h - fm.lineSpacing() - pixmap->height()) / 2; |
984 | - if ( sunken ){ | 1086 | - if ( sunken ){ |
985 | - ++dx; | 1087 | - ++dx; |
986 | - ++dy; | 1088 | - ++dy; |
987 | - } | 1089 | - } |
988 | - p->drawPixmap( x+dx, y+dy, *pixmap ); | 1090 | - p->drawPixmap( x+dx, y+dy, *pixmap ); |
989 | - } | 1091 | - } |
990 | - if (!btext.isNull()){ | 1092 | - if (!btext.isNull()){ |
991 | - int tf = AlignBottom|AlignHCenter; | 1093 | - int tf = AlignBottom|AlignHCenter; |
992 | - dy= pixmap->height(); | 1094 | - dy= pixmap->height(); |
993 | - dx = 2; | 1095 | - dx = 2; |
994 | - if ( sunken ){ | 1096 | - if ( sunken ){ |
995 | - ++dx; | 1097 | - ++dx; |
996 | - ++dy; | 1098 | - ++dy; |
997 | - } | 1099 | - } |
998 | - if (font) | 1100 | - if (font) |
999 | - p->setFont(*font); | 1101 | - p->setFont(*font); |
1000 | - if(raised) | 1102 | - if(raised) |
1001 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); | 1103 | - p->setPen(KGlobalSettings::toolBarHighlightColor()); |
1002 | - p->drawText(x, y, w, h-3, tf, btext); | 1104 | - p->drawText(x, y, w, h-3, tf, btext); |
1003 | - } | 1105 | - } |
1004 | - } | 1106 | - } |
1005 | - if (popup){ | 1107 | - if (popup){ |
1006 | - if (enabled) | 1108 | - if (enabled) |
1007 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, | 1109 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, 0, 0, |
1008 | - g, true); | 1110 | - g, true); |
1009 | - else | 1111 | - else |
1010 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, | 1112 | - qDrawArrow (p, Qt::DownArrow, Qt::WindowsStyle, false, w-5, h-5, |
1011 | - 0, 0, g, false); | 1113 | - 0, 0, g, false); |
1012 | + if(active){ | 1114 | + if(active){ |
1013 | + x -= 2; // Bug in Qt/E | 1115 | + x -= 2; // Bug in Qt/E |
1014 | + y -= 2; | 1116 | + y -= 2; |
1015 | + w += 2; | 1117 | + w += 2; |
1016 | + h += 2; | 1118 | + h += 2; |
1017 | } | 1119 | } |
1018 | -} | 1120 | -} |
1019 | 1121 | ||
1020 | - | 1122 | - |
1021 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, | 1123 | -void LiquidStyle::drawKMenuItem(QPainter *p, int x, int y, int w, int h, |
1022 | - const QColorGroup &g, bool active, QMenuItem *mi, | 1124 | - const QColorGroup &g, bool active, QMenuItem *mi, |
1023 | - QBrush *) | 1125 | - QBrush *) |
1024 | -{ | 1126 | -{ |
1025 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1127 | - if ( p->font() == KGlobalSettings::generalFont() ) |
1026 | - p->setFont( KGlobalSettings::menuFont() ); | 1128 | - p->setFont( KGlobalSettings::menuFont() ); |
1027 | + QWidget *parent = (QWidget *)p->device(); | 1129 | + QWidget *parent = (QWidget *)p->device(); |
1028 | + p->setBrushOrigin(parent->pos()); | 1130 | + p->setBrushOrigin(parent->pos()); |
1029 | + parent->erase(x, y, w, h); | 1131 | + parent->erase(x, y, w, h); |
1030 | 1132 | ||
1031 | if(menuHandler->useShadowText()){ | 1133 | if(menuHandler->useShadowText()){ |
1032 | QColor shadow; | 1134 | QColor shadow; |
1033 | if(p->device() && p->device()->devType() == QInternal::Widget && | 1135 | if(p->device() && p->device()->devType() == QInternal::Widget && |
1034 | - ((QWidget *)p->device())->inherits("KMenuBar")){ | 1136 | - ((QWidget *)p->device())->inherits("KMenuBar")){ |
1035 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1137 | - shadow = ((KMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
1036 | + ((QWidget *)p->device())->inherits("QMenuBar")){ | 1138 | + ((QWidget *)p->device())->inherits("QMenuBar")){ |
1037 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : | 1139 | + shadow = ((QMenuBar*)p->device())->isTopLevel() ? g.button().dark(130) : |
1038 | g.background().dark(130); | 1140 | g.background().dark(130); |
1039 | } | 1141 | } |
1040 | else | 1142 | else |
1041 | @@ -2300,8 +2055,8 @@ | 1143 | @@ -2300,8 +2145,8 @@ |
1042 | } | 1144 | } |
1043 | 1145 | ||
1044 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, | 1146 | void LiquidStyle::drawPopupPanel(QPainter *p, int x, int y, int w, int h, |
1045 | - const QColorGroup &g, int lineWidth, | 1147 | - const QColorGroup &g, int lineWidth, |
1046 | - const QBrush * fill) | 1148 | - const QBrush * fill) |
1047 | + const QColorGroup &g, int /*lineWidth*/, | 1149 | + const QColorGroup &g, int /*lineWidth*/, |
1048 | + const QBrush * /*fill*/) | 1150 | + const QBrush * /*fill*/) |
1049 | { | 1151 | { |
1050 | QColor c; | 1152 | QColor c; |
1051 | switch(menuHandler->transType()){ | 1153 | switch(menuHandler->transType()){ |
1052 | @@ -2336,8 +2091,6 @@ | 1154 | @@ -2336,8 +2181,6 @@ |
1053 | 1155 | ||
1054 | maxpmw = QMAX( maxpmw, 20 ); | 1156 | maxpmw = QMAX( maxpmw, 20 ); |
1055 | 1157 | ||
1056 | - if ( p->font() == KGlobalSettings::generalFont() ) | 1158 | - if ( p->font() == KGlobalSettings::generalFont() ) |
1057 | - p->setFont( KGlobalSettings::menuFont() ); | 1159 | - p->setFont( KGlobalSettings::menuFont() ); |
1058 | 1160 | ||
1059 | bool dis = !enabled; | 1161 | bool dis = !enabled; |
1060 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); | 1162 | QColorGroup itemg = dis ? pal.disabled() : pal.active(); |
1061 | @@ -2363,7 +2116,7 @@ | 1163 | @@ -2363,7 +2206,7 @@ |
1062 | p->fillRect(x, y, w, h, menuBrush); | 1164 | p->fillRect(x, y, w, h, menuBrush); |
1063 | } | 1165 | } |
1064 | else{ | 1166 | else{ |
1065 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1167 | - KPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
1066 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); | 1168 | + QPixmap *pix = menuHandler->pixmap(((QWidget*)p->device())->winId()); |
1067 | if(pix) | 1169 | if(pix) |
1068 | p->drawPixmap(x, y, *pix, x, y, w, h); | 1170 | p->drawPixmap(x, y, *pix, x, y, w, h); |
1069 | } | 1171 | } |
1070 | @@ -2508,25 +2261,6 @@ | 1172 | @@ -2508,25 +2351,6 @@ |
1071 | return h; | 1173 | return h; |
1072 | } | 1174 | } |
1073 | 1175 | ||
1074 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, | 1176 | -void LiquidStyle::drawKProgressBlock(QPainter *p, int x, int y, int w, int h, |
1075 | - const QColorGroup &g, QBrush *fill) | 1177 | - const QColorGroup &g, QBrush *fill) |
1076 | -{ | 1178 | -{ |
1077 | - p->setPen(g.button().dark(130)); | 1179 | - p->setPen(g.button().dark(130)); |
1078 | - p->drawRect(x, y, w, h); | 1180 | - p->drawRect(x, y, w, h); |
1079 | - p->setPen(g.button().light(120)); | 1181 | - p->setPen(g.button().light(120)); |
1080 | - p->drawRect(x+1, y+1, w-2, h-2); | 1182 | - p->drawRect(x+1, y+1, w-2, h-2); |
1081 | - if(w >= 4 && h >= 4){ | 1183 | - if(w >= 4 && h >= 4){ |
1082 | - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); | 1184 | - QPixmap *pix = bevelFillDict.find(g.button().dark(120).rgb()); |
1083 | - if(!pix){ | 1185 | - if(!pix){ |
1084 | - int h, s, v; | 1186 | - int h, s, v; |
1085 | - g.button().dark(120).hsv(&h, &s, &v); | 1187 | - g.button().dark(120).hsv(&h, &s, &v); |
1086 | - pix = new QPixmap(*bevelFillPix); | 1188 | - pix = new QPixmap(*bevelFillPix); |
1087 | - adjustHSV(*pix, h, s, v); | 1189 | - adjustHSV(*pix, h, s, v); |
1088 | - bevelFillDict.insert(g.button().dark(120).rgb(), pix); | 1190 | - bevelFillDict.insert(g.button().dark(120).rgb(), pix); |
1089 | - } | 1191 | - } |
1090 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); | 1192 | - p->drawTiledPixmap(x+2, y+2, w-4, h-4, *pix); |
1091 | - } | 1193 | - } |
1092 | -} | 1194 | -} |
1093 | 1195 | ||
1094 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, | 1196 | void LiquidStyle::drawFocusRect(QPainter *p, const QRect &r, |
1095 | const QColorGroup &g, const QColor *c, | 1197 | const QColorGroup &g, const QColor *c, |
1096 | @@ -2540,25 +2274,25 @@ | 1198 | @@ -2540,25 +2364,25 @@ |
1097 | return; | 1199 | return; |
1098 | } | 1200 | } |
1099 | else{ | 1201 | else{ |
1100 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | 1202 | - KStyle::drawFocusRect(p, r, g, c, atBorder); |
1101 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | 1203 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); |
1102 | } | 1204 | } |
1103 | } | 1205 | } |
1104 | else | 1206 | else |
1105 | - KStyle::drawFocusRect(p, r, g, c, atBorder); | 1207 | - KStyle::drawFocusRect(p, r, g, c, atBorder); |
1106 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); | 1208 | + QWindowsStyle::drawFocusRect(p, r, g, c, atBorder); |
1107 | 1209 | ||
1108 | } | 1210 | } |
1109 | 1211 | ||
1110 | void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) | 1212 | void LiquidStyle::polishPopupMenu(QPopupMenu *mnu) |
1111 | { | 1213 | { |
1112 | mnu->installEventFilter(menuHandler); | 1214 | mnu->installEventFilter(menuHandler); |
1113 | - KStyle::polishPopupMenu(mnu); | 1215 | - KStyle::polishPopupMenu(mnu); |
1114 | + QWindowsStyle::polishPopupMenu(mnu); | 1216 | + QWindowsStyle::polishPopupMenu(mnu); |
1115 | } | 1217 | } |
1116 | 1218 | ||
1117 | void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, | 1219 | void LiquidStyle::drawTab(QPainter *p, const QTabBar *tabBar, QTab *tab, |
1118 | bool selected) | 1220 | bool selected) |
1119 | { | 1221 | { |
1120 | if(tabBar->shape() != QTabBar::RoundedAbove){ | 1222 | if(tabBar->shape() != QTabBar::RoundedAbove){ |
1121 | - KStyle::drawTab(p, tabBar, tab, selected); | 1223 | - KStyle::drawTab(p, tabBar, tab, selected); |
1122 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); | 1224 | + QWindowsStyle::drawTab(p, tabBar, tab, selected); |
1123 | return; | 1225 | return; |
1124 | } | 1226 | } |
1125 | QPixmap tilePix; | 1227 | QPixmap tilePix; |
1126 | @@ -2671,7 +2405,7 @@ | 1228 | @@ -2671,7 +2495,7 @@ |
1127 | vFrame = 8; // was 10 | 1229 | vFrame = 8; // was 10 |
1128 | } | 1230 | } |
1129 | else | 1231 | else |
1130 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1232 | - KStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1131 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); | 1233 | + QWindowsStyle::tabbarMetrics(t, hFrame, vFrame, overlap); |
1132 | } | 1234 | } |
1133 | 1235 | ||
1134 | 1236 | ||
1135 | @@ -2699,7 +2433,7 @@ | 1237 | @@ -2699,7 +2523,7 @@ |
1136 | p->drawLine(x+1, y+1, x+1, y2-1); | 1238 | p->drawLine(x+1, y+1, x+1, y2-1); |
1137 | } | 1239 | } |
1138 | else if(lineWidth != 2 || !sunken) | 1240 | else if(lineWidth != 2 || !sunken) |
1139 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1241 | - KStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1140 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); | 1242 | + QWindowsStyle::drawPanel(p, x, y, w, h, g, sunken, lineWidth, fill); |
1141 | else{ | 1243 | else{ |
1142 | QPen oldPen = p->pen(); | 1244 | QPen oldPen = p->pen(); |
1143 | int x2 = x+w-1; | 1245 | int x2 = x+w-1; |
1144 | @@ -2726,105 +2460,6 @@ | 1246 | @@ -2726,105 +2550,6 @@ |
1145 | } | 1247 | } |
1146 | } | 1248 | } |
1147 | 1249 | ||
1148 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, | 1250 | -void LiquidStyle::drawKickerAppletHandle(QPainter *p, int x, int y, int w, int h, |
1149 | - const QColorGroup &g, QBrush *) | 1251 | - const QColorGroup &g, QBrush *) |
1150 | -{ | 1252 | -{ |
1151 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); | 1253 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Background)); |
1152 | - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? | 1254 | - drawClearBevel(p, x, y, w, h, highlightWidget == p->device() ? |
1153 | - g.button().light(120) : g.button(), g.button()); | 1255 | - g.button().light(120) : g.button(), g.button()); |
1154 | - /* | 1256 | - /* |
1155 | - if(h > w){ | 1257 | - if(h > w){ |
1156 | - int y2 = y+h-1; | 1258 | - int y2 = y+h-1; |
1157 | - | 1259 | - |
1158 | - p->setPen(g.light()); | 1260 | - p->setPen(g.light()); |
1159 | - | 1261 | - |
1160 | - p->drawLine(x+1, y+2, x+1, y2-2); | 1262 | - p->drawLine(x+1, y+2, x+1, y2-2); |
1161 | - p->drawLine(x+4, y+2, x+4, y2-2); | 1263 | - p->drawLine(x+4, y+2, x+4, y2-2); |
1162 | - | 1264 | - |
1163 | - p->setPen(g.dark()); | 1265 | - p->setPen(g.dark()); |
1164 | - p->drawLine(x+2, y+2, x+2, y2-2); | 1266 | - p->drawLine(x+2, y+2, x+2, y2-2); |
1165 | - p->drawLine(x+5, y+2, x+5, y2-2); | 1267 | - p->drawLine(x+5, y+2, x+5, y2-2); |
1166 | - | 1268 | - |
1167 | - } | 1269 | - } |
1168 | - else{ | 1270 | - else{ |
1169 | - int x2 = x+w-1; | 1271 | - int x2 = x+w-1; |
1170 | - | 1272 | - |
1171 | - p->setPen(g.light()); | 1273 | - p->setPen(g.light()); |
1172 | - | 1274 | - |
1173 | - p->drawLine(x+2, y+1, x2-2, y+1); | 1275 | - p->drawLine(x+2, y+1, x2-2, y+1); |
1174 | - p->drawLine(x+2, y+4, x2-2, y+4); | 1276 | - p->drawLine(x+2, y+4, x2-2, y+4); |
1175 | - | 1277 | - |
1176 | - p->setPen(g.dark()); | 1278 | - p->setPen(g.dark()); |
1177 | - p->drawLine(x+2, y+2, x2-2, y+2); | 1279 | - p->drawLine(x+2, y+2, x2-2, y+2); |
1178 | - p->drawLine(x+2, y+5, x2-2, y+5); | 1280 | - p->drawLine(x+2, y+5, x2-2, y+5); |
1179 | - }*/ | 1281 | - }*/ |
1180 | - | 1282 | - |
1181 | -} | 1283 | -} |
1182 | - | 1284 | - |
1183 | -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, | 1285 | -void LiquidStyle::drawKickerTaskButton(QPainter *p, int x, int y, int w, int h, |
1184 | - const QColorGroup &g, | 1286 | - const QColorGroup &g, |
1185 | - const QString &text, bool sunken, | 1287 | - const QString &text, bool sunken, |
1186 | - QPixmap *pixmap, QBrush *) | 1288 | - QPixmap *pixmap, QBrush *) |
1187 | -{ | 1289 | -{ |
1188 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); | 1290 | - p->fillRect(x, y, w, h, g.brush(QColorGroup::Button)); |
1189 | - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); | 1291 | - drawClearBevel(p, x, y, w, h, sunken ? g.button() : g.background(), g.button()); |
1190 | - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) | 1292 | - p->setPen(g.buttonText()); // Kicker doesn't set this ;-) |
1191 | - | 1293 | - |
1192 | - if(text.isNull() && !pixmap) | 1294 | - if(text.isNull() && !pixmap) |
1193 | - return; | 1295 | - return; |
1194 | - | 1296 | - |
1195 | - const int pxWidth = 20; | 1297 | - const int pxWidth = 20; |
1196 | - int textPos = pxWidth; | 1298 | - int textPos = pxWidth; |
1197 | - QRect br(buttonRect(x, y, w, h)); | 1299 | - QRect br(buttonRect(x, y, w, h)); |
1198 | - | 1300 | - |
1199 | - if (sunken) | 1301 | - if (sunken) |
1200 | - p->translate(1,1); | 1302 | - p->translate(1,1); |
1201 | - | 1303 | - |
1202 | - if ( pixmap && !pixmap->isNull() ) { | 1304 | - if ( pixmap && !pixmap->isNull() ) { |
1203 | - int dx = ( pxWidth - pixmap->width() ) / 2; | 1305 | - int dx = ( pxWidth - pixmap->width() ) / 2; |
1204 | - int dy = ( h - pixmap->height() ) / 2; | 1306 | - int dy = ( h - pixmap->height() ) / 2; |
1205 | - p->drawPixmap( br.x()+dx, dy, *pixmap ); | 1307 | - p->drawPixmap( br.x()+dx, dy, *pixmap ); |
1206 | - } | 1308 | - } |
1207 | - | 1309 | - |
1208 | - QString s = text; | 1310 | - QString s = text; |
1209 | - static const QString &modStr = KGlobal::staticQString( | 1311 | - static const QString &modStr = KGlobal::staticQString( |
1210 | - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); | 1312 | - QString::fromUtf8("[") + i18n("modified") + QString::fromUtf8("]")); |
1211 | - | 1313 | - |
1212 | - int modStrPos = s.find(modStr); | 1314 | - int modStrPos = s.find(modStr); |
1213 | - | 1315 | - |
1214 | - if (-1 != modStrPos) { | 1316 | - if (-1 != modStrPos) { |
1215 | - | 1317 | - |
1216 | - // +1 because we include a space after the closing brace. | 1318 | - // +1 because we include a space after the closing brace. |
1217 | - s.remove(modStrPos, modStr.length()+1); | 1319 | - s.remove(modStrPos, modStr.length()+1); |
1218 | - | 1320 | - |
1219 | - QPixmap modPixmap = SmallIcon("modified"); | 1321 | - QPixmap modPixmap = SmallIcon("modified"); |
1220 | - | 1322 | - |
1221 | - int dx = (pxWidth - modPixmap.width()) / 2; | 1323 | - int dx = (pxWidth - modPixmap.width()) / 2; |
1222 | - int dy = (h - modPixmap.height()) / 2; | 1324 | - int dy = (h - modPixmap.height()) / 2; |
1223 | - | 1325 | - |
1224 | - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); | 1326 | - p->drawPixmap(br.x() + textPos + dx, dy, modPixmap); |
1225 | - | 1327 | - |
1226 | - textPos += pxWidth; | 1328 | - textPos += pxWidth; |
1227 | - } | 1329 | - } |
1228 | - | 1330 | - |
1229 | - if (!s.isEmpty()){ | 1331 | - if (!s.isEmpty()){ |
1230 | - if (p->fontMetrics().width(s) > br.width() - textPos) { | 1332 | - if (p->fontMetrics().width(s) > br.width() - textPos) { |
1231 | - | 1333 | - |
1232 | - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); | 1334 | - int maxLen = br.width() - textPos - p->fontMetrics().width("..."); |
1233 | - | 1335 | - |
1234 | - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) | 1336 | - while ((!s.isEmpty()) && (p->fontMetrics().width(s) > maxLen)) |
1235 | - s.truncate(s.length() - 1); | 1337 | - s.truncate(s.length() - 1); |
1236 | - | 1338 | - |
1237 | - s.append("..."); | 1339 | - s.append("..."); |
1238 | - } | 1340 | - } |
1239 | - | 1341 | - |
1240 | - p->setPen(g.buttonText()); | 1342 | - p->setPen(g.buttonText()); |
1241 | - | 1343 | - |
1242 | - p->drawText(br.x()+ textPos, -1, w-textPos, h, | 1344 | - p->drawText(br.x()+ textPos, -1, w-textPos, h, |
1243 | - AlignLeft|AlignVCenter, s); | 1345 | - AlignLeft|AlignVCenter, s); |
1244 | - } | 1346 | - } |
1245 | - | 1347 | - |
1246 | -} | 1348 | -} |
1247 | 1349 | ||
1248 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) | 1350 | void LiquidStyle::adjustHSV(QPixmap &pix, int h, int s, int v) |
1249 | { | 1351 | { |
1250 | @@ -2998,22 +2633,22 @@ | 1352 | @@ -2998,22 +2723,22 @@ |
1251 | customBtnIconList.clear(); | 1353 | customBtnIconList.clear(); |
1252 | customBtnLabelList.clear(); | 1354 | customBtnLabelList.clear(); |
1253 | 1355 | ||
1254 | - KConfig *config = KGlobal::config(); | 1356 | - KConfig *config = KGlobal::config(); |
1255 | - QString oldGrp = config->group(); | 1357 | - QString oldGrp = config->group(); |
1256 | - config->setGroup("MosfetButtons"); | 1358 | - config->setGroup("MosfetButtons"); |
1257 | +// KConfig *config = KGlobal::config(); | 1359 | +// KConfig *config = KGlobal::config(); |
1258 | +// QString oldGrp = config->group(); | 1360 | +// QString oldGrp = config->group(); |
1259 | +// config->setGroup("MosfetButtons"); | 1361 | +// config->setGroup("MosfetButtons"); |
1260 | 1362 | ||
1261 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors | 1363 | QStrList iconList, colorList; //temp, we store QPixmaps and QColors |
1262 | iconList.setAutoDelete(true); | 1364 | iconList.setAutoDelete(true); |
1263 | colorList.setAutoDelete(true); | 1365 | colorList.setAutoDelete(true); |
1264 | - config->readListEntry("Labels", customBtnLabelList); | 1366 | - config->readListEntry("Labels", customBtnLabelList); |
1265 | - config->readListEntry("Icons", iconList); | 1367 | - config->readListEntry("Icons", iconList); |
1266 | - config->readListEntry("Colors", colorList); | 1368 | - config->readListEntry("Colors", colorList); |
1267 | +// config->readListEntry("Labels", customBtnLabelList); | 1369 | +// config->readListEntry("Labels", customBtnLabelList); |
1268 | +// config->readListEntry("Icons", iconList); | 1370 | +// config->readListEntry("Icons", iconList); |
1269 | +// config->readListEntry("Colors", colorList); | 1371 | +// config->readListEntry("Colors", colorList); |
1270 | 1372 | ||
1271 | const char *labelStr = customBtnLabelList.first(); | 1373 | const char *labelStr = customBtnLabelList.first(); |
1272 | const char *colorStr = colorList.first(); | 1374 | const char *colorStr = colorList.first(); |
1273 | const char *iconStr = iconList.first(); | 1375 | const char *iconStr = iconList.first(); |
1274 | 1376 | ||
1275 | - KIconLoader *ldr = KGlobal::iconLoader(); | 1377 | - KIconLoader *ldr = KGlobal::iconLoader(); |
1276 | +// KIconLoader *ldr = KGlobal::iconLoader(); | 1378 | +// KIconLoader *ldr = KGlobal::iconLoader(); |
1277 | while(labelStr != NULL){ | 1379 | while(labelStr != NULL){ |
1278 | QColor *c = new QColor; | 1380 | QColor *c = new QColor; |
1279 | c->setNamedColor(QString(colorStr)); | 1381 | c->setNamedColor(QString(colorStr)); |
1280 | @@ -3022,7 +2657,7 @@ | 1382 | @@ -3022,7 +2747,7 @@ |
1281 | QString tmpStr(iconStr); | 1383 | QString tmpStr(iconStr); |
1282 | if(!tmpStr.isEmpty()){ | 1384 | if(!tmpStr.isEmpty()){ |
1283 | QPixmap *pixmap = | 1385 | QPixmap *pixmap = |
1284 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); | 1386 | - new QPixmap(ldr->loadIcon(tmpStr, KIcon::Small)); |
1285 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); | 1387 | + new QPixmap();//ldr->loadIcon(tmpStr, KIcon::Small)); |
1286 | if(pixmap->isNull()){ | 1388 | if(pixmap->isNull()){ |
1287 | delete pixmap; | 1389 | delete pixmap; |
1288 | customBtnIconList.append(NULL); | 1390 | customBtnIconList.append(NULL); |
1289 | @@ -3037,7 +2672,6 @@ | 1391 | @@ -3037,7 +2762,6 @@ |
1290 | colorStr = colorList.next(); | 1392 | colorStr = colorList.next(); |
1291 | iconStr = iconList.next(); | 1393 | iconStr = iconList.next(); |
1292 | } | 1394 | } |
1293 | - config->setGroup(oldGrp); | 1395 | - config->setGroup(oldGrp); |
1294 | } | 1396 | } |
1295 | 1397 | ||
1296 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) | 1398 | void LiquidStyle::applyCustomAttributes(QPushButton *btn) |
1297 | @@ -3087,7 +2721,7 @@ | 1399 | @@ -3087,7 +2811,7 @@ |
1298 | } | 1400 | } |
1299 | } | 1401 | } |
1300 | 1402 | ||
1301 | -#include "liquid.moc" | 1403 | -#include "liquid.moc" |
1302 | +// #include "liquid.moc" | 1404 | +// #include "liquid.moc" |
1303 | 1405 | ||
1304 | 1406 | ||
1305 | 1407 | ||
1306 | --- -Sat Sep 21 05:31:48 2002 | 1408 | --- -2002-10-24 03:19:31.000000000 +0200 |
1307 | +++ plugin.cppMon Jul 8 02:42:56 2002 | 1409 | +++ plugin.cpp2002-10-04 03:37:38.000000000 +0200 |
1308 | @@ -1,29 +1,113 @@ | 1410 | @@ -1,29 +1,84 @@ |
1411 | +#include <qapplication.h> | ||
1412 | + | ||
1309 | #include "liquid.h" | 1413 | #include "liquid.h" |
1310 | -#include <klocale.h> | 1414 | -#include <klocale.h> |
1311 | +#include "liquidset.h" | 1415 | +#include "liquidset.h" |
1312 | +#include "plugin.h" | 1416 | +#include "plugin.h" |
1313 | 1417 | + | |
1314 | -extern "C" { | ||
1315 | - KStyle* allocate(); | ||
1316 | - int minor_version(); | ||
1317 | - int major_version(); | ||
1318 | - const char *description(); | ||
1319 | + | 1418 | + |
1320 | + | 1419 | + |
1321 | +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) | 1420 | +LiquidInterface::LiquidInterface ( ) : ref ( 0 ) |
1322 | +{ | 1421 | +{ |
1422 | +m_widget = 0; | ||
1323 | +} | 1423 | +} |
1324 | + | 1424 | + |
1325 | +LiquidInterface::~LiquidInterface ( ) | 1425 | +LiquidInterface::~LiquidInterface ( ) |
1326 | +{ | 1426 | +{ |
1327 | +} | 1427 | +} |
1328 | + | 1428 | + |
1329 | +QStyle *LiquidInterface::create ( ) | 1429 | +QStyle *LiquidInterface::style ( ) |
1330 | +{ | 1430 | +{ |
1331 | +return new LiquidStyle ( ); | 1431 | +return new LiquidStyle ( ); |
1332 | +} | 1432 | +} |
1333 | + | 1433 | + |
1334 | +QString LiquidInterface::name ( ) | 1434 | +QString LiquidInterface::name ( ) const |
1435 | +{ | ||
1436 | +return qApp-> translate ( "Styles", "Liquid" ); | ||
1437 | +} | ||
1438 | + | ||
1439 | +QString LiquidInterface::description ( ) const | ||
1440 | +{ | ||
1441 | +return qApp-> translate ( "Styles", "High Performance Liquid style by Mosfet" ); | ||
1442 | +} | ||
1443 | + | ||
1444 | +bool LiquidInterface::hasSettings ( ) const | ||
1445 | +{ | ||
1446 | +return true; | ||
1447 | +} | ||
1448 | + | ||
1449 | +QWidget *LiquidInterface::create ( QWidget *parent, const char *name ) | ||
1335 | +{ | 1450 | +{ |
1336 | +return QObject::tr( "Liquid", "name" ); | 1451 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); |
1452 | |||
1453 | -extern "C" { | ||
1454 | - KStyle* allocate(); | ||
1455 | - int minor_version(); | ||
1456 | - int major_version(); | ||
1457 | - const char *description(); | ||
1458 | +return m_widget; | ||
1337 | } | 1459 | } |
1338 | 1460 | ||
1339 | -KStyle* allocate() | 1461 | -KStyle* allocate() |
1340 | +QString LiquidInterface::description ( ) | 1462 | +bool LiquidInterface::accept ( ) |
1341 | { | 1463 | { |
1342 | - return(new LiquidStyle); | 1464 | - return(new LiquidStyle); |
1343 | +return QObject::tr( "High Performance Liquid style by Mosfet", "description" ); | 1465 | +if ( !m_widget ) |
1466 | + return false; | ||
1467 | + | ||
1468 | +return m_widget-> writeConfig ( ); | ||
1344 | } | 1469 | } |
1345 | 1470 | ||
1346 | -int minor_version() | 1471 | -int minor_version() |
1347 | +QCString LiquidInterface::key ( ) | 1472 | +void LiquidInterface::reject ( ) |
1348 | { | 1473 | { |
1349 | - return(0); | 1474 | - return(0); |
1350 | +return QCString ( "liquid" ); | ||
1351 | } | 1475 | } |
1352 | 1476 | ||
1353 | -int major_version() | 1477 | -int major_version() |
1354 | +unsigned int LiquidInterface::version ( ) | 1478 | + |
1479 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
1355 | { | 1480 | { |
1356 | - return(1); | 1481 | - return(1); |
1357 | +return 100; // 1.0.0 (\d+.\d.\d) | ||
1358 | } | ||
1359 | |||
1360 | -const char *description() | ||
1361 | +QRESULT LiquidInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
1362 | +{ | ||
1363 | +static LiquidSettingsInterface *setiface = 0; | ||
1364 | + | ||
1365 | +*iface = 0; | 1482 | +*iface = 0; |
1366 | + | 1483 | + |
1367 | +if ( uuid == IID_QUnknown ) | 1484 | +if ( uuid == IID_QUnknown ) |
1368 | + *iface = this; | 1485 | + *iface = this; |
1369 | +else if ( uuid == IID_Style ) | 1486 | +else if ( uuid == IID_Style ) |
1370 | + *iface = this; | 1487 | + *iface = this; |
1371 | +else if ( uuid == IID_StyleSettings ) { | 1488 | +else if ( uuid == IID_StyleExtended ) |
1372 | + if ( !setiface ) | 1489 | + *iface = this; |
1373 | + setiface = new LiquidSettingsInterface ( ); | ||
1374 | + *iface = setiface; | ||
1375 | +} | ||
1376 | + | 1490 | + |
1377 | +if ( *iface ) | 1491 | +if ( *iface ) |
1378 | + (*iface)-> addRef ( ); | 1492 | + (*iface)-> addRef ( ); |
1379 | + | 1493 | + |
1380 | +return QS_OK; | 1494 | +return QS_OK; |
1381 | +} | 1495 | } |
1382 | + | 1496 | |
1497 | -const char *description() | ||
1383 | +Q_EXPORT_INTERFACE() | 1498 | +Q_EXPORT_INTERFACE() |
1384 | +{ | ||
1385 | +Q_CREATE_INSTANCE( LiquidInterface ) | ||
1386 | +} | ||
1387 | + | ||
1388 | + | ||
1389 | +LiquidSettingsInterface::LiquidSettingsInterface ( ) : ref ( 0 ) | ||
1390 | { | 1499 | { |
1391 | - return(i18n("High performance liquid plugin").utf8()); | 1500 | - return(i18n("High performance liquid plugin").utf8()); |
1392 | +m_widget = 0; | 1501 | +Q_CREATE_INSTANCE( LiquidInterface ) |
1393 | } | 1502 | } |
1394 | + | ||
1395 | +LiquidSettingsInterface::~LiquidSettingsInterface ( ) | ||
1396 | +{ | ||
1397 | +} | ||
1398 | + | ||
1399 | +QWidget *LiquidSettingsInterface::create ( QWidget *parent, const char *name ) | ||
1400 | +{ | ||
1401 | +m_widget = new LiquidSettings ( parent, name ? name : "LIQUID-SETTINGS" ); | ||
1402 | + | ||
1403 | +return m_widget; | ||
1404 | +} | ||
1405 | + | ||
1406 | +bool LiquidSettingsInterface::accept ( ) | ||
1407 | +{ | ||
1408 | +if ( !m_widget ) | ||
1409 | + return false; | ||
1410 | + | 1503 | + |
1411 | +return m_widget-> writeConfig ( ); | ||
1412 | +} | ||
1413 | + | 1504 | + |
1414 | +void LiquidSettingsInterface::reject ( ) | 1505 | + |
1415 | +{ | ||
1416 | +} | ||
1417 | + | ||
1418 | +QRESULT LiquidSettingsInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | ||
1419 | +{ | ||
1420 | +*iface = 0; | ||
1421 | + | ||
1422 | + | ||
1423 | +if ( uuid == IID_QUnknown ) | ||
1424 | + *iface = this; | ||
1425 | +else if ( uuid == IID_StyleSettings ) | ||
1426 | + *iface = this; | ||
1427 | + | ||
1428 | +if ( *iface ) | ||
1429 | + (*iface)-> addRef ( ); | ||
1430 | + | ||
1431 | +return QS_OK; | ||
1432 | +} | ||
1433 | + | 1506 | + |
1434 | +// Hack for Retail Z experiments | 1507 | +// Hack for Retail Z experiments |
1435 | +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } | 1508 | +extern "C" { QStyle *allocate ( ) { return new LiquidStyle ( ); } } |