add options to change the cat scalling (#3380)

This commit is contained in:
Tayou 2025-06-06 14:23:39 +02:00 committed by GitHub
commit 9cdfeb5fcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 187 additions and 56 deletions

View file

@ -97,22 +97,28 @@ void AppearanceWidget::applySettings()
settings->set("ConsoleFont", consoleFontFamily);
settings->set("ConsoleFontSize", m_ui->fontSizeBox->value());
settings->set("CatOpacity", m_ui->catOpacitySlider->value());
auto catFit = m_ui->catFitComboBox->currentIndex();
settings->set("CatFit", catFit == 0 ? "fit" : catFit == 1 ? "fill" : "strech");
}
void AppearanceWidget::loadSettings()
{
QString fontFamily = APPLICATION->settings()->get("ConsoleFont").toString();
SettingsObjectPtr settings = APPLICATION->settings();
QString fontFamily = settings->get("ConsoleFont").toString();
QFont consoleFont(fontFamily);
m_ui->consoleFont->setCurrentFont(consoleFont);
bool conversionOk = true;
int fontSize = APPLICATION->settings()->get("ConsoleFontSize").toInt(&conversionOk);
int fontSize = settings->get("ConsoleFontSize").toInt(&conversionOk);
if (!conversionOk) {
fontSize = 11;
}
m_ui->fontSizeBox->setValue(fontSize);
m_ui->catOpacitySlider->setValue(APPLICATION->settings()->get("CatOpacity").toInt());
m_ui->catOpacitySlider->setValue(settings->get("CatOpacity").toInt());
auto catFit = settings->get("CatFit").toString();
m_ui->catFitComboBox->setCurrentIndex(catFit == "fit" ? 0 : catFit == "fill" ? 1 : 2);
}
void AppearanceWidget::retranslateUi()
@ -245,9 +251,7 @@ void AppearanceWidget::updateConsolePreview()
workCursor.insertBlock();
};
print(QString("%1 version: %2\n")
.arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()),
MessageLevel::Launcher);
print(QString("%1 version: %2\n").arg(BuildConfig.LAUNCHER_DISPLAYNAME, BuildConfig.printableVersionString()), MessageLevel::Launcher);
QDate today = QDate::currentDate();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>700</height>
<height>711</height>
</rect>
</property>
<property name="minimumSize">
@ -203,6 +203,53 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="catFitLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Fit</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="catFitComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>77</width>
<height>30</height>
</size>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Fit</string>
</property>
</item>
<item>
<property name="text">
<string>Fill</string>
</property>
</item>
<item>
<property name="text">
<string>Stretch</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="catOpacityLabel">
<property name="text">
@ -372,8 +419,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="new">
<normaloff>.</normaloff>.</iconset>
<iconset theme="new"/>
</property>
<property name="flat">
<bool>true</bool>
@ -389,8 +435,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="centralmods">
<normaloff>.</normaloff>.</iconset>
<iconset theme="centralmods"/>
</property>
<property name="flat">
<bool>true</bool>
@ -406,8 +451,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="viewfolder">
<normaloff>.</normaloff>.</iconset>
<iconset theme="viewfolder"/>
</property>
<property name="flat">
<bool>true</bool>
@ -423,8 +467,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="launch">
<normaloff>.</normaloff>.</iconset>
<iconset theme="launch"/>
</property>
<property name="flat">
<bool>true</bool>
@ -440,8 +483,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="copy">
<normaloff>.</normaloff>.</iconset>
<iconset theme="copy"/>
</property>
<property name="flat">
<bool>true</bool>
@ -457,8 +499,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="export">
<normaloff>.</normaloff>.</iconset>
<iconset theme="export"/>
</property>
<property name="flat">
<bool>true</bool>
@ -474,8 +515,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="delete">
<normaloff>.</normaloff>.</iconset>
<iconset theme="delete"/>
</property>
<property name="flat">
<bool>true</bool>
@ -491,8 +531,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="about">
<normaloff>.</normaloff>.</iconset>
<iconset theme="about"/>
</property>
<property name="flat">
<bool>true</bool>
@ -508,8 +547,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="settings">
<normaloff>.</normaloff>.</iconset>
<iconset theme="settings"/>
</property>
<property name="flat">
<bool>true</bool>
@ -525,8 +563,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="cat">
<normaloff>.</normaloff>.</iconset>
<iconset theme="cat"/>
</property>
<property name="flat">
<bool>true</bool>
@ -586,6 +623,7 @@
<tabstop>reloadThemesButton</tabstop>
<tabstop>consoleFont</tabstop>
<tabstop>fontSizeBox</tabstop>
<tabstop>catFitComboBox</tabstop>
<tabstop>catOpacitySlider</tabstop>
<tabstop>consolePreview</tabstop>
</tabstops>