From: Zoltan Papp Date: Mon, 1 Jun 2009 06:14:56 +0000 (+0300) Subject: Merge branch 'master' into dev_local X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=b50201458e621351445d5930fd98d2a33558fdad;hp=-c;p=qtmeetings Merge branch 'master' into dev_local Conflicts: src/BusinessLogic/UIManager.h --- b50201458e621351445d5930fd98d2a33558fdad diff --combined src/BusinessLogic/Engine.cpp index 3a5d24f,89fe7de..3ef75cb --- a/src/BusinessLogic/Engine.cpp +++ b/src/BusinessLogic/Engine.cpp @@@ -32,8 -32,6 +32,8 @@@ Engine::Engine() iWindowManager( 0 ), iUIManager( 0 ) { qDebug() << "Engine::Engine()"; + iCommunicationFailed = false; + iCurrentWeekFetched = false; initConfiguration(); initDevice(); @@@ -197,16 -195,8 +197,16 @@@ void Engine::fetchMeetingDetails( Meeti void Engine::meetingsFetched( const QList &aMeetings ) { qDebug() << "Engine::meetingsFetched( const QList & )"; - - for ( int i = 0; i < iMeetings.count(); ++i ) { + // TODO: should check if this week's meetings were fetched + if( iCommunicationFailed || !iCurrentWeekFetched ) + { + iCurrentWeekFetched = true; + iCommunicationFailed = false; + iUIManager->connectionEstablished(); + } + + for ( int i = 0; i < iMeetings.count(); ++i ) + { Meeting* m = iMeetings.takeAt( i ); delete m; } @@@ -222,11 -212,6 +222,11 @@@ void Engine::errorHandler( int aCode, const QString &aAddInfo ) { + if( aCode >= 100 && aCode < 150 ) + { + iCommunicationFailed = true; + if ( iUIManager != 0 ) iUIManager->connectionLost(); + } if ( iWindowManager != 0 ) { iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) ); @@@ -283,14 -268,17 +283,17 @@@ void Engine::initUserInterface( 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( dialogActivated() ), this, SLOT( dialogActivated() ) ); + // connect( iWindowManager, SIGNAL( dialogDeactivated() ), this, SLOT( dialogDeactivated() ) ); // Show the UI iWindowManager->setWindowState( Qt::WindowMaximized ); iWindowManager->show(); iUIManager->showMainView(); + // This triggers the meeting fetching + iUIManager->currentRoomChanged( this->iCurrentRoom ); + qDebug() << "[Engine::initUserInterface] "; } @@@ -384,5 -372,6 +387,6 @@@ void Engine::startIdleTimeCounter( void Engine::currentRoomChanged(Room *aRoom) { + qDebug() << "[Engine::currentRoomChanged] "; iCurrentRoom = aRoom; } diff --combined src/BusinessLogic/UIManager.cpp index a540f96,96251a1..1c8345b --- a/src/BusinessLogic/UIManager.cpp +++ b/src/BusinessLogic/UIManager.cpp @@@ -37,16 -37,12 +37,12 @@@ UIManager::UIManager( Engine *aEngine, if ( iEngine == 0 ) return; if ( iWindowManager == 0 ) return; - qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; - createWeeklyView(); createSettingsView(); createRoomStatusIndicator(); createPasswordDialog(); createProgressBar(); createMeetingInfoDialog(); - - qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"; } UIManager::~UIManager() @@@ -237,24 -233,9 +233,25 @@@ void UIManager::changeModeOrdered( Devi } } +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) { + qDebug() << "[UIManager::currentRoomChanged] "; if ( iWeeklyView != 0 ) { QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() ); diff --combined src/BusinessLogic/UIManager.h index 6721510,b2ef8e5..8d47f86 --- a/src/BusinessLogic/UIManager.h +++ b/src/BusinessLogic/UIManager.h @@@ -18,6 -18,15 +18,15 @@@ class MeetingInfoDialog class CommunicationManager; class QDateTime; + //! User Interface manager class. + /*! + * User Interface manager class that is responsible for handling + * UI actions. It creates the needed views and connects signals + * accordingly. All interactions with the UI is handled by this + * class. The Engine class handles the basic logic and does not + * know or care about the UI and this class does not know or care + * about the basic logic only UI related actions (signals, events etc.). + */ class UIManager : public QObject { Q_OBJECT @@@ -26,32 -35,78 +35,85 @@@ public UIManager( Engine *aEngine, WindowManager *aWindowManager ); virtual ~UIManager(); + //! Connects Device Managers signals. + /*! + * This method connects Device Managers signals directly to UI + * components or to it selft. + */ void connectDeviceManager( DeviceManager *aDeviceManager ); + //! Connects Communication Managers signals. + /*! + * This method connects Communication Managers signals directly to UI + * components or to it selft. + */ void connectCommunicationManager( CommunicationManager *aCommunicationManager ); + //! Shows the main view. + /*! + * Makes the main view visible trough WindowManager. + */ void showMainView(); + //! Shows the progress bar. + /*! + * Shows the progress bar with given text. + */ void showProgressBar( QString aText ); signals: public slots: + //! Handles setting view request. + /*! + * Handles request to show settings view. Makes the + * view visible and stops the idle time counter. + */ void settingsViewRequest(); + //! Handles setting views ok clicked. + /*! + * Handles the setting views Ok button clicked + * signal. Sets the weekly view visible and starts + * the idle time counter. + */ void settingsOkClicked(); + //! Handles room status indicator view request. + /*! + * Handles the request to show room status indicator + * view. Sets the view visible and stops the idle + * time counter. The WindowManager handles restoring + * what ever view was previously visible. + */ void roomStatusIndicatorRequested(); + //! Handles previousViewRestored signal. + /*! + * Handles the restoring of previous view. This is usually + * signaled by WindowManager when room status indicator + * view is being hidden. + */ void previousViewRestored(); + //! Handle change mode order. + /*! + * Handles change mode order. Displays the password query dialog + * and waits for its response. + */ void changeModeOrdered( DeviceManager::OperationMode aMode ); + //! Handles select room change. + /*! + * Handles the changing of currently select room. Engine is requested + * to start fetching new meetings for currently shown week. + */ + void currentRoomChanged( Room *aRoom ); + + //! Shows any view specific indicators for connection error + void connectionLost(); + + //! Removes any view specific indicators for connection error + void connectionEstablished(); + + private slots: void meetingsFetched( const QList &aMeetings ); void meetingDetailsFetched( Meeting &aDetailedMeeting ); - void currentRoomChanged( Room *aRoom ); void progressBarCancelled(); void updateTime( QDateTime aDateTime ); void passwordEntered( PasswordDialog::PasswordStatus aStatus ); diff --combined src/UserInterface/Views/RoomStatusIndicatorWidget.cpp index 60d9253,c903bc0..6573e28 --- a/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp +++ b/src/UserInterface/Views/RoomStatusIndicatorWidget.cpp @@@ -31,48 -31,28 +31,48 @@@ RoomStatusIndicatorWidget::RoomStatusIn iDefaultRoomLabel = ToolBox::createLabel( aDefaultRoom->name(), importantTextFont ); iDefaultRoomLabel->setAlignment( Qt::AlignHCenter ); iDefaultRoomLabel->setStyleSheet( "background-color: transparent" ); + iDefaultRoomLabel->setHidden( true ); + // is busy iStatusLabel = ToolBox::createLabel( tr( "is %1" ).arg( statusToText( aStatus ) ), importantTextFont ); iStatusLabel->setAlignment( Qt::AlignHCenter ); iStatusLabel->setStyleSheet( "background-color: transparent" ); + iStatusLabel->setHidden( true ); // until 13:22 iUntilTextLabel = ToolBox::createLabel( tr( "until %1" ).arg( aUntil.toString( iTimeFormat ) ), importantTextFont ); iUntilTextLabel->setAlignment( Qt::AlignHCenter ); iUntilTextLabel->setStyleSheet( "background-color: transparent" ); + iUntilTextLabel->setHidden( true ); + + // No connection to server note + qDebug() << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label"; + QFrame* connectionLabelFrame = new QFrame( this ); + iConnectionLabel = new QLabel( tr( "No connection to server" ), connectionLabelFrame ); + iConnectionLabel->setFont( importantTextFont ); + iConnectionLabel->setAlignment( Qt::AlignHCenter ); + iConnectionLabel->setWordWrap( true ); + iConnectionLabel->setStyleSheet( "background-color: transparent; color: red; text-decoration:blink; max-width: 250px" ); + connectionLabelFrame->setFixedSize( iConnectionLabel->sizeHint() ); + if( connectedOnce && !connectionError ) iConnectionLabel->setHidden( true ); + QVBoxLayout *topLayout = new QVBoxLayout; topLayout->addStretch(); topLayout->addWidget( iTimeDisplay ); + topLayout->addSpacing( 28 ); topLayout->addWidget( iDefaultRoomLabel ); topLayout->addWidget( iStatusLabel ); topLayout->addWidget( iUntilTextLabel ); + topLayout->addSpacing( 28 ); + topLayout->addWidget( connectionLabelFrame ); topLayout->addStretch(); QHBoxLayout *mainLayout = new QHBoxLayout; mainLayout->addLayout( topLayout ); mainLayout->addStretch(); - mainLayout->setMargin( 65 ); + //mainLayout->setMargin( 65 ); + mainLayout->setContentsMargins( 65, 65, 65, 0 ); setLayout( mainLayout ); statusChanged( aStatus, aUntil ); @@@ -138,24 -118,3 +138,26 @@@ void RoomStatusIndicatorWidget::statusC } setPalette( createPalette( aStatus ) ); } + +void RoomStatusIndicatorWidget::connectionEstablished() +{ ++ + if( !connectedOnce ) + { + // Just got the required meetings for the first time + qDebug() << "RoomStatusIndicatorWidget::connectionEstablished() first call"; + iDefaultRoomLabel->setHidden( false ); + iUntilTextLabel->setHidden( false ); + iStatusLabel->setHidden( false ); + } ++ else qDebug() << "RoomStatusIndicatorWidget::connectionEstablished()"; + ViewBase::connectionEstablished(); + iConnectionLabel->setHidden( true ); +} + +void RoomStatusIndicatorWidget::connectionLost() +{ + ViewBase::connectionLost(); + iConnectionLabel->setHidden( false ); +} + diff --combined src/UserInterface/Views/ViewBase.cpp index 902f177,24d6461..14c51aa --- a/src/UserInterface/Views/ViewBase.cpp +++ b/src/UserInterface/Views/ViewBase.cpp @@@ -12,7 -12,7 +12,8 @@@ ViewBase::ViewBase( ViewBase::ViewMode aMode, QWidget *aParent ) : QWidget( aParent ), iViewMode( aMode ) { -- ++ connectedOnce = false; ++ connectionError = false; } ViewBase::~ViewBase() @@@ -25,18 -25,6 +26,18 @@@ ViewBase::ViewMode ViewBase::viewMode( return iViewMode; } +void ViewBase::connectionEstablished() +{ + connectedOnce = true; + connectionError = false; +} + +void ViewBase::connectionLost() +{ + connectionError = true; +} + + bool ViewBase::event(QEvent *event) { switch( event->type() )