Open catpak folder action
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
516ddb22ae
commit
816acc9c76
@ -1160,6 +1160,11 @@ void MainWindow::on_actionViewWidgetThemeFolder_triggered()
|
|||||||
DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path());
|
DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionViewCatPackFolder_triggered()
|
||||||
|
{
|
||||||
|
DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path());
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::refreshInstances()
|
void MainWindow::refreshInstances()
|
||||||
{
|
{
|
||||||
APPLICATION->instances()->loadList();
|
APPLICATION->instances()->loadList();
|
||||||
|
@ -118,6 +118,7 @@ private slots:
|
|||||||
|
|
||||||
void on_actionViewIconThemeFolder_triggered();
|
void on_actionViewIconThemeFolder_triggered();
|
||||||
void on_actionViewWidgetThemeFolder_triggered();
|
void on_actionViewWidgetThemeFolder_triggered();
|
||||||
|
void on_actionViewCatPackFolder_triggered();
|
||||||
|
|
||||||
void on_actionViewSelectedInstFolder_triggered();
|
void on_actionViewSelectedInstFolder_triggered();
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>20</height>
|
<height>30</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="fileMenu">
|
<widget class="QMenu" name="fileMenu">
|
||||||
@ -193,6 +193,7 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionViewIconThemeFolder"/>
|
<addaction name="actionViewIconThemeFolder"/>
|
||||||
<addaction name="actionViewWidgetThemeFolder"/>
|
<addaction name="actionViewWidgetThemeFolder"/>
|
||||||
|
<addaction name="actionViewCatPackFolder"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="accountsMenu">
|
<widget class="QMenu" name="accountsMenu">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -729,7 +730,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionViewWidgetThemeFolder">
|
<action name="actionViewWidgetThemeFolder">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="viewfolder"/>
|
<iconset theme="viewfolder">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>View &Widget Themes Folder</string>
|
<string>View &Widget Themes Folder</string>
|
||||||
@ -740,7 +742,8 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionViewIconThemeFolder">
|
<action name="actionViewIconThemeFolder">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="viewfolder"/>
|
<iconset theme="viewfolder">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>View I&con Theme Folder</string>
|
<string>View I&con Theme Folder</string>
|
||||||
@ -749,6 +752,14 @@
|
|||||||
<string>View Icon Theme Folder</string>
|
<string>View Icon Theme Folder</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionViewCatPackFolder">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="viewfolder"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>View Cat Packs Folder</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
@ -205,6 +205,11 @@ QDir ThemeManager::getApplicationThemesFolder()
|
|||||||
return m_applicationThemeFolder;
|
return m_applicationThemeFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDir ThemeManager::getCatPacksFolder()
|
||||||
|
{
|
||||||
|
return m_catPacksFolder;
|
||||||
|
}
|
||||||
|
|
||||||
void ThemeManager::setIconTheme(const QString& name)
|
void ThemeManager::setIconTheme(const QString& name)
|
||||||
{
|
{
|
||||||
if (m_icons.find(name) == m_icons.end()) {
|
if (m_icons.find(name) == m_icons.end()) {
|
||||||
@ -270,9 +275,9 @@ void ThemeManager::initializeCatPacks()
|
|||||||
for (auto [id, name] : defaultCats) {
|
for (auto [id, name] : defaultCats) {
|
||||||
addCatPack(std::unique_ptr<CatPack>(new BasicCatPack(id, name)));
|
addCatPack(std::unique_ptr<CatPack>(new BasicCatPack(id, name)));
|
||||||
}
|
}
|
||||||
QDir catpacksDir("catpacks");
|
if (!m_catPacksFolder.mkpath("."))
|
||||||
QString catpacksFolder = catpacksDir.absoluteFilePath("");
|
themeWarningLog() << "Couldn't create theme folder";
|
||||||
themeDebugLog() << "CatPacks Folder Path:" << catpacksFolder;
|
themeDebugLog() << "CatPacks Folder Path:" << m_catPacksFolder.absolutePath();
|
||||||
|
|
||||||
QStringList supportedImageFormats;
|
QStringList supportedImageFormats;
|
||||||
for (auto format : QImageReader::supportedImageFormats()) {
|
for (auto format : QImageReader::supportedImageFormats()) {
|
||||||
@ -289,9 +294,9 @@ void ThemeManager::initializeCatPacks()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loadFiles(catpacksDir);
|
loadFiles(m_catPacksFolder);
|
||||||
|
|
||||||
QDirIterator directoryIterator(catpacksFolder, QDir::Dirs | QDir::NoDotAndDotDot);
|
QDirIterator directoryIterator(m_catPacksFolder.path(), QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
while (directoryIterator.hasNext()) {
|
while (directoryIterator.hasNext()) {
|
||||||
QDir dir(directoryIterator.next());
|
QDir dir(directoryIterator.next());
|
||||||
QFileInfo manifest(dir.absoluteFilePath("catpack.json"));
|
QFileInfo manifest(dir.absoluteFilePath("catpack.json"));
|
||||||
|
@ -44,6 +44,7 @@ class ThemeManager {
|
|||||||
bool isValidApplicationTheme(const QString& id);
|
bool isValidApplicationTheme(const QString& id);
|
||||||
QDir getIconThemesFolder();
|
QDir getIconThemesFolder();
|
||||||
QDir getApplicationThemesFolder();
|
QDir getApplicationThemesFolder();
|
||||||
|
QDir getCatPacksFolder();
|
||||||
void applyCurrentlySelectedTheme(bool initial = false);
|
void applyCurrentlySelectedTheme(bool initial = false);
|
||||||
void setIconTheme(const QString& name);
|
void setIconTheme(const QString& name);
|
||||||
void setApplicationTheme(const QString& name, bool initial = false);
|
void setApplicationTheme(const QString& name, bool initial = false);
|
||||||
@ -59,6 +60,7 @@ class ThemeManager {
|
|||||||
std::map<QString, IconTheme> m_icons;
|
std::map<QString, IconTheme> m_icons;
|
||||||
QDir m_iconThemeFolder{ "iconthemes" };
|
QDir m_iconThemeFolder{ "iconthemes" };
|
||||||
QDir m_applicationThemeFolder{ "themes" };
|
QDir m_applicationThemeFolder{ "themes" };
|
||||||
|
QDir m_catPacksFolder{ "catpacks" };
|
||||||
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
|
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
|
||||||
|
|
||||||
void initializeThemes();
|
void initializeThemes();
|
||||||
|
@ -35,6 +35,7 @@ ThemeCustomizationWidget::ThemeCustomizationWidget(QWidget* parent) : QWidget(pa
|
|||||||
|
|
||||||
connect(ui->iconsFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getIconThemesFolder().path()); });
|
connect(ui->iconsFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getIconThemesFolder().path()); });
|
||||||
connect(ui->widgetStyleFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
connect(ui->widgetStyleFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
|
||||||
|
connect(ui->catPackFolder, &QPushButton::clicked, this, [] { DesktopServices::openDirectory(APPLICATION->themeManager()->getCatPacksFolder().path()); });
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
ThemeCustomizationWidget::~ThemeCustomizationWidget()
|
||||||
|
@ -63,7 +63,8 @@
|
|||||||
<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>
|
||||||
@ -106,7 +107,8 @@
|
|||||||
<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>
|
||||||
@ -147,15 +149,15 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="catInfoLabel">
|
<widget class="QPushButton" name="catPackFolder">
|
||||||
<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>View cat packs folder.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="about">
|
<iconset theme="viewfolder">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
|
Loading…
Reference in New Issue
Block a user