Emu: msg_dialog_frame fixup: don't reject on Close to prevent Emu.Stop()

This commit is contained in:
Megamouse
2019-05-05 11:16:03 +02:00
parent b639584acc
commit c1e245ae73
4 changed files with 8 additions and 7 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ public:
virtual ~MsgDialogBase(); virtual ~MsgDialogBase();
virtual void Create(const std::string& msg, const std::string& title = "") = 0; virtual void Create(const std::string& msg, const std::string& title = "") = 0;
virtual void Close() = 0; virtual void Close(bool success) = 0;
virtual void SetMsg(const std::string& msg) = 0; virtual void SetMsg(const std::string& msg) = 0;
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0; virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0;
virtual void ProgressBarReset(u32 progressBarIndex) = 0; virtual void ProgressBarReset(u32 progressBarIndex) = 0;
+1 -1
View File
@@ -424,7 +424,7 @@ void Emulator::Init()
Emu.CallAfter([=] Emu.CallAfter([=]
{ {
dlg->Close(); dlg->Close(true);
}); });
} }
}); });
+4 -3
View File
@@ -13,7 +13,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
static const auto& barWidth = [](){return QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width();}; static const auto& barWidth = [](){return QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width();};
Close(); Close(true);
m_dialog = new custom_dialog(type.disable_cancel); m_dialog = new custom_dialog(type.disable_cancel);
m_dialog->setWindowTitle(title.empty() ? (type.se_normal ? "Normal dialog" : "Error dialog") : qstr(title)); m_dialog->setWindowTitle(title.empty() ? (type.se_normal ? "Normal dialog" : "Error dialog") : qstr(title));
@@ -148,11 +148,12 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
#endif #endif
} }
void msg_dialog_frame::Close() void msg_dialog_frame::Close(bool success)
{ {
if (m_dialog) if (m_dialog)
{ {
m_dialog->close(); m_dialog->done(success ? QDialog::Accepted : QDialog::Rejected);
m_dialog->deleteLater();
} }
} }
+2 -2
View File
@@ -38,7 +38,7 @@ private:
#elif HAVE_QTDBUS #elif HAVE_QTDBUS
int m_progress_value = 0; int m_progress_value = 0;
#endif #endif
custom_dialog* m_dialog =nullptr; custom_dialog* m_dialog = nullptr;
QLabel* m_text = nullptr; QLabel* m_text = nullptr;
QLabel* m_text1 = nullptr; QLabel* m_text1 = nullptr;
QLabel* m_text2 = nullptr; QLabel* m_text2 = nullptr;
@@ -53,7 +53,7 @@ public:
msg_dialog_frame(QWindow* taskbarTarget); msg_dialog_frame(QWindow* taskbarTarget);
~msg_dialog_frame(); ~msg_dialog_frame();
virtual void Create(const std::string& msg, const std::string& title = "") override; virtual void Create(const std::string& msg, const std::string& title = "") override;
virtual void Close() override; virtual void Close(bool success) override;
virtual void SetMsg(const std::string& msg) override; virtual void SetMsg(const std::string& msg) override;
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override; virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
virtual void ProgressBarReset(u32 progressBarIndex) override; virtual void ProgressBarReset(u32 progressBarIndex) override;