Fix crash if key bindings specified in profile cannot be found. Improve
[personal-kdebase.git] / apps / konsole / src / ColorSchemeEditor.h
blob5ae6d1d2ba4f119f17910e6ba2b145273622c6f7
1 /*
2 Copyright 2007-2008 by Robert Knight <robertknight@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301 USA.
20 #ifndef COLORSCHEMEEDITOR_H
21 #define COLORSCHEMEEDITOR_H
23 // Qt
24 #include <QtGui/QWidget>
26 // Konsole
27 #include "ColorScheme.h"
29 class QTableWidgetItem;
31 namespace Ui
33 class ColorSchemeEditor;
36 namespace Konsole
39 class ColorScheme;
41 /**
42 * A dialog for editing color schemes.
44 * After creation, the dialog can be initialised with the settings
45 * of a color scheme using the setup() method.
47 * The dialog creates a copy of the supplied color scheme to which
48 * any changes made are applied. The modified color scheme
49 * can be retrieved using the colorScheme() method.
51 * When changes are made the colorsChanged() signal is emitted.
53 class ColorSchemeEditor : public QWidget
55 Q_OBJECT
57 public:
58 /** Constructs a new color scheme editor with the specified parent. */
59 ColorSchemeEditor(QWidget* parent = 0);
60 virtual ~ColorSchemeEditor();
62 /** Initialises the dialog with the properties of the specified color scheme. */
63 void setup(const ColorScheme* scheme);
64 /** Returns the modified color scheme. */
65 ColorScheme* colorScheme() const;
67 signals:
68 /** Emitted when the colors in the color scheme change. */
69 void colorsChanged(ColorScheme* scheme);
71 public slots:
72 /** Sets the text displayed in the description edit field. */
73 void setDescription(const QString& description);
75 private slots:
76 void setTransparencyPercentLabel(int percent);
77 void setRandomizedBackgroundColor(bool randomized);
78 void editColorItem(QTableWidgetItem* item);
80 private:
81 void setupColorTable(const ColorScheme* table);
83 Ui::ColorSchemeEditor* _ui;
84 ColorScheme* _colors;
89 #endif // COLORSCHEMEEDITOR_H