OSDWidget::OSDWidget( const QString &appName, QWidget *parent, const char *name ) : QWidget( parent, name, WNoAutoErase | WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop | WStyle_Tool ) , m_appName( appName ) , m_duration( 5000 ) , m_shadow( true ) , m_alignment( Middle ) , m_screen( 0 ) , m_y( MARGIN ) , m_dirty( false ) { setFocusPolicy( NoFocus ); setBackgroundMode( NoBackground ); unsetColors(); connect( &timer, SIGNAL( timeout() ), SLOT( hide() ) ); connect( &timerMin, SIGNAL( timeout() ), SLOT( minReached() ) ); }
void OSDWidget::show() { // Don't show the OSD widget when the desktop is locked if ( isKDesktopLockRunning() == Locked ) { minReached(); // don't queue the message return; } if ( m_dirty ) renderOSDText( m_currentText ); QWidget::show(); if ( m_duration ) //duration 0 -> stay forever { timer.start( m_duration, true ); //calls hide() timerMin.start( 150 ); //calls minReached() } }
OSDWidget::OSDWidget( const QString &context, QWidget *parent, const char *name ) : QWidget( parent, name, WType_TopLevel | WNoAutoErase | WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop ) , m_duration( 5000 ) ,m_linking(false) ,m_context(context) , m_alignment( Middle ) , m_screen( 0 ) , m_y( MARGIN ) ,m_srt(0) , m_dirty( false ) ,m_dragging( false ) { //Attempt to change cursor over link // this->setMouseTracking(true); setFocusPolicy( NoFocus ); setBackgroundMode( NoBackground ); connect( &timer, SIGNAL( timeout() ), SLOT( hide() ) ); connect( &timerMin, SIGNAL( timeout() ), SLOT( minReached() ) ); }