Commit 65caf817 authored by Halla Rempt's avatar Halla Rempt

BUG:373846 Fix creating a brush from a stamp

If you'd create an image, and then without changing brush preset
would try to use that image as a new stamp, it would fail because
the preset editor was initialized before the image was added to
to the viewmanager.
parent e51b5f13
...@@ -320,7 +320,7 @@ void KisViewManager::slotViewAdded(KisView *view) ...@@ -320,7 +320,7 @@ void KisViewManager::slotViewAdded(KisView *view)
{ {
d->inputManager.addTrackedCanvas(view->canvasBase()); d->inputManager.addTrackedCanvas(view->canvasBase());
if (viewCount() == 0) { if (viewCount() != 0) {
d->statusBar.showAllStatusBarItems(); d->statusBar.showAllStatusBarItems();
} }
} }
...@@ -350,30 +350,6 @@ void KisViewManager::setCurrentView(KisView *view) ...@@ -350,30 +350,6 @@ void KisViewManager::setCurrentView(KisView *view)
d->viewConnections.clear(); d->viewConnections.clear();
} }
// Restore the last used brush preset, color and background color.
if (first) {
KisConfig cfg;
KisPaintOpPresetResourceServer * rserver = KisResourceServerProvider::instance()->paintOpPresetServer();
QString lastPreset = cfg.readEntry("LastPreset", QString("Basic_tip_default"));
KisPaintOpPresetSP preset = rserver->resourceByName(lastPreset);
if (!preset) {
preset = rserver->resourceByName("Basic_tip_default");
}
if (!preset) {
preset = rserver->resources().first();
}
if (preset) {
paintOpBox()->restoreResource(preset.data());
}
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor foreground(Qt::black, cs);
d->canvasResourceProvider.setFGColor(cfg.readKoColor("LastForeGroundColor",foreground));
KoColor background(Qt::white, cs);
d->canvasResourceProvider.setBGColor(cfg.readKoColor("LastBackGroundColor",background));
}
d->softProof->setChecked(view->softProofing()); d->softProof->setChecked(view->softProofing());
d->gamutCheck->setChecked(view->gamutCheck()); d->gamutCheck->setChecked(view->gamutCheck());
...@@ -386,6 +362,31 @@ void KisViewManager::setCurrentView(KisView *view) ...@@ -386,6 +362,31 @@ void KisViewManager::setCurrentView(KisView *view)
// connect(canvasController()->proxyObject, SIGNAL(documentMousePositionChanged(QPointF)), d->statusBar, SLOT(documentMousePositionChanged(QPointF))); // connect(canvasController()->proxyObject, SIGNAL(documentMousePositionChanged(QPointF)), d->statusBar, SLOT(documentMousePositionChanged(QPointF)));
d->currentImageView = imageView; d->currentImageView = imageView;
// Restore the last used brush preset, color and background color.
if (first) {
KisConfig cfg;
KisPaintOpPresetResourceServer * rserver = KisResourceServerProvider::instance()->paintOpPresetServer();
QString lastPreset = cfg.readEntry("LastPreset", QString("Basic_tip_default"));
KisPaintOpPresetSP preset = rserver->resourceByName(lastPreset);
if (!preset) {
preset = rserver->resourceByName("Basic_tip_default");
}
if (!preset) {
preset = rserver->resources().first();
}
if (preset) {
paintOpBox()->restoreResource(preset.data());
}
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8();
KoColor foreground(Qt::black, cs);
d->canvasResourceProvider.setFGColor(cfg.readKoColor("LastForeGroundColor",foreground));
KoColor background(Qt::white, cs);
d->canvasResourceProvider.setBGColor(cfg.readKoColor("LastBackGroundColor",background));
}
KisCanvasController *canvasController = dynamic_cast<KisCanvasController*>(d->currentImageView->canvasController()); KisCanvasController *canvasController = dynamic_cast<KisCanvasController*>(d->currentImageView->canvasController());
d->viewConnections.addUniqueConnection(&d->nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)), doc->image(), SLOT(requestStrokeEndActiveNode())); d->viewConnections.addUniqueConnection(&d->nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)), doc->image(), SLOT(requestStrokeEndActiveNode()));
...@@ -411,7 +412,7 @@ void KisViewManager::setCurrentView(KisView *view) ...@@ -411,7 +412,7 @@ void KisViewManager::setCurrentView(KisView *view)
imageView->zoomManager()->setShowRulers(d->showRulersAction->isChecked()); imageView->zoomManager()->setShowRulers(d->showRulersAction->isChecked());
imageView->zoomManager()->setRulersTrackMouse(d->rulersTrackMouseAction->isChecked()); imageView->zoomManager()->setRulersTrackMouse(d->rulersTrackMouseAction->isChecked());
showHideScrollbars(); showHideScrollbars();
} }
...@@ -454,6 +455,8 @@ void KisViewManager::setCurrentView(KisView *view) ...@@ -454,6 +455,8 @@ void KisViewManager::setCurrentView(KisView *view)
resourceProvider()->slotImageSizeChanged(); resourceProvider()->slotImageSizeChanged();
resourceProvider()->slotOnScreenResolutionChanged(); resourceProvider()->slotOnScreenResolutionChanged();
Q_EMIT viewChanged(); Q_EMIT viewChanged();
} }
......
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