Commit c1931d24 authored by Scott Petrovic's avatar Scott Petrovic

separate selecting presets in the brush editor with the engine filter

parent 568c9786
......@@ -627,7 +627,8 @@ void KisPaintopBox::setCurrentPaintop(KisPaintOpPresetSP preset)
QString pixFilename = KoResourcePaths::findResource("kis_images", paintOp->pixmap());
m_brushEditorPopupButton->setIcon(QIcon(pixFilename));
m_presetsPopup->setCurrentPaintOp(paintop.id());
m_presetsPopup->setCurrentPaintOpId(paintop.id());
////qDebug() << "\tsetting the new preset for" << m_currTabletToolID.uniqueID << "to" << preset->name();
m_paintOpPresetMap[m_resourceProvider->currentPreset()->paintOp()] = preset;
......@@ -635,7 +636,7 @@ void KisPaintopBox::setCurrentPaintop(KisPaintOpPresetSP preset)
m_tabletToolMap[m_currTabletToolID].paintOpID = preset->paintOp();
if (m_presetsPopup->currentPaintOp() != paintop.id()) {
if (m_presetsPopup->currentPaintOpId() != paintop.id()) {
// Must change the paintop as the current one is not supported
// by the new colorspace.
dbgKrita << "current paintop " << paintop.name() << " was not set, not supported by colorspace";
......
......@@ -270,7 +270,7 @@ KisPaintOpPresetsPopup::KisPaintOpPresetsPopup(KisCanvasResourceProvider * resou
resource(KisCanvasResourceProvider::LodAvailability));
connect(m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPaintOpChanged(int)));
connect(m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdatePaintOpFilter()));
}
......@@ -483,35 +483,11 @@ void KisPaintOpPresetsPopup::setPaintOpList(const QList< KisPaintOpFactory* >& l
}
void KisPaintOpPresetsPopup::setCurrentPaintOp(const QString& paintOpId)
void KisPaintOpPresetsPopup::setCurrentPaintOpId(const QString& paintOpId)
{
// iterate through the items and find the engine we need the combo box to switch to
for (int i= 0; i < m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->count(); i++) {
QVariant userData = m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->itemData(i); // grab paintOpID from data
QString currentPaintOpId = userData.toString();
if (paintOpId == currentPaintOpId) {
m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->setCurrentIndex(i); // found it!
}
}
// if the "all" option is set, set the filter to "", that way it clears the filter and shows everything
QString paintOpFilter = paintOpId;
if (paintOpFilter == "all_options") {
paintOpFilter = "";
}
m_d->uiWdgPaintOpPresetSettings.presetWidget->setPresetFilter(paintOpFilter);
current_paintOpId = paintOpId;
}
QString KisPaintOpPresetsPopup::currentPaintOp()
{
QVariant userData = m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->currentData(); // grab paintOpID from data
QString currentPaintOpId = userData.toString();
return currentPaintOpId;
}
QString KisPaintOpPresetsPopup::currentPaintOpId() {
return current_paintOpId;
......@@ -567,17 +543,16 @@ void KisPaintOpPresetsPopup::slotSwitchShowPresets(bool visible) {
m_d->uiWdgPaintOpPresetSettings.presetsContainer->setVisible(visible);
}
void KisPaintOpPresetsPopup::slotPaintOpChanged(int index) {
Q_UNUSED(index);
void KisPaintOpPresetsPopup::slotUpdatePaintOpFilter() {
QVariant userData = m_d->uiWdgPaintOpPresetSettings.brushEgineComboBox->currentData(); // grab paintOpID from data
QString currentPaintOpId = userData.toString();
QString filterPaintOpId = userData.toString();
setCurrentPaintOp(currentPaintOpId);
emit paintopActivated(currentPaintOpId); // tell the toolbar to change the active icon
}
if (filterPaintOpId == "all_options") {
filterPaintOpId = "";
}
m_d->uiWdgPaintOpPresetSettings.presetWidget->setPresetFilter(filterPaintOpId);
}
void KisPaintOpPresetsPopup::updateViewSettings()
{
......@@ -585,8 +560,11 @@ void KisPaintOpPresetsPopup::updateViewSettings()
}
void KisPaintOpPresetsPopup::currentPresetChanged(KisPaintOpPresetSP preset)
{
{
m_d->uiWdgPaintOpPresetSettings.presetWidget->smallPresetChooser->setCurrentResource(preset.data());
setCurrentPaintOpId(preset->paintOp().id());
emit paintopActivated(currentPaintOpId()); // tell the toolbar to change the active icon
}
void KisPaintOpPresetsPopup::updateThemedIcons()
......
......@@ -58,8 +58,7 @@ public:
void setPaintOpList(const QList<KisPaintOpFactory*>& list);
void setCurrentPaintOp(const QString & paintOpId);
QString currentPaintOp();
void setCurrentPaintOpId(const QString & paintOpId);
/// returns the internal ID for the paint op (brush engine)
QString currentPaintOpId();
......@@ -108,7 +107,7 @@ private Q_SLOTS:
void slotResourceChanged(int key, const QVariant &value);
void slotLodAvailabilityChanged(bool value);
void slotSwitchShowEditor(bool visible);
void slotPaintOpChanged(int index);
void slotUpdatePaintOpFilter();
void slotSwitchShowPresets(bool visible);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment