Remove translation manager menu when unloading the plugin.
--HG-- branch : gsoc2014-dfighter
This commit is contained in:
parent
fb4dc15fe7
commit
828f31a2a4
2 changed files with 33 additions and 10 deletions
|
@ -47,6 +47,7 @@ namespace TranslationManager
|
|||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
menu = NULL;
|
||||
_ui.setupUi(this);
|
||||
|
||||
_ui.mdiArea->closeAllSubWindows();
|
||||
|
@ -59,10 +60,37 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||
connect(Core::ICore::instance(), SIGNAL(changeSettings()), this, SLOT(readSettings()));
|
||||
readSettings();
|
||||
createToolbar();
|
||||
createMenus();
|
||||
m_undoStack = new QUndoStack(this);
|
||||
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
removeMenus();
|
||||
}
|
||||
|
||||
void CMainWindow::removeMenus()
|
||||
{
|
||||
delete menu;
|
||||
menu = NULL;
|
||||
}
|
||||
|
||||
void CMainWindow::createMenus()
|
||||
{
|
||||
// Windows menu
|
||||
Core::MenuManager *menuManager = Core::ICore::instance()->menuManager();
|
||||
QMenu *m = menuManager->menuBar()->addMenu( "Translation Manager" );
|
||||
if( m != NULL )
|
||||
{
|
||||
windowMenu = m->addMenu("Window");
|
||||
menu = m;
|
||||
}
|
||||
|
||||
updateWindowsList();
|
||||
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
||||
}
|
||||
|
||||
// Functions that will insert the plugin buttons
|
||||
void CMainWindow::createToolbar()
|
||||
{
|
||||
|
@ -126,17 +154,8 @@ void CMainWindow::createToolbar()
|
|||
mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory"));
|
||||
connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile()));
|
||||
|
||||
// Windows menu
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
Core::MenuManager *menuManager = core->menuManager();
|
||||
QMenu *m = menuManager->menuBar()->addMenu( "Translation Manager" );
|
||||
if( m != NULL )
|
||||
{
|
||||
windowMenu = m->addMenu("Window");
|
||||
}
|
||||
|
||||
updateWindowsList();
|
||||
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList()));
|
||||
|
||||
// Undo, Redo actions
|
||||
QAction *undoAction = menuManager->action(Core::Constants::UNDO);
|
||||
|
|
|
@ -58,7 +58,7 @@ class CMainWindow : public QMainWindow
|
|||
|
||||
public:
|
||||
CMainWindow(QWidget *parent = 0);
|
||||
virtual ~CMainWindow() {}
|
||||
~CMainWindow();
|
||||
QUndoStack *m_undoStack;
|
||||
|
||||
public:
|
||||
|
@ -96,6 +96,7 @@ private:
|
|||
void updateToolbar(QMdiSubWindow *window);
|
||||
bool verifySettings();
|
||||
void readSettings();
|
||||
void removeMenus();
|
||||
void createMenus();
|
||||
void createToolbar();
|
||||
void initializeSettings(bool georges);
|
||||
|
@ -105,6 +106,9 @@ private:
|
|||
CEditorWorksheet *getEditorByWorksheetType(const QString &type);
|
||||
bool isWorksheetEditor(QString filename);
|
||||
bool isPhraseEditor(QString filename);
|
||||
|
||||
|
||||
QMenu *menu;
|
||||
};
|
||||
|
||||
class CCoreListener : public Core::ICoreListener
|
||||
|
|
Loading…
Reference in a new issue