From 93a7d0e2dc4be3b3efa40c1fd507d039e478156a Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 28 Jan 2013 15:45:12 +0100 Subject: Do not hardcode the settings source in the library. This is inherently application-specific. Therefore, the library must not instantiate the Settings class itself anywhere; instead, a pre-allocated object comes in via the API. Change-Id: I04a101d5535508b9e165123b4efe06d957c0d171 Reviewed-by: Joerg Bornemann --- src/app/shared/qbssettings.h | 43 ++++++++++++++++++++++++++++++++ src/app/shared/specialplatformssetup.cpp | 5 ++-- src/app/shared/specialplatformssetup.h | 4 ++- 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 src/app/shared/qbssettings.h (limited to 'src/app/shared') diff --git a/src/app/shared/qbssettings.h b/src/app/shared/qbssettings.h new file mode 100644 index 000000000..37afb61b9 --- /dev/null +++ b/src/app/shared/qbssettings.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Build Suite. +** +** 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 QBS_QBS_SETTINGS +#define QBS_QBS_SETTINGS + +#include + +#include + +typedef QSharedPointer SettingsPtr; + +inline SettingsPtr qbsSettings() +{ + return SettingsPtr(new qbs::Settings(QLatin1String("QtProject"), QLatin1String("qbs"))); +} + +#endif // Include guard diff --git a/src/app/shared/specialplatformssetup.cpp b/src/app/shared/specialplatformssetup.cpp index 409cbd5a9..88d50d103 100644 --- a/src/app/shared/specialplatformssetup.cpp +++ b/src/app/shared/specialplatformssetup.cpp @@ -42,7 +42,8 @@ namespace qbs { -SpecialPlatformsSetup::SpecialPlatformsSetup() : m_stdout(stdout), m_helpRequested(false) {} +SpecialPlatformsSetup::SpecialPlatformsSetup(Settings *settings) + : m_stdout(stdout), m_helpRequested(false), m_settings(settings) {} SpecialPlatformsSetup::~SpecialPlatformsSetup() {} void SpecialPlatformsSetup::setup() @@ -143,7 +144,7 @@ void SpecialPlatformsSetup::registerProfile(const PlatformInfo &platformInfo) { m_stdout << tr("Setting up profile '%1'...").arg(platformInfo.name) << endl; - Profile profile(platformInfo.name); + Profile profile(platformInfo.name, m_settings); profile.removeProfile(); profile.setValue(QLatin1String("qbs.toolchain"), QLatin1String("gcc")); profile.setValue(QLatin1String("qbs.endianness"), QLatin1String("little-endian")); diff --git a/src/app/shared/specialplatformssetup.h b/src/app/shared/specialplatformssetup.h index 64e18199f..b26b903d0 100644 --- a/src/app/shared/specialplatformssetup.h +++ b/src/app/shared/specialplatformssetup.h @@ -35,6 +35,7 @@ QT_FORWARD_DECLARE_CLASS(QProcessEnvironment) namespace qbs { +class Settings; class SpecialPlatformsSetup { @@ -65,7 +66,7 @@ public: QHash environment; }; - SpecialPlatformsSetup(); + SpecialPlatformsSetup(Settings *settings); virtual ~SpecialPlatformsSetup(); void setup(); @@ -92,6 +93,7 @@ private: QString m_baseDir; QTextStream m_stdout; bool m_helpRequested; + Settings *m_settings; }; } // namespace qbs -- cgit v1.2.3