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