//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void tCZoneModesModel::OnDataChanged() { bool modeChanged = false; for ( int row=0; row < rowCount(); ++row ) { QStandardItem* pItem = item( row ); if (pItem != 0) { bool ok; int index = pItem->data( INDEX_ROLE ).toInt( &ok ); if ( ok ) { tDigitalData state( tDataId( DATA_TYPE_SWITCH_STATE, index, DATA_ENGINE_CZONE_SELECTION ) ); Qt::CheckState checkState = Qt::Unchecked; if ( state.Value() > 0 ) { checkState = Qt::Checked; } Qt::CheckState oldCheckState = pItem->checkState(); pItem->setCheckState( checkState ); if ( oldCheckState != checkState ) { modeChanged = true; } } } } if ( modeChanged ) { emit ModeChanged(); } }
void Model::setMode(Mode mode) { if (m_mode == mode) return; m_mode = mode; QSettings s; s.setValue(Keys::mode, static_cast<int>(m_mode)); emit ModeChanged(mode); }
virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo ) { switch (event) { case eFE_Initialize: { m_actInfo = *pActInfo; CPlayer* pPlayer = GetPlayer(m_entityId); if (pPlayer) { CNanoSuit* pSuit = pPlayer->GetNanoSuit(); if(pSuit) { ModeChanged(pSuit->GetMode()); EnergyChanged(pSuit->GetSuitEnergy()); } } } break; case eFE_SetEntityId: { RemoveAsNanoSuitListener(); m_entityId = pActInfo->pEntity ? pActInfo->pEntity->GetId() : 0; AddAsNanoSuitListener(); } break; case eFE_Activate: { CPlayer* pPlayer = GetPlayer(m_entityId); if (pPlayer == 0) return; CNanoSuit* pSuit = pPlayer->GetNanoSuit(); if(!pSuit) return; if (IsPortActive(pActInfo, EIP_Cloak)) pSuit->SetMode(NANOMODE_CLOAK); else if (IsPortActive(pActInfo, EIP_Speed)) pSuit->SetMode(NANOMODE_SPEED); else if (IsPortActive(pActInfo, EIP_Strength)) pSuit->SetMode(NANOMODE_STRENGTH); else if (IsPortActive(pActInfo, EIP_Defense)) pSuit->SetMode(NANOMODE_DEFENSE); if (IsPortActive(pActInfo, EIP_Energy)) pSuit->SetSuitEnergy(GetPortFloat(pActInfo, EIP_Energy)); if (IsPortActive(pActInfo, EIP_CloakLevel)) pSuit->SetCloakLevel( (ENanoCloakMode) GetPortInt(pActInfo, EIP_CloakLevel)); } break; } }
//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- void tCZoneMainLayer::CreateModeItems() { m_pLoadingModesLabel->hide(); //Make sure this only happens once disconnect( &m_ModesModel, SIGNAL( Populated() ), this, SLOT( CreateModeItems() ) ); const int numberOfModes = m_ModesModel.rowCount(); if( numberOfModes > 0 ) { tAction* pMenuAction = CreateGridMenuAction( 0 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode1() ) ); } if( numberOfModes > 1 ) { tAction* pMenuAction = CreateGridMenuAction( 1 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode2() ) ); } if( numberOfModes > 2 ) { tAction* pMenuAction = CreateGridMenuAction( 2 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode3() ) ); } if( numberOfModes > 3 ) { tAction* pMenuAction = CreateGridMenuAction( 3 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode4() ) ); } if ( numberOfModes > 4 ) { tAction* pMenuAction = CreateGridMenuAction( 4 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode5() ) ); } if ( numberOfModes == 6 ) { tAction* pMenuAction = CreateGridMenuAction( 5 ); m_pGrid->AddAction( pMenuAction, false ); Connect( pMenuAction, SIGNAL( triggered() ), this, SLOT( OnMode6() ) ); } if ( numberOfModes > 6 ) //The More Modes item { // If there is a current mode and it's one of the more items then highlight the more button tAction* pAction = new tAction( this ); pAction->setText( QString( tr( "More Modes" ) + "..." ) ); pAction->setIcon( style()->standardIcon( NIT( tNOSStyle::NIT_CZoneMode ) ) ); m_pGrid->AddAction( pAction, false ); Connect( pAction, SIGNAL( triggered() ), this, SIGNAL( MoreModes() ) ); } OnModeChanged(); Connect( &m_ModesModel, SIGNAL( ModeChanged() ), this, SLOT( OnModeChanged() ) ); }
void Controllingroomba::on_pbStop_clicked() { emit ModeChanged(MODESTOPPED); }
void Controllingroomba::on_pbDock_clicked() { emit ModeChanged(MODEDOCK); }
void Controllingroomba::on_pbCleanSpot_clicked() { emit ModeChanged(MODECLEANONSPOT); }
void Controllingroomba::on_pbClean_clicked() { emit ModeChanged(MODECLEAN); }
// Constructor MakeRT::MakeRT(QWidget *parent): QWidget(parent), _ui(new Ui::MakeRT), _audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)), _player(new Phonon::MediaObject(this)), _timer(new QTimer(this)), _settings(new QSettings(this)), _textNotificationWidget(new TextNotificationWidget(this)), _soundNotificationWidget(new SoundNotificationWidget(this, _player)), _timerSettingsWidget(new TimerSettingsWidget(this)), _messageBox(new QMessageBox(QMessageBox::Information, tr("Make reality test!"), "", QMessageBox::Ok, this)) #ifndef Q_OS_SYMBIAN , _trayIcon(new QSystemTrayIcon(QIcon(":/icon.png"), this)) #else , _textNotificationAction(new QAction(tr("Text notifications"), this)), _soundNotificationAction(new QAction(tr("Sound notification"), this)), _timerSettingsAction(new QAction(tr("Timer settings"), this)), _vibrationsMenu(new QMenu(tr("Vibrations"), this)), _vibrationsOnAction(new QAction(tr("On"), this)), _vibrationsOffAction(new QAction(tr("Off"), this)), _aboutQtAction(new QAction(tr("About Qt4"), this)), _quitAction(new QAction(tr("Quit"), this)), _menu(new QMenu(this)), _menuAction(new QAction(tr("Menu"), this)), _hideAction(new QAction(tr("Hide"), this)) #endif // Q_OS_SYMBIAN { if (!_instance) _instance = this; else return; _ui->setupUi(this); #ifdef Q_OS_SYMBIAN _vibrator = CHWRMVibra::NewL(); _vibrationsOnAction->setCheckable(true); //_vibrationsOnAction->setChecked(true); _vibrationsOffAction->setCheckable(true); QActionGroup *group = new QActionGroup(this); group->addAction(_vibrationsOnAction); group->addAction(_vibrationsOffAction); _vibrationsMenu->addActions(group->actions()); addAction(_menuAction); addAction(_hideAction); _menu->addAction(_textNotificationAction); _menu->addAction(_soundNotificationAction); _menu->addAction(_timerSettingsAction); _menu->addMenu(_vibrationsMenu); _menu->addAction(_aboutQtAction); _menu->addAction(_quitAction); _menuAction->setMenu(_menu); _menuAction->setSoftKeyRole(QAction::PositiveSoftKey); _hideAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(_textNotificationAction, SIGNAL(triggered()), _textNotificationWidget, SLOT(showMaximized())); connect(_soundNotificationAction, SIGNAL(triggered()), _soundNotificationWidget, SLOT(showMaximized())); connect(_timerSettingsAction, SIGNAL(triggered()), _timerSettingsWidget, SLOT(showMaximized())); connect(_vibrationsOnAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled())); connect(_vibrationsOffAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled())); connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(_quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(_hideAction, SIGNAL(triggered()), this, SLOT(lower())); _ui->about->setFocus(); #else _ui->tabWidget->addTab(_textNotificationWidget, tr("Text notifications settings")); _ui->tabWidget->addTab(_soundNotificationWidget, tr("Sound notification settigns")); _ui->tabWidget->addTab(_timerSettingsWidget, tr("Timer settings")); connect(_ui->quit, SIGNAL(clicked()), qApp, SLOT(quit())); connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(TrayIconClicked())); connect(_ui->startup, SIGNAL(toggled(bool)), this, SLOT(RunAtStartupEnabled(bool))); connect(_ui->tray, SIGNAL(toggled(bool)), this, SLOT(RunInTrayEnabled(bool))); _trayIcon->show(); #endif // Q_OS_SYMBIAN connect(_textNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(TextMessageActivationChanged(bool))); connect(_textNotificationWidget, SIGNAL(TextMessageChanged(QString)), this, SLOT(TextMessageChanged(QString))); connect(_textNotificationWidget, SIGNAL(MessageListChanged(QStringList&)), this, SLOT(MessageListChanged(QStringList&))); connect(_textNotificationWidget, SIGNAL(ModeChanged(TextNotificationWidget::Mode)), this, SLOT(TextMessageModeChanged(TextNotificationWidget::Mode))); connect(_soundNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(SoundNotificationActivationChanged(bool))); connect(_soundNotificationWidget, SIGNAL(FileNameChanged(QString)), this, SLOT(AudioFileNameChanged(QString))); connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(TimerModeChanged(TimerSettingsWidget::Mode))); connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(FixedIntervalChanged(int))); connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(RandomIntervalChanged(int,int))); connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(SetTimer())); connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(SetTimer())); connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(SetTimer())); connect(_audioOutput, SIGNAL(volumeChanged(qreal)), this, SLOT(VolumeChanged(qreal))); connect(_timer, SIGNAL(timeout()), this, SLOT(Alarm())); Phonon::createPath(_player, _audioOutput); SetTimer(); _soundNotificationWidget->SetAudioOutput(_audioOutput); #ifndef Q_OS_SYMBIAN _trayIcon->show(); #endif // Q_OS_SYMBIAN LoadSettings(); _ui->about->setHtml(tr("<b>MakeRT</b> is a simple application dedicated to a newbie lucid dreamers (<a href=\"http://en.wikipedia.org/wiki/Lucid_dream\">http://en.wikipedia.org/wiki/Lucid_dream</a>). It helps to reach a lucid dream by forming a habit of making reality checks.<br><br>\n" "<b>Features:</b>\n" "<ul><li>text notifications (single or randomly selected from list)\n" "<li>sound notification (by plaing audio file)\n" "<li>vibrations (only on Symbian)\n" "<li>fixed or random interval between following notifications</ul><br><br>\n" "<a href=\"mailto:[email protected]\">[email protected]</a>")); this->adjustSize(); this->setWindowIcon(QIcon(":/icon.png")); this->setWindowTitle(QString("MakeRT v.") + qApp->applicationVersion()); }
// ModeChange void TextNotificationWidget::ModeChange() { emit ModeChanged(GetMode()); }