iWindowManager->showView( iWeeklyView );
}
-void UIManager::showProgressBar( QString aText )
-{
- if ( iProgressBar != 0 )
- {
- iProgressBar->update( aText );
- iWindowManager->showDialog( iProgressBar );
- }
-}
-
// ===============================================
// INITIALIZE THE UIMANAGER
void UIManager::createWeeklyView()
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 ) ) );
}
{
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();
}
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 ) );
}
}
// Show the progress bar..
if ( iProgressBar != 0 )
{
+ iProgressBar->update( tr( "" ), tr( "Changing operation mode" ) );
+ iProgressBar->toggleCancellable( false );
iWindowManager->showDialog( static_cast<QDialog *>( iProgressBar ), false );
}
// ... and initiate the mode changing
void connectDeviceManager( DeviceManager *aDeviceManager );
void connectCommunicationManager( CommunicationManager *aCommunicationManager );
void showMainView();
- void showProgressBar( QString aText );
signals:
iMode = EmptyMode;
iHWKeyListener = new HWKeyListener();
- handleKeyPresses( true );
+ connect( iHWKeyListener, SIGNAL( HWKeyFullScreenPressed() ), this, SLOT( HWKeyFullScreenPressed() ) );
+ //handleKeyPresses( true );
+ iIgnoreHWKeyPresses = false;
}
DeviceManager::OperationMode DeviceManager::currentOperationMode()
{
qDebug() << "void DeviceManager::changeMode()";
if( !aChange ) {
- handleKeyPresses( true );
+ //handleKeyPresses( true );
+ iIgnoreHWKeyPresses = false;
return;
}
iModeToggler = new OperationModeToggler( iMode, iSettings, iAlarmSender, iConfigurator, iDataStorage );
qDebug() << "DeviceManager::HWKeyFullScreenPressed()";
// no more key presses before this one is handled
- handleKeyPresses( false );
-
- OperationMode nextMode;
- switch ( iMode )
- {
- case KioskMode:
- nextMode = StandAloneMode;
- break;
- case StandAloneMode:
- nextMode = KioskMode;
- break;
- default:
- nextMode = EmptyMode;
- break;
+ //handleKeyPresses( false );
+ if( !iIgnoreHWKeyPresses ) {
+ iIgnoreHWKeyPresses = true;
+ OperationMode nextMode;
+ switch ( iMode )
+ {
+ case KioskMode:
+ nextMode = StandAloneMode;
+ break;
+ case StandAloneMode:
+ nextMode = KioskMode;
+ break;
+ default:
+ nextMode = EmptyMode;
+ break;
+ }
+ if ( nextMode != EmptyMode )
+ emit changeModeOrdered( nextMode );
+ else
+ iIgnoreHWKeyPresses = false;
}
- if ( nextMode != EmptyMode )
- emit changeModeOrdered( nextMode );
- else
- handleKeyPresses( true );
}
void DeviceManager::errorSender( DeviceManager::ErrorCode aErrorCode, const QString &aAddInfo )
}
//in case device restarting fails we just continue
- handleKeyPresses( true );
+ iIgnoreHWKeyPresses = false;
}
OperationMode iMode;
bool iSendErrorMessages;
+ bool iIgnoreHWKeyPresses;
};
bool HWKeyListener::eventFilter( QObject*, QEvent* e )
{
- if ( e->type() == QEvent::KeyPress )
+ if ( e->type() == QEvent::KeyRelease )
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>( e );
switch ( keyEvent->key() )
QVBoxLayout *layout = new QVBoxLayout;
- if ( !aText.isNull() )
- {
- QLabel *text = new QLabel( aText );
- layout->addWidget( text );
- layout->addStretch();
- }
+ iText = new QLabel( aText );
+ layout->addWidget( iText );
+ layout->addStretch();
iPasswordEdit = new QLineEdit;
iPasswordEdit->setEchoMode( QLineEdit::Password );
emit passwordEntered( PasswordDialog::Canceled );
}
+void PasswordDialog::update( const QString &aText )
+{
+ qDebug() << "PasswordDialog::update()";
+ iText->setText( aText );
+}
#include <QDialog>
class QLineEdit;
+class QLabel;
class QByteArray;
//! UserInterface class. Responsible for poping-up password query on the screen.
Incorrect, /*!< Incorrect password. */
Canceled
};
+
+ //! Constructor.
+ /*!
+ * Constructor to initialize a PasswordDialog instance.
+ * \param aParent The parent object.
+ * \param aPassword The password.
+ */
+ PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle = "", QWidget *aParent = 0 );
+ //! Destructor.
+ virtual ~PasswordDialog();
+ //! Updates the text of the password dialog label.
+ /*!
+ * Updates the text of the password dialog label.
+ * \param aText The text for the label.
+ */
+ void update( const QString &aText );
signals:
//! Signals the authenticity of the password when the uuser dismisses the dialog.
void okButtonPressed();
void cancelButtonPressed();
-public:
- //! Constructor.
- /*!
- * Constructor to initialize a PasswordDialog instance.
- * \param aParent The parent object.
- * \param aPassword The password.
- */
- PasswordDialog( const QString &aPassword, const QString &aText, const QString &aTitle = "", QWidget *aParent = 0 );
- //! Destructor.
- virtual ~PasswordDialog();
-
+private:
QLineEdit *iPasswordEdit;
+ QLabel *iText;
QByteArray iPasswordHash;
};
#include <QLabel>
#include <QtDebug>
-ProgressBar::ProgressBar( const QString &aText, bool aCancellable, QWidget *aParent ) :
+ProgressBar::ProgressBar( const QString &aTitle, bool aCancellable, QWidget *aParent ) :
QDialog( aParent )
{
qDebug() << "ProgressBar::ProgressBar( const QString &, bool, QWidget *)";
- setWindowTitle( aText );
+ setWindowTitle( aTitle );
setModal( true );
iProgress = new QProgressBar();
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() ) );
+
+ iButton = new QPushButton( tr( "Cancel" ) );
+ subLayout->addSpacing( 5 );
+ subLayout->addWidget( iButton );
+ connect( iButton, SIGNAL( pressed() ), this, SIGNAL( cancel() ) );
+ if( !aCancellable ) {
+ iButton->setVisible( false );
}
+
mainLayout->addLayout( subLayout );
mainLayout->setAlignment( Qt::AlignCenter );
setLayout( mainLayout );
qDebug() << "ProgressBar::~ProgressBar()";
}
-void ProgressBar::update( const QString &aMessage )
+void ProgressBar::update( const QString &aMessage, const QString &aTitle )
{
qDebug() << "ProgressBar::update( const QString & )";
iLabel->setText( aMessage );
+ if( aTitle != "" )
+ setWindowTitle( aTitle );
+}
+
+void ProgressBar::toggleCancellable( bool aEnable )
+{
+ if( aEnable )
+ iButton->setVisible( true );
+ else
+ iButton->setVisible( false );
}
class QProgressBar;
class QLabel;
+class QPushButton;
//! UserInterface class.
/*!
/*!
* Constructor to initialize the StatusWidget instance.
* \param aParent Parent object.
- * \param aText Title string to be set to the progress bar.
+ * \param aTitle Title string to be set to the progress bar.
*/
- ProgressBar( const QString &aText, bool aCancellable = false, QWidget *aParent = 0 );
+ ProgressBar( const QString &aTitle, bool aCancellable = false, QWidget *aParent = 0 );
//! Destructor.
virtual ~ProgressBar();
+ //! Updates the text fields of progress bar dialog.
+ /*!
+ * Updates the text fields of progress bar dialog.
+ * \param aMessage The text for the label of the dialog.
+ * \param aTitle Title string to be set to the progress bar.
+ */
+ void update( const QString &aMessage, const QString &aTitle = "" );
- void update( const QString &aMessage );
+ void toggleCancellable( bool aEnable );
signals:
//! Signal. Emitted if user presses cancel button.
private:
QProgressBar *iProgress;
QLabel *iLabel;
+ QPushButton *iButton;
};