Commit 1cc239ef authored by Tim Jenssen's avatar Tim Jenssen Committed by Christian Stenger
Browse files

move create menu entries to extra function



Change-Id: Ia504e453b6cacc254ea598c629c3762c03cfa783
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent 2cc47c20
...@@ -83,6 +83,20 @@ bool AutotestPlugin::checkLicense() ...@@ -83,6 +83,20 @@ bool AutotestPlugin::checkLicense()
return true; 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) bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString)
{ {
// Register objects in the plugin manager's object pool // Register objects in the plugin manager's object pool
...@@ -98,16 +112,7 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri ...@@ -98,16 +112,7 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
if (!checkLicense()) if (!checkLicense())
return true; return true;
QAction *action = new QAction(tr("Autotest action"), this); initializeMenuEntries();
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);
m_settings->fromSettings(Core::ICore::settings()); m_settings->fromSettings(Core::ICore::settings());
TestSettingsPage *settingsPage = new TestSettingsPage(m_settings); TestSettingsPage *settingsPage = new TestSettingsPage(m_settings);
......
...@@ -50,6 +50,7 @@ private slots: ...@@ -50,6 +50,7 @@ private slots:
private: private:
bool checkLicense(); bool checkLicense();
void initializeMenuEntries();
const QSharedPointer<TestSettings> m_settings; const QSharedPointer<TestSettings> m_settings;
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment