Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[style manager] imporve import and export experience, save symbols' tags & favorite flag #3789

Merged
merged 5 commits into from
Nov 21, 2016

Conversation

nirvn
Copy link
Contributor

@nirvn nirvn commented Nov 19, 2016

This PR (greatly, IMHO) improves the usefulness of saved symbols' import and export function by implementing a //TODO within QgsStyle: the import and export of symbols' tags and favorite flag. If someone spends a fair share of time classifying his/her symbols with an elaborate set of tags, not being able to export tags amounts to significant losses.

In order to do so, I've added the possibility of creating a temporary memory spatialite DB that is used to temporarily store a symbol's full set of information (name, xml, favorite, and tags). ( @nyalldawson , this temporary db is very useful for the test unit, it avoids us clashing with symbols we ship by default will testing the QgsStyle class)

On the import front, this opens the door for symbol creators to ship a .XML with a pre-defined tagging structure (v. useful). For users uninterested by pre-defined tags, they are given the option to ignore tags:
untitled2

I've also cleaned up the UI a bit, mostly by making the import / export symbol preview list use padding for its icons, as well as making sure the icons are aligned to a grid to avoid a sense of chaos:
untitled
Ahhh, orderly presentation & symbol padding

@nirvn
Copy link
Contributor Author

nirvn commented Nov 19, 2016

Small note regarding import of symbols and favorites: for the "Import symbol(s)" dialog, accessed through the style manager, the favorite flag attached to symbols within a .xml file is ignored in favor of the "Add to favorite" check box, which makes more sense.

However, in the coming week, I'm planning to change the way QGIS creates its default style db (i.e. the symbology-ng.db copied by default in the ~/.qgis3 user directry), and it'll use the favorite flag declared within a given default-shipped-symbols.xml file. But more on that later 😄

@nyalldawson
Copy link
Collaborator

Very nice! I'd suggest "don't import tags" or just "ignore existing tags" would be easier strings. The grid improvement makes a huge difference!

@@ -273,6 +273,9 @@ class CORE_EXPORT QgsStyle : public QObject
//! Changes ramp's name
bool renameColorRamp( const QString& oldName, const QString& newName );

//! Creates a temporary memory database
bool createMemoryDB();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we want to make public? I'd lean toward making it private and making TestStyle a friend class of QgsStyle.

Copy link
Collaborator

@nyalldawson nyalldawson Nov 19, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, ignore that. It does look useful. I'd just expand on the docs to explain why you'd want to call this and what effect it has (something like "if you don't want to associate the style with an on-disk database, ...etc". I'd also make a note in the load() docs.

@nirvn
Copy link
Contributor Author

nirvn commented Nov 19, 2016

"Don't import embedded tags"?

@nyalldawson
Copy link
Collaborator

Maybe"do not import embedded tags" is better... I'm not sure if don't is too informal

@nirvn
Copy link
Contributor Author

nirvn commented Nov 19, 2016

@nyalldawson , comments addressed in updated set of commits.

@DelazJ
Copy link
Contributor

DelazJ commented Nov 19, 2016

Once again, nice work!
With the grid alignment (which looks great), long labels are unfortunately split and hidden. Would that make sense to allow multiline label?

@DelazJ
Copy link
Contributor

DelazJ commented Nov 19, 2016

Could you also add a [feature] tag to the appropriate commits, in order to ease retrieval of new features for 3.0 changelog and create issues in the doc repo?

@nirvn
Copy link
Contributor Author

nirvn commented Nov 20, 2016

@DelazJ, there's a bottleneck in Qt QListView that don't allow for such a multiline label scenario. However, to try and mediate the situation, I've committed the following changes:

  • reduced the font size to 10pt to display a few more characters per label
  • add a tooltip to the icon (visible when placing your mouse over a symbol) which shows the full name as well as associated tag(s)
    untitled

I've also added a [FEATURE] tag to the relevant commit, thanks for pointing that out.

@nirvn
Copy link
Contributor Author

nirvn commented Nov 21, 2016

@nyalldawson , when you have a minute, this PR is ready to merge.

@nyalldawson nyalldawson merged commit ee71077 into qgis:master Nov 21, 2016
@nirvn
Copy link
Contributor Author

nirvn commented Nov 21, 2016

@nyalldawson , thanks.

@nirvn nirvn deleted the style_import_export_imp branch February 26, 2018 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants