1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _tcColourMapWidget_h_
21 #define _tcColourMapWidget_h_
24 * @file tcColourMapWidget.h
25 * @brief Colour mapping widget.
28 #include <QScrollArea>
35 /// Colour mapping widget.
36 class tcColourMapWidget
: public QScrollArea
43 * Constructors + destructor
46 /// Construct with colour information.
47 tcColourMapWidget(const QStringList
& outputBands
, QWidget
* parent
);
50 virtual ~tcColourMapWidget();
57 void clearInputBands();
59 /// Add an input band.
60 void addInputBand(const QString
& name
, const QString
& description
);
62 /// Add an input band group separator.
63 void addInputGroupSeparator(const QString
& name
);
69 /// Get the index of the input band assigned to an output band.
70 int inputBand(int outputBand
) const;
78 /// Set the input band assigned to an output.
79 void setInputBand(int output
, int input
);
87 /// Emitted when an input band is clicked.
88 void inputBandClicked(int input
, int inputGroup
);
90 /// Emitted when an input group is clicked.
91 void inputGroupClicked(int group
);
93 /// Emitted when the input band assigned to an output is changed.
94 void inputBandChanged(int output
, int input
, int inputGroup
);
102 /// Indicates that an input band has been clicked.
103 void inputBandClickedSlot(int input
);
105 /// Indicates that the input band assigned to an output has changed.
106 void inputBandChangedSlot(int output
);
114 /// Get the input group and adjust the band number to be relative to the input group.
115 int inputGroup(int* band
);
123 /// Main layout of the widget.
124 QGridLayout
* m_layout
;
126 /// Input label signal mapper.
127 QSignalMapper
* m_inputSignalMapper
;
129 /// Input group signal mapper.
130 QSignalMapper
* m_inputGroupSignalMapper
;
132 /// Group signal mapper.
133 QSignalMapper
* m_groupSignalMapper
;
139 /// Radio button groups for each output band.
140 QList
<QButtonGroup
*> m_outputBandButtonGroups
;
142 /// Number of input colour bands.
145 /// Number of input bands per group.
146 QList
<int> m_numInputBandsPerGroup
;