Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Merge remote-tracking branch 'origin/master' into bourumir/357493-retain-color-history

Dmitry Kazakov8637392f38e2
diff --cc libs/resources/KoCanvasResourcesIds.h
index 66b8826973,f8b4b3b731..fd5edb5107
--- a/libs/resources/KoCanvasResourcesIds.h
+++ b/libs/resources/KoCanvasResourcesIds.h
@@@ -58,7 -59,10 +59,11 @@@ enum CanvasResourceId
PreviousPaintOpPreset,
EffectiveZoom, ///<-Used only by painting tools for non-displaying purposes
EffectivePhysicalZoom, ///<-Used by tool for displaying purposes
+ BrushRotation,
+ HandleRadius, ///< The handle radius used for drawing handles of any kind
+ DecorationThickness, ///< Integer, the thickness of single px decorations, will be adjusted by HiDPI settings. Because most of our decorations are drawn without anti-aliasing, this is an integer, so that line thickness won't vary as the painter tries round the floating point.
+ UsingOtherColor, ///<- a boolean that is controlled by the tool invocation action
+ ColorHistory // Color history if not per document
};
}
diff --cc libs/ui/KisDocument.cpp
index 53fbfb3160,019cb9a134..eb940a9445
--- a/libs/ui/KisDocument.cpp
+++ b/libs/ui/KisDocument.cpp
@@@ -389,8 -391,10 +393,11 @@@ public
StoryboardItemList m_storyboardItemList;
QVector<StoryboardComment> m_storyboardCommentList;
+ QVector<QFileInfo> audioTracks;
+ qreal audioLevel = 1.0;
+
QColor globalAssistantsColor;
+ QList<KoColor> colorHistory;
KisGridConfig gridConfig;
diff --cc libs/ui/KisViewManager.cpp
index 78da46bdcf,a1da921e62..2a88e2c09a
--- a/libs/ui/KisViewManager.cpp
+++ b/libs/ui/KisViewManager.cpp
@@@ -320,12 -356,8 +357,12 @@@ KisViewManager::~KisViewManager(
cfg.writeKoColor("LastBackGroundColor",canvasResourceProvider()->bgColor());
}
+ if (canvasResourceProvider()) {
+ cfg.writeKoColors("LastColorHistory", canvasResourceProvider()->colorHistory());
+ }
+
cfg.writeEntry("baseLength", KisResourceItemChooserSync::instance()->baseLength());
- cfg.writeEntry("CanvasOnlyActive", false); // We never restart in CavnasOnlyMode
+ cfg.writeEntry("CanvasOnlyActive", false); // We never restart in CanvasOnlyMode
delete d;
}
diff --cc plugins/dockers/advancedcolorselector/kis_color_history.cpp
index dd1856c92e,a39bce2cd8..4250ce4db3
--- a/plugins/dockers/advancedcolorselector/kis_color_history.cpp
+++ b/plugins/dockers/advancedcolorselector/kis_color_history.cpp
@@@ -79,70 -66,9 +79,62 @@@ void KisColorHistory::addColorToHistory
// don't add color in erase mode. See https://bugs.kde.org/show_bug.cgi?id=298940
if (m_resourceProvider && m_resourceProvider->currentCompositeOp() == COMPOSITE_ERASE) return;
- QList<KoColor> history = colorHistory();
+ KisColorPatches::addColorPatch(color);
+
- history.removeAll(color);
- history.prepend(color);
-
- //the history holds 200 colors, but not all are displayed
- if (history.size() > 200) {
- history.removeLast();
- }
-
- updateColorHistory(history);
- s_color_history_change_notifier->notifyColorHistoryChanged(history);
++ updateColorHistory(colors());
++ s_color_history_change_notifier->notifyColorHistoryChanged(colors());
+}
+
+void KisColorHistory::clearColorHistory()
+{
+ QList<KoColor> empty;
+ updateColorHistory(empty);
+ s_color_history_change_notifier->notifyColorHistoryChanged(empty);
+}
+
+QList<KoColor> KisColorHistory::colorHistory()
+{
+ if (m_history_per_document && m_document) {
+ return m_document->colorHistory();
+ } else if (m_resourceProvider) {
+ return m_resourceProvider->colorHistory();
+ } else {
+ return QList<KoColor>();
+ }
+}
+
+void KisColorHistory::updateColorHistory(const QList<KoColor> &history)
+{
+ if (m_history_per_document && m_document) {
+ m_document->setColorHistory(history);
+ } else if (m_resourceProvider) {
+ m_resourceProvider->setColorHistory(history);
+ }
+ setColors(history);
+}
+
+void KisColorHistory::updateStrategy()
+{
+ KisConfig config(true);
+ m_history_per_document = config.colorHistoryPerDocument();
+ updateColorHistory(colorHistory()); // Show with respect to the current strategy
+}
+
+void KisColorHistory::colorHistoryChanged(const QList<KoColor> &history)
+{
+ if (sender() != this) {
+ if (m_history_per_document) {
+ // The document is shared also across windows to passed history is not required.
+ // Differently, the update may contain the history for another document.
+ updateColorHistory(colorHistory());
+ } else {
+ // The resource provider is per window so needs an update if the history must be global.
+ updateColorHistory(history);
+ }
+ }
}
-void KisColorHistory::clearColorHistory() {
- setColors(QList<KoColor>());
+void KisColorHistoryNotifier::notifyColorHistoryChanged(const QList<KoColor> &history)
+{
+ emit colorHistoryChanged(history);
}
diff --cc plugins/dockers/advancedcolorselector/kis_color_history.h
index bae3c48f02,0b4831b3c1..685484edd9
--- a/plugins/dockers/advancedcolorselector/kis_color_history.h
+++ b/plugins/dockers/advancedcolorselector/kis_color_history.h
@@@ -28,24 -27,8 +28,23 @@@ public Q_SLOTS
void addColorToHistory(const KoColor& color);
void clearColorHistory();
+
+ void updateStrategy();
+
+ // Receive notification that the color history changed in some selector
+ void colorHistoryChanged(const QList<KoColor> &history);
+
private:
+ // Get reference to the relevant color history, either from resource provider or doucment.
+ QList<KoColor> colorHistory();
+
+ // Write the changed color history where it is stored, depending on the settings.
+ void updateColorHistory(const QList<KoColor> &history);
+
+ bool m_history_per_document = false;
+
QToolButton* m_clearButton;
-
+ KisDocument *m_document; // Color history is now stored in the document
KisCanvasResourceProvider *m_resourceProvider; // to disconnect...
};
diff --cc plugins/impex/libkra/kis_kra_loader.cpp
index f2cdc1b9a6,df58614143..67493bf9cd
--- a/plugins/impex/libkra/kis_kra_loader.cpp
+++ b/plugins/impex/libkra/kis_kra_loader.cpp
@@@ -322,9 -321,11 +325,10 @@@ KisImageSP KisKraLoader::loadXML(const
}
}
-
if(e.tagName()== PROOFINGWARNINGCOLOR) {
QDomDocument dom;
- KoXml::asQDomElement(dom, e);
+ QDomNode node = e;
+ dom.appendChild(dom.importNode(node, true));
QDomElement eq = dom.firstChildElement();
proofingConfig->warningColor = KoColor::fromXML(eq.firstChildElement(), Integer8BitsColorDepthID.id());
}
diff --cc plugins/impex/libkra/kis_kra_loader.h
index 8252a369cc,4b441136d4..cfc7921cd6
--- a/plugins/impex/libkra/kis_kra_loader.h
+++ b/plugins/impex/libkra/kis_kra_loader.h
@@@ -113,11 -114,9 +116,10 @@@ private
void loadGrid(const QDomElement& elem);
void loadGuides(const QDomElement& elem);
void loadMirrorAxis(const QDomElement& elem);
- void loadAudio(const QDomElement& elem, KisImageSP image);
void loadStoryboardItemList(const QDomElement& elem);
void loadStoryboardCommentList(const QDomElement& elem);
-
+ void loadAudioXML(QDomDocument& xmlDoc, QDomElement &xmlElement, KisDocument* kisDoc);
+ QList<KoColor> loadKoColors(const QDomElement& elem) const;
private:
struct Private;
diff --cc plugins/impex/libkra/kis_kra_saver.cpp
index eabb0aa1a5,e188716c3c..8c274cb47a
--- a/plugins/impex/libkra/kis_kra_saver.cpp
+++ b/plugins/impex/libkra/kis_kra_saver.cpp
@@@ -142,8 -142,6 +142,7 @@@ QDomElement KisKraSaver::saveXML(QDomDo
saveGrid(doc, imageElement);
saveGuides(doc, imageElement);
saveMirrorAxis(doc, imageElement);
- saveAudio(doc, imageElement);
+ saveColorHistory(doc, imageElement);
saveResourcesToXML(doc, imageElement);
// Redundancy -- Save animation metadata in XML to prevent data loss for the time being...