Merge branch 'master' into dev_local
[qtmeetings] / src / UserInterface / WindowManager.cpp
index 8107fbb..3819076 100644 (file)
@@ -19,6 +19,7 @@
 WindowManager::WindowManager( Configuration *aConfiguration ) :
                QObject(),
                iApplicationName( tr( "Qt Meetings" ) ),
+               iFullScreen( false ),
                iConfiguration( aConfiguration ),
                iWeeklyView( 0 ),
                iRoomStatusView( 0 ),
@@ -70,6 +71,8 @@ void WindowManager::roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime
        {
                iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iConfiguration->displaySettings()->timeFormat() );
                iRoomStatusView->setWindowTitle( iApplicationName );
+               if( iFullScreen )
+                       iRoomStatusView->setWindowState( Qt::WindowFullScreen );
                connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
        }
        else
@@ -85,7 +88,7 @@ void WindowManager::roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime
 void WindowManager::showRoomStatus()
 {
        qDebug() << "WindowManager::showRoomStatus";
-
+       iWeeklyView->setDefaultRoom();
        if ( iRoomStatusView == 0 )
        {
                emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
@@ -119,8 +122,11 @@ void WindowManager::showWeeklyView()
 
 void WindowManager::fullScreen()
 {
-       iRoomStatusView->setWindowState( Qt::WindowFullScreen );
-       iWeeklyView->setWindowState( Qt::WindowFullScreen );
+       if ( iRoomStatusView != 0 )
+               iRoomStatusView->setWindowState( Qt::WindowFullScreen );
+       if ( iWeeklyView != 0 )
+               iWeeklyView->setWindowState( Qt::WindowFullScreen );
+       iFullScreen = true;
 }
 
 void WindowManager::insertMeeting( Meeting *aMeeting )
@@ -160,53 +166,64 @@ void WindowManager::error( const QString &aErrorMessage )
        PopUpMessageBox::error( 0, aErrorMessage );
 }
 
-void WindowManager::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
+{
+       iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
+       connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
+                       this, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+       iPasswordDialog->show();
+       
+       //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
+}
+
+void WindowManager::closePasswordDialog()
 {
+       iPasswordDialog->close();
        delete iPasswordDialog;
        iPasswordDialog = 0;
+}
+
+void WindowManager::showProgressBar( const QString &aText, bool aCancellable )
+{
+       qDebug() << "WindowManager::showProgressBar( const QString & )";
+       if( iProgressBar == 0 ) {
+               iProgressBar = new ProgressBar( aText, aCancellable );
+               iProgressBar->setFixedSize( 600, 125 );
+               iProgressBar->show();
+               if( aCancellable )
+                       connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
+       }
        
-       switch ( aPasswordStatus )
+       //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
+}
+
+void WindowManager::closeProgressBar()
+{
+       qDebug() << "WindowManager::closeProgressBar()";
+       if( iProgressBar )
        {
-               case PasswordDialog::Correct :
-               {
-                       progressBar( tr( "Changing operation mode" ), true );
-                       iProgressBar->show();
-                       while(1);
-                       break;
-               }
-               case PasswordDialog::Incorrect :
-               {
-                       error( tr( "Incorrect password." ) );
-                       break;
-               }
-               default : //case PasswordDialog::Canceled
-               {
-               }
+               iProgressBar->close();
+               delete iProgressBar;
+               iProgressBar = 0;
        }
 }
 
-void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
+void WindowManager::updateProgressBar( const QString &aMessage )
 {
-       iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
-       iPasswordDialog->show();
+       qDebug() << "WindowManager::updateProgressBar( const QString & )";
+       if( iProgressBar != 0 )
+               iProgressBar->update( aMessage );
 }
 
+void WindowManager::connectionLost()
+{
+       //TODO: Inform all views
+       qDebug() << "WindowManager::connectionLost()";
+}
 
-void WindowManager::progressBar( const QString &aText, bool aStart )
+void WindowManager::connectionEstablished()
 {
-       qDebug() << "WindowManager::progressBar( const QString &, bool)";
-       if( aStart ) {
-               if( iProgressBar == 0 ) {
-                       iProgressBar = new ProgressBar( aText );
-                       connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBar() ) );
-                       connect( iProgressBar, SIGNAL( started() ), this, SLOT( changeMode() ) );
-               }
-       }
-       else {
-               if( iProgressBar != 0 ) {
-                       delete iProgressBar;
-                       iProgressBar = 0;
-               }
-       }
+       //TODO: Inform all views
+       qDebug() << "WindowManager::connectionEstablished()";
 }