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::insertMeeting( Meeting *aMeeting )
134 iWeeklyView->insertMeeting( aMeeting );
137 void WindowManager::deleteMeeting( Meeting *aMeeting )
139 iWeeklyView->deleteMeeting( aMeeting );
142 void WindowManager::showMeetingInfo( Meeting *aMeeting )
144 iMeetingInfo = new MeetingInfoDialog( aMeeting );
145 // Display modal dialog
146 iMeetingInfo->exec();
152 void WindowManager::showSettingsView()
154 // TODO : give the Torspo for the person who was responsible to write this method
157 WeeklyViewWidget * WindowManager::weeklyView()
162 void WindowManager::error( const QString &aErrorMessage )
164 qDebug() << "WindowManager::showErrorPopup";
166 PopUpMessageBox::error( 0, aErrorMessage );
169 void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
171 iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
172 connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
173 this, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ) );
174 iPasswordDialog->show();
176 //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
179 void WindowManager::closePasswordDialog()
181 iPasswordDialog->close();
182 delete iPasswordDialog;
186 void WindowManager::showProgressBar( const QString &aText, bool aCancellable )
188 qDebug() << "WindowManager::showProgressBar( const QString & )";
189 if( iProgressBar == 0 ) {
190 iProgressBar = new ProgressBar( aText, aCancellable );
191 iProgressBar->setFixedSize( 600, 125 );
192 iProgressBar->show();
193 connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
196 //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
199 void WindowManager::closeProgressBar()
201 qDebug() << "WindowManager::closeProgressBar()";
204 iProgressBar->close();
210 void WindowManager::updateProgressBar( const QString &aMessage )
212 qDebug() << "WindowManager::updateProgressBar( const QString & )";
213 if( iProgressBar != 0 )
214 iProgressBar->update( aMessage );