Engine::Engine() :
iClock( 0 ), iConfiguration( Configuration::instance() ), iCommunication( 0 )
{
+ qDebug() << "Engine::Engine()";
// if reading of configuration fails, signal that initialization failed
if ( iConfiguration == 0 )
{
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()) );
Engine::~Engine()
{
+ qDebug() << "Engine::~Engine()";
while ( !iMeetings.isEmpty() )
delete iMeetings.takeFirst();
iIdleTimeCounter->stop();
void Engine::observedEventDetected()
{
+ qDebug() << "Engine::observedEventDetected()";
iWindowManager->showWeeklyView();
// prepare to restart idle counter
if ( iIdleTimeCounter->isActive() )
Room* Engine::defaultRoom()
{
+ qDebug() << "Engine::defaultRoom()";
return iConfiguration->defaultRoom();
}
void Engine::checkStatusOfAllRooms()
{
+ qDebug() << "Engine::checkStatusOfAllRooms()";
// iterate trough on the rooms
for ( int i = 0; i < iConfiguration->rooms().count(); i++ )
{
int Engine::indexOfMeetingAt( Room *aRoom, QDateTime aAt )
{
+ qDebug() << "Engine::indexOfMeetingAt( Room *, QDateTime )";
for ( int i = 0; i < iMeetings.count(); i++ )
{
// exchange server ensures that there is only one meeting in a room at a specified time
int Engine::indexOfMeetingAfter( Room *aRoom, QDateTime aAfter )
{
+ qDebug() << "Engine::indexOfMeetingAfter( Room *, QDateTime )";
// seeks for the next meeting on the SAME DAY
int min = -1;
for ( int i = 0; i < iMeetings.count(); i++ )
void Engine::roomStatusInfoNeeded( Room *aRoom )
{
+ qDebug() << "Engine::roomStatusInfoNeeded( Room * )";
if ( aRoom == 0 )
{
return;
void Engine::fetchMeetingDetails( Meeting *aMeeting )
{
+ qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
iCommunication->fetchMeetingDetails( *aMeeting );
}
bool Engine::isMeetingInList( const QList<Meeting*> &aList, const Meeting *aMeeting )
{
+ qDebug() << "Engine::isMeetingInList( const QList<Meeting*> &, const Meeting * )";
for ( int i = 0; i < aList.count(); i++ )
{
if ( aMeeting->equals( *(aList.at( i )) ) )
void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
{
+ qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
// check if there is any new meeting in the list came from the server -> added
for ( int i = 0; i < aMeetings.count(); i++ )
{
void Engine::meetingDetailsFetched( Meeting &aDetailedMeeting )
{
+ qDebug() << "Engine::meetingDetailsFetched( Meeting & )";
iWindowManager->showMeetingInfo( &aDetailedMeeting );
}
void Engine::fetchMeetings( const QDateTime &aFrom, const QDateTime &aUntil, const Room *aIn )
{
- qDebug() << "Engine::fetchMeetings";
+ qDebug() << "Engine::fetchMeetings( const QDateTime &, const QDateTime &, const Room * )";
iCommunication->fetchMeetings( aFrom, aUntil, *aIn );
}
void Engine::shownWeekChanged( QDate aFrom )
{
+ qDebug() << "Engine::shownWeekChanged( QDate )";
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" );
}
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 ) );
case PasswordDialog::Correct :
{
iWindowManager->showProgressBar( "Changing current operation mode." );
+ connect( iWindowManager, SIGNAL( progressBarCancelled() ), this, SLOT( progressBarCancelled() ) );
+ connect( iDevice, SIGNAL( changingMode( const QString & ) ),
+ iWindowManager, SLOT( updateProgressBar( const QString & ) ) );
+ iDevice->changeMode( true );
break;
}
case PasswordDialog::Incorrect :
{
iWindowManager->error( tr( "Incorrect password." ) );
- iDevice->handleKeyPresses( true );
+ iDevice->changeMode( false );
break;
}
default : //case PasswordDialog::Canceled
{
- iDevice->handleKeyPresses( true );
+ iDevice->changeMode( false );
}
}
}
void Engine::progressBarCancelled()
{
+ qDebug() << "Engine::progressBarCancelled()";
//TODO: cancel the on-going event
iWindowManager->closeProgressBar();
- iDevice->handleKeyPresses( true );
+ iDevice->changeMode( false );
}
handleKeyPresses( true );
return;
}
-
+
switch ( iMode )
{
case EmptyMode:
case StandAloneMode:
// change to KioskMode
+ emit changingMode( "Changing to Kiosk mode" );
+ while( 1 );
// check if auto turn on/off functionality enabled and send turn on/off alarm events to alarm daemon
if ( iSettings->isPowersavingEnabled() )
* \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 aAddInfo Possible additional information.
*/
void error( int aCode, const QString &aAddInfo );
+
+ void changingMode( const QString &aMessage );
private slots:
//! Slot. Handles "full screen"-hardware key presses.
* \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;
#include "PasswordDialog.h"
+
#include <QLineEdit>
#include <QPushButton>
#include <QVBoxLayout>
layout->addSpacing( 5 );
layout->addLayout( buttonLayout );
- // Connect the buttons pressed signals to corresponding slots
+ // Connect the user action signals to corresponding slots
connect( buttonOK, SIGNAL( pressed() ), this, SLOT( okButtonPressed() ) );
connect( buttonCancel, SIGNAL( pressed() ), this, SLOT( cancelButtonPressed() ) );
#include "ProgressBar.h"
+#include "ObservedWidget.h"
#include <QProgressBar>
-#include <QBoxLayout>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
#include <QPushButton>
+#include <QLabel>
+#include <QtDebug>
-ProgressBar::ProgressBar( const QString &aText, QWidget *aParent ) :
+ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aParent ) :
QDialog( aParent )
{
+ qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
setWindowTitle( aText );
setModal( true );
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() ) );
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ iLabel = new QLabel();
+ mainLayout->addWidget( iLabel );
+ QHBoxLayout *subLayout = new QHBoxLayout;
+ subLayout->addWidget( iProgress );
+ if( aCancellable ) {
+ QPushButton *buttonCancel = new QPushButton( tr( "Cancel" ) );
+ subLayout->addSpacing( 5 );
+ subLayout->addWidget( buttonCancel );
+ connect( buttonCancel, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+ }
- setLayout( layout );
+ setLayout( mainLayout );
}
ProgressBar::~ProgressBar()
{
+ qDebug() << "ProgressBar::~ProgressBar()";
}
+
+void ProgressBar::update( const QString &aMessage )
+{
+ qDebug() << "ProgressBar::update( const QString & )";
+ iLabel->setText( aMessage );
+}
\ No newline at end of file
#include <QDialog>
class QProgressBar;
+class QLabel;
//! UserInterface class.
/*!
* \param aParent Parent object.
* \param aText Title string to be set to the progress bar.
*/
- ProgressBar( const QString &aText, QWidget *aParent = 0 );
+ ProgressBar( const QString &aText, bool aCancellable = false, QWidget *aParent = 0 );
//! Destructor.
virtual ~ProgressBar();
+
+ void update( const QString &aMessage );
signals:
//! Signal. Emitted if user presses cancel button.
private:
QProgressBar *iProgress;
+ QLabel *iLabel;
};
WindowManager::WindowManager( Configuration *aConfiguration ) :
QObject(),
iApplicationName( tr( "Qt Meetings" ) ),
+ iFullScreen( false ),
iConfiguration( aConfiguration ),
iWeeklyView( 0 ),
iRoomStatusView( 0 ),
{
iRoomStatusView = new RoomStatusIndicatorWidget( aRoom, aStatus, aTime, iConfiguration->displaySettings()->timeFormat() );
iRoomStatusView->setWindowTitle( iApplicationName );
+ if( iFullScreen )
+ iRoomStatusView->setWindowState( Qt::WindowFullScreen );
connect( iRoomStatusView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
}
else
void WindowManager::fullScreen()
{
- iRoomStatusView->setWindowState( Qt::WindowFullScreen );
- iWeeklyView->setWindowState( Qt::WindowFullScreen );
+ if ( iRoomStatusView != 0 )
+ iRoomStatusView->setWindowState( Qt::WindowFullScreen );
+ if ( iWeeklyView != 0 )
+ iWeeklyView->setWindowState( Qt::WindowFullScreen );
+ iFullScreen = true;
}
void WindowManager::insertMeeting( Meeting *aMeeting )
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()
iProgressBar->show();
connect( iProgressBar, SIGNAL( cancel() ), this, SIGNAL( progressBarCancelled() ) );
}
+
+ //TODO connect connect( iWeeklyView, SIGNAL( observedEventDetected() ), this, SIGNAL( observedEventDetected() ) );
}
void WindowManager::closeProgressBar()
{
+ qDebug() << "WindowManager::closeProgressBar()";
iProgressBar->close();
delete iProgressBar;
iProgressBar = 0;
}
+
+void WindowManager::updateProgressBar( const QString &aMessage )
+{
+ qDebug() << "WindowManager::updateProgressBar( const QString & )";
+ if( iProgressBar != 0 )
+ iProgressBar->update( aMessage );
+}
*/\r
void distributeDateTimeInfo( QDateTime aCurrentDateTime );\r
\r
+ void updateProgressBar( const QString &aMessage );\r
+ \r
private slots:\r
//! Displays the settings view\r
void showSettingsView();\r
private:\r
//! Name of the application.\r
QString iApplicationName;\r
+ //! Defines whether the views should be shown as full screen \r
+ bool iFullScreen;\r
//! Pointer to the configuration.\r
Configuration *iConfiguration;\r
//! Pointer to the weekly view.\r