FileName WorkingDirectoryAspect::workingDirectory() const
{
    auto envAspect = runConfiguration()->extraAspect<EnvironmentAspect>();
    const Utils::Environment env = envAspect ? envAspect->environment()
                                             : Utils::Environment::systemEnvironment();
    const QString macroExpanded
            = runConfiguration()->macroExpander()->expandProcessArgs(m_workingDirectory.toUserOutput());
    return FileName::fromString(PathChooser::expandedDirectory(macroExpanded, env, QString()));
}
Example #2
0
InstallerForm::InstallerForm(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InstallerForm)
{
    ui->setupUi(this);
    setModal(true);
    //    setWindowModality(Qt::ApplicationModal);
    ui->launchBrowser->setVisible(false);
    ui->showWizard->setVisible(false);

    connect(ui->launchBrowser, SIGNAL(clicked()), SLOT(authThroughBrowser()));
    connect(ui->showWizard, SIGNAL(clicked()), SLOT(runGtkInstaller()));

    //! @todo download to temp file name
    //! @todo KIO::NetAccess::download(daemonUrl, tmpFile,this) .... and possibly uncompress?
    downloadPath=QDir::toNativeSeparators(QDir::homePath().append("/daemon.tar.gz"));

    if(QSysInfo::WordSize==64)
        daemonUrl="http://www.dropbox.com/download?plat=lnx.x86_64";
    else
        daemonUrl="http://www.dropbox.com/download?plat=lnx.x86";

    if(DropboxClient::isInstalled())
        runConfiguration();
    else
        downloadDaemon();

}
void WorkingDirectoryAspect::addToMainConfigurationWidget(QWidget *parent, QFormLayout *layout)
{
    QTC_CHECK(!m_chooser);
    m_resetButton = new QToolButton(parent);
    m_resetButton->setToolTip(tr("Reset to Default"));
    m_resetButton->setIcon(Core::Icons::RESET.icon());
    connect(m_resetButton.data(), &QAbstractButton::clicked, this, &WorkingDirectoryAspect::resetPath);

    m_chooser = new PathChooser(parent);
    m_chooser->setHistoryCompleter(m_key);
    m_chooser->setExpectedKind(Utils::PathChooser::Directory);
    m_chooser->setPromptDialogTitle(tr("Select Working Directory"));
    m_chooser->setBaseFileName(m_defaultWorkingDirectory);
    m_chooser->setFileName(m_workingDirectory.isEmpty() ? m_defaultWorkingDirectory : m_workingDirectory);
    connect(m_chooser.data(), &PathChooser::pathChanged, this,
            [this]() {
                m_workingDirectory = m_chooser->rawFileName();
                m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory);
            });

    m_resetButton->setEnabled(m_workingDirectory != m_defaultWorkingDirectory);

    if (auto envAspect = runConfiguration()->extraAspect<EnvironmentAspect>()) {
        connect(envAspect, &EnvironmentAspect::environmentChanged, m_chooser.data(), [this, envAspect] {
            m_chooser->setEnvironment(envAspect->environment());
        });
        m_chooser->setEnvironment(envAspect->environment());
    }

    auto hbox = new QHBoxLayout;
    hbox->addWidget(m_chooser);
    hbox->addWidget(m_resetButton);
    layout->addRow(tr("Working directory:"), hbox);
}
Utils::Environment QmlProjectEnvironmentAspect::baseEnvironment() const
{
    int base = baseEnvironmentBase();
    Utils::Environment env = Utils::Environment::systemEnvironment();
    if (base == static_cast<int>(KitEnvironmentBase))
        runConfiguration()->target()->kit()->addToEnvironment(env);

    return env;
}
Example #5
0
void InstallerForm::processFile()
{
    ui->label->setText(tr("unpacking downloaded file"));

    QProcess::execute("tar", QStringList() << "-xf" << downloadPath << "-C" << QDir::homePath());

    QFile::remove(downloadPath);

    runConfiguration();
}
Example #6
0
void InstallerForm::processFile()
{
    ui->label->setText(tr("unpacking downloaded file"));
    QProcess sc;
    sc.execute("tar -xf "+downloadPath+" -C "+QDir::homePath());
    sc.waitForFinished();

    sc.startDetached("rm -f "+ downloadPath);

    runConfiguration();
}
Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
{
    int base = baseEnvironmentBase();
    Utils::Environment env;
    if (base == static_cast<int>(BuildEnvironmentBase)) {
        if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
            env = bc->environment();
        } else { // Fallback for targets without buildconfigurations:
            env = Utils::Environment::systemEnvironment();
            runConfiguration()->target()->kit()->addToEnvironment(env);
        }
    } else if (base == static_cast<int>(SystemEnvironmentBase)) {
        env = Utils::Environment::systemEnvironment();
    }

    if (m_baseEnvironmentModifier)
        m_baseEnvironmentModifier(runConfiguration(), env);

    return env;
}
Example #8
0
InstallerForm::InstallerForm(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::InstallerForm)
{
    ui->setupUi(this);
    setModal(true);
    ui->launchBrowser->setVisible(false);
    ui->showWizard->setVisible(false);

    connect(ui->launchBrowser, SIGNAL(clicked()), SLOT(authThroughBrowser()));
    connect(ui->showWizard, SIGNAL(clicked()), SLOT(runGtkInstaller()));

    //! @todo KIO::NetAccess::download(daemonUrl, tmpFile,this) .... and possibly uncompress?
    downloadPath = QDir(QDir::tempPath()).filePath("dropbox-lnx.tar.gz");
    daemonUrl = QString("http://www.dropbox.com/download?plat=lnx.%1").arg(QSysInfo::WordSize == 64 ? "x86_64" : "x86");

    if (DropboxClient::isInstalled())
        runConfiguration();
    else
        downloadDaemon();
}
QString ArgumentsAspect::arguments() const
{
    return runConfiguration()->macroExpander()->expandProcessArgs(m_arguments);
}