Skip to content

Commit e628e7f

Browse files
committed
feat(ui): make appearance page scrollable
Signed-off-by: so5iso4ka <so5iso4ka@icloud.com>
1 parent b5dd637 commit e628e7f

4 files changed

Lines changed: 57 additions & 9 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/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)