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).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "qmakeprofileinformation.h"
|
|
|
|
|
|
|
|
|
|
#include "qmakeprofileinformation.h"
|
|
|
|
|
#include "qmakeprofileconfigwidget.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
|
#include <qtsupport/qtprofileinformation.h>
|
|
|
|
|
|
|
|
|
|
namespace Qt4ProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
const char MKSPEC_INFORMATION[] = "QtPM4.mkSpecInformation";
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
|
|
|
|
|
QmakeProfileInformation::QmakeProfileInformation()
|
|
|
|
|
{
|
|
|
|
|
setObjectName(QLatin1String("QmakeProfileInformation"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Core::Id QmakeProfileInformation::dataId() const
|
|
|
|
|
{
|
|
|
|
|
static Core::Id id = Core::Id(Internal::MKSPEC_INFORMATION);
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int QmakeProfileInformation::priority() const
|
|
|
|
|
{
|
|
|
|
|
return 24000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant QmakeProfileInformation::defaultValue(ProjectExplorer::Profile *p) const
|
|
|
|
|
{
|
2012-06-20 15:43:01 +02:00
|
|
|
Q_UNUSED(p);
|
|
|
|
|
return QString();
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::Task> QmakeProfileInformation::validate(ProjectExplorer::Profile *p) const
|
|
|
|
|
{
|
|
|
|
|
QList<ProjectExplorer::Task> result;
|
|
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
|
|
|
|
|
|
|
|
|
|
Utils::FileName mkspec = QmakeProfileInformation::mkspec(p);
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::ProfileConfigWidget *
|
|
|
|
|
QmakeProfileInformation::createConfigWidget(ProjectExplorer::Profile *p) const
|
|
|
|
|
{
|
|
|
|
|
return new Internal::QmakeProfileConfigWidget(p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::ProfileInformation::ItemList QmakeProfileInformation::toUserOutput(ProjectExplorer::Profile *p) const
|
|
|
|
|
{
|
|
|
|
|
return ItemList() << qMakePair(tr("mkspec"), mkspec(p).toUserOutput());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName QmakeProfileInformation::mkspec(const ProjectExplorer::Profile *p)
|
|
|
|
|
{
|
|
|
|
|
if (!p)
|
|
|
|
|
return Utils::FileName();
|
|
|
|
|
return Utils::FileName::fromString(p->value(Core::Id(Internal::MKSPEC_INFORMATION)).toString());
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-20 15:43:01 +02:00
|
|
|
Utils::FileName QmakeProfileInformation::effectiveMkspec(const ProjectExplorer::Profile *p)
|
|
|
|
|
{
|
|
|
|
|
if (!p)
|
|
|
|
|
return Utils::FileName();
|
|
|
|
|
Utils::FileName spec = mkspec(p);
|
|
|
|
|
if (spec.isEmpty())
|
|
|
|
|
return defaultMkspec(p);
|
|
|
|
|
return spec;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
void QmakeProfileInformation::setMkspec(ProjectExplorer::Profile *p, const Utils::FileName &fn)
|
|
|
|
|
{
|
2012-06-20 15:43:01 +02:00
|
|
|
if (fn == defaultMkspec(p))
|
|
|
|
|
p->setValue(Core::Id(Internal::MKSPEC_INFORMATION), QString());
|
|
|
|
|
else
|
|
|
|
|
p->setValue(Core::Id(Internal::MKSPEC_INFORMATION), fn.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName QmakeProfileInformation::defaultMkspec(const ProjectExplorer::Profile *p)
|
|
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(p);
|
|
|
|
|
if (!version) // No version, so no qmake
|
|
|
|
|
return Utils::FileName();
|
|
|
|
|
|
2012-06-30 00:23:47 +02:00
|
|
|
return version->mkspecFor(ProjectExplorer::ToolChainProfileInformation::toolChain(p));
|
2012-04-24 15:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Qt4ProjectManager
|