Skip to content

Commit

Permalink
The application icon themes are taken from the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
LenkaDEA committed Nov 8, 2023
1 parent a2511fa commit 6ef91ea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/admc/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,8 @@ MainWindow::MainWindow(AdInterface &ad, QWidget *parent)
//
// Setup theme action
//
const QList<QString> name_theme_list = {
QIcon::fallbackThemeName(),
"Active-Directory-line",
"Active-Directory-duotone",
"Active-Directory-color"
};
const QList<QString> name_theme_list = settings_get_themes();

auto theme_group = new QActionGroup(this);
for (const QString &name_theme : name_theme_list){
const auto action = new QAction(name_theme, theme_group);
Expand Down Expand Up @@ -227,8 +223,6 @@ MainWindow::MainWindow(AdInterface &ad, QWidget *parent)

update();
reload_scope_tree();


});
}

Expand Down
14 changes: 14 additions & 0 deletions src/admc/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
QSettings set("icon-theme-ActiveDirectory");

QList<QString> name_theme_list;
name_theme_list.push_front(QIcon::fallbackThemeName());

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

return name_theme_list;
}
3 changes: 3 additions & 0 deletions src/admc/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,7 @@ bool settings_restore_geometry(const QString setting, QWidget *widget);
void settings_save_header_state(const QString setting, QHeaderView *header);
bool settings_restore_header_state(const QString setting, QHeaderView *header);

//
QList<QString> settings_get_themes ();

#endif /* SETTINGS_H */

0 comments on commit 6ef91ea

Please sign in to comment.