if ( iEngine == 0 ) return;
if ( iWindowManager == 0 ) return;
- qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
-
+ connect(iWindowManager, SIGNAL(showSettingsClicked()), this, SLOT(settingsViewRequest()));
+
createWeeklyView();
- createSettingsView();
createRoomStatusIndicator();
createPasswordDialog();
createProgressBar();
createMeetingInfoDialog();
-
- qDebug() << "[UIManager::ctor] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
}
UIManager::~UIManager()
iWindowManager->showView( iWeeklyView );
}
-void UIManager::showProgressBar( QString aText )
-{
- if ( iProgressBar != 0 )
- {
- iProgressBar->update( aText );
- iWindowManager->showDialog( iProgressBar );
- }
-}
-
// ===============================================
// INITIALIZE THE UIMANAGER
void UIManager::createWeeklyView()
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( showMeetingProgressBar( Meeting * ) ) );
// Connect signals to engine
+ connect( iWeeklyView, SIGNAL( refreshButtonClicked() ), iEngine, SLOT( updateRoomInfo() ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting * ) ) );
connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), iEngine, SLOT( shownWeekChanged( QDate ) ) );
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iEngine, SLOT( currentRoomChanged( Room * ) ) );
// Connect signals
connect( iSettingsView, SIGNAL( okClicked() ), this, SLOT( settingsOkClicked() ) );
+ connect( iSettingsView, SIGNAL( cancelClicked() ), this, SLOT( settingsCancelClicked() ) );
}
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(), iEngine->iConfiguration->displaySettings()->timeFormat() );
+ 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()
{
- iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), tr("UIManager::createPasswordDialog"), tr("UIManager::createPasswordDialog") );
-
+ iPasswordDialog = new PasswordDialog( iEngine->iConfiguration->adminPassword(), "", tr("Enter password") );
connect( iPasswordDialog, SIGNAL( passwordEntered( PasswordDialog::PasswordStatus ) ), this, SLOT( passwordEntered( PasswordDialog::PasswordStatus ) ) );
}
void UIManager::createProgressBar()
{
iProgressBar = new ProgressBar( tr("CHANGE THIS"), true );
-
// Connect to UIManager
connect( iProgressBar, SIGNAL( cancel() ), this, SLOT( progressBarCancelled() ) );
// Connect to Engine
// UIMANAGER SLOTS
void UIManager::settingsViewRequest()
{
+ createSettingsView();
+
// Show the settings view and stop the idle timer
- if ( iSettingsView != 0 )
- {
- iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
- iEngine->stopIdleTimeCounter();
- }
+ iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
+ iEngine->stopIdleTimeCounter();
}
void UIManager::settingsOkClicked()
if ( iWeeklyView != 0 )
{
iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
iEngine->startIdleTimeCounter();
+ currentRoomChanged(iWeeklyView->currentRoom());
}
}
}
}
-void UIManager::showMeetingProgressBar( Meeting *aMeeting )
+void UIManager::showMeetingProgressBar( Meeting */*aMeeting*/ )
{
if ( iProgressBar != 0 )
{
- iProgressBar->update( tr("Fetching meeting info...") );
+ iProgressBar->update( tr( "Fetching meeting info..." ), tr( "Please wait" ) );
+ iProgressBar->toggleCancellable( true );
iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
- iEngine->stopIdleTimeCounter();
}
}
if ( iProgressBar != 0 )
{
iProgressBar->close();
- iEngine->startIdleTimeCounter();
}
}
void UIManager::changeModeOrdered( DeviceManager::OperationMode aMode )
{
qDebug() << "[UIManager::changeModeOrdered] <Invoked>";
-
- QString message = tr( "You are about to change operation mode to %1." )
- .arg( iEngine->iDevice->operationModeToString( aMode ) );
if ( iPasswordDialog != 0 )
{
- // TODO : Set the new text for password dialog
+ QString text = tr( "You are about to change operation mode to %1." )
+ .arg( iEngine->iDevice->operationModeToString( aMode ) );
+ iPasswordDialog->update( text );
iWindowManager->showDialog( static_cast<QDialog *>( iPasswordDialog ) );
}
}
{
qDebug() << "UIManager::connectionLost()";
iWeeklyView->connectionLost();
- iSettingsView->connectionLost();
iRoomStatusIndicator->connectionLost();
}
{
qDebug() << "UIManager::connectionEstablished()";
iWeeklyView->connectionEstablished();
- iSettingsView->connectionEstablished();
iRoomStatusIndicator->connectionEstablished();
}
void UIManager::currentRoomChanged(Room *aRoom)
{
+ qDebug() << "[UIManager::currentRoomChanged] <Invoked>";
if ( iWeeklyView != 0 )
{
- QDateTime from = QDateTime( iWeeklyView->beginnigOfShownWeek() );
- QDateTime to = QDateTime( from.addDays( 8 ) );
- iEngine->fetchMeetings( from, to, aRoom );
+ QDateTime shown = QDateTime( iWeeklyView->beginnigOfShownWeek() );
+ iEngine->fetchMeetings( shown.date().weekNumber(), shown.date().year(), aRoom );
}
}
{
if ( iWeeklyView != 0 )
{
- iWeeklyView->setCurrentDateTime( aDateTime );
+ iWeeklyView->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
+ }
+ if ( iRoomStatusIndicator != 0 )
+ {
+ iRoomStatusIndicator->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
}
}
// Show the progress bar..
if ( iProgressBar != 0 )
{
- iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
+ iProgressBar->update( tr( "" ), tr( "Changing operation mode" ) );
+ iProgressBar->toggleCancellable( false );
+ iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false, false );
}
// ... and initiate the mode changing
- iEngine->changeDeviceMode( true );
+ iEngine->changeDeviceMode();
break;
case PasswordDialog::Incorrect:
iWindowManager->error( tr("Incorrect Password") );
+ break;
case PasswordDialog::Canceled:
- iEngine->changeDeviceMode( false );
break;
}
iProgressBar->close();
}
}
+
+void UIManager::settingsCancelClicked()
+{
+ // Show the weekly view and restart the idle timer
+ if ( iWeeklyView != 0 )
+ {
+ iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
+ iEngine->startIdleTimeCounter();
+ }
+}