forked from qt-creator/qt-creator
ProjectExplorer: De-QObject-ify BuildConfigurationFactories
The QObject was not heavily used. Object name was for debugging only, translation context can be taken from the corresponding BuildConfiguration objects, the qobject_casts in the three big importers are replaced by dynamic_cast, which is good enough in that context. Take the opportunity to re-use translations from base BuildConfiguration for the common cases and sprinkle in some 'final'. Change-Id: I8e9727c98c6e943cb333556861c24e701c2bdf45 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -430,20 +430,18 @@ QbsBuildConfigurationFactory::QbsBuildConfigurationFactory()
|
||||
|
||||
BuildInfo info = createBuildInfo(k, BuildConfiguration::Debug);
|
||||
//: The name of the debug build configuration created by default for a qbs project.
|
||||
info.displayName = tr("Debug");
|
||||
info.displayName = BuildConfiguration::tr("Debug");
|
||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||
info.buildDirectory
|
||||
= defaultBuildDirectory(projectPath, k, tr("Debug", "Shadow build directory suffix"),
|
||||
info.buildType);
|
||||
const QString dbg = QbsBuildConfiguration::tr("Debug", "Shadow build directory suffix");
|
||||
info.buildDirectory = defaultBuildDirectory(projectPath, k, dbg, info.buildType);
|
||||
result << info;
|
||||
|
||||
info = createBuildInfo(k, BuildConfiguration::Release);
|
||||
//: The name of the release build configuration created by default for a qbs project.
|
||||
info.displayName = tr("Release");
|
||||
info.displayName = BuildConfiguration::tr("Release");
|
||||
//: Non-ASCII characters in directory suffix may cause build issues.
|
||||
info.buildDirectory
|
||||
= defaultBuildDirectory(projectPath, k, tr("Release", "Shadow build directory suffix"),
|
||||
info.buildType);
|
||||
const QString rel = QbsBuildConfiguration::tr("Release", "Shadow build directory suffix");
|
||||
info.buildDirectory = defaultBuildDirectory(projectPath, k, rel, info.buildType);
|
||||
result << info;
|
||||
|
||||
} else {
|
||||
@@ -462,7 +460,7 @@ BuildInfo QbsBuildConfigurationFactory::createBuildInfo(const Kit *k,
|
||||
BuildInfo info(this);
|
||||
info.kitId = k->id();
|
||||
info.buildType = type;
|
||||
info.typeName = tr("Build");
|
||||
info.typeName = BuildConfiguration::tr("Build");
|
||||
QVariantMap config;
|
||||
config.insert("configName", type == BuildConfiguration::Debug ? "Debug" : "Release");
|
||||
info.extraInfo = config;
|
||||
|
||||
@@ -95,10 +95,8 @@ private:
|
||||
QbsBuildSystem *m_buildSystem = nullptr;
|
||||
};
|
||||
|
||||
class QbsBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationFactory
|
||||
class QbsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QbsBuildConfigurationFactory();
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ Kit *QbsProjectImporter::createKit(void *directoryData) const
|
||||
const QList<BuildInfo> QbsProjectImporter::buildInfoListForKit(const Kit *k, void *directoryData) const
|
||||
{
|
||||
qCDebug(qbsPmLog) << "creating build info for kit" << k->displayName();
|
||||
const auto factory = qobject_cast<QbsBuildConfigurationFactory *>(
|
||||
const auto factory = dynamic_cast<QbsBuildConfigurationFactory *>(
|
||||
BuildConfigurationFactory::find(k, projectFilePath()));
|
||||
if (!factory) {
|
||||
qCDebug(qbsPmLog) << "no build config factory found";
|
||||
|
||||
Reference in New Issue
Block a user