2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2009-03-10 14:20:07 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2009-03-10 14:20:07 +01:00
|
|
|
|
|
|
|
|
#include "genericprojectplugin.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
#include "genericbuildconfiguration.h"
|
2009-03-12 17:53:25 +01:00
|
|
|
#include "genericprojectwizard.h"
|
2009-03-16 11:08:07 +01:00
|
|
|
#include "genericprojectconstants.h"
|
|
|
|
|
#include "genericprojectfileseditor.h"
|
2009-03-18 13:33:00 +01:00
|
|
|
#include "genericmakestep.h"
|
2011-06-20 11:57:20 +02:00
|
|
|
#include "genericproject.h"
|
2009-03-10 14:20:07 +01:00
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
2011-06-20 11:57:20 +02:00
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
2015-02-26 13:38:54 +01:00
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2011-06-20 11:57:20 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2017-03-03 18:16:34 +01:00
|
|
|
#include <projectexplorer/projectmanager.h>
|
2015-01-13 15:50:37 +01:00
|
|
|
#include <projectexplorer/projecttree.h>
|
2013-08-24 23:10:17 +02:00
|
|
|
#include <projectexplorer/selectablefilesmodel.h>
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2015-11-03 13:03:39 +01:00
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
#include <utils/fileutils.h>
|
2015-02-04 09:32:46 +01:00
|
|
|
|
2017-02-28 16:31:07 +01:00
|
|
|
#include <QAction>
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2014-08-20 00:58:38 +02:00
|
|
|
using namespace Core;
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2012-08-14 15:37:38 +02:00
|
|
|
namespace GenericProjectManager {
|
|
|
|
|
namespace Internal {
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2018-02-02 14:17:52 +01:00
|
|
|
class GenericProjectPluginPrivate : public QObject
|
2009-03-10 14:20:07 +01:00
|
|
|
{
|
2018-02-02 14:17:52 +01:00
|
|
|
public:
|
|
|
|
|
GenericProjectPluginPrivate();
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2018-02-02 14:17:52 +01:00
|
|
|
ProjectFilesFactory projectFilesFactory;
|
|
|
|
|
GenericMakeAllStepFactory makeAllStepFactory;
|
|
|
|
|
GenericMakeCleanStepFactory makeCleanStepFactory;
|
|
|
|
|
GenericBuildConfigurationFactory buildConfigFactory;
|
2017-03-03 18:16:34 +01:00
|
|
|
|
2018-02-02 14:17:52 +01:00
|
|
|
QAction editFilesAction{GenericProjectPluginPrivate::tr("Edit Files..."), nullptr};
|
|
|
|
|
};
|
2009-03-10 14:20:07 +01:00
|
|
|
|
2018-02-02 14:17:52 +01:00
|
|
|
static GenericProjectPluginPrivate *dd = nullptr;
|
|
|
|
|
|
|
|
|
|
GenericProjectPlugin::~GenericProjectPlugin()
|
|
|
|
|
{
|
|
|
|
|
delete dd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GenericProjectPlugin::initialize(const QStringList &, QString *)
|
|
|
|
|
{
|
|
|
|
|
dd = new GenericProjectPluginPrivate;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GenericProjectPluginPrivate::GenericProjectPluginPrivate()
|
|
|
|
|
{
|
|
|
|
|
ProjectManager::registerProjectType<GenericProject>(Constants::GENERICMIMETYPE);
|
|
|
|
|
|
|
|
|
|
IWizardFactory::registerFactoryCreator([] { return QList<IWizardFactory *>{new GenericProjectWizard}; });
|
2015-05-22 17:16:36 +02:00
|
|
|
|
2013-08-30 16:38:57 +02:00
|
|
|
ActionContainer *mproject =
|
|
|
|
|
ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
|
2012-08-14 15:37:38 +02:00
|
|
|
|
2018-02-02 14:17:52 +01:00
|
|
|
Command *command = ActionManager::registerAction(&editFilesAction,
|
2017-12-20 11:13:26 +01:00
|
|
|
"GenericProjectManager.EditFiles", Context(Constants::GENERICPROJECT_ID));
|
2013-08-30 16:38:57 +02:00
|
|
|
command->setAttribute(Command::CA_Hide);
|
2011-06-20 11:57:20 +02:00
|
|
|
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES);
|
|
|
|
|
|
2018-02-21 10:32:48 +01:00
|
|
|
connect(&editFilesAction, &QAction::triggered, this, [] {
|
2018-02-02 14:17:52 +01:00
|
|
|
auto genericProject = qobject_cast<GenericProject *>(ProjectTree::currentProject());
|
|
|
|
|
if (!genericProject)
|
|
|
|
|
return;
|
|
|
|
|
SelectableFilesDialogEditFiles sfd(genericProject->projectDirectory(),
|
|
|
|
|
genericProject->files(Project::AllFiles),
|
|
|
|
|
ICore::mainWindow());
|
|
|
|
|
if (sfd.exec() == QDialog::Accepted)
|
|
|
|
|
genericProject->setFiles(Utils::transform(sfd.selectedFiles(), &Utils::FileName::toString));
|
|
|
|
|
});
|
2011-06-20 11:57:20 +02:00
|
|
|
}
|
|
|
|
|
|
2012-08-14 15:37:38 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace GenericProjectManager
|