forked from qt-creator/qt-creator
QtSupport: Use FilePath for several BaseQtVersion members
uicCommand(), designerCommand(), linguistCommand(), qscxmlcCommand(), qmlsceneCommand(), qmlplugindumpCommand(). No change in functionality intented. Change-Id: I43121de559019f96c2c1ff3b423974dddfc37124 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <QTcpServer>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
@@ -65,14 +66,14 @@ static inline QString msgAppNotFound(const QString &id)
|
||||
static QString linguistBinary(const QtSupport::BaseQtVersion *qtVersion)
|
||||
{
|
||||
if (qtVersion)
|
||||
return qtVersion->linguistCommand();
|
||||
return qtVersion->linguistCommand().toString();
|
||||
return QLatin1String(Utils::HostOsInfo::isMacHost() ? "Linguist" : "linguist");
|
||||
}
|
||||
|
||||
static QString designerBinary(const QtSupport::BaseQtVersion *qtVersion)
|
||||
{
|
||||
if (qtVersion)
|
||||
return qtVersion->designerCommand();
|
||||
return qtVersion->designerCommand().toString();
|
||||
return QLatin1String(Utils::HostOsInfo::isMacHost() ? "Designer" : "designer");
|
||||
}
|
||||
|
||||
|
@@ -61,6 +61,8 @@
|
||||
#include <QTemporaryFile>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
QTableWidget* GenerateResource::createFilesTable(const QList<ResourceFile> &fileNames)
|
||||
@@ -183,7 +185,7 @@ void GenerateResource::generateMenuEntry()
|
||||
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(
|
||||
currentProject->activeTarget()->kit());
|
||||
QString rccBinary = qtVersion->rccCommand();
|
||||
FilePath rccBinary = qtVersion->rccCommand();
|
||||
|
||||
Utils::QtcProcess rccProcess;
|
||||
rccProcess.setWorkingDirectory(projectPath);
|
||||
@@ -207,7 +209,7 @@ void GenerateResource::generateMenuEntry()
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"A timeout occurred running \"%1\"")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
|
||||
}
|
||||
@@ -220,14 +222,14 @@ void GenerateResource::generateMenuEntry()
|
||||
if (rccProcess.exitStatus() != QProcess::NormalExit) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource", "\"%1\" crashed.")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
}
|
||||
if (rccProcess.exitCode() != 0) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"\"%1\" failed (exit code %2).")
|
||||
.arg(rccBinary + " " + arguments.join(" "))
|
||||
.arg(rccProcess.commandLine().toUserOutput())
|
||||
.arg(rccProcess.exitCode()));
|
||||
return;
|
||||
}
|
||||
@@ -360,9 +362,9 @@ void GenerateResource::generateMenuEntry()
|
||||
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(
|
||||
currentProject->activeTarget()->kit());
|
||||
QString rccBinary = qtVersion->rccCommand();
|
||||
FilePath rccBinary = qtVersion->rccCommand();
|
||||
|
||||
Utils::QtcProcess rccProcess;
|
||||
QtcProcess rccProcess;
|
||||
rccProcess.setWorkingDirectory(projectPath);
|
||||
|
||||
QXmlStreamReader reader;
|
||||
@@ -392,7 +394,7 @@ void GenerateResource::generateMenuEntry()
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"A timeout occurred running \"%1\"")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
}
|
||||
if (!stdOut.trimmed().isEmpty())
|
||||
@@ -404,14 +406,14 @@ void GenerateResource::generateMenuEntry()
|
||||
if (rccProcess.exitStatus() != QProcess::NormalExit) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource", "\"%1\" crashed.")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
}
|
||||
if (rccProcess.exitCode() != 0) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"\"%1\" failed (exit code %2).")
|
||||
.arg(rccBinary + " " + arguments.join(" "))
|
||||
.arg(rccProcess.commandLine().toUserOutput())
|
||||
.arg(rccProcess.exitCode()));
|
||||
return;
|
||||
}
|
||||
@@ -526,7 +528,7 @@ void GenerateResource::generateMenuEntry()
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"A timeout occurred running \"%1\"")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
|
||||
}
|
||||
@@ -539,14 +541,14 @@ void GenerateResource::generateMenuEntry()
|
||||
if (rccProcess.exitStatus() != QProcess::NormalExit) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource", "\"%1\" crashed.")
|
||||
.arg(rccBinary + " " + arguments.join(" ")));
|
||||
.arg(rccProcess.commandLine().toUserOutput()));
|
||||
return;
|
||||
}
|
||||
if (rccProcess.exitCode() != 0) {
|
||||
Core::MessageManager::writeDisrupting(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
"\"%1\" failed (exit code %2).")
|
||||
.arg(rccBinary + " " + arguments.join(" "))
|
||||
.arg(rccProcess.commandLine().toUserOutput())
|
||||
.arg(rccProcess.exitCode()));
|
||||
return;
|
||||
}
|
||||
|
@@ -156,7 +156,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
|
||||
projectInfo.qmlDumpPath.clear();
|
||||
const QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(activeKit);
|
||||
if (version && projectInfo.tryQmlDump) {
|
||||
projectInfo.qmlDumpPath = version->qmlplugindumpCommand();
|
||||
projectInfo.qmlDumpPath = version->qmlplugindumpCommand().toString();
|
||||
projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag();
|
||||
}
|
||||
|
||||
|
@@ -184,7 +184,7 @@ public:
|
||||
|
||||
void updateVersionInfo();
|
||||
|
||||
QString findHostBinary(HostBinaries binary) const;
|
||||
FilePath findHostBinary(HostBinaries binary) const;
|
||||
void updateMkspec();
|
||||
QHash<ProKey, ProString> versionInfo();
|
||||
static bool queryQMakeVariables(const FilePath &binary,
|
||||
@@ -235,13 +235,13 @@ public:
|
||||
|
||||
FilePath m_qmakeCommand;
|
||||
|
||||
QString m_rccCommand;
|
||||
QString m_uicCommand;
|
||||
QString m_designerCommand;
|
||||
QString m_linguistCommand;
|
||||
QString m_qscxmlcCommand;
|
||||
FilePath m_rccCommand;
|
||||
FilePath m_uicCommand;
|
||||
FilePath m_designerCommand;
|
||||
FilePath m_linguistCommand;
|
||||
FilePath m_qscxmlcCommand;
|
||||
FilePath m_qmlsceneCommand;
|
||||
QString m_qmlplugindumpCommand;
|
||||
FilePath m_qmlplugindumpCommand;
|
||||
|
||||
MacroExpanderWrapper m_expander;
|
||||
};
|
||||
@@ -991,30 +991,30 @@ FilePath BaseQtVersion::qtPackageSourcePath() const
|
||||
return d->m_data.qtSources;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::designerCommand() const
|
||||
FilePath BaseQtVersion::designerCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
if (d->m_designerCommand.isNull())
|
||||
return {};
|
||||
if (d->m_designerCommand.isEmpty())
|
||||
d->m_designerCommand = d->findHostBinary(Designer);
|
||||
return d->m_designerCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::linguistCommand() const
|
||||
FilePath BaseQtVersion::linguistCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
if (d->m_linguistCommand.isNull())
|
||||
return {};
|
||||
if (d->m_linguistCommand.isEmpty())
|
||||
d->m_linguistCommand = d->findHostBinary(Linguist);
|
||||
return d->m_linguistCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::qscxmlcCommand() const
|
||||
FilePath BaseQtVersion::qscxmlcCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
if (d->m_qscxmlcCommand.isNull())
|
||||
if (d->m_qscxmlcCommand.isEmpty())
|
||||
d->m_qscxmlcCommand = d->findHostBinary(QScxmlc);
|
||||
return d->m_qscxmlcCommand;
|
||||
}
|
||||
@@ -1033,40 +1033,38 @@ FilePath BaseQtVersion::qmlsceneCommand() const
|
||||
return d->m_qmlsceneCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::qmlplugindumpCommand() const
|
||||
FilePath BaseQtVersion::qmlplugindumpCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
if (!d->m_qmlplugindumpCommand.isNull())
|
||||
if (!d->m_qmlplugindumpCommand.isEmpty())
|
||||
return d->m_qmlplugindumpCommand;
|
||||
|
||||
const QString path
|
||||
= binPath().pathAppended(HostOsInfo::withExecutableSuffix("qmlplugindump")).toString();
|
||||
|
||||
d->m_qmlplugindumpCommand = QFileInfo(path).isFile() ? path : QString();
|
||||
const FilePath path = binPath() / HostOsInfo::withExecutableSuffix("qmlplugindump");
|
||||
d->m_qmlplugindumpCommand = path.isExecutableFile() ? path : FilePath();
|
||||
|
||||
return d->m_qmlplugindumpCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
|
||||
FilePath BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
|
||||
{
|
||||
QString baseDir;
|
||||
FilePath baseDir;
|
||||
if (q->qtVersion() < QtVersionNumber(5, 0, 0)) {
|
||||
baseDir = q->binPath().toString();
|
||||
baseDir = q->binPath();
|
||||
} else {
|
||||
switch (binary) {
|
||||
case Designer:
|
||||
case Linguist:
|
||||
case QScxmlc:
|
||||
baseDir = q->hostBinPath().toString();
|
||||
baseDir = q->hostBinPath();
|
||||
break;
|
||||
case Rcc:
|
||||
case Uic:
|
||||
if (q->qtVersion() >= QtVersionNumber(6, 1))
|
||||
baseDir = q->hostLibexecPath().toString();
|
||||
baseDir = q->hostLibexecPath();
|
||||
else
|
||||
baseDir = q->hostBinPath().toString();
|
||||
baseDir = q->hostBinPath();
|
||||
break;
|
||||
default:
|
||||
// Can't happen
|
||||
@@ -1075,9 +1073,7 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
|
||||
}
|
||||
|
||||
if (baseDir.isEmpty())
|
||||
return QString();
|
||||
if (!baseDir.endsWith('/'))
|
||||
baseDir += '/';
|
||||
return {};
|
||||
|
||||
QStringList possibleCommands;
|
||||
switch (binary) {
|
||||
@@ -1115,29 +1111,29 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
foreach (const QString &possibleCommand, possibleCommands) {
|
||||
const QString fullPath = baseDir + possibleCommand;
|
||||
if (QFileInfo(fullPath).isFile())
|
||||
return QDir::cleanPath(fullPath);
|
||||
for (const QString &possibleCommand : qAsConst(possibleCommands)) {
|
||||
const FilePath fullPath = baseDir / possibleCommand;
|
||||
if (fullPath.isExecutableFile())
|
||||
return fullPath;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString BaseQtVersion::rccCommand() const
|
||||
FilePath BaseQtVersion::rccCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
if (!d->m_rccCommand.isNull())
|
||||
return {};
|
||||
if (!d->m_rccCommand.isEmpty())
|
||||
return d->m_rccCommand;
|
||||
d->m_rccCommand = d->findHostBinary(Rcc);
|
||||
return d->m_rccCommand;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::uicCommand() const
|
||||
FilePath BaseQtVersion::uicCommand() const
|
||||
{
|
||||
if (!isValid())
|
||||
return QString();
|
||||
if (!d->m_uicCommand.isNull())
|
||||
return {};
|
||||
if (!d->m_uicCommand.isEmpty())
|
||||
return d->m_uicCommand;
|
||||
d->m_uicCommand = d->findHostBinary(Uic);
|
||||
return d->m_uicCommand;
|
||||
|
@@ -131,14 +131,14 @@ public:
|
||||
bool isInSourceDirectory(const Utils::FilePath &filePath);
|
||||
bool isSubProject(const Utils::FilePath &filePath) const;
|
||||
|
||||
QString rccCommand() const;
|
||||
Utils::FilePath rccCommand() const;
|
||||
// used by UiCodeModelSupport
|
||||
QString uicCommand() const;
|
||||
QString designerCommand() const;
|
||||
QString linguistCommand() const;
|
||||
QString qscxmlcCommand() const;
|
||||
Utils::FilePath uicCommand() const;
|
||||
Utils::FilePath designerCommand() const;
|
||||
Utils::FilePath linguistCommand() const;
|
||||
Utils::FilePath qscxmlcCommand() const;
|
||||
Utils::FilePath qmlsceneCommand() const;
|
||||
QString qmlplugindumpCommand() const;
|
||||
Utils::FilePath qmlplugindumpCommand() const;
|
||||
|
||||
QString qtVersionString() const;
|
||||
QtVersionNumber qtVersion() const;
|
||||
|
@@ -84,7 +84,7 @@ Utils::FilePath QScxmlcGenerator::command() const
|
||||
if (!version)
|
||||
return Utils::FilePath();
|
||||
|
||||
return Utils::FilePath::fromString(version->qscxmlcCommand());
|
||||
return version->qscxmlcCommand();
|
||||
}
|
||||
|
||||
QStringList QScxmlcGenerator::arguments() const
|
||||
|
@@ -62,7 +62,7 @@ Utils::FilePath UicGenerator::command() const
|
||||
if (!version)
|
||||
return Utils::FilePath();
|
||||
|
||||
return Utils::FilePath::fromString(version->uicCommand());
|
||||
return version->uicCommand();
|
||||
}
|
||||
|
||||
QStringList UicGenerator::arguments() const
|
||||
|
Reference in New Issue
Block a user