Exemplo n.º 1
0
SliderSpinBoxWidget::SliderSpinBoxWidget(QWidget* parent)
    : QWidget(parent)
    , isSliderTrackingEnabled_(true)
    , isSpinboxTrackingEnabled_(false)
{
    layout_ = new QHBoxLayout(this);
    layout_->setSpacing(6);
    layout_->setMargin(0);
    slider_ = new QSlider(this);
    slider_->setOrientation(Qt::Horizontal);
    slider_->setTickPosition(QSlider::NoTicks);
    slider_->setTickInterval(5);

    layout_->addWidget(slider_);
    spinbox_ = new QSpinBox(this);
    layout_->addWidget(spinbox_);


    // signals and slots connections
    connect(slider_, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
    connect(slider_, SIGNAL(sliderPressed()), this, SLOT(sliderPressed()));
    connect(slider_, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
    connect(spinbox_, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
    connect(spinbox_, SIGNAL(editingFinished()), this, SLOT(spinEditingFinished()));

    value_ = getValue();

    setSliderTracking(isSliderTrackingEnabled_);
    setSpinboxTracking(isSpinboxTrackingEnabled_);
}
unsigned int GradientSliderWidget::AddSlider()
{
	TriangleSliderButton *newSlider = new TriangleSliderButton(this);
	unsigned int newID = newSlider->GetID();
	if (!sliders.contains(newID))
	{
		newSlider->SetValue((minValue + maxValue) / 2.0);
		newSlider->SetColor(QColor::fromRgb(0, 0, 0));
		connect(newSlider, SIGNAL(sliderPressed(uint)), this, SLOT(sliderPressed(uint)));
		connect(newSlider, SIGNAL(sliderReleased(uint)), this, SLOT(sliderReleased(uint)));
		connect(newSlider, SIGNAL(colorChanged(uint,QColor)), this, SLOT(updateGradientStops(uint,QColor)));
		connect(newSlider, SIGNAL(removeSlider(uint)), this, SLOT(removeSlider(uint)));
		sliders[newID] = newSlider;

		newSlider->show();
		CheckSliderCount();

		emit sliderAdded(newID, newSlider->GetValue(), newSlider->GetColor());

		return newID;
	} else {
		delete newSlider;
	}

	return 0;
}
Exemplo n.º 3
0
void PlayerControls::setupSliders()
{
    QString lblStyle = "QLabel { color: #555; font-size: 9px; }";
    m_styleSlider = "::sub-page:horizontal { background-image: url(:/images/prog_sub); } ::add-page:horizontal { background-image: url(:/images/prog_add); } ::groove:horizontal {background:  transparent; } ::handle:horizontal {image: url(:/images/handle);} ::handle:horizontal:hover {image: url(:/images/handle_hover);}";

    QHBoxLayout *layout = new QHBoxLayout();

    // Seek
    m_wSeekSlider = new QSlider(this);
    m_wSeekSlider->setOrientation(Qt::Horizontal);
    m_wSeekSlider->setFixedHeight(20);
    m_wSeekSlider->setStyleSheet(m_styleSlider);
    m_wSeekSlider->setMaximum(1000);
    m_wSeekSlider->setTickInterval(10);

    m_wSeekSlider->installEventFilter(this);

    m_bTickSlider = true;

    m_wlCurTime = new QLabel("0:00");
    m_wlCurTime->setStyleSheet(lblStyle);
    m_wlTotTime = new QLabel("0:00");
    m_wlTotTime->setStyleSheet(lblStyle);

    // Volume
    m_wVolumeSlider = new QSlider(this);
    m_wVolumeSlider->setOrientation(Qt::Horizontal);
    m_wVolumeSlider->setFixedHeight(20);
    m_wVolumeSlider->setMaximumWidth(100);
    m_wVolumeSlider->setObjectName("volumeSlider");
    m_wVolumeSlider->setStyleSheet(m_styleSlider);
    m_wVolumeSlider->setValue(75);
    m_wVolumeSlider->setMaximum(100);

    m_wlCurVolume = new QLabel("75");
    m_wlCurVolume->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    m_wlCurVolume->setMinimumWidth(18);
    m_wlCurVolume->setStyleSheet(lblStyle);

    // Layouts
    layout->addWidget(m_wlCurTime);
    layout->addWidget(m_wSeekSlider);
    layout->addWidget(m_wlTotTime);
    layout->addSpacing(30);
    layout->addWidget(m_wlCurVolume);
    layout->addWidget(m_wVolumeSlider);;

    // Connection
    //connect(m_wVolumeSlider, SIGNAL(valueChanged(int)), SLOT(setVolume(int)));
    connect(m_wVolumeSlider, SIGNAL(valueChanged(int)), SLOT(onVolumeChanged(int)));

    connect(m_wSeekSlider, SIGNAL(sliderPressed()), SLOT(sliderPressed()));
    connect(m_wSeekSlider, SIGNAL(sliderReleased()), SLOT(sliderReleased()));


    m_mainLayout->addLayout(layout, 1, 1);
}
Exemplo n.º 4
0
// Based on code from qslider.cpp
void Slider::mousePressEvent( QMouseEvent *e )
{
	qDebug("pressed (%d, %d)", e->pos().x(), e->pos().y());
	if( e->button() == Qt::LeftButton )
	{
		qDebug( "Left button" );
		QStyleOptionSlider opt;
		initStyleOption( &opt );
		const QRect sliderRect = style()->subControlRect( QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this );
		const QPoint center = sliderRect.center() - sliderRect.topLeft();
		// to take half of the slider off for the setSliderPosition call we use the center - topLeft

		if ( ! sliderRect.contains( e->pos() ) )
		{
			qDebug( "accept" );
			e->accept();

			int v = pixelPosToRangeValue( pick( e->pos() - center ) );
			setSliderPosition( v );
			triggerAction( SliderMove );
			setRepeatAction( SliderNoAction );
			emit sliderMoved( v );//TODO: ok?
			emit sliderPressed(); //TODO: ok?
		}
		else
		{
			QSlider::mousePressEvent( e );
		}
	}
	else
	{
		QSlider::mousePressEvent( e );
	}
}
Exemplo n.º 5
0
void BtQmlScrollView::initScrollBar() {
    m_scrollBar->setRange(-100,100);
    m_scrollBar->setValue(0);
    BT_CONNECT(m_scrollBar, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderMoved(int)));
    BT_CONNECT(m_scrollBar, SIGNAL(sliderPressed()), this, SLOT(slotSliderPressed()));
    BT_CONNECT(m_scrollBar, SIGNAL(sliderReleased()), this, SLOT(slotSliderReleased()));
}
Exemplo n.º 6
0
TimeSlider::TimeSlider( QWidget * parent ) : MySlider(parent)
{
	dont_update = FALSE;
	setMinimum(0);
#ifdef SEEKBAR_RESOLUTION
	setMaximum(SEEKBAR_RESOLUTION);
#else
	setMaximum(100);
#endif

	setFocusPolicy( Qt::NoFocus );
	setSizePolicy( QSizePolicy::Expanding , QSizePolicy::Fixed );

	connect( this, SIGNAL( sliderPressed() ), this, SLOT( stopUpdate() ) );
	connect( this, SIGNAL( sliderReleased() ), this, SLOT( resumeUpdate() ) );
	connect( this, SIGNAL( sliderReleased() ), this, SLOT( mouseReleased() ) );
	connect( this, SIGNAL( valueChanged(int) ), this, SLOT( valueChanged_slot(int) ) );
#if ENABLE_DELAYED_DRAGGING
	connect( this, SIGNAL(draggingPos(int) ), this, SLOT(checkDragging(int)) );
	
	last_pos_to_send = -1;
	timer = new QTimer(this);
	connect( timer, SIGNAL(timeout()), this, SLOT(sendDelayedPos()) );
	timer->start(200);
#endif
}
Exemplo n.º 7
0
void MainWindow::makeConnections()
{
    connect(pt_videocapture, SIGNAL(positionUpdated(int)), ui->positionSlider, SLOT(setValue(int)));
    connect(ui->positionSlider, SIGNAL(sliderPressed()), pt_videocapture, SLOT(pause()));
    connect(ui->positionSlider, SIGNAL(sliderReleased(int)), pt_videocapture, SLOT(setPosition(int)));
    connect(ui->positionSlider, SIGNAL(sliderReleased(int)), pt_videocapture, SLOT(resume()));
    connect(pt_videocapture, SIGNAL(framesInFile(int)), ui->positionSlider, SLOT(setMaxValue(int)));

    connect(ui->resumeButton, SIGNAL(pressed()), pt_resumeAct, SLOT(trigger()));
    connect(ui->pauseButton, SIGNAL(pressed()), pt_pauseAct, SLOT(trigger()));
    connect(ui->backwardButton, SIGNAL(pressed()), pt_backwardAct, SLOT(trigger()));
    connect(ui->forwardButton, SIGNAL(pressed()), pt_forwardAct, SLOT(trigger()));
    connect(ui->speeddownButton, SIGNAL(pressed()), pt_speeddownAct, SLOT(trigger()));
    connect(ui->speedupButton, SIGNAL(pressed()), pt_speedupAct, SLOT(trigger()));

    connect(pt_videocapture, SIGNAL(positionUpdated(int)), ui->frameLCD, SLOT(display(int)));
    connect(pt_videocapture, SIGNAL(framesInFile(int)), ui->totalframesLCD, SLOT(display(int)));

    connect(pt_stasm, SIGNAL(frametimeUpdated(double)), ui->frametimeLCD, SLOT(display(double)));

    connect(pt_opencv, SIGNAL(snrUpdated(double)), ui->snrLCD, SLOT(display(double)));
    connect(pt_opencv, SIGNAL(contrastUpdated(double)), ui->contrastLCD, SLOT(display(double)));
    connect(pt_stasm, SIGNAL(eyesdistanceUpdated(double)), ui->eyesLCD, SLOT(display(double)));   
    qRegisterMetaType<cv::Rect>("cv::Rect");
    connect(pt_stasm, SIGNAL(facerectUpdated(cv::Rect)), ui->display, SLOT(updateSelection(cv::Rect)));

    //seriesanalyzer part
    connect(ui->dataseriaW, SIGNAL(stateChanged(bool)), this, SLOT(dataanalysconnection(bool)));
    connect(pt_seriesanalyzer, SIGNAL(seriesFound(DataSeria,uint,uint)), ui->dataseriaW, SLOT(updateSeries(DataSeria,uint,uint)));
    connect(ui->dataseriaW, SIGNAL(moveBackward()), pt_seriesanalyzer, SLOT(stepBackward()));
    connect(ui->dataseriaW, SIGNAL(moveForward()), pt_seriesanalyzer, SLOT(stepForward()));
    connect(ui->dataseriaW, SIGNAL(clearHistory()), pt_seriesanalyzer, SLOT(clearSeriesHistory()));
}
Exemplo n.º 8
0
void WaSlider::mousePressEvent(QMouseEvent *e) {
    if (e->button() != LeftButton && e->button() != MidButton) {
        WaWidget::mousePressEvent(e);
        return;
    }

    int maxX = slider_x - slider_width;
    
    if(mapping == _WA_MAPPING_VOLUME_BAR) 
        maxX -= 3;
    
    if ((e->x() < slider_x) || (e->x() > (maxX))) {
        int newX = e->x();
        newX -= (slider_width / 2);
        setValue(pixel2Value(newX));
   }

   
   pressPoint.setX(e->x() - slider_x);
   lDragging = true;

   update();

   emit(sliderPressed());
}
Exemplo n.º 9
0
QPlayer::QPlayer(QTimer *timer1, QTimer *timer2, QFile *file1)
{
	playTimer = timer1;
	refreshTimer = timer2;

	file = file1;
	QDesktopWidget *desktop = new QDesktopWidget;

	setWindowTitle("QPlayer");
	setGeometry(desktop->width()-100, desktop->height()-60, 220, 25);

	xSize = 130;
	ySize = 30;
	busy = false;

	slider = new QSlider(Qt::Horizontal,this);
	QPushButton *playButton = new QPushButton(QIcon(":/icons/amarok_play.png"),"");
	QPushButton *pauseButton = new QPushButton(QIcon(":/icons/amarok_pause.png"),"");
	playButton->setFlat(true);
	pauseButton->setFlat(true);
	QHBoxLayout *layout = new QHBoxLayout;
	layout->addWidget(playButton);
	layout->addWidget(pauseButton);
	layout->addWidget(slider);

	connect(playButton, SIGNAL(released()), this, SLOT(play() ) );
	connect(pauseButton,SIGNAL(released()), this, SLOT(pause()) );
	connect(slider,SIGNAL(sliderReleased()), this, SLOT(seekFile()) );
	connect(slider,SIGNAL(sliderPressed()), this, SLOT(sliderPress()) );

	setLayout(layout);
	show();
}
Exemplo n.º 10
0
void KisColorSliderInput::init()
{
    QHBoxLayout* m_layout = new QHBoxLayout(this);
    m_layout->setContentsMargins(0, 0, 0, 0);
    m_layout->setSpacing(1);

    QString m_name;
    switch (m_type){
    case 0: m_name=i18n("Hue"); break;
    case 1: m_name=i18n("Saturation"); break;
    case 2: m_name=i18n("Value"); break;
    case 3: m_name=i18n("Hue"); break;
    case 4: m_name=i18n("Saturation"); break;
    case 5: m_name=i18n("Lightness"); break;
    case 6: m_name=i18n("Hue"); break;
    case 7: m_name=i18n("Saturation"); break;
    case 8: m_name=i18n("Intensity"); break;
    case 9: m_name=i18n("Hue"); break;
    case 10: m_name=i18n("Saturation"); break;
    case 11: m_name=i18n("Luma"); break;
    }
    
    QLabel* m_label = new QLabel(i18n("%1:", m_name), this);
    m_layout->addWidget(m_label);

    m_hsvSlider = new KisHSVSlider(Qt::Horizontal, this, m_displayRenderer, m_canvas);
    m_hsvSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_layout->addWidget(m_hsvSlider);
    connect (m_hsvSlider,  SIGNAL(sliderPressed()), SLOT(sliderIn()));
    connect (m_hsvSlider,  SIGNAL(sliderReleased()), SLOT(sliderOut()));

    QWidget* m_input = createInput();
    m_hsvSlider->setFixedHeight(m_input->sizeHint().height());
    m_layout->addWidget(m_input);
}
Exemplo n.º 11
0
void SubBarPlayer::xSetup()
{
   //DAVID Setup Background;
   pixBackground.load("/root/kde_application/hdass08/skin/SubBarBackground.png");
   setBackgroundPixmap(pixBackground);
   
   //DAVID Load BtnGraphic
   BtnGraphic[0]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Previous.png");
   BtnGraphic[1]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Previous-Active.png");
   BtnGraphic[2]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Play.png");
   BtnGraphic[3]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Play-Active.png");
   BtnGraphic[4]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Pause.png");
   BtnGraphic[5]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Pause-Active.png");
   BtnGraphic[6]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Next.png");
   BtnGraphic[7]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Next-Active.png");
  
   
   SubBtnPlayer_PlayNPause =new SkinButton(this);
   SubBtnPlayer_Backword     =new SkinButton(this);
   SubBtn_Forward                =new SkinButton(this);
   
   SubBtnPlayer_Backword->setPixmaps(BtnGraphic[0],BtnGraphic[1]);
   SubBtnPlayer_Backword->setGeometry(336,0,60,80);
   SubBtnPlayer_Backword->show();
   
   SubBtnPlayer_PlayNPause->setPixmaps(BtnGraphic[2],BtnGraphic[3]);
   SubBtnPlayer_PlayNPause->setGeometry(403,0,80,80);
   SubBtnPlayer_PlayNPause->show();
   
   SubBtn_Forward->setPixmaps(BtnGraphic[6],BtnGraphic[7]);
   SubBtn_Forward->setGeometry(484,0,60,80);
   SubBtn_Forward->show();
   
   //DAVID Pos Slider
   playerPosition = new QSlider(0,100,1,0,Qt::Horizontal,this);
   playerPosition->setGeometry( QRect(10,39,300,15) );
   //playerPosition->show();
   
   
   QObject::connect(SubBtnPlayer_PlayNPause, SIGNAL(clicked()), m_player, SLOT(play()));
   QObject::connect(SubBtnPlayer_PlayNPause,SIGNAL(clicked()),this,SLOT(ChangeBtnPlayPauseGraphic()));
   QObject::connect(SubBtn_Forward, SIGNAL(clicked()), m_player, SLOT(next()));
   QObject::connect(SubBtnPlayer_Backword, SIGNAL(clicked()), m_player, SLOT(previous()));

   state=SubBarPlayer::GO;
   
   connect(m_player, SIGNAL(positionMessage(int)), this, SLOT(handlePosition(int )));
   connect(m_player,SIGNAL(trackMessage(int, int, QString, QString, QString )),this,SLOT(handleMessage(int, int, QString, QString, QString )));
   connect(playerPosition, SIGNAL(sliderPressed()), this, SLOT(handleSliderPressed()));
   connect(playerPosition, SIGNAL(sliderReleased()), this, SLOT(handleSliderReleased()));
   
    forwardTimer = new QTimer( this ); // create internal timer
    connect( forwardTimer, SIGNAL(timeout()),this, SLOT(handleForward()) );

    
    backwardTimer = new QTimer( this );
    connect( backwardTimer, SIGNAL(timeout()), this, SLOT(handleBackward()) );
    
    slotReadList();
}
Exemplo n.º 12
0
VideoControls::VideoControls(QWidget *parent) : QFrame (parent) {
    setEnabled(false);
    m_isTracking = false;
    m_isPlaying = false;
    m_autoHide = false;

    m_hbox = new QHBoxLayout(this);
    m_hbox->setSizeConstraint(QLayout::SetMinimumSize);
    m_hbox->setContentsMargins(0,0,0,0);
    m_hbox->setSpacing(4);
    
    m_prevButton = new QToolButton(this);
    m_hbox->addWidget(m_prevButton);
    m_prevButton->setFixedSize(24, 24);
    m_prevButton->setAutoRaise(true);
    m_prevButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward));
	m_prevButton->setAutoRepeat(true);
	m_prevButton->setAutoRepeatInterval(1000/50); 

    m_playButton = new QToolButton(this);;
    m_hbox->addWidget(m_playButton);
    m_playButton->setFixedSize(24, 24);
    m_playButton->setAutoRaise(true);
    m_playButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));

    m_nextButton = new QToolButton(this);;
    m_hbox->addWidget(m_nextButton);
    m_nextButton->setFixedSize(24, 24);
    m_nextButton->setAutoRaise(true);
    m_nextButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward));
	m_nextButton->setAutoRepeat(true);
	m_nextButton->setAutoRepeatInterval(1000/50); 

    m_frameSlider = new QSlider(this);
    m_hbox->addWidget(m_frameSlider);
    m_frameSlider->setMinimumHeight(24);
    m_frameSlider->setRange(0,0);
    m_frameSlider->setFocusPolicy(Qt::NoFocus);
    m_frameSlider->setOrientation(Qt::Horizontal);
    m_frameSlider->setTracking(false);

    m_frameEdit = new QSpinBox(this);
    m_hbox->addWidget(m_frameEdit);
    m_frameEdit->setMinimumHeight(24);
    m_frameEdit->setRange(0,0);
    m_frameEdit->setButtonSymbols(QAbstractSpinBox::NoButtons);
    m_frameEdit->setAlignment(Qt::AlignCenter);
    m_frameEdit->setKeyboardTracking(false);

    connect(m_prevButton, SIGNAL(clicked()), this, SIGNAL(stepBack()));
    connect(m_playButton, SIGNAL(clicked()), this, SLOT(toogle()));
    connect(m_nextButton, SIGNAL(clicked()), this, SIGNAL(stepForward()));

    connect(m_frameSlider, SIGNAL(valueChanged(int)), this, SIGNAL(currentFrameChanged(int)));
    connect(m_frameSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(currentFrameTracked(int)));
    connect(m_frameSlider, SIGNAL(sliderPressed()), this, SLOT(handleSliderPressed()));
    connect(m_frameSlider, SIGNAL(sliderReleased()), this, SLOT(handleSliderReleased()));

    connect(m_frameEdit, SIGNAL(valueChanged(int)), this, SIGNAL(currentFrameChanged(int)));
}
Exemplo n.º 13
0
// --------------------------------------------------------------------------
void ctkRangeWidgetPrivate::connectSlider()
{
  Q_Q(ctkRangeWidget);
  QObject::connect(this->Slider, SIGNAL(valuesChanged(double, double)),
                   q, SLOT(changeValues(double,double)));
  QObject::connect(this->Slider, SIGNAL(minimumValueChanged(double)),
                   q, SLOT(changeMinimumValue(double)));
  QObject::connect(this->Slider, SIGNAL(maximumValueChanged(double)),
                   q, SLOT(changeMaximumValue(double)));

  QObject::connect(this->MinimumSpinBox, SIGNAL(valueChanged(double)),
                   this->Slider, SLOT(setMinimumValue(double)));
  QObject::connect(this->MaximumSpinBox, SIGNAL(valueChanged(double)),
                   this->Slider, SLOT(setMaximumValue(double)));
  QObject::connect(this->MinimumSpinBox, SIGNAL(valueChanged(double)),
                   q, SLOT(setMinimumToMaximumSpinBox(double)));
  QObject::connect(this->MaximumSpinBox, SIGNAL(valueChanged(double)),
                   q, SLOT(setMaximumToMinimumSpinBox(double)));

  QObject::connect(this->Slider, SIGNAL(sliderPressed()),
                   q, SLOT(startChanging()));
  QObject::connect(this->Slider, SIGNAL(sliderReleased()),
                   q, SLOT(stopChanging()));
  QObject::connect(this->Slider, SIGNAL(rangeChanged(double, double)),
                   q, SLOT(onSliderRangeChanged(double, double)));
}
Exemplo n.º 14
0
void NSlider::mousePressEvent(QMouseEvent *event)
{
	if (event->button() != Qt::RightButton) {
		emit sliderPressed();

		QStyleOptionSlider opt;
		initStyleOption(&opt);
		QRect gr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this);
		QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);

		int pxMin;
		int pxMax;
		if (orientation() == Qt::Horizontal) {
			pxMin = gr.x() +  sr.width() / 2;
			pxMax = gr.right() -  sr.width() / 2 + 1;
		} else {
			pxMin = gr.y() + sr.height() / 2;
			pxMax = gr.bottom() - sr.height() / 2 + 1;
		}

		setValue(QStyle::sliderValueFromPosition(minimum(), maximum(), event->x() - pxMin, pxMax - pxMin, opt.upsideDown));

		emit sliderMoved(value());
	}

	QSlider::mousePressEvent(event);
}
Exemplo n.º 15
0
	SeekSlider::SeekSlider (SourceObject *source, QWidget *parent)
	: QWidget (parent)
	, Source_ (source)
	, IgnoreNextValChange_ (false)
	, IsPressed_ (false)
	{
		Ui_.setupUi (this);

		connect (source,
				SIGNAL (currentSourceChanged (AudioSource)),
				this,
				SLOT (updateRanges ()));
		connect (source,
				SIGNAL (totalTimeChanged (qint64)),
				this,
				SLOT (updateRanges ()));
		connect (source,
				SIGNAL (tick (qint64)),
				this,
				SLOT (handleCurrentPlayTime (qint64)));
		connect (source,
				SIGNAL (stateChanged (SourceState, SourceState)),
				this,
				SLOT (handleStateChanged ()));

		connect (Ui_.Slider_,
				SIGNAL (sliderPressed ()),
				this,
				SLOT (handleSliderPressed ()));
		connect (Ui_.Slider_,
				SIGNAL (sliderReleased ()),
				this,
				SLOT (handleSliderReleased ()));
	}
Exemplo n.º 16
0
void knob::mousePressEvent( QMouseEvent * _me )
{
	if( _me->button() == Qt::LeftButton &&
			! ( _me->modifiers() & Qt::ControlModifier ) &&
			! ( _me->modifiers() & Qt::ShiftModifier ) )
	{
		model()->prepareJournalEntryFromOldVal();

		const QPoint & p = _me->pos();
		m_origMousePos = p;
		m_mouseOffset = QPoint(0, 0);
		m_leftOver = 0.0f;

		emit sliderPressed();

		QApplication::setOverrideCursor( Qt::BlankCursor );
		s_textFloat->setText( displayValue() );
		s_textFloat->moveGlobal( this,
				QPoint( width() + 2, 0 ) );
		s_textFloat->show();
		m_buttonPressed = true;
	}
	else if( _me->button() == Qt::LeftButton &&
			engine::mainWindow()->isShiftPressed() == true )
	{
		new stringPairDrag( "float_value",
					QString::number( model()->value() ),
							QPixmap(), this );
	}
	else
	{
		FloatModelView::mousePressEvent( _me );
	}
}
Exemplo n.º 17
0
void DSlider::mousePressEvent(QMouseEvent *event)
{
    QAbstractSlider::mousePressEvent(event);

    if (event->button() == Qt::LeftButton) {
        if (orientation() == Qt::Vertical) {
            setValue(minimum() + ((maximum() - minimum()) * (height() - event->y())) / height()) ;
        } else {
            // FIXME
            // the value 10 is specified in DSlider.theme, it's ugly here, but I don't have any
            // good idea for now, maybe someone can help.
            setValue(minimum() + ((maximum() - minimum()) * (event->x() - 10)) / (width() - 10 - 10)) ;
        }

        event->accept();

        Q_D(DSlider);

        QStyleOptionSlider opt;
        initStyleOption(&opt);
        setRepeatAction(SliderNoAction);
        QRect sr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);

        d->clickOffset = d->pick(event->pos() - sr.topLeft());
        d->mousePressed = true;

        emit sliderPressed();
    }
}
Exemplo n.º 18
0
MediaPlayer::MediaPlayer(Data::DataManager * const _dataManager)
	:dataManager(_dataManager)
	,player(_dataManager)
{
	auto videoWidget = new Video::Widget();
	auto surface = videoWidget->videoSurface();

	player.start(surface);
	mediaControl = player.getMediaControl();

	playPauseButton = new QPushButton;
	playPauseButton->setEnabled(false);
	playPauseButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
	playPauseButton->setText("PlayPause");

	connect(playPauseButton, SIGNAL(clicked()),this, SLOT(playPause()));

	positionSlider = new QSlider(Qt::Horizontal);
	positionSlider->setRange(0, 10000);
	connect(positionSlider, SIGNAL(sliderMoved(int)),this, SLOT(sliderChanged(int)));
	connect(positionSlider, SIGNAL(sliderPressed()),this, SLOT(sliderPressed()));
	connect(positionSlider, SIGNAL(sliderReleased()),this, SLOT(sliderReleased()));

	connect(surface, SIGNAL(frameChanged(I8u)),this, SLOT(frameChanged(I8u)));
	connect(surface, SIGNAL(durationFramesChanged(I8u)),this, SLOT(durationFramesChanged(I8u)));

	connect(this, SIGNAL(setSlider(int)),positionSlider, SLOT(setValue(int)));
	
	QBoxLayout * controlLayout = new QHBoxLayout;
	controlLayout->addWidget(playPauseButton);
	controlLayout->addWidget(positionSlider);

	QBoxLayout * layout = new QVBoxLayout;
	layout->addWidget(videoWidget);
	layout->addLayout(controlLayout);

	createActions();
	createMenus();

	auto window = new QWidget;
	window->setLayout(layout);
	setCentralWidget(window);

	setWindowTitle(tr("Media Player"));
	resize(600, 600);
	
}
Exemplo n.º 19
0
void TransFunc1DRampEditor::createConnections() {
    // Buttons
    connect(clearButton_, SIGNAL(clicked()), this, SLOT(clearButtonClicked()));
    connect(loadButton_, SIGNAL(clicked()), this, SLOT(loadTransferFunction()));
    connect(saveButton_, SIGNAL(clicked()), this, SLOT(saveTransferFunction()));

    // signals from transferMappingCanvas
    connect(transCanvas_, SIGNAL(changed()), this, SLOT(updateTransferFunction()));
    connect(transCanvas_, SIGNAL(loadTransferFunction()), this, SLOT(loadTransferFunction()));
    connect(transCanvas_, SIGNAL(saveTransferFunction()), this, SLOT(saveTransferFunction()));
    connect(transCanvas_, SIGNAL(resetTransferFunction()), this, SLOT(clearButtonClicked()));
    connect(transCanvas_, SIGNAL(toggleInteractionMode(bool)), this, SLOT(toggleInteractionMode(bool)));

    // signals for colorPicker
    connect(transCanvas_, SIGNAL(colorChanged(const QColor&)),
            colorPicker_, SLOT(setCol(const QColor)));
    connect(transCanvas_, SIGNAL(colorChanged(const QColor&)),
            colorLumPicker_, SLOT(setCol(const QColor)));
    connect(colorPicker_, SIGNAL(newCol(int,int)),
            colorLumPicker_, SLOT(setCol(int,int)));
    connect(colorLumPicker_, SIGNAL(newHsv(int,int,int)),
            this, SLOT(markerColorChanged(int,int,int)));
    connect(colorPicker_, SIGNAL(toggleInteractionMode(bool)), this, SLOT(toggleInteractionMode(bool)));
    connect(colorLumPicker_, SIGNAL(toggleInteractionMode(bool)), this, SLOT(toggleInteractionMode(bool)));

    // doubleslider
    connect(doubleSlider_, SIGNAL(valuesChanged(float, float)), this, SLOT(thresholdChanged(float, float)));
    connect(doubleSlider_, SIGNAL(toggleInteractionMode(bool)), this, SLOT(toggleInteractionMode(bool)));

    // threshold spinboxes
    connect(lowerThresholdSpin_, SIGNAL(valueChanged(int)), this, SLOT(lowerThresholdSpinChanged(int)));
    connect(upperThresholdSpin_, SIGNAL(valueChanged(int)), this, SLOT(upperThresholdSpinChanged(int)));

    connect(checkClipThresholds_, SIGNAL(toggled(bool)), transCanvas_, SLOT(toggleClipThresholds(bool)));

    //ramp slider and spinboxes
    connect(sliderRampCenter_, SIGNAL(valueChanged(int)), this, SLOT(updateRampCenter(int)));
    connect(spinRampCenter_,   SIGNAL(valueChanged(int)), this, SLOT(updateRampCenter(int)));
    connect(spinRampWidth_,    SIGNAL(valueChanged(int)), this, SLOT(updateRampWidth(int)));
    connect(sliderRampWidth_,  SIGNAL(valueChanged(int)), this, SLOT(updateRampWidth(int)));

    connect(sliderRampCenter_, SIGNAL(sliderPressed()),  this, SLOT(startTracking()));
    connect(sliderRampWidth_,  SIGNAL(sliderPressed()),  this, SLOT(startTracking()));
    connect(sliderRampCenter_, SIGNAL(sliderReleased()), this, SLOT(stopTracking()));
    connect(sliderRampWidth_,  SIGNAL(sliderReleased()), this, SLOT(stopTracking()));
}
Exemplo n.º 20
0
void DrawWidget::SetScaleControl(QScaleSlider * pScale)
{
  m_pScale = pScale;

  connect(m_pScale, SIGNAL(actionTriggered(int)), this, SLOT(ScaleChanged(int)));
  connect(m_pScale, SIGNAL(sliderPressed()), this, SLOT(SliderPressed()));
  connect(m_pScale, SIGNAL(sliderReleased()), this, SLOT(SliderReleased()));
}
Exemplo n.º 21
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , _ui(new Ui::MainWindow)
    , _midiOutput(new CxxMidi::Output::Default(0))
    , _midiPlayer(new CxxMidi::Player::Asynchronous(_midiOutput))
    , _midiFile(0)
    , _sliderLocked(false)
{
    _ui->setupUi(this);

    this->createMenuBar();
    this->centralWidget()->setDisabled(true);
    this->resize(this->minimumSizeHint());

    _midiPlayer->setCallbackHeartbeat(&_playerHeartbeatCallback);
    connect(&_playerHeartbeatCallback,SIGNAL(playerTimeChanged(CxxMidi::Time::Point)),
            this,SLOT(updateTimeCode(CxxMidi::Time::Point)),Qt::QueuedConnection);

    _midiPlayer->setCallbackFinished(&_playerFinishedCallback);
    connect(&_playerFinishedCallback,SIGNAL(playerFinished()),
            this,SLOT(playerFinished()),Qt::QueuedConnection);

    connect(_ui->doubleSpinBoxSpeed,SIGNAL(valueChanged(double)),
            this,SLOT(onSpeedChange(double)));

    connect(_ui->pushButtonPlay,SIGNAL(clicked()),
            this,SLOT(onPlayClicked()));

    connect(_ui->pushButtonPause,SIGNAL(clicked()),
            this,SLOT(onPauseClicked()));

    connect(_ui->sliderTimeline,SIGNAL(sliderPressed()),
            this,SLOT(onTimeSliderPressed()));

    connect(_ui->sliderTimeline,SIGNAL(sliderReleased()),
            this,SLOT(onTimeSliderReleased()));


    // first argument is file name
    if(QApplication::arguments().size() >=2 )
    {
        QString fileName = QApplication::arguments().at(1);
        this->openFile(fileName);
    }

    // second argument is output num
    if(QApplication::arguments().size() >=3)
    {
        int num = QApplication::arguments().at(2).toInt();
        this->setOutput(num);
        _outputsActionGroup->actions()[num]->setChecked(true);
    }

    // auto play
    if( QApplication::arguments().size() >= 2)
        _midiPlayer->play();
}
Exemplo n.º 22
0
void Plot::mousePressEvent(QMouseEvent *event)
{
    if (event->pos().y() > padding_top && event->pos().y() < height() - padding_bottom)
    {
        auto sv = style()->sliderValueFromPosition(softMinimum, softMaximum, event->pos().x() - 50 - 10, width() - 50 - 20);
        setValue(sv);
        emit sliderPressed();
    }
}
Exemplo n.º 23
0
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());
}
Exemplo n.º 24
0
void SliderDialog::addSlider(CSlider* pSlider)
{
  if (mpParentWindow == NULL)
    return;

  // check if there already is a slider for this  object
  CCopasiDataModel * pDataModel = pSlider->getObjectDataModel();
  assert(pDataModel != NULL);
  SCopasiXMLGUI* pGUI = pDataModel->getGUI();
  assert(pGUI);

  if (!equivalentSliderExists(pSlider))
    {
      CObjectInterface::ContainerList listOfContainers;
      assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
      listOfContainers.push_back(pDataModel->getModel());
      pSlider->compile(listOfContainers);
      pGUI->getSliderList()->add(pSlider, true);
    }

  CopasiSlider* tmp = findCopasiSliderForCSlider(pSlider);

  if (!tmp)
    {
      setCurrentSlider(new CopasiSlider(pSlider, mpParentWindow->getDataModel(), mpSliderBox));
      mpCurrSlider->installEventFilter(this);
      mpCurrSlider->setHidden(true);
      mpCurrSlider->updateSliderData();
      // make sure the slider points to the correct object
      // for the currently set framework
      this->setCorrectSliderObject(this->mpCurrSlider);
      mSliderMap[mCurrentFolderId].push_back(mpCurrSlider);
      QBoxLayout* layout = static_cast<QBoxLayout*>(mpSliderBox->layout());
      int childCount = layout->count() - 1;
      layout->insertWidget(childCount, mpCurrSlider);
      connect(mpCurrSlider, SIGNAL(valueChanged(double)), this , SLOT(sliderValueChanged()));
      connect(mpCurrSlider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
      connect(mpCurrSlider, SIGNAL(sliderPressed()), this, SLOT(sliderPressed()));
      connect(mpCurrSlider, SIGNAL(closeClicked(CopasiSlider*)), this, SLOT(removeSlider(CopasiSlider*)));
      connect(mpCurrSlider, SIGNAL(editClicked(CopasiSlider*)), this, SLOT(editSlider(CopasiSlider*)));
      mpCurrSlider->setHidden(false);
      mChanged = true;
    }
Exemplo n.º 25
0
void WaBalanceSlider::buildGui()
{
    ws = new WaSlider(_WA_MAPPING_BALANCE_BAR,
		      _WA_MAPPING_BALANCE_SLIDER, true);

    ws->setRange(-100, 100);


    ws->setPixmapSliderButtonUp(_WA_SKIN_BALANCE_SLIDER_NORM);
    ws->setPixmapSliderButtonDown(_WA_SKIN_BALANCE_SLIDER_PRES);
    ws->setPixmapSliderBar(_WA_SKIN_BALANCE_BAR);

    ws->setValue(0);

    connect(ws, SIGNAL(valueChanged(int)), this,
	    SIGNAL(balanceSetValue(int)));
    connect(ws, SIGNAL(sliderPressed()), SIGNAL(sliderPressed()));
    connect(ws, SIGNAL(sliderReleased()), SIGNAL(sliderReleased()));
}
Exemplo n.º 26
0
void QDialPrivate::init()
{
    Q_Q(QDial);
    showNotches = false;
    q->setFocusPolicy(Qt::WheelFocus);
#ifdef QT3_SUPPORT
    QObject::connect(q, SIGNAL(sliderPressed()), q, SIGNAL(dialPressed()));
    QObject::connect(q, SIGNAL(sliderMoved(int)), q, SIGNAL(dialMoved(int)));
    QObject::connect(q, SIGNAL(sliderReleased()), q, SIGNAL(dialReleased()));
#endif
}
Exemplo n.º 27
0
MixerTrackPart::MixerTrackPart(QWidget *parent, MixerTrackItemPtr mti, bool expanded) :
      QWidget(parent), _mti(mti), _selected(false), _group(0)
      {
      setupUi(this);

      int numChannels = 0;
      Part* part = _mti->part();
      const InstrumentList* il = part->instruments();
      for (auto it = il->begin(); it != il->end(); ++it) {
            Instrument* instr = it->second;
            numChannels += instr->channel().size();
            }

      expandBn->setEnabled(numChannels > 1);
      expandBn->setChecked(expanded);

      connect(expandBn, SIGNAL(toggled(bool)), SLOT(expandToggled(bool)));

      connect(soloBn, SIGNAL(toggled(bool)), SLOT(updateSolo(bool)));
      connect(muteBn, SIGNAL(toggled(bool)), SLOT(updateMute(bool)));

      updateNameLabel();

      //set up rest

      Channel* chan = _mti->focusedChan();

      soloBn->setChecked(chan->solo());
      muteBn->setChecked(chan->mute());

      chan->addListener(this);
      volumeSlider->setValue(chan->volume());
      volumeSlider->setToolTip(tr("Volume: %1").arg(QString::number(chan->volume())));
      volumeSlider->setMaxValue(127);
      volumeSlider->setMinValue(0);
      volumeSlider->setNumMajorTicks(10);
      volumeSlider->setNumMinorTicks(4);

      QIcon iconSliderHead;
      iconSliderHead.addFile(QStringLiteral(":/data/icons/mixer-slider-handle-vertical.svg"), QSize(), QIcon::Normal, QIcon::Off);
      volumeSlider->setSliderHeadIcon(iconSliderHead);

      panSlider->setValue(chan->pan());
      panSlider->setToolTip(tr("Pan: %1").arg(QString::number(chan->pan())));
      panSlider->setMaxValue(127);
      panSlider->setMinValue(0);

      connect(volumeSlider, SIGNAL(valueChanged(double)),      SLOT(volumeChanged(double)));
      connect(panSlider,    SIGNAL(valueChanged(double, int)), SLOT(panChanged(double)));

      connect(volumeSlider, SIGNAL(sliderPressed()),    SLOT(controlSelected()));
      connect(panSlider,    SIGNAL(sliderPressed(int)), SLOT(controlSelected()));
      }
Exemplo n.º 28
0
void Knob::mousePressEvent(QMouseEvent* ev)
      {
      startY = ev->y();
      emit sliderPressed(_id);
      if (_center) {
            QRect r(points->boundingRect().toRect());
            if (r.contains(ev->pos())) {
                  setValue(.0f);
                  valueChange();
                  }
            }
      }
Exemplo n.º 29
0
void Slider::mousePressEvent(QMouseEvent* ev)
      {
      startDrag = ev->pos();
//      if (points->boundingRect().toRect().contains(startDrag)) {
            emit sliderPressed(_id);
            dragMode = true;
            int pixel = (orient == Qt::Vertical) ? height() - _sliderSize.height() : width() - _sliderSize.width();
            dragppos = int(pixel * (_value - minValue()) / (maxValue() - minValue()));
            if (_invert)
                  dragppos = pixel - dragppos;
//            }
      }
Exemplo n.º 30
0
void ControlBar::setupConnection(){
    connect(timer,SIGNAL(timeout()),this,SLOT(timerout()));
    connect(playSlider,SIGNAL(sliderPressed()),this,SLOT(playSliderPressed()));
    connect(playSlider,SIGNAL(sliderReleased()),this,SLOT(playSliderReleased()));
    connect(volumeSlider,SIGNAL(valueChanged(int)),player,SLOT(changeVolume(int)));
    connect(player,SIGNAL(volumeChanged(int)),volumeSlider,SLOT(setValue(int)));
    connect(playBtn,SIGNAL(clicked()),player,SLOT(playOrPause()));
    connect(player,SIGNAL(stateChanged(MPlayerState)),this,SLOT(stateChanged(MPlayerState)));
    connect(player,SIGNAL(streamPositionChanged(double)),this,SLOT(changePlaySliderPosisition(double)));
    connect(fullScreenBtn,SIGNAL(clicked()),parent,SLOT(toggleFullScreen()));
    connect(subtitleBtn,SIGNAL(clicked()),this,SLOT(loadSubtitle()));
}