Added button to refresh themes and catpacks
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
a30292009a
commit
b4bfc03e8b
@ -313,3 +313,13 @@ void ThemeManager::initializeCatPacks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeManager::refresh()
|
||||||
|
{
|
||||||
|
m_themes.clear();
|
||||||
|
m_icons.clear();
|
||||||
|
m_catPacks.clear();
|
||||||
|
|
||||||
|
initializeThemes();
|
||||||
|
initializeCatPacks();
|
||||||
|
};
|
@ -55,6 +55,8 @@ class ThemeManager {
|
|||||||
QString getCatPack(QString catName = "");
|
QString getCatPack(QString catName = "");
|
||||||
QList<CatPack*> getValidCatPacks();
|
QList<CatPack*> getValidCatPacks();
|
||||||
|
|
||||||
|
void refresh();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<QString, std::unique_ptr<ITheme>> m_themes;
|
std::map<QString, std::unique_ptr<ITheme>> m_themes;
|
||||||
std::map<QString, IconTheme> m_icons;
|
std::map<QString, IconTheme> m_icons;
|
||||||
|
@ -39,6 +39,8 @@ ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget* parent) : QWidget(pa
|
|||||||
[] { DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
[] { DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
||||||
connect(ui->catPackFolder, &QPushButton::clicked, this,
|
connect(ui->catPackFolder, &QPushButton::clicked, this,
|
||||||
[] { DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path()); });
|
[] { DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path()); });
|
||||||
|
|
||||||
|
connect(ui->refreshButton, &QPushButton::clicked, this, &ThemeCustomizationWidget::refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
||||||
@ -169,3 +171,22 @@ void ThemeCustomizationWidget::retranslate()
|
|||||||
{
|
{
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeCustomizationWidget::refresh()
|
||||||
|
{
|
||||||
|
applySettings();
|
||||||
|
disconnect(ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyIconTheme);
|
||||||
|
disconnect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ThemeCustomizationWidget::applyWidgetTheme);
|
||||||
|
disconnect(ui->backgroundCatComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ThemeCustomizationWidget::applyCatTheme);
|
||||||
|
APPLICATION->themeManager()->refresh();
|
||||||
|
ui->iconsComboBox->clear();
|
||||||
|
ui->widgetStyleComboBox->clear();
|
||||||
|
ui->backgroundCatComboBox->clear();
|
||||||
|
loadSettings();
|
||||||
|
connect(ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyIconTheme);
|
||||||
|
connect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
&ThemeCustomizationWidget::applyWidgetTheme);
|
||||||
|
connect(ui->backgroundCatComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyCatTheme);
|
||||||
|
};
|
@ -44,6 +44,7 @@ class ThemeCustomizationWidget : public QWidget {
|
|||||||
void applyIconTheme(int index);
|
void applyIconTheme(int index);
|
||||||
void applyWidgetTheme(int index);
|
void applyWidgetTheme(int index);
|
||||||
void applyCatTheme(int index);
|
void applyCatTheme(int index);
|
||||||
|
void refresh();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
int currentIconThemeChanged(int index);
|
int currentIconThemeChanged(int index);
|
||||||
|
@ -167,6 +167,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QPushButton" name="refreshButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user