Exemplo n.º 1
0
 OutputProxy()
 {
     // Users of this class can either be in the GUI thread or in other threads.
     // Use Qt::AutoConnection to always append in the GUI thread (directly or queued)
     VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
     connect(this, SIGNAL(append(QString)), outputWindow, SLOT(append(QString)));
     connect(this, SIGNAL(appendSilently(QString)), outputWindow, SLOT(appendSilently(QString)));
     connect(this, SIGNAL(appendError(QString)), outputWindow, SLOT(appendError(QString)));
     connect(this, SIGNAL(appendCommand(QString,QString,QStringList)),
             outputWindow, SLOT(appendCommand(QString,QString,QStringList)));
     connect(this, SIGNAL(appendMessage(QString)), outputWindow, SLOT(appendMessage(QString)));
 }
Exemplo n.º 2
0
bool CleanDialog::promptToDelete()
{
    // Prompt the user and delete files
    const QStringList selectedFiles = checkedFiles();
    if (selectedFiles.isEmpty())
        return true;

    if (QMessageBox::question(this, tr("Delete"),
                              tr("Do you want to delete %n files?", 0, selectedFiles.size()),
                              QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes)
        return false;

    // Remove in background
    CleanFilesTask *cleanTask = new CleanFilesTask(d->m_workingDirectory, selectedFiles);
    connect(cleanTask, SIGNAL(error(QString)),
            VCSBase::VCSBaseOutputWindow::instance(), SLOT(appendSilently(QString)),
            Qt::QueuedConnection);

    QFuture<void> task = QtConcurrent::run(cleanTask, &CleanFilesTask::run);
    const QString taskName = tr("Cleaning %1").
                             arg(QDir::toNativeSeparators(d->m_workingDirectory));
    Core::ICore::instance()->progressManager()->addTask(task, taskName,
                                                        QLatin1String("VCSBase.cleanRepository"));
    return true;
}