Skip to content

Commit 3b78fbe

Browse files
committed
new update
1 parent edcc9b8 commit 3b78fbe

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

src/main.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "mainwindow.h"
22
#include "utils/colors.h"
3+
#include "onboardingdialog.h"
34
#include <QApplication>
45
#include <QFont>
6+
#include <QSettings>
57

68
QString getStyleSheet() {
79
return QString(R"(
@@ -141,8 +143,21 @@ int main(int argc, char *argv[]) {
141143
font.setStyleStrategy(QFont::PreferAntialias);
142144
app.setFont(font);
143145

146+
// Check for saved username, show onboarding if needed BEFORE main window
147+
QSettings settings("LuaPatcher", "SteamLuaPatcher");
148+
QString username = settings.value("username", "").toString();
149+
if (username.isEmpty()) {
150+
OnboardingDialog dialog;
151+
if (dialog.exec() == QDialog::Accepted) {
152+
username = dialog.username();
153+
settings.setValue("username", username);
154+
} else {
155+
return 0; // User closed onboarding, exit app
156+
}
157+
}
158+
144159
MainWindow window;
145-
window.show();
160+
window.showMaximized();
146161

147162
return app.exec();
148163
}

src/mainwindow.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "utils/colors.h"
1111
#include "utils/paths.h"
1212
#include "config.h"
13-
#include "onboardingdialog.h"
1413

1514
#include <QVBoxLayout>
1615
#include <QHBoxLayout>
@@ -109,19 +108,9 @@ MainWindow::MainWindow(QWidget* parent)
109108

110109
initUI();
111110

112-
// Check for saved username, show onboarding if needed
111+
// Retrieve username from settings (already checked in main.cpp)
113112
QSettings settings("LuaPatcher", "SteamLuaPatcher");
114-
m_username = settings.value("username", "").toString();
115-
if (m_username.isEmpty()) {
116-
QTimer::singleShot(100, this, [this]() {
117-
OnboardingDialog dialog(this);
118-
if (dialog.exec() == QDialog::Accepted) {
119-
m_username = dialog.username();
120-
QSettings s("LuaPatcher", "SteamLuaPatcher");
121-
s.setValue("username", m_username);
122-
}
123-
});
124-
}
113+
m_username = settings.value("username", "User").toString();
125114

126115
m_debounceTimer = new QTimer(this);
127116
m_debounceTimer->setSingleShot(true);

0 commit comments

Comments
 (0)