2012-04-24 15:49:09 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
2012-07-19 12:26:56 +02:00
|
|
|
** Contact: http://www.qt-project.org/
|
2012-04-24 15:49:09 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** 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, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitinformation.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include "qmakekitinformation.h"
|
|
|
|
|
#include "qmakekitconfigwidget.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
|
|
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
const char MKSPEC_INFORMATION[] = "QtPM4.mkSpecInformation";
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QmakeKitInformation::QmakeKitInformation()
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
setObjectName(QLatin1String("QmakeKitInformation"));
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Core::Id QmakeKitInformation::dataId() const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
static Core::Id id = Core::Id(Internal::MKSPEC_INFORMATION);
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
unsigned int QmakeKitInformation::priority() const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
return 24000;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QVariant QmakeKitInformation::defaultValue(ProjectExplorer::Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
Q_UNUSED(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
return QString();
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
QList<ProjectExplorer::Task> QmakeKitInformation::validate(ProjectExplorer::Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::Task> result;
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Utils::FileName mkspec = QmakeKitInformation::mkspec(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
if (!version && !mkspec.isEmpty())
|
|
|
|
|
result << ProjectExplorer::Task(ProjectExplorer::Task::Warning,
|
|
|
|
|
tr("No Qt version set, so mkspec is ignored."),
|
|
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
if (version && !version->hasMkspec(mkspec))
|
|
|
|
|
result << ProjectExplorer::Task(ProjectExplorer::Task::Error,
|
|
|
|
|
tr("Mkspec not found for Qt version."),
|
|
|
|
|
Utils::FileName(), -1,
|
|
|
|
|
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::KitConfigWidget *
|
|
|
|
|
QmakeKitInformation::createConfigWidget(ProjectExplorer::Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
return new Internal::QmakeKitConfigWidget(k);
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
ProjectExplorer::KitInformation::ItemList QmakeKitInformation::toUserOutput(ProjectExplorer::Kit *k) const
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
return ItemList() << qMakePair(tr("mkspec"), mkspec(k).toUserOutput());
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Utils::FileName QmakeKitInformation::mkspec(const ProjectExplorer::Kit *k)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
if (!k)
|
2012-04-24 15:49:09 +02:00
|
|
|
return Utils::FileName();
|
2012-09-03 18:31:44 +02:00
|
|
|
return Utils::FileName::fromString(k->value(Core::Id(Internal::MKSPEC_INFORMATION)).toString());
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Utils::FileName QmakeKitInformation::effectiveMkspec(const ProjectExplorer::Kit *k)
|
2012-06-20 15:43:01 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
if (!k)
|
2012-06-20 15:43:01 +02:00
|
|
|
return Utils::FileName();
|
2012-09-03 18:31:44 +02:00
|
|
|
Utils::FileName spec = mkspec(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
if (spec.isEmpty())
|
2012-09-03 18:31:44 +02:00
|
|
|
return defaultMkspec(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
return spec;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
void QmakeKitInformation::setMkspec(ProjectExplorer::Kit *k, const Utils::FileName &fn)
|
2012-04-24 15:49:09 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
if (fn == defaultMkspec(k))
|
|
|
|
|
k->setValue(Core::Id(Internal::MKSPEC_INFORMATION), QString());
|
2012-06-20 15:43:01 +02:00
|
|
|
else
|
2012-09-03 18:31:44 +02:00
|
|
|
k->setValue(Core::Id(Internal::MKSPEC_INFORMATION), fn.toString());
|
2012-06-20 15:43:01 +02:00
|
|
|
}
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
Utils::FileName QmakeKitInformation::defaultMkspec(const ProjectExplorer::Kit *k)
|
2012-06-20 15:43:01 +02:00
|
|
|
{
|
2012-09-03 18:31:44 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
|
2012-06-20 15:43:01 +02:00
|
|
|
if (!version) // No version, so no qmake
|
|
|
|
|
return Utils::FileName();
|
|
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
return version->mkspecFor(ProjectExplorer::ToolChainKitInformation::toolChain(k));
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Qt4ProjectManager
|