mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 17:35:43 +00:00
Unsaved changes bugfix, added close event for start window
This commit is contained in:
@@ -28,24 +28,29 @@ CStartWindow::~CStartWindow()
|
||||
delete mpModelEditor;
|
||||
}
|
||||
|
||||
void CStartWindow::closeEvent(QCloseEvent *pEvent)
|
||||
{
|
||||
if (mpWorldEditor->close())
|
||||
qApp->quit();
|
||||
else
|
||||
pEvent->ignore();
|
||||
}
|
||||
|
||||
void CStartWindow::on_actionOpen_MLVL_triggered()
|
||||
{
|
||||
QString WorldFile = QFileDialog::getOpenFileName(this, "Open MLVL", "", "Metroid Prime World (*.MLVL)");
|
||||
if (WorldFile.isEmpty()) return;
|
||||
|
||||
if (mpWorldEditor->CheckUnsavedChanges())
|
||||
if (mpWorldEditor->close())
|
||||
{
|
||||
gResCache.SetFolder(TString(WorldFile.toStdString()).GetFileDirectory());
|
||||
mpWorld = gResCache.GetResource(WorldFile.toStdString());
|
||||
mpWorldEditor->close();
|
||||
|
||||
FillWorldUI();
|
||||
}
|
||||
}
|
||||
|
||||
void CStartWindow::FillWorldUI()
|
||||
{
|
||||
|
||||
CStringTable *pWorldName = mpWorld->GetWorldName();
|
||||
if (pWorldName)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ class CStartWindow : public QMainWindow
|
||||
public:
|
||||
explicit CStartWindow(QWidget *parent = 0);
|
||||
~CStartWindow();
|
||||
void closeEvent(QCloseEvent *pEvent);
|
||||
|
||||
private slots:
|
||||
void on_actionOpen_MLVL_triggered();
|
||||
|
||||
@@ -93,6 +93,8 @@ void CWorldEditor::closeEvent(QCloseEvent *pEvent)
|
||||
|
||||
if (ShouldClose)
|
||||
{
|
||||
mUndoStack.clear();
|
||||
|
||||
if (mpPoiDialog)
|
||||
mpPoiDialog->close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user