forked from qt-creator/qt-creator
TaskHandler: Add task handler that let's you jump into the configuration
... wire it up so that "No compiler found in kit" gets you to the kits page. Change-Id: Ie7b34d285a6d2eef81ccd5fdc86d91bcd0254515 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
66
src/plugins/projectexplorer/configtaskhandler.cpp
Normal file
66
src/plugins/projectexplorer/configtaskhandler.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "configtaskhandler.h"
|
||||
|
||||
#include "task.h"
|
||||
#include "taskhub.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
ConfigTaskHandler::ConfigTaskHandler(const Task &pattern, Core::Id group, Core::Id page) :
|
||||
m_pattern(pattern),
|
||||
m_targetGroup(group),
|
||||
m_targetPage(page)
|
||||
{ }
|
||||
|
||||
bool ConfigTaskHandler::canHandle(const ProjectExplorer::Task &task) const
|
||||
{
|
||||
return task.description == m_pattern.description
|
||||
&& task.category == m_pattern.category;
|
||||
}
|
||||
|
||||
void ConfigTaskHandler::handle(const ProjectExplorer::Task &task)
|
||||
{
|
||||
Q_UNUSED(task);
|
||||
Core::ICore::showOptionsDialog(m_targetGroup, m_targetPage);
|
||||
}
|
||||
|
||||
QAction *ConfigTaskHandler::createAction(QObject *parent) const
|
||||
{
|
||||
QAction *action = new QAction(Core::ICore::msgShowOptionsDialog(), parent);
|
||||
action->setToolTip(Core::ICore::msgShowOptionsDialogToolTip());
|
||||
return action;
|
||||
}
|
61
src/plugins/projectexplorer/configtaskhandler.h
Normal file
61
src/plugins/projectexplorer/configtaskhandler.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef PROJECTEXPLORER_CONFIGTASKHANDLER_H
|
||||
#define PROJECTEXPLORER_CONFIGTASKHANDLER_H
|
||||
|
||||
#include "itaskhandler.h"
|
||||
|
||||
#include "task.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class ConfigTaskHandler : public ITaskHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigTaskHandler(const Task &pattern, Core::Id group, Core::Id page);
|
||||
|
||||
bool canHandle(const Task &task) const;
|
||||
void handle(const Task &task);
|
||||
QAction *createAction(QObject *parent) const;
|
||||
|
||||
private:
|
||||
const Task m_pattern;
|
||||
|
||||
const Core::Id m_targetGroup;
|
||||
const Core::Id m_targetPage;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
#endif // PROJECTEXPLORER_CONFIGTASKHANDLER_H
|
@@ -30,6 +30,7 @@
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include "buildsteplist.h"
|
||||
#include "configtaskhandler.h"
|
||||
#include "customwizard/customwizard.h"
|
||||
#include "deployablefile.h"
|
||||
#include "deployconfiguration.h"
|
||||
@@ -418,6 +419,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
addAutoReleasedObject(new ShowInEditorTaskHandler);
|
||||
addAutoReleasedObject(new VcsAnnotateTaskHandler);
|
||||
addAutoReleasedObject(new RemoveTaskHandler);
|
||||
addAutoReleasedObject(new ConfigTaskHandler(Task::compilerMissingTask(),
|
||||
Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||
Constants::KITS_SETTINGS_PAGE_ID));
|
||||
addAutoReleasedObject(new CoreListener);
|
||||
|
||||
d->m_outputPane = new AppOutputPane;
|
||||
|
@@ -8,6 +8,7 @@ HEADERS += projectexplorer.h \
|
||||
ansifilterparser.h \
|
||||
buildinfo.h \
|
||||
clangparser.h \
|
||||
configtaskhandler.h \
|
||||
environmentaspect.h \
|
||||
environmentaspectwidget.h \
|
||||
gcctoolchain.h \
|
||||
@@ -154,6 +155,7 @@ SOURCES += projectexplorer.cpp \
|
||||
abiwidget.cpp \
|
||||
ansifilterparser.cpp \
|
||||
clangparser.cpp \
|
||||
configtaskhandler.cpp \
|
||||
environmentaspect.cpp \
|
||||
environmentaspectwidget.cpp \
|
||||
gcctoolchain.cpp \
|
||||
|
@@ -49,6 +49,7 @@ QtcPlugin {
|
||||
"clangparser.cpp", "clangparser.h",
|
||||
"codestylesettingspropertiespage.cpp", "codestylesettingspropertiespage.h", "codestylesettingspropertiespage.ui",
|
||||
"compileoutputwindow.cpp", "compileoutputwindow.h",
|
||||
"configtaskhandler.cpp", "configtaskhandler.h",
|
||||
"copytaskhandler.cpp", "copytaskhandler.h",
|
||||
"corelistenercheckingforrunningbuild.cpp", "corelistenercheckingforrunningbuild.h",
|
||||
"currentprojectfilter.cpp", "currentprojectfilter.h",
|
||||
|
Reference in New Issue
Block a user