File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include " mainwindow.h"
22#include " utils/colors.h"
3+ #include " onboardingdialog.h"
34#include < QApplication>
45#include < QFont>
6+ #include < QSettings>
57
68QString 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}
Original file line number Diff line number Diff line change 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 );
You can’t perform that action at this time.
0 commit comments