Element* Score::upAlt(Element* element) { Element* re = 0; if (element->type() == Element::REST) re = prevTrack(static_cast<Rest*>(element)); else if (element->type() == Element::NOTE) { Chord* chord = static_cast<Note*>(element)->chord(); const QList<Note*>& notes = chord->notes(); int idx = notes.indexOf(static_cast<Note*>(element)); if (idx < notes.size()-1) { ++idx; re = notes.value(idx); } else { re = prevTrack(chord); if (re->track() == chord->track()) re = element; } } if (re == 0) return 0; if (re->type() == Element::CHORD) re = static_cast<Chord*>(re)->notes().front(); return re; }
void MediaPlayer::chatKeyPressed(QKeyEvent *e, CustomInput *k, bool &handled) { Q_UNUSED(k) kdebugf(); if (handled) return; if (!m_configuration->deprecatedApi()->readBoolEntry("MediaPlayer", "chatShortcuts", true)) return; if (e->key() == SHORTCUT_KEY) winKeyPressed = true; // We want to handle LeftWinKey pressed state else if (!winKeyPressed) return; // If LeftWinKey isn't pressed then break function. if (!isActive()) return; handled = true; switch (e->key()) { case Qt::Key_Left: prevTrack(); break; case Qt::Key_Right: nextTrack(); break; case Qt::Key_Up: incrVolume(); break; case Qt::Key_Down: decrVolume(); break; case Qt::Key_Return: case Qt::Key_Enter: if (isPlaying()) pause(); else play(); break; case Qt::Key_Backspace: stop(); break; default: handled = false; } }
void squeezeLiteGui::setupInterfaceConnections(void) { DEBUGF("Initialize Interface Connections"); QQuickItem *v = rootObject(); // interface signals to application connect(v,SIGNAL(play(int)), this,SLOT(playState(int))); connect(v,SIGNAL(nextTrack()), this,SLOT(nextTrackClicked())); connect(v,SIGNAL(prevTrack()), this,SLOT(prevTrackClicked())); connect(v,SIGNAL(volUp()), this,SLOT(volUp())); connect(v,SIGNAL(volDown()), this,SLOT(volDown())); connect(v,SIGNAL(setVolume(int)), this,SLOT(setVolume(int))); connect(v,SIGNAL(controlClicked(QString)), this,SLOT(controlViewClicked(QString))); connect(v,SIGNAL(shuffle(int)), this,SLOT(shuffleState(int))); connect(v,SIGNAL(repeat(int)), this,SLOT(repeatState(int))); // connect(v,SIGNAL(playButtonClicked()),this,SLOT(playPauseToggle())); // application signals to interface connect(this,SIGNAL(playlistIndexChange(QVariant)), v, SLOT(setControlViewListIndex(QVariant))); connect(this,SIGNAL(updateAlbumCover(QVariant)), v,SLOT(updateAlbumCover(QVariant))); connect(this,SIGNAL(playStatus(QVariant)), v, SLOT(updatePlayMode(QVariant))); connect(this,SIGNAL(VolumeChange(QVariant)), v,SLOT(setMainVolume(QVariant))); connect(this,SIGNAL(songDuration(QVariant)), v,SLOT(setSongDuration(QVariant))); connect(this,SIGNAL(progress(QVariant)), v,SLOT(updateProgress(QVariant))); connect(m_playerInfo,SIGNAL(PlayingTime(QVariant,QVariant)), v,SLOT(setupSongTimes(QVariant,QVariant))); connect(m_playerInfo,SIGNAL(TimeText(QVariant)),v,SLOT(setTimeText(QVariant))); connect(m_playerInfo,SIGNAL(NewSong()),this,SLOT(NewSong())); connect(&m_tick,SIGNAL(timeout()),m_playerInfo,SLOT(tick())); m_tick.start(1000); /* * messages from device that need to be connected to slots void playlistIndexChange(QVariant newidx); void NewSong(int newPlayListIndex); void NewPlaylist(void); void Mute(bool); void VolumeChange(int); void ModeChange(QString); */ }
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 */ }