void MenuBar::addFileMenu() { QMenu *m = new QMenu(Qrc::text("menubar.file"), this); QMenu *o = new QMenu(Qrc::text("menubar.file.open"), m); o->addAction(Qrc::text("menubar.file.open.apk"), parent(), SLOT(onMenuBarFileOpenApk()), QKeySequence::New); o->addAction(Qrc::text("menubar.file.open.dir"), parent(), SLOT(onMenuBarFileOpenDir()), QKeySequence::Open); o->addSeparator(); o->addAction(Qrc::text("menubar.file.open.file"), parent(), SLOT(onMenuBarFileOpenFile())); m->addAction(o->menuAction()); m->addSeparator(); m->addAction(Qrc::text("menubar.file.close"), parent(), SLOT(onMenuBarFileClose()), QKeySequence::Close); m->addAction(Qrc::text("menubar.file.close_all"), parent(), SLOT(onMenuBarFileCloseAll())); m->addSeparator(); m->addAction(Qrc::text("menubar.file.save"), parent(), SLOT(onMenuBarFileSave()), QKeySequence::Save); m->addAction(Qrc::text("menubar.file.save_all"), parent(), SLOT(onMenuBarFileSaveAll())); m->addSeparator(); QDir dir(Preferences::get()->previousProject()); if (dir.exists() && dir.exists("apktool.yml")) { _connections << connect(m->addAction(dir.dirName()), &QAction::triggered, [=] { emit projectOpen(dir.absolutePath()); }); } else { m->addAction(Qrc::text("menubar.file.recent_none"))->setEnabled(false); } m->addSeparator(); m->addAction(Qrc::text("menubar.file.terminal"), parent(), SLOT(onMenuBarFileTerminal())); m->addSeparator(); m->addAction(Qrc::text("menubar.file.quit"), parent(), SLOT(onMenuBarFileQuit()), QKeySequence::Quit); addAction(m->menuAction()); }
AS_NAMESPACE_START ToolBar::ToolBar(QWidget *p) : QToolBar(p) { addAction(Qrc::icon("toolbar_apk"), Qrc::text("toolbar.item.apk"), p, SLOT(onMenuBarFileOpenApk())); addAction(Qrc::icon("toolbar_dir"), Qrc::text("toolbar.item.dir"), p, SLOT(onMenuBarFileOpenDir())); addSeparator(); addAction(Qrc::icon("toolbar_save"), Qrc::text("toolbar.item.save"), p, SLOT(onMenuBarFileSave())); addSeparator(); addAction(Qrc::icon("toolbar_build"), Qrc::text("toolbar.item.build"), p, SLOT(onMenuBarProjectBuild())); addAction(Qrc::icon("toolbar_sign"), Qrc::text("toolbar.item.sign"), p, SLOT(onMenuBarProjectSignExport())); addSeparator(); addAction(Qrc::icon("toolbar_terminal"), Qrc::text("toolbar.item.terminal"), p, SLOT(onMenuBarFileTerminal())); addAction(Qrc::icon("toolbar_settings"), Qrc::text("toolbar.item.settings"), p, SLOT(onMenuBarEditSettings())); setObjectName("ToolBar"); }
void MenuBar::addFileMenu() { QMenu *m = new QMenu(__("file", "menubar"), this); QMenu *o = new QMenu(__("open", "menubar"), m); o->addAction(__("apk", "menubar"), parent(), SLOT(onMenuBarFileOpenApk()), QKeySequence::New); o->addAction(__("directory", "menubar"), parent(), SLOT(onMenuBarFileOpenDir()), QKeySequence::Open); o->addSeparator(); o->addAction(__("file", "menubar"), parent(), SLOT(onMenuBarFileOpenFile())); m->addAction(o->menuAction()); m->addSeparator(); m->addAction(__("close", "menubar"), parent(), SLOT(onMenuBarFileClose()), QKeySequence::Close); m->addAction(__("close_all", "menubar"), parent(), SLOT(onMenuBarFileCloseAll())); m->addSeparator(); m->addAction(__("save", "menubar"), parent(), SLOT(onMenuBarFileSave()), QKeySequence::Save); m->addAction(__("save_all", "menubar"), parent(), SLOT(onMenuBarFileSaveAll())); m->addSeparator(); m->addAction(__("terminal", "menubar"), parent(), SLOT(onMenuBarFileTerminal())); m->addSeparator(); m->addAction(__("quit", "menubar"), parent(), SLOT(onMenuBarFileQuit()), QKeySequence::Quit); addAction(m->menuAction()); }