1 #include "WindowManager.h"
4 #include "Configuration.h"
5 #include "DisplaySettings.h"
9 #include "WeeklyViewWidget.h"
10 #include "RoomStatusIndicatorWidget.h"
11 #include "MeetingInfoDialog.h"
12 #include "PopUpMessageBox.h"
13 #include "DeviceManager.h"
14 #include "SettingsView.h"
15 #include "ProgressBar.h"
19 WindowManager::WindowManager( Configuration *aConfiguration ) :
21 iApplicationName( tr( "Qt Meetings" ) ),
23 iConfiguration( aConfiguration ),
30 iWeeklyView = new WeeklyViewWidget( QDateTime::currentDateTime(), aConfiguration );
31 iWeeklyView->setWindowTitle( iApplicationName );
32 connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
33 connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SIGNAL( meetingActivated( Meeting * ) ) );
34 connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );
35 connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );
41 WindowManager::~WindowManager()
45 delete iRoomStatusView;
51 delete iPasswordDialog;
55 void WindowManager::distributeDateTimeInfo( QDateTime aCurrentDateTime )
57 if ( iRoomStatusView != 0 && iRoomStatusView->isActiveWindow() )
59 iRoomStatusView->setCurrentTime( aCurrentDateTime.time() );
62 if ( iWeeklyView != 0 && iWeeklyView->isActiveWindow() )
64 iWeeklyView->setCurrentDateTime( aCurrentDateTime );
68 void WindowManager::roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime )
70 if ( iRoomStatusView == 0 )
72 iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iConfiguration->displaySettings()->timeFormat() );
73 iRoomStatusView->setWindowTitle( iApplicationName );
75 iRoomStatusView->setWindowState( Qt::WindowFullScreen );
76 connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
80 iRoomStatusView->statusChanged( aStatus, aTime );
82 if ( !iWeeklyView->isVisible() && !iRoomStatusView->isVisible() )
88 void WindowManager::showRoomStatus()
90 qDebug() << "WindowManager::showRoomStatus";
92 if ( iRoomStatusView == 0 )
94 emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
98 iRoomStatusView->show();
99 if ( iWeeklyView->isVisible() )
105 // closing/deleting meeting info dialog
106 if ( iMeetingInfo != 0 )
108 iMeetingInfo->hide();
112 void WindowManager::showWeeklyView()
114 qDebug() << "WindowManager::showWeeklyView";
115 if ( iRoomStatusView != 0 && iRoomStatusView->isVisible() )
117 iRoomStatusView->hide();
123 void WindowManager::fullScreen()
125 if ( iRoomStatusView != 0 )
126 iRoomStatusView->setWindowState( Qt::WindowFullScreen );
127 if ( iWeeklyView != 0 )
128 iWeeklyView->setWindowState( Qt::WindowFullScreen );
132 void WindowManager::showMeetingInfo( Meeting *aMeeting )
134 iMeetingInfo = new MeetingInfoDialog( aMeeting );
135 // Display modal dialog
136 iMeetingInfo->exec();
142 void WindowManager::showSettingsView()
144 // TODO : give the Torspo for the person who was responsible to write this method
147 WeeklyViewWidget * WindowManager::weeklyView()
152 void WindowManager::error( const QString &aErrorMessage )
154 qDebug() << "WindowManager::showErrorPopup";
156 PopUpMessageBox::error( 0, aErrorMessage );
159 void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
161 iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
162 connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
163 this, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ) );
164 iPasswordDialog->show();
166 //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
169 void WindowManager::closePasswordDialog()
171 iPasswordDialog->close();
172 delete iPasswordDialog;
176 void WindowManager::showProgressBar( const QString &aText, bool aCancellable )
178 qDebug() << "WindowManager::showProgressBar( const QString & )";
179 if( iProgressBar == 0 ) {
180 iProgressBar = new ProgressBar( aText, aCancellable );
181 iProgressBar->setFixedSize( 600, 125 );
182 iProgressBar->show();
184 connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
187 //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
190 void WindowManager::closeProgressBar()
192 qDebug() << "WindowManager::closeProgressBar()";
195 iProgressBar->close();
201 void WindowManager::updateProgressBar( const QString &aMessage )
203 qDebug() << "WindowManager::updateProgressBar( const QString & )";
204 if( iProgressBar != 0 )
205 iProgressBar->update( aMessage );
208 void WindowManager::refreshMeetings( const QList<Meeting*> &aMeetings )
210 qDebug() << "WindowManager::refreshMeetings()";
211 iWeeklyView->refreshMeetings( aMeetings );