mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-18 11:55:38 +00:00
Qt: Add function to recreate the main window
This commit is contained in:
parent
971af2cb5c
commit
47f85dc453
|
@ -84,7 +84,7 @@ int main(int argc, char* argv[])
|
||||||
if (!ParseCommandLineParameters(app, host_interface.get(), &boot_params))
|
if (!ParseCommandLineParameters(app, host_interface.get(), &boot_params))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
std::unique_ptr<MainWindow> window = std::make_unique<MainWindow>(host_interface.get());
|
MainWindow* window = new MainWindow(host_interface.get());
|
||||||
|
|
||||||
if (!host_interface->Initialize())
|
if (!host_interface->Initialize())
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,6 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
int result = app.exec();
|
int result = app.exec();
|
||||||
|
|
||||||
window.reset();
|
|
||||||
host_interface->Shutdown();
|
host_interface->Shutdown();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,8 @@ MainWindow::MainWindow(QtHostInterface* host_interface)
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
Assert(!m_display_widget);
|
Assert(!m_display_widget);
|
||||||
m_host_interface->setMainWindow(nullptr);
|
if (m_host_interface->getMainWindow() == this)
|
||||||
|
m_host_interface->setMainWindow(nullptr);
|
||||||
|
|
||||||
Assert(!m_debugger_window);
|
Assert(!m_debugger_window);
|
||||||
}
|
}
|
||||||
|
@ -562,6 +563,19 @@ std::string MainWindow::getDeviceDiscPath(const QString& title)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::recreate()
|
||||||
|
{
|
||||||
|
if (m_emulation_running)
|
||||||
|
m_host_interface->synchronousPowerOffSystem();
|
||||||
|
|
||||||
|
close();
|
||||||
|
m_host_interface->setMainWindow(nullptr);
|
||||||
|
|
||||||
|
MainWindow* new_main_window = new MainWindow(m_host_interface);
|
||||||
|
new_main_window->initializeAndShow();
|
||||||
|
deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::onStartDiscActionTriggered()
|
void MainWindow::onStartDiscActionTriggered()
|
||||||
{
|
{
|
||||||
std::string path(getDeviceDiscPath(tr("Start Disc")));
|
std::string path(getDeviceDiscPath(tr("Start Disc")));
|
||||||
|
|
|
@ -150,6 +150,7 @@ private:
|
||||||
void updateMenuSelectedTheme();
|
void updateMenuSelectedTheme();
|
||||||
void ensureGameListLoaded();
|
void ensureGameListLoaded();
|
||||||
std::string getDeviceDiscPath(const QString& title);
|
std::string getDeviceDiscPath(const QString& title);
|
||||||
|
void recreate();
|
||||||
|
|
||||||
Ui::MainWindow m_ui;
|
Ui::MainWindow m_ui;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,8 @@ bool QtHostInterface::Initialize()
|
||||||
void QtHostInterface::Shutdown()
|
void QtHostInterface::Shutdown()
|
||||||
{
|
{
|
||||||
stopThread();
|
stopThread();
|
||||||
|
|
||||||
|
delete m_main_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtHostInterface::initializeOnThread()
|
bool QtHostInterface::initializeOnThread()
|
||||||
|
|
Loading…
Reference in a new issue