From: Mikko Siren Date: Tue, 26 May 2009 11:46:46 +0000 (+0300) Subject: UIManager and some functionality X-Git-Url: https://vcs.maemo.org/git/?p=qtmeetings;a=commitdiff_plain;h=4f5e48bd4a1e5ab05cd5f0d46c3e335731bb05ff UIManager and some functionality --- diff --git a/QtMeetings.pro b/QtMeetings.pro index 3ec3197..121575b 100644 --- a/QtMeetings.pro +++ b/QtMeetings.pro @@ -13,7 +13,8 @@ INCLUDEPATH += src/Domain/ \ src/UserInterface/Components/ \ src/UserInterface/Utils/ \ src/UserInterface/Views/ -HEADERS += src/IO/DeviceControl/OperationModeToggler.h \ +HEADERS += src/BusinessLogic/UIManager.h \ + src/IO/DeviceControl/OperationModeToggler.h \ src/UserInterface/Utils/ProgressBar.h \ src/Domain/Room.h \ src/Domain/Meeting.h \ @@ -46,7 +47,8 @@ HEADERS += src/IO/DeviceControl/OperationModeToggler.h \ src/UserInterface/Views/SettingsView.h \ src/UserInterface/WindowManager.h \ src/UserInterface/Views/ViewBase.h -SOURCES += src/IO/DeviceControl/OperationModeToggler.cpp \ +SOURCES += src/BusinessLogic/UIManager.cpp \ + src/IO/DeviceControl/OperationModeToggler.cpp \ src/UserInterface/Utils/ProgressBar.cpp \ src/Domain/Room.cpp \ src/Domain/Meeting.cpp \ diff --git a/src/BusinessLogic/Engine.cpp b/src/BusinessLogic/Engine.cpp index 0c76679..5245702 100644 --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@ -8,11 +8,7 @@ // #include "DeviceManager.h" #include "Clock.h" #include "ErrorMapper.h" -#include "WeeklyViewWidget.h" -#include "SettingsView.h" -#include "RoomStatusIndicatorWidget.h" -#include "PasswordDialog.h" -#include "MeetingInfoDialog.h" +#include "UIManager.h" #include #include @@ -47,19 +43,18 @@ Engine::Engine() : // iIdleTimeCounter->setInterval( IDLE_TIME_MULTIPLIER * iConfiguration->displaySettings()->screensaver() ); iIdleTimeCounter->setInterval( 10000 ); iIdleTimeCounter->start(); - // connect( iIdleTimeCounter, SIGNAL( timeout() ), iWindowManager, SLOT( showRoomStatus() ) ); - connect( iIdleTimeCounter, SIGNAL( timeout() ), this, SLOT( idleTimerTimeout() ) ); // create application clock iClock = new Clock; connect( iClock, SIGNAL( tick( QDateTime ) ), this, SLOT( checkStatusOfAllRooms() ) ); // connect( iClock, SIGNAL( tick( QDateTime ) ), iWindowManager, SLOT( distributeDateTimeInfo( QDateTime ) ) ); + // Create auto refresh timer iAutoRefresh = new QTimer; iAutoRefresh->setInterval( iConfiguration->connectionSettings()->refreshInterval() * 1000 ); iAutoRefresh->start(); connect( iAutoRefresh, SIGNAL( timeout() ), iAutoRefresh, SLOT( start() ) ); -// connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ) ); + connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ) ); if( iDevice->currentOperationMode() == DeviceManager::KioskMode ) { @@ -87,11 +82,8 @@ Engine::~Engine() } QT_DELETE( iClock ); QT_DELETE( iDevice ); - - QT_DELETE( iRoomStatusIndicator ); - QT_DELETE( iSettingsView ); - QT_DELETE( iWeeklyView ); - QT_DELETE( iPasswordDialog ); + + QT_DELETE( iUIManager ); QT_DELETE( iWindowManager ); } @@ -191,13 +183,13 @@ void Engine::fetchMeetings() void Engine::fetchMeetingDetails( Meeting *aMeeting ) { qDebug() << "Engine::fetchMeetingDetails( Meeting* )"; - iWindowManager->showProgressBar( tr("Please Wait"), true ); - iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") ); - connect( iWindowManager, +// iWindowManager->showProgressBar( tr("Please Wait"), true ); +// iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") ); +/* connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( fetchMeetingDetailsCancelled() ) - ); + ); */ iCommunication->fetchMeetingDetails( *aMeeting ); } @@ -227,7 +219,7 @@ void Engine::meetingsFetched( const QList &aMeetings ) Meeting* m = new Meeting( *(aMeetings.at( i )) ); iMeetings.append( m ); // and signal the changes - iWeeklyView->insertMeeting( m ); +// iWeeklyView->insertMeeting( m ); } } @@ -239,7 +231,7 @@ void Engine::meetingsFetched( const QList &aMeetings ) { Meeting* m = iMeetings.takeAt( i ); // signal the changes - iWeeklyView->deleteMeeting( m ); +// iWeeklyView->deleteMeeting( m ); // delete the meeting from the local list delete m; } @@ -249,18 +241,6 @@ void Engine::meetingsFetched( const QList &aMeetings ) roomStatusInfoNeeded( defaultRoom() ); } -void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting ) -{ - qDebug() << "Engine::meetingDetailsFetched( Meeting & )"; - - if ( iMeetingInfoDialog != 0 ) - { - iMeetingInfoDialog->setMeeting( &aDetailedMeeting ); - iWindowManager->showDialog( iMeetingInfoDialog ); - } - -} - void Engine::errorHandler( int aCode, const QString &aAddInfo ) { qDebug() << "Engine::ErrorHandler, aCode: " << aCode; @@ -271,14 +251,6 @@ void Engine::errorHandler( int aCode, const QString &aAddInfo ) // iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) ); } -void Engine::currentRoomChanged( Room *aCurrentRoom ) -{ - qDebug() << "Engine::currentRoomChanged to " << aCurrentRoom->name(); -// QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() ); -// QDateTime to( from.addDays( 8 ) ); -// fetchMeetings( from, to, aCurrentRoom ); -} - void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn ) { qDebug() << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )"; @@ -294,16 +266,6 @@ void Engine::shownWeekChanged( QDate aFrom ) // fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() ); } -void Engine::changeModeOrdered( DeviceManager::OperationMode aMode ) -{ - qDebug() << "Engine::changeModeOrdered( DeviceManager::OperationMode )"; - QString message = tr( "You are about to change operation mode to %1." ) - .arg( iDevice->operationModeToString( aMode ) ); - - // iPasswordDialog->update( message ); - iWindowManager->showDialog( static_cast( iPasswordDialog ) ); -} - void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ) { qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )"; @@ -313,13 +275,6 @@ void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ) { case PasswordDialog::Correct : { -// iWindowManager->showProgressBar( "Changing current operation mode." ); -// connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) ); -// connect( iDevice, SIGNAL( changingMode( const QString & ) ), -// iWindowManager, SLOT( updateProgressBar( const QString & ) ) ); - // TODO : Connect the signal directory to progress bar dialog which should be instance in engine -// connect( iDevice, SIGNAL( changingMode( const QString & ) ), -// iWindowManager, SLOT( updateProgressBar( const QString & ) ) ); connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( progressBarCancelled() ) ); iDevice->changeMode( true ); break; @@ -340,60 +295,33 @@ void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ) void Engine::progressBarCancelled() { qDebug() << "Engine::progressBarCancelled()"; - //TODO: cancel the on-going event -// iWindowManager->closeProgressBar(); iDevice->changeMode( false ); } void Engine::initUserInterface() { qDebug() << "[Engine::initUserInterface] "; + // Initialize the window manager and connect what ever signals can be connected iWindowManager = new WindowManager; + // Create the UIManager which internally handles most of the UI actions + iUIManager = new UIManager( this, iWindowManager ); + connect( iWindowManager, SIGNAL( eventDetected() ), this, SLOT( handleViewEvent() ) ); - connect( iWindowManager, SIGNAL( previousViewRestored() ), this, SLOT( previousViewRestored() ) ); + connect( iWindowManager, SIGNAL( previousViewRestored() ), iUIManager, SLOT( previousViewRestored() ) ); connect( iWindowManager, SIGNAL( dialogActivated() ), this, SLOT( dialogActivated() ) ); connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) ); - // Initialize the weekly view and connect what ever signals can be connected at this stage - iWeeklyView = new WeeklyViewWidget(QDateTime::currentDateTime(), iConfiguration); - connect( iWeeklyView, SIGNAL( settingsButtonClicked() ), this, SLOT( settingsViewRequested() ) ); - connect( iWeeklyView, SIGNAL( currentRoomChange( Room * ) ) , this, SLOT( currentRoomChange( Room * ) ) ); - connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( fetchMeetingDetails( Meeting * ) ) ) ; - connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ) , this, SLOT( shownWeekChanged( QDate ) ) ); - - // Initialize the settings view - iSettingsView = new SettingsView; - connect( iSettingsView, SIGNAL( okClicked() ) , this, SLOT( settingsOkClicked() ) ); - - // Initialize the room status indicator - iRoomStatusIndicator = new RoomStatusIndicatorWidget( defaultRoom(), Room::FreeStatus, QTime::currentTime(), iConfiguration->displaySettings()->dateFormat() ); - - // Create password dialog - iPasswordDialog = new PasswordDialog( iConfiguration->adminPassword(), tr("No Text Set"), tr("Title") ); - connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) ); - // Show the UI iWindowManager->setWindowState( Qt::WindowMaximized ); iWindowManager->show(); - iWindowManager->showView( iWeeklyView ); + iUIManager->showMainView(); qDebug() << "[Engine::initUserInterface] "; } -void Engine::settingsViewRequested() -{ - if ( iSettingsView != 0 ) - { - iWindowManager->showView( static_cast( iSettingsView ) ); - // Room status indicator will not be shown when settings view is active - iIdleTimeCounter->stop(); - } -} - void Engine::handleViewEvent() { - qDebug() << "[Engine::handleViewEvent] "; if ( iIdleTimeCounter != 0 ) { // Restart the idle time counter when view event is received @@ -411,28 +339,14 @@ void Engine::initConfiguration() } } -void Engine::idleTimerTimeout() -{ - if ( iRoomStatusIndicator != 0 ) - { - iWindowManager->showView( static_cast( iRoomStatusIndicator ) ); - } -} - -void Engine::settingsOkClicked() -{ - if ( iWeeklyView != 0 ) - { - iWindowManager->showView( iWeeklyView ); - // Start the idle time counter when we return to the main view - iIdleTimeCounter->start(); - } -} - void Engine::connectSignals() { - // Handle weekly view signal connections - connect( iClock, SIGNAL( tick( QDateTime ) ), iWeeklyView, SLOT( setCurrentDateTime( QDateTime ) ) ); + // Connect engine objects signals to UIManager + connect( iClock, SIGNAL( tick( QDateTime ) ), iUIManager, SLOT( updateTime( QDateTime ) ) ); + connect( iIdleTimeCounter, SIGNAL( timeout() ) , iUIManager, SLOT( roomStatusIndicatorRequested() ) ); + + iUIManager->connectDeviceManager( iDevice ); + iUIManager->connectCommunicationManager( iCommunication ); } void Engine::initCommunication() @@ -443,8 +357,6 @@ void Engine::initCommunication() this, SLOT( errorHandler( int ) ) ); connect( iCommunication, SIGNAL( meetingsFetched( const QList& ) ), this, SLOT( meetingsFetched( const QList& ) ) ); - connect( iCommunication, SIGNAL( meetingDetailsFetched( Meeting& ) ), - this, SLOT( meetingDetailsFetched( Meeting& ) ) ); } void Engine::initDevice() @@ -452,8 +364,6 @@ void Engine::initDevice() // create device manager iDevice = new DeviceManager( iConfiguration->startupSettings() ); connect( iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ) ); - connect( iDevice, SIGNAL( changeModeOrdered( DeviceManager::OperationMode ) ), - this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) ); iDevice->initDeviceManager(); } @@ -484,5 +394,21 @@ void Engine::previousViewRestored() void Engine::fetchMeetingDetailsCancelled() { iCommunication->cancelFetchMeetingDetails(); - iWindowManager->closeProgressBar(); +// iWindowManager->closeProgressBar(); +} + +void Engine::stopIdleTimeCounter() +{ + if ( iIdleTimeCounter != 0 ) + { + iIdleTimeCounter->stop(); + } +} + +void Engine::startIdleTimeCounter() +{ + if ( iIdleTimeCounter != 0 ) + { + iIdleTimeCounter->start(); + } } diff --git a/src/BusinessLogic/Engine.h b/src/BusinessLogic/Engine.h index 70afcbc..c457fae 100644 --- a/src/BusinessLogic/Engine.h +++ b/src/BusinessLogic/Engine.h @@ -13,11 +13,7 @@ class Clock; class Configuration; class CommunicationManager; class Meeting; -class WeeklyViewWidget; -class SettingsView; -class RoomStatusIndicatorWidget; -class PasswordDialog; -class MeetingInfoDialog; +class UIManager; //! BusinessLogic class. Contains all the business logic of the application. /*! @@ -64,12 +60,6 @@ private slots: * Slot. Asks the communication to fetch new meeting data. * \param aCurrentRoom The current room. */ - void currentRoomChanged( Room *aCurrentRoom ); - //! Slot. Asks the communication to fetch new meeting data. - /*! - * Slot. Asks the communication to fetch new meeting data. - * \param aCurrentRoom The current room. - */ void shownWeekChanged( QDate aDate ); //! Slot. Handles errors. /*! @@ -93,21 +83,12 @@ private slots: * \param aMeetings The list of freshly fetched meetings. */ void meetingsFetched( const QList& ); - - void meetingDetailsFetched( Meeting &aDetailedMeeting ); - //! Slot. Checks the availability of all the rooms. /*! * Slot. Checks the availability of all the rooms by iterating through the current object's local * room storage and calling the roomStatusInfoNeeded() separately on each of them. */ void checkStatusOfAllRooms(); - //! Slot for popping up the confirmation dialog to change the current operation mode - /*! - * Slot. Asks Window manager to pop up a confirmation dialog. - * \param aMode The operation mode to be changed to - */ - void changeModeOrdered( DeviceManager::OperationMode aMode ); //! Slot. Fetches meeting details from the server. /*! * Slot. Fetches meeting details from the server. @@ -134,11 +115,6 @@ private slots: void handleViewEvent(); void previousViewRestored(); - void settingsViewRequested(); - - void idleTimerTimeout(); - - void settingsOkClicked(); //! Slot for dialog activation signal. /*! @@ -155,7 +131,13 @@ private slots: */ void dialogDeactivated(); + void stopIdleTimeCounter(); + void startIdleTimeCounter(); + private: + // Make the UIManager as friendly class so it can connect to private slots. + friend class UIManager; + //! Provides the index of the Meeting instance which is at the specified time. /*! * Provides the index of the Meeting instance which is at the specified time. If there are @@ -227,18 +209,13 @@ private: static QTime endOfTheDay; WindowManager *iWindowManager; - WeeklyViewWidget *iWeeklyView; - SettingsView *iSettingsView; - RoomStatusIndicatorWidget *iRoomStatusIndicator; - - PasswordDialog *iPasswordDialog; - MeetingInfoDialog *iMeetingInfoDialog; QTimer *iIdleTimeCounter; Clock *iClock; Configuration *iConfiguration; CommunicationManager *iCommunication; DeviceManager *iDevice; + UIManager *iUIManager; QTimer *iAutoRefresh; diff --git a/src/BusinessLogic/UIManager.cpp b/src/BusinessLogic/UIManager.cpp new file mode 100644 index 0000000..9da0a8a --- /dev/null +++ b/src/BusinessLogic/UIManager.cpp @@ -0,0 +1,221 @@ +#include "UIManager.h" + +#include +#include + +#include "Engine.h" +#include "WindowManager.h" +#include "ViewBase.h" +#include "WeeklyViewWidget.h" +#include "SettingsView.h" +#include "RoomStatusIndicatorWidget.h" +#include "PasswordDialog.h" +#include "MeetingInfoDialog.h" +#include "ProgressBar.h" +#include "CommunicationManager.h" +#include "Configuration.h" +#include "DisplaySettings.h" + +#include + +#define QT_DELETE(X) \ + if ( X != 0 ) \ + { \ + delete X; \ + X = 0; \ + } + +UIManager::UIManager( Engine *aEngine, WindowManager *aWindowManager ) : + iEngine( aEngine ), + iWindowManager( aWindowManager ), + iWeeklyView( 0 ), + iSettingsView( 0 ), + iRoomStatusIndicator( 0 ), + iPasswordDialog( 0 ), + iProgressBar( 0 ), + iMeetingInfo( 0 ) +{ + if ( iEngine == 0 ) return; + if ( iWindowManager == 0 ) return; + + createWeeklyView(); + createSettingsView(); + createRoomStatusIndicator(); + createPasswordDialog(); + createProgressBar(); + createMeetingInfoDialog(); +} + +UIManager::~UIManager() +{ + iEngine = 0; + iWindowManager = 0; + + QT_DELETE( iMeetingInfo ); + QT_DELETE( iProgressBar ); + QT_DELETE( iPasswordDialog ); + QT_DELETE( iRoomStatusIndicator ); + QT_DELETE( iSettingsView ); + QT_DELETE( iWeeklyView ); +} + +void UIManager::showMainView() +{ + iWindowManager->showView( iWeeklyView ); +} + +void UIManager::showProgressBar( QString aText ) +{ + if ( iProgressBar != 0 ) + { + iProgressBar->update( tr("Changing current operation mode.") ); + iWindowManager->showDialog( iProgressBar ); + } +} + +// =============================================== +// INITIALIZE THE UIMANAGER +void UIManager::createWeeklyView() +{ + iWeeklyView = new WeeklyViewWidget( QDateTime::currentDateTime(), iEngine->iConfiguration ); + + // Connect signals + connect( iWeeklyView, SIGNAL( settingsButtonClicked() ), this, SLOT( settingsViewRequest() ) ); + connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) ); +} + +void UIManager::createSettingsView() +{ + iSettingsView = new SettingsView; + + // Connect signals + connect( iSettingsView, SIGNAL( okClicked() ), this, SLOT( settingsOkClicked() ) ); +} + +void UIManager::createRoomStatusIndicator() +{ + iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime(), iEngine->iConfiguration->displaySettings()->dateFormat() ); +} + +void UIManager::createPasswordDialog() +{ + iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), tr("UIManager::createPasswordDialog"), tr("UIManager::createPasswordDialog") ); +} + +void UIManager::createProgressBar() +{ + iProgressBar = new ProgressBar( tr("CHANGE THIS") ); + + connect( iProgressBar, SIGNAL( cancelled() ), this, SLOT( progressBarCancelled() ) ); + connect( iProgressBar, SIGNAL( cancelled() ), iEngine, SLOT( progressBarCancelled() ) ); +} + +void UIManager::createMeetingInfoDialog() +{ + +} + +void UIManager::connectDeviceManager( DeviceManager *aDeviceManager ) +{ + connect( aDeviceManager, SIGNAL( changeModeOrdered( DeviceManager::OperationMode ) ), + this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) ); + + connect( aDeviceManager, SIGNAL( changingMode( const QString & ) ), iProgressBar, SLOT( update( const QString & ) ) ); +} + +void UIManager::connectCommunicationManager( CommunicationManager *aCommunicationManager ) +{ + // To communication manager + connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), aCommunicationManager, SLOT( fetchMeetingDetails( Meeting * ) ) ); + + // From communication manager + connect( aCommunicationManager, SIGNAL( meetingsFetched( const QList ) ), this, SLOT( meetingsFetched( const QList ) ) ); + connect( aCommunicationManager, SIGNAL( meetingDetailsFetched( Meeting & ) ), this, SLOT( meetingDetailsFetched( Meeting & ) ) ); +} + +// ============================================ +// UIMANAGER SLOTS +void UIManager::settingsViewRequest() +{ + // Show the settings view and stop the idle timer + if ( iSettingsView != 0 ) + { + iWindowManager->showView( static_cast( iSettingsView ) ); + iEngine->stopIdleTimeCounter(); + } +} + +void UIManager::settingsOkClicked() +{ + // Show the weekly view and restart the idle timer + if ( iWeeklyView != 0 ) + { + iWindowManager->showView( static_cast( iWeeklyView ) ); + iEngine->startIdleTimeCounter(); + } +} + +void UIManager::meetingsFetched( const QList &aMeetings ) +{ + +} + +void UIManager::meetingDetailsFetched(Meeting &aDetailedMeeting) +{ + if ( iMeetingInfo != 0 ) + { + iMeetingInfo->setMeeting( &aDetailedMeeting ); + iWindowManager->showDialog( static_cast( iMeetingInfo ) ); + } +} + +void UIManager::roomStatusIndicatorRequested() +{ + if ( iRoomStatusIndicator != 0 ) + { + iWindowManager->showView( static_cast( iRoomStatusIndicator ) ); + iEngine->stopIdleTimeCounter(); + } +} + +void UIManager::previousViewRestored() +{ + iEngine->startIdleTimeCounter(); +} + +void UIManager::progressBarCancelled() +{ + // TODO : Close progress bar +} + +void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode ) +{ + qDebug() << "[UIManager::changeModeOrdered] "; + + QString message = tr( "You are about to change operation mode to %1." ) + .arg( iEngine->iDevice->operationModeToString( aMode ) ); + + if ( iPasswordDialog != 0 ) + { + // TODO : Set the new text for password dialog + iWindowManager->showDialog( static_cast( iPasswordDialog ) ); + } +} + +void UIManager::currentRoomChanged(Room *aRoom) +{ + if ( iWeeklyView != 0 ) + { + QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() ); + QDateTime to = QDateTime( from.addDays( 8 ) ); + iEngine->fetchMeetings( from, to, aRoom ); + } +} + +void UIManager::updateTime(QDateTime aDateTime) +{ + if ( iWeeklyView != 0 ) + { + iWeeklyView->setCurrentDateTime( aDateTime ); + } +} diff --git a/src/BusinessLogic/UIManager.h b/src/BusinessLogic/UIManager.h new file mode 100644 index 0000000..dfaf8fd --- /dev/null +++ b/src/BusinessLogic/UIManager.h @@ -0,0 +1,73 @@ +#ifndef UIMANAGER_H_ +#define UIMANAGER_H_ + +#include +#include + +#include "Meeting.h" +#include "DeviceManager.h" + +class Engine; +class WindowManager; +class WeeklyViewWidget; +class SettingsView; +class RoomStatusIndicatorWidget; +class PasswordDialog; +class ProgressBar; +class MeetingInfoDialog; +class CommunicationManager; +class QDateTime; + +class UIManager : public QObject +{ + Q_OBJECT + +public: + UIManager( Engine *aEngine, WindowManager *aWindowManager ); + virtual ~UIManager(); + + void connectDeviceManager( DeviceManager *aDeviceManager ); + void connectCommunicationManager( CommunicationManager *aCommunicationManager ); + void showMainView(); + void showProgressBar( QString aText ); + +signals: + +public slots: + + void settingsViewRequest(); + void settingsOkClicked(); + void roomStatusIndicatorRequested(); + void previousViewRestored(); + void changeModeOrdered( DeviceManager::OperationMode aMode ); + +private slots: + + void meetingsFetched( const QList &aMeetings ); + void meetingDetailsFetched( Meeting &aDetailedMeeting ); + void currentRoomChanged( Room *aRoom ); + void progressBarCancelled(); + void updateTime( QDateTime aDateTime ); + +private: + + void createWeeklyView(); + void createSettingsView(); + void createRoomStatusIndicator(); + void createPasswordDialog(); + void createProgressBar(); + void createMeetingInfoDialog(); + +private: + Engine *iEngine; + WindowManager *iWindowManager; + + WeeklyViewWidget *iWeeklyView; + SettingsView *iSettingsView; + RoomStatusIndicatorWidget *iRoomStatusIndicator; + PasswordDialog *iPasswordDialog; + ProgressBar *iProgressBar; + MeetingInfoDialog *iMeetingInfo; +}; + +#endif /*UIMANAGER_H_*/ diff --git a/src/UserInterface/WindowManager.cpp b/src/UserInterface/WindowManager.cpp index 25a4cc8..e50229a 100644 --- a/src/UserInterface/WindowManager.cpp +++ b/src/UserInterface/WindowManager.cpp @@ -105,7 +105,7 @@ void WindowManager::error( const QString &aErrorMessage ) { qDebug() << "WindowManager::showErrorPopup"; - PopUpMessageBox::error( 0, aErrorMessage ); +// PopUpMessageBox::error( 0, aErrorMessage ); } void WindowManager::setFullscreen() diff --git a/src/UserInterface/WindowManager.h b/src/UserInterface/WindowManager.h index f361e41..fe594c2 100644 --- a/src/UserInterface/WindowManager.h +++ b/src/UserInterface/WindowManager.h @@ -1,4 +1,3 @@ -<<<<<<< HEAD:src/UserInterface/WindowManager.h #ifndef WINDOWMANAGER_H_ #define WINDOWMANAGER_H_ @@ -10,6 +9,7 @@ class ViewBase; class QEvent; class QSize; class QDialog; +class QString; //! UserInterface class. Manages displayed views. /*! @@ -89,6 +89,8 @@ public slots: void viewEventDetected(); void setFullscreen(); + + void error( const QString &aErrorMessage ); private: //! Name of the application. @@ -103,191 +105,3 @@ private: }; #endif /*WINDOWMANAGER_H_*/ -======= -#ifndef WINDOWMANAGER_H_ -#define WINDOWMANAGER_H_ - -#include -#include -#include "Room.h" -#include "Meeting.h" -#include "PasswordDialog.h" -#include "DeviceManager.h" - -class QTimer; -class RoomStatusIndicatorWidget; -class WeeklyViewWidget; -class Engine; -class MeetingInfoDialog; -class SettingsView; -class ProgressBar; -class Configuration; - -//! UserInterface class. Behaves as a proxy between the user interface and application's business logic. -/*! - * UserInterface class. Controls the whole user interface, starting with displaying the appropriate - * views. It behaves as a proxy between the user interface and application's business logic, it connects - * the specified components together and forwards the data to the correct place. It also manages the correct - * appearance of current views on the screen. - */ -class WindowManager : public QObject -{ - Q_OBJECT - -public: - //! Constructor. - /*! - * Constructor of WindowManager. - * \param aConfiguration The pointer to configuration. - */ - WindowManager( Configuration *aConfiguration ); - //! Destructor. - virtual ~WindowManager(); - /*! - * Displays an error message - * \param aErrorMessage Message to be displayd - */ - void error( const QString &aErrorMessage ); - //! Updates the rooms status. - /*! - * Forwards the signal of changed status to current view. - * \param aRoom Room which status is changed. - * \param aStatus Current status of room. - * \param aTime Time when status is changed. - */ - void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime ); - //! Shows the password dialog. - /*! - * Shows the password dialog. - * \param aAdminPassword The correct password. - * \param aMessage The message to be shown in the password dialog. - */ - void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage ); - //! Closes the password dialog. - /*! - * Closes the password dialog. - */ - void closePasswordDialog(); - //! Displays the weekly view. - /*! - * Displays the weekly view. - */ - void showWeeklyView(); - //! Displays the meeting info dialog. - /*! - * Displays the meeting info dialog. - * \param aMeeting Meeting to be displayd - */ - void showMeetingInfo( Meeting *aMeeting ); - //! Returns the pointer to the weekly view. - /*! - * Returns the pointer to the weekly view. - */ - WeeklyViewWidget * weeklyView(); - //! Switches the views to full screen. - /*! - * Switches the views to full screen. - */ - void fullScreen(); - //! Shows the progress bar. - /*! - * Starts showing the progress bar. - * \param aText The text to be shown in progress bar. - * \param aCancellable Is the Cancel button visible. By default not visible. - */ - void showProgressBar( const QString &aText, bool aCancellable = false ); - //! Closes the progress bar. - /*! - * Closes the progress bar. - */ - void closeProgressBar(); - - void insertMeeting( Meeting *aMeeting ); - - void deleteMeeting( Meeting *aMeeting ); - -signals: - //! Request current status of the room. - /*! - * Signal is emitted when there is need to check current status of room aRoom. - * \param aRoom Meetingroom which status is requested. - */ - void roomStatusInfoNeeded( Room *aRoom ); - //! Indicate that some user event has happened. - /*! - * Signal is emitted if some user event has happened. - */ - void observedEventDetected(); - //! Meeting activated. - /*! - * Signal is emitted when a meeting is clicked by the user. - * \param aMeeting actived meeting. - */ - void meetingActivated( Meeting *aMeeting ); - //! Signals if the shown week has been changed. - /*! - * Signal. Emitted if the shown week has been changed. - * \param aDate The first date of the shown week. - */ - void shownWeekChanged( QDate aDate ); - //! Signals change of the meeting room. - /*! - * Signal is emitted when meeting room is changed. - * \param aRoom Selected meeting room. - */ - void currentRoomChanged( Room *aRoom ); - //! Signals when the password dialog buttons are clicked. - /*! - * Signal is emitted when the password dialog buttons are clicked. - * \param aPasswordStatus The status of the password. - */ - void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus ); - //! Signals when the cancel button in the progress bar is clicked. - /*! - * Signal is emitted when the cancel button in the progress bar is clicked. - */ - void progressBarCancelled(); - -public slots: - //! Slot for displaying the screensaver (room status view). - /*! - * Slot. Displays the screensaver. - */ - void showRoomStatus(); - //! Slot for updating the time. - /*! - * Slot. Forwards the signal of changed time to current view. - * \param aCurrentDateTime Current date and time. - */ - void distributeDateTimeInfo( QDateTime aCurrentDateTime ); - - void updateProgressBar( const QString &aMessage ); - -private slots: - //! Displays the settings view - void showSettingsView(); - -private: - //! Name of the application. - QString iApplicationName; - //! Defines whether the views should be shown as full screen - bool iFullScreen; - //! Pointer to the configuration. - Configuration *iConfiguration; - //! Pointer to the weekly view. - WeeklyViewWidget *iWeeklyView; - //! Pointer to the screensaver (room status view). - RoomStatusIndicatorWidget *iRoomStatusView; - //! Pointer to the meeting info dialog - MeetingInfoDialog *iMeetingInfo; - //! Pointer to the settings view - SettingsView *iSettingsView; - //! Pointer to the progress bar - ProgressBar *iProgressBar; - //! Pointer to the password dialog. - PasswordDialog *iPasswordDialog; - -}; - -#endif /*WINDOWMANAGER_H_*/ ->>>>>>> deb6aee06a80416a24a64c2ac6349a2341acdc39:src/UserInterface/WindowManager.h