Improve appearance page more

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2025-03-22 13:58:41 +00:00
parent 06b5ac9a25
commit 99eeef40d9
No known key found for this signature in database
GPG key ID: 5E39D70B4C93C38E
12 changed files with 913 additions and 602 deletions

View file

@ -1,21 +1,41 @@
#include "AppearancePage.h" #include "AppearancePage.h"
#include "ui_AppearancePage.h" #include "ui_AppearancePage.h"
#include <BuildConfig.h> #include <DesktopServices.h>
#include <ui/themes/ITheme.h> #include <QGraphicsOpacityEffect>
#include <ui/themes/ThemeManager.h> #include "BuildConfig.h"
#include "ui/themes/ITheme.h"
#include "ui/themes/ThemeManager.h"
AppearancePage::AppearancePage(QWidget* parent) : QWidget(parent), m_ui(new Ui::AppearancePage) AppearancePage::AppearancePage(QWidget* parent) : QWidget(parent), m_ui(new Ui::AppearancePage)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
defaultFormat = new QTextCharFormat(m_ui->fontPreview->currentCharFormat()); m_ui->catPreview->setGraphicsEffect(new QGraphicsOpacityEffect(this));
defaultFormat = new QTextCharFormat(m_ui->consolePreview->currentCharFormat());
loadSettings(); loadSettings();
connect(m_ui->fontSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AppearancePage::updateFontPreview); loadThemeSettings();
connect(m_ui->consoleFont, &QFontComboBox::currentFontChanged, this, &AppearancePage::updateFontPreview);
connect(m_ui->themeCustomizationWidget, &ThemeCustomizationWidget::currentWidgetThemeChanged, this, &AppearancePage::updateFontPreview); updateConsolePreview();
connect(m_ui->themeCustomizationWidget, &ThemeCustomizationWidget::currentCatChanged, APPLICATION, &Application::currentCatChanged); updateCatPreview();
connect(m_ui->fontSizeBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AppearancePage::updateConsolePreview);
connect(m_ui->consoleFont, &QFontComboBox::currentFontChanged, this, &AppearancePage::updateConsolePreview);
connect(m_ui->iconsComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AppearancePage::applyIconTheme);
connect(m_ui->widgetStyleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AppearancePage::applyWidgetTheme);
connect(m_ui->catPackComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &AppearancePage::applyCatTheme);
connect(m_ui->catOpacitySlider, &QAbstractSlider::valueChanged, this, &AppearancePage::updateCatPreview);
connect(m_ui->iconsFolder, &QPushButton::clicked, this,
[] { DesktopServices::openPath(APPLICATION->themeManager()->getIconThemesFolder().path()); });
connect(m_ui->widgetStyleFolder, &QPushButton::clicked, this,
[] { DesktopServices::openPath(APPLICATION->themeManager()->getApplicationThemesFolder().path()); });
connect(m_ui->catPackFolder, &QPushButton::clicked, this,
[] { DesktopServices::openPath(APPLICATION->themeManager()->getCatPacksFolder().path()); });
connect(m_ui->reloadThemesButton, &QPushButton::pressed, this, &AppearancePage::loadThemeSettings);
} }
AppearancePage::~AppearancePage() AppearancePage::~AppearancePage()
@ -40,6 +60,7 @@ void AppearancePage::applySettings()
QString consoleFontFamily = m_ui->consoleFont->currentFont().family(); QString consoleFontFamily = m_ui->consoleFont->currentFont().family();
settings->set("ConsoleFont", consoleFontFamily); settings->set("ConsoleFont", consoleFontFamily);
settings->set("ConsoleFontSize", m_ui->fontSizeBox->value()); settings->set("ConsoleFontSize", m_ui->fontSizeBox->value());
settings->set("CatOpacity", m_ui->catOpacitySlider->value());
} }
void AppearancePage::loadSettings() void AppearancePage::loadSettings()
@ -55,16 +76,111 @@ void AppearancePage::loadSettings()
} }
m_ui->fontSizeBox->setValue(fontSize); m_ui->fontSizeBox->setValue(fontSize);
updateFontPreview(); m_ui->catOpacitySlider->setValue(APPLICATION->settings()->get("CatOpacity").toInt());
} }
void AppearancePage::updateFontPreview() void AppearancePage::applyIconTheme(int index)
{
auto settings = APPLICATION->settings();
auto originalIconTheme = settings->get("IconTheme").toString();
auto newIconTheme = m_ui->iconsComboBox->itemData(index).toString();
if (originalIconTheme != newIconTheme) {
settings->set("IconTheme", newIconTheme);
APPLICATION->themeManager()->applyCurrentlySelectedTheme();
}
}
void AppearancePage::applyWidgetTheme(int index)
{
auto settings = APPLICATION->settings();
auto originalAppTheme = settings->get("ApplicationTheme").toString();
auto newAppTheme = m_ui->widgetStyleComboBox->itemData(index).toString();
if (originalAppTheme != newAppTheme) {
settings->set("ApplicationTheme", newAppTheme);
APPLICATION->themeManager()->applyCurrentlySelectedTheme();
}
updateConsolePreview();
}
void AppearancePage::applyCatTheme(int index)
{
auto settings = APPLICATION->settings();
auto originalCat = settings->get("BackgroundCat").toString();
auto newCat = m_ui->catPackComboBox->itemData(index).toString();
if (originalCat != newCat) {
settings->set("BackgroundCat", newCat);
}
APPLICATION->currentCatChanged(index);
updateCatPreview();
}
void AppearancePage::loadThemeSettings()
{
APPLICATION->themeManager()->refresh();
m_ui->iconsComboBox->blockSignals(true);
m_ui->widgetStyleComboBox->blockSignals(true);
m_ui->catPackComboBox->blockSignals(true);
m_ui->iconsComboBox->clear();
m_ui->widgetStyleComboBox->clear();
m_ui->catPackComboBox->clear();
const SettingsObjectPtr settings = APPLICATION->settings();
const QString currentIconTheme = settings->get("IconTheme").toString();
const auto iconThemes = APPLICATION->themeManager()->getValidIconThemes();
for (int i = 0; i < iconThemes.count(); ++i) {
const IconTheme* theme = iconThemes[i];
QIcon iconForComboBox = QIcon(theme->path() + "/scalable/settings");
m_ui->iconsComboBox->addItem(iconForComboBox, theme->name(), theme->id());
if (currentIconTheme == theme->id())
m_ui->iconsComboBox->setCurrentIndex(i);
}
const QString currentTheme = settings->get("ApplicationTheme").toString();
auto themes = APPLICATION->themeManager()->getValidApplicationThemes();
for (int i = 0; i < themes.count(); ++i) {
ITheme* theme = themes[i];
m_ui->widgetStyleComboBox->addItem(theme->name(), theme->id());
if (!theme->tooltip().isEmpty())
m_ui->widgetStyleComboBox->setItemData(i, theme->tooltip(), Qt::ToolTipRole);
if (currentTheme == theme->id())
m_ui->widgetStyleComboBox->setCurrentIndex(i);
}
const QString currentCat = settings->get("BackgroundCat").toString();
const auto cats = APPLICATION->themeManager()->getValidCatPacks();
for (int i = 0; i < cats.count(); ++i) {
const CatPack* cat = cats[i];
QIcon catIcon = QIcon(QString("%1").arg(cat->path()));
m_ui->catPackComboBox->addItem(catIcon, cat->name(), cat->id());
if (currentCat == cat->id())
m_ui->catPackComboBox->setCurrentIndex(i);
}
m_ui->iconsComboBox->blockSignals(false);
m_ui->widgetStyleComboBox->blockSignals(false);
m_ui->catPackComboBox->blockSignals(false);
}
void AppearancePage::updateConsolePreview()
{ {
const LogColors& colors = APPLICATION->themeManager()->getLogColors(); const LogColors& colors = APPLICATION->themeManager()->getLogColors();
int fontSize = m_ui->fontSizeBox->value(); int fontSize = m_ui->fontSizeBox->value();
QString fontFamily = m_ui->consoleFont->currentFont().family(); QString fontFamily = m_ui->consoleFont->currentFont().family();
m_ui->fontPreview->clear(); m_ui->consolePreview->clear();
defaultFormat->setFont(QFont(fontFamily, fontSize)); defaultFormat->setFont(QFont(fontFamily, fontSize));
auto print = [this, colors](const QString& message, MessageLevel::Enum level) { auto print = [this, colors](const QString& message, MessageLevel::Enum level) {
@ -80,7 +196,7 @@ void AppearancePage::updateFontPreview()
format.setForeground(fg); format.setForeground(fg);
// append a paragraph/line // append a paragraph/line
auto workCursor = m_ui->fontPreview->textCursor(); auto workCursor = m_ui->consolePreview->textCursor();
workCursor.movePosition(QTextCursor::End); workCursor.movePosition(QTextCursor::End);
workCursor.insertText(message, format); workCursor.insertText(message, format);
workCursor.insertBlock(); workCursor.insertBlock();
@ -102,3 +218,13 @@ void AppearancePage::updateFontPreview()
print(tr("[Test/DEBUG] A secret debugging message..."), MessageLevel::Debug); print(tr("[Test/DEBUG] A secret debugging message..."), MessageLevel::Debug);
print(tr("[Test/FATAL] A terrifying fatal error!"), MessageLevel::Fatal); print(tr("[Test/FATAL] A terrifying fatal error!"), MessageLevel::Fatal);
} }
void AppearancePage::updateCatPreview()
{
QIcon catPackIcon(APPLICATION->themeManager()->getCatPack());
m_ui->catPreview->setIcon(catPackIcon);
auto effect = dynamic_cast<QGraphicsOpacityEffect*>(m_ui->catPreview->graphicsEffect());
if (effect)
effect->setOpacity(m_ui->catOpacitySlider->value() / 100.0);
}

View file

@ -67,7 +67,14 @@ class AppearancePage : public QWidget, public BasePage {
private: private:
void applySettings(); void applySettings();
void loadSettings(); void loadSettings();
void updateFontPreview();
void applyIconTheme(int index);
void applyWidgetTheme(int index);
void applyCatTheme(int index);
void loadThemeSettings();
void updateConsolePreview();
void updateCatPreview();
private: private:
Ui::AppearancePage* m_ui; Ui::AppearancePage* m_ui;

View file

@ -10,299 +10,522 @@
<height>700</height> <height>700</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1"> <layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="iconSetBox">
<property name="title"> <property name="title">
<string>Theme</string> <string/>
</property>
<property name="flat">
<bool>false</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="ThemeCustomizationWidget" name="themeCustomizationWidget" native="true"/> <layout class="QGridLayout" name="gridLayout">
</item> <item row="2" column="3">
</layout> <widget class="QPushButton" name="catPackFolder">
</widget> <property name="toolTip">
</item> <string>View cat packs folder.</string>
<item>
<widget class="QGroupBox" name="themeBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>&amp;Fonts</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QFontComboBox" name="consoleFont">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="fontSizeBox">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>11</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label">
<property name="text">
<string>Monospace Font</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="icon1">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Open Folder</string>
</property>
<property name="icon">
<iconset theme="new">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="3">
<widget class="QPushButton" name="icon2"> <widget class="QPushButton" name="widgetStyleFolder">
<property name="focusPolicy"> <property name="toolTip">
<enum>Qt::NoFocus</enum> <string>View widget themes folder.</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Open Folder</string>
</property>
<property name="icon">
<iconset theme="centralmods">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="3">
<widget class="QPushButton" name="icon3"> <widget class="QPushButton" name="iconsFolder">
<property name="focusPolicy"> <property name="toolTip">
<enum>Qt::NoFocus</enum> <string>View icon themes folder.</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Open Folder</string>
</property>
<property name="icon">
<iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="0">
<widget class="QPushButton" name="icon4"> <widget class="QLabel" name="catPackLabel">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text"> <property name="text">
<string/> <string>&amp;Cat Pack</string>
</property> </property>
<property name="icon"> <property name="buddy">
<iconset theme="launch"> <cstring>catPackComboBox</cstring>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="2" column="2">
<widget class="QPushButton" name="icon5"> <widget class="QComboBox" name="catPackComboBox"/>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="iconsComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="copy">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="2">
<widget class="QPushButton" name="icon6"> <widget class="QComboBox" name="widgetStyleComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::StrongFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="export">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="3" column="2">
<widget class="QPushButton" name="icon7"> <widget class="QPushButton" name="reloadThemesButton">
<property name="focusPolicy"> <property name="sizePolicy">
<enum>Qt::NoFocus</enum> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Reload All</string>
</property>
<property name="icon">
<iconset theme="delete">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="0">
<widget class="QPushButton" name="icon8"> <widget class="QLabel" name="widgetStyleLabel">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text"> <property name="text">
<string/> <string>Theme</string>
</property> </property>
<property name="icon"> <property name="buddy">
<iconset theme="about"> <cstring>widgetStyleComboBox</cstring>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="1" column="0">
<widget class="QPushButton" name="icon9"> <widget class="QLabel" name="iconsLabel">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text"> <property name="text">
<string/> <string>&amp;Icons</string>
</property> </property>
<property name="icon"> <property name="buddy">
<iconset theme="settings"> <cstring>iconsComboBox</cstring>
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="icon10">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="cat">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="fontPreview"> <widget class="QLabel" name="label">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding"> <string>Console Font</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QFontComboBox" name="consoleFont"/>
</item>
<item>
<widget class="QSpinBox" name="fontSizeBox">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>16</number>
</property>
<property name="value">
<number>11</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="catOpacityLabel">
<property name="text">
<string>Cat Opacity</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="2" column="2">
<spacer name="horizontalSpacer_4">
<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 row="1" column="0" colspan="4">
<widget class="QSlider" name="catOpacitySlider">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickInterval">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Transparent</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_5">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Opaque</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="previewBox">
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="catPreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>128</width>
<height>256</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="icon1">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="new">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon2">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="centralmods">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon3">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon4">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="launch">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon5">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="copy">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon6">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="export">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon7">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="delete">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon8">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="about">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon9">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="settings">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="icon10">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="cat">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="consolePreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets> <tabstops>
<customwidget> <tabstop>widgetStyleComboBox</tabstop>
<class>ThemeCustomizationWidget</class> <tabstop>widgetStyleFolder</tabstop>
<extends>QWidget</extends> <tabstop>iconsComboBox</tabstop>
<header>ui/widgets/ThemeCustomizationWidget.h</header> <tabstop>iconsFolder</tabstop>
<container>1</container> <tabstop>catPackComboBox</tabstop>
</customwidget> <tabstop>catPackFolder</tabstop>
</customwidgets> <tabstop>consoleFont</tabstop>
<tabstop>fontSizeBox</tabstop>
<tabstop>catOpacitySlider</tabstop>
<tabstop>consolePreview</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View file

@ -31,7 +31,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>563</width> <width>563</width>
<height>1293</height> <height>1336</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8">
@ -72,11 +72,20 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="preferMenuBarCheckBox"> <widget class="QCheckBox" name="preferMenuBarCheckBox">
@ -104,6 +113,22 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QLabel" name="updateIntervalLabel"> <widget class="QLabel" name="updateIntervalLabel">
<property name="text"> <property name="text">
@ -112,37 +137,26 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QSpinBox" name="updateIntervalSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="updateIntervalSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="toolTip"> <horstretch>0</horstretch>
<string>Set it to 0 to only check on launch</string> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="suffix"> </property>
<string>h</string> <property name="toolTip">
</property> <string>Set it to 0 to only check on launch</string>
<property name="minimum"> </property>
<number>0</number> <property name="suffix">
</property> <string>h</string>
<property name="maximum"> </property>
<number>168</number> <property name="minimum">
</property> <number>0</number>
</widget> </property>
</item> <property name="maximum">
<item> <number>168</number>
<spacer name="horizontalSpacer_2"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -163,29 +177,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="2"> <item row="3" column="2">
<widget class="QToolButton" name="downloadsDirBrowseBtn"> <widget class="QToolButton" name="javaDirBrowseBtn">
<property name="text"> <property name="text">
<string>Browse</string> <string>Browse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<widget class="QLineEdit" name="iconsDirTextBox"/>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="javaDirTextBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelSkinsDir">
<property name="text">
<string>&amp;Skins</string>
</property>
<property name="buddy">
<cstring>skinsDirTextBox</cstring>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="labelIconsDir"> <widget class="QLabel" name="labelIconsDir">
<property name="text"> <property name="text">
@ -196,19 +194,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1" colspan="2"> <item row="0" column="2">
<layout class="QHBoxLayout" name="downloadModsCheckLayout"/> <widget class="QToolButton" name="instDirBrowseBtn">
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="downloadsDirTextBox"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelJavaDir">
<property name="text"> <property name="text">
<string>&amp;Java</string> <string>Browse</string>
</property>
<property name="buddy">
<cstring>javaDirTextBox</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@ -222,29 +211,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QLineEdit" name="skinsDirTextBox"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="modsDirTextBox"/>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="instDirTextBox"/>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="modsDirBrowseBtn">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="instDirBrowseBtn">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QToolButton" name="iconsDirBrowseBtn"> <widget class="QToolButton" name="iconsDirBrowseBtn">
<property name="text"> <property name="text">
@ -252,6 +218,22 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="QLineEdit" name="javaDirTextBox"/>
</item>
<item row="8" column="2">
<widget class="QToolButton" name="downloadsDirBrowseBtn">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="downloadsDirTextBox"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="modsDirTextBox"/>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="labelInstDir"> <widget class="QLabel" name="labelInstDir">
<property name="text"> <property name="text">
@ -262,13 +244,39 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="3" column="0">
<widget class="QToolButton" name="javaDirBrowseBtn"> <widget class="QLabel" name="labelJavaDir">
<property name="text">
<string>&amp;Java</string>
</property>
<property name="buddy">
<cstring>javaDirTextBox</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="iconsDirTextBox"/>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="modsDirBrowseBtn">
<property name="text"> <property name="text">
<string>Browse</string> <string>Browse</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<widget class="QLineEdit" name="skinsDirTextBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelSkinsDir">
<property name="text">
<string>&amp;Skins</string>
</property>
<property name="buddy">
<cstring>skinsDirTextBox</cstring>
</property>
</widget>
</item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QToolButton" name="skinsDirBrowseBtn"> <widget class="QToolButton" name="skinsDirBrowseBtn">
<property name="text"> <property name="text">
@ -276,13 +284,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="instDirTextBox"/>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="modsBox"> <widget class="QGroupBox" name="modsBox">
<property name="title"> <property name="title">
<string>Mod Management</string> <string>Mods</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
@ -350,7 +361,7 @@
<string>When creating a new modpack instance, do not suggest updating existing instances instead.</string> <string>When creating a new modpack instance, do not suggest updating existing instances instead.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Ask whether to update an existing instance when installing modpacks</string> <string>Suggest to update an existing instance</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -374,40 +385,45 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_6"> <widget class="QSpinBox" name="lineLimitSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="lineLimitSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="sizePolicy"> <horstretch>0</horstretch>
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <verstretch>0</verstretch>
<horstretch>0</horstretch> </sizepolicy>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="suffix">
</property> <string> lines</string>
<property name="suffix"> </property>
<string> lines</string> <property name="minimum">
</property> <number>10000</number>
<property name="minimum"> </property>
<number>10000</number> <property name="maximum">
</property> <number>1000000</number>
<property name="maximum"> </property>
<number>1000000</number> <property name="singleStep">
</property> <number>10000</number>
<property name="singleStep"> </property>
<number>10000</number> <property name="value">
</property> <number>100000</number>
<property name="value"> </property>
<number>100000</number> </widget>
</property> </item>
</widget> <item>
</item> <spacer name="verticalSpacer_6">
<item> <property name="orientation">
<spacer name="horizontalSpacer_6"> <enum>Qt::Vertical</enum>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <property name="sizeType">
</property> <enum>QSizePolicy::Fixed</enum>
</spacer> </property>
</item> <property name="sizeHint" stdset="0">
</layout> <size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkStopLogging"> <widget class="QCheckBox" name="checkStopLogging">
@ -433,28 +449,33 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QSpinBox" name="numberOfConcurrentTasksSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="numberOfConcurrentTasksSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="minimum"> <horstretch>0</horstretch>
<number>1</number> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimum">
<item> <number>1</number>
<spacer name="horizontalSpacer"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum> </item>
</property> <item>
<property name="sizeHint" stdset="0"> <spacer name="verticalSpacer_3">
<size> <property name="orientation">
<width>0</width> <enum>Qt::Vertical</enum>
<height>0</height> </property>
</size> <property name="sizeType">
</property> <enum>QSizePolicy::Fixed</enum>
</spacer> </property>
</item> <property name="sizeHint" stdset="0">
</layout> <size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="numberOfConcurrentDownloadsLabel"> <widget class="QLabel" name="numberOfConcurrentDownloadsLabel">
@ -464,28 +485,33 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QSpinBox" name="numberOfConcurrentDownloadsSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="numberOfConcurrentDownloadsSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="minimum"> <horstretch>0</horstretch>
<number>1</number> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimum">
<item> <number>1</number>
<spacer name="horizontalSpacer_3"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum> </item>
</property> <item>
<property name="sizeHint" stdset="0"> <spacer name="verticalSpacer_4">
<size> <property name="orientation">
<width>0</width> <enum>Qt::Vertical</enum>
<height>0</height> </property>
</size> <property name="sizeType">
</property> <enum>QSizePolicy::Fixed</enum>
</spacer> </property>
</item> <property name="sizeHint" stdset="0">
</layout> <size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="numberOfManualRetriesLabel"> <widget class="QLabel" name="numberOfManualRetriesLabel">
@ -495,28 +521,33 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <widget class="QSpinBox" name="numberOfManualRetriesSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="numberOfManualRetriesSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="minimum"> <horstretch>0</horstretch>
<number>0</number> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="minimum">
<item> <number>0</number>
<spacer name="horizontalSpacer_4"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum> </item>
</property> <item>
<property name="sizeHint" stdset="0"> <spacer name="verticalSpacer_5">
<size> <property name="orientation">
<width>0</width> <enum>Qt::Vertical</enum>
<height>0</height> </property>
</size> <property name="sizeType">
</property> <enum>QSizePolicy::Fixed</enum>
</spacer> </property>
</item> <property name="sizeHint" stdset="0">
</layout> <size>
<width>0</width>
<height>6</height>
</size>
</property>
</spacer>
</item> </item>
<item> <item>
<widget class="QLabel" name="timeoutSecondsLabel"> <widget class="QLabel" name="timeoutSecondsLabel">
@ -529,28 +560,17 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <widget class="QSpinBox" name="timeoutSecondsSpinBox">
<item> <property name="sizePolicy">
<widget class="QSpinBox" name="timeoutSecondsSpinBox"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<property name="suffix"> <horstretch>0</horstretch>
<string>s</string> <verstretch>0</verstretch>
</property> </sizepolicy>
</widget> </property>
</item> <property name="suffix">
<item> <string>s</string>
<spacer name="horizontalSpacer_5"> </property>
<property name="orientation"> </widget>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View file

@ -43,7 +43,7 @@
#include "FileSystem.h" #include "FileSystem.h"
#include "Json.h" #include "Json.h"
QString BasicCatPack::path() QString BasicCatPack::path() const
{ {
const auto now = QDate::currentDate(); const auto now = QDate::currentDate();
const auto birthday = QDate(now.year(), 11, 1); const auto birthday = QDate(now.year(), 11, 1);
@ -100,12 +100,12 @@ QDate ensureDay(int year, int month, int day)
return QDate(year, month, day); return QDate(year, month, day);
} }
QString JsonCatPack::path() QString JsonCatPack::path() const
{ {
return path(QDate::currentDate()); return path(QDate::currentDate());
} }
QString JsonCatPack::path(QDate now) QString JsonCatPack::path(QDate now) const
{ {
for (auto var : m_variants) { for (auto var : m_variants) {
QDate startDate = ensureDay(now.year(), var.startTime.month, var.startTime.day); QDate startDate = ensureDay(now.year(), var.startTime.month, var.startTime.day);

View file

@ -43,18 +43,18 @@
class CatPack { class CatPack {
public: public:
virtual ~CatPack() {} virtual ~CatPack() {}
virtual QString id() = 0; virtual QString id() const = 0;
virtual QString name() = 0; virtual QString name() const = 0;
virtual QString path() = 0; virtual QString path() const = 0;
}; };
class BasicCatPack : public CatPack { class BasicCatPack : public CatPack {
public: public:
BasicCatPack(QString id, QString name) : m_id(id), m_name(name) {} BasicCatPack(QString id, QString name) : m_id(id), m_name(name) {}
BasicCatPack(QString id) : BasicCatPack(id, id) {} BasicCatPack(QString id) : BasicCatPack(id, id) {}
virtual QString id() override { return m_id; } virtual QString id() const override { return m_id; }
virtual QString name() override { return m_name; } virtual QString name() const override { return m_name; }
virtual QString path() override; virtual QString path() const override;
protected: protected:
QString m_id; QString m_id;
@ -65,7 +65,7 @@ class FileCatPack : public BasicCatPack {
public: public:
FileCatPack(QString id, QFileInfo& fileInfo) : BasicCatPack(id), m_path(fileInfo.absoluteFilePath()) {} FileCatPack(QString id, QFileInfo& fileInfo) : BasicCatPack(id), m_path(fileInfo.absoluteFilePath()) {}
FileCatPack(QFileInfo& fileInfo) : FileCatPack(fileInfo.baseName(), fileInfo) {} FileCatPack(QFileInfo& fileInfo) : FileCatPack(fileInfo.baseName(), fileInfo) {}
virtual QString path() { return m_path; } virtual QString path() const { return m_path; }
private: private:
QString m_path; QString m_path;
@ -83,8 +83,8 @@ class JsonCatPack : public BasicCatPack {
PartialDate endTime; PartialDate endTime;
}; };
JsonCatPack(QFileInfo& manifestInfo); JsonCatPack(QFileInfo& manifestInfo);
virtual QString path() override; virtual QString path() const override;
QString path(QDate now); QString path(QDate now) const;
private: private:
QString m_default_path; QString m_default_path;

View file

@ -47,6 +47,7 @@ struct LogColors {
}; };
// TODO: rename to Theme; this is not an interface as it contains method implementations // TODO: rename to Theme; this is not an interface as it contains method implementations
// TODO: make methods const
class ITheme { class ITheme {
public: public:
virtual ~ITheme() {} virtual ~ITheme() {}

View file

@ -21,8 +21,6 @@
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
IconTheme::IconTheme(const QString& id, const QString& path) : m_id(id), m_path(path) {}
bool IconTheme::load() bool IconTheme::load()
{ {
const QString path = m_path + "/index.theme"; const QString path = m_path + "/index.theme";
@ -36,18 +34,3 @@ bool IconTheme::load()
settings.endGroup(); settings.endGroup();
return !m_name.isNull(); return !m_name.isNull();
} }
QString IconTheme::id()
{
return m_id;
}
QString IconTheme::path()
{
return m_path;
}
QString IconTheme::name()
{
return m_name;
}

View file

@ -22,13 +22,13 @@
class IconTheme { class IconTheme {
public: public:
IconTheme(const QString& id, const QString& path); IconTheme(const QString& id, const QString& path) : m_id(id), m_path(path) {}
IconTheme() = default; IconTheme() = default;
bool load(); bool load();
QString id(); QString id() const { return m_id; }
QString path(); QString path() const { return m_path; }
QString name(); QString name() const { return m_name; }
private: private:
QString m_id; QString m_id;

View file

@ -49,40 +49,6 @@ ThemeCustomizationWidget::~ThemeCustomizationWidget()
delete ui; delete ui;
} }
/// <summary>
/// The layout was not quite right, so currently this just disables the UI elements, which should be hidden instead
/// TODO FIXME
///
/// Original Method One:
/// ui->iconsComboBox->setVisible(features& ThemeFields::ICONS);
/// ui->iconsLabel->setVisible(features& ThemeFields::ICONS);
/// ui->widgetStyleComboBox->setVisible(features& ThemeFields::WIDGETS);
/// ui->widgetThemeLabel->setVisible(features& ThemeFields::WIDGETS);
/// ui->backgroundCatComboBox->setVisible(features& ThemeFields::CAT);
/// ui->backgroundCatLabel->setVisible(features& ThemeFields::CAT);
///
/// original Method Two:
/// if (!(features & ThemeFields::ICONS)) {
/// ui->formLayout->setRowVisible(0, false);
/// }
/// if (!(features & ThemeFields::WIDGETS)) {
/// ui->formLayout->setRowVisible(1, false);
/// }
/// if (!(features & ThemeFields::CAT)) {
/// ui->formLayout->setRowVisible(2, false);
/// }
/// </summary>
/// <param name="features"></param>
void ThemeCustomizationWidget::showFeatures(ThemeFields features)
{
ui->iconsComboBox->setEnabled(features & ThemeFields::ICONS);
ui->iconsLabel->setEnabled(features & ThemeFields::ICONS);
ui->widgetStyleComboBox->setEnabled(features & ThemeFields::WIDGETS);
ui->widgetStyleLabel->setEnabled(features & ThemeFields::WIDGETS);
ui->backgroundCatComboBox->setEnabled(features & ThemeFields::CAT);
ui->backgroundCatLabel->setEnabled(features & ThemeFields::CAT);
}
void ThemeCustomizationWidget::applyIconTheme(int index) void ThemeCustomizationWidget::applyIconTheme(int index)
{ {
auto settings = APPLICATION->settings(); auto settings = APPLICATION->settings();

View file

@ -33,8 +33,6 @@ class ThemeCustomizationWidget : public QWidget {
explicit ThemeCustomizationWidget(QWidget* parent = nullptr); explicit ThemeCustomizationWidget(QWidget* parent = nullptr);
~ThemeCustomizationWidget() override; ~ThemeCustomizationWidget() override;
void showFeatures(ThemeFields features);
void applySettings(); void applySettings();
void loadSettings(); void loadSettings();

View file

@ -7,68 +7,13 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>400</width>
<height>191</height> <height>168</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string notr="true">Form</string> <string notr="true">Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QPushButton" name="iconsFolder">
<property name="toolTip">
<string>View icon themes folder.</string>
</property>
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="backgroundCatLabel">
<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>
<property name="text">
<string>C&amp;at</string>
</property>
<property name="buddy">
<cstring>backgroundCatComboBox</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="catPackFolder">
<property name="toolTip">
<string>View cat packs folder.</string>
</property>
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="iconsLabel">
<property name="text">
<string>&amp;Icons</string>
</property>
<property name="buddy">
<cstring>iconsComboBox</cstring>
</property>
</widget>
</item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="widgetStyleComboBox"> <widget class="QComboBox" name="widgetStyleComboBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -102,22 +47,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1">
<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 row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="iconsComboBox"> <widget class="QComboBox" name="iconsComboBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -131,7 +60,17 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="3"> <item row="0" column="2">
<widget class="QPushButton" name="iconsFolder">
<property name="toolTip">
<string>View icon themes folder.</string>
</property>
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
@ -146,13 +85,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh All</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
@ -168,6 +100,62 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="backgroundCatLabel">
<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>
<property name="text">
<string>C&amp;at</string>
</property>
<property name="buddy">
<cstring>backgroundCatComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="iconsLabel">
<property name="text">
<string>&amp;Icons</string>
</property>
<property name="buddy">
<cstring>iconsComboBox</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="catPackFolder">
<property name="toolTip">
<string>View cat packs folder.</string>
</property>
<property name="text">
<string>Open Folder</string>
</property>
</widget>
</item>
<item row="2" column="1">
<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 row="3" column="0">
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh All</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
@ -177,7 +165,6 @@
<tabstop>widgetStyleFolder</tabstop> <tabstop>widgetStyleFolder</tabstop>
<tabstop>backgroundCatComboBox</tabstop> <tabstop>backgroundCatComboBox</tabstop>
<tabstop>catPackFolder</tabstop> <tabstop>catPackFolder</tabstop>
<tabstop>refreshButton</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>