Commit 11eaaf35 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Restore the last-used color only on startup

We save the last used color only on application exit, when the
KisViewManager object is deleted, so we should only read the option
on creating the KisViewManager, not every time we create a new
view.

BUG:394816
parent ae410a3d
......@@ -287,6 +287,7 @@ KisViewManager::KisViewManager(QWidget *parent, KActionCollection *_actionCollec
d->controlFrame.setup(parent);
//Check to draw scrollbars after "Canvas only mode" toggle is created.
this->showHideScrollbars();
......@@ -317,6 +318,13 @@ KisViewManager::KisViewManager(QWidget *parent, KActionCollection *_actionCollec
KisConfig cfg;
d->showFloatingMessage = cfg.showCanvasMessages();
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));
}
......@@ -435,13 +443,6 @@ void KisViewManager::setCurrentView(KisView *view)
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());
......
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