diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2013-01-28 15:45:12 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2013-01-29 16:08:46 +0100 |
commit | 93a7d0e2dc4be3b3efa40c1fd507d039e478156a (patch) | |
tree | 829e9e8e8922ec8adb12e2b9ca2b9d49bb17b5ea /src/app/shared | |
parent | ecc425798f7a38f8c2c48b274dcd20965dfa792f (diff) |
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 <joerg.bornemann@digia.com>
Diffstat (limited to 'src/app/shared')
-rw-r--r-- | src/app/shared/qbssettings.h | 43 | ||||
-rw-r--r-- | src/app/shared/specialplatformssetup.cpp | 5 | ||||
-rw-r--r-- | src/app/shared/specialplatformssetup.h | 4 |
3 files changed, 49 insertions, 3 deletions
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 <tools/settings.h> + +#include <QSharedPointer> + +typedef QSharedPointer<qbs::Settings> 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<QString, QString> 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 |