-rw-r--r-- | microkde/kcolordialog.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/microkde/kcolordialog.cpp b/microkde/kcolordialog.cpp index 9a76e5e..a3d8973 100644 --- a/microkde/kcolordialog.cpp +++ b/microkde/kcolordialog.cpp | |||
@@ -1,92 +1,93 @@ | |||
1 | #include "kcolordialog.h" | 1 | #include "kcolordialog.h" |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qslider.h> | 5 | #include <qslider.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | #include <qapplication.h> | 7 | #include <qapplication.h> |
8 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
9 | 9 | ||
10 | #include <kglobal.h> | 10 | #include <kglobal.h> |
11 | QColor KColorDialog::getColor( ) const | 11 | QColor KColorDialog::getColor( ) const |
12 | { | 12 | { |
13 | QColor c ( r->value(), g->value(), b->value() ); | 13 | QColor c ( r->value(), g->value(), b->value() ); |
14 | lar->setText ( "R: " + QString::number ( c.red() ) ); | 14 | lar->setText ( "R: " + QString::number ( c.red() ) ); |
15 | lag->setText ( "G: " + QString::number ( c.green() ) ); | 15 | lag->setText ( "G: " + QString::number ( c.green() ) ); |
16 | lab->setText ( "B: " + QString::number ( c.blue() ) ); | 16 | lab->setText ( "B: " + QString::number ( c.blue() ) ); |
17 | return c; | 17 | return c; |
18 | } | 18 | } |
19 | void KColorDialog::setColor( const QColor & d ) | 19 | void KColorDialog::setColor( const QColor & d ) |
20 | { | 20 | { |
21 | r->setValue(d.red() ); | 21 | r->setValue(d.red() ); |
22 | g->setValue(d.green() ); | 22 | g->setValue(d.green() ); |
23 | b->setValue(d.blue() ); | 23 | b->setValue(d.blue() ); |
24 | old_color->setPalette( QPalette( d.dark(), d ) ); | 24 | old_color->setPalette( QPalette( d.dark(), d ) ); |
25 | lar->setText ( "R: " + QString::number ( d.red() ) ); | 25 | lar->setText ( "R: " + QString::number ( d.red() ) ); |
26 | lag->setText ( "G: " + QString::number ( d.green() ) ); | 26 | lag->setText ( "G: " + QString::number ( d.green() ) ); |
27 | lab->setText ( "B: " + QString::number ( d.blue() ) ); | 27 | lab->setText ( "B: " + QString::number ( d.blue() ) ); |
28 | 28 | ||
29 | } | 29 | } |
30 | KColorDialog::KColorDialog( QWidget *p ):QDialog( p, "input-dialog", true ) | 30 | KColorDialog::KColorDialog( QWidget *p ):QDialog( p, "input-dialog", true ) |
31 | { | 31 | { |
32 | setCaption( i18n("Choose Color") ); | 32 | setCaption( i18n("Choose Color") ); |
33 | 33 | ||
34 | setMaximumSize( QApplication::desktop()->width() - 20, QApplication::desktop()->height() - 40 ); // for zaurus 5500er. | 34 | setMaximumSize( QApplication::desktop()->width() - 20, QApplication::desktop()->height() - 40 ); // for zaurus 5500er. |
35 | QGridLayout* lay = new QGridLayout ( this, 4, 2 ); | 35 | QGridLayout* lay = new QGridLayout ( this, 4, 2 ); |
36 | lay->setSpacing( 6 ); | 36 | lay->setSpacing( 6 ); |
37 | lay->setMargin( 11 ); | 37 | lay->setMargin( 11 ); |
38 | 38 | ||
39 | old_color = new QLabel("Old color",this); | 39 | old_color = new QLabel("Old color",this); |
40 | old_color->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 40 | old_color->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
41 | old_color->setLineWidth( 1 ); | 41 | old_color->setLineWidth( 1 ); |
42 | lay->addWidget(old_color, 0, 0); | 42 | lay->addWidget(old_color, 0, 0); |
43 | 43 | ||
44 | new_color = new QLabel("New color", this); | 44 | new_color = new QLabel("New color", this); |
45 | new_color->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 45 | new_color->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
46 | new_color->setLineWidth( 1 ); | 46 | new_color->setLineWidth( 1 ); |
47 | lay->addWidget(new_color, 0, 1); | 47 | lay->addWidget(new_color, 0, 1); |
48 | new_color->setAlignment( AlignCenter ); | 48 | new_color->setAlignment( AlignCenter ); |
49 | 49 | ||
50 | QHBox* hb = new QHBox ( this ); | 50 | QHBox* hb = new QHBox ( this ); |
51 | lar = new QLabel( hb ); | 51 | lar = new QLabel( hb ); |
52 | lag = new QLabel( hb ); | 52 | lag = new QLabel( hb ); |
53 | lab = new QLabel( hb ); | 53 | lab = new QLabel( hb ); |
54 | lay->addMultiCellWidget( hb,1,1, 0,1 ); | 54 | lay->addMultiCellWidget( hb,1,1, 0,1 ); |
55 | 55 | ||
56 | QLabel* lr = new QLabel ( "Red:", this ); | 56 | QLabel* lr = new QLabel ( "Red:", this ); |
57 | lay->addWidget( lr,2,0 ); | 57 | lay->addWidget( lr,2,0 ); |
58 | r = new QSlider ( 0, 255, 1, 1, Horizontal, this ); | 58 | r = new QSlider ( 0, 255, 1, 1, Horizontal, this ); |
59 | lay->addWidget(r ,2,1 ); | 59 | lay->addWidget(r ,2,1 ); |
60 | 60 | ||
61 | QLabel* lg = new QLabel( "Green:",this ); | 61 | QLabel* lg = new QLabel( "Green:",this ); |
62 | lay->addWidget(lg ,3,0 ); | 62 | lay->addWidget(lg ,3,0 ); |
63 | g = new QSlider ( 0, 255, 1, 1, Horizontal, this ); | 63 | g = new QSlider ( 0, 255, 1, 1, Horizontal, this ); |
64 | lay->addWidget( g ,3,1 ); | 64 | lay->addWidget( g ,3,1 ); |
65 | 65 | ||
66 | QLabel* lb = new QLabel ( "Blue:",this ); | 66 | QLabel* lb = new QLabel ( "Blue:",this ); |
67 | lay->addWidget( lb,4,0 ); | 67 | lay->addWidget( lb,4,0 ); |
68 | b = new QSlider ( 0, 255, 1, 1, Horizontal, this ); | 68 | b = new QSlider ( 0, 255, 1, 1, Horizontal, this ); |
69 | lay->addWidget(b ,4,1 ); | 69 | lay->addWidget(b ,4,1 ); |
70 | 70 | ||
71 | QColor d = backgroundColor(); | 71 | QColor d = backgroundColor(); |
72 | r->setValue(d.red() ); | 72 | r->setValue(d.red() ); |
73 | g->setValue(d.green() ); | 73 | g->setValue(d.green() ); |
74 | b->setValue(d.blue() ); | 74 | b->setValue(d.blue() ); |
75 | old_color->setPalette( QPalette( d.dark() , d ) ); | 75 | old_color->setPalette( QPalette( d.dark() , d ) ); |
76 | // kannst du wieder reinnehmen, aber es geht auch so. | 76 | // kannst du wieder reinnehmen, aber es geht auch so. |
77 | QPushButton * ok = new QPushButton (i18n(" OK "), this ); | 77 | QPushButton * ok = new QPushButton (i18n(" OK "), this ); |
78 | ok->setDefault( true ); | ||
78 | QPushButton * cancel = new QPushButton (i18n(" Cancel "), this ); | 79 | QPushButton * cancel = new QPushButton (i18n(" Cancel "), this ); |
79 | 80 | ||
80 | lay->addWidget(ok ,5,0 ); | 81 | lay->addWidget(ok ,5,0 ); |
81 | lay->addWidget(cancel ,5,1 ); | 82 | lay->addWidget(cancel ,5,1 ); |
82 | connect (ok, SIGNAL( clicked() ), this ,SLOT (accept() )); | 83 | connect (ok, SIGNAL( clicked() ), this ,SLOT (accept() )); |
83 | connect (cancel, SIGNAL( clicked() ), this ,SLOT (reject() )); | 84 | connect (cancel, SIGNAL( clicked() ), this ,SLOT (reject() )); |
84 | connect (r, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); | 85 | connect (r, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); |
85 | connect (g, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); | 86 | connect (g, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); |
86 | connect (b, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); | 87 | connect (b, SIGNAL( valueChanged ( int ) ), this ,SLOT (updateColor( int ) )); |
87 | } | 88 | } |
88 | void KColorDialog::updateColor( int ) | 89 | void KColorDialog::updateColor( int ) |
89 | { | 90 | { |
90 | QColor c = getColor( ) ; | 91 | QColor c = getColor( ) ; |
91 | new_color->setPalette( QPalette( c.dark(), c ) ); | 92 | new_color->setPalette( QPalette( c.dark(), c ) ); |
92 | } | 93 | } |