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