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