{
qDebug() << "Engine::Engine()";
iCommunicationFailed = false;
+ iCurrentWeekFetched = false;
initConfiguration();
initDevice();
void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
{
qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
- if( iCommunicationFailed )
+ // TODO: should check if this week's meetings were fetched
+ if( iCommunicationFailed || !iCurrentWeekFetched )
{
+ iCurrentWeekFetched = true;
iCommunicationFailed = false;
- iWindowManager->connectionEstablished();
+ iUIManager->connectionEstablished();
}
for ( int i = 0; i < iMeetings.count(); ++i )
if( aCode >= 100 && aCode < 150 )
{
iCommunicationFailed = true;
- //TODO: Call window manager
- //if ( iWindowManager != 0 ) iWindowManager->connectionLost();
+ if ( iUIManager != 0 ) iUIManager->connectionLost();
}
if ( iWindowManager != 0 )
{
void Engine::changeDeviceMode( bool aChange )
{
if ( aChange )
- }
{
connect( iDevice, SIGNAL( changingModeFailed() ), this, SLOT( changeModeFailed() ) );
iAutoRefresh->stop(); // Stop the meeting update
Room *iCurrentRoom;
bool iCommunicationFailed;
+ bool iCurrentWeekFetched;
};
#endif /*ENGINE_H_*/
}
}
+void UIManager::connectionLost()
+{
+ qDebug() << "UIManager::connectionLost()";
+ iWeeklyView->connectionLost();
+ iSettingsView->connectionLost();
+ iRoomStatusIndicator->connectionLost();
+}
+
+void UIManager::connectionEstablished()
+{
+ qDebug() << "UIManager::connectionEstablished()";
+ iWeeklyView->connectionEstablished();
+ iSettingsView->connectionEstablished();
+ iRoomStatusIndicator->connectionEstablished();
+}
+
void UIManager::currentRoomChanged(Room *aRoom)
{
if ( iWeeklyView != 0 )
void roomStatusIndicatorRequested();
void previousViewRestored();
void changeModeOrdered( DeviceManager::OperationMode aMode );
+
+ //! Shows any view specific indicators for connection error
+ void connectionLost();
+
+ //! Removes any view specific indicators for connection error
+ void connectionEstablished();
private slots:
iDefaultRoomLabel = ToolBox::createLabel( aDefaultRoom->name(), importantTextFont );\r
iDefaultRoomLabel->setAlignment( Qt::AlignHCenter );\r
iDefaultRoomLabel->setStyleSheet( "background-color: transparent" );\r
+ iDefaultRoomLabel->setHidden( true );\r
+ \r
// is busy\r
iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont );\r
iStatusLabel->setAlignment( Qt::AlignHCenter );\r
iStatusLabel->setStyleSheet( "background-color: transparent" );\r
+ iStatusLabel->setHidden( true );\r
\r
// until 13:22\r
iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont );\r
iUntilTextLabel->setAlignment( Qt::AlignHCenter );\r
iUntilTextLabel->setStyleSheet( "background-color: transparent" );\r
+ iUntilTextLabel->setHidden( true );\r
\r
// No connection to server note\r
qDebug() << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label";\r
iConnectionLabel->setWordWrap( true );\r
iConnectionLabel->setStyleSheet( "background-color: transparent; color: red; text-decoration:blink; max-width: 250px" );\r
connectionLabelFrame->setFixedSize( iConnectionLabel->sizeHint() );\r
- //iConnectionLabel->setHidden( true );\r
+ if( connectedOnce && !connectionError ) iConnectionLabel->setHidden( true );\r
+ \r
\r
QVBoxLayout *topLayout = new QVBoxLayout;\r
topLayout->addStretch();\r
}\r
setPalette( createPalette( aStatus ) );\r
}\r
+\r
+void RoomStatusIndicatorWidget::connectionEstablished()\r
+{\r
+ if( !connectedOnce )\r
+ {\r
+ // Just got the required meetings for the first time\r
+ qDebug() << "RoomStatusIndicatorWidget::connectionEstablished() first call";\r
+ iDefaultRoomLabel->setHidden( false );\r
+ iUntilTextLabel->setHidden( false );\r
+ iStatusLabel->setHidden( false );\r
+ }\r
+ ViewBase::connectionEstablished();\r
+ iConnectionLabel->setHidden( true );\r
+}\r
+\r
+void RoomStatusIndicatorWidget::connectionLost()\r
+{\r
+ ViewBase::connectionLost();\r
+ iConnectionLabel->setHidden( false );\r
+}\r
+\r
\r
void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
\r
+ void connectionEstablished();\r
+ \r
+ void connectionLost();\r
+ \r
private:\r
//! Translates the status into human readable text.\r
/*!\r
return iViewMode;
}
+void ViewBase::connectionEstablished()
+{
+ connectedOnce = true;
+ connectionError = false;
+}
+
+void ViewBase::connectionLost()
+{
+ connectionError = true;
+}
+
+
bool ViewBase::event(QEvent *event)
{
switch( event->type() )
*/
virtual void viewResized(const QSize &newSize, const QSize &oldSize) = 0;
+ void connectionEstablished();
+
+ void connectionLost();
+
signals:
/*!
* This signal indicates that some user initiated event has occured.
protected:
void observeChild(QWidget *aChild);
+ bool connectionError; // true if last connection attempt failed
+ // TODO: connectedOnce should actually indicate if the current week has been fetched at least once
+ bool connectedOnce; // true if connection has been formed at least once
private:
ViewMode iViewMode;
-
};
#endif /*VIEWBASE_*/
this->setWindowState( Qt::WindowFullScreen );
// Resize event handles the rest.
}
-
-void WindowManager::connectionLost()
-{
- //TODO: Inform all views
- qDebug() << "WindowManager::connectionLost()";
-}
-
-void WindowManager::connectionEstablished()
-{
- //TODO: Inform all views
- qDebug() << "WindowManager::connectionEstablished()";
-}
-
virtual bool event(QEvent *event);
-
- //! Shows any view specific indicators for connection error
- void connectionLost();
-
- //! Removes any view specific indicators for connection error
- void connectionEstablished();
-
signals:
//! Request current status of the room.
/*!