Commit e4651a28 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

External editors: Fall back to path if not found in Qt version.

Use Designer/Linguist executables from path if (embedded)
Qt version does not ship them.

Task-number: QTCREATORBUG-4826
Change-Id: Ide2fe0e59a8ea8f93a9193e0f97877631ce68470
Reviewed-on: http://codereview.qt.nokia.com/502

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
parent 8e66c35f
...@@ -78,8 +78,8 @@ static inline QString msgAppNotFound(const QString &id) ...@@ -78,8 +78,8 @@ static inline QString msgAppNotFound(const QString &id)
// -- Commands and helpers // -- Commands and helpers
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
static const char * const linguistBinaryC = "Linguist"; static const char linguistBinaryC[] = "Linguist";
static const char * const designerBinaryC = "Designer"; static const char designerBinaryC[] = "Designer";
// Mac: Change the call 'Foo.app/Contents/MacOS/Foo <filelist>' to // Mac: Change the call 'Foo.app/Contents/MacOS/Foo <filelist>' to
// 'open -a Foo.app <filelist>'. doesn't support generic command line arguments // 'open -a Foo.app <filelist>'. doesn't support generic command line arguments
...@@ -94,15 +94,15 @@ static void createMacOpenCommand(QString *binary, QStringList *arguments) ...@@ -94,15 +94,15 @@ static void createMacOpenCommand(QString *binary, QStringList *arguments)
} }
} }
#else #else
static const char * const linguistBinaryC = "linguist"; static const char linguistBinaryC[] = "linguist";
static const char * const designerBinaryC = "designer"; static const char designerBinaryC[] = "designer";
#endif #endif
static const char * const designerIdC = "Qt.Designer"; static const char designerIdC[] = "Qt.Designer";
static const char * const linguistIdC = "Qt.Linguisr"; static const char linguistIdC[] = "Qt.Linguist";
static const char * const designerDisplayName = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt Designer"); static const char designerDisplayName[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt Designer");
static const char * const linguistDisplayName = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt Linguist"); static const char linguistDisplayName[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Qt Linguist");
// -------------- ExternalQtEditor // -------------- ExternalQtEditor
ExternalQtEditor::ExternalQtEditor(const QString &id, ExternalQtEditor::ExternalQtEditor(const QString &id,
...@@ -139,20 +139,18 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName, ...@@ -139,20 +139,18 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
EditorLaunchData *data, EditorLaunchData *data,
QString *errorMessage) const QString *errorMessage) const
{ {
const Qt4Project *project = qt4ProjectFor(fileName);
// Get the binary either from the current Qt version of the project or Path // Get the binary either from the current Qt version of the project or Path
if (project) { if (const Qt4Project *project = qt4ProjectFor(fileName)) {
if (!project->activeTarget() || if (const Qt4BaseTarget *target = project->activeTarget()) {
!project->activeTarget()->activeBuildConfiguration()) if (const Qt4BuildConfiguration *qt4bc = target->activeBuildConfiguration()) {
return false; if (const QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion()) {
Qt4BuildConfiguration *qt4bc = project->activeTarget()->activeBuildConfiguration(); data->binary = (qtVersion->*commandAccessor)();
QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion(); data->workingDirectory = project->projectDirectory();
if (!qtVersion) }
return false; }
}
data->binary = (qtVersion->*commandAccessor)(); }
data->workingDirectory = project->projectDirectory(); if (data->binary.isEmpty()) {
} else {
data->workingDirectory.clear(); data->workingDirectory.clear();
data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary); data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment