Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/colorselectors/builderselector/buildercolorselector.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU General Public License * | 14 | * You should have received a copy of the GNU General Public License * | ||
15 | * along with this program; if not, write to the * | 15 | * along with this program; if not, write to the * | ||
16 | * Free Software Foundation, Inc., * | 16 | * Free Software Foundation, Inc., * | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
18 | *********************************************************************************/ | 18 | *********************************************************************************/ | ||
19 | 19 | | |||
20 | #include "buildercolorselector.h" | 20 | #include "buildercolorselector.h" | ||
21 | 21 | | |||
22 | #include <QtGui/QMouseEvent> | 22 | #include <QMouseEvent> | ||
23 | #include <QtGui/QLayout> | 23 | #include <QLayout> | ||
24 | #include <QtGui/QRadioButton> | 24 | #include <QRadioButton> | ||
25 | #include <QtGui/QStackedWidget> | 25 | #include <QStackedWidget> | ||
26 | #include <QTabWidget> | ||||
26 | 27 | | |||
27 | #include <KAction> | | |||
28 | #include <KColorUtils> | 28 | #include <KColorUtils> | ||
29 | #include <KColorButton> | 29 | #include <KColorButton> | ||
30 | #include <KTabWidget> | | |||
31 | 30 | | |||
32 | #include "colorutil.h" | 31 | #include "colorutil.h" | ||
33 | 32 | | |||
34 | #include "kcoloredit_settings.h" | 33 | #include "kcoloredit_settings.h" | ||
35 | 34 | | |||
36 | BuilderColorSelector::BuilderColorSelector(QWidget * parent) | 35 | BuilderColorSelector::BuilderColorSelector(QWidget * parent) | ||
37 | : ColorSelector(parent) | 36 | : ColorSelector(parent) | ||
38 | , m_currentSource(0) | 37 | , m_currentSource(0) | ||
39 | { | 38 | { | ||
40 | QWidget *builderWidget = new QWidget(this); | 39 | QWidget *builderWidget = new QWidget(this); | ||
41 | 40 | | |||
42 | m_uiBuilderForm.setupUi(builderWidget); | 41 | m_uiBuilderForm.setupUi(builderWidget); | ||
43 | 42 | | |||
44 | setInputType(Settings::textInput()); | 43 | setInputType(Settings::textInput()); | ||
45 | 44 | | |||
46 | QVBoxLayout *mainLayout = new QVBoxLayout(this); | 45 | QVBoxLayout *mainLayout = new QVBoxLayout(this); | ||
47 | mainLayout->addWidget(builderWidget); | 46 | mainLayout->addWidget(builderWidget); | ||
48 | 47 | | |||
49 | connect(m_uiBuilderForm.buildColorKPushButton, SIGNAL(pressed()), SLOT(buildColor())); | 48 | connect(m_uiBuilderForm.buildColorPushButton, SIGNAL(pressed()), SLOT(buildColor())); | ||
50 | connect(m_uiBuilderForm.controlsInputKTabWidget, SIGNAL(currentChanged(int)), SLOT(setCurrentSource(int))); | 49 | connect(m_uiBuilderForm.controlsInputTabWidget, SIGNAL(currentChanged(int)), SLOT(setCurrentSource(int))); | ||
51 | 50 | | |||
52 | connect(m_uiBuilderForm.controlsInputKTabWidget, SIGNAL(currentChanged(int)), SLOT(setCurrentSource(int))); | 51 | connect(m_uiBuilderForm.controlsInputTabWidget, SIGNAL(currentChanged(int)), SLOT(setCurrentSource(int))); | ||
53 | // valueChanged ( int i ) | 52 | // valueChanged ( int i ) | ||
54 | } | 53 | } | ||
55 | 54 | | |||
56 | void BuilderColorSelector::setInputType(bool textInput) | 55 | void BuilderColorSelector::setInputType(bool textInput) | ||
57 | { | 56 | { | ||
58 | if (textInput) | 57 | if (textInput) | ||
59 | { | 58 | { | ||
60 | m_uiBuilderForm.controlsInputKTabWidget->setVisible(false); | 59 | m_uiBuilderForm.controlsInputTabWidget->setVisible(false); | ||
61 | m_uiBuilderForm.textInputWidget->setVisible(true); | 60 | m_uiBuilderForm.textInputWidget->setVisible(true); | ||
62 | } | 61 | } | ||
63 | else | 62 | else | ||
64 | { | 63 | { | ||
65 | m_uiBuilderForm.controlsInputKTabWidget->setVisible(true); | 64 | m_uiBuilderForm.controlsInputTabWidget->setVisible(true); | ||
66 | m_uiBuilderForm.textInputWidget->setVisible(false); | 65 | m_uiBuilderForm.textInputWidget->setVisible(false); | ||
67 | } | 66 | } | ||
68 | } | 67 | } | ||
69 | 68 | | |||
70 | void BuilderColorSelector::setColor(const QColor & color) | 69 | void BuilderColorSelector::setColor(const QColor & color) | ||
71 | { | 70 | { | ||
72 | Q_UNUSED(color); | 71 | Q_UNUSED(color); | ||
73 | } | 72 | } | ||
74 | 73 | | |||
75 | void BuilderColorSelector::buildColor() | 74 | void BuilderColorSelector::buildColor() | ||
76 | { | 75 | { | ||
77 | //QMessageBox::warning(this, tr("My Application"), QString::number(m_currentSource), QMessageBox::Ok); | 76 | //QMessageBox::warning(this, tr("My Application"), QString::number(m_currentSource), QMessageBox::Ok); | ||
78 | 77 | | |||
79 | emit colorSelected(Qt::yellow); | 78 | emit colorSelected(Qt::yellow); | ||
80 | } | 79 | } | ||
81 | 80 | | |||
82 | void BuilderColorSelector::setCurrentSource(int tabIndex) | 81 | void BuilderColorSelector::setCurrentSource(int tabIndex) | ||
83 | { | 82 | { | ||
84 | m_currentSource = tabIndex; | 83 | m_currentSource = tabIndex; | ||
85 | } | 84 | } | ||
86 | 85 | | |||
87 | // | 86 | // | ||
88 | | ||||
89 | #include "buildercolorselector.moc" | |