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

Appearance tab. Issue #6363. #6375

Closed
wants to merge 2 commits into from

Conversation

magao
Copy link
Contributor

@magao magao commented Feb 12, 2017

Moves existing options to a new "Appearance tab" as discussed in issue #6363.

appearance_prefs

Changed preferences icons:

Existing Behaviour icon moved to Appearance.
Behaviour now has the gear icon.
WebUI icon changed to qbt-theme/webui.png (which I think it was probably intended to be).

2 new signals emitted from Preferences when theme-related options are changed or dark/light theme change detected:

  • Preferences::configureThemeProvider() emitted first, theme providers (e.g. GuiIconProvider) need to connect directly to ensure they are configured before being used;

  • Preferences::themeChanged() for components that need to update themselves when a theme change occurs.

Both of these signals are emitted before Preferences::changed().

@zeule
Copy link
Contributor

zeule commented Feb 13, 2017

@magao, thank for posting the code! Frankly speaking, I don't like the result of our plan (#6363 (comment)) because it results in overconcentration of responsibilities in the Preferences class: I do believe that neither theme detection nor signals for changes in environment belong to it. But here is no placeholder created for them yet, because of the order in the plan. I belieave the plan needs to be adjusted a bit. Thus perhaps we better create the theme management components (as bare signletons) right away, move settings and signals there (a PR), move current colors and fonts selection into the default theme (a PR), and then add additional themese?

@magao
Copy link
Contributor Author

magao commented Feb 13, 2017

I'll have to think about this some more (just woke up, no caffeine yet ...).

The advantage of having the Preferences object signal themeChanged() is that it makes it trivial to detect changed options that affect the theme.

But we could easily have a mixture of the 2 - a separate GuiPreferences singleton (or maybe ThemePreferences) which handles theme providers and emits themeChanged() once things are configured.

And palette changes would be forwarded to the GuiPreferences.

I don't think we should move the actual preference accessors to it - I think leaving them on Preferences is the way to go.

@zeule
Copy link
Contributor

zeule commented Feb 13, 2017

The advantage of having the Preferences object signal themeChanged() is...

Can not agree with you, sorry. Changes in the environment are not changes in the application preferences.

And there is another point which needs to be raised here: the project tries to move away from concentrating everything in the Preferences class, but instead serialise settings for a component inside the component itself (directly using SettingsStorage). When our settings were not united, there was no common place for them and they were left in the Preferences. Now we introduce a well defined component which will manage the application theme. Therefore we should move those settings out of the Preferences into the corresponding singletons. The options page should access them via these new classes too.

And that is why I proposed to change our roadmap a bit and settle these components before implementing all their future stuff, but not moving it into them later. Thus I propose you to limit this PR within options consolidation in the new options page.

@magao magao changed the title Appearance tab and themeChanged() signal. Issue #6363. Appearance tab. Issue #6363. Feb 16, 2017
@magao
Copy link
Contributor Author

magao commented Feb 16, 2017

@evsh Done. Please set up the code how you want it with the default theme, and once that's merged I'll port my icon fixes (inverting, coloured to match state) and dark/light theme detection on top of the default theme.

Copy link
Contributor

@zeule zeule left a comment

Choose a reason for hiding this comment

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

Sorry, I did not write these remarks last time.

{ "Preferences/Advanced/useSystemIconTheme", "Preferences/Appearance/useSystemIconTheme" },
};

for (QList<QPair<QString, QString>>::iterator iter = prefsToMigrate.begin(); iter != prefsToMigrate.end(); ++iter) {
Copy link
Contributor

@zeule zeule Feb 16, 2017

Choose a reason for hiding this comment

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

you can write:

for (auto  iter = prefsToMigrate.begin(); iter != prefsToMigrate.end(); ++iter) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to that (auto is another C++11 thing I wasn't aware of).

@@ -1611,10 +1642,9 @@ void Preferences::upgrade()
QStringList labels = value("TransferListFilters/customLabels").toStringList();
if (!labels.isEmpty()) {
QVariantMap categories = value("BitTorrent/Session/Categories").toMap();
foreach (const QString &label, labels) {
foreach (const QString &label, labels)
Copy link
Contributor

Choose a reason for hiding this comment

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

for (const QString &label: labels)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was from uncrustify.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I meant that one can use range-based for here too, instead of Qt's foreach macro

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - but my point is that this an automated change in the code cleanup commit - it's not part of the changes for the feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK

@@ -77,13 +77,14 @@ OptionsDialog::OptionsDialog(QWidget *parent)
setModal(true);

// Icons
m_ui->tabSelection->item(TAB_UI)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop"));
m_ui->tabSelection->item(TAB_APPEARANCE)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop"));
m_ui->tabSelection->item(TAB_BEHAVIOUR)->setIcon(GuiIconProvider::instance()->getIcon("gear"));
Copy link
Contributor

Choose a reason for hiding this comment

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

The icon name has to be FDO compatible. "preferences-desktop-theme" seems to be suitable.

Copy link
Contributor Author

@magao magao Feb 16, 2017

Choose a reason for hiding this comment

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

I didn't change the names of any of the icons - just used what was already there.

What is FDO? I don't think you mean Feedback-Directed Optimization - I'm guessing it's something to do with FreeDesktop?

Copy link
Contributor

Choose a reason for hiding this comment

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

FDO stands for FreeDesktop.org, and here is the icon theme specification. You may also look at QIcon::fromTheme() documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd prefer to leave doing any of this to someone who knows something about it e.g. you.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I'll change icon names

Copy link
Contributor

@zeule zeule Feb 17, 2017

Choose a reason for hiding this comment

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

OK, I'll change icon names

No, there will be a problem then at merging. Could you, please, copy the icon "gear" into "preferences-desktop-theme" and change this call to:

m_ui->tabSelection->item(TAB_BEHAVIOUR)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop-theme"));

or, if you do not want to copy the icon:

m_ui->tabSelection->item(TAB_BEHAVIOUR)->setIcon(GuiIconProvider::instance()->getIcon("preferences-desktop-theme", "gear"));

Copy link
Contributor

Choose a reason for hiding this comment

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

Or, no! The icon "preferences-desktop-theme" is for the "Appearance" tab. "preferences-desktop" should be used for the "Behaviour" tab as it is now. Things get complicated :) If you like, leave it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no preferences-desktop-theme.png in the existing codebase. I didn't change any icon names - just moved around the ones that were already being used since we didn't have an icon for the Appearance tab.

I will revert them all (and not have an icon for Appearance) and you can do whatever you want to.

m_ui->tabSelection->item(TAB_BITTORRENT)->setIcon(GuiIconProvider::instance()->getIcon("preferences-system-network"));
m_ui->tabSelection->item(TAB_CONNECTION)->setIcon(GuiIconProvider::instance()->getIcon("network-wired"));
m_ui->tabSelection->item(TAB_DOWNLOADS)->setIcon(GuiIconProvider::instance()->getIcon("folder-download"));
m_ui->tabSelection->item(TAB_SPEED)->setIcon(GuiIconProvider::instance()->getIcon("speedometer", "chronometer"));
#ifndef DISABLE_WEBUI
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(GuiIconProvider::instance()->getIcon("network-server"));
m_ui->tabSelection->item(TAB_WEBUI)->setIcon(GuiIconProvider::instance()->getIcon("webui"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: "network-server" is the name which is found in almost any icon theme.

Copy link
Contributor

Choose a reason for hiding this comment

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

Revert this change, please.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or you may do:

GuiIconProvider::instance()->getIcon("network-server", "webui")

@zeule
Copy link
Contributor

zeule commented Feb 16, 2017

@magao thank you. I will play my round on top of this.

@magao
Copy link
Contributor Author

magao commented Feb 16, 2017

@evsh I'll address the review comments this weekend. I didn't want to change any icon names, etc in this commit - just wanted the minimal changes to get the Appearance tab. Maybe I shouldn't have changed the WebUI icon.

I'm happy for you to reorganise as you think best - the only investment I have in this is that I want to get the changes from my other PR implemented ...

@zeule
Copy link
Contributor

zeule commented Feb 18, 2017

@magao, you forgot to remove cb_use_icon_theme member declaration from advancedsettings.h.

--HG--
branch : magao-dev
@magao
Copy link
Contributor Author

magao commented Feb 19, 2017

@evsh Minimal version pushed - addressed comments, reverted all icon changes.

@zeule
Copy link
Contributor

zeule commented Apr 21, 2017

@LordNyriox, stop your flooding already, please.

@sledgehammer999
Copy link
Member

@magao are you still interested in this? If yes, please rebase.
@evsh is this PR still valid?
Personally, I agree with the icon change in the first post. I also agree that theme management should no be inside Preferences.
However, I don't know if you have already reached a consensus on this somewhere else or this is still pending?

@zeule
Copy link
Contributor

zeule commented Apr 30, 2017

@evsh is this PR still valid?

I'm working on top of this. Current approach is in #6698, and I plan to update it with fully functional color themes part later today.

@FranciscoPombal
Copy link
Member

@magao are you still interested in this?

@FranciscoPombal FranciscoPombal added GUI GUI-related issues/changes Look and feel Affect UI "Look and feel" only without changing the logic labels Feb 27, 2020
@magao
Copy link
Contributor Author

magao commented Feb 27, 2020

Don't really care. If someone else wants to take the code and create a new PR feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI GUI-related issues/changes Look and feel Affect UI "Look and feel" only without changing the logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants