diff options
author | Tim Jenssen <tim.jenssen@theqtcompany.com> | 2014-12-19 11:25:05 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2015-01-06 15:35:55 +0200 |
commit | 1cc239ef41d1e7d356979d3dca59c3489b1dfba7 (patch) | |
tree | d03eac3e6d908dc7771e70e332bfdc241503fca5 /plugins/autotest/autotestplugin.cpp | |
parent | 2cc47c2039c4b78c2f14b268ef156afd90255843 (diff) | |
download | qt-creator-1cc239ef41d1e7d356979d3dca59c3489b1dfba7.tar.gz |
move create menu entries to extra function
Change-Id: Ia504e453b6cacc254ea598c629c3762c03cfa783
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'plugins/autotest/autotestplugin.cpp')
-rw-r--r-- | plugins/autotest/autotestplugin.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 7823fdef2c..a4b3108cdd 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -83,6 +83,20 @@ bool AutotestPlugin::checkLicense() return true; } +void AutotestPlugin::initializeMenuEntries() +{ + QAction *action = new QAction(tr("Autotest action"), this); + Core::Command *command = Core::ActionManager::registerAction(action, Constants::ACTION_ID, + Core::Context(Core::Constants::C_GLOBAL)); + command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A"))); + connect(action, SIGNAL(triggered()), this, SLOT(triggerAction())); + + Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); + menu->menu()->setTitle(tr("Tests")); + menu->addAction(command); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); +} + bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString) { // Register objects in the plugin manager's object pool @@ -98,16 +112,7 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri if (!checkLicense()) return true; - QAction *action = new QAction(tr("Autotest action"), this); - Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID, - Core::Context(Core::Constants::C_GLOBAL)); - cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A"))); - connect(action, SIGNAL(triggered()), this, SLOT(triggerAction())); - - Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); - menu->menu()->setTitle(tr("Tests")); - menu->addAction(cmd); - Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); + initializeMenuEntries(); m_settings->fromSettings(Core::ICore::settings()); TestSettingsPage *settingsPage = new TestSettingsPage(m_settings); |