コード例 #1
0
bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
                                           QtVersionCommandAccessor commandAccessor,
                                           const QString &fallbackBinary,
                                           const QStringList &additionalArguments,
                                           bool useMacOpenCommand,
                                           EditorLaunchData *data,
                                           QString *errorMessage) const
{
    // Get the binary either from the current Qt version of the project or Path
    if (ProjectExplorer::Project *project = ProjectExplorer::SessionManager::projectForFile(fileName)) {
        if (const ProjectExplorer::Target *target = project->activeTarget()) {
            if (const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target->kit())) {
                data->binary = (qtVersion->*commandAccessor)();
                data->workingDirectory = project->projectDirectory().toString();
            }
        }
    }
    if (data->binary.isEmpty()) {
        data->workingDirectory.clear();
        data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary);
    }
    if (data->binary.isEmpty()) {
        *errorMessage = msgAppNotFound(id().toString());
        return false;
    }
    // Setup binary + arguments, use Mac Open if appropriate
    data->arguments = additionalArguments;
    data->arguments.push_back(fileName);
    if (Utils::HostOsInfo::isMacHost() && useMacOpenCommand)
        createMacOpenCommand(&(data->binary), &(data->arguments));
    if (debug)
        qDebug() << Q_FUNC_INFO << '\n' << data->binary << data->arguments;
    return true;
}
コード例 #2
0
bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
                                           QtVersionCommandAccessor commandAccessor,
                                           const QString &fallbackBinary,
                                           const QStringList &additionalArguments,
                                           bool useMacOpenCommand,
                                           EditorLaunchData *data,
                                           QString *errorMessage) const
{
    // Get the binary either from the current Qt version of the project or Path
    if (const Qt4Project *project = qt4ProjectFor(fileName)) {
        if (const Qt4BaseTarget *target = project->activeTarget()) {
            if (const Qt4BuildConfiguration *qt4bc = target->activeBuildConfiguration()) {
                if (const QtSupport::BaseQtVersion *qtVersion = qt4bc->qtVersion()) {
                    data->binary = (qtVersion->*commandAccessor)();
                    data->workingDirectory = project->projectDirectory();
                }
            }
        }
    }
    if (data->binary.isEmpty()) {
        data->workingDirectory.clear();
        data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary);
    }
    if (data->binary.isEmpty()) {
        *errorMessage = msgAppNotFound(id());
        return false;
    }
    // Setup binary + arguments, use Mac Open if appropriate
    data->arguments = additionalArguments;
    data->arguments.push_back(fileName);
#ifdef Q_OS_MAC
    if (useMacOpenCommand)
        createMacOpenCommand(&(data->binary), &(data->arguments));
#else
    Q_UNUSED(useMacOpenCommand)
#endif
    if (debug)
        qDebug() << Q_FUNC_INFO << '\n' << data->binary << data->arguments;
    return true;
}