Clean up plugin

Change-Id: I695adb992f4d1f32f266f1628f2094e4bcc81485
Reviewed-by: Andre Poenitz <andre.poenitz@theqtcompany.com>
This commit is contained in:
Christian Stenger
2015-02-16 13:17:53 +01:00
parent 4caba7a3dd
commit b9a60137ad
7 changed files with 8 additions and 35 deletions

View File

@@ -18,6 +18,7 @@
#include "autotestplugin.h"
#include "autotestconstants.h"
#include "testcodeparser.h"
#include "testrunner.h"
#include "testsettings.h"
#include "testsettingspage.h"
@@ -67,7 +68,6 @@ AutotestPlugin::AutotestPlugin()
AutotestPlugin::~AutotestPlugin()
{
// Unregister objects from the plugin manager's object pool
// Delete members
TestTreeModel *model = TestTreeModel::instance();
delete model;
@@ -100,11 +100,12 @@ bool AutotestPlugin::checkLicense()
void AutotestPlugin::initializeMenuEntries()
{
QAction *action = new QAction(tr("Autotest action"), this);
QAction *action = new QAction(tr("Re&scan Tests"), 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()));
command->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+T,Alt+S")));
connect(action, &QAction::triggered,
TestTreeModel::instance()->parser(), &TestCodeParser::updateTestTree);
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
menu->menu()->setTitle(tr("Tests"));
@@ -114,13 +115,6 @@ void AutotestPlugin::initializeMenuEntries()
bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorString)
{
// Register objects in the plugin manager's object pool
// Load settings
// Add actions to menus
// Connect to other plugins' signals
// In the initialize function, a plugin can be sure that the plugins it
// depends on have initialized their members.
Q_UNUSED(arguments)
Q_UNUSED(errorString)
@@ -139,26 +133,13 @@ bool AutotestPlugin::initialize(const QStringList &arguments, QString *errorStri
void AutotestPlugin::extensionsInitialized()
{
// Retrieve objects from the plugin manager's object pool
// In the extensionsInitialized function, a plugin can be sure that all
// plugins that depend on it are completely initialized.
}
ExtensionSystem::IPlugin::ShutdownFlag AutotestPlugin::aboutToShutdown()
{
// Save settings
// Disconnect from signals that are not needed during shutdown
// Hide UI (if you add UI that is not in the main window directly)
return SynchronousShutdown;
}
void AutotestPlugin::triggerAction()
{
QMessageBox::information(Core::ICore::mainWindow(),
tr("Action triggered"),
tr("This is an action from Autotest."));
}
QList<QObject *> AutotestPlugin::createTestObjects() const
{
QList<QObject *> tests;