TEMPLATE = app
-
TARGET = qtmeetings
-
QT += xml \
network
-
INCLUDEPATH += src/Domain/ \
src/Domain/Configuration/ \
src/IO/ \
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 \
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 \
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]" )
rm /usr/var/qtmeetings.txt
fi
+if [ -e /usr/var/qtmeetings.log ]; then
+ rm /usr/var/qtmeetings.log
+fi
+
exit 0
#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 ) ) );
+
// 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 );
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() ) );
{
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()
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...
// ...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 )
Meeting* m = new Meeting( *(aMeetings.at( i )) );
iMeetings.append( m );
// and signal the changes
- emit meetingAdded( m );
+ iWindowManager->insertMeeting( m );
}
}
{
Meeting* m = iMeetings.takeAt( i );
// signal the changes
- emit meetingDeleted( m );
+ iWindowManager->deleteMeeting( m );
// delete the meeting from the local list
delete m;
}
void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting )
{
- emit meetingDetailsFetched( &aDetailedMeeting );
+ iWindowManager->showMeetingInfo( &aDetailedMeeting );
}
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 );
}
#include <QObject>
#include <QDateTime>
#include "Room.h"
+#include "WindowManager.h"
class QTimer;
class Clock;
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
* 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 );
private:
//! Provides the index of the Meeting instance which is at the specified time.
/*!
* \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;
QTimer *iAutoRefresh;
QList<Meeting*> iMeetings;
-
- Room *iCurrentRoom; /*! Not owned */
};
#endif /*ENGINE_H_*/
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() )
#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 );
// Enable the layout
setLayout( layout );
+
+ show();
}
PasswordDialog::~PasswordDialog()
{
+ close();
}
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() )
{
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 );
}
* \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.
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();
#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 )
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();
}
}
if ( iRoomStatusView == 0 )
{
- iEngine->roomStatusInfoNeeded( iWeeklyView->currentRoom() );
+ emit roomStatusInfoNeeded( iWeeklyView->currentRoom() );
}
else
{
{
iWeeklyView->hide();
}
- /* Causes SEGMENTATION FAULT
- if ( iSettingsView->isVisible() )
- {
- iSettingsView->hide();
- }
- */
}
// closing/deleting meeting info dialog
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 );
// TODO : give the Torspo for the person who was responsible to write this method
}
-void WindowManager::error( const QString &aErrorMessage )
-{
- qDebug() << "WindowManager::showErrorPopup";
-
- 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 )
+WeeklyViewWidget * WindowManager::weeklyView()
{
- 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 );
+ return iWeeklyView;
}
-void WindowManager::fetchMeetings( QDate aFrom )
+void WindowManager::error( const QString &aErrorMessage )
{
- 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() );
-}
+ qDebug() << "WindowManager::showErrorPopup";
-void WindowManager::changeModeOrdered( DeviceManager::OperationMode aMode )
-{
- 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 ) ) );
+ PopUpMessageBox::error( 0, aErrorMessage );
}
void WindowManager::passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus )
{
+ delete iPasswordDialog;
+ iPasswordDialog = 0;
+
switch ( aPasswordStatus )
{
case PasswordDialog::Correct :
{
- iEngine->deviceManager()->changeMode( true );
+ progressBar( tr( "Changing operation mode" ), true );
+ iProgressBar->show();
+ while(1);
break;
}
case PasswordDialog::Incorrect :
{
error( tr( "Incorrect password." ) );
- iEngine->deviceManager()->changeMode( false );
break;
}
default : //case PasswordDialog::Canceled
{
- iEngine->deviceManager()->changeMode( false );
}
}
}
+
+void WindowManager::showPasswordDialog( QByteArray aAdminPassword, const QString &aMessage )
+{
+ iPasswordDialog = new PasswordDialog( aAdminPassword, aMessage );
+ iPasswordDialog->show();
+}
+
+
+void WindowManager::progressBar( const QString &aText, bool aStart )
+{
+ qDebug() << "WindowManager::progressBar( const QString &, bool)";
+ if( aStart ) {
+ if( iProgressBar == 0 ) {
+ iProgressBar = new ProgressBar( aText );
+ connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBar() ) );
+ connect( iProgressBar, SIGNAL( started() ), this, SLOT( changeMode() ) );
+ }
+ }
+ else {
+ if( iProgressBar != 0 ) {
+ delete iProgressBar;
+ iProgressBar = 0;
+ }
+ }
+}
+
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
//! 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
+ //! 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
+ \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
+ void currentRoomChanged( Room *aRoom );\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
//! Slot for receiving the status of the entered password\r
/*!\r
* Slot. Receives the status of the entered password and makes the DeviceManager to change the\r
* \param aPasswordStatus The status of the password.\r
*/\r
void passwordEntered( PasswordDialog::PasswordStatus aPasswordStatus );\r
+ //! Slot for showing/hiding the progress bar.\r
+ /*!\r
+ * Slot. Starts showing or hides the progress bar.\r
+ * \param aText The text to be shown in progress bar.\r
+ * \param aStart to indicate whether the progress bar is wanted to shown or hidden\r
+ */\r
+ void progressBar( const QString &aText = "", bool aStart = false );\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
#include <fstream> \r
#include <QApplication>\r
#include <QTime>\r
-#include "WindowManager.h"\r
+#include "Engine.h"\r
\r
using namespace std;\r
\r
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