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" ) ),
22 iConfiguration( aConfiguration ),
29 iWeeklyView = new WeeklyViewWidget( QDateTime::currentDateTime(), aConfiguration );
30 iWeeklyView->setWindowTitle( iApplicationName );
31 connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
32 connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SIGNAL( meetingActivated( Meeting * ) ) );
33 connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );
34 connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );
40 WindowManager::~WindowManager()
44 delete iRoomStatusView;
50 delete iPasswordDialog;
54 void WindowManager::distributeDateTimeInfo( QDateTime aCurrentDateTime )
56 if ( iRoomStatusView != 0 && iRoomStatusView->isActiveWindow() )
58 iRoomStatusView->setCurrentTime( aCurrentDateTime.time() );
61 if ( iWeeklyView != 0 && iWeeklyView->isActiveWindow() )
63 iWeeklyView->setCurrentDateTime( aCurrentDateTime );
67 void WindowManager::roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime )
69 if ( iRoomStatusView == 0 )
71 iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iConfiguration->displaySettings()->timeFormat() );
72 iRoomStatusView->setWindowTitle( iApplicationName );
73 connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
77 iRoomStatusView->statusChanged( aStatus, aTime );
79 if ( !iWeeklyView->isVisible() && !iRoomStatusView->isVisible() )
85 void WindowManager::showRoomStatus()
87 qDebug() << "WindowManager::showRoomStatus";
89 if ( iRoomStatusView == 0 )
91 emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
95 iRoomStatusView->show();
96 if ( iWeeklyView->isVisible() )
102 // closing/deleting meeting info dialog
103 if ( iMeetingInfo != 0 )
105 iMeetingInfo->hide();
109 void WindowManager::showWeeklyView()
111 qDebug() << "WindowManager::showWeeklyView";
112 if ( iRoomStatusView != 0 && iRoomStatusView->isVisible() )
114 iRoomStatusView->hide();
120 void WindowManager::fullScreen()
122 iRoomStatusView->setWindowState( Qt::WindowFullScreen );
123 iWeeklyView->setWindowState( Qt::WindowFullScreen );
126 void WindowManager::insertMeeting( Meeting *aMeeting )
128 iWeeklyView->insertMeeting( aMeeting );
131 void WindowManager::deleteMeeting( Meeting *aMeeting )
133 iWeeklyView->deleteMeeting( aMeeting );
136 void WindowManager::showMeetingInfo( Meeting *aMeeting )
138 iMeetingInfo = new MeetingInfoDialog( aMeeting );
139 // Display modal dialog
140 iMeetingInfo->exec();
146 void WindowManager::showSettingsView()
148 // TODO : give the Torspo for the person who was responsible to write this method
151 WeeklyViewWidget * WindowManager::weeklyView()
156 void WindowManager::error( const QString &aErrorMessage )
158 qDebug() << "WindowManager::showErrorPopup";
160 PopUpMessageBox::error( 0, aErrorMessage );
163 void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
165 iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
166 connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
167 this, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ) );
168 iPasswordDialog->show();
171 void WindowManager::closePasswordDialog()
173 iPasswordDialog->close();
174 delete iPasswordDialog;
178 void WindowManager::showProgressBar( const QString &aText )
180 qDebug() << "WindowManager::showProgressBar( const QString & )";
181 if( iProgressBar == 0 ) {
182 iProgressBar = new ProgressBar( aText );
183 iProgressBar->show();
184 connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
188 void WindowManager::closeProgressBar()
190 iProgressBar->close();