void AndroidBuildApkWidget::updateKeyStorePath(const QString &path)
{
    Utils::FileName file = Utils::FileName::fromString(path);
    m_step->setKeystorePath(file);
    m_ui->signPackageCheckBox->setChecked(!file.isEmpty());
    if (!file.isEmpty())
        setCertificates();
}
void AndroidPackageCreationWidget::on_KeystoreLocationPushButton_clicked()
{
    Utils::FileName keystorePath = m_step->keystorePath();
    if (keystorePath.isEmpty())
        keystorePath = Utils::FileName::fromString(QDir::homePath());
    Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select keystore file"), keystorePath.toString(), tr("Keystore files (*.keystore *.jks)")));
    if (file.isEmpty())
        return;
    m_ui->KeystoreLocationLineEdit->setText(file.toUserOutput());
    m_step->setKeystorePath(file);
    m_ui->signPackageCheckBox->setChecked(false);
}
Beispiel #3
0
void IosSimulatorToolHandlerPrivate::requestRunApp(const QString &bundlePath,
                                                   const QStringList &extraArgs,
                                                   IosToolHandler::RunKind runType,
                                                   const QString &deviceId, int timeout)
{
    Q_UNUSED(timeout);
    this->bundlePath = bundlePath;
    this->deviceId = deviceId;
    this->runKind = runType;
    QStringList args;

    args << QLatin1String("launch") << bundlePath;
    Utils::FileName devPath = IosConfigurations::developerPath();
    if (!devPath.isEmpty())
        args << QLatin1String("--developer-path") << devPath.toString();
    addDeviceArguments(args);
    switch (runType) {
    case IosToolHandler::NormalRun:
        break;
    case IosToolHandler::DebugRun:
        args << QLatin1String("--wait-for-debugger");
        break;
    }
    args << QLatin1String("--args") << extraArgs;
    op = OpAppRun;
    start(IosToolHandler::iosSimulatorToolPath(), args);
}
void AndroidSettingsWidget::gdbserverLocationX86EditingFinished()
{
    Utils::FileName location = Utils::FileName::fromUserInput(m_ui->GdbserverLocationLineEditx86->text());
    if (location.isEmpty() || !location.toFileInfo().exists())
        return;
    m_androidConfig.x86GdbserverLocation = location;
}
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
{
    m_ui->toolchainVersionComboBox->setEnabled(false);
    m_ui->GdbLocationLineEdit->setEnabled(false);
    m_ui->GdbLocationPushButton->setEnabled(false);
    m_ui->GdbserverLocationLineEdit->setEnabled(false);
    m_ui->GdbserverLocationPushButton->setEnabled(false);
    if (location.isEmpty())
        return false;
    Utils::FileName platformPath = location;
    Utils::FileName toolChainPath = location;
    Utils::FileName sourcesPath = location;
    if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
            || !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
            || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
        QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android NDK top folder").arg(location.toUserOutput()));
        return false;
    }
    m_androidConfig.ndkLocation = location;
    m_ui->toolchainVersionComboBox->setEnabled(true);
    m_ui->GdbLocationLineEdit->setEnabled(true);
    m_ui->GdbLocationPushButton->setEnabled(true);
    m_ui->GdbserverLocationLineEdit->setEnabled(true);
    m_ui->GdbserverLocationPushButton->setEnabled(true);
    return true;

}
void BaseCheckoutWizardFactory::runWizard(const QString &path, QWidget *parent, const QString &platform,
                                   const QVariantMap &extraValues)
{
    Q_UNUSED(platform);
    Q_UNUSED(extraValues);
    // Create dialog and launch

    Utils::FileName checkoutPath;
    {
        QScopedPointer<BaseCheckoutWizard> wizard(m_wizardCreator(Utils::FileName::fromString(path), parent));
        wizard->setWindowTitle(displayName());
        checkoutPath = wizard->run();
    }

    if (checkoutPath.isEmpty())
        return;

    // Now try to find the project file and open
    QString errorMessage;
    const QString projectFile = openProject(checkoutPath, &errorMessage);
    if (projectFile.isEmpty()) {
        QMessageBox msgBox(QMessageBox::Warning, tr("Cannot Open Project"),
                           tr("Failed to open project in \"%1\".").arg(checkoutPath.toUserOutput()));
        msgBox.setDetailedText(errorMessage);
        msgBox.addButton(QMessageBox::Ok);
        msgBox.exec();
    }
}
bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
{
    if (location.isEmpty()) {
        m_ui->sdkWarningIconLabel->setVisible(false);
        m_ui->sdkWarningLabel->setVisible(false);
        return false;
    }
    Utils::FileName adb = location;
    Utils::FileName androidExe = location;
    Utils::FileName androidBat = location;
    Utils::FileName emulator = location;
    if (!adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
            || (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
                && !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
            || !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) {
        m_ui->sdkWarningIconLabel->setVisible(true);
        m_ui->sdkWarningLabel->setVisible(true);
        m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
        return false;
    } else {
        m_ui->sdkWarningIconLabel->setVisible(false);
        m_ui->sdkWarningLabel->setVisible(false);
    }
    return true;
}
QList<AndroidToolChainFactory::AndroidToolChainInformation> AndroidToolChainFactory::toolchainPathsForNdk(const Utils::FileName &ndkPath)
{
    QList<AndroidToolChainInformation> result;
    if (ndkPath.isEmpty())
        return result;
    QRegExp versionRegExp(NDKGccVersionRegExp);
    FileName path = ndkPath;
    QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
                    QStringList() << QLatin1String("*"), QDir::Dirs);
    while (it.hasNext()) {
        const QString &fileName = QFileInfo(it.next()).fileName();
        int idx = versionRegExp.indexIn(fileName);
        if (idx == -1)
            continue;
        AndroidToolChainInformation ati;
        ati.version = fileName.mid(idx + 1);
        QString platform = fileName.left(idx);
        ati.architecture = AndroidConfig::architectureForToolChainPrefix(platform);
        if (ati.architecture == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
            continue;
        // AndroidToolChain *tc = new AndroidToolChain(arch, version, true);
        ati.compilerCommand = AndroidConfigurations::currentConfig().gccPath(ati.architecture, ati.version);
        // tc->setCompilerCommand(compilerPath);
        result.append(ati);
    }
    return result;
}
Beispiel #9
0
QString BaseQtVersion::defaultDisplayName(const QString &versionString, const Utils::FileName &qmakePath,
                                          bool fromPath)
{
    QString location;
    if (qmakePath.isEmpty()) {
        location = QCoreApplication::translate("QtVersion", "<unknown>");
    } else {
        // Deduce a description from '/foo/qt-folder/[qtbase]/bin/qmake' -> '/foo/qt-folder'.
        // '/usr' indicates System Qt 4.X on Linux.
        QDir dir = qmakePath.toFileInfo().absoluteDir();
        do {
            const QString dirName = dir.dirName();
            if (dirName == QLatin1String("usr")) { // System-installed Qt.
                location = QCoreApplication::translate("QtVersion", "System");
                break;
            }
            if (dirName.compare(QLatin1String("bin"), Qt::CaseInsensitive)
                && dirName.compare(QLatin1String("qtbase"), Qt::CaseInsensitive)) {
                location = dirName;
                break;
            }
        } while (dir.cdUp());
    }

    return fromPath ?
        QCoreApplication::translate("QtVersion", "Qt %1 in PATH (%2)").arg(versionString, location) :
        QCoreApplication::translate("QtVersion", "Qt %1 (%2)").arg(versionString, location);
}
void AndroidSettingsWidget::openJDKLocationEditingFinished()
{
    Utils::FileName location = Utils::FileName::fromUserInput(m_ui->OpenJDKLocationLineEdit->text());
    if (location.isEmpty() || !location.toFileInfo().exists())
        return;
    m_androidConfig.openJDKLocation = location;
}
Beispiel #11
0
bool BazaarControl::isConfigured() const
{
    const Utils::FileName binary = m_bazaarClient->vcsBinary();
    if (binary.isEmpty())
        return false;
    QFileInfo fi = binary.toFileInfo();
    return fi.exists() && fi.isFile() && fi.isExecutable();
}
void AndroidSettingsWidget::browseOpenJDKLocation()
{
    Utils::FileName openJDKPath = AndroidConfigurations::instance().openJDKPath();
    Utils::FileName file = Utils::FileName::fromString(QFileDialog::getExistingDirectory(this, tr("Select OpenJDK Path"), openJDKPath.toString()));
    if (file.isEmpty())
        return;
    m_ui->OpenJDKLocationLineEdit->setText(file.toUserOutput());
    openJDKLocationEditingFinished();
}
void AndroidSettingsWidget::browseGdbserverLocationX86()
{
    Utils::FileName gdbserverPath = AndroidConfigurations::instance().gdbServerPath(ProjectExplorer::Abi::X86Architecture);
    Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select gdbserver android executable"), gdbserverPath.toString()));
    if (file.isEmpty())
        return;
    m_ui->GdbserverLocationLineEditx86->setText(file.toUserOutput());
    gdbserverLocationX86EditingFinished();
}
bool BlackBerryDeviceConfigurationWizardConfigPage::isComplete() const
{
    bool configurationNameComplete = !m_ui->configurationNameField->text().isEmpty();
    Utils::FileName fileName = Utils::FileName::fromString(m_ui->debugTokenCombo->currentText());
    bool debugTokenComplete = m_holder.isSimulator || !m_holder.isProductionDevice
            || (!fileName.isEmpty() && fileName.toFileInfo().exists());

    return configurationNameComplete  &&  debugTokenComplete;
}
Beispiel #15
0
static QList<ProjectExplorer::Abi> guessGccAbi(const Utils::FileName &path, const QStringList &env)
{
    if (path.isEmpty())
        return QList<ProjectExplorer::Abi>();

    QStringList arguments(QLatin1String("-dumpmachine"));
    QString machine = QString::fromLocal8Bit(runGcc(path, arguments, env)).trimmed();
    return guessGccAbi(machine);
}
Beispiel #16
0
Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
{
    if (AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target)) {
        Utils::FileName source = androidQtSupport->manifestSourcePath(target);
        if (!source.isEmpty())
            return source;
    }
    return manifestPath(target);
}
void AndroidSettingsWidget::browseNDKLocation()
{
    Utils::FileName dir = Utils::FileName::fromString(
                QFileDialog::getExistingDirectory(this, tr("Select Android NDK folder"),
                                                  m_ui->NDKLocationLineEdit->text()));
    if (dir.isEmpty())
        return;
    m_ui->NDKLocationLineEdit->setText(dir.toUserOutput());
    ndkLocationEditingFinished();
}
Beispiel #18
0
QStringList QmlProject::makeAbsolute(const Utils::FileName &path, const QStringList &relativePaths)
{
    if (path.isEmpty())
        return relativePaths;

    const QDir baseDir(path.toString());
    return Utils::transform(relativePaths, [&baseDir](const QString &path) {
        return QDir::cleanPath(baseDir.absoluteFilePath(path));
    });
}
void BuildConfiguration::prependCompilerPathToEnvironment(Kit *k, Utils::Environment &env)
{
    const ToolChain *tc
            = ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);

    if (!tc)
        return;

    const Utils::FileName compilerDir = tc->compilerCommand().parentDir();
    if (!compilerDir.isEmpty())
        env.prependOrSetPath(compilerDir.toString());
}
void QmakeBuildConfigurationFactory::configureBuildConfiguration(Target *parent,
                                                                 QmakeBuildConfiguration *bc,
                                                                 const QmakeBuildInfo *qmakeInfo) const
{
    BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(parent->kit());

    BaseQtVersion::QmakeBuildConfigs config = version->defaultBuildConfig();
    if (qmakeInfo->buildType == BuildConfiguration::Debug)
        config |= QtSupport::BaseQtVersion::DebugBuild;
    else
        config &= ~QtSupport::BaseQtVersion::DebugBuild;

    bc->setDefaultDisplayName(qmakeInfo->displayName);
    bc->setDisplayName(qmakeInfo->displayName);

    BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
    BuildStepList *cleanSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_CLEAN));
    Q_ASSERT(buildSteps);
    Q_ASSERT(cleanSteps);

    QMakeStep *qmakeStep = new QMakeStep(buildSteps);
    buildSteps->insertStep(0, qmakeStep);

    MakeStep *makeStep = new MakeStep(buildSteps);
    buildSteps->insertStep(1, makeStep);

    MakeStep *cleanStep = new MakeStep(cleanSteps);
    cleanStep->setClean(true);
    cleanStep->setUserArguments(QLatin1String("clean"));
    cleanSteps->insertStep(0, cleanStep);

    QString additionalArguments = qmakeInfo->additionalArguments;
    if (!additionalArguments.isEmpty())
        qmakeStep->setUserArguments(additionalArguments);
    qmakeStep->setLinkQmlDebuggingLibrary(qmakeInfo->config.linkQmlDebuggingQQ2);
    qmakeStep->setSeparateDebugInfo(qmakeInfo->config.separateDebugInfo);
    qmakeStep->setUseQtQuickCompiler(qmakeInfo->config.useQtQuickCompiler);

    bc->setQMakeBuildConfiguration(config);

    Utils::FileName directory = qmakeInfo->buildDirectory;
    if (directory.isEmpty()) {
        directory = defaultBuildDirectory(parent->project()->projectFilePath().toString(),
                                          parent->kit(), qmakeInfo->displayName, bc->buildType());
    }

    bc->setBuildDirectory(directory);
}
Utils::FileName IosRunConfiguration::bundleDirectory() const
{
    Utils::FileName res;
    Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
    bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
    if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
        qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
        return res;
    }
    QmakeBuildConfiguration *bc =
            qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
    if (bc) {
        QmakeProject *pro = qobject_cast<QmakeProject *>(target()->project());
        const QmakeProFileNode *node = 0;
        if (pro)
            node = pro->rootQmakeProjectNode();
        if (node)
            node = node->findProFileFor(profilePath());
        if (node) {
            TargetInformation ti = node->targetInformation();
            if (ti.valid)
                res = FileName::fromString(ti.buildDir);
        }
        if (res.isEmpty())
            res = bc->buildDirectory();
        switch (bc->buildType()) {
        case BuildConfiguration::Debug :
        case BuildConfiguration::Unknown :
            if (isDevice)
                res.appendPath(QLatin1String("Debug-iphoneos"));
            else
                res.appendPath(QLatin1String("Debug-iphonesimulator"));
            break;
        case BuildConfiguration::Release :
            if (isDevice)
                res.appendPath(QLatin1String("Release-iphoneos"));
            else
                res.appendPath(QLatin1String("Release-iphonesimulator"));
            break;
        default:
            qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
                     << target()->activeBuildConfiguration()->buildType();
        }
    }
    res.appendPath(applicationName() + QLatin1String(".app"));
    return res;
}
bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
{
    if (location.isEmpty())
        return false;
    Utils::FileName adb = location;
    Utils::FileName androidExe = location;
    Utils::FileName androidBat = location;
    Utils::FileName emulator = location;
    if (!adb.appendPath(QLatin1String("platform-tools/adb" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
            || (!androidExe.appendPath(QLatin1String("/tools/android" ANDROID_EXE_SUFFIX)).toFileInfo().exists()
                && !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
            || !emulator.appendPath(QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX)).toFileInfo().exists()) {
        QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" doesn't seem to be an Android SDK top folder").arg(location.toUserOutput()));
        return false;
    }
    return true;
}
static inline QString detectSsh()
{
    const QByteArray gitSsh = qgetenv("GIT_SSH");
    if (!gitSsh.isEmpty())
        return QString::fromLocal8Bit(gitSsh);
#if QT_VERSION >= 0x050000
    QString ssh = QStandardPaths::findExecutable(QLatin1String(defaultSshC));
#else
    const Utils::Environment env = Utils::Environment::systemEnvironment();
    QString ssh = env.searchInPath(QLatin1String(defaultSshC));
#endif
    if (!ssh.isEmpty())
        return ssh;
    if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
        Utils::FileName path = GerritPlugin::gitBinDirectory();
        if (!path.isEmpty())
            ssh = path.appendPath(QLatin1String(defaultSshC)).toString();
    }
    return ssh;
}
Beispiel #24
0
Utils::FileName GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
{
    // Locate binary in path if one is specified, otherwise default
    // to pathless binary
    if (ok)
        *ok = true;
    if (errorMessage)
        errorMessage->clear();

    Utils::FileName binPath = binaryPath();
    if (binPath.isEmpty()) {
        if (ok)
            *ok = false;
        if (errorMessage)
            *errorMessage = QCoreApplication::translate("Git::Internal::GitSettings",
                                                        "The binary \"%1\" could not be located in the path \"%2\"")
                .arg(stringValue(binaryPathKey), stringValue(pathKey));
    }
    return binPath;
}
QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const
{
    CMakeTool *tool = CMakeKitInformation::cmakeTool(k);
    if (!tool)
        return QString();
    QStringList known = tool->supportedGenerators();
    auto it = std::find_if(known.constBegin(), known.constEnd(),
                           [](const QString &s) { return s == QLatin1String("CodeBlocks - Ninja"); });
    if (it != known.constEnd()) {
        Utils::Environment env = Utils::Environment::systemEnvironment();
        k->addToEnvironment(env);
        const Utils::FileName ninjaExec = env.searchInPath(QLatin1String("ninja"));
        if (ninjaExec.isEmpty())
            it = known.constEnd(); // Ignore ninja generator without ninja exectuable
    }
    if (Utils::HostOsInfo::isWindowsHost()) {
        // *sigh* Windows with its zoo of incompatible stuff again...
        ToolChain *tc = ToolChainKitInformation::toolChain(k, ToolChain::Language::Cxx);
        if (tc && tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID) {
            if (it == known.constEnd())
                it = std::find_if(known.constBegin(), known.constEnd(),
                                  [](const QString &s) { return s == QLatin1String("CodeBlocks - MinGW Makefiles"); });
        } else {
            if (it == known.constEnd())
                it = std::find_if(known.constBegin(), known.constEnd(),
                                  [](const QString &s) { return s == QLatin1String("CodeBlocks - NMake Makefiles"); });
        }

    } else {
        // Unix-oid OSes:
        if (it == known.constEnd())
            it = std::find_if(known.constBegin(), known.constEnd(),
                              [](const QString &s) { return s == QLatin1String("CodeBlocks - Unix Makefiles"); });
    }
    if (it == known.constEnd())
        it = known.constBegin(); // Fallback to the first generator...
    if (it != known.constEnd())
        return *it;
    return QString();
}
QList<ToolChain *> AndroidToolChainFactory::createToolChainsForNdk(const Utils::FileName &ndkPath)
{
    QList<ToolChain *> result;
    if (ndkPath.isEmpty())
        return result;
    QRegExp versionRegExp(NDKGccVersionRegExp);
    FileName path = ndkPath;
    QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
                    QStringList() << QLatin1String("*"), QDir::Dirs);
    QMap<Abi::Architecture, AndroidToolChain *> newestToolChainForArch;

    while (it.hasNext()) {
        const QString &fileName = QFileInfo(it.next()).fileName();
        int idx = versionRegExp.indexIn(fileName);
        if (idx == -1)
            continue;
        QString version = fileName.mid(idx + 1);
        QString platform = fileName.left(idx);
        Abi::Architecture arch = AndroidConfig::architectureForToolChainPrefix(platform);
        if (arch == Abi::UnknownArchitecture) // e.g. mipsel which is not yet supported
            continue;
        AndroidToolChain *tc = new AndroidToolChain(arch, version, ToolChain::AutoDetection);
        FileName compilerPath = AndroidConfigurations::currentConfig().gccPath(arch, version);
        tc->setCompilerCommand(compilerPath);
        result.append(tc);

        QMap<Abi::Architecture, AndroidToolChain *>::const_iterator it
                = newestToolChainForArch.constFind(arch);
        if (it == newestToolChainForArch.constEnd())
            newestToolChainForArch.insert(arch, tc);
        else if (versionCompareLess(it.value(), tc))
            newestToolChainForArch[arch] = tc;
    }

    foreach (ToolChain *tc, result) {
        AndroidToolChain *atc = static_cast<AndroidToolChain *>(tc);
        if (newestToolChainForArch.value(atc->targetAbi().architecture()) != atc)
            atc->setSecondaryToolChain(true);
    }
void AndroidSettingsWidget::searchForAnt(const Utils::FileName &location)
{
    if (!m_androidConfig.antLocation().isEmpty())
            return;
    if (location.isEmpty())
        return;
    QDir parentFolder = location.toFileInfo().absoluteDir();
    foreach (const QString &file, parentFolder.entryList()) {
        if (file.startsWith(QLatin1String("apache-ant"))) {
            Utils::FileName ant = Utils::FileName::fromString(parentFolder.absolutePath());
            ant.appendPath(file).appendPath(QLatin1String("bin"));
            if (Utils::HostOsInfo::isWindowsHost())
                ant.appendPath(QLatin1String("ant.bat"));
            else
                ant.appendPath(QLatin1String("ant"));
            if (ant.toFileInfo().exists()) {
                m_androidConfig.setAntLocation(ant);
                m_ui->AntLocationLineEdit->setText(ant.toUserOutput());
            }
        }
    }
}
Beispiel #28
0
void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
        const Utils::FileName &newPath)
{
    Q_UNUSED(oldPath);

    if (!newPath.isEmpty()) {
        Utils::MimeDatabase mdb;
        setMimeType(mdb.mimeTypeForFile(newPath.toFileInfo()).name());

        disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
        connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));

        // Un-Register/Register in ModelManager
        m_editorDocumentHandle.reset();
        m_editorDocumentHandle.reset(new CppEditorDocumentHandleImpl(this));

        resetProcessor();
        updatePreprocessorSettings();
        m_processorRevision = document()->revision();
        processDocument();
    }
}
Beispiel #29
0
SystemPreprocessor::SystemPreprocessor(bool verbose)
    : m_verbose(verbose)
{
    m_knownCompilers[portableExecutableName(QLatin1String("gcc"))]
        = QLatin1String("-DCPLUSPLUS_WITHOUT_QT -U__BLOCKS__ -xc++ -E -include");
    m_knownCompilers[portableExecutableName(QLatin1String("cl"))]
        = QLatin1String("/DCPLUSPLUS_WITHOUT_QT /U__BLOCKS__ /TP /E /I . /FI");

    QMapIterator<QString, QString> i(m_knownCompilers);
    while (i.hasNext()) {
        i.next();
        const Utils::FileName executablePath
            = Utils::Environment::systemEnvironment().searchInPath(i.key());
        if (!executablePath.isEmpty()) {
            m_compiler = i.key();
            m_compilerArguments = i.value().split(QLatin1Char(' '), QString::SkipEmptyParts);
            m_compilerArguments
                    << QDir::toNativeSeparators(QLatin1String(PATH_PREPROCESSOR_CONFIG));
            break;
        }
    }
}
Beispiel #30
0
///
/// Returns all arguments
/// That is: possbile subpath
/// spec
/// config arguemnts
/// moreArguments
/// user arguments
QString QMakeStep::allArguments(bool shorted)
{
    Qt4BuildConfiguration *bc = qt4BuildConfiguration();
    QStringList arguments;
    if (bc->subNodeBuild())
        arguments << QDir::toNativeSeparators(bc->subNodeBuild()->path());
    else if (shorted)
        arguments << QDir::toNativeSeparators(QFileInfo(project()->document()->fileName()).fileName());
    else
        arguments << QDir::toNativeSeparators(project()->document()->fileName());

    arguments << QLatin1String("-r");
    bool userProvidedMkspec = false;
    for (Utils::QtcProcess::ConstArgIterator ait(m_userArgs); ait.next(); ) {
        if (ait.value() == QLatin1String("-spec")) {
            if (ait.next()) {
                userProvidedMkspec = true;
                break;
            }
        }
    }
    Utils::FileName specArg = mkspec();
    if (!userProvidedMkspec && !specArg.isEmpty())
        arguments << QLatin1String("-spec") << specArg.toUserOutput();

    // Find out what flags we pass on to qmake
    arguments << bc->configCommandLineArguments();

    arguments << deducedArguments();

    QString args = Utils::QtcProcess::joinArgs(arguments);
    // User arguments
    Utils::QtcProcess::addArgs(&args, m_userArgs);
    // moreArgumentsAfter
    foreach (const QString &arg, deducedArgumentsAfter())
        Utils::QtcProcess::addArg(&args, arg);
    return args;
}