- Re-factored the code so that Engine is now the main class that owns WindowManager...
authorJan Lapinkataja <jan.lapinkataja@ixonos.com>
Wed, 20 May 2009 07:27:06 +0000 (10:27 +0300)
committerJan Lapinkataja <jan.lapinkataja@ixonos.com>
Wed, 20 May 2009 07:27:06 +0000 (10:27 +0300)
- Some updating to progress bar class relation with operation mode change (Task 1168)

13 files changed:
QtMeetings.pro
debian/postrm
src/BusinessLogic/Engine.cpp
src/BusinessLogic/Engine.h
src/Domain/Configuration/Configuration.cpp
src/IO/DeviceControl/DeviceManager.h
src/UserInterface/Utils/PasswordDialog.cpp
src/UserInterface/Utils/PasswordDialog.h
src/UserInterface/Utils/ProgressBar.cpp [new file with mode: 0755]
src/UserInterface/Utils/ProgressBar.h [new file with mode: 0755]
src/UserInterface/WindowManager.cpp
src/UserInterface/WindowManager.h
src/main.cpp

index 38adacb..cbe1b6c 100644 (file)
@@ -1,10 +1,7 @@
 TEMPLATE = app
-
 TARGET = qtmeetings
-
 QT += xml \
     network
-
 INCLUDEPATH += src/Domain/ \
     src/Domain/Configuration/ \
     src/IO/ \
@@ -16,8 +13,8 @@ INCLUDEPATH += src/Domain/ \
     src/UserInterface/Components/ \
     src/UserInterface/Utils/ \
     src/UserInterface/Views/
-
-HEADERS += src/Domain/Room.h \
+HEADERS += src/UserInterface/Utils/ProgressBar.h \
+    src/Domain/Room.h \
     src/Domain/Meeting.h \
     src/Domain/Configuration/ConnectionSettings.h \
     src/Domain/Configuration/StartupSettings.h \
@@ -47,8 +44,8 @@ HEADERS += src/Domain/Room.h \
     src/UserInterface/Views/MeetingInfoDialog.h \
     src/UserInterface/Views/SettingsView.h \
     src/UserInterface/WindowManager.h
-
-SOURCES += src/Domain/Room.cpp \
+SOURCES += src/UserInterface/Utils/ProgressBar.cpp \
+    src/Domain/Room.cpp \
     src/Domain/Meeting.cpp \
     src/Domain/Configuration/ConnectionSettings.cpp \
     src/Domain/Configuration/StartupSettings.cpp \
@@ -79,50 +76,40 @@ SOURCES += src/Domain/Room.cpp \
     src/UserInterface/Views/SettingsView.cpp \
     src/UserInterface/WindowManager.cpp \
     src/main.cpp
-
 RESOURCES += resources/BusinessLogic.qrc \
     resources/UserInterface.qrc
-
 CONFIG += link_pkgconfig
 PKGCONFIG += libalarm
 
-DEFINES += QT_NO_DEBUG_OUTPUT
-
+# DEFINES += QT_NO_DEBUG_OUTPUT
 executable.files = qtmeetings
 executable.path = /usr/bin/
 executable.hint = executable
 INSTALLS += executable
-
 appconfig.files = QtMeetings.conf
 appconfig.path = /etc/
 appconfig.hint = appconfig
 INSTALLS += appconfig
-
 desktop.files = QtMeetings.desktop
 desktop.path = /usr/share/applications/hildon/
 desktop.hint = desktop
 INSTALLS += desktop
-
 devstopperscript.files = scripts/qtmeetings-devstopper
 devstopperscript.path = /usr/bin/
 devstopperscript.hint = devstopperscript
 INSTALLS += devstopperscript
-
 renamescript.files = scripts/qtmeetings-rename
 renamescript.path = /usr/bin/
 renamescript.hint = renamescript
 INSTALLS += renamescript
-
 updatercdscript.files = scripts/qtmeetings-updatercd
 updatercdscript.path = /usr/bin/
 updatercdscript.hint = updatercdscript
 INSTALLS += updatercdscript
-
 launcherscript.files = scripts/qtmeetings-launcher
 launcherscript.path = /etc/init.d/
 launcherscript.hint = launcherscript
 INSTALLS += launcherscript
-
 unix:exists( $$system(which doxygen) ) { 
     message( "Doxygen is present in your system." )
     BUILD_NOW = $$prompt( "Do you want to build Doxygen documentation now? [YES/no]" )
index 00ece1c..5ca9600 100644 (file)
@@ -25,4 +25,8 @@ if [ -e /usr/var/qtmeetings.txt ]; then
        rm /usr/var/qtmeetings.txt
 fi
 
+if [ -e /usr/var/qtmeetings.log ]; then
+       rm /usr/var/qtmeetings.log
+fi
+
 exit 0
index 2f943a7..e529799 100644 (file)
@@ -1,49 +1,64 @@
 #include "Engine.h"
-
-#include <QTimer>
-#include <QList>
 #include "Room.h"
 #include "Meeting.h"
 #include "ConnectionSettings.h"
 #include "Configuration.h"
+#include "DisplaySettings.h"
 #include "CommunicationManager.h"
 #include "DeviceManager.h"
 #include "Clock.h"
 #include "ErrorMapper.h"
+#include "WeeklyViewWidget.h"
 
+#include <QApplication>
+#include <QTimer>
+#include <QList>
 #include <QtDebug>
 
 QTime Engine::endOfTheDay = QTime( 23, 59, 0, 0 ); // end of the day is 11:59pm
+const int IDLE_TIME_MULTIPLIER = 60000; // Multiplies milliseconds to minutes
 
 Engine::Engine() :
-               iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 ), iCurrentRoom( 0 )
+               iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 )
 {
        // if reading of configuration fails, signal that initialization failed
        if ( iConfiguration == 0 )
        {
-               QTimer::singleShot( 0, this, SIGNAL( initializationFailed() ) );
+               QTimer::singleShot( 0, this, SLOT( closeApplication() ) );
                return;
        }
+               
+       //initialize window manager
+       iWindowManager = new WindowManager( iConfiguration );
+       connect( iWindowManager, SIGNAL( roomStatusInfoNeeded( Room * ) ), this, SLOT( roomStatusInfoNeeded( Room * ) ) );
+       connect( iWindowManager, SIGNAL( observedEventDetected() ), this, SLOT( observedEventDetected() ) );
+       connect( iWindowManager, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( fetchMeetingDetails( Meeting * ) ) );
+       connect( iWindowManager, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
+       connect( iWindowManager, SIGNAL( shownWeekChanged( QDate ) ), this, SLOT( shownWeekChanged( QDate ) ) );
+       connect( iWindowManager, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
+                       this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+       connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
+       
        // 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*>& ) )
-                       );
-       connect( iCommunication,
-                        SIGNAL( meetingDetailsFetched( Meeting& ) ),
-                        this,
-                        SLOT( meetingDetailsFetched( Meeting& ) )
-                       );
+       connect( iCommunication, SIGNAL( error( int, CommunicationManager::CommunicationType  ) ),
+                       this, SLOT( errorHandler( int ) ) );
+       connect( iCommunication, SIGNAL( meetingsFetched( const QList<Meeting*>& ) ),
+                       this, SLOT( meetingsFetched( const QList<Meeting*>& ) ) );
+       connect( iCommunication, SIGNAL( meetingDetailsFetched( Meeting& ) ),
+                       this, SLOT( meetingDetailsFetched( Meeting& ) ) );
+
+       //initialize idle time counter
+       iIdleTimeCounter = new QTimer();
+       iIdleTimeCounter->setSingleShot( true );
+       iIdleTimeCounter->setInterval( IDLE_TIME_MULTIPLIER * iConfiguration->displaySettings()->screensaver() );
+       iIdleTimeCounter->start();
+       connect( iIdleTimeCounter, SIGNAL( timeout() ), iWindowManager, SLOT( showRoomStatus() ) );
 
        // create application clock
        iClock = new Clock;
        connect( iClock, SIGNAL( tick( QDateTime ) ), this, SLOT( checkStatusOfAllRooms() ) );
+       connect( iClock, SIGNAL( tick( QDateTime ) ), iWindowManager, SLOT( distributeDateTimeInfo( QDateTime ) ) );
 
        iAutoRefresh = new QTimer;
        iAutoRefresh->setInterval( iConfiguration->connectionSettings()->refreshInterval() * 1000 );
@@ -51,9 +66,15 @@ Engine::Engine() :
        connect( iAutoRefresh, SIGNAL( timeout() ), iAutoRefresh, SLOT( start() ) );
        connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ) );
 
+       // create device manager
        iDevice = new DeviceManager( iConfiguration->startupSettings() );
-       connect( iDevice, SIGNAL( error( int, const QString& ) ), this, SLOT( errorHandler( int, const QString& ) ) );
+       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();
+       
+       if( iDevice->currentOperationMode() == DeviceManager::KioskMode )
+               iWindowManager->fullScreen();
 
        QTimer::singleShot( 0, this, SLOT( fetchMeetings() ) );
 
@@ -64,26 +85,39 @@ Engine::~Engine()
 {
        while ( !iMeetings.isEmpty() )
                delete iMeetings.takeFirst();
+       iIdleTimeCounter->stop();
+       delete iIdleTimeCounter;
+       iIdleTimeCounter = 0;
+       delete iWindowManager;
+       iWindowManager = 0;
+       delete iClock;
+       iClock = 0;
+       delete iDevice;
+       iDevice = 0;
 }
 
-Room* Engine::defaultRoom()
+void Engine::closeApplication()
 {
-       return iConfiguration->defaultRoom();
+       qDebug() << "Engine::closeApplication()";
+       // closes application after 1 second
+       QTimer::singleShot( 1000, QApplication::instance(), SLOT( quit() ) );
 }
 
-Clock* Engine::clock()
+void Engine::observedEventDetected()
 {
-       return iClock;
-}
-
-Configuration* Engine::configuration()
-{
-       return iConfiguration;
+       iWindowManager->showWeeklyView();
+       // prepare to restart idle counter
+       if ( iIdleTimeCounter->isActive() )
+       {
+               iIdleTimeCounter->stop();
+       }
+       // (re)start idle counter
+       iIdleTimeCounter->start();
 }
 
-DeviceManager* Engine::deviceManager()
+Room* Engine::defaultRoom()
 {
-       return iDevice;
+       return iConfiguration->defaultRoom();
 }
 
 void Engine::checkStatusOfAllRooms()
@@ -143,8 +177,6 @@ void Engine::roomStatusInfoNeeded( Room *aRoom )
        int indexOfCurrentMeeting = indexOfMeetingAt( aRoom, iClock->datetime() );
        int indexOfNextMeeting = indexOfMeetingAfter( aRoom, iClock->datetime() );
 
-//     qDebug() << QString( "Engine::roomStatusInfoNeeded\troom:%1current:%2 next:%3" ).arg( aRoom->toString() ).arg( indexOfCurrentMeeting ).arg( indexOfNextMeeting );
-
        // if there is no meeting, then status is Free; otherwise Busy
        Room::Status status = ( indexOfCurrentMeeting == -1 ) ? Room::FreeStatus : Room::BusyStatus;
        // if room is Busy, then check end time, otherwise...
@@ -152,21 +184,16 @@ void Engine::roomStatusInfoNeeded( Room *aRoom )
                          // ...if there is meeting following on the same day then check end time, otherwise end is the of the working day
                          (( indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay );
 
-       emit roomStatusChanged( aRoom, status, until );
+       //currently works only for deafult room
+       if( aRoom->equals( *(defaultRoom() ) ) )
+               iWindowManager->roomStatusChanged( aRoom, status, until );
 }
 
 void Engine::fetchMeetings()
 {
-       // TODO : define interval correctly. at the moment it's +/- 14 days
-       Room *room = iCurrentRoom;
-       if ( room == 0 ) room = defaultRoom();
+       Room *room = defaultRoom();
        qDebug() << "Engine::fetchMeetings for " << room->name();
-       fetchMeetings( iClock->datetime().addDays( -14 ), iClock->datetime().addDays( 14 ), room );
-}
-
-void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, Room *aIn )
-{
-       iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
+       fetchMeetings( iClock->datetime(), iClock->datetime().addDays( 7 ), room );
 }
 
 void Engine::fetchMeetingDetails( Meeting *aMeeting )
@@ -198,7 +225,7 @@ void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
                        Meeting* m = new Meeting( *(aMeetings.at( i )) );
                        iMeetings.append( m );
                        // and signal the changes
-                       emit meetingAdded( m );
+                       iWindowManager->insertMeeting( m );
                }
        }
 
@@ -210,7 +237,7 @@ void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
                {
                        Meeting* m = iMeetings.takeAt( i );
                        // signal the changes
-                       emit meetingDeleted( m );
+                       iWindowManager->deleteMeeting( m );
                        // delete the meeting from the local list
                        delete m;
                }
@@ -222,7 +249,7 @@ void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
 
 void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting )
 {
-       emit meetingDetailsFetched( &aDetailedMeeting );
+       iWindowManager->showMeetingInfo( &aDetailedMeeting );
 }
 
 void Engine::errorHandler( int aCode, const QString &aAddInfo )
@@ -231,11 +258,67 @@ void Engine::errorHandler( int aCode, const QString &aAddInfo )
        // inform UI about the problem
        if( aCode >= 100 && aCode <= 110 )
                qDebug() << "CommunicationManager signaled an error:" << aCode;
-       emit error( ErrorMapper::codeToString( aCode, aAddInfo ) );
+       iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
 }
 
 void Engine::currentRoomChanged( Room *aCurrentRoom )
 {
-       iCurrentRoom = aCurrentRoom;
-       qDebug() << "Engine::currentRoomChanged to " << iCurrentRoom->name();
+       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";
+       iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
+}
+
+void Engine::shownWeekChanged( QDate aFrom )
+{
+       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() );
+}
+
+void Engine::changeModeOrdered( DeviceManager::OperationMode aMode )
+{
+       QString message = tr( "You are about to change operation mode to %1." )
+                               .arg( iDevice->operationModeToString( aMode ) );
+       
+       iWindowManager->showPasswordDialog( iConfiguration->adminPassword(), message );
+}
+
+void Engine::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+{
+       qDebug() << "Engine::passwordEntered( PasswordDialog::PasswordStatus )";
+       iWindowManager->closePasswordDialog();
+       
+       switch ( aPasswordStatus )
+       {
+               case PasswordDialog::Correct :
+               {
+                       iWindowManager->showProgressBar( "Changing current operation mode." );
+                       break;
+               }
+               case PasswordDialog::Incorrect :
+               {
+                       iWindowManager->error( tr( "Incorrect password." ) );
+                       iDevice->handleKeyPresses( true );
+                       break;
+               }
+               default : //case PasswordDialog::Canceled
+               {
+                       iDevice->handleKeyPresses( true );
+               }
+       }
+}
+
+void Engine::progressBarCancelled()
+{
+       //TODO: cancel the on-going event
+       iWindowManager->closeProgressBar();
+       iDevice->handleKeyPresses( true );
 }
index 47b2a4d..457d6ba 100644 (file)
@@ -4,6 +4,7 @@
 #include <QObject>
 #include <QDateTime>
 #include "Room.h"
+#include "WindowManager.h"
 
 class QTimer;
 class Clock;
@@ -29,94 +30,46 @@ public:
        Engine();
        //! Destructor.
        virtual ~Engine();
-
-       //! Gets the clock instance used by the object to get up-to-date date and time info.
-       /*!
-        * Gets the clock instance used by the object to get up-to-date date and time info.
-        * \return Pointer to the Clock instance.
-        */
-       Clock* clock();
-       //! Gets the application's configuration.
-       /*!
-        * Gets the application's configuration.
-        * \return Pointer to the Configuration instance.
-        */
-       Configuration* configuration();
        //! Gets default room of the application.
        /*!
         * Gets default room of the application.
         * \return Pointer to the default Room instance.
         */
        Room* defaultRoom();
-       //! Gets the deviceManager instance
-       /*!
-        * Gets the deviceManager instance.
-        * \return Pointer to the deviceManager instance.
-        */
-       DeviceManager* deviceManager();
 
 signals:
-       //! Signal. Emitted if initialization of the current instance failed.
-       /*!
-        * Signal. Emitted if initialization of the current instance failed, if reading of the configuration
-        * was not successful. It's purpose to inform the userinterface that the Engine is not ready for
-        * controlling the application, application must be shut down.
-        */
-       void initializationFailed();
-       //! Signal. Emitted if the availability information of the specified room changed.
-       /*!
-        * Signal. Emitted if the availability information of the specified room changed.
-        * \param aRoom The Room instance which availability changed.
-        * \param aStatus The status of the room.
-        * \param aUntil Time until the spacified status is valid.
-        */
-       void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aUntil );
-       //! Signal. Emitted if new meeting was found on the server.
-       /*!
-        * Signal. Emitted if new meeting was found on the server.
-        * \param aMeeting The new meeting which was added.
-        */
-       void meetingAdded( Meeting *aMeeting );
-       //! Signal. Emitted if meeting was deleted on the server.
-       /*!
-        * Signal. Emitted if meeting was deleted on the server.
-        * \param aMeeting The meeting which was deleted.
-        */
-       void meetingDeleted( Meeting *aMeeting );
-       //! Signal. Emitted error occured and error message must be shown on UI.
-       /*!
-        * Signal. Emitted error occured and error message must be shown on UI.
-        * \param aErrorMessage The message.
-        */
-       void error( const QString &aErrorMessage );
 
-       void meetingDetailsFetched( Meeting *aDetailedMeeting );
+       void meetingDetailsFetched( Meeting *aDetailedMeeting );        
 
-public slots:
+private slots:
+       //! Slot. Closes the application.
+       /*!
+        * Slot. Closes the application.
+        */
+       void closeApplication();
        //! Slot. Checks actual availability information of the specified room.
        /*!
         * Slot. Checks actual availability information of the specified room.
         * \param aRoom The room which availability information is needed.
         */
        void roomStatusInfoNeeded( Room *aRoom );
-       //! Slot. Fetches meetings from the server.
+       //! Slot. Indicates that some user event has happened.
        /*!
-        * Slot. Fetches meetings from the server, exact parameters are specified in the parameter list.
-        * \param aFrom Time from when the meetings need to be fetched.
-        * \param aUntil Time until when the meetings need to be fetched.
-        * \param aIn The room which meetings need to be fetched.
+        * Slot. Indicates that some user event has happened.
         */
-       void fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, Room *aIn );
-       
-       void fetchMeetingDetails( Meeting * );
-       
+       void observedEventDetected();
+       //! Slot. Asks the communication to fetch new meeting data.
        /*!
-        * Slot. Sets the current meeting room iCurrentRoom.
-        * \param aCurrentRoom
+        * Slot. Asks the communication to fetch new meeting data.
+        * \param aCurrentRoom The current room.
         */
        void currentRoomChanged( Room *aCurrentRoom );
-
-private slots:
+       //! 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.
        /*!
         * Slot. Handles errors and informs the UI by emitting the error() signal with the message in
@@ -148,7 +101,31 @@ private slots:
         * 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.
+        * \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 cancel event of the progress bar.
+       /*!
+        * Slot. Receives the cancel event of the progress bar.
+        */
+       void progressBarCancelled();
+       
 private:
        //! Provides the index of the Meeting instance which is at the specified time.
        /*!
@@ -176,10 +153,20 @@ private:
         * \return True if contains; otherwise, false.
         */
        static bool isMeetingInList( const QList<Meeting*> &aList, const Meeting *aMeeting );
+       //! Slot. Fetches meetings from the server.
+       /*!
+        * Slot. Fetches meetings from the server, exact parameters are specified in the parameter list.
+        * \param aFrom Time from when the meetings need to be fetched.
+        * \param aUntil Time until when the meetings need to be fetched.
+        * \param aIn The room which meetings need to be fetched.
+        */
+       void fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn );
 
 private:
        static QTime endOfTheDay;
 
+       WindowManager *iWindowManager;
+       QTimer *iIdleTimeCounter;
        Clock *iClock;
        Configuration *iConfiguration;
        CommunicationManager *iCommunication;
@@ -188,8 +175,6 @@ private:
        QTimer *iAutoRefresh;
 
        QList<Meeting*> iMeetings;
-
-       Room *iCurrentRoom;     /*! Not owned */
 };
 
 #endif /*ENGINE_H_*/
index 9286846..56a4472 100644 (file)
@@ -479,10 +479,10 @@ StartupSettings * Configuration::readStartupSettings( const QDomNode &aXML )
 
 DisplaySettings * Configuration::readDisplaySettings( const QDomNode &aXML )
 {
-       DisplaySettings::DaysInSchedule daysInSchedule;
+       DisplaySettings::DaysInSchedule daysInSchedule = DisplaySettings::WeekdaysInSchedule;
        QTime dayStartsAt, dayEndsAt;
-       DisplaySettings::DateFormat dateformat;
-       DisplaySettings::TimeFormat timeformat;
+       DisplaySettings::DateFormat dateformat = DisplaySettings::ShortDateFormat;
+       DisplaySettings::TimeFormat timeformat = DisplaySettings::TwentyFourHoursTimeFormat;
        int screensaver = 1;    //! Default value for screensaver wait time
 
        for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
index f3f89dc..e65f714 100644 (file)
@@ -84,6 +84,19 @@ public:
         * \return QString value of the current operation mode.
         */
        QString operationModeToString( OperationMode aMode );
+       //! Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot.
+       /*!
+        * Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot. In case
+        * a signal is caught the connection is disabled until the signal handling is finished.
+        * \param aHandle indicates if the signals should be connected or not.
+        */
+       void handleKeyPresses( bool aHandle );
+       //! Changes the operation mode.
+       /*!
+        * Changes the operation mode.
+        * \param aChange To indicate if the mode should be changed or not
+        */
+       void changeMode( bool aChange );
 
 signals:
        //! Signal. Emitted if user tries to change the operation mode.
@@ -100,14 +113,6 @@ signals:
         */
        void error( int aCode, const QString &aAddInfo );
 
-public slots:
-       //! Slot. Changes the operation mode.
-       /*!
-        * Slot. Changes the operation mode.
-        * \param aChange To indicate if the mode should be changed or not
-        */
-       void changeMode( bool aChange );
-
 private slots:
        //! Slot. Handles "full screen"-hardware key presses.
        /*!
@@ -148,13 +153,6 @@ private:
         * \return True if operation mode storing and deactivation of the init script succeed; otherwise, false.
         */
        bool finalizeStandAloneMode();
-       //! Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot.
-       /*!
-        * Connects/disconnects the HWKeyListener signals to the private HWKeyFullScreenPressed() slot. In case
-        * a signal is caught the connection is disabled until the signal handling is finished.
-        * \param aHandle indicates if the signals should be connected or not.
-        */
-       void handleKeyPresses( bool aHandle );
 
 private:
        AlarmSender *iAlarmSender;
index 332b0b6..778d32a 100644 (file)
@@ -7,18 +7,12 @@
 #include <QtDebug>
 #include <QLabel>
 
-PasswordDialog::PasswordDialog( QWidget *aParent, const QString &aPassword, const QString &aText, const QString &aTitle ) :
+PasswordDialog::PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle, QWidget *aParent ) :
                QDialog( aParent )
 {
        setWindowTitle( aTitle.isNull() ? tr( "Enter password" ) : aTitle );
        setModal( true );
 
-       // Store the password hash to iPasswordHash
-       // ( aPassword should be allready encoded )
-//     QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 );
-//     hash->addData( aPassword.toUtf8() );
-//     iPasswordHash = hash->result();
-//     delete hash;
        iPasswordHash = aPassword.toUtf8();
 
        /* Create the layout:
@@ -75,8 +69,10 @@ void PasswordDialog::okButtonPressed()
        QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 );
        hash->addData( iPasswordEdit->text().toUtf8() );
        QByteArray userpw = hash->result();
-       delete hash; 
+       delete hash;
        
+       close();
+               
        // Compare the password hashes and emit corresponding signal tellin if the password was correct
        if ( iPasswordHash == userpw.toHex() )
        {
@@ -88,25 +84,13 @@ void PasswordDialog::okButtonPressed()
                emit passwordEntered( PasswordDialog::Incorrect );
                qDebug() << "Incorrect password!";
        }
-
-       // Close the dialog
-       close();
 }
 
 void PasswordDialog::cancelButtonPressed()
 {
        qDebug() << "PasswordDialog::cancelButtonPressed()";
-
-       emit passwordEntered( PasswordDialog::Canceled );
-
+       
        close();
-}
-
-PasswordDialog * PasswordDialog::query( QWidget *aParent, const QString &aPassword, const QString &aText, const QString &aTitle )
-{
-       // Create a PasswordDialog instance and show it
-       PasswordDialog* dlg = new PasswordDialog( aParent, aPassword, aText, aTitle );
-       dlg->show();
-       return dlg;
+       emit passwordEntered( PasswordDialog::Canceled );
 }
 
index 5bf8c62..686523b 100644 (file)
@@ -27,18 +27,6 @@ public:
                Canceled
        };
 
-       //! Creates a new PasswordDialog instance and shows the dialog on the screen.
-       /*!
-        * Creates a new Password query dialog.
-        * \param aParent The parent object.
-        * \param aPassword The password.
-        * \param aText Optional. Text displayed in the dialog.
-        * \param aTitle Optional. Dialog title, defaults to "Enter password".
-        * \return The instance which was created.
-        */
-       static PasswordDialog * query( QWidget *aParent, const QString &aPassword,
-                                                const QString &aText = 0, const QString &aTitle = 0 );
-
 signals:
        //! Signals the authenticity of the password when the uuser dismisses the dialog.
        /*!
@@ -51,14 +39,14 @@ private slots:
        void okButtonPressed();
        void cancelButtonPressed();
 
-private:
+public:
        //! Constructor.
        /*!
         * Constructor to initialize a PasswordDialog instance.
         * \param aParent The parent object.
         * \param aPassword The password.
         */
-       PasswordDialog( QWidget *aParent, const QString &aPassword, const QString &aText, const QString &aTitle );
+       PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle = "", QWidget *aParent = 0 );
        //! Destructor.
        virtual ~PasswordDialog();
 
diff --git a/src/UserInterface/Utils/ProgressBar.cpp b/src/UserInterface/Utils/ProgressBar.cpp
new file mode 100755 (executable)
index 0000000..a43098d
--- /dev/null
@@ -0,0 +1,34 @@
+#include "ProgressBar.h"
+
+#include <QProgressBar>
+#include <QBoxLayout>
+#include <QPushButton>
+
+ProgressBar::ProgressBar( const QString &aText, QWidget *aParent ) :
+       QDialog( aParent )
+{
+       setWindowTitle( aText );
+       setModal( true );
+
+       iProgress = new QProgressBar();
+       iProgress->setMinimumWidth( 200 );
+       iProgress->setMaximum( 0 );
+       iProgress->setTextVisible( false );
+
+       QBoxLayout* layout = new QBoxLayout( QBoxLayout::LeftToRight, this );
+       layout->setSizeConstraint( QLayout::SetDefaultConstraint );
+       layout->addWidget( iProgress, 0, Qt::AlignHCenter );
+       
+       QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
+       layout->addSpacing( 5 );
+       layout->addWidget( buttonCancel );
+       
+       connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+       connect( iProgress, SIGNAL( valueChanged( int ) ), this, SIGNAL( started() ) );
+       
+       setLayout( layout );
+}
+
+ProgressBar::~ProgressBar()
+{
+}
diff --git a/src/UserInterface/Utils/ProgressBar.h b/src/UserInterface/Utils/ProgressBar.h
new file mode 100755 (executable)
index 0000000..a247cf3
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef PROGRESSBAR_H_
+#define PROGRESSBAR_H_
+
+#include <QDialog>
+
+class QProgressBar;
+
+//! UserInterface class.
+/*!
+ * UserInterface class which launches a modal progress bar during application events that might take
+ * some time
+ */
+class ProgressBar : public QDialog
+{
+       Q_OBJECT
+
+public:
+       //! Constructor.
+       /*!
+        * Constructor to initialize the StatusWidget instance.
+        * \param aParent Parent object.
+        * \param aText Title string to be set to the progress bar.
+        */
+       ProgressBar( const QString &aText, QWidget *aParent = 0 );
+       //! Destructor.
+       virtual ~ProgressBar();
+
+signals:
+       //! Signal. Emitted if user presses cancel button.
+       /*!
+        * Signal. Emitted if user presses cancel button.
+        */
+       void cancel();
+       void started();
+
+private:
+       QProgressBar *iProgress;
+
+};
+
+#endif /*PROGRESSBAR_H_*/
index edb7b95..3a593a9 100644 (file)
@@ -1,12 +1,10 @@
 #include "WindowManager.h"
 
-#include <QApplication>
 #include <QTimer>
 #include "Configuration.h"
 #include "DisplaySettings.h"
 #include "Meeting.h"
 #include "Room.h"
-#include "Engine.h"
 #include "Clock.h"
 #include "WeeklyViewWidget.h"
 #include "RoomStatusIndicatorWidget.h"
 #include "PopUpMessageBox.h"
 #include "DeviceManager.h"
 #include "SettingsView.h"
+#include "ProgressBar.h"
 
 #include <QtDebug>
 
-const int IDLE_TIME_MULTIPLIER = 60000; // Multiplies milliseconds to minutes
-
-WindowManager::WindowManager() :
+WindowManager::WindowManager( Configuration *aConfiguration ) :
                QObject(),
                iApplicationName( tr( "Qt Meetings" ) ),
+               iConfiguration( aConfiguration ),
                iWeeklyView( 0 ),
                iRoomStatusView( 0 ),
-               iMeetingInfo( 0 )
+               iMeetingInfo( 0 ),
+               iProgressBar( 0 ),
+               iPasswordDialog( 0 )
 {
-       iEngine = new Engine;
-       connect( iEngine, SIGNAL( initializationFailed() ), this, SLOT( closeApplication() ) );
-       connect( this, SIGNAL( roomStatusInfoNeeded( Room * ) ), iEngine, SLOT( roomStatusInfoNeeded( Room * ) ) );
-       connect( iEngine, SIGNAL( roomStatusChanged( Room *, Room::Status, QTime ) ), this, SLOT( roomStatusChanged( Room *, Room::Status, QTime ) ) );
-       connect( iEngine->clock(), SIGNAL( tick( QDateTime ) ), this, SLOT( distributeDateTimeInfo( QDateTime ) ) );
-       connect( iEngine, SIGNAL( error( QString ) ), this, SLOT( error( QString ) ) );
-       connect( iEngine->deviceManager(), SIGNAL( changeModeOrdered( DeviceManager::OperationMode ) ), this, SLOT( changeModeOrdered( DeviceManager::OperationMode ) ) );
-       
-       iWeeklyView = new WeeklyViewWidget( QDateTime::currentDateTime(), iEngine->configuration() );
+       iWeeklyView = new WeeklyViewWidget( QDateTime::currentDateTime(), aConfiguration );
        iWeeklyView->setWindowTitle( iApplicationName );
-       connect( iEngine, SIGNAL( meetingAdded( Meeting * ) ), iWeeklyView, SLOT( insertMeeting( Meeting * ) ) );
-       connect( iEngine, SIGNAL( meetingDeleted( Meeting * ) ), iWeeklyView, SLOT( deleteMeeting( Meeting * ) ) );
-       connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SLOT( observedEventDetected() ) );
-       connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting* ) ) );
-       connect( iEngine, SIGNAL( meetingDetailsFetched( Meeting* ) ), this, SLOT( showMeetingInfo( Meeting * ) ) );
-       connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iEngine, SLOT( currentRoomChanged( Room * ) ) );
-       connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( fetchMeetings( Room * ) ) );
-       // TODO: fetch meetings for specific week
-       connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), this, SLOT( fetchMeetings( QDate ) ) );
-
-       iIdleTimeCounter = new QTimer();
-       iIdleTimeCounter->setSingleShot( true );
-       iIdleTimeCounter->setInterval( IDLE_TIME_MULTIPLIER * iEngine->configuration()->displaySettings()->screensaver() );
-       iIdleTimeCounter->start();
-       connect( iIdleTimeCounter, SIGNAL( timeout() ), this, SLOT( showRoomStatus() ) );
-
-       if( iEngine->deviceManager()->currentOperationMode() == DeviceManager::KioskMode )
-               iWeeklyView->setWindowState( Qt::WindowFullScreen );
-       else
-               iWeeklyView->setWindowState( Qt::WindowMaximized );
+       connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
+       connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SIGNAL( meetingActivated( Meeting * ) ) );
+       connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );
+       connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );
+       
        showWeeklyView();
-
-       //QTimer::singleShot( 0, this, SLOT( closeApplication() ) );
+       
 }
 
 WindowManager::~WindowManager()
 {
-       if ( iWeeklyView != 0 )
-       {
-               delete iWeeklyView;
-               iWeeklyView = 0;
-       }
-
-       if ( iRoomStatusView != 0 )
-       {
-               delete iRoomStatusView;
-               iRoomStatusView = 0;
-       }
-
-       if ( iMeetingInfo != 0 )
-       {
-               delete iMeetingInfo;
-               iMeetingInfo = 0;
-       }
-
-       if ( iIdleTimeCounter )
-       {
-               iIdleTimeCounter->stop();
-               delete iIdleTimeCounter;
-               iIdleTimeCounter = 0;
-       }
-}
-
-void WindowManager::closeApplication()
-{
-       qDebug() << "WindowManager::closeApplication\tclose application";
-       // closes application after 1 second
-       QTimer::singleShot( 1000, QApplication::instance(), SLOT( quit() ) );
+       delete iWeeklyView;
+       iWeeklyView = 0;
+       delete iRoomStatusView;
+       iRoomStatusView = 0;
+       delete iMeetingInfo;
+       iMeetingInfo = 0;
+       delete iProgressBar;
+       iProgressBar = 0;
+       delete iPasswordDialog;
+       iPasswordDialog = 0;
 }
 
 void WindowManager::distributeDateTimeInfo( QDateTime aCurrentDateTime )
@@ -111,28 +66,19 @@ void WindowManager::distributeDateTimeInfo( QDateTime aCurrentDateTime )
 
 void WindowManager::roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime )
 {
-       // currently works only for default room
-       if ( aRoom->equals( *(iEngine->defaultRoom()) ) )
+       if ( iRoomStatusView == 0 )
        {
-               if ( iRoomStatusView == 0 )
-               {
-                       iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iEngine->configuration()->displaySettings()->timeFormat() );
-                       iRoomStatusView->setWindowTitle( iApplicationName );
-                       connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SLOT( observedEventDetected() ) );
-                       if( iEngine->deviceManager()->currentOperationMode() == DeviceManager::KioskMode )
-                               iRoomStatusView->setWindowState( Qt::WindowFullScreen );
-                       else
-                               iRoomStatusView->setWindowState( Qt::WindowMaximized );
-               }
-               else
-               {
-                       iRoomStatusView->statusChanged( aStatus, aTime );
-               }
-
-               if ( !iWeeklyView->isVisible() && !iRoomStatusView->isVisible() )
-               {
-                       showRoomStatus();
-               }
+               iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iConfiguration->displaySettings()->timeFormat() );
+               iRoomStatusView->setWindowTitle( iApplicationName );
+               connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
+       }
+       else
+       {
+               iRoomStatusView->statusChanged( aStatus, aTime );
+       }
+       if ( !iWeeklyView->isVisible() && !iRoomStatusView->isVisible() )
+       {
+               showRoomStatus();
        }
 }
 
@@ -142,7 +88,7 @@ void WindowManager::showRoomStatus()
 
        if ( iRoomStatusView == 0 )
        {
-               iEngine->roomStatusInfoNeeded( iWeeklyView->currentRoom() );
+               emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
        }
        else
        {
@@ -151,12 +97,6 @@ void WindowManager::showRoomStatus()
                {
                        iWeeklyView->hide();
                }
-               /* Causes SEGMENTATION FAULT
-               if ( iSettingsView->isVisible() )
-               {
-                       iSettingsView->hide();
-               }
-               */
        }
 
        // closing/deleting meeting info dialog
@@ -177,6 +117,22 @@ void WindowManager::showWeeklyView()
        iWeeklyView->show();
 }
 
+void WindowManager::fullScreen()
+{
+       iRoomStatusView->setWindowState( Qt::WindowFullScreen );
+       iWeeklyView->setWindowState( Qt::WindowFullScreen );
+}
+
+void WindowManager::insertMeeting( Meeting *aMeeting )
+{
+       iWeeklyView->insertMeeting( aMeeting );
+}
+
+void WindowManager::deleteMeeting( Meeting *aMeeting )
+{
+       iWeeklyView->deleteMeeting( aMeeting );
+}
+
 void WindowManager::showMeetingInfo( Meeting *aMeeting )
 {
        iMeetingInfo = new MeetingInfoDialog( aMeeting );
@@ -192,6 +148,11 @@ void WindowManager::showSettingsView()
        // TODO : give the Torspo for the person who was responsible to write this method
 }
 
+WeeklyViewWidget * WindowManager::weeklyView()
+{
+       return iWeeklyView;
+}
+
 void WindowManager::error( const QString &aErrorMessage )
 {
        qDebug() << "WindowManager::showErrorPopup";
@@ -199,74 +160,34 @@ void WindowManager::error( const QString &aErrorMessage )
        PopUpMessageBox::error( 0, aErrorMessage );
 }
 
-void WindowManager::observedEventDetected()
-{
-       // if event was detected on room status view
-       if ( iRoomStatusView != 0 && iRoomStatusView->isVisible() )
-       {
-               // show weekly view
-               showWeeklyView();
-       }
-       // otherwise
-       else
-       {
-               // prepare to restart idle counter
-               if ( iIdleTimeCounter->isActive() )
-               {
-                       iIdleTimeCounter->stop();
-               }
-       }
-       // (re)start idle counter
-       iIdleTimeCounter->start();
-}
-
-void WindowManager::fetchMeetings( Room * aRoom )
+void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
 {
-       QDateTime from( iWeeklyView->beginnigOfShownWeek() );
-       QDateTime to( from.addDays( 8 ) );
-       qDebug() << "WindowManager::fetchMeetings from " << from.toString( "d.m. h:mm" )
-       << " to " << to.toString( "d.m. h:mm" );
-       iEngine->fetchMeetings( from, to, aRoom );
+       iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
+       connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
+                       this, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+       iPasswordDialog->show();
 }
 
-void WindowManager::fetchMeetings( QDate aFrom )
+void WindowManager::closePasswordDialog()
 {
-       QDateTime from( aFrom );
-       QDateTime to( aFrom.addDays( 7 ), QTime( 23, 59 ) );
-       qDebug() << "WindowManager::fetchMeetings from " << from.toString( "d.m. h:mm" )
-       << " to " << to.toString( "d.m. h:mm" );
-       iEngine->fetchMeetings( from, to, iWeeklyView->currentRoom() );
+       iPasswordDialog->close();
+       delete iPasswordDialog;
+       iPasswordDialog = 0;
 }
 
-void WindowManager::changeModeOrdered( DeviceManager::OperationMode aMode )
+void WindowManager::showProgressBar( const QString &aText )
 {
-       QString message = tr( "You are about to change operation mode to %1." )
-                               .arg( iEngine->deviceManager()->operationModeToString( aMode ) );
-       PasswordDialog *dlg = PasswordDialog::query( 0, iEngine->configuration()->adminPassword(), message );
-       qDebug() << "WindowManager::changeModeOrdered/tpassword: " << iEngine->configuration()->adminPassword();
-       //TODO make this modal!!!
-       connect( dlg, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ),
-                  this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
+       qDebug() << "WindowManager::showProgressBar( const QString & )";
+       if( iProgressBar == 0 ) {
+               iProgressBar = new ProgressBar( aText );
+               iProgressBar->show();
+               connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
+       }
 }
 
-void WindowManager::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
+void WindowManager::closeProgressBar()
 {
-       switch ( aPasswordStatus )
-       {
-               case PasswordDialog::Correct :
-               {
-                       iEngine->deviceManager()->changeMode( true );
-                       break;
-               }
-               case PasswordDialog::Incorrect :
-               {
-                       error( tr( "Incorrect password." ) );
-                       iEngine->deviceManager()->changeMode( false );
-                       break;
-               }
-               default : //case PasswordDialog::Canceled
-               {
-                       iEngine->deviceManager()->changeMode( false );
-               }
-       }
+       iProgressBar->close();
+       delete iProgressBar;
+       iProgressBar = 0;
 }
index f1f72b5..6a56e77 100644 (file)
@@ -14,6 +14,8 @@ class WeeklyViewWidget;
 class Engine;\r
 class MeetingInfoDialog;\r
 class SettingsView;\r
+class ProgressBar;\r
+class Configuration;\r
 \r
 //! UserInterface class. Behaves as a proxy between the user interface and application's business logic.\r
 /*!\r
@@ -30,95 +32,149 @@ public:
        //! Constructor.\r
        /*!\r
         * Constructor of WindowManager.\r
+        * \param aConfiguration The pointer to configuration.\r
         */\r
-       WindowManager();\r
+       WindowManager( Configuration *aConfiguration );\r
        //! Destructor.\r
        virtual ~WindowManager();\r
-\r
-signals:\r
-       //! Request current status of the room.\r
-       /*!\r
-        * Signal is emitted when there is need to check current status of room aRoom.\r
-        * \param aRoom Meetingroom which status is requested.\r
-        */\r
-       void roomStatusInfoNeeded( Room *aRoom );\r
-\r
-private slots:\r
-       //! Closes the application.\r
-       void closeApplication();\r
-       //! Updates the time.\r
        /*!\r
-        * Forwards the signal of changed time to current view.\r
-        * \param aCurrentDateTime Current date and time.\r
+        * Displays an error message\r
+        * \param aErrorMessage Message to be displayd\r
         */\r
-       void distributeDateTimeInfo( QDateTime aCurrentDateTime );\r
+       void error( const QString &aErrorMessage );\r
        //! Updates the rooms status.\r
-       /*!\r
+       /*! \r
         * Forwards the signal of changed status to current view.\r
         * \param aRoom Room which status is changed.\r
         * \param aStatus Current status of room.\r
         * \param aTime Time when status is changed.\r
         */\r
        void roomStatusChanged( Room *aRoom, Room::Status aStatus, QTime aTime );\r
-       //! Displays the weekly view\r
+       //! Shows the password dialog.\r
+       /*!\r
+        * Shows the password dialog.\r
+        * \param aAdminPassword The correct password.\r
+        * \param aMessage The message to be shown in the password dialog.\r
+        */\r
+       void showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage );\r
+       //! Closes the password dialog.\r
+       /*!\r
+        * Closes the password dialog.\r
+        */\r
+       void closePasswordDialog();\r
+       //! Displays the weekly view.\r
+       /*!\r
+        * Displays the weekly view.\r
+        */\r
        void showWeeklyView();\r
-       //! Displays the screensaver (room status view)\r
-       void showRoomStatus();\r
-       //! Displays the settings view\r
-       void showSettingsView();\r
+       //! Displays the meeting info dialog.\r
        /*!\r
-        * Displays the meeting info dialog\r
+        * Displays the meeting info dialog. \r
         * \param aMeeting Meeting to be displayd\r
         */\r
        void showMeetingInfo( Meeting *aMeeting );\r
+       //! Returns the pointer to the weekly view. \r
        /*!\r
-        * Displays an error message\r
-        * \param aErrorMessage Message to be displayd\r
+        * Returns the pointer to the weekly view.\r
+        */\r
+       WeeklyViewWidget * weeklyView();\r
+       //! Switches the views to full screen.\r
+       /*!\r
+        * Switches the views to full screen.\r
+        */\r
+       void fullScreen();\r
+       //! Shows the progress bar.\r
+       /*!\r
+        * Starts showing the progress bar.\r
+        * \param aText The text to be shown in progress bar.\r
+        */\r
+       void showProgressBar( const QString &aText );\r
+       //! Closes the progress bar.\r
+       /*!\r
+        * Closes the progress bar.\r
+        */\r
+       void closeProgressBar();\r
+       \r
+       void insertMeeting( Meeting *aMeeting );\r
+       \r
+       void deleteMeeting( Meeting *aMeeting );\r
+\r
+signals:\r
+       //! Request current status of the room.\r
+       /*!\r
+        * Signal is emitted when there is need to check current status of room aRoom.\r
+        * \param aRoom Meetingroom which status is requested.\r
+        */\r
+       void roomStatusInfoNeeded( Room *aRoom );\r
+       //! Indicate that some user event has happened.\r
+       /*!\r
+        * Signal is emitted if some user event has happened.\r
         */\r
-       void error( const QString &aErrorMessage );\r
-       //! Restarts the timer to launch the screensaver.\r
        void observedEventDetected();\r
-       //! Slot for fetching meetings.\r
+       //! Meeting activated.\r
        /*!\r
-        * Slot. Fetches meetings for room aRoom for currently visible week\r
-        * \param aRoom\r
+        * Signal is emitted when a meeting is clicked by the user.\r
+        * \param aMeeting actived meeting.\r
         */\r
-       void fetchMeetings( Room *aRoom );\r
-       //! Slot for fetching meetings.\r
+       void meetingActivated( Meeting *aMeeting );\r
+       //! Signals if the shown week has been changed.\r
        /*!\r
-        * Slot. Fetches meetings for current room from date aFrom to week ahead.\r
-        * \param aFrom Date where to begin fetching\r
+        * Signal. Emitted if the shown week has been changed.\r
+        * \param aDate The first date of the shown week.\r
         */\r
-       void fetchMeetings( QDate aFrom );\r
-       //! Slot for popping up the confirmation dialog to change the current operation mode\r
+       void shownWeekChanged( QDate aDate );\r
+       //! Signals change of the meeting room.\r
        /*!\r
-        * Slot. Asks PopUpMessageBox to pop up a confirmation dialog.\r
-        * \param aMode The operation mode to be changed to\r
+        * Signal is emitted when meeting room is changed.\r
+        * \param aRoom Selected meeting room.\r
         */\r
-       void changeModeOrdered( DeviceManager::OperationMode aMode );\r
-       //! Slot for receiving the status of the entered password\r
+       void currentRoomChanged( Room *aRoom );\r
+       //! Signals when the password dialog buttons are clicked.\r
        /*!\r
-        * Slot. Receives the status of the entered password and makes the DeviceManager to change the\r
-        * operation mode if the password is correct.\r
+        * Signal is emitted when the password dialog buttons are clicked.\r
         * \param aPasswordStatus The status of the password.\r
         */\r
        void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );\r
+       //! Signals when the cancel button in the progress bar is clicked.\r
+       /*!\r
+        * Signal is emitted when the cancel button in the progress bar is clicked.\r
+        */\r
+       void progressBarCancelled();\r
+       \r
+public slots:\r
+       //! Slot for displaying the screensaver (room status view).\r
+       /*!\r
+        * Slot. Displays the screensaver.\r
+        */\r
+       void showRoomStatus();\r
+       //! Slot for updating the time.\r
+       /*!\r
+        * Slot. Forwards the signal of changed time to current view.\r
+        * \param aCurrentDateTime Current date and time.\r
+        */\r
+       void distributeDateTimeInfo( QDateTime aCurrentDateTime );\r
+       \r
+private slots:\r
+       //! Displays the settings view\r
+       void showSettingsView();\r
 \r
 private:\r
        //! Name of the application.\r
        QString iApplicationName;\r
+       //! Pointer to the configuration.\r
+       Configuration *iConfiguration;\r
        //! Pointer to the weekly view.\r
        WeeklyViewWidget *iWeeklyView;\r
        //! Pointer to the screensaver (room status view).\r
        RoomStatusIndicatorWidget *iRoomStatusView;\r
        //! Pointer to the meeting info dialog\r
        MeetingInfoDialog *iMeetingInfo;\r
-       //! Pointer to the engine.\r
-       Engine *iEngine;\r
-       //! Timer to launch the screensaver widget\r
-       QTimer *iIdleTimeCounter;\r
        //! Pointer to the settings view\r
        SettingsView *iSettingsView;\r
+       //! Pointer to the progress bar\r
+       ProgressBar *iProgressBar;\r
+       //! Pointer to the password dialog.\r
+       PasswordDialog *iPasswordDialog;\r
 \r
 };\r
 \r
index 9ed1c36..feaca6e 100644 (file)
@@ -2,7 +2,7 @@
 #include <fstream> \r
 #include <QApplication>\r
 #include <QTime>\r
-#include "WindowManager.h"\r
+#include "Engine.h"\r
 \r
 using namespace std;\r
 \r
@@ -31,11 +31,11 @@ void DebugOutputHandler( QtMsgType type, const char *msg ) {
 int main( int argc, char *argv[] )\r
 {\r
        #ifndef QT_NO_DEBUG_OUTPUT\r
-       logfile.open( "/tmp/qtmeetings.log", ios::app );\r
+       logfile.open( "/usr/var/qtmeetings.log", ios::app );\r
        qInstallMsgHandler( DebugOutputHandler );\r
        #endif\r
        \r
        QApplication app( argc, argv );\r
-       WindowManager *windowManager = new WindowManager;\r
+       Engine *engine = new Engine;\r
        return app.exec();\r
 }\r