diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index 02e55416e3..54052af4ce 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -161,7 +161,11 @@ bool gui_application::Init() { welcome_dialog* welcome = new welcome_dialog(m_gui_settings, false); - welcome->exec(); + if (welcome->exec() == QDialog::Rejected) + { + // if the agreement on RPCS3's usage conditions was not accecped by the user, ask the main window to softly terminate + return false; + } } // Check maxfiles diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 9c02b4a0d9..ad7e2ce01f 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -1848,12 +1848,29 @@ void main_window::SaveWindowState() const // Save gui settings m_gui_settings->SetValue(gui::mw_geometry, saveGeometry(), false); m_gui_settings->SetValue(gui::mw_windowState, saveState(), false); - m_gui_settings->SetValue(gui::mw_mwState, m_mw->saveState(), true); - // Save column settings - m_game_list_frame->SaveSettings(); - // Save splitter state - m_debugger_frame->SaveSettings(); + // NOTE: + // + // This method is also invoked in case the gui_application::Init() method failed ("false" was returned) + // to initialize some modules leaving other modules uninitialized (NULL pointed). + // So, the following checks on NULL pointer are provided before accessing the related module's object + + if (m_mw != nullptr) + { + m_gui_settings->SetValue(gui::mw_mwState, m_mw->saveState(), true); + } + + if (m_game_list_frame != nullptr) + { + // Save column settings + m_game_list_frame->SaveSettings(); + } + + if (m_debugger_frame != nullptr) + { + // Save splitter state + m_debugger_frame->SaveSettings(); + } } void main_window::RepaintThumbnailIcons() diff --git a/rpcs3/rpcs3qt/welcome_dialog.cpp b/rpcs3/rpcs3qt/welcome_dialog.cpp index 00860f58a5..4efeaad4f1 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.cpp +++ b/rpcs3/rpcs3qt/welcome_dialog.cpp @@ -19,17 +19,12 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); - setWindowFlag(Qt::WindowCloseButtonHint, is_manual_show); + setWindowFlag(Qt::WindowCloseButtonHint, false); // disable the close button shown on the dialog's top right corner + layout()->setSizeConstraint(QLayout::SetFixedSize); - ui->okay->setEnabled(is_manual_show); - ui->i_have_read->setEnabled(!is_manual_show); - ui->i_have_read->setChecked(is_manual_show); - ui->do_not_show->setEnabled(!is_manual_show); - ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); - ui->use_dark_theme->setEnabled(!is_manual_show); - ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); ui->icon_label->load(QStringLiteral(":/rpcs3.svg")); - ui->label_3->setText(tr( + + ui->label_desc->setText(tr( R"(

RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.
@@ -51,11 +46,33 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool )" ).arg(gui::utils::get_link_style())); +#ifdef __APPLE__ + ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut")); + ui->use_dark_theme->setVisible(false); + ui->use_dark_theme->setEnabled(false); +#else + #ifndef _WIN32 + ui->create_applications_menu_shortcut->setText(tr("&Create Application Menu shortcut")); + #endif + + ui->use_dark_theme->setVisible(!is_manual_show); + ui->use_dark_theme->setEnabled(!is_manual_show); + ui->use_dark_theme->setChecked(gui::utils::dark_mode_active()); +#endif + + ui->accept->setEnabled(is_manual_show); + ui->reject->setVisible(!is_manual_show); + ui->i_have_read->setVisible(!is_manual_show); + ui->i_have_read->setChecked(is_manual_show); + ui->do_not_show->setVisible(!is_manual_show); + ui->do_not_show->setChecked(!m_gui_settings->GetValue(gui::ib_show_welcome).toBool()); + if (!is_manual_show) { connect(ui->i_have_read, &QCheckBox::clicked, this, [this](bool checked) { - ui->okay->setEnabled(checked); + ui->accept->setEnabled(checked); + ui->reject->setEnabled(!checked); }); connect(ui->do_not_show, &QCheckBox::clicked, this, [this](bool checked) @@ -64,20 +81,10 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool }); } - connect(ui->okay, &QPushButton::clicked, this, &QDialog::accept); + connect(ui->accept, &QPushButton::clicked, this, &QDialog::accept); // trigger "accept" signal (setting also dialog's result code to QDialog::Accepted) + connect(ui->reject, &QPushButton::clicked, this, &QDialog::reject); // trigger "reject" signal (setting also dialog's result code to QDialog::Rejected) -#ifdef _WIN32 - ui->create_applications_menu_shortcut->setText(tr("&Create Start Menu shortcut")); -#elif defined(__APPLE__) - ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut")); - ui->use_dark_theme->setVisible(false); -#else - ui->create_applications_menu_shortcut->setText(tr("&Create Application Menu shortcut")); -#endif - - layout()->setSizeConstraint(QLayout::SetFixedSize); - - connect(this, &QDialog::accepted, this, [this]() + connect(this, &QDialog::accepted, this, [this]() // "accept" signal's event handler { if (ui->create_desktop_shortcut->isChecked()) { @@ -94,6 +101,12 @@ welcome_dialog::welcome_dialog(std::shared_ptr gui_settings, bool m_gui_settings->SetValue(gui::m_currentStylesheet, gui::DarkStylesheet); } }); + + connect(this, &QDialog::rejected, this, [this]() // "reject" signal's event handler + { + // if the agreement on RPCS3's usage conditions was not accecped by the user, always display the initial welcome dialog at next startup + m_gui_settings->SetValue(gui::ib_show_welcome, QVariant(true)); + }); } welcome_dialog::~welcome_dialog() diff --git a/rpcs3/rpcs3qt/welcome_dialog.ui b/rpcs3/rpcs3qt/welcome_dialog.ui index a1026854ee..72e8a047c9 100644 --- a/rpcs3/rpcs3qt/welcome_dialog.ui +++ b/rpcs3/rpcs3qt/welcome_dialog.ui @@ -103,7 +103,7 @@ - + Arial @@ -201,7 +201,7 @@ - Use Dark Theme (Can Be Configured Later) + Use Dark Theme (can be configured later) @@ -233,7 +233,7 @@ 0 - + Continue @@ -242,6 +242,16 @@ + + + + Exit + + + true + + +