Commit e38c5056 authored by Scott Petrovic's avatar Scott Petrovic

Swap out underscores for spaces in labels when displaying brush preset names

parent 2f888b32
......@@ -105,9 +105,10 @@ public: // Krita specific interfaces
* KisView will take care of removing the items when the view GUI is deactivated
* and readding them when it is reactivated.
* The parameters are the same as QStatusBar::addWidget().
*/
*/
void addStatusBarItem(QWidget * widget, int stretch = 0, bool permanent = false);
/**
* Remove a widget from the statusbar for this view.
*/
......
......@@ -184,6 +184,11 @@ void KisTool::deactivate()
void KisTool::canvasResourceChanged(int key, const QVariant & v)
{
QString formattedBrushName;
if (key == KisCanvasResourceProvider::CurrentPaintOpPreset) {
QString formattedBrushName = v.value<KisPaintOpPresetSP>()->name().replace("_", " ");
}
switch (key) {
case(KoCanvasResourceManager::ForegroundColor):
d->currentFgColor = v.value<KoColor>();
......@@ -204,7 +209,7 @@ void KisTool::canvasResourceChanged(int key, const QVariant & v)
d->currentGenerator = static_cast<KisFilterConfiguration*>(v.value<void *>());
break;
case(KisCanvasResourceProvider::CurrentPaintOpPreset):
emit statusTextChanged(v.value<KisPaintOpPresetSP>()->name());
emit statusTextChanged(formattedBrushName);
break;
case(KisCanvasResourceProvider::CurrentKritaNode):
resetCursorStyle();
......
......@@ -170,7 +170,11 @@ void KisToolPaint::canvasResourceChanged(int key, const QVariant& v)
void KisToolPaint::activate(ToolActivation toolActivation, const QSet<KoShape*> &shapes)
{
if (currentPaintOpPreset()) emit statusTextChanged(currentPaintOpPreset()->name());
if (currentPaintOpPreset()) {
QString formattedBrushName = currentPaintOpPreset()->name().replace("_", " ");
emit statusTextChanged(formattedBrushName);
}
KisTool::activate(toolActivation, shapes);
connect(action("increase_brush_size"), SIGNAL(triggered()), SLOT(increaseBrushSize()), Qt::UniqueConnection);
connect(action("decrease_brush_size"), SIGNAL(triggered()), SLOT(decreaseBrushSize()), Qt::UniqueConnection);
......
......@@ -531,11 +531,13 @@ void KisPaintOpPresetsPopup::resourceSelected(KoResource* resource)
}
}
QString selectedBrush = resource->name();
// brush names have underscores as part of the file name (to help with building). We don't really need underscores
// when viewing the names, so replace them with spaces
QString formattedBrushName = resource->name().replace("_", " ");
m_d->uiWdgPaintOpPresetSettings.currentBrushNameLabel->setText(selectedBrush);
m_d->uiWdgPaintOpPresetSettings.currentBrushNameLabel->setText(formattedBrushName);
m_d->uiWdgPaintOpPresetSettings.currentBrushEngineLabel->setText(currentBrushEngineName.append(" ").append("Engine"));
m_d->uiWdgPaintOpPresetSettings.renameBrushNameTextField->setText(resource->name());
m_d->uiWdgPaintOpPresetSettings.renameBrushNameTextField->setText(resource->name()); // use file name
// get the preset image and pop it into the thumbnail area on the top of the brush editor
......
......@@ -116,8 +116,10 @@ void KisPresetDelegate::paint(QPainter * painter, const QStyleOptionViewItem & o
brushSizeText = QString::number(brushSize, 'f', 0);
}
painter->drawText(pixSize.width() + 10, option.rect.y() + option.rect.height() - 10, brushSizeText);
painter->drawText(pixSize.width() + 40, option.rect.y() + option.rect.height() - 10, preset->name().append(dirtyPresetIndicator));
painter->drawText(pixSize.width() + 10, option.rect.y() + option.rect.height() - 10, brushSizeText); // brush size
QString presetDisplayName = preset->name().replace("_", " "); // don't need underscores that might be part of the file name
painter->drawText(pixSize.width() + 40, option.rect.y() + option.rect.height() - 10, presetDisplayName.append(dirtyPresetIndicator));
}
if (m_useDirtyPresets && preset->isPresetDirty()) {
......
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