#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
+const int IDLE_TIME_MULTIPLIER = 5000; // Multiplies milliseconds to minutes
// Macro to help deleting objects. This could be global.
#define QT_DELETE(X) \
( ( indexOfNextMeeting != -1 ) ? iMeetings.at( indexOfNextMeeting )->startsAt().time() : Engine::endOfTheDay );
//currently works only for deafult room
-// if( aRoom->equals( *(defaultRoom() ) ) )
-// iWindowManager->roomStatusChanged( aRoom, status, until );
-}
-
-/*
-void Engine::fetchMeetings()
-{
- qDebug() << "Engine::fetchMeetings for " << iCurrentRoom;
- QDateTime from( iWindowManager->weeklyView()->beginnigOfShownWeek() );
- QDateTime to( from.addDays( 7 ) );
- // fetchMeetings( from, to, iWindowManager->weeklyView()->currentRoom() );
- // Signal is connected to the currentRoomChanged slot which keeps the iCurrentRoom up to date
- fetchMeetings( from, to, iCurrentRoom );
+ if ( aRoom->equals( *(iCurrentRoom) ) )
+ {
+ emit roomStatusChanged( status, until );
+ }
}
-*/
void Engine::fetchMeetingDetails( Meeting *aMeeting )
{
qDebug() << "Engine::fetchMeetingDetails( Meeting* )";
-/* iWindowManager->showProgressBar(tr("Please Wait"), true);
- iWindowManager->updateProgressBar(tr("Fetching Meeting Details...") );
- connect(iWindowManager,
- SIGNAL( progressBarCancelled() ), this,
- SLOT( fetchMeetingDetailsCancelled() ));
- iCommunication->fetchMeetingDetails( *aMeeting); */
iCommunication->fetchMeetingDetails( *aMeeting );
}
connect( iWindowManager, SIGNAL( eventDetected() ), this, SLOT( handleViewEvent() ) );
connect( iWindowManager, SIGNAL( previousViewRestored() ), iUIManager, SLOT( previousViewRestored() ) );
// connect( iWindowManager, SIGNAL( dialogActivated() ), this, SLOT( dialogActivated() ) );
-// connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
+ connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) );
// Show the UI
iWindowManager->setWindowState( Qt::WindowMaximized );
//! BusinessLogic class. Contains all the business logic of the application.
/*!
- * BusinessLogic class. Contains all the business logic of the application. It is responsible
- * for connecting user interface to lower application layers (IO).
+ * BusinessLogic class. Contains all the business logic of the application. This class handles
+ * the logic of the application according received calls to the slots. This class also maintains
+ * the instances of managers, timers and its own set of meeting list. The managers handles
+ * their tasks in more detailed manner.
*/
class Engine : public QObject
{
signals:
+ void roomStatusChanged( Room::Status aStatus, QTime aUntil );
+
private slots:
//! Slot. Closes the application.
/*!
* \param aAddInfo Possible addition info.
*/
void errorHandler( int aCode, const QString &aAddInfo = "" );
- //! Slot. Fetches meetings from the server.
- /*!
- * Slot. Fetches meetings from the server. Parameters are hard coded: the meetings of the default
- * room from current and +/- 2 weeks are fetched.
- */
-// void fetchMeetings();
//! Slot. Saves fetched meetings to the current instance's local storage.
/*!
* Slot. Saves fetched meetings to the current instance's local storage. Meetings are soted in a
void UIManager::createRoomStatusIndicator()
{
- iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime(), iEngine->iConfiguration->displaySettings()->dateFormat() );
+ iRoomStatusIndicator = new RoomStatusIndicatorWidget( iEngine->defaultRoom(), Room::FreeStatus, QTime::currentTime().addSecs(100000000), iEngine->iConfiguration->displaySettings()->timeFormat() );
+
+ // Connect engine signals
+ connect( iEngine, SIGNAL( roomStatusChanged( Room::Status, QTime ) ), iRoomStatusIndicator, SLOT( statusChanged( Room::Status, QTime ) ) );
+ connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iRoomStatusIndicator, SLOT( currentRoomChanged( Room * ) ) );
}
void UIManager::createPasswordDialog()
{
iProgressBar->close(); // Close it in case it's visible
}
+ iEngine->stopIdleTimeCounter(); // Timer restarted when the dialog is dismissed.
MeetingInfoDialog *tmp = new MeetingInfoDialog( &aDetailedMeeting );
iWindowManager->showDialog( static_cast<QDialog *>( tmp ) );
+
// TODO : We should use the member variable and implement correctly the setMeeting() method !!!
// iMeetingInfo->setMeeting( &aDetailedMeeting );
// iWindowManager->showDialog( static_cast<QDialog *>( iMeetingInfo ) );
{
iWeeklyView->setCurrentDateTime( aDateTime );
}
+ if ( iRoomStatusIndicator != 0 )
+ {
+ iRoomStatusIndicator->setCurrentTime( aDateTime.time() );
+ }
}
void UIManager::passwordEntered( PasswordDialog::PasswordStatus aStatus )
RoomStatusIndicatorWidget::RoomStatusIndicatorWidget( Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent ) :\r
ViewBase( ViewBase::ObservedView, aParent ), iTimeFormat( aTimeFormat )\r
{\r
+ \r
QFont importantTextFont;\r
//importantTextFont.setBold( true );\r
importantTextFont.setPointSize( 20 );\r
}\r
setPalette( createPalette( aStatus ) );\r
}\r
+\r
+void RoomStatusIndicatorWidget::currentRoomChanged( Room *aRoom )\r
+{\r
+ iDefaultRoomLabel->setText( aRoom->name() );\r
+}\r
* \param aUntil The new time until the specified status is valid.\r
*/\r
void statusChanged( const Room::Status aStatus, const QTime aUntil );\r
+ //! Changed the current room.\r
+ /*!\r
+ * This slot is used to inform that current room is changed and it changes\r
+ * the room name label.\r
+ */\r
+ void currentRoomChanged( Room *aRoom );\r
\r
void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
\r