void VideoControls::setPlayback(bool playing) { if (m_isPlaying != playing) { m_isPlaying = playing; if (m_isPlaying) { m_playButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPause)); } else { m_playButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay)); } m_nextButton->setEnabled(!m_isPlaying); m_prevButton->setEnabled(!m_isPlaying); m_frameSlider->setEnabled(!m_isPlaying); m_frameEdit->setEnabled(!m_isPlaying); playbackChanged(m_isPlaying); if (m_isPlaying) { playbackStarted(); } else { playbackPaused(); } } }
void Player::PlayOrPause() { //From pause to play if(_state==PLAYSTATE_STOPPED) { if(playFrame()==loopOut) setPlaybackFrame(loopIn); _state = PLAYSTATE_PLAYING; ui->playButton->setIcon(pauseIcon); timer.start((int)(1.0/fps()*1000.0)); emit playbackStarted(); } else //pause the playback { timer.stop(); _state = PLAYSTATE_STOPPED; ui->playButton->setIcon(playIcon); emit playbackPaused(); } }
CarPI::CarPI(QObject * parent): QObject(parent) { qDebug() << "CarPI: Starting"; _sourceCurrent = sourceUnknown; _sourcePaused = false; /* Kontroler płyty głównej urządzenia */ _mainboard = MainBoard::getInstance(); /* Emulator wyświetlacza radia */ _displayEmulator = DisplayEmulator::getInstance(); /* Emulator zmieniarki CD */ _changerEmulator = ChangerEmulator::getInstance(); /* Kontroler modułu bluetooth */ _bluetooth = Bluetooth::getInstance(); /* Odtwarzacz MP3 */ _mp3Player = MP3Player::getInstance(); /* Nawigacja */ _navit = Navit::getInstance(); /* Interfejs OBD II */ _elm327 = Elm327::getInstance(); _atmosphericPressure = 100; /* Zakładamy ciśnienie 1000hPa */ connect(_mainboard, SIGNAL(radioPowerChanged(bool)), _displayEmulator, SLOT(radioPowerChanged(bool))); connect(_mainboard, SIGNAL(keyStateChanged(int)), this, SLOT(_pilotKeyStateChanged(int))); connect(_mainboard, SIGNAL(ignitionChanged(bool)), this, SLOT(_ignitionStateChanged(bool))); connect(_mainboard, SIGNAL(shutdown()), this, SLOT(shutdown())); connect(_displayEmulator, SIGNAL(displayTextChanged(QString)), this, SLOT(_displayTextChanged(QString))); connect(_displayEmulator, SIGNAL(displayIconsChanged(int)), this, SLOT(_displayIconsChanged(int))); connect(_displayEmulator, SIGNAL(displayMenuShow(int)), this, SLOT(_displayMenuShow(int))); connect(_displayEmulator, SIGNAL(displayMenuHide()), this, SLOT(_displayMenuHide())); connect(_displayEmulator, SIGNAL(displayMenuItemUpdate(int,QString,bool)), this, SLOT(_displayMenuSetItem(int,QString,bool))); connect(this, SIGNAL(radioNewKeyEvent(int)), _displayEmulator, SLOT(sendKeyEvent(int))); connect(_bluetooth, SIGNAL(connectionStateChanged(bool)), this, SLOT(_bluetoothConnectionStateChanged(bool))); connect(_bluetooth, SIGNAL(callStateChanged(BluetoothCallState,QString)), this, SLOT(_bluetoothCallStateChanged(BluetoothCallState,QString))); connect(_changerEmulator, SIGNAL(playbackStarted()), _mp3Player, SLOT(play())); connect(_changerEmulator, SIGNAL(playbackPaused()), _mp3Player, SLOT(pause())); connect(_changerEmulator, SIGNAL(playbackStopped()), _mp3Player, SLOT(stop())); connect(_changerEmulator, SIGNAL(nextTrack()), _mp3Player, SLOT(nextTrack())); connect(_changerEmulator, SIGNAL(prevTrack()), _mp3Player, SLOT(prevTrack())); connect(_changerEmulator, SIGNAL(loadCD(int)), this, SLOT(_changerEmulatorLoadCD(int))); connect(_mp3Player, SIGNAL(textChanged(QString)), this, SLOT(_mp3PlayerTextChanged(QString))); connect(this, SIGNAL(mp3PlayerNextAlbum()), _mp3Player, SLOT(nextAlbum())); connect(this, SIGNAL(mp3PlayerPrevAlbum()), _mp3Player, SLOT(prevAlbum())); connect(this, SIGNAL(mp3PlayerSwitchDisplayMode()), _mp3Player, SLOT(switchDisplayMode())); connect(_elm327, SIGNAL(pidValueChanged(int,QVector<int>)), this, SLOT(_elm327PidChanged(int,QVector<int>))); connect(_elm327, SIGNAL(voltageChanged(double)), this, SLOT(_elm327VoltageChanged(double))); connect(this, SIGNAL(elm327addWatchPid(int)), _elm327, SLOT(addWatchPid(int))); connect(this, SIGNAL(elm327start()), _elm327, SLOT(start())); connect(this, SIGNAL(elm327stop()), _elm327, SLOT(stop())); _mainboard->readState(); emit elm327addWatchPid(0x05); /* Temperatura wody */ emit elm327addWatchPid(0x04); /* Obciążenie silnika */ emit elm327addWatchPid(0x0B); /* Ciśnienie absolutne w kolektorze dolotowym */ emit elm327addWatchPid(0x0F); /* Temperatura powietrza w dolocie */ emit elm327addWatchPid(0x23); /* Ciśnienie paliwa */ }