예제 #1
0
// 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);
}
예제 #2
0
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();
}
예제 #3
0
Progress::Progress(QWidget *parent) : QProgressDialog(parent, Qt::WindowStaysOnTopHint)
{
	setStyleSheet("QLabel { qproperty-alignment: 'AlignLeft | AlignBottom'; }");
	setWindowTitle("Copying Files");
	setFixedWidth(parent->width()/2);
	setFocusPolicy(Qt::NoFocus);
	setAutoReset(false);
	setAutoClose(false);

	QProgressDialog::setMaximum(INT_MAX);
}
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;
}
예제 #5
0
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"));
}
void ossimQtProgressDialog::init()
{
   // Start at 0 by default.
   setProgress(0);

   //---
   // Set this to false so that "wasCanceled" will return true if canceled.
   // Users can change this as "setAutoReset" is a public method.
   //---
   setAutoReset(false);
   theProcessInterface = 0;
}
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);
}
예제 #8
0
akuWaitDialog::akuWaitDialog(QWidget *parent) : KProgressDialog(parent, i18n("Processing Archive"), i18n("Work in progress, aKu is not freezed"))
{
  progressBar() -> setMaximumSize(654999, 20);
  progressBar() -> setMaximum(0);
  progressBar() -> setMinimum(0);
  progressBar() -> setValue(0);
  setMinimumSize(320, 100);
  setMaximumSize(320, 100);
  setModal(true);
  setAutoClose(false);
  setAutoReset(false);
  setAllowCancel(false);
}
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 &)));
}
예제 #10
0
FSSM_InitStatusMsgBox::FSSM_InitStatusMsgBox(const QString & labelText, const QString & cancelButtonText,
					     int minimum, int maximum, QWidget * parent, Qt::WindowFlags f)
					    : QProgressDialog(labelText, cancelButtonText, minimum, maximum, parent, f)
{
	_allow_close = false;
	_parent = parent;
	setAutoClose( false );
	setAutoReset( false );
	setModal( true );
	QFont newfont = font();
	newfont.setPixelSize(13); // 10pts
	newfont.setBold( true );
	setFont( newfont );
}
예제 #11
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()));
}