summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/colordialog.cpp56
-rw-r--r--libopie/colordialog.h22
-rw-r--r--libopie/colorpopupmenu.cpp2
3 files changed, 40 insertions, 40 deletions
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp
index 6d72ff6..684d6ea 100644
--- a/libopie/colordialog.cpp
+++ b/libopie/colordialog.cpp
@@ -1,10 +1,10 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Implementation of QColorDialog class 4** Implementation of OColorDialog class
5** 5**
6** Created : 990222 6** Created : 990222
7** 7**
8** Copyright (C) 1999-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the dialogs module of the Qt GUI Toolkit. 10** This file is part of the dialogs module of the Qt GUI Toolkit.
@@ -473,55 +473,55 @@ QColorShower::QColorShower( QWidget *parent, const char *name )
473 this, SIGNAL( newCol( QRgb ) ) ); 473 this, SIGNAL( newCol( QRgb ) ) );
474 connect( lab, SIGNAL( colorDropped( QRgb ) ), 474 connect( lab, SIGNAL( colorDropped( QRgb ) ),
475 this, SLOT( setRgb( QRgb ) ) ); 475 this, SLOT( setRgb( QRgb ) ) );
476 476
477 hEd = new QColNumLineEdit( this ); 477 hEd = new QColNumLineEdit( this );
478 hEd->setValidator( val360 ); 478 hEd->setValidator( val360 );
479 QLabel *l = new QLabel( hEd, QColorDialog::tr("Hue:"), this ); 479 QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this );
480 l->setAlignment( AlignRight|AlignVCenter ); 480 l->setAlignment( AlignRight|AlignVCenter );
481 gl->addWidget( l, 0, 1 ); 481 gl->addWidget( l, 0, 1 );
482 gl->addWidget( hEd, 0, 2 ); 482 gl->addWidget( hEd, 0, 2 );
483 483
484 sEd = new QColNumLineEdit( this ); 484 sEd = new QColNumLineEdit( this );
485 sEd->setValidator( val256 ); 485 sEd->setValidator( val256 );
486 l = new QLabel( sEd, QColorDialog::tr("Sat:"), this ); 486 l = new QLabel( sEd, OColorDialog::tr("Sat:"), this );
487 l->setAlignment( AlignRight|AlignVCenter ); 487 l->setAlignment( AlignRight|AlignVCenter );
488 gl->addWidget( l, 1, 1 ); 488 gl->addWidget( l, 1, 1 );
489 gl->addWidget( sEd, 1, 2 ); 489 gl->addWidget( sEd, 1, 2 );
490 490
491 vEd = new QColNumLineEdit( this ); 491 vEd = new QColNumLineEdit( this );
492 vEd->setValidator( val256 ); 492 vEd->setValidator( val256 );
493 l = new QLabel( vEd, QColorDialog::tr("Val:"), this ); 493 l = new QLabel( vEd, OColorDialog::tr("Val:"), this );
494 l->setAlignment( AlignRight|AlignVCenter ); 494 l->setAlignment( AlignRight|AlignVCenter );
495 gl->addWidget( l, 2, 1 ); 495 gl->addWidget( l, 2, 1 );
496 gl->addWidget( vEd, 2, 2 ); 496 gl->addWidget( vEd, 2, 2 );
497 497
498 rEd = new QColNumLineEdit( this ); 498 rEd = new QColNumLineEdit( this );
499 rEd->setValidator( val256 ); 499 rEd->setValidator( val256 );
500 l = new QLabel( rEd, QColorDialog::tr("Red:"), this ); 500 l = new QLabel( rEd, OColorDialog::tr("Red:"), this );
501 l->setAlignment( AlignRight|AlignVCenter ); 501 l->setAlignment( AlignRight|AlignVCenter );
502 gl->addWidget( l, 0, 3 ); 502 gl->addWidget( l, 0, 3 );
503 gl->addWidget( rEd, 0, 4 ); 503 gl->addWidget( rEd, 0, 4 );
504 504
505 gEd = new QColNumLineEdit( this ); 505 gEd = new QColNumLineEdit( this );
506 gEd->setValidator( val256 ); 506 gEd->setValidator( val256 );
507 l = new QLabel( gEd, QColorDialog::tr("Green:"), this ); 507 l = new QLabel( gEd, OColorDialog::tr("Green:"), this );
508 l->setAlignment( AlignRight|AlignVCenter ); 508 l->setAlignment( AlignRight|AlignVCenter );
509 gl->addWidget( l, 1, 3 ); 509 gl->addWidget( l, 1, 3 );
510 gl->addWidget( gEd, 1, 4 ); 510 gl->addWidget( gEd, 1, 4 );
511 511
512 bEd = new QColNumLineEdit( this ); 512 bEd = new QColNumLineEdit( this );
513 bEd->setValidator( val256 ); 513 bEd->setValidator( val256 );
514 l = new QLabel( bEd, QColorDialog::tr("Blue:"), this ); 514 l = new QLabel( bEd, OColorDialog::tr("Blue:"), this );
515 l->setAlignment( AlignRight|AlignVCenter ); 515 l->setAlignment( AlignRight|AlignVCenter );
516 gl->addWidget( l, 2, 3 ); 516 gl->addWidget( l, 2, 3 );
517 gl->addWidget( bEd, 2, 4 ); 517 gl->addWidget( bEd, 2, 4 );
518 518
519 alphaEd = new QColNumLineEdit( this ); 519 alphaEd = new QColNumLineEdit( this );
520 alphaEd->setValidator( val256 ); 520 alphaEd->setValidator( val256 );
521 alphaLab = new QLabel( alphaEd, QColorDialog::tr("Alpha channel:"), this ); 521 alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this );
522 alphaLab->setAlignment( AlignRight|AlignVCenter ); 522 alphaLab->setAlignment( AlignRight|AlignVCenter );
523 gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); 523 gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 );
524 gl->addWidget( alphaEd, 3, 4 ); 524 gl->addWidget( alphaEd, 3, 4 );
525 alphaEd->hide(); 525 alphaEd->hide();
526 alphaLab->hide(); 526 alphaLab->hide();
527 527
@@ -604,17 +604,17 @@ void QColorShower::setHsv( int h, int s, int v )
604 bEd->setNum( qBlue(currentColor()) ); 604 bEd->setNum( qBlue(currentColor()) );
605 605
606 606
607 showCurrentColor(); 607 showCurrentColor();
608} 608}
609 609
610class QColorDialogPrivate : public QObject 610class OColorDialogPrivate : public QObject
611{ 611{
612Q_OBJECT 612Q_OBJECT
613public: 613public:
614 QColorDialogPrivate( QColorDialog *p ); 614 OColorDialogPrivate( OColorDialog *p );
615 QRgb currentColor() const { return cs->currentColor(); } 615 QRgb currentColor() const { return cs->currentColor(); }
616 void setCurrentColor( QRgb rgb ); 616 void setCurrentColor( QRgb rgb );
617 617
618 int currentAlpha() const { return cs->currentAlpha(); } 618 int currentAlpha() const { return cs->currentAlpha(); }
619 void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } 619 void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); }
620 void showAlpha( bool b ) { cs->showAlpha( b ); } 620 void showAlpha( bool b ) { cs->showAlpha( b ); }
@@ -626,36 +626,36 @@ private:
626 QColorPicker *cp; 626 QColorPicker *cp;
627 QColorLuminancePicker *lp; 627 QColorLuminancePicker *lp;
628 QColorShower *cs; 628 QColorShower *cs;
629}; 629};
630 630
631//sets all widgets to display h,s,v 631//sets all widgets to display h,s,v
632void QColorDialogPrivate::newHsv( int h, int s, int v ) 632void OColorDialogPrivate::newHsv( int h, int s, int v )
633{ 633{
634 cs->setHsv( h, s, v ); 634 cs->setHsv( h, s, v );
635 cp->setCol( h, s ); 635 cp->setCol( h, s );
636 lp->setCol( h, s, v ); 636 lp->setCol( h, s, v );
637} 637}
638 638
639//sets all widgets to display rgb 639//sets all widgets to display rgb
640void QColorDialogPrivate::setCurrentColor( QRgb rgb ) 640void OColorDialogPrivate::setCurrentColor( QRgb rgb )
641{ 641{
642 cs->setRgb( rgb ); 642 cs->setRgb( rgb );
643 newColorTypedIn( rgb ); 643 newColorTypedIn( rgb );
644} 644}
645 645
646//sets all widgets exept cs to display rgb 646//sets all widgets exept cs to display rgb
647void QColorDialogPrivate::newColorTypedIn( QRgb rgb ) 647void OColorDialogPrivate::newColorTypedIn( QRgb rgb )
648{ 648{
649 int h, s, v; 649 int h, s, v;
650 rgb2hsv(rgb, h, s, v ); 650 rgb2hsv(rgb, h, s, v );
651 cp->setCol( h, s ); 651 cp->setCol( h, s );
652 lp->setCol( h, s, v); 652 lp->setCol( h, s, v);
653} 653}
654 654
655QColorDialogPrivate::QColorDialogPrivate( QColorDialog *dialog ) : 655OColorDialogPrivate::OColorDialogPrivate( OColorDialog *dialog ) :
656 QObject(dialog) 656 QObject(dialog)
657{ 657{
658 int border = 2; 658 int border = 2;
659 QVBoxLayout *topLay = new QVBoxLayout( dialog, border, 2 ); 659 QVBoxLayout *topLay = new QVBoxLayout( dialog, border, 2 );
660 660
661 QHBoxLayout *pickLay = new QHBoxLayout( topLay ); 661 QHBoxLayout *pickLay = new QHBoxLayout( topLay );
@@ -682,14 +682,14 @@ QColorDialogPrivate::QColorDialogPrivate( QColorDialog *dialog ) :
682 682
683} 683}
684 684
685 685
686// BEING REVISED: jo 686// BEING REVISED: jo
687/*! 687/*!
688 \class QColorDialog qcolordialog.h 688 \class OColorDialog OColorDialog.h
689 \brief The QColorDialog class provides a dialog widget for specifying colors. 689 \brief The OColorDialog class provides a dialog widget for specifying colors.
690 \ingroup dialogs 690 \ingroup dialogs
691 691
692 The color dialog's function is to allow users to choose colors - 692 The color dialog's function is to allow users to choose colors -
693 for instance, you might use this in a drawing program to allow the 693 for instance, you might use this in a drawing program to allow the
694 user to set the brush color. 694 user to set the brush color.
695 695
@@ -709,37 +709,37 @@ QColorDialogPrivate::QColorDialogPrivate( QColorDialog *dialog ) :
709/*! 709/*!
710 Constructs a default color dialog. Use setColor() for setting an initial value. 710 Constructs a default color dialog. Use setColor() for setting an initial value.
711 711
712 \sa getColor() 712 \sa getColor()
713*/ 713*/
714 714
715QColorDialog::QColorDialog(QWidget* parent, const char* name, bool modal) : 715OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) :
716 QDialog(parent, name, modal ) 716 QDialog(parent, name, modal )
717{ 717{
718 d = new QColorDialogPrivate( this ); 718 d = new OColorDialogPrivate( this );
719} 719}
720 720
721 721
722/*! 722/*!
723 Pops up a modal color dialog letting the user choose a color and returns 723 Pops up a modal color dialog letting the user choose a color and returns
724 that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels 724 that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels
725 the dialog. All colors allocated by the dialog will be deallocated 725 the dialog. All colors allocated by the dialog will be deallocated
726 before this function returns. 726 before this function returns.
727*/ 727*/
728 728
729QColor QColorDialog::getColor( QColor initial, QWidget *parent, 729QColor OColorDialog::getColor( QColor initial, QWidget *parent,
730 const char *name ) 730 const char *name )
731{ 731{
732 int allocContext = QColor::enterAllocContext(); 732 int allocContext = QColor::enterAllocContext();
733 QColorDialog *dlg = new QColorDialog( parent, name, TRUE ); //modal 733 OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal
734 if ( parent && parent->icon() && !parent->icon()->isNull() ) 734 if ( parent && parent->icon() && !parent->icon()->isNull() )
735 dlg->setIcon( *parent->icon() ); 735 dlg->setIcon( *parent->icon() );
736 else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) 736 else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
737 dlg->setIcon( *qApp->mainWidget()->icon() ); 737 dlg->setIcon( *qApp->mainWidget()->icon() );
738 738
739 dlg->setCaption( QColorDialog::tr( "Select color" ) ); 739 dlg->setCaption( OColorDialog::tr( "Select color" ) );
740 dlg->setColor( initial ); 740 dlg->setColor( initial );
741 dlg->showMaximized(); 741 dlg->showMaximized();
742 int resultCode = dlg->exec(); 742 int resultCode = dlg->exec();
743 QColor::leaveAllocContext(); 743 QColor::leaveAllocContext();
744 QColor result; 744 QColor result;
745 if ( resultCode == QDialog::Accepted ) { 745 if ( resultCode == QDialog::Accepted ) {
@@ -760,17 +760,17 @@ QColor QColorDialog::getColor( QColor initial, QWidget *parent,
760 If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK, 760 If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK,
761 and FALSE if the user clicked Cancel. 761 and FALSE if the user clicked Cancel.
762 762
763 If the user clicks Cancel the \a initial value is returned. 763 If the user clicks Cancel the \a initial value is returned.
764*/ 764*/
765 765
766QRgb QColorDialog::getRgba( QRgb initial, bool *ok, 766QRgb OColorDialog::getRgba( QRgb initial, bool *ok,
767 QWidget *parent, const char* name ) 767 QWidget *parent, const char* name )
768{ 768{
769 int allocContext = QColor::enterAllocContext(); 769 int allocContext = QColor::enterAllocContext();
770 QColorDialog *dlg = new QColorDialog( parent, name, TRUE ); //modal 770 OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal
771 dlg->setColor( initial ); 771 dlg->setColor( initial );
772 dlg->setSelectedAlpha( qAlpha(initial) ); 772 dlg->setSelectedAlpha( qAlpha(initial) );
773 dlg->showMaximized(); 773 dlg->showMaximized();
774 int resultCode = dlg->exec(); 774 int resultCode = dlg->exec();
775 QColor::leaveAllocContext(); 775 QColor::leaveAllocContext();
776 QRgb result = initial; 776 QRgb result = initial;
@@ -794,58 +794,58 @@ QRgb QColorDialog::getRgba( QRgb initial, bool *ok,
794/*! 794/*!
795 Returns the color currently selected in the dialog. 795 Returns the color currently selected in the dialog.
796 796
797 \sa setColor() 797 \sa setColor()
798*/ 798*/
799 799
800QColor QColorDialog::color() const 800QColor OColorDialog::color() const
801{ 801{
802 return QColor(d->currentColor()); 802 return QColor(d->currentColor());
803} 803}
804 804
805 805
806/*! Destructs the dialog and frees any memory it allocated. 806/*! Destructs the dialog and frees any memory it allocated.
807 807
808*/ 808*/
809 809
810QColorDialog::~QColorDialog() 810OColorDialog::~OColorDialog()
811{ 811{
812 //d inherits QObject, so it is deleted by Qt. 812 //d inherits QObject, so it is deleted by Qt.
813} 813}
814 814
815 815
816/*! 816/*!
817 Sets the color shown in the dialog to \a c. 817 Sets the color shown in the dialog to \a c.
818 818
819 \sa color() 819 \sa color()
820*/ 820*/
821 821
822void QColorDialog::setColor( QColor c ) 822void OColorDialog::setColor( QColor c )
823{ 823{
824 d->setCurrentColor( c.rgb() ); 824 d->setCurrentColor( c.rgb() );
825} 825}
826 826
827 827
828 828
829 829
830/*! 830/*!
831 Sets the initial alpha channel value to \a a, and show the alpha channel 831 Sets the initial alpha channel value to \a a, and show the alpha channel
832 entry box. 832 entry box.
833*/ 833*/
834 834
835void QColorDialog::setSelectedAlpha( int a ) 835void OColorDialog::setSelectedAlpha( int a )
836{ 836{
837 d->showAlpha( TRUE ); 837 d->showAlpha( TRUE );
838 d->setCurrentAlpha( a ); 838 d->setCurrentAlpha( a );
839} 839}
840 840
841 841
842/*! 842/*!
843 Returns the value selected for the alpha channel. 843 Returns the value selected for the alpha channel.
844*/ 844*/
845 845
846int QColorDialog::selectedAlpha() const 846int OColorDialog::selectedAlpha() const
847{ 847{
848 return d->currentAlpha(); 848 return d->currentAlpha();
849} 849}
850 850
851#include "colordialog.moc" 851#include "colordialog.moc"
diff --git a/libopie/colordialog.h b/libopie/colordialog.h
index a2d4d30..474bc61 100644
--- a/libopie/colordialog.h
+++ b/libopie/colordialog.h
@@ -1,10 +1,10 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Definition of QColorDialog class 4** Definition of OColorDialog class
5** 5**
6** Created : 990222 6** Created : 990222
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the dialogs module of the Qt GUI Toolkit. 10** This file is part of the dialogs module of the Qt GUI Toolkit.
@@ -32,46 +32,46 @@
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#ifndef QCOLORDIALOG_H 38#ifndef OColorDialog_H
39#define QCOLORDIALOG_H 39#define OColorDialog_H
40 40
41#ifndef QT_H 41#ifndef QT_H
42#include <qdialog.h> 42#include <qdialog.h>
43#endif // QT_H 43#endif // QT_H
44 44
45class QColorDialogPrivate; 45class OColorDialogPrivate;
46 46
47class Q_EXPORT QColorDialog : public QDialog 47class Q_EXPORT OColorDialog : public QDialog
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 50
51public: 51public:
52 static QColor getColor( QColor, QWidget *parent=0, const char* name=0 ); // ### 3.0: make const QColor& 52 static QColor getColor( QColor, QWidget *parent=0, const char* name=0 ); // ### 3.0: make const QColor&
53 static QRgb getRgba( QRgb, bool* ok = 0, 53 static QRgb getRgba( QRgb, bool* ok = 0,
54 QWidget *parent=0, const char* name=0 ); 54 QWidget *parent=0, const char* name=0 );
55 55
56private: 56private:
57 ~QColorDialog(); 57 ~OColorDialog();
58 58
59 QColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); 59 OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE );
60 void setColor( QColor ); // ### 3.0: make const QColor& 60 void setColor( QColor ); // ### 3.0: make const QColor&
61 QColor color() const; 61 QColor color() const;
62 62
63private: 63private:
64 void setSelectedAlpha( int ); 64 void setSelectedAlpha( int );
65 int selectedAlpha() const; 65 int selectedAlpha() const;
66private: 66private:
67 QColorDialogPrivate *d; 67 OColorDialogPrivate *d;
68 friend class QColorDialogPrivate; 68 friend class OColorDialogPrivate;
69 69
70 private:// Disabled copy constructor and operator= 70 private:// Disabled copy constructor and operator=
71#if defined(Q_DISABLE_COPY) 71#if defined(Q_DISABLE_COPY)
72 QColorDialog( const QColorDialog & ); 72 OColorDialog( const OColorDialog & );
73 QColorDialog& operator=( const QColorDialog & ); 73 OColorDialog& operator=( const OColorDialog & );
74#endif 74#endif
75}; 75};
76 76
77#endif 77#endif
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp
index 35e91f4..9b50a8b 100644
--- a/libopie/colorpopupmenu.cpp
+++ b/libopie/colorpopupmenu.cpp
@@ -155,11 +155,11 @@ void ColorPopupMenu::buttonSelected( const QColor& color )
155 emit colorSelected( color ); 155 emit colorSelected( color );
156 hide(); 156 hide();
157} 157}
158 158
159void ColorPopupMenu::moreColorClicked() 159void ColorPopupMenu::moreColorClicked()
160{ 160{
161 QColor color = QColorDialog::getColor( m_color ); 161 QColor color = OColorDialog::getColor( m_color );
162 m_color = color; 162 m_color = color;
163 emit colorSelected( color ); 163 emit colorSelected( color );
164 hide(); 164 hide();
165} 165}