コード例 #1
0
FileDownloader::FileDownloader(QWidget *parent) : QProgressDialog(parent)
{
	reply = 0;
	manager = new QNetworkAccessManager(this);
	connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(gotResponse(QNetworkReply*)));

	setMinimumDuration(0);
	setRange(0,0);

	connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload()));
	/*
	connect(this, SIGNAL(fileSaved(const QString &, const QString &)), this, SLOT(reportFileSaved(const QString &,const QString &)));
	connect(this, SIGNAL(saveFailed(const QString &)), this, SLOT(reportSaveFailed(const QString &)));
	connect(this, SIGNAL(errorOcurred(int,QString)), this, SLOT(reportError(int,QString)));
	*/

	setWindowTitle(tr("Downloading..."));
}
コード例 #2
0
ファイル: frame.cpp プロジェクト: serghei/kde3-kdepim
void Frame::setState(int a)
{
    m_state = a;

    switch(m_state)
    {
        case Frame::Started:
            emit started();
            break;
        case Frame::Canceled:
            emit canceled(QString::null);
            break;
        case Frame::Idle:
        case Frame::Completed:
        default:
            emit completed();
    }
}
コード例 #3
0
ファイル: trackexportworker.cpp プロジェクト: Alppasa/mixxx
void TrackExportWorker::run() {
    int i = 0;
    QMap<QString, QFileInfo> copy_list = createCopylist(m_tracks);
    for (auto it = copy_list.constBegin(); it != copy_list.constEnd(); ++it) {
        // We emit progress twice per loop, which may seem excessive, but it
        // guarantees that we emit a sane progress before we start and after
        // we end.  In between, each filename will get its own visible tick
        // on the bar, which looks really nice.
        emit(progress(it->fileName(), i, copy_list.size()));
        copyFile(*it, it.key());
        if (load_atomic(m_bStop)) {
            emit(canceled());
            return;
        }
        ++i;
        emit(progress(it->fileName(), i, copy_list.size()));
    }
}
コード例 #4
0
void QQuickMouseArea::ungrabMouse()
{
    Q_D(QQuickMouseArea);
    if (d->pressed) {
        // if our mouse grab has been removed (probably by Flickable), fix our
        // state
        d->pressed = 0;
        d->stealMouse = false;
        setKeepMouseGrab(false);
        emit canceled();
        emit pressedChanged();
        emit pressedButtonsChanged();
        if (d->hovered) {
            d->hovered = false;
            emit hoveredChanged();
        }
    }
}
コード例 #5
0
ファイル: menustate.c プロジェクト: maupatras/gretl
static int uniform_corr_option (const gchar *title, gretlopt *popt)
{
    const char *opts[] = {
	N_("Ensure uniform sample size"),
	NULL
    };
    int uniform = 0;
    int resp;

    resp = checks_only_dialog(title, NULL, opts, 1, 
			      &uniform, CORR, NULL);

    if (!canceled(resp) && uniform) {
	*popt = OPT_U;
    }

    return resp;
}
コード例 #6
0
ファイル: k3bdvdformattingjob.cpp プロジェクト: KDE/k3b
void K3b::DvdFormattingJob::slotProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
{
    if( d->canceled ) {
        emit canceled();
        d->success = false;
    }
    else if( exitStatus == QProcess::NormalExit ) {
        if( !d->error && (exitCode == 0) ) {
            emit infoMessage( i18n("Formatting successfully completed"), Job::MessageSuccess );

            if( d->lastProgressValue < 100 ) {
                emit infoMessage( i18n("Do not be concerned with the progress stopping before 100%."), MessageInfo );
                emit infoMessage( i18n("The formatting will continue in the background during writing."), MessageInfo );
            }

            d->success = true;
        }
        else {
            emit infoMessage( i18n("%1 returned an unknown error (code %2).",d->dvdFormatBin->name(), exitCode),
                              Job::MessageError );
            emit infoMessage( i18n("Please send me an email with the last output."), Job::MessageError );

            d->success = false;
        }
    }
    else {
        emit infoMessage( i18n("%1 did not exit cleanly.",d->dvdFormatBin->name()),
                          MessageError );
        d->success = false;
    }

    if( d->forceNoEject ||
        !k3bcore->globalSettings()->ejectMedia() ) {
        d->running = false;
        jobFinished(d->success);
    }
    else {
        emit infoMessage( i18n("Ejecting medium..."), MessageInfo );
        connect( Device::eject( d->device ),
                 SIGNAL(finished(K3b::Device::DeviceHandler*)),
                 this,
                 SLOT(slotEjectingFinished(K3b::Device::DeviceHandler*)) );
    }
}
コード例 #7
0
void K3bDvdFormattingJob::slotProcessFinished( KProcess* p )
{
  if( d->canceled ) {
    emit canceled();
    d->success = false;
  }
  else if( p->normalExit() ) {
    if( !d->error && p->exitStatus() == 0 ) {
      emit infoMessage( i18n("Formatting successfully completed"), K3bJob::SUCCESS );

      if( d->lastProgressValue < 100 ) {
	emit infoMessage( i18n("Do not be concerned with the progress stopping before 100%."), INFO );
	emit infoMessage( i18n("The formatting will continue in the background while writing."), INFO );
      }

      d->success = true;
    }
    else {
      emit infoMessage( i18n("%1 returned an unknown error (code %2).").arg(d->dvdFormatBin->name()).arg(p->exitStatus()),
			K3bJob::ERROR );
      emit infoMessage( i18n("Please send me an email with the last output."), K3bJob::ERROR );

      d->success = false;
    }
  }
  else {
    emit infoMessage( i18n("%1 did not exit cleanly.").arg(d->dvdFormatBin->name()),
		      ERROR );
    d->success = false;
  }

  if( d->forceNoEject ||
      !k3bcore->globalSettings()->ejectMedia() ) {
    d->running = false;
    jobFinished(d->success);
  }
  else {
    emit infoMessage( i18n("Ejecting DVD..."), INFO );
    connect( K3bDevice::eject( d->device ),
	     SIGNAL(finished(K3bDevice::DeviceHandler*)),
	     this,
	     SLOT(slotEjectingFinished(K3bDevice::DeviceHandler*)) );
  }
}
コード例 #8
0
ファイル: krpleasewait.cpp プロジェクト: aremai/krusader
void KRPleaseWaitHandler::startWaiting(QString msg, int count , bool cancel)
{
    if (dlg == 0) {
        dlg = new KRPleaseWait(msg , _parentWindow, count, cancel);
        connect(dlg, SIGNAL(canceled()), this, SLOT(killJob()));
    }
    incMutex = cycleMutex = _wasCancelled = false;
    dlg->setValue(0);

    dlg->setLabelText(msg);
    if (count == 0) {
        dlg->setMaximum(10);
        cycle = true ;
        cycleProgress();
    } else {
        dlg->setMaximum(count);
        cycle = false;
    }
}
コード例 #9
0
void BluetoothLinkManagerDeviceDiscoverer::setError(int errorCode)
{
    qDebug() << __PRETTY_FUNCTION__ << "errorCode=" << errorCode;
    QString errorString;
    switch (errorCode) {
        case KLinkManagerErrBase:
            errorString.append("Link manager base error value or Insufficient baseband resources error value");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
            break;
        case KErrProxyWriteNotAvailable:
            errorString.append("Proxy write not available error value");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
            break;
        case KErrReflexiveBluetoothLink:
            errorString.append("Reflexive BT link error value");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
            break;
        case KErrPendingPhysicalLink:
            errorString.append("Physical link connection already pending when trying to connect the physical link");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
            break;
        case KErrNotReady:
            errorString.append("KErrNotReady");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
        case KErrHardwareNotAvailable:
            // this is returned by Symbian backend when bluetooth is off
            errorString.append("KErrHardwareNotAvailable");
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::PoweredOff, errorString);
            break;
        case KErrCancel:
            errorString.append("KErrCancel");
            qDebug() << "emitting canceled";
            emit canceled();
            break;
        case KErrNone:
            // do nothing
            break;
        default:
            errorString = QString("Symbian errorCode = %1").arg(errorCode);
            emit linkManagerError(QBluetoothDeviceDiscoveryAgent::UnknownError, errorString);
            break;
    }
}
コード例 #10
0
QDeclarativeBluetoothDiscoveryModel::QDeclarativeBluetoothDiscoveryModel(QObject *parent) :
    QAbstractListModel(parent),
    d(new QDeclarativeBluetoothDiscoveryModelPrivate)
{

    QHash<int, QByteArray> roleNames;
    roleNames = QAbstractItemModel::roleNames();
    roleNames.insert(Qt::DisplayRole, "name");
    roleNames.insert(Qt::DecorationRole, "icon");
    roleNames.insert(ServiceRole, "service");
    setRoleNames(roleNames);

    d->m_agent = new QBluetoothServiceDiscoveryAgent(this);
    connect(d->m_agent, SIGNAL(serviceDiscovered(const QBluetoothServiceInfo&)), this, SLOT(serviceDiscovered(const QBluetoothServiceInfo&)));
    connect(d->m_agent, SIGNAL(finished()), this, SLOT(finishedDiscovery()));
    connect(d->m_agent, SIGNAL(canceled()), this, SLOT(finishedDiscovery()));
    connect(d->m_agent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(errorDiscovery(QBluetoothServiceDiscoveryAgent::Error)));

}
コード例 #11
0
void Downloader::setAnimator(QProgressDialog *anAnimator, QLabel* anAnimatorLabel, QProgressBar* anAnimatorBar, bool anAnimate)
{
    delete AnimationTimer;

    AnimatorLabel = anAnimatorLabel;
    AnimatorBar = anAnimatorBar;
    if (AnimatorBar && anAnimate)
    {
        AnimationTimer = new QTimer(this);
        connect(AnimationTimer,SIGNAL(timeout()),this,SLOT(animate()));
    }
    if (AnimatorBar)
    {
        AnimatorBar->setValue(0);
        if (anAnimator)
            connect(anAnimator,SIGNAL(canceled()),this,SLOT(on_Cancel_clicked()));
        qApp->processEvents();
    }
}
コード例 #12
0
void MainWindow::learning()
{
    QString dir_weight = QFileDialog::getOpenFileName(this, tr("Open File"), "/home", tr("Text (*.txt)"));
    dataset_ = new dataset_t(dir_weight.toStdString(), X_SIZE, Y_SIZE);
    dataset_->split_train_test(0.7);
    perceptron_ = new perceptron_t(dataset_->dim());

    thread_ = new QThread;
    connect(this, SIGNAL(finish_learn()), thread_, SLOT(quit()));
    connect(this, SIGNAL(finish_learn()), thread_, SLOT(deleteLater()));
    connect(thread_, SIGNAL(started()), this, SLOT(learn()));
    thread_->start();

    progress_ = new QProgressDialog("Learning...", "Cancel", 0, EPOCH_COUNT, this);
    connect(progress_, SIGNAL(canceled()), progress_, SLOT(cancel()));
    progress_->setWindowModality(Qt::WindowModal);

    ui->load->setDisabled(false);
}
コード例 #13
0
void QuteMessenger::startDeviceDiscovery()
{
    SetupMenu(true);
    if (devDisc) {
        ui.deviceListWidget->clear();
        foundDevices.clear();
        connect(devDisc, SIGNAL(newDeviceFound(QBtDevice)), this,
                SLOT(populateDeviceList(QBtDevice)));
        connect(devDisc, SIGNAL(discoveryStopped()), this, SLOT(deviceDiscoveryCompleteReport()));
        devDisc->startDiscovery();

        dialog = new QProgressDialog("Searching devices...", "Stop", 0, 0, this);
        dialog->setWindowModality(Qt::WindowModal);
        connect(dialog, SIGNAL(canceled()), this, SLOT(deviceDiscoveryCompleteReport()));
        dialog->setBar(NULL);

        dialog->show();
    }
}
コード例 #14
0
UpdateApplication::UpdateApplication()
// ----------------------------------------------------------------------------
//    Constructor
// ----------------------------------------------------------------------------
    : state(Idle), file(NULL), progress(NULL),
      dialogTitle(QString(tr("Tao3D Update"))),
      downloadIcon(loadIcon(":/images/download.png")),
      checkmarkIcon(loadIcon(":images/checkmark.png")),
      connectionErrorIcon(loadIcon(":/images/not_connected.png")),
      reply(NULL), manager(NULL), code(-1)
{
    // download.png from http://www.iconfinder.com/icondetails/2085/128
    // Author: Alexandre Moore
    // License: LGPL
    //
    // checkmark.png from http://www.iconfinder.com/icondetails/3207/128
    // Author: Everaldo Coelho
    // License: LGPL

    // not_connected.png is a merge from:
    //
    // - Red cross from http://www.iconfinder.com/icondetails/3206/128
    //   Author: Everaldo Coelho
    //   License: LGPL
    // - Earth from http://www.iconfinder.com/icondetails/17829/128
    //   Author: Everaldo Coelho
    //   License: LGPL

    resetRequest();

    progress = new QProgressDialog(TaoApp->windowWidget());
    progress->setFixedSize(500, 100);
    connect(progress, SIGNAL(canceled()),
            this,     SLOT(cancel()));
    progress->setWindowTitle(dialogTitle);

    IFTRACE(update)
    debug() << "Current version: edition='" << +edition
            << "' version=" << version
            << " target='" << +target << "'"
            << " User-Agent='" << +userAgent() << "'\n";
}
コード例 #15
0
ファイル: widget.cpp プロジェクト: weilaidb/qtexample
void Widget::onSelectSong()
{
    QString strPath = QDir::currentPath();
    QStringList nameFilters("*.mp3");
    nameFilters << "*.wma" << "*.ape" << "*.ogg"
                << "*.aac" << "*.wav" << "*.mid"
                << "*.amr" << "*.3gp" << "*.mp4";

    m_fileSelector = new OpenFileWidget(strPath, nameFilters);
    m_layout->addWidget(m_fileSelector);
    m_layout->setCurrentWidget(m_fileSelector);

    m_fileSelector->setAttribute(Qt::WA_DeleteOnClose);
    connect(m_fileSelector, SIGNAL(selected(QString))
            , this, SLOT(onFileSelected(QString)));
    connect(m_fileSelector, SIGNAL(canceled())
            , this, SLOT(onFileSelectCanceled()));

    m_fileSelector->setStyleSheet("QListWidget{ background: #303030; border: 1px solid white}");
}
コード例 #16
0
HttpWindow::HttpWindow(QWidget *parent, QUrl _url, QString _savePath) :
		QDialog(parent) {

	this->setFont(THE_REPO->fontVariableWidthSmall);
	this->fullUrlString = _url.scheme() + "://" + _url.authority()
	+ _url.path();
	this->downloadSuccess = false;
	this->uploadFlag = false;
	this->savePath = _savePath;
	progressDialog = new QProgressDialog(this);

	connect(&qnam,
			SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
			this,
			SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));

	connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));

	this->downloadFile();
}
コード例 #17
0
bool QDeclarativeMouseArea::sceneEvent(QEvent *event)
{
    bool rv = QDeclarativeItem::sceneEvent(event);
    if (event->type() == QEvent::UngrabMouse) {
        Q_D(QDeclarativeMouseArea);
        if (d->pressed) {
            // if our mouse grab has been removed (probably by Flickable), fix our
            // state
            d->pressed = false;
            setKeepMouseGrab(false);
            emit canceled();
            emit pressedChanged();
            if (d->hovered) {
                d->hovered = false;
                emit hoveredChanged();
            }
        }
    }
    return rv;
}
コード例 #18
0
ファイル: updater.cpp プロジェクト: yiminyangguang520/Updater
void Updater::downloadUpdate()
{
    if(a_netManager->networkAccessible() != QNetworkAccessManager::NotAccessible)
    {
        a_progressDialog = new QProgressDialog(nullptr);
        a_progressDialog->setWindowModality(Qt::ApplicationModal);
        connect(a_progressDialog, SIGNAL(canceled()),this, SLOT(cancelDownload()));
        a_progressDialog->setWindowTitle(tr("Veuillez patienter"));
        a_progressDialog->setLabelText(tr("Téléchargement de la mise à jour de %1 en cours").arg(a_appName));
        a_progressDialog->setValue(0);
        a_progressDialog->show();
        a_netRequest.setUrl(a_urlExe);
        a_netReply = a_netManager->get(a_netRequest);
        connect(a_netReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorHandling(QNetworkReply::NetworkError)));
        connect(a_netReply, SIGNAL(finished()),this, SLOT(writeUpdate()));
        connect(a_netReply, SIGNAL(downloadProgress(qint64, qint64)),this, SLOT(updateProgress(qint64, qint64)));
    }
    else
        noNetworkError();
}
コード例 #19
0
ファイル: command.cpp プロジェクト: ZerpHmm/qt-creator
void Command::execute()
{
    d->m_lastExecSuccess = false;
    d->m_lastExecExitCode = -1;

    if (d->m_jobs.empty())
        return;

    // For some reason QtConcurrent::run() only works on this
    QFuture<void> task = QtConcurrent::run(&Command::run, this);
    d->m_watcher.setFuture(task);
    connect(&d->m_watcher, SIGNAL(canceled()), this, SLOT(cancel()));
    QString binary = QFileInfo(d->m_binaryPath).baseName();
    if (!binary.isEmpty())
        binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
    const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0);

    Core::ProgressManager::addTask(task, taskName,
        Core::Id::fromString(binary + QLatin1String(".action")));
}
コード例 #20
0
CinemaProgress::CinemaProgress()
	: QObject()
	, startAppTimer_(0)
{
	startAppTimer_ = new QTimer(this);
	connect(startAppTimer_, SIGNAL(timeout()), SLOT(startApp()));
	startAppTimer_->setInterval(500);
	startAppTimer_->setSingleShot(true);

	cinemas_ = new CinemaList();
	cinemas_->setCanInitFromWeb(true);
	connect(cinemas_, SIGNAL(progressChanged()), SLOT(progressChanged()));
	QTimer::singleShot(100, cinemas_, SLOT(init()));

	progress_ = new QProgressDialog(trUtf8("Загружаю кинотеатры..."), trUtf8("Отмена"), 0, 0);
	connect(progress_, SIGNAL(canceled()), SLOT(cancel()));
	// progress_->setParent(this);
	progress_->setWindowModality(Qt::WindowModal);
	progress_->show();
}
コード例 #21
0
ファイル: ImportDialog.cpp プロジェクト: Adrianl3d/hifi
ImportDialog::ImportDialog(QWidget* parent) :
    QFileDialog(parent, WINDOW_NAME, DOWNLOAD_LOCATION, NULL),
    _progressBar(this),
    _importButton(IMPORT_BUTTON_NAME, this),
    _cancelButton(CANCEL_BUTTON_NAME, this),
    _mode(importMode) {

    setOption(QFileDialog::DontUseNativeDialog, true);
    setFileMode(QFileDialog::ExistingFile);
    setViewMode(QFileDialog::Detail);

    setImportTypes();
    setLayout();

    _progressBar.setRange(0, 100);
    
    connect(&_importButton, SIGNAL(pressed()), SLOT(accept()));
    connect(&_cancelButton, SIGNAL(pressed()), SIGNAL(canceled()));
    connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString)));
}
コード例 #22
0
void GalleryWindow::connectSignals()
{
    connect(d->albumView, SIGNAL(itemSelectionChanged()),
            this , SLOT(slotAlbumSelected()) );

    connect(d->newAlbumBtn, SIGNAL(clicked()),
            this, SLOT(slotNewAlbum()));

    connect(d->addPhotoBtn, SIGNAL(clicked()),
            this, SLOT(slotAddPhoto()));

    connect(d->resizeCheckBox, SIGNAL(stateChanged(int)),
            this, SLOT(slotEnableSpinBox(int)));

    connect(d->logo, SIGNAL(leftClickedUrl(QString)),
            this, SLOT(slotProcessUrl(QString)));

    connect(m_progressDlg, SIGNAL(canceled()),
            this, SLOT(slotAddPhotoCancel()));

    connect(m_talker, SIGNAL(signalError(QString)),
            this, SLOT(slotError(QString)));

    connect(m_talker, SIGNAL(signalBusy(bool)),
            this, SLOT(slotBusy(bool)));

    connect(m_talker, SIGNAL(signalLoginFailed(QString)),
            this, SLOT(slotLoginFailed(QString)));

    connect(m_talker, SIGNAL(signalAlbums(QList<GAlbum>)),
            this, SLOT(slotAlbums(QList<GAlbum>)));

    connect(m_talker, SIGNAL(signalPhotos(QList<GPhoto>)),
            this, SLOT(slotPhotos(QList<GPhoto>)));

    connect(m_talker, SIGNAL(signalAddPhotoSucceeded()),
            this, SLOT(slotAddPhotoSucceeded()));

    connect(m_talker, SIGNAL(signalAddPhotoFailed(QString)),
            this, SLOT(slotAddPhotoFailed(QString)));
}
コード例 #23
0
BtRefreshProgressDialog::BtRefreshProgressDialog(sword::InstallSource &source,
                                                 QWidget *parent,
                                                 Qt::WindowFlags flags)
             : QProgressDialog(parent, flags)
             , m_source(source)
{
    Q_ASSERT(BtInstallBackend::isRemote(source));
    setWindowTitle(tr("Refreshing source %1").arg(QString(source.caption)));
    setCancelButtonText(tr("&Cancel"));
    setLabelText(tr("Connecting..."));
    Q_ASSERT(minimum() == 0);
    setMaximum(100);
    setValue(0);
    setWindowModality(Qt::ApplicationModal);
    setMinimumDuration(1000);

    connect(this, SIGNAL(canceled()),
            this, SLOT(slotCanceled()));
    connect(&m_installMgr, SIGNAL(percentCompleted(int,int)),
            this,          SLOT(slotPercentCompleted(int,int)));
}
コード例 #24
0
ファイル: k3bblankingjob.cpp プロジェクト: franhaufer/k3b
void K3b::BlankingJob::slotFinished(bool success)
{
    if ( !m_forceNoEject && k3bcore->globalSettings()->ejectMedia() ) {
        K3b::Device::eject( m_device );
    }

    if( success ) {
        emit percent( 100 );
        jobFinished( true );
    }
    else {
        if( m_canceled ) {
            emit canceled();
        }
        else {
            emit infoMessage( i18n("Blanking error."), K3b::Job::MessageError );
            emit infoMessage( i18n("Sorry, no error handling yet."), K3b::Job::MessageError );
        }
        jobFinished( false );
    }
}
コード例 #25
0
void QProgressDialogPrivate::init(const QString &labelText, const QString &cancelText,
                                  int min, int max)
{
    Q_Q(QProgressDialog);
    label = new QLabel(labelText, q);
    int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
    label->setAlignment(Qt::Alignment(align));
    bar = new QProgressBar(q);
    bar->setRange(min, max);
    autoClose = true;
    autoReset = true;
    forceHide = false;
    QObject::connect(q, SIGNAL(canceled()), q, SLOT(cancel()));
    forceTimer = new QTimer(q);
    QObject::connect(forceTimer, SIGNAL(timeout()), q, SLOT(forceShow()));
    if (useDefaultCancelText) {
        retranslateStrings();
    } else {
        q->setCancelButtonText(cancelText);
    }
}
コード例 #26
0
Kleo::ProgressDialog::ProgressDialog(Job *job, const QString &baseText,
                                     QWidget *creator, const char *name, WFlags f)
    : QProgressDialog(creator, name, false, f), mBaseText(baseText)
{
    assert(job);
    setBar(new ProgressBar(this, "replacement progressbar in Kleo::ProgressDialog"));

    setMinimumDuration(2000 /*ms*/);
    setAutoReset(false);
    setAutoClose(false);
    setLabelText(baseText);
    setProgress(0, 0);   // activate busy indicator

    connect(job, SIGNAL(progress(const QString &, int, int)),
            SLOT(slotProgress(const QString &, int, int)));
    connect(job, SIGNAL(done()), SLOT(slotDone()));
    connect(this, SIGNAL(canceled()),
            job, SLOT(slotCancel()));

    QTimer::singleShot(minimumDuration(), this, SLOT(forceShow()));
}
コード例 #27
0
ossimQtProgressDialog::ossimQtProgressDialog(const QString& labelText,
                                             const QString& cancelButtonText,
                                             int totalSteps,
                                             QWidget * creator,
                                             const char * name,
                                             bool modal,
                                             WFlags f)
   : QProgressDialog(labelText,
                     cancelButtonText,
                     totalSteps,
                     creator,
                     name,
                     modal,
                     f),
     ossimProcessListener()
                                            
{
   init();
   connect(this, SIGNAL(canceled()), this, SLOT(cancelClicked()) );
   theProcessInterface = 0;
}
コード例 #28
0
void
Part::scanCompleted( Directory *tree )
{
   if( tree ) {
      statusBar()->message( i18n( "Scan completed, generating map..." ) );

      m_map->create( tree );

      //do after creating map
      stateChanged( "scan_complete" );
   }
   else {
      stateChanged( "scan_failed" );
      emit canceled( i18n( "Scan failed: %1" ).arg( prettyURL() ) );
      emit setWindowCaption( QString::null );

      statusBar()->clear();
//      QTimer::singleShot( 2000, statusBar(), SLOT(clear()) );

      m_url = KURL();
   }
}
コード例 #29
0
void checkForUpdates::downloadButtonPressed()
{
      this->close();
      QUrl url(newurl);
      filename = "xTuple-" + serverVersion + "-" + OS + "-installer."+ suffix;

      if(QFile::exists(filename))
      {
          if(QMessageBox::question(this, tr("Update"),
              tr("There already exists a file called %1 in "
                  "the current directory. Overwrite?").arg(filename),
                  QMessageBox::Yes|QMessageBox::No, QMessageBox::No)
                  == QMessageBox::No)
                  return;
          QFile::remove(filename);
      }

      file = new QFile(filename);
      if(!file->open(QIODevice::WriteOnly))
      {
          QMessageBox::information(this, "Update",
              tr("Unable to save the file %1: %2.")
              .arg(filename).arg(file->errorString()));
          delete file;
          file = NULL;
          return;
      }

      downloadRequestAborted = false;
      reply = manager.get(QNetworkRequest(url));
      connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
      connect(reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
      connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
      connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));

      progressDialog->setLabelText(tr("Downloading %1...").arg(filename));
      _button->setEnabled(false);
      progressDialog->exec();
}
コード例 #30
0
  void MOPACInputDialog::computeClicked()
  {
    if (m_process != 0) {
      QMessageBox::warning(this, tr("MOPAC Running."),
                           tr("MOPAC is already running. Wait until the previous calculation is finished."));
      return;
    }

    QString fileName = saveInputFile(ui.previewText->toPlainText(), tr("MOPAC Input Deck"), QString("mop"));
    if (fileName.isEmpty())
      return;

    QFileInfo info(mopacPath);
    if (!info.exists() || !info.isExecutable()) {
      QMessageBox::warning(this, tr("MOPAC Not Installed."),
                           tr("The MOPAC executable, cannot be found."));
      return;
    }

    m_process = new QProcess(this);
    QFileInfo input(fileName);
    m_process->setWorkingDirectory(input.absolutePath());

    QStringList arguments;
    arguments << fileName;
    m_inputFile = fileName; // save for reading in output

    m_process->start(mopacPath, arguments);
    if (!m_process->waitForStarted()) {
      QMessageBox::warning(this, tr("MOPAC failed to start."),
                           tr("MOPAC did not start. Perhaps it is not installed correctly."));
    }
    connect(m_process, SIGNAL(finished(int)), this, SLOT(finished(int)));
    m_progress = new QProgressDialog(this);
    m_progress->setRange(0,0); // indeterminate progress
    m_progress->setLabelText(tr("Running MOPAC calculation..."));
    m_progress->show();
    connect(m_progress, SIGNAL(canceled()), this, SLOT(stopProcess()));
  }