Esempio n. 1
0
KTimerDialog::KTimerDialog(int msec, TimerStyle style, QWidget *parent, const char *name, bool modal, const QString &caption, int buttonMask,
                           ButtonCode defaultButton, bool separator, const KGuiItem &user1, const KGuiItem &user2, const KGuiItem &user3)
    : KDialogBase(parent, name, modal, caption, buttonMask, defaultButton, separator, user1, user2, user3)
{
    totalTimer = new QTimer(this);
    updateTimer = new QTimer(this);
    msecTotal = msecRemaining = msec;
    updateInterval = 1000;
    tStyle = style;
    KWin::setIcons(winId(), DesktopIcon("randr"), SmallIcon("randr"));
    // default to cancelling the dialog on timeout
    if(buttonMask & Cancel)
        buttonOnTimeout = Cancel;

    connect(totalTimer, SIGNAL(timeout()), SLOT(slotInternalTimeout()));
    connect(updateTimer, SIGNAL(timeout()), SLOT(slotUpdateTime()));

    // create the widgets
    mainWidget = new QVBox(this, "mainWidget");
    timerWidget = new QHBox(mainWidget, "timerWidget");
    timerLabel = new QLabel(timerWidget);
    timerProgress = new QProgressBar(timerWidget);
    timerProgress->setTotalSteps(msecTotal);
    timerProgress->setPercentageVisible(false);

    KDialogBase::setMainWidget(mainWidget);

    slotUpdateTime(false);
}
Esempio n. 2
0
KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent,
                 const char *name, bool modal,
                 const QString &caption,
                 int buttonMask, ButtonCode defaultButton,
                 bool separator,
                 const KGuiItem &user1,
                 const KGuiItem &user2,
                 const KGuiItem &user3 )
    : KDialog( parent )
{
    setObjectName( name );
    setModal( modal );
    setCaption( caption );
    setButtons( (ButtonCodes)buttonMask );
    setDefaultButton( defaultButton );
    showButtonSeparator( separator );
    setButtonGuiItem( User1, user1 );
    setButtonGuiItem( User2, user2 );
    setButtonGuiItem( User3, user3 );

    totalTimer = new QTimer( this );
    totalTimer->setSingleShot( true );
    updateTimer = new QTimer( this );
    updateTimer->setSingleShot( false );
    msecTotal = msecRemaining = msec;
    updateInterval = 1000;
    tStyle = style;
	KWindowSystem::setIcons( winId(), DesktopIcon("randr"), SmallIcon("randr") );
    // default to canceling the dialog on timeout
    if ( buttonMask & Cancel )
        buttonOnTimeout = Cancel;

    connect( totalTimer, SIGNAL( timeout() ), SLOT( slotInternalTimeout() ) );
    connect( updateTimer, SIGNAL( timeout() ), SLOT( slotUpdateTime() ) );

    // create the widgets
    mainWidget = new KVBox( this );
    timerWidget = new KHBox( mainWidget );
    timerLabel = new QLabel( timerWidget );
    timerProgress = new QProgressBar( timerWidget );
    timerProgress->setRange( 0, msecTotal );
    timerProgress->setTextVisible( false );

    KDialog::setMainWidget( mainWidget );

    slotUpdateTime( false );
}