bool VCSlider::copyFrom(VCWidget* widget) { VCSlider* slider = qobject_cast<VCSlider*> (widget); if (slider == NULL) return false; /* Copy level stuff */ setLevelLowLimit(slider->levelLowLimit()); setLevelHighLimit(slider->levelHighLimit()); m_levelChannels = slider->m_levelChannels; /* Copy bus stuff */ setBusLowLimit(slider->busLowLimit()); setBusHighLimit(slider->busHighLimit()); setBus(slider->bus()); /* Copy slider appearance */ setValueDisplayStyle(slider->valueDisplayStyle()); setInvertedAppearance(slider->invertedAppearance()); /* Copy mode & current value */ setSliderMode(slider->sliderMode()); setSliderValue(slider->sliderValue()); /* Copy common stuff */ return VCWidget::copyFrom(widget); }
void VCSlider::setSliderMode(SliderMode mode) { Q_ASSERT(mode >= Bus && mode <= Submaster); /* Disconnect these to prevent double callbacks and non-essential signals (with Level & Submaster modes) */ disconnect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); disconnect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); m_sliderMode = mode; if (mode == Bus) { /* Set the slider range */ m_slider->setRange(busLowLimit() * KFrequency, busHighLimit() * KFrequency); setSliderValue(busLowLimit() * KFrequency); /* Reconnect to bus emitter */ connect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); connect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); m_bottomLabel->hide(); m_tapButton->show(); m_time->start(); }
//知道了现在是在播放音乐,所以要修改相应的按钮图标 void Widget::currentIsPlaying(bool playingBool) { playBool = playingBool; if(playBool) { playerBtn->setIcon(QPixmap(":/images/playerIcon2.png")); //playBool = false; } else { playerBtn->setIcon(QPixmap(":/images/playerIcon.png")); //playBool = true; } //测试用,看在这里能够修改间隔时间 mainMusic->player->setNotifyInterval(10); //是时间条的滑块也相应地变化 connect(mainMusic->player, SIGNAL(positionChanged(qint64)), this, SLOT(setSliderValue(qint64))); //还得关联上歌词的滚动显示 connect(mainMusic->player, SIGNAL(positionChanged(qint64)), secFrameLayout->lyricWidget, SLOT(lyricScroll(qint64))); }
const std::string& LLMultiSlider::addSlider(F32 val) { std::stringstream newName; F32 initVal = val; if(mValue.size() >= mMaxNumSliders) { return LLStringUtil::null; } // create a new name newName << "sldr" << mNameCounter; mNameCounter++; bool foundOne = findUnusedValue(initVal); if(!foundOne) { return LLStringUtil::null; } // add a new thumb rect mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); // add the value and set the current slider to this one mValue.insert(newName.str(), initVal); mCurSlider = newName.str(); // move the slider setSliderValue(mCurSlider, initVal, TRUE); return mCurSlider; }
bool VCSlider::copyFrom(const VCWidget* widget) { const VCSlider* slider = qobject_cast<const VCSlider*> (widget); if (slider == NULL) return false; /* Copy widget style */ setWidgetStyle(slider->widgetStyle()); /* Copy level stuff */ setLevelLowLimit(slider->levelLowLimit()); setLevelHighLimit(slider->levelHighLimit()); m_levelChannels = slider->m_levelChannels; /* Copy playback stuff */ m_playbackFunction = slider->m_playbackFunction; /* Copy slider appearance */ setValueDisplayStyle(slider->valueDisplayStyle()); setInvertedAppearance(slider->invertedAppearance()); /* Copy Click & Go feature */ setClickAndGoType(slider->clickAndGoType()); /* Copy mode & current value */ setSliderMode(slider->sliderMode()); setSliderValue(slider->sliderValue()); /* Copy monitor mode */ setChannelsMonitorEnabled(slider->channelsMonitorEnabled()); /* Copy common stuff */ return VCWidget::copyFrom(widget); }
void VCSlider::setSliderMode(SliderMode mode) { Q_ASSERT(mode >= Bus && mode <= Submaster); /* Disconnect these to prevent double callbacks and non-needes signals */ disconnect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); disconnect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); /* Unregister this as a DMX source if the new mode is not "Level" */ if (m_sliderMode == Level && mode != Level) _app->masterTimer()->unregisterDMXSource(this); m_sliderMode = mode; if (mode == Bus) { /* Set the slider range */ m_slider->setRange(busLowLimit() * MasterTimer::frequency(), busHighLimit() * MasterTimer::frequency()); setSliderValue(Bus::instance()->value(bus())); slotSliderMoved(sliderValue()); /* Reconnect to bus emitter */ connect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); connect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); m_bottomLabel->hide(); m_tapButton->show(); m_time->start(); }
void VCSlider::init() { setCaption(""); /* Main VBox */ m_vbox = new QVBoxLayout(this); m_vbox->setMargin(10); m_vbox->setSpacing(10); /* Top label */ m_topLabel = new QLabel(this); m_vbox->addWidget(m_topLabel); m_topLabel->setAlignment(AlignCenter); /* Slider & its HBox */ m_hbox = new QHBoxLayout(m_vbox); m_hbox->insertSpacing(-1, 10); m_slider = new QSlider(this); m_hbox->addWidget(m_slider); m_slider->setRange(KDefaultBusLowLimit * KFrequency, KDefaultBusHighLimit * KFrequency); m_slider->setPageStep(1); connect(m_slider, SIGNAL(sliderPressed()), this, SLOT(slotSliderPressed())); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderValueChanged(int))); connect(m_slider, SIGNAL(sliderReleased()), this, SLOT(slotSliderReleased())); m_hbox->insertSpacing(-1, 10); /* Tap button */ m_tapButton = new QPushButton(this); m_vbox->addWidget(m_tapButton); connect(m_tapButton, SIGNAL(clicked()), this, SLOT(slotTapButtonClicked())); m_time = new QTime(); /* Bottom label */ m_bottomLabel = new QLabel(this); m_vbox->addWidget(m_bottomLabel); m_bottomLabel->setAlignment(AlignCenter); m_bottomLabel->hide(); resize(QPoint(60, 220)); /* Initialize to bus mode by default */ setBus(KBusIDDefaultFade); setSliderMode(Bus); setSliderValue(0); slotSliderValueChanged(0); /* Update the slider according to current mode */ slotModeChanged(_app->mode()); }
void ParameterSlider::setParameterValue(float value) { const int oldSliderValue = slider_->value(); const float boundValue = qBound(minimumValue_, value, maximumValue_); const int sliderValue = parameterValueToSliderValue(boundValue); slider_->setValue(sliderValue); if (sliderValue == oldSliderValue) { // in this case the slider won't emit the signal valueChanged(int) setSliderValue(sliderValue); } }
void ParameterSlider::setValues(const QStringList& values) { m_values = values; setEnabled(m_values.size() > 1); if (!m_values.isEmpty()) { m_ui->slider->setRange(0, m_values.size() - 1); setSliderValue(0); } }
void FloatEditor::spinBoxValueChanged(double value) { senderIsSpinBox_ = true; if (!senderIsSlider_) setSliderValue(value); senderIsSpinBox_ = false; emit valueChanged(value); }
ScalePropertyToolEditor::ScalePropertyToolEditor(QSlider *slider, QObject *parent) : PropertyToolEditor(slider->parentWidget(), parent), m_slider(slider) { connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(changeScale(int))); connect(this, SIGNAL(valueSet(QVariant)), this, SLOT(setSliderValue(QVariant))); Scale scale(m_slider->minimum(), m_slider->maximum()); scale.setValue(m_slider->sliderPosition()); setValue(QVariant::fromValue(scale)); }
void LLMultiSlider::setValue(const LLSD& value) { // only do if it's a map if(value.isMap()) { // add each value... the first in the map becomes the current LLSD::map_const_iterator mIt = value.beginMap(); mCurSlider = mIt->first; for(; mIt != value.endMap(); mIt++) { setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE); } } }
void UIScaleFactorEditor::updateValuesAfterMonitorChange() { /* Set the spinbox value for the currently selected monitor: */ if (m_pMonitorComboBox) { int currentMonitorIndex = m_pMonitorComboBox->currentIndex(); while (m_scaleFactors.size() <= currentMonitorIndex) m_scaleFactors.append(m_dDefaultScaleFactor); setSpinBoxValue(100 * m_scaleFactors.at(currentMonitorIndex)); setSliderValue(100 * m_scaleFactors.at(currentMonitorIndex)); } }
int MyWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: setSliderValue((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: setComboValue((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 2; } return _id; }
//接收从secFrame窗体传递过来的信号,控制歌曲的暂停播放功能之前,增添一个 //关闭之前播放歌曲的功能,使得即使从其他窗体传递过来了歌曲也只有一首歌曲播放 void Widget::PreplayOrpauseMusic(SingleMusic *mu) { //在控制歌曲播放与暂停功能之前,先关闭之前播放的歌曲 if(mainMusic != nullptr) closePreMusic(); //再将传递过来的歌曲传递给playOrpauseMusic()函数进行播放 playOrpauseMusic(mu); //测试用,看能够解决播放试听音乐开始没有进度条进行 connect(mainMusic->player, SIGNAL(positionChanged(qint64)), this, SLOT(setSliderValue(qint64))); connect(mainMusic, SIGNAL(isPlaying(bool)), this, SLOT(currentIsPlaying(bool))); //player(); //currentIsPlaying(true); }
//单纯控制歌曲的播放与暂停 void Widget::playOrpauseMusic(SingleMusic *para) { //这就是要播放或暂停的歌曲 mainMusic = para; mainMusicName = mainMusic->SingleMusicName; mainMusicTotalTime = mainMusic->musicTotalTime; mainMusicPlayedTime = mainMusic->musicPlayedTime; connect(mainMusic->player, SIGNAL(positionChanged(qint64)), this, SLOT(setSliderValue(qint64))); //暂停或播放这首歌曲 mainMusic->playAndPause(); connect(mainMusic, SIGNAL(isPlaying(bool)), this, SLOT(currentIsPlaying(bool))); }
bool geHorizontalSlider::onMouseMove(float x, float y, int flag) { float diffX=x-m_fMousePrevXPos; if(m_bGrabbed && (flag&MK_LBUTTON)) { float actualPos=m_cPos.x+m_fSliderPos*(m_cSize.x-SLIDER_GRABBER_SZ); actualPos+=diffX; m_fSliderPos=(actualPos-m_cPos.x)/(m_cSize.x-SLIDER_GRABBER_SZ); if(m_fSliderPos<=0.0f) m_fSliderPos=0.0f; if(m_fSliderPos>=1.0f) m_fSliderPos=1.0f; setSliderValue(m_fSliderPos, true); } m_fMousePrevXPos=x; return true; }
void VCSlider::slotMonitorDMXValueChanged(int value) { if (value != sliderValue()) { if (invertedAppearance()) m_monitorValue = 255 - value; else m_monitorValue = value; m_levelValueMutex.lock(); m_levelValue = m_monitorValue; m_levelValueMutex.unlock(); if (m_slider) m_slider->blockSignals(true); setSliderValue(m_monitorValue, true); setTopLabelText(sliderValue()); if (m_slider) m_slider->blockSignals(false); updateFeedback(); } }
Jmplayer::Jmplayer( QWidget * parent, Qt::WFlags f) : QMainWindow(parent, f) { setupUi(this); timer = new QTimer(this); ms = 0; fileIndex = 0; firstTime = true; running = false; connect(timer, SIGNAL(timeout()), this, SLOT(showTime())); connect(timer, SIGNAL(timeout()), this, SLOT(setSliderValue())); connect(play_button, SIGNAL(clicked()), this, SLOT(pauseContinue())); connect(prev_button, SIGNAL(clicked()), this, SLOT(skipBackward())); connect(next_button, SIGNAL(clicked()), this, SLOT(skipForward())); connect(add_button, SIGNAL(clicked()), this, SLOT(loadFiles())); connect(timeSlider, SIGNAL(sliderReleased()),this, SLOT(seekFile())); connect(volumeSlider, SIGNAL(valueChanged(int)),this, SLOT(changeVolume())); program = "/usr/bin/mplayer"; myProcess = new QProcess(parent); adjustWindow(); initUi(); }
void LLMultiSlider::addSlider(F32 val, const std::string& name) { F32 initVal = val; if(mValue.size() >= mMaxNumSliders) { return; } bool foundOne = findUnusedValue(initVal); if(!foundOne) { return; } // add a new thumb rect mThumbRects[name] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); // add the value and set the current slider to this one mValue.insert(name, initVal); mCurSlider = name; // move the slider setSliderValue(mCurSlider, initVal, TRUE); }
int CSVSlider::mouseMove(int x, int y) { if (csvData && currentSlider) { CSVSRC *e = currentSlider->getCurrentSRC(); CSVDST dst; // restore value for CSVSlider class (mouse position calculate) currentSlider->dstOffsetX = 0; currentSlider->dstOffsetY = 0; currentSlider->getDST(&dst); int range = e->getSliderRange(); double dx = (double)(x - dst.getX()) / range; double dy = (double)(y - dst.getY()) / range; double d = 0; switch (e->getSliderMuki()) { case 0: d = 1-dy; break; case 1: d = dx; break; case 2: d = dy; break; case 3: d = 1-dx; break; } setSliderValue(e->getSliderType(), setRange0to1(d)); return e->getSliderType(); } return 0; }
VCSlider::VCSlider(QWidget* parent) : VCWidget(parent) { /* Set the class name "VCSlider" as the object name as well */ setObjectName(VCSlider::staticMetaObject.className()); m_hbox = NULL; m_topLabel = NULL; m_slider = NULL; m_bottomLabel = NULL; m_tapButton = NULL; m_sliderMode = Bus; m_valueDisplayStyle = ExactValue; m_levelLowLimit = 0; m_levelHighLimit = 255; m_bus = Bus::defaultFade(); m_busLowLimit = KDefaultBusLowLimit; m_busHighLimit = KDefaultBusHighLimit; m_sliderValue = 0; m_time = NULL; setCaption(QString::null); setFrameStyle(KVCFrameStyleSunken); /* Main VBox */ new QVBoxLayout(this); /* Top label */ m_topLabel = new QLabel(this); layout()->addWidget(m_topLabel); m_topLabel->setAlignment(Qt::AlignHCenter); /* Slider's HBox |stretch|slider|stretch| */ m_hbox = new QHBoxLayout(); layout()->addItem(m_hbox); /* Put stretchable space before the slider (to its left side) */ m_hbox->addStretch(); /* The slider */ m_slider = new QSlider(this); m_slider->setStyle(App::saneStyle()); m_hbox->addWidget(m_slider); m_slider->setRange(KDefaultBusLowLimit * KFrequency, KDefaultBusHighLimit * KFrequency); m_slider->setPageStep(1); m_slider->setInvertedAppearance(false); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotSliderMoved(int))); /* Put stretchable space after the slider (to its right side) */ m_hbox->addStretch(); /* Tap button */ m_tapButton = new QPushButton(this); layout()->addWidget(m_tapButton); connect(m_tapButton, SIGNAL(clicked()), this, SLOT(slotTapButtonClicked())); m_time = new QTime(); /* Bottom label */ m_bottomLabel = new QLabel(this); layout()->addWidget(m_bottomLabel); m_bottomLabel->setAlignment(Qt::AlignCenter); m_bottomLabel->hide(); resize(QPoint(60, 220)); /* Initialize to bus mode by default */ setBus(Bus::defaultFade()); setSliderMode(Bus); setSliderValue(0); slotSliderMoved(0); setInvertedAppearance(true); /* Update the slider according to current mode */ slotModeChanged(_app->mode()); }
void UIScaleFactorEditor::sltScaleSpinBoxValueChanged(int value) { setSliderValue(value); if (m_pMonitorComboBox) setScaleFactor(m_pMonitorComboBox->currentIndex(), value); }
QmlView::QmlView(QUrl source, QWidget *parent, MafwRegistryAdapter *mafwRegistry ) : QMainWindow(parent), ui(new Ui::QmlView), mafwRegistry(mafwRegistry), mafwRenderer(mafwRegistry->renderer()) { ui->setupUi(this); ui->declarativeView->setSource(source); ui->declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView); setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_Maemo5StackedWindow); setAttribute(Qt::WA_Maemo5NonComposited); QGLWidget *glWidget = new QGLWidget(this); ui->declarativeView->setViewport(glWidget); positionTimer = new QTimer(this); positionTimer->setInterval(1000); fmtx = new FMTXInterface(this); Rotator *rotator = Rotator::acquire(); savedPolicy = rotator->policy(); rotator->setPolicy(Rotator::Landscape); rootObject = dynamic_cast<QObject*>(ui->declarativeView->rootObject()); rootObject->setParent(this); connect(rootObject, SIGNAL(quitButtonClicked()), this, SLOT(close())); connect(rootObject, SIGNAL(prevButtonClicked()), mafwRenderer, SLOT(previous())); connect(rootObject, SIGNAL(playButtonClicked()), this, SLOT(onPlayClicked())); connect(rootObject, SIGNAL(nextButtonClicked()), mafwRenderer, SLOT(next())); connect(rootObject, SIGNAL(fmtxButtonClicked()), this, SLOT(onFmtxClicked())); connect(rootObject, SIGNAL(sliderValueChanged(int)), this, SLOT(onSliderValueChanged(int))); connect(rootObject, SIGNAL(playlistItemSelected(int)), this, SLOT(onPlaylistItemChanged(int))); connect(this, SIGNAL(titleChanged(QVariant)), rootObject, SLOT(setSongTitle(QVariant))); connect(this, SIGNAL(albumChanged(QVariant)), rootObject, SLOT(setSongAlbum(QVariant))); connect(this, SIGNAL(artistChanged(QVariant)), rootObject, SLOT(setSongArtist(QVariant))); connect(this, SIGNAL(albumArtChanged(QVariant)), rootObject, SLOT(setAlbumArt(QVariant))); connect(this, SIGNAL(durationTextChanged(QVariant)), rootObject, SLOT(setPosition(QVariant))); connect(this, SIGNAL(positionChanged(QVariant)), rootObject, SLOT(setSliderValue(QVariant))); connect(this, SIGNAL(durationChanged(QVariant)), rootObject, SLOT(setSliderMaximum(QVariant))); connect(this, SIGNAL(stateIconChanged(QVariant)), rootObject, SLOT(setPlayButtonIcon(QVariant))); connect(this, SIGNAL(rowChanged(QVariant)), rootObject, SLOT(onRowChanged(QVariant))); connect(this, SIGNAL(fmtxStateChanged(QVariant)), rootObject, SLOT(onFmtxStateChanged(QVariant))); connect(this, SIGNAL(playlistItemAppended(QVariant,QVariant,QVariant)), rootObject, SLOT(appendPlaylistItem(QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemInserted(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(insertPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemSet(QVariant,QVariant,QVariant,QVariant)), rootObject, SLOT(setPlaylistItem(QVariant,QVariant,QVariant,QVariant))); connect(this, SIGNAL(playlistItemRemoved(QVariant)), rootObject, SLOT(removePlaylistItem(QVariant))); connect(this, SIGNAL(playlistCleared()), rootObject, SLOT(clearPlaylist())); connect(mafwRenderer, SIGNAL(stateChanged(MafwPlayState)), this, SLOT(onStateChanged(MafwPlayState))); connect(mafwRenderer, SIGNAL(positionReceived(int,QString)), this, SLOT(onPositionChanged(int))); connect(mafwRenderer, SIGNAL(statusReceived(MafwPlaylist*,uint,MafwPlayState,QString,QString)), this, SLOT(onStatusReceived(MafwPlaylist*,uint,MafwPlayState))); connect(positionTimer, SIGNAL(timeout()), mafwRenderer, SLOT(getPosition())); connect(fmtx, SIGNAL(propertyChanged()), this, SLOT(onFmtxChanged())); onFmtxChanged(); positionTimer->start(); quint32 disable = {0}; Atom winPortraitModeSupportAtom = XInternAtom(QX11Info::display(), "_HILDON_PORTRAIT_MODE_SUPPORT", false); XChangeProperty(QX11Info::display(), winId(), winPortraitModeSupportAtom, XA_CARDINAL, 32, PropModeReplace, (uchar*) &disable, 1); this->setDNDAtom(true); mafwRenderer->getStatus(); mafwRenderer->getPosition(); }