11#include <QButtonGroup>
12#include <QRadioButton>
15#include <klocalizedstring.h>
16#include <kconfiggroup.h>
18#include <ksharedconfig.h>
35#include "ui_wdgSpecificColorSelectorWidget.h"
41 , m_hsvSlider(nullptr)
42 , m_rgbButton(nullptr)
43 , m_hsxButton(nullptr)
44 , m_hsvSelector(nullptr)
45 , m_colorSpace(nullptr)
48 , m_updateAllowed(true)
50 , m_colorspaceSelector(nullptr)
52 , m_displayConverter(nullptr)
53 , m_converterConnection()
56 m_ui.reset(
new Ui_wdgSpecificColorSelectorWidget());
82 QSpacerItem *hsvButtonSpacer =
new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
86 m_ui->hsvButtonsLayout->addItem(hsvButtonSpacer);
104 m_ui->useSameColorSpace->setChecked(
true);
110 KConfigGroup cfg = KSharedConfig::openConfig()->group(QString());
111 m_ui->chkUsePercentage->setChecked(cfg.readEntry(
"SpecificColorSelector/UsePercentage",
false));
113 m_hsxModeComboBox->setCurrentIndex(cfg.readEntry(
"SpecificColorSelector/HsxMode", 0));
114 m_hsxButton->setChecked(cfg.readEntry(
"SpecificColorSelector/UseHsx",
false));
118 QSpacerItem *bottomSpacer =
new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
119 m_ui->spacerLayout->addItem(bottomSpacer);
124 KConfigGroup cfg = KSharedConfig::openConfig()->group(QString());
125 cfg.writeEntry(
"SpecificColorSelector/UsePercentage",
m_ui->chkUsePercentage->isChecked());
126 cfg.writeEntry(
"SpecificColorSelector/HsxMode",
m_hsxModeComboBox->currentIndex());
127 cfg.writeEntry(
"SpecificColorSelector/UseHsx",
m_hsxButton->isChecked());
133 if (locked && reloadColorSpace) {
140 QWidget::resizeEvent(event);
143 QString elidedColorspaceName =
m_ui->colorspacePopupButton->fontMetrics().elidedText(
145 m_ui->colorspacePopupButton->width()
147 m_ui->colorspacePopupButton->setText(elidedColorspaceName);
190 m_ui->chkUsePercentage->setVisible(
true);
192 m_ui->chkUsePercentage->setVisible(
false);
199 QString elidedColorspaceName =
m_ui->colorspacePopupButton->fontMetrics().elidedText(
201 m_ui->colorspacePopupButton->width()
203 m_ui->colorspacePopupButton->setText(elidedColorspaceName);
246 m_ui->slidersLayout->addWidget(input);
255 Q_FOREACH (QLabel* label, input->findChildren<QLabel*>()) {
256 labels.append(label);
257 labelWidth = qMax(labelWidth, label->sizeHint().width());
261 Q_FOREACH (QLabel *label, labels) {
262 label->setMinimumWidth(labelWidth);
265 bool allChannels8Bit =
true;
268 allChannels8Bit =
false;
271 if (allChannels8Bit) {
317 m_ui->useSameColorSpace->setChecked(
false);
325 input->setPercentageWise(isChecked);
345 if (!isRgbColorSpace) {
349 input->setVisible(
true);
351 m_ui->chkUsePercentage->setEnabled(
true);
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void setCurrentColorSpace(const KoColorSpace *colorSpace)
void showColorBrowserButton(bool showButton)
KoColorDisplayRendererInterface * displayRendererInterface() const
const KoColorSpace * paintingColorSpace() const
static KisDisplayColorConverter * dumbConverterInstance()
void addConnection(Sender sender, Signal signal, Receiver receiver, Method method, Qt::ConnectionType type=Qt::AutoConnection)
@ COLOR
The channel represents a color.
@ UINT8
use this for an unsigned integer 8bits channel
@ UINT16
use this for an integer 16bits channel
@ FLOAT32
use this for a float 32bits channel
@ FLOAT16
use this for a float 16bits channel
@ UINT32
use this for an unsigned integer 21bits channel
enumChannelType channelType() const
enumChannelValueType channelValueType() const
static QList< KoChannelInfo * > displayOrderSorted(const QList< KoChannelInfo * > &channels)
QList< KoChannelInfo * > channels
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
virtual const KoColorProfile * profile() const =0
void fromKoColor(const KoColor &src)
QIcon loadIcon(const QString &name)
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()