[DEV] add exit menu

This commit is contained in:
Edouard DUPIN 2017-01-30 22:29:19 +01:00
parent 06624bb21e
commit f273f809c2

View File

@ -182,6 +182,8 @@ void MainWindows::init() {
myMenu->add(idMenuFile, "_T{Save As ...}", "", "menu:save-as"); myMenu->add(idMenuFile, "_T{Save As ...}", "", "menu:save-as");
myMenu->addSpacer(); myMenu->addSpacer();
myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.edf", "menu:property"); myMenu->add(idMenuFile, "_T{Properties}", "THEME:GUI:Parameter.edf", "menu:property");
myMenu->addSpacer();
myMenu->add(idMenuFile, "_T{Exit}", "", "menu:exit");
int32_t idMenuEdit = myMenu->addTitle("_T{Edit}"); int32_t idMenuEdit = myMenu->addTitle("_T{Edit}");
myMenu->add(idMenuEdit, "_T{Goto line ...}","", "menu:goto-line"); myMenu->add(idMenuEdit, "_T{Goto line ...}","", "menu:goto-line");
int32_t idMenuSearch = myMenu->addTitle("_T{Search}"); int32_t idMenuSearch = myMenu->addTitle("_T{Search}");
@ -226,6 +228,7 @@ void MainWindows::init() {
shortCutAdd("ctrl+f", "menu:search"); shortCutAdd("ctrl+f", "menu:search");
shortCutAdd("F12", "menu:reloade-shader"); shortCutAdd("F12", "menu:reloade-shader");
shortCutAdd("alt+F4", "menu:exit");
// TODO : auto-connect on shortcut event ==> maybe do beter later ... // TODO : auto-connect on shortcut event ==> maybe do beter later ...
signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut); signalShortcut.connect(sharedFromThis(), &MainWindows::onCallbackShortCut);
m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile); m_bufferManager->signalSelectFile.connect(sharedFromThis(), &MainWindows::onCallbackselectNewFile);
@ -247,6 +250,8 @@ void MainWindows::onCallbackMenuEvent(const std::string& _value) {
if (m_bufferManager != nullptr) { if (m_bufferManager != nullptr) {
m_bufferManager->createNewBuffer(); m_bufferManager->createNewBuffer();
} }
} else if (_value == "menu:exit") {
gale::getContext().stop();
} else if (_value == "menu:open") { } else if (_value == "menu:open") {
displayOpen(); displayOpen();
} else if (_value == "menu:close") { } else if (_value == "menu:close") {