Preset ico library widget.
ClosedPublic

Authored by woltherav on Nov 11 2017, 6:54 PM.

Details

Reviewers
dkazakov
Group Reviewers
Krita
Maniphest Tasks
T7435: Brush tip preset library.
Summary

For T7435, this...

  • Adds a resource folder named preset_icon, which contains tool_icons and emblem_icons. These are filled with pngs.
  • Adds a little dialog for loading and combining the above pngs into a preset icon, with some sliders to adjust the look of the tool icon.

Things that need to be considered:

  1. Do we want to create the folders for the icons in the user's resource directory too?
  2. Maybe the grid for the tool icons should just have two side by side...
  3. The last slider is actually a super-simple levels filter, how should we go about naming it properly?
Test Plan

How to use:

Go to brush settings->save new preset and in the new window select "Load from icon library".

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
woltherav edited the summary of this revision. (Show Details)Nov 11 2017, 6:57 PM

Do you have a branch with this committed? The diff doesn't include the binary files (PNGs).

Do you have a branch with this committed? The diff doesn't include the binary files (PNGs).

Ack! Pushed it to Wolthera/T7435-preset-icon-library

dkazakov added a subscriber: dkazakov.EditedNov 14 2017, 4:47 PM

The patch doesn't compile on Qt 5.6.1. Here is the fix :)

I just pushed the fix into the branch.

1diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
2index cf0c812..5c975c5 100644
3--- a/libs/image/kis_image.cc
4+++ b/libs/image/kis_image.cc
5@@ -1712,10 +1712,7 @@ void KisImage::setProofingConfiguration(KisProofingConfigurationSP proofingConfi
6
7 KisProofingConfigurationSP KisImage::proofingConfiguration() const
8 {
9- if (m_d->proofingConfig) {
10- return m_d->proofingConfig;
11- }
12- return 0;
13+ return m_d->proofingConfig;
14 }
15
16 QPointF KisImage::mirrorAxesCenter() const
17diff --git a/libs/ui/canvas/kis_canvas2.cpp b/libs/ui/canvas/kis_canvas2.cpp
18index ed54646..4de130f 100644
19--- a/libs/ui/canvas/kis_canvas2.cpp
20+++ b/libs/ui/canvas/kis_canvas2.cpp
21@@ -610,7 +610,7 @@ void KisCanvas2::setProofingOptions(bool softProof, bool gamutCheck)
22 m_d->proofingConfig = cfg.defaultProofingconfiguration();
23 }
24 KoColorConversionTransformation::ConversionFlags conversionFlags = m_d->proofingConfig->conversionFlags;
25-#if QT_VERSION >= 0x07000
26+#if QT_VERSION >= 0x070000
27 if (this->image()->colorSpace()->colorDepthId().id().contains("U")) {
28 conversionFlags.setFlag(KoColorConversionTransformation::SoftProofing, softProof);
29 if (softProof) {
30@@ -628,7 +628,7 @@ void KisCanvas2::setProofingOptions(bool softProof, bool gamutCheck)
31 } else {
32 conversionFlags = conversionFlags & ~KoColorConversionTransformation::GamutCheck;
33 }
34-#endif;
35+#endif
36 m_d->proofingConfig->conversionFlags = conversionFlags;
37
38 m_d->proofingConfigUpdated = true;
39diff --git a/libs/ui/dialogs/kis_dlg_image_properties.cc b/libs/ui/dialogs/kis_dlg_image_properties.cc
40index 16f8eb7..b218a48 100644
41--- a/libs/ui/dialogs/kis_dlg_image_properties.cc
42+++ b/libs/ui/dialogs/kis_dlg_image_properties.cc
43@@ -164,10 +164,10 @@ void KisDlgImageProperties::setProofingConfig()
44 if (m_page->chkSaveProofing->isChecked()) {
45
46 m_proofingConfig->conversionFlags = KoColorConversionTransformation::HighQuality;
47-#if QT_VERSION >= 0x07000
48+#if QT_VERSION >= 0x070000
49 m_proofingConfig->conversionFlags.setFlag(KoColorConversionTransformation::BlackpointCompensation, m_page->ckbBlackPointComp->isChecked());
50 #else
51- m_page->chkBlackPointComp->isChecked() ?
52+ m_page->ckbBlackPointComp->isChecked() ?
53 m_proofingConfig->conversionFlags |= KoColorConversionTransformation::BlackpointCompensation
54 : m_proofingConfig->conversionFlags = m_proofingConfig->conversionFlags & ~KoColorConversionTransformation::BlackpointCompensation;
55
56@@ -182,7 +182,7 @@ void KisDlgImageProperties::setProofingConfig()
57 m_image->setProofingConfiguration(m_proofingConfig);
58 }
59 else {
60- m_image->setProofingConfiguration(0);
61+ m_image->setProofingConfiguration(KisProofingConfigurationSP());
62 }
63 }
64

Ah, seems this was already fixed on master, so I went and merged and then fixed the merge conflicts to fit master.

dkazakov accepted this revision.Nov 14 2017, 6:11 PM

The patch looks fine. I would propose to add two small improvements, but they are not too critical:

  1. When the library dialog is closed and then open back, the state of the dialog is reset. It would be nice if it would be saved at least during a single save operation.
  2. It would be nice to make the right column fixed size, with the size of the preview. Otherwise, the layout doesn't look nice when one resize the dialog (there is empty space to the right from the preview):

Otherwise the patch looks fine, just fix two inline comments and push the patch.

libs/ui/KisApplication.cpp
285

Yes, I think you should add these lines. Even empty folders suggest the user where to put his own emblems.

libs/ui/widgets/kis_paintop_preset_icon_library.cpp
151

Please be more careful with spaces between the numerical signs, like '*', '=', etc.

values[v] = qMax(qMin((int)((128.0 / (qreal)(255 - level)) * (v - level) + 128.0), 255), 0);

I've also seen the same problem in other places.

You can also use qreal's and int's constructors instead of conversion operators, it usually looks a bit clearer:

int(128.0 / qreal(255 - level))

Though it is not in the policy, so the latter thing is not mandatory :)

This revision is now accepted and ready to land.Nov 14 2017, 6:11 PM
woltherav closed this revision.EditedNov 15 2017, 3:10 PM

merged! The only ting that didn't get in is saving the icon, as that wasn't seen as too useful...

I also wasn't able to get the second column tiny, so instead I opted to center the preset preview, which makes it seem a little more intentional.