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,141 +29,179 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="iconsLabel">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<property name="text">
|
<item row="0" column="0">
|
||||||
<string>&Icons</string>
|
<widget class="QLabel" name="iconsLabel">
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>iconsComboBox</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<layout class="QHBoxLayout" name="iconsLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="iconsComboBox">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::StrongFocus</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="iconsFolder">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>View icon themes folder.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>&Icons</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="buddy">
|
||||||
<iconset theme="viewfolder">
|
<cstring>iconsComboBox</cstring>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="0" column="1">
|
||||||
</item>
|
<layout class="QHBoxLayout" name="iconsLayout">
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="widgetStyleLabel">
|
<widget class="QComboBox" name="iconsComboBox">
|
||||||
<property name="text">
|
<property name="sizePolicy">
|
||||||
<string>&Widgets</string>
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
<property name="buddy">
|
<verstretch>0</verstretch>
|
||||||
<cstring>widgetStyleComboBox</cstring>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="focusPolicy">
|
||||||
</item>
|
<enum>Qt::StrongFocus</enum>
|
||||||
<item row="1" column="1">
|
</property>
|
||||||
<layout class="QHBoxLayout" name="widgetStyleLayout">
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="QComboBox" name="widgetStyleComboBox">
|
<item>
|
||||||
<property name="sizePolicy">
|
<widget class="QPushButton" name="iconsFolder">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<property name="toolTip">
|
||||||
<horstretch>0</horstretch>
|
<string>View icon themes folder.</string>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<property name="text">
|
||||||
</property>
|
<string/>
|
||||||
<property name="focusPolicy">
|
</property>
|
||||||
<enum>Qt::StrongFocus</enum>
|
<property name="icon">
|
||||||
</property>
|
<iconset theme="viewfolder"/>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="widgetStyleFolder">
|
<widget class="QLabel" name="widgetStyleLabel">
|
||||||
<property name="toolTip">
|
|
||||||
<string>View widget themes folder.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>&Widgets</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="buddy">
|
||||||
<iconset theme="viewfolder">
|
<cstring>widgetStyleComboBox</cstring>
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="1" column="1">
|
||||||
</item>
|
<layout class="QHBoxLayout" name="widgetStyleLayout">
|
||||||
<item row="2" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="backgroundCatLabel">
|
<widget class="QComboBox" name="widgetStyleComboBox">
|
||||||
<property name="toolTip">
|
<property name="sizePolicy">
|
||||||
<string>The cat appears in the background and is not shown by default. It is only made visible when pressing the Cat button in the Toolbar.</string>
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
<property name="text">
|
<verstretch>0</verstretch>
|
||||||
<string>C&at</string>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="focusPolicy">
|
||||||
<cstring>backgroundCatComboBox</cstring>
|
<enum>Qt::StrongFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item>
|
||||||
<layout class="QHBoxLayout" name="catLayout">
|
<widget class="QPushButton" name="widgetStyleFolder">
|
||||||
<item>
|
<property name="toolTip">
|
||||||
<widget class="QComboBox" name="backgroundCatComboBox">
|
<string>View widget themes folder.</string>
|
||||||
<property name="sizePolicy">
|
</property>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<property name="text">
|
||||||
<horstretch>0</horstretch>
|
<string/>
|
||||||
<verstretch>0</verstretch>
|
</property>
|
||||||
</sizepolicy>
|
<property name="icon">
|
||||||
</property>
|
<iconset theme="viewfolder"/>
|
||||||
<property name="focusPolicy">
|
</property>
|
||||||
<enum>Qt::StrongFocus</enum>
|
<property name="flat">
|
||||||
</property>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="backgroundCatLabel">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The cat appears in the background and is not shown by default. It is only made visible when pressing the Cat button in the Toolbar.</string>
|
<string>The cat appears in the background and is not shown by default. It is only made visible when pressing the Cat button in the Toolbar.</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>C&at</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>backgroundCatComboBox</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="catLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="backgroundCatComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The cat appears in the background and is not shown by default. It is only made visible when pressing the Cat button in the Toolbar.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="catPackFolder">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>View cat packs folder.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="viewfolder"/>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="catPackFolder">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="toolTip">
|
<property name="orientation">
|
||||||
<string>View cat packs folder.</string>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="sizeHint" stdset="0">
|
||||||
<string/>
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
</spacer>
|
||||||
<iconset theme="viewfolder">
|
|
||||||
<normaloff>.</normaloff>.</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user