Move the log trigger menu item into it's own menu, and remove the menu when unloading the plugin.

This commit is contained in:
dfighter1985 2014-06-09 17:55:45 +02:00
parent 4f09537f31
commit 6cd1f2c9d3
2 changed files with 8 additions and 2 deletions

View file

@ -45,6 +45,7 @@ namespace Plugin
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
logMenu = NULL;
} }
CLogPlugin::~CLogPlugin() CLogPlugin::~CLogPlugin()
@ -63,6 +64,9 @@ namespace Plugin
NLMISC::InfoLog->removeDisplayer(m_displayer); NLMISC::InfoLog->removeDisplayer(m_displayer);
delete m_displayer; delete m_displayer;
delete logMenu;
logMenu = NULL;
delete m_libContext; delete m_libContext;
m_libContext = NULL; m_libContext = NULL;
} }
@ -82,13 +86,13 @@ namespace Plugin
Core::ICore *core = Core::ICore::instance(); Core::ICore *core = Core::ICore::instance();
Core::MenuManager *menuManager = core->menuManager(); Core::MenuManager *menuManager = core->menuManager();
QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW);
QMainWindow *wnd = Core::ICore::instance()->mainWindow(); QMainWindow *wnd = Core::ICore::instance()->mainWindow();
wnd->addDockWidget(Qt::RightDockWidgetArea, this); wnd->addDockWidget(Qt::RightDockWidgetArea, this);
hide(); hide();
viewMenu->addAction(this->toggleViewAction()); logMenu = menuManager->menuBar()->addMenu( "Log" );
logMenu->addAction(toggleViewAction());
} }
void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext)

View file

@ -85,6 +85,8 @@ namespace Plugin
NLQT::CQtDisplayer *m_displayer; NLQT::CQtDisplayer *m_displayer;
QMenu *logMenu;
}; };
} // namespace Plugin } // namespace Plugin