Merge pull request #1823 from Trial97/refresh_cats
Added button to refresh themes and catpacks
This commit is contained in:
commit
7e5db651fd
@ -313,3 +313,13 @@ void ThemeManager::initializeCatPacks()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeManager::refresh()
|
||||||
|
{
|
||||||
|
m_themes.clear();
|
||||||
|
m_icons.clear();
|
||||||
|
m_cat_packs.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;
|
||||||
|
@ -27,6 +27,7 @@ ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget* parent) : QWidget(pa
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
ThemeCustomizationWidget::refresh();
|
||||||
|
|
||||||
connect(ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyIconTheme);
|
connect(ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ThemeCustomizationWidget::applyIconTheme);
|
||||||
connect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
@ -39,6 +40,8 @@ ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget* parent) : QWidget(pa
|
|||||||
[] { DesktopServices::openPath(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
[] { DesktopServices::openPath(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
||||||
connect(ui->catPackFolder, &QPushButton::clicked, this,
|
connect(ui->catPackFolder, &QPushButton::clicked, this,
|
||||||
[] { DesktopServices::openPath(APPLICATION->themeManager()->getCatPacksFolder().path()); });
|
[] { DesktopServices::openPath(APPLICATION->themeManager()->getCatPacksFolder().path()); });
|
||||||
|
|
||||||
|
connect(ui->refreshButton, &QPushButton::clicked, this, &ThemeCustomizationWidget::refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
||||||
@ -169,3 +172,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);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string notr="true">Form</string>
|
<string notr="true">Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetMinimumSize</enum>
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -29,6 +29,8 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="iconsLabel">
|
<widget class="QLabel" name="iconsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -63,8 +65,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="viewfolder">
|
<iconset theme="viewfolder"/>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -107,8 +108,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="viewfolder">
|
<iconset theme="viewfolder"/>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -157,8 +157,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="viewfolder">
|
<iconset theme="viewfolder"/>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -168,6 +167,45 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="refreshLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="refreshButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh all</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user