summaryrefslogtreecommitdiff
path: root/noncore/settings/appearance2/editScheme.cpp
authorsandman <sandman>2002-09-20 01:42:10 (UTC)
committer sandman <sandman>2002-09-20 01:42:10 (UTC)
commitb1f3d33cb0b3f203f153074a8812d5988c3031b2 (patch) (unidiff)
tree1734ac2808dab8f0982b23a2a9101486fcdcfee5 /noncore/settings/appearance2/editScheme.cpp
parent9204c61f669fb265f6c5f14bfd6ca363a2929e40 (diff)
downloadopie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.zip
opie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.tar.gz
opie-b1f3d33cb0b3f203f153074a8812d5988c3031b2.tar.bz2
New experimental appearance settings
Diffstat (limited to 'noncore/settings/appearance2/editScheme.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/editScheme.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp
new file mode 100644
index 0000000..2453c7b
--- a/dev/null
+++ b/noncore/settings/appearance2/editScheme.cpp
@@ -0,0 +1,83 @@
1/**********************************************************************
2** EditScheme
3**
4** Dialog for editing color scheme
5**
6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org
8** http://draknor.net
9**
10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file.
14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17**
18**********************************************************************/
19
20#include "editScheme.h"
21
22#include "opie/colorpopupmenu.h"
23
24#include <qaction.h>
25#include <qlabel.h>
26#include <qlayout.h>
27#include <qpopupmenu.h>
28#include <qscrollview.h>
29#include <qtoolbutton.h>
30
31EditScheme::EditScheme( QWidget* parent, const char* name, bool modal, WFlags fl,
32 int max, QString list[], QString colors[] )
33 : QDialog( parent, name, modal, fl )
34{
35 setCaption( tr( "Edit scheme" ) );
36 QGridLayout* layout = new QGridLayout( this );
37 layout->setSpacing( 4 );
38 layout->setMargin( 4 );
39
40
41 maxCount = max;
42 int i;
43 QLabel* label;
44 ColorPopupMenu* colorPopupMenu;
45 for ( i = 0; i < max; i++ )
46 {
47 colorList[i] = colors[i];
48 surfaceList[i] = list[i];
49 label = new QLabel( tr( surfaceList[i] ), this );
50 layout->addWidget( label, i, 0 );
51 colorButtons[i] = new QToolButton( this, list[i] );
52 colorButtons[i]->setPalette( QPalette( QColor( colors[i] ) ) );
53 layout->addWidget( colorButtons[i], i, 1 );
54
55 colorPopupMenu = new ColorPopupMenu( colors[i], 0, list[i] );
56 colorButtons[i]->setPopup( colorPopupMenu );
57 colorButtons[i]->setPopupDelay( 0 );
58 connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );
59 }
60}
61
62EditScheme::~EditScheme()
63{
64}
65
66void EditScheme::changeColor( const QColor& color )
67{
68 QString name( sender()->name() );
69 int i;
70
71 for ( i = 0; i < maxCount; i++ )
72 {
73 if ( name == colorButtons[i]->name() )
74 {
75 break;
76 }
77 }
78 if ( i < maxCount && name == colorButtons[i]->name() )
79 {
80 colorList[i] = color.name();
81 colorButtons[i]->setPalette( QPalette( QColor( colorList[i] ) ) );
82 }
83}