// Subclass QProgressDialog() MyQProgressDialog::MyQProgressDialog(LPCSTR titleText, LPCSTR labelText, LPCSTR styleSheet, LPCSTR icon) : QProgressDialog(labelText, CANCEL, 0, 100, QApplication::activeWindow(), 0), m_isCanceled(FALSE), m_indeterminateMode(FALSE), m_lastProgress(-1), m_hMouseHook(NULL), m_hWinHook(NULL), m_hTimerQueue(NULL), m_hUpdateTimer(NULL) { setWindowTitle(titleText); setAutoReset(FALSE); setAutoClose(FALSE); setWindowModality(Qt::WindowModal); setFixedSize(DAILOG_WIDTH, DAILOG_HEIGHT); setSizeGripEnabled(FALSE); // Qt::Tool -- Smaller title bar with smaller 'X' // Qt::Popup -- Boarderless // Qt::SubWindow -- Nonmodal on top with no background //setWindowFlags(Qt::Tool); // Nix the title bar help button setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | Qt::WindowMinimizeButtonHint); // This time must elapse before dialog shows (default 4sec) setMinimumDuration(SHOW_DELAY); // Set dialog font (and children inherit) QFont fnt(FONT, 10, QFont::Normal); fnt.setStyleStrategy(QFont::PreferAntialias); setFont(fnt); // Put the progress text in the middle if (QProgressBar *bar = findChild<QProgressBar *>()) bar->setAlignment(Qt::AlignCenter); // Optionally set Qt style sheet if (styleSheet && styleSheet[0]) { // From a file? if (strncmp(styleSheet, "url(", 4) == 0) { QString fn(styleSheet + (sizeof("url(") - 1)); fn.chop(1); QFile f(fn); if (f.open(QFile::ReadOnly | QFile::Text)) setStyleSheet(QTextStream(&f).readAll()); } else // No, string setStyleSheet(styleSheet); } // Optionally set titlebar icon if (icon && icon[0]) setWindowIcon(QIcon(icon)); // Progress 0 for the control to setup internally setValue(0); // Start update interval timer if (m_hTimerQueue = CreateTimerQueue()) CreateTimerQueueTimer(&m_hUpdateTimer, m_hTimerQueue, (WAITORTIMERCALLBACK)timerTick, NULL, TARGET_UPDATE_MS, TARGET_UPDATE_MS, 0); _ASSERT(m_hUpdateTimer != NULL); }
KRPleaseWait::KRPleaseWait(QString msg, QWidget *parent, int count, bool cancel): QProgressDialog(cancel ? 0 : parent) , inc(true) { setModal(!cancel); timer = new QTimer(this); setWindowTitle(i18n("Krusader::Wait")); setMinimumDuration(500); setAutoClose(false); setAutoReset(false); connect(timer, SIGNAL(timeout()), this, SLOT(cycleProgress())); QProgressBar* progress = new QProgressBar(this); progress->setMaximum(count); progress->setMinimum(0); setBar(progress); QLabel* label = new QLabel(this); setLabel(label); QPushButton* btn = new QPushButton(i18n("&Cancel"), this); setCancelButton(btn); btn->setEnabled(canClose = cancel); setLabelText(msg); show(); }
ccProgressDialog::ccProgressDialog( bool showCancelButton, QWidget *parent/*=0*/ ) : QProgressDialog(parent) , m_currentValue(0) , m_lastValue(-1) , m_timer(this) , m_refreshInterval(1) { setAutoClose(true); setWindowModality(Qt::ApplicationModal); setRange(0,100); setMinimumDuration(0); QPushButton* cancelButton = 0; if (showCancelButton) { cancelButton = new QPushButton("Cancel"); cancelButton->setDefault(false); cancelButton->setFocusPolicy(Qt::NoFocus); } setCancelButton(cancelButton); connect(&m_timer, SIGNAL(timeout()), this, SLOT(refresh())/*, Qt::DirectConnection*/); //can't use DirectConnection here! }
DownloadDialog::DownloadDialog(QUrl source, QString destination, QWidget *parent) : QProgressDialog("Downloading", "Cancel", 0, 100, parent) , _download(nullptr) , _completed(false) { setMinimumDuration(0); setWindowTitle("File Download"); _destination.setFileName(destination); _destination.remove(); if (_destination.open(QIODevice::WriteOnly)) { QNetworkRequest request(source); request.setRawHeader("User-Agent", "Mozilla Firefox"); _download = _manager.get(request); //qDebug() << _download->error(); connect(_download, SIGNAL(downloadProgress(qint64,qint64)), SLOT(downloadProgress(qint64,qint64))); connect(_download, SIGNAL(finished()), SLOT(dispose())); connect(_download, SIGNAL(readyRead()), SLOT(downloadReadyRead())); connect(this, SIGNAL(canceled()), SLOT(dispose())); setLabelText("Downloading " + destination); setValue(0); } }
ScanProgressDialog::ScanProgressDialog(QWidget* parent) : QProgressDialog(parent) { setWindowTitle(i18nc("@title:window", "Scanning devices...")); setMinimumWidth(280); setMinimumDuration(150); setAttribute(Qt::WA_ShowModal, true); }
Progress::Progress(int n, const char * lbl, QApplication * a) : QProgressDialog(0, 0, n, 0, 0, FALSE, WDestructiveClose), n(0), app(a) { if (it != 0) delete it; it = this; setLabelText(lbl); setMinimumDuration(1000); }
ProgressDialog::ProgressDialog(const QUrl &url, QWidget *parent) : QProgressDialog(parent) { setWindowTitle(tr("Download Progress")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setLabelText(tr("Downloading %1.").arg(url.toDisplayString())); setMinimum(0); setValue(0); setMinimumDuration(0); }
KQProgressModalDialog::KQProgressModalDialog ( const QString & captionText, const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator ) : KProgressDialog( creator, captionText, labelText ) { setAllowCancel( true ); showCancelButton( true ); setAutoClose( true ); setButtonText( cancelButtonText ); progressBar()->setMaximum( totalSteps ); setMinimumDuration( 1 ); }
DBRefreshDialog::DBRefreshDialog(QWidget *parent) : QProgressDialog(parent) { setWindowModality(Qt::WindowModal); setWindowTitle(tr("Please wait...")); setLabelText(tr("Synchronizing package databases...")); setMinimumDuration(500); setRange(0,0); connect(this,SIGNAL(canceled()),this,SLOT(onCancel())); dbRefresher = new PacmanDBRefresher(); connect(dbRefresher,SIGNAL(finished(PacmanProcessReader *)),this,SLOT(read_info_finished(PacmanProcessReader *))); }
groupProgressDialog::groupProgressDialog(int numDialogs) : QProgressDialog("", QString(), 0, 100), count_(0), numDialogs_(numDialogs) { setMinimumDuration(0); setWindowModality(Qt::WindowModal); setAutoClose(false); setAutoReset(false); move(PROGRESS_X_COORDINATE, PROGRESS_Y_COORDINATE); setWindowTitle(QObject::tr("Progress")); }
bool QProgressDialog::qt_property( int id, int f, QVariant* v) { switch ( id - staticMetaObject()->propertyOffset() ) { case 0: switch( f ) { case 1: *v = QVariant( this->wasCancelled(), 0 ); break; case 4: break; default: return FALSE; } break; case 1: switch( f ) { case 1: *v = QVariant( this->wasCanceled(), 0 ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 2: switch( f ) { case 0: setTotalSteps(v->asInt()); break; case 1: *v = QVariant( this->totalSteps() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 3: switch( f ) { case 0: setProgress(v->asInt()); break; case 1: *v = QVariant( this->progress() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 4: switch( f ) { case 0: setAutoReset(v->asBool()); break; case 1: *v = QVariant( this->autoReset(), 0 ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 5: switch( f ) { case 0: setAutoClose(v->asBool()); break; case 1: *v = QVariant( this->autoClose(), 0 ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 6: switch( f ) { case 0: setMinimumDuration(v->asInt()); break; case 1: *v = QVariant( this->minimumDuration() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; case 7: switch( f ) { case 0: setLabelText(v->asString()); break; case 1: *v = QVariant( this->labelText() ); break; case 3: case 4: case 5: break; default: return FALSE; } break; default: return QDialog::qt_property( id, f, v ); } return TRUE; }
TimedDialog::TimedDialog(const QString &title, const QString &labelText, int timeout, QWidget *parent, Qt::WindowFlags flags) : QProgressDialog(labelText, tr("Cancel"), 0, timeout, parent, flags), bar(new QProgressBar(this)) { setWindowTitle(title); setAutoReset(false); // open immediately... setMinimumDuration(0); // setup progress bar bar->setRange(0, timeout); bar->setFormat(tr("Timing out in %1 seconds").arg(timeout)); setBar(bar); }
PrintProgressDialog::PrintProgressDialog(MapPrinter* map_printer, QWidget* parent, Qt::WindowFlags f) : QProgressDialog(parent, f) , map_printer(map_printer) { setWindowModality(Qt::ApplicationModal); // Required for OSX, cf. QTBUG-40112 setRange(0, 100); setMinimumDuration(0); setValue(0); Q_ASSERT(map_printer); connect(map_printer, &MapPrinter::printProgress, this, &PrintProgressDialog::setProgress); connect(this, &PrintProgressDialog::canceled, map_printer, &MapPrinter::cancelPrintMap); }
RemoveProgressDialog::RemoveProgressDialog(PacmanRemovePackagesReader * remover,QWidget *parent) : QProgressDialog(parent) { this->remover = remover; index = 0; setWindowModality(Qt::WindowModal); setWindowTitle(tr("Removing the packages...")); setMinimumDuration(500); setAutoReset(false); setLabelText(tr("Preparing...")); disconnect(this,SIGNAL(canceled()),this,SLOT(cancel())); connect(remover,SIGNAL(finished(PacmanProcessReader *)),this,SLOT(cancel())); connect(remover,SIGNAL(start_removing(const QString &)),this,SLOT(start_removing(const QString &))); }
DBusyDlg::DBusyDlg(const QString& txt, QWidget* const parent) : QProgressDialog(parent, Qt::FramelessWindowHint), d(new Private) { setLabelText(txt); setCancelButton(0); setMinimumDuration(0); setModal(true); setAutoClose(false); setMaximum(0); setMinimum(0); setValue(0); }
FileDownloader::FileDownloader(QWidget *parent) : QProgressDialog(parent) { setMinimumDuration(0); http = new QHttp(this); connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool))); connect(http, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &))); connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload())); setWindowTitle(tr("Downloading...")); }
CodeDownloader::CodeDownloader(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...")); }
bool QProgressDialog::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: cancel(); break; case 1: reset(); break; case 2: setTotalSteps((int)static_QUType_int.get(_o+1)); break; case 3: setProgress((int)static_QUType_int.get(_o+1)); break; case 4: setProgress((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 5: setLabelText((const QString&)static_QUType_QString.get(_o+1)); break; case 6: setCancelButtonText((const QString&)static_QUType_QString.get(_o+1)); break; case 7: setMinimumDuration((int)static_QUType_int.get(_o+1)); break; case 8: forceShow(); break; default: return QDialog::qt_invoke( _id, _o ); } return TRUE; }
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))); }
RDProgressDialog(const QString &labelText, QWidget *parent) // we add 1 so that the progress value never hits maximum until we are actually finished : QProgressDialog(labelText, QString(), 0, maxProgress + 1, parent), m_Label(this) { setWindowTitle(tr("Please Wait")); setWindowFlags(Qt::CustomizeWindowHint | Qt::Dialog | Qt::WindowTitleHint); setWindowIcon(QIcon()); setMinimumSize(QSize(250, 0)); setMaximumSize(QSize(250, 10000)); setCancelButton(NULL); setMinimumDuration(0); setWindowModality(Qt::ApplicationModal); setValue(0); m_Label.setText(labelText); m_Label.setAlignment(Qt::AlignCenter); m_Label.setWordWrap(true); setLabel(&m_Label); }
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())); }
ProgressDialog::ProgressDialog(const QString &labelText , /* int totalSteps, int showAfter,*/ QWidget *parent /*, bool modal*/) : QProgressDialog(parent), // m_wasVisible(false), // m_frozen(false), // m_modal(modal), // m_minimumTimeHasExpired(false), // m_minimumDuration(1000), // m_sleepingBetweenOperations(false), // m_operationText(""), // m_totalSteps(totalSteps), // m_deferredClose(false), m_indeterminate(false) { RG_DEBUG << "ProgressDialog::ProgressDialog - " << labelText << /* " - modal : " << modal << */ endl; setWindowTitle(tr("Rosegarden")); setBar(new ProgressBar(this)); setLabelText(labelText); // Setting this to QString() causes the cancel button to be deleted. // The cancel buttons have never worked properly, and they are particularly // broken now, creating a very tricky plumbing problem. Not being able to // cancel is not ideal, but at least not showing a cancel button is // truthful. setCancelButtonText(QString()); setMinimumDuration(2000); setAttribute(Qt::WA_DeleteOnClose); hide(); // setModal(modal); /* setWindowFlags(Qt::Dialog); QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); layout->setAlignment(Qt::AlignCenter); QLabel *info = new QLabel(tr("<qt><h3>Processing...</h3></qt>")); layout->addWidget(info); QGroupBox *box = new QGroupBox; layout->addWidget(box); QVBoxLayout *boxLayout = new QVBoxLayout; box->setLayout(boxLayout); m_label = new QLabel(labelText); boxLayout->addWidget(m_label); m_progressBar = new ProgressBar(totalSteps); boxLayout->addWidget(m_progressBar); connect(m_progressBar, SIGNAL(valueChanged(int)), this, SLOT(slotCheckShow(int))); QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Cancel); layout->addWidget(bb); bb->setCenterButtons(true); connect(bb, SIGNAL(rejected()), this, SLOT(cancel())); */ // don't show before this timer has elapsed m_showAfterTimer = new QTimer; m_showAfterTimer->setSingleShot(true); m_showAfterTimer->start(2000); connect(m_showAfterTimer, SIGNAL(timeout()), this, SLOT(forceShow())); /* m_timer = new QTimer; m_timer->setSingleShot(true); QWidget::hide(); */ }
Progress::Progress(int n, const char * lbl) : Q3ProgressDialog(lbl, 0, n, 0, 0, FALSE, Qt::WDestructiveClose), n(0) { setMinimumDuration(1000); }
KQProgressModalDialog::KQProgressModalDialog ( const QString & captionText, const QString & labelText, const QString & cancelButtonText, int totalSteps, QWidget * creator ) : QProgressDialog( labelText, cancelButtonText, 0, totalSteps, creator ) { setWindowTitle( captionText ); setMinimumDuration( 1 ); }