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

Icon themes: Active-Directory (line, duotone, color) #425

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LenkaDEA
Copy link
Contributor

Added icon themes: Active-Directory-line, Active-Directory-duotone, Active-Directory-color
Icon themes are set separately: https://github.com/LenkaDEA/admc_icons/tree/themes

@@ -341,7 +342,10 @@ void console_query_tree_init(ConsoleWidget *console) {
const QList<QStandardItem *> root_row = console->add_scope_item(ItemType_QueryFolder, QModelIndex());
auto root = root_row[0];
root->setText(QCoreApplication::translate("query", "Saved Queries"));
root->setIcon(QIcon::fromTheme("folder"));

const QIcon create_query_folder_icon = g_icon_manager->get_object_icon("folder-query");
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not related to the commit topic. Better move to another commit or create refactor branch

@@ -533,7 +537,9 @@ QModelIndex console_query_folder_create(ConsoleWidget *console, const QString &n
void console_query_folder_load(const QList<QStandardItem *> &row, const QString &name, const QString &description) {
QStandardItem *main_item = row[0];
main_item->setData(description, QueryItemRole_Description);
main_item->setIcon(QIcon::fromTheme("folder"));

const QIcon create_query_folder_icon = g_icon_manager->get_object_icon("folder-query");
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not related to the commit topic. Better move to another commit or create refactor branch

@@ -68,7 +67,9 @@ void QueryItemImpl::fetch(const QModelIndex &index) {
// NOTE: reset icon and tooltip in case query is in the
// "out of date" state
QStandardItem *item = console->get_item(index);
item->setIcon(QIcon::fromTheme(query_item_icon));

const QIcon create_query_item = g_icon_manager->get_object_icon("query-item");
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not related to the commit topic. Better move to another commit or create refactor branch

@@ -11,28 +12,54 @@ IconManager::IconManager()
{
}

void IconManager::init()
void IconManager::init(QString icon_theme)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Init method is used for object initialization. In my opinion its better to create another function like set_theme() to change themes.

@@ -99,6 +99,7 @@ DEFINE_SETTING(SETTING_create_shared_folder_dialog_geometry);
DEFINE_SETTING(SETTING_create_contact_dialog_geometry);
DEFINE_SETTING(SETTING_find_policy_dialog_geometry);
DEFINE_SETTING(SETTING_time_span_attribute_dialog_geometry);
DEFINE_SETTING(SETTING_icons_theme_geometry);
Copy link
Collaborator

@Samael340 Samael340 Nov 22, 2023

Choose a reason for hiding this comment

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

I think better rename it to "SETTING_icons_theme" and move it to "Other" settings. This does not apply to geometry settings.


g_icon_manager->init(name_theme);

const QIcon create_user_icon = g_icon_manager->get_object_icon(OBJECT_CATEGORY_PERSON);
Copy link
Collaborator

Choose a reason for hiding this comment

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

In my opinion better remove "create" word from icon object's name. Verbs are commonly used in function names

g_icon_manager->init(name_theme);

const QIcon create_user_icon = g_icon_manager->get_object_icon(OBJECT_CATEGORY_PERSON);
ui->action_create_user->setIcon(create_user_icon);
Copy link
Collaborator

Choose a reason for hiding this comment

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

To set action icons pass action pointers to icon manager someway. You can pass it when you initialize icon manager as an option

@@ -112,3 +112,17 @@ void settings_set_variant(const QString setting, const QVariant &value) {

settings.setValue(setting, value);
}

QList<QString> settings_get_themes (){
QSettings::setPath(QSettings::NativeFormat, QSettings::SystemScope, "/etc/icon-theme-ActiveDirectory");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure this is a good idea to move configs to the system scope?

Copy link
Member

Choose a reason for hiding this comment

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

А что такое /etc/icon-theme-ActiveDirectory ?
Это файл настройки или каталог? Если каталог, то для чего?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Это каталог в котором лежит файл конфигураций с темами иконок.
Этот каталог и файл конфигураций в нем создаются при установке пакета с темами значков:
https://github.com/LenkaDEA/admc_icons/tree/themes


QStringList all_themes = set.allKeys();
for( QString &name_theme : all_themes )
name_theme_list.push_back(set.value(name_theme).toString());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think better check themes availability. It was done somehow here #369

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Здесь я читаю все темы из конфига. Если темы не установлены, то они и не будут доступны для выбора пользователя.
Что именно сделать как там?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Если я верно поняла твою мысль, то ты хочешь, чтоб просматривался весь каталог с темами, тем самым в списке выбора тем появились доп темы, что есть у пользователя. Верно я тебя поняла?
Если да, то считаю, что это лишний функционал.

  1. Нам не известно, как доп темы (которые установлены у пользователя на системе) будут дружить с нашим приложением.
  2. Если пользователь захочет поменять тему, то он поменяет ее скорее на всей системе.
  3. Наши темы более полные для нашего приложения, так что использовать, с большей вероятность, будут их, потому что это удобнее.

Если я не права, то поясните, потому это будет не лишним, пожалуйста.

@@ -28,6 +28,7 @@ BuildRequires: libkrb5-devel

Requires: libsasl2
Requires: libsasl2-plugin-gssapi
Requires: icon-theme-ActiveDirectory
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest dividing theme changing feature and new themes package addition (main icon too) into two pull requests, but I am not sure about it.

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