add Quit action
This commit is contained in:
parent
6f965e5218
commit
00d0793b67
|
|
@ -6,6 +6,7 @@
|
|||
#include <NazaraEditor/Core/Application/Actions/EditorAction_Level_New.hpp>
|
||||
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_Clear.hpp>
|
||||
#include <NazaraEditor/Core/Application/Actions/EditorAction_Log_CopyToClipboard.hpp>
|
||||
#include <NazaraEditor/Core/Application/Actions/EditorAction_Quit.hpp>
|
||||
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
||||
#include <NazaraEditor/Core/Application/EditorLogger.hpp>
|
||||
#include <NazaraEditor/Core/Application/Level.hpp>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <NazaraEditor/Core/Application/Action.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARAEDITOR_CORE_API EditorAction_Quit final
|
||||
: public EditorAction
|
||||
{
|
||||
EDITORACTION_BODY(EditorAction_Quit, false);
|
||||
|
||||
public:
|
||||
void Execute() override;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#include <NazaraEditor/Core/Application/Actions/EditorAction_Quit.hpp>
|
||||
#include <NazaraEditor/Core/Application/BaseApplication.hpp>
|
||||
#include <NazaraEditor/Core/UI/PopupManager.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
void EditorAction_Quit::Execute()
|
||||
{
|
||||
Nz::EditorPopupManager::Instance()->CreatePopup({
|
||||
.title = "Warning",
|
||||
.description = "Are you sure you want to exit? All unsaved work will be discarded",
|
||||
.choices = {
|
||||
{
|
||||
.name = "Yes",
|
||||
.callback = []() { Nz::EditorBaseApplication::Instance()->Quit(); }
|
||||
},
|
||||
{
|
||||
.name = "No"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -64,6 +64,12 @@ int WinMain(int argc, char* argv[])
|
|||
.path = "Copy to Clipboard",
|
||||
.category = "Output",
|
||||
});
|
||||
app.RegisterAction<Nz::EditorAction_Quit>({
|
||||
.description = "Exits the editor",
|
||||
.path = "File|Exit",
|
||||
.category = "General",
|
||||
.shortcut = Nz::Shortcut::Create(Nz::Keyboard::VKey::F4, false, false, true),
|
||||
});
|
||||
|
||||
entt::meta<Nz::NodeComponent>()
|
||||
.type(entt::type_hash<Nz::NodeComponent>::value())
|
||||
|
|
|
|||
Loading…
Reference in New Issue