fetchMeetings( iClock->datetime(), iClock->datetime().addDays( 7 ), room );
}
--void Engine::fetchMeetingDetails( Meeting *aMeeting )
--{
-- qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
- // iWindowManager->showProgressBar( tr("Please Wait"), true );
- // iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") );
- /* connect( iWindowManager,
- SIGNAL( progressBarCancelled() ),
- this,
- SLOT( fetchMeetingDetailsCancelled() )
- ); */
- iCommunication->fetchMeetingDetails( *aMeeting );
- }
-
- iWindowManager->showProgressBar( tr("Please Wait"), true );
- iWindowManager->updateProgressBar( tr("Fetching Meeting Details...") );
- connect( iWindowManager,
- SIGNAL( progressBarCancelled() ),
- this,
- SLOT( fetchMeetingDetailsCancelled() )
- );
- iCommunication->fetchMeetingDetails( *aMeeting );
-}
-
bool Engine::isMeetingInList( const QList<Meeting*> &aList, const Meeting *aMeeting )
{
qDebug() << "Engine::isMeetingInList( const QList<Meeting*> &, const Meeting * )";
{
qDebug() << "Engine::ErrorHandler, aCode: " << aCode;
// inform UI about the problem
- if( aCode >= 100 && aCode <= 150 )
+ if( aCode >= 100 && aCode <= 150 ) { //communication errors
+ //we don't want these to close operation changing
qDebug() << "CommunicationManager signaled an error:" << aCode;
- // iWindowManager->closeProgressBar();
- // iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
- iWindowManager->closeProgressBar();
+ }
++
+ 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 * )";
iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
}
++void Engine::fetchMeetingDetails(Meeting *aMeeting)
++{
++ qDebug() << "[Engine::fetchMeetingDetails] <TODO : METHOD NOT IMPLEMENTED>";
++// Meeting tempMeeting = aMeeting;
++// iCommunication->fetchMeetingDetails( tempMeeting );
++}
++
++void Engine::cancelFetchMeetingDetails()
++{
++ iCommunication->cancelFetchMeetingDetails();
++}
++
void Engine::shownWeekChanged( QDate aFrom )
{
-- qDebug() << "Engine::shownWeekChanged( QDate )";
++ qDebug() << "[Engine::shownWeekChanged] <Invoked>";
QDateTime from( aFrom );
QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) );
-- qDebug() << "Engine::shownWeekChanged " << aFrom.toString( "d.m. h:mm" ) << " to " << to.toString( "d.m. h:mm" );
- fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
++ qDebug() << "[Engine::shownWeekChanged] <From " << aFrom.toString( "d.m. h:mm" ) << " to " << to.toString( "d.m. h:mm" ) << ">";
++ iCommunication->fetchMeetings( from, to, *defaultRoom() );
+// fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
}
- void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
-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 ) );
++void Engine::changeDeviceMode( bool aChange )
+{
- qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
- // iWindowManager->closePasswordDialog();
-
- switch ( aPasswordStatus )
++ if ( aChange )
+ {
- case PasswordDialog::Correct :
- {
- connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( progressBarCancelled() ) );
- iDevice->changeMode( true );
- break;
- }
- case PasswordDialog::Incorrect :
- {
- // iWindowManager->error( tr( "Incorrect password." ) );
- iDevice->changeMode( false );
- break;
- }
- default : //case PasswordDialog::Canceled
- {
- iDevice->changeMode( false );
- }
++ connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( changeModeFailed() ) );
++ iAutoRefresh->stop(); // Stop the meeting update
+ }
++ iDevice->changeMode( aChange );
+}
+
- void Engine::progressBarCancelled()
++void Engine::changeModeFailed()
+{
+ qDebug() << "Engine::progressBarCancelled()";
+ iDevice->changeMode( false );
++ iAutoRefresh->start(); //we start the metting updating
+}
+
+void Engine::initUserInterface()
+{
+ qDebug() << "[Engine::initUserInterface] <Invoked>";
+
+ // 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() ), iUIManager, SLOT( previousViewRestored() ) );
+ connect( iWindowManager, SIGNAL( dialogActivated() ), this, SLOT( dialogActivated() ) );
+ connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
- iWindowManager->showPasswordDialog( iConfiguration->adminPassword(), message );
+ // Show the UI
+ iWindowManager->setWindowState( Qt::WindowMaximized );
+ iWindowManager->show();
+ iUIManager->showMainView();
+
+ qDebug() << "[Engine::initUserInterface] <Finished>";
+}
+
+void Engine::handleViewEvent()
+{
+ if ( iIdleTimeCounter != 0 )
+ {
+ // Restart the idle time counter when view event is received
+ iIdleTimeCounter->stop();
+ iIdleTimeCounter->start();
+ }
}
-void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+void Engine::initConfiguration()
{
- qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
- iWindowManager->closePasswordDialog();
+ iConfiguration = Configuration::instance();
+ if ( iConfiguration == 0 )
+ {
+ QTimer::singleShot( 0, this, SLOT( closeApplication() ) );
+ }
+}
+
+void Engine::connectSignals()
+{
+ // Connect engine objects signals to UIManager
+ connect( iClock, SIGNAL( tick( QDateTime ) ), iUIManager, SLOT( updateTime( QDateTime ) ) );
+ connect( iIdleTimeCounter, SIGNAL( timeout() ) , iUIManager, SLOT( roomStatusIndicatorRequested() ) );
- switch ( aPasswordStatus )
+ iUIManager->connectDeviceManager( iDevice );
+ iUIManager->connectCommunicationManager( iCommunication );
+}
+
+void Engine::initCommunication()
+{
+ // initialize communication
+ iCommunication = new CommunicationManager( *(iConfiguration->connectionSettings()) );
+ connect( iCommunication, SIGNAL( error( int, CommunicationManager::CommunicationType ) ),
+ this, SLOT( errorHandler( int ) ) );
+ connect( iCommunication, SIGNAL( meetingsFetched( const QList<Meeting*>& ) ),
+ this, SLOT( meetingsFetched( const QList<Meeting*>& ) ) );
+}
+
+void Engine::initDevice()
+{
+ // create device manager
+ iDevice = new DeviceManager( iConfiguration->startupSettings() );
+ connect( iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ) );
+ iDevice->initDeviceManager();
+}
+
+void Engine::dialogActivated()
+{
+ if ( iIdleTimeCounter != 0 )
{
- case PasswordDialog::Correct :
- {
- iAutoRefresh->stop(); //we stop the metting updating
- iWindowManager->showProgressBar( "Changing current operation mode." );
- connect( iDevice, SIGNAL( changingMode( const QString & ) ),
- iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
- connect( iDevice, SIGNAL( changeModeFailed() ), this, SLOT( changeModeFailed() ) );
- iDevice->changeMode( true );
- break;
- }
- case PasswordDialog::Incorrect :
- {
- iWindowManager->error( tr( "Incorrect password." ) );
- iDevice->changeMode( false );
- break;
- }
- default : //case PasswordDialog::Canceled
- {
- iDevice->changeMode( false );
- }
+ iIdleTimeCounter->stop();
}
}
-void Engine::changeModeFailed()
+void Engine::dialogDeactivated()
{
- qDebug() << "Engine::changeModeFailed()";
- iWindowManager->closeProgressBar();
- iAutoRefresh->start(); //we start the metting updating
+ if ( iIdleTimeCounter != 0 )
+ {
+ iIdleTimeCounter->start();
+ }
}
-void Engine::fetchMeetingDetailsCancelled()
+void Engine::previousViewRestored()
{
- iCommunication->cancelFetchMeetingDetails();
- iWindowManager->closeProgressBar();
+ if ( iIdleTimeCounter != 0 )
+ {
+ iIdleTimeCounter->start();
+ }
+}
+
- void Engine::fetchMeetingDetailsCancelled()
- {
- iCommunication->cancelFetchMeetingDetails();
- // iWindowManager->closeProgressBar();
- }
-
+void Engine::stopIdleTimeCounter()
+{
+ if ( iIdleTimeCounter != 0 )
+ {
+ iIdleTimeCounter->stop();
+ }
+}
+
+void Engine::startIdleTimeCounter()
+{
+ if ( iIdleTimeCounter != 0 )
+ {
+ iIdleTimeCounter->start();
+ }
}
* room storage and calling the roomStatusInfoNeeded() separately on each of them.
*/
void checkStatusOfAllRooms();
- //! Slot. Fetches meeting details from the server.
- //! 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.
- * \param aMeeting The meeting.
- */
- void fetchMeetingDetails( Meeting *aMeeting );
- //! Slot for receiving the status of the entered password
- /*!
- * Slot. Receives the status of the entered password and makes the DeviceManager to change the
- * operation mode if the password is correct.
- * \param aPasswordStatus The status of the password.
- */
- void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
+ //! Slot for receiving the failure event of operation mode changing.
/*!
- * Slot. Fetches meeting details from the server.
- * \param aMeeting The meeting.
+ * Slot. Receives the failure event of operation mode changing.
*/
- void fetchMeetingDetails( Meeting *aMeeting );
- //! Slot for receiving the status of the entered password
- /*!
- * Slot. Receives the status of the entered password and makes the DeviceManager to change the
- * operation mode if the password is correct.
- * \param aPasswordStatus The status of the password.
- */
- void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );
- //! Slot for receiving the cancel event of the progress bar.
- /*!
- * Slot. Receives the cancel event of the progress bar.
- */
- void progressBarCancelled();
+ void changeModeFailed();
//! Slot for receiving the cancel event of the progress bar.
/*!
* Receives the cancel event of the progress bar when meeting details requested.
*/
-- void fetchMeetingDetailsCancelled();
++ void fetchMeetingDetails( Meeting *aMeeting );
++ void cancelFetchMeetingDetails();
+
+ void handleViewEvent();
+ void previousViewRestored();
+
+ //! Slot for dialog activation signal.
+ /*!
+ * This slot is used to inform that dialog is activated. It stops
+ * the idle time counter so screensaver is not activated while the
+ * dialog is displayed.
+ */
+ void dialogActivated();
+ //! Slot for dialog deactivation signal.
+ /*!
+ * This slot is used to inform that dialog is deactivated. It restarts
+ * the idle time counter so that the screensaver is being activated again
+ * as needed.
+ */
+ void dialogDeactivated();
+
+ void stopIdleTimeCounter();
+ void startIdleTimeCounter();
++
++ void changeDeviceMode( bool aChange );
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
--- /dev/null
+#include "UIManager.h"
+
+#include <QDateTime>
+#include <QTime>
+
+#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 <QtDebug>
+
+#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;
+
++ qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
++
+ createWeeklyView();
+ createSettingsView();
+ createRoomStatusIndicator();
+ createPasswordDialog();
+ createProgressBar();
+ createMeetingInfoDialog();
++
++ qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
+}
+
+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 signals to UIManager
+ connect( iWeeklyView, SIGNAL( settingsButtonClicked() ), this, SLOT( settingsViewRequest() ) );
+ connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
++ connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( showMeetingProgressBar( Meeting * ) ) );
++ // Connect signals to engine
++ connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting * ) ) );
++ connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), iEngine, SLOT( shownWeekChanged( QDate ) ) );
+}
+
+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") );
++
++ connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+}
+
+void UIManager::createProgressBar()
+{
+ iProgressBar = new ProgressBar( tr("CHANGE THIS") );
+
- connect( iProgressBar, SIGNAL( cancelled() ), this, SLOT( progressBarCancelled() ) );
- connect( iProgressBar, SIGNAL( cancelled() ), iEngine, SLOT( progressBarCancelled() ) );
++ // Connect to UIManager
++ connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
++ // Connect to Engine
++ connect( iProgressBar, SIGNAL( cancel() ), iEngine, SLOT( cancelFetchMeetingDetails() ) );
+}
+
+void UIManager::createMeetingInfoDialog()
+{
-
++ iMeetingInfo = new MeetingInfoDialog();
+}
+
+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 & ) ) );
++ connect( aDeviceManager, SIGNAL( changingMode( const QString & ) ), this, SLOT( updateProgressBarText( 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<Meeting *> ) ), this, SLOT( meetingsFetched( const QList<Meeting *> ) ) );
+ 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<ViewBase *>( iSettingsView ) );
+ iEngine->stopIdleTimeCounter();
+ }
+}
+
+void UIManager::settingsOkClicked()
+{
+ // Show the weekly view and restart the idle timer
+ if ( iWeeklyView != 0 )
+ {
+ iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ iEngine->startIdleTimeCounter();
+ }
+}
+
+void UIManager::meetingsFetched( const QList<Meeting*> &aMeetings )
+{
+
+}
+
++void UIManager::showMeetingProgressBar( Meeting *aMeeting )
++{
++ if ( iProgressBar != 0 )
++ {
++ iProgressBar->update( tr("Fetching meeting info...") );
++ iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
++ }
++}
++
+void UIManager::meetingDetailsFetched(Meeting &aDetailedMeeting)
+{
+ if ( iMeetingInfo != 0 )
+ {
++ if ( iProgressBar != 0 )
++ {
++ iProgressBar->close(); // Close it in case it's visible
++ }
+ iMeetingInfo->setMeeting( &aDetailedMeeting );
+ iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
+ }
+}
+
+void UIManager::roomStatusIndicatorRequested()
+{
+ if ( iRoomStatusIndicator != 0 )
+ {
+ iWindowManager->showView( static_cast<ViewBase *>( iRoomStatusIndicator ) );
+ iEngine->stopIdleTimeCounter();
+ }
+}
+
+void UIManager::previousViewRestored()
+{
+ iEngine->startIdleTimeCounter();
+}
+
+void UIManager::progressBarCancelled()
+{
- // TODO : Close progress bar
++ if ( iProgressBar != 0 )
++ {
++ iProgressBar->close();
++ }
+}
+
+void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode )
+{
+ qDebug() << "[UIManager::changeModeOrdered] <Invoked>";
+
+ 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<QDialog *>( 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 );
+ }
+}
++
++void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus )
++{
++ switch( aStatus )
++ {
++ case PasswordDialog::Correct:
++ // Show the progress bar..
++ if ( iProgressBar != 0 )
++ {
++ iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ) );
++ }
++ // ... and initiate the mode changing
++ iEngine->changeDeviceMode( true );
++ break;
++ case PasswordDialog::Incorrect:
++ iWindowManager->error( tr("Incorrect Password") );
++ case PasswordDialog::Canceled:
++ iEngine->changeDeviceMode( false );
++ break;
++ }
++
++ // Close the dialog after we have handled the status
++ if ( iPasswordDialog != 0 )
++ {
++ iPasswordDialog->close();
++ }
++}
++
++void UIManager::updateProgressBarText(const QString &aText)
++{
++ if ( iProgressBar != 0 )
++ {
++ iProgressBar->update( aText );
++ }
++}
--- /dev/null
+#ifndef UIMANAGER_H_
+#define UIMANAGER_H_
+
+#include <QObject>
+#include <QList>
+
+#include "Meeting.h"
+#include "DeviceManager.h"
++#include "PasswordDialog.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<Meeting*> &aMeetings );
+ void meetingDetailsFetched( Meeting &aDetailedMeeting );
+ void currentRoomChanged( Room *aRoom );
+ void progressBarCancelled();
+ void updateTime( QDateTime aDateTime );
++ void passwordEntered( PasswordDialog::PasswordStatus aStatus );
++ void showMeetingProgressBar( Meeting *aMeeting );
++ void updateProgressBarText( const QString &aText );
+
+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_*/
QHBoxLayout *buttonLayout = new QHBoxLayout;
iOkButton = new QPushButton;
iOkButton->setText( tr( "OK" ) );
-- iCancelButton = new QPushButton;
-- iCancelButton->setText( tr( "Cancel" ) );
buttonLayout->addWidget( iOkButton );
-- buttonLayout->addWidget( iCancelButton );
// Handle the main layout
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout( mainLayout );
// Handle component connections
- connect( iOkButton, SIGNAL( pressed() ), this, SLOT( okClicked() ) );
- connect( iCancelButton, SIGNAL( pressed() ), this, SLOT( cancelClicked() ) );
+ connect( iOkButton, SIGNAL( clicked() ), this, SLOT( handleOkClicked() ) );
- connect( iCancelButton, SIGNAL( clicked() ), this, SLOT( cancelClicked() ) );
}
SettingsView::~SettingsView()
delete iOkButton;
iOkButton = 0;
}
-- if ( iCancelButton != 0 )
-- {
-- delete iCancelButton;
-- iCancelButton = 0;
-- }
if ( iSettingsTab != 0 )
{
delete iSettingsTab;
bool powerSaveEnabled = iPowerSaveEnabled->isChecked();
// TODO : Set the values to configuration and save it
-
- close();
+
+ // Emit the signal to notify that ok is pressed and data is saved.
+ emit okClicked();
-
- // close();
- }
-
- void SettingsView::cancelClicked()
- {
- qDebug() << "[SettingsView::cancelClicked] <Invoked>";
- close();
}
-void SettingsView::cancelClicked()
+void SettingsView::viewResized(const QSize &size)
{
- qDebug() << "[SettingsView::cancelClicked] <Invoked>";
- close();
-}
+ qDebug() << "[SettingsView::viewResized] <Invoked>";
+
+ qDebug() << "[SettingsView::viewResized] <Finished>";
+}
private slots:
//! Slot to handle the Ok button pressing.
- void okClicked();
- //! Slot to handle the cancel button pressing.
- void cancelClicked();
+ void handleOkClicked();
- //! Slot to handle the cancel button pressing.
- void cancelClicked();
private:
//! Initialize "Settings" tab.
QTabWidget *iTabWidget;
//! OK button to dismiss the settings view with saving the settings.
QPushButton *iOkButton;
-- //! Cancel button to dismiss the settings view without saving settings.
-- QPushButton *iCancelButton;
//! Settings tab.
QWidget *iSettingsTab;
//! Week View tab.
\r
iRoomsCombo = new MeetingRoomCombo( iConfiguration->rooms(), this );\r
iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
- connect( iRoomsCombo, SIGNAL( currentRoomChange( Room * ) ), this, SIGNAL( currentRoomChange( Room * ) ) );\r
- connect( iRoomsCombo, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );\r
++ connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );\r
\r
iTimeDisplay = new DigitalTimeDisplayWidget( aCurrentDateTime.time(), iConfiguration->displaySettings()->timeFormat(), this );\r
iTimeDisplay->setFrameVisible( false );\r
#include "WindowManager.h"
-#include <QTimer>
-#include "Configuration.h"
-#include "DisplaySettings.h"
-#include "Meeting.h"
-#include "Room.h"
-#include "Clock.h"
-#include "WeeklyViewWidget.h"
-#include "RoomStatusIndicatorWidget.h"
-#include "MeetingInfoDialog.h"
+#include <QEvent>
+#include <QDialog>
+#include "ViewBase.h"
+ #include "PopUpMessageBox.h"
-#include "DeviceManager.h"
-#include "SettingsView.h"
-#include "ProgressBar.h"
#include <QtDebug>
{
qDebug() << "WindowManager::showErrorPopup";
- // PopUpMessageBox::error( 0, aErrorMessage );
- PopUpMessageBox::error( 0, aErrorMessage );
-}
-
-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() ) );
- }
-
- //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
-}
-
-void WindowManager::closeProgressBar()
-{
- qDebug() << "WindowManager::closeProgressBar()";
- if( iProgressBar )
- {
- iProgressBar->close();
- delete iProgressBar;
- iProgressBar = 0;
- }
++ showDialog( static_cast<QDialog *>( PopUpMessageBox::error( 0, aErrorMessage ) ) );
}
-void WindowManager::updateProgressBar( const QString &aMessage )
+void WindowManager::setFullscreen()
{
- qDebug() << "WindowManager::updateProgressBar( const QString & )";
- if( iProgressBar != 0 )
- iProgressBar->update( aMessage );
+ this->setWindowState( Qt::WindowFullScreen );
+ // Resize event handles the rest.
}