remove "exit to proejct selection"

This commit is contained in:
T1ti
2024-04-26 22:56:41 +02:00
parent b1511fb669
commit 053fad877c
2 changed files with 22 additions and 11 deletions

View File

@@ -110,19 +110,21 @@ namespace Noggit::Ui::Windows
}
);
auto mapmenu_action(file_menu->addAction("Exit"));
QObject::connect(mapmenu_action, &QAction::triggered, [this]
auto proj_selec_action(file_menu->addAction("Exit to Project Selection"));
QObject::connect(proj_selec_action, &QAction::triggered, [this]
{
// auto noggit = Noggit::Application::NoggitApplication::instance();
// auto project_selection = new Noggit::Ui::Windows::NoggitProjectSelectionWindow(noggit);
// project_selection->show();
exit_to_project_selection = true;
close();
}
);
auto proj_selec_action(file_menu->addAction("Exit to Project Selection"));
QObject::connect(proj_selec_action, &QAction::triggered, [this]
auto mapmenu_action(file_menu->addAction("Exit"));
QObject::connect(mapmenu_action, &QAction::triggered, [this]
{
auto noggit = Noggit::Application::NoggitApplication::instance();
auto project_selection = new Noggit::Ui::Windows::NoggitProjectSelectionWindow(noggit);
project_selection->show();
close();
}
);
@@ -481,6 +483,7 @@ namespace Noggit::Ui::Windows
{
event->accept();
}
exit_to_project_selection = false;
}
void NoggitWindow::handleEventMapListContextMenuPinMap(int mapId, std::string MapName)
@@ -505,6 +508,7 @@ namespace Noggit::Ui::Windows
prompt.setText("Exit?");
prompt.setInformativeText("Any unsaved changes will be lost.");
prompt.addButton("Exit", QMessageBox::DestructiveRole);
if (!exit_to_project_selection)
prompt.addButton("Return to menu", QMessageBox::AcceptRole);
prompt.setDefaultButton(prompt.addButton("Cancel", QMessageBox::RejectRole));
prompt.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint);
@@ -525,6 +529,12 @@ namespace Noggit::Ui::Windows
case QMessageBox::DestructiveRole:
Noggit::Ui::Tools::ViewportManager::ViewportManager::unloadAll();
setCentralWidget(_null_widget = new QWidget(this));
if (exit_to_project_selection)
{
auto noggit = Noggit::Application::NoggitApplication::instance();
auto project_selection = new Noggit::Ui::Windows::NoggitProjectSelectionWindow(noggit);
project_selection->show();
}
event->accept();
break;
default:

View File

@@ -93,6 +93,7 @@ namespace Noggit::Ui::Windows
std::unique_ptr<World> _world;
bool map_loaded = false;
bool exit_to_project_selection = false;
virtual void closeEvent (QCloseEvent*) override;
};