Skip to content

Commit e517fb8

Browse files
authored
fix(ui): minimize the settings window (#162)
2 parents 68e1151 + e628e7f commit e517fb8

6 files changed

Lines changed: 60 additions & 12 deletions

File tree

launcher/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ SET(LAUNCHER_SOURCES
10221022
ui/pages/global/MinecraftPage.h
10231023
ui/pages/global/LauncherPage.cpp
10241024
ui/pages/global/LauncherPage.h
1025+
ui/pages/global/AppearancePage.cpp
10251026
ui/pages/global/AppearancePage.h
10261027
ui/pages/global/ProxyPage.cpp
10271028
ui/pages/global/ProxyPage.h
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// SPDX-License-Identifier: GPL-3.0-only
2+
/*
3+
* Freesm Launcher - Minecraft Launcher
4+
* Copyright (C) 2026 so5iso4ka <so5iso4ka@icloud.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, version 3.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
#include "AppearancePage.h"
20+
21+
#include <QScrollArea>
22+
23+
AppearancePage::AppearancePage(QWidget* parent) : QWidget(parent), m_widget(new AppearanceWidget(false, this))
24+
{
25+
auto layout = new QVBoxLayout(this);
26+
layout->setContentsMargins(0, 0, 0, 0);
27+
28+
auto scrollArea = new QScrollArea(this);
29+
scrollArea->setWidgetResizable(true);
30+
scrollArea->setWidget(m_widget);
31+
32+
layout->addWidget(scrollArea);
33+
34+
if (const auto widgetLayout = qobject_cast<QVBoxLayout*>(m_widget->layout())) {
35+
widgetLayout->addStretch();
36+
}
37+
}
38+
39+
bool AppearancePage::apply()
40+
{
41+
m_widget->applySettings();
42+
return true;
43+
}
44+
45+
void AppearancePage::retranslate()
46+
{
47+
m_widget->retranslateUi();
48+
}

launcher/ui/pages/global/AppearancePage.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,21 @@
4545
class QTextCharFormat;
4646
class SettingsObject;
4747

48-
class AppearancePage : public AppearanceWidget, public BasePage {
48+
class AppearancePage : public QWidget, public BasePage {
4949
Q_OBJECT
5050

5151
public:
52-
explicit AppearancePage(QWidget* parent = nullptr) : AppearanceWidget(false, parent) { layout()->setContentsMargins(0, 0, 6, 0); }
52+
explicit AppearancePage(QWidget* parent = nullptr);
5353

5454
QString displayName() const override { return tr("Appearance"); }
5555
QIcon icon() const override { return QIcon::fromTheme("appearance"); }
5656
QString id() const override { return "appearance-settings"; }
5757
QString helpPage() const override { return "Launcher-settings"; }
5858

59-
bool apply() override
60-
{
61-
applySettings();
62-
return true;
63-
}
59+
bool apply() override;
6460

65-
void retranslate() override { retranslateUi(); }
61+
void retranslate() override;
62+
63+
private:
64+
AppearanceWidget* m_widget;
6665
};

launcher/ui/pages/global/LauncherPage.ui

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@
454454
</string>
455455
</property>
456456
<property name="text">
457-
<string>Suggest to update an existing instance during modpack installation
458-
</string>
457+
<string>Suggest to update an existing instance during modpack installation</string>
459458
</property>
460459
</widget>
461460
</item>

launcher/ui/themes/FreesmTheme.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ QString FreesmTheme::appStyleSheet()
138138
"rgba(150, 150, 150);}QScrollBar:vertical, QScrollBar:horizontal {background: none;border: none;}QScrollBar::add-line, "
139139
"QScrollBar::sub-line {background: none;border: none;width: 0px;height: 0px;}QScrollBar::add-page, QScrollBar::sub-page "
140140
"{background: none;}QScrollBar::up-arrow, QScrollBar::down-arrow,QScrollBar::left-arrow, QScrollBar::right-arrow {image: "
141-
"none;width: 0px;height: 0px;}QAbstractScrollArea {background-color: transparent;}QProgressBar {text-align: "
141+
"none;width: 0px;height: 0px;}QScrollBar::handle {min-height: 8px;min-width: 8px;}QAbstractScrollArea {background-color: "
142+
"transparent;}QProgressBar {text-align: "
142143
"right;background-color: "
143144
"qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:1, stop:0.119403 rgba(255, 255, 255, 20), stop:0.273632 rgba(0, 0, "
144145
"0, 0));border-radius: 1px;margin-top: 14px;margin-bottom: 14px;margin-right: 30px;}QProgressBar::chunk {background-color: "

launcher/ui/widgets/AppearanceWidget.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
<item>
601601
<widget class="QTextEdit" name="consolePreview">
602602
<property name="sizePolicy">
603-
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
603+
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
604604
<horstretch>0</horstretch>
605605
<verstretch>0</verstretch>
606606
</sizepolicy>

0 commit comments

Comments
 (0)