QvisText3DInterface::QvisText3DInterface(QWidget *parent) : 
    QvisAnnotationObjectInterface(parent)
{
    // Set the title of the group box.
    this->setTitle(GetName());

    QGridLayout *cLayout = new QGridLayout(0);
    topLayout->addLayout(cLayout);
    cLayout->setSpacing(10);

    int row = 0;

    // Add controls for entering the text
    textLineEdit = new QLineEdit(this);
    connect(textLineEdit, SIGNAL(returnPressed()),
            this, SLOT(textChanged()));
    cLayout->addWidget(textLineEdit, row, 1, 1, 2);
    cLayout->addWidget(new QLabel(tr("Text"), this), row, 0);
    ++row;

    // Add controls for the position
    positionEdit = new QLineEdit(this);
    connect(positionEdit, SIGNAL(returnPressed()),
            this, SLOT(positionChanged()));
    cLayout->addWidget(positionEdit, row, 1, 1, 2);
    cLayout->addWidget(new QLabel(tr("Position"), this), row, 0);
    ++row;

    // Add controls for the height.
    heightMode = new QButtonGroup(this);
    connect(heightMode, SIGNAL(buttonClicked(int)),
            this, SLOT(heightModeChanged(int)));
    cLayout->addWidget(new QLabel(tr("Height"), this), row, 0);
    QRadioButton *rb = new QRadioButton(tr("Relative"), this);
    heightMode->addButton(rb, 0);
    cLayout->addWidget(rb, row, 1);
    // Add controls for relative height
    relativeHeightSpinBox = new QSpinBox(this);
    relativeHeightSpinBox->setMinimum(1);
    relativeHeightSpinBox->setMaximum(100);
    relativeHeightSpinBox->setSuffix("%");
    relativeHeightSpinBox->setButtonSymbols(QSpinBox::PlusMinus);
    connect(relativeHeightSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(relativeHeightChanged(int)));
    cLayout->addWidget(relativeHeightSpinBox, row, 2);
    ++row;

    // Add controls for fixed height.
    rb = new QRadioButton(tr("Fixed"), this);
    heightMode->addButton(rb, 1);
    cLayout->addWidget(rb, row, 1);
    fixedHeightEdit = new QLineEdit(this);
    connect(fixedHeightEdit, SIGNAL(returnPressed()),
            this, SLOT(fixedHeightChanged()));
    cLayout->addWidget(fixedHeightEdit, row, 2);
    cLayout->setColumnStretch(2, 10);
    ++row;

    QFrame *splitter1 = new QFrame(this);
    splitter1->setFrameStyle(QFrame::HLine + QFrame::Raised);
    cLayout->addWidget(splitter1, row, 0, 1, 3);
    ++row;

    facesCameraCheckBox = new QCheckBox(tr("Preserve orientation when view changes"), this);
    connect(facesCameraCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(facesCameraToggled(bool)));
    cLayout->addWidget(facesCameraCheckBox, row, 0, 1, 3);
    ++row;

    rotateZ = new QSpinBox(this);
    rotateZ->setMinimum(-360);
    rotateZ->setMaximum(360);
    rotateZ->setButtonSymbols(QSpinBox::PlusMinus);
    rotateZ->setSuffix(" deg");
    connect(rotateZ, SIGNAL(valueChanged(int)),
            this, SLOT(rotateZChanged(int)));
    QLabel *rotateZLabel = new QLabel(tr("Rotate Z"), this);
    rotateX = new QSpinBox(this);
    rotateX->setMinimum(-360);
    rotateX->setMaximum(360);
    rotateX->setButtonSymbols(QSpinBox::PlusMinus);
    rotateX->setSuffix(" deg");
    connect(rotateX, SIGNAL(valueChanged(int)),
            this, SLOT(rotateXChanged(int)));
    QLabel *rotateXLabel = new QLabel(tr("Rotate X"), this);
    rotateY = new QSpinBox(this);
    rotateY->setMinimum(-360);
    rotateY->setMaximum(360);
    rotateY->setButtonSymbols(QSpinBox::PlusMinus);
    rotateY->setSuffix(" deg");
    connect(rotateY, SIGNAL(valueChanged(int)),
            this, SLOT(rotateYChanged(int)));
    QLabel *rotateYLabel = new QLabel(tr("Rotate Y"), this);
    QGridLayout *rLayout = new QGridLayout(0);
    rLayout->setMargin(0);
    cLayout->addLayout(rLayout, row, 0, 1, 3);
    rLayout->addWidget(rotateYLabel, 0, 0);
    rLayout->addWidget(rotateXLabel, 0, 1);
    rLayout->addWidget(rotateZLabel, 0, 2);
    rLayout->addWidget(rotateY, 1, 0);
    rLayout->addWidget(rotateX, 1, 1);
    rLayout->addWidget(rotateZ, 1, 2);
    ++row;

    QFrame *splitter2 = new QFrame(this);
    splitter2->setFrameStyle(QFrame::HLine + QFrame::Raised);
    cLayout->addWidget(splitter2, row, 0, 1, 4);
    ++row;

    // Add controls for the text color.
    textColorButton = new QvisColorButton(this);
    connect(textColorButton, SIGNAL(selectedColor(const QColor &)),
            this, SLOT(textColorChanged(const QColor &)));
    cLayout->addWidget(new QLabel(tr("Text color")), row, 0, Qt::AlignLeft);
    cLayout->addWidget(textColorButton, row, 1);
    textColorOpacity = new QvisOpacitySlider(0, 255, 10, 0, this);
    connect(textColorOpacity, SIGNAL(valueChanged(int)),
            this, SLOT(textOpacityChanged(int)));
    cLayout->addWidget(textColorOpacity, row, 2, 1, 2);
    ++row;

    // Added a use foreground toggle
    useForegroundColorCheckBox = new QCheckBox(tr("Use foreground color"), this);
    connect(useForegroundColorCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(useForegroundColorToggled(bool)));
    cLayout->addWidget(useForegroundColorCheckBox, row, 0, 1, 3);
    ++row;

    // Added a visibility toggle
    visibleCheckBox = new QCheckBox(tr("Visible"), this);
    connect(visibleCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(visibilityToggled(bool)));
    cLayout->addWidget(visibleCheckBox, row, 0);
}
/**
  This method is EXTREMELY important.
  Virtually every geometry-editing-function passes through here.
*/
bool EdgeWidget::setPosition(int location, ScreenEdge edge, const QSize &newSize)
{
	// Store some important variables to be able to restore them if things don't go well.
	QRect oldDg = _desiredGeometry;
	ScreenEdge oldEdge = _edge;

	// This really is not the best way to solve the problem with posdragging, but for now it will suffice.
	QPoint oldPosDragging;
	if (_posDragging)
		oldPosDragging = *_posDragging;

	// Set the size of desiredGeometry to do the coming calculations on the new desired size (location and such)
	_desiredGeometry.setSize(newSize);

	// Make sure we only deal with "real" edges, we don't want to have to check for SameEdge everywhere.
	if (edge == SameEdge)
		edge = oldEdge;

	// We only tranpose for now, we don't emit edgeChange-signals to trigger reorienting widgets,
	// in case things don't work out with the new geometry.
	if ((edge != oldEdge) && _edgeAdjust)
			adjustOrientation(_desiredGeometry, edge);

	// Do all coming calculations based on the new edge
	_edge = edge;

	// Check we're not moving out of screen
	int minLocation = 0;
	int maxLocation = (orientation(edge) == Horizontal)?
			_screen->width() - _desiredGeometry.width():
			_screen->height() - _desiredGeometry.height();
	if (location < minLocation)
		location = minLocation;
	if (location > maxLocation)
		location = maxLocation;

	// Now, we should have figured the final size, edge and location, just make it so.
	switch (edge)
	{
		case TopEdge:
			_desiredGeometry.moveLeft(location);
			_desiredGeometry.moveTop(-_currentOffset);
			break;
		case BottomEdge:
			_desiredGeometry.moveLeft(location);
			_desiredGeometry.moveBottom(_screen->height()+_currentOffset);
			break;
		case LeftEdge:
			_desiredGeometry.moveLeft(-_currentOffset);
			_desiredGeometry.moveTop(location);
			break;
		case RightEdge:
			_desiredGeometry.moveRight(_screen->width()+_currentOffset);
			_desiredGeometry.moveTop(location);
			break;
		default:
			_desiredGeometry.moveLeft(0);
			_desiredGeometry.moveTop(0);
	}

	// Check for collsion, this is a recursive call.
	if (EdgeWidgetManager::instance()->checkCollision(*this))
	{
		// If things did not work out, restore the desired geometry and edge to the way they were before.
		_desiredGeometry = oldDg;
		_edge = oldEdge;

		if (_posDragging)
			*_posDragging = oldPosDragging;

		// False indicates the new geometry had unresolved collisions.
		return false;
	}
	else
	{
		// Apply the new geometry
		QWidget::setGeometry(_desiredGeometry);

		// Ok, new geometry was OK, emit the edgechange signal and give the widget a chance to adjust.
		if (oldEdge != edge)
			emit edgeChanged(oldEdge, edge);

		if (pos() != _desiredGeometry.topLeft())
		{
			if (!_posDragging)
				emit positionChanged();
			emit positionChanging();
		}

		if (size() != _desiredGeometry.size())
		{
			if (!_sizeDragging)
				emit sizeChanged();
			emit sizeChanging();
		}

		// True indicates there were no unresolved problems with the new geometry.
		return true;
	}
}
Example #3
0
void TreeKeyIdx::decrement(int steps) {
	error = getTreeNodeFromIdxOffset(currentNode.offset - (4*steps), &currentNode);
	positionChanged();
}
void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
{
    Q_D(QQuickMouseArea);
    if (!d->enabled && !d->pressed) {
        QQuickItem::mouseMoveEvent(event);
        return;
    }

    d->saveEvent(event);

    // ### we should skip this if these signals aren't used
    // ### can GV handle this for us?
    const bool isInside = contains(d->lastPos);
    if (d->hovered && !isInside)
        setHovered(false);
    else if (!d->hovered && isInside)
        setHovered(true);

#ifndef QT_NO_DRAGANDDROP
    if (d->drag && d->drag->target()) {
        if (!d->moved) {
            d->targetStartPos = d->drag->target()->parentItem()
                    ? d->drag->target()->parentItem()->mapToScene(d->drag->target()->position())
                    : d->drag->target()->position();
        }

        QPointF startLocalPos;
        QPointF curLocalPos;
        if (drag()->target()->parentItem()) {
            startLocalPos = drag()->target()->parentItem()->mapFromScene(d->startScene);
            curLocalPos = drag()->target()->parentItem()->mapFromScene(event->windowPos());
        } else {
            startLocalPos = d->startScene;
            curLocalPos = event->windowPos();
        }

        qreal dx = qAbs(curLocalPos.x() - startLocalPos.x());
        qreal dy = qAbs(curLocalPos.y() - startLocalPos.y());

        if (keepMouseGrab() && d->stealMouse && !d->drag->active())
            d->drag->setActive(true);

        QPointF startPos = d->drag->target()->parentItem()
                ? d->drag->target()->parentItem()->mapFromScene(d->targetStartPos)
                : d->targetStartPos;

        QPointF dragPos = d->drag->target()->position();

        bool dragX = drag()->axis() & QQuickDrag::XAxis;
        bool dragY = drag()->axis() & QQuickDrag::YAxis;

        if (dragX && d->drag->active()) {
            qreal x = (curLocalPos.x() - startLocalPos.x()) + startPos.x();
            if (x < drag()->xmin())
                x = drag()->xmin();
            else if (x > drag()->xmax())
                x = drag()->xmax();
            dragPos.setX(x);
        }
        if (dragY && d->drag->active()) {
            qreal y = (curLocalPos.y() - startLocalPos.y()) + startPos.y();
            if (y < drag()->ymin())
                y = drag()->ymin();
            else if (y > drag()->ymax())
                y = drag()->ymax();
            dragPos.setY(y);
        }
        d->drag->target()->setPosition(dragPos);

        if (!keepMouseGrab()) {
            bool xDragged = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event);
            bool yDragged = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event);
            if ((!dragY && !yDragged && dragX && xDragged)
                || (!dragX && !xDragged && dragY && yDragged)
                || (dragX && dragY && (xDragged || yDragged))) {
                setKeepMouseGrab(true);
                d->stealMouse = true;
            }
        }

        d->moved = true;
    }
#endif

    QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
    emit mouseXChanged(&me);
    me.setPosition(d->lastPos);
    emit mouseYChanged(&me);
    me.setPosition(d->lastPos);
    emit positionChanged(&me);
}
Example #5
0
void TreeKeyIdx::setOffset(unsigned long offset) {
	error = getTreeNodeFromIdxOffset(offset, &currentNode);
	positionChanged();
}
void CartesianPlotLegendDock::setLegends(QList<CartesianPlotLegend*> list) {
	m_initializing = true;
	m_legendList = list;

	m_legend=list.first();

	//if there is more then one legend in the list, disable the tab "general"
	if (list.size()==1){
		ui.lName->setEnabled(true);
		ui.leName->setEnabled(true);
		ui.lComment->setEnabled(true);
		ui.leComment->setEnabled(true);

		ui.leName->setText(m_legend->name());
		ui.leComment->setText(m_legend->comment());
	}else{
		ui.lName->setEnabled(false);
		ui.leName->setEnabled(false);
		ui.lComment->setEnabled(false);
		ui.leComment->setEnabled(false);

		ui.leName->setText("");
		ui.leComment->setText("");
	}

	//show the properties of the first curve
	this->load();

	//on the very first start the column count shown in UI is 1.
	//if the this count for m_legend is also 1 then the slot layoutColumnCountChanged is not called
	//and we need to disable the "order" widgets here.
	ui.lOrder->setVisible(m_legend->layoutColumnCount()!=1);
	ui.cbOrder->setVisible(m_legend->layoutColumnCount()!=1);

	//legend title
	QList<TextLabel*> labels;
	foreach(CartesianPlotLegend* legend, list)
		labels.append(legend->title());

	labelWidget->setLabels(labels);

	//update active widgets
	backgroundTypeChanged(ui.cbBackgroundType->currentIndex());

	//SIGNALs/SLOTs
	//General
	connect( m_legend, SIGNAL(aspectDescriptionChanged(const AbstractAspect*)), this, SLOT(legendDescriptionChanged(const AbstractAspect*)) );
	connect( m_legend, SIGNAL(labelFontChanged(QFont&)), this, SLOT(legendLabelFontChanged(QFont&)) );
	connect( m_legend, SIGNAL(labelColorChanged(QColor&)), this, SLOT(legendLabelColorChanged(QColor&)) );
	connect( m_legend, SIGNAL(labelColumnMajorChanged(bool)), this, SLOT(legendLabelOrderChanged(bool)) );
	connect( m_legend, SIGNAL(positionChanged(CartesianPlotLegend::PositionWrapper)),
			 this, SLOT(legendPositionChanged(CartesianPlotLegend::PositionWrapper)) );
	connect( m_legend, SIGNAL(lineSymbolWidthChanged(float)), this, SLOT(legendLineSymbolWidthChanged(float)) );
	connect(m_legend, SIGNAL(visibilityChanged(bool)), this, SLOT(legendVisibilityChanged(bool)));

	//background
	connect( m_legend, SIGNAL(backgroundTypeChanged(PlotArea::BackgroundType)), this, SLOT(legendBackgroundTypeChanged(PlotArea::BackgroundType)) );
	connect( m_legend, SIGNAL(backgroundColorStyleChanged(PlotArea::BackgroundColorStyle)), this, SLOT(legendBackgroundColorStyleChanged(PlotArea::BackgroundColorStyle)) );
	connect( m_legend, SIGNAL(backgroundImageStyleChanged(PlotArea::BackgroundImageStyle)), this, SLOT(legendBackgroundImageStyleChanged(PlotArea::BackgroundImageStyle)) );
	connect( m_legend, SIGNAL(backgroundBrushStyleChanged(Qt::BrushStyle)), this, SLOT(legendBackgroundBrushStyleChanged(Qt::BrushStyle)) );
	connect( m_legend, SIGNAL(backgroundFirstColorChanged(QColor&)), this, SLOT(legendBackgroundFirstColorChanged(QColor&)) );
	connect( m_legend, SIGNAL(backgroundSecondColorChanged(QColor&)), this, SLOT(legendBackgroundSecondColorChanged(QColor&)) );
	connect( m_legend, SIGNAL(backgroundFileNameChanged(QString&)), this, SLOT(legendBackgroundFileNameChanged(QString&)) );
	connect( m_legend, SIGNAL(backgroundOpacityChanged(float)), this, SLOT(legendBackgroundOpacityChanged(float)) );
	connect( m_legend, SIGNAL(borderPenChanged(QPen&)), this, SLOT(legendBorderPenChanged(QPen&)) );
	connect( m_legend, SIGNAL(borderCornerRadiusChanged(float)), this, SLOT(legendBorderCornerRadiusChanged(float)) );
	connect( m_legend, SIGNAL(borderOpacityChanged(float)), this, SLOT(legendBorderOpacityChanged(float)) );

	//layout
	connect(m_legend,SIGNAL(layoutTopMarginChanged(float)),this,SLOT(legendLayoutTopMarginChanged(float)));
	connect(m_legend,SIGNAL(layoutBottomMarginChanged(float)),this,SLOT(legendLayoutBottomMarginChanged(float)));
	connect(m_legend,SIGNAL(layoutLeftMarginChanged(float)),this,SLOT(legendLayoutLeftMarginChanged(float)));
	connect(m_legend,SIGNAL(layoutRightMarginChanged(float)),this,SLOT(legendLayoutRightMarginChanged(float)));
	connect(m_legend,SIGNAL(layoutVerticalSpacingChanged(float)),this,SLOT(legendLayoutVerticalSpacingChanged(float)));
	connect(m_legend,SIGNAL(layoutHorizontalSpacingChanged(float)),this,SLOT(legendLayoutHorizontalSpacingChanged(float)));
	connect(m_legend,SIGNAL(layoutColumnCountChanged(int)),this,SLOT(legendLayoutColumnCountChanged(int)));

	m_initializing = false;
}
Example #7
0
ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal width, ChatView *parent)
  : QGraphicsScene(0, 0, width, 0, (QObject *)parent),
    _chatView(parent),
    _idString(idString),
    _model(model),
    _singleBufferId(BufferId()),
    _sceneRect(0, 0, width, 0),
    _firstLineRow(-1),
    _viewportHeight(0),
    _cutoffMode(CutoffRight),
    _selectingItem(0),
    _selectionStart(-1),
    _isSelecting(false),
    _clickMode(NoClick),
    _clickHandled(true),
    _leftButtonPressed(false)
{
  MessageFilter *filter = qobject_cast<MessageFilter*>(model);
  if(filter && filter->isSingleBufferFilter()) {
    _singleBufferId = filter->singleBufferId();
  }

  ChatViewSettings defaultSettings;
  int defaultFirstColHandlePos = defaultSettings.value("FirstColumnHandlePos", 80).toInt();
  int defaultSecondColHandlePos = defaultSettings.value("SecondColumnHandlePos", 200).toInt();

  ChatViewSettings viewSettings(this);
  _firstColHandlePos = viewSettings.value("FirstColumnHandlePos", defaultFirstColHandlePos).toInt();
  _secondColHandlePos = viewSettings.value("SecondColumnHandlePos", defaultSecondColHandlePos).toInt();

  _firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator());
  addItem(_firstColHandle);
  _firstColHandle->setXPos(_firstColHandlePos);
  connect(_firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(firstHandlePositionChanged(qreal)));
  connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _firstColHandle, SLOT(sceneRectChanged(const QRectF &)));

  _secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator());
  addItem(_secondColHandle);
  _secondColHandle->setXPos(_secondColHandlePos);
  connect(_secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(secondHandlePositionChanged(qreal)));

  connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _secondColHandle, SLOT(sceneRectChanged(const QRectF &)));

  setHandleXLimits();

  connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
          this, SLOT(rowsInserted(const QModelIndex &, int, int)));
  connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
          this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
  connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex)));

  if(model->rowCount() > 0)
    rowsInserted(QModelIndex(), 0, model->rowCount() - 1);

#ifdef HAVE_WEBKIT
  webPreview.timer.setSingleShot(true);
  connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));
#endif
  _showWebPreview = defaultSettings.showWebPreview();
  defaultSettings.notify("ShowWebPreview", this, SLOT(showWebPreviewChanged()));

  _clickTimer.setInterval(QApplication::doubleClickInterval());
  _clickTimer.setSingleShot(true);
  connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout()));

  setItemIndexMethod(QGraphicsScene::NoIndex);
}
Example #8
0
void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    Q_D(QDeclarativeMouseArea);
    if (!d->absorb) {
        QDeclarativeItem::mouseMoveEvent(event);
        return;
    }

    d->saveEvent(event);

    // ### we should skip this if these signals aren't used
    // ### can GV handle this for us?
    bool contains = boundingRect().contains(d->lastPos);
    if (d->hovered && !contains)
        setHovered(false);
    else if (!d->hovered && contains)
        setHovered(true);

    if (d->drag && d->drag->target()) {
        if (!d->moved) {
            d->startX = drag()->target()->x();
            d->startY = drag()->target()->y();
        }

        QPointF startLocalPos;
        QPointF curLocalPos;
        if (drag()->target()->parent()) {
            startLocalPos = drag()->target()->parentItem()->mapFromScene(d->startScene);
            curLocalPos = drag()->target()->parentItem()->mapFromScene(event->scenePos());
        } else {
            startLocalPos = d->startScene;
            curLocalPos = event->scenePos();
        }

        const int dragThreshold = QApplication::startDragDistance();
        qreal dx = qAbs(curLocalPos.x() - startLocalPos.x());
        qreal dy = qAbs(curLocalPos.y() - startLocalPos.y());
        if ((d->dragX && !(dx < dragThreshold)) || (d->dragY && !(dy < dragThreshold)))
            d->drag->setActive(true);
        if (!keepMouseGrab()) {
            if ((!d->dragY && dy < dragThreshold && d->dragX && dx > dragThreshold)
                || (!d->dragX && dx < dragThreshold && d->dragY && dy > dragThreshold)
                || (d->dragX && d->dragY)) {
                setKeepMouseGrab(true);
            }
        }

        if (d->dragX && d->drag->active()) {
            qreal x = (curLocalPos.x() - startLocalPos.x()) + d->startX;
            if (x < drag()->xmin())
                x = drag()->xmin();
            else if (x > drag()->xmax())
                x = drag()->xmax();
            drag()->target()->setX(x);
        }
        if (d->dragY && d->drag->active()) {
            qreal y = (curLocalPos.y() - startLocalPos.y()) + d->startY;
            if (y < drag()->ymin())
                y = drag()->ymin();
            else if (y > drag()->ymax())
                y = drag()->ymax();
            drag()->target()->setY(y);
        }
        d->moved = true;
    }
    QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
    emit mousePositionChanged(&me);
    me.setX(d->lastPos.x());
    me.setY(d->lastPos.y());
    emit positionChanged(&me);
}
Example #9
0
void BBTrackContainerView::updatePosition()
{
	//realignTracks();
	emit positionChanged( m_currentPosition );
}
void QFacebookGraphCommonWorkModel::setPosition(const QVariantMap &position) {
    if(m_position != position) {
        m_position = position;
        emit positionChanged();
    }
}
void MusicConnectionPool::poolConnect(const QString &from, const QString &to)
{
    QObject *first = m_para.value(from);
    QObject *second = m_para.value(to);
    if(first == nullptr || second == nullptr)
    {
        return;
    }

    if(from == MusicNetworkThread::getClassName() && to == MusicDownloadStatusObject::getClassName())
    {
        QObject::connect(first, SIGNAL(networkConnectionStateChanged(bool)), second, SLOT(networkConnectionStateChanged(bool)));
    }
#ifndef MUSIC_MOBILE
    else if(from == MusicPlayer::getClassName() && to == MusicLrcMakerWidget::getClassName())
    {
        QObject::connect(first, SIGNAL(positionChanged(qint64)), second, SLOT(positionChanged(qint64)));
        QObject::connect(first, SIGNAL(durationChanged(qint64)), second, SLOT(durationChanged(qint64)));
    }
    else if((from == MusicLocalSongsManagerWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()) ||
            (from == MusicSongCheckToolsDuplicateTableWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()) ||
            (from == MusicSongCheckToolsQualityTableWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()) ||
            (from == MusicDownloadAbstractTableWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()))
    {
        QObject::connect(first, SIGNAL(addSongToPlay(QStringList)), second, SLOT(addSongToPlayList(QStringList)));
    }
    else if(from == MusicEqualizerDialog::getClassName() && to == MusicPlayer::getClassName())
    {
        QObject::connect(first, SIGNAL(setEqEffect(MusicObject::MIntList)), second, SLOT(setEqEffect(MusicObject::MIntList)));
        QObject::connect(first, SIGNAL(setEnaleEffect(bool)), second, SLOT(setEnaleEffect(bool)));
    }
    else if(from == MusicEqualizerDialog::getClassName() && to == MusicSoundEffectsWidget::getClassName())
    {
        QObject::connect(first, SIGNAL(setEnaleEffect(bool)), second, SLOT(equalizerButtonChanged(bool)));
    }
    else if(from == MusicSoundEffectsWidget::getClassName() && to == MusicPlayer::getClassName())
    {
        QObject::connect(first, SIGNAL(volumeChanged(int)), second, SLOT(setSoundEffectVolume(int)));
        QObject::connect(first, SIGNAL(setEqInformation()), second, SLOT(setEqInformation()));
    }
    else if(from == MusicSongSearchOnlineTableWidget::getClassName() && to == MusicDownloadStatusObject::getClassName())
    {
        QObject::connect(first, SIGNAL(showDownLoadInfoFor(MusicObject::DownLoadMode)), second, SLOT(showDownLoadInfoFor(MusicObject::DownLoadMode)));
    }
    else if((from == MusicSongSearchOnlineTableWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()) ||
            (from == MusicQueryFoundTableWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()))
    {
        QObject::connect(first, SIGNAL(muiscSongToPlayListChanged(QString,QString,QString,bool)), second, SLOT(addNetMusicSongToList(QString,QString,QString,bool)));
    }
    else if(from == MusicLrcLocalLinkWidget::getClassName() && to == MusicDownloadStatusObject::getClassName())
    {
        QObject::connect(first, SIGNAL(currentLrcChanged(QString)), second, SLOT(showDownLoadInfoFinished(QString)));
    }
    else if(from == MusicVideoQualityPopWidget::getClassName() && to == MusicVideoTableWidget::getClassName())
    {
        QObject::connect(first, SIGNAL(getMusicMvInfo(MusicObject::MusicSongAttributes&)), second, SLOT(getMusicMvInfo(MusicObject::MusicSongAttributes&)));
    }
    else if((from == MusicConnectTransferWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()) ||
            (from == MusicSongCheckToolsWidget::getClassName() && to == MusicSongsSummariziedWidget::getClassName()))
    {
        QObject::connect(first, SIGNAL(getMusicLists(MusicSongItems&)), second, SLOT(getMusicLists(MusicSongItems&)));
    }
#endif
}
Example #12
0
VCXYPadProperties::VCXYPadProperties(VCXYPad* xypad, Doc* doc)
    : QDialog(xypad)
    , m_xypad(xypad)
    , m_doc(doc)
{
    Q_ASSERT(doc != NULL);
    Q_ASSERT(xypad != NULL);

    setupUi(this);

    // IDs 0-15 are reserved for XYPad base controls
    m_lastAssignedID = 15;

    QAction* action = new QAction(this);
    action->setShortcut(QKeySequence(QKeySequence::Close));
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
    addAction(action);

    /********************************************************************
     * General page
     ********************************************************************/

    m_nameEdit->setText(m_xypad->caption());

    if (m_xypad->invertedAppearance() == true)
        m_YInvertedRadio->setChecked(true);

    m_panInputWidget = new InputSelectionWidget(m_doc, this);
    m_panInputWidget->setTitle(tr("Pan / Horizontal Axis"));
    m_panInputWidget->setKeyInputVisibility(false);
    m_panInputWidget->setInputSource(m_xypad->inputSource(VCXYPad::panInputSourceId));
    m_panInputWidget->setWidgetPage(m_xypad->page());
    m_panInputWidget->emitOddValues(true);
    m_panInputWidget->show();
    m_extInputLayout->addWidget(m_panInputWidget);
    connect(m_panInputWidget, SIGNAL(autoDetectToggled(bool)),
            this, SLOT(slotPanAutoDetectToggled(bool)));
    connect(m_panInputWidget, SIGNAL(inputValueChanged(quint32,quint32)),
            this, SLOT(slotPanInputValueChanged(quint32,quint32)));

    m_tiltInputWidget = new InputSelectionWidget(m_doc, this);
    m_tiltInputWidget->setTitle(tr("Tilt / Vertical Axis"));
    m_tiltInputWidget->setKeyInputVisibility(false);
    m_tiltInputWidget->setInputSource(m_xypad->inputSource(VCXYPad::tiltInputSourceId));
    m_tiltInputWidget->setWidgetPage(m_xypad->page());
    m_tiltInputWidget->emitOddValues(true);
    m_tiltInputWidget->show();
    m_extInputLayout->addWidget(m_tiltInputWidget);
    connect(m_tiltInputWidget, SIGNAL(autoDetectToggled(bool)),
            this, SLOT(slotTiltAutoDetectToggled(bool)));
    connect(m_tiltInputWidget, SIGNAL(inputValueChanged(quint32,quint32)),
            this, SLOT(slotTiltInputValueChanged(quint32,quint32)));

    m_widthInputWidget = new InputSelectionWidget(m_doc, this);
    m_widthInputWidget->setTitle(tr("Width"));
    m_widthInputWidget->setKeyInputVisibility(false);
    m_widthInputWidget->setInputSource(m_xypad->inputSource(VCXYPad::widthInputSourceId));
    m_widthInputWidget->setWidgetPage(m_xypad->page());
    m_widthInputWidget->show();
    m_sizeInputLayout->addWidget(m_widthInputWidget);

    m_heightInputWidget = new InputSelectionWidget(m_doc, this);
    m_heightInputWidget->setTitle(tr("Height"));
    m_heightInputWidget->setKeyInputVisibility(false);
    m_heightInputWidget->setInputSource(m_xypad->inputSource(VCXYPad::heightInputSourceId));
    m_heightInputWidget->setWidgetPage(m_xypad->page());
    m_heightInputWidget->show();
    m_sizeInputLayout->addWidget(m_heightInputWidget);

    /********************************************************************
     * Fixtures page
     ********************************************************************/

    slotSelectionChanged(NULL);
    fillFixturesTree();

    connect(m_percentageRadio, SIGNAL(clicked(bool)),
            this, SLOT(slotPercentageRadioChecked()));
    connect(m_degreesRadio, SIGNAL(clicked(bool)),
            this, SLOT(slotDegreesRadioChecked()));
    connect(m_dmxRadio, SIGNAL(clicked(bool)),
            this, SLOT(slotDMXRadioChecked()));

    /********************************************************************
     * Presets page
     ********************************************************************/

    m_presetInputWidget = new InputSelectionWidget(m_doc, this);
    m_presetInputWidget->setCustomFeedbackVisibility(true);
    m_presetInputWidget->setWidgetPage(m_xypad->page());
    m_presetInputWidget->show();
    m_presetInputLayout->addWidget(m_presetInputWidget);

    connect(m_presetInputWidget, SIGNAL(inputValueChanged(quint32,quint32)),
            this, SLOT(slotInputValueChanged(quint32,quint32)));
    connect(m_presetInputWidget, SIGNAL(keySequenceChanged(QKeySequence)),
            this, SLOT(slotKeySequenceChanged(QKeySequence)));

    connect(m_addPositionButton, SIGNAL(clicked(bool)),
            this, SLOT(slotAddPositionClicked()));
    connect(m_addEfxButton, SIGNAL(clicked(bool)),
            this, SLOT(slotAddEFXClicked()));
    connect(m_addSceneButton, SIGNAL(clicked(bool)),
            this, SLOT(slotAddSceneClicked()));
    connect(m_addFxGroupButton, SIGNAL(clicked(bool)),
            this, SLOT(slotAddFixtureGroupClicked()));
    connect(m_removePresetButton, SIGNAL(clicked()),
            this, SLOT(slotRemovePresetClicked()));
    connect(m_moveUpPresetButton, SIGNAL(clicked()),
            this, SLOT(slotMoveUpPresetClicked()));
    connect(m_moveDownPresetButton, SIGNAL(clicked()),
            this, SLOT(slotMoveDownPresetClicked()));
    connect(m_presetNameEdit, SIGNAL(textEdited(QString const&)),
            this, SLOT(slotPresetNameEdited(QString const&)));
    connect(m_presetsTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
            this, SLOT(slotPresetSelectionChanged()));

    m_xyArea = new VCXYPadArea(this);
    //m_xyArea->setFixedSize(140, 140);
    m_xyArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_xyArea->setMode(Doc::Operate);
    m_presetLayout->addWidget(m_xyArea);
    connect(m_xyArea, SIGNAL(positionChanged(QPointF)),
            this, SLOT(slotXYPadPositionChanged(QPointF)));

    foreach(const VCXYPadPreset *preset, m_xypad->presets())
    {
        m_presetList.append(new VCXYPadPreset(*preset));
        if (preset->m_id > m_lastAssignedID)
            m_lastAssignedID = preset->m_id;
    }

    updatePresetsTree();

    QSettings settings;
    QVariant var = settings.value(SETTINGS_GEOMETRY);
    if (var.isValid() == true)
        restoreGeometry(var.toByteArray());
    AppUtil::ensureWidgetIsVisible(this);

    m_doc->masterTimer()->registerDMXSource(this, "XYPadCfg");
}
void MediaPlayer :: setPosition(qint64 position)
{
    iPosition = position;
    emit positionChanged();
}
void MusicConnectionPool::poolConnect(const QString &from, const QString &to)
{
    QObject *first = m_para.value(from);
    QObject *second = m_para.value(to);
    if(first == nullptr || second == nullptr)
    {
        return;
    }

    if(from == "MusicPlayer" && to == "MusicLrcMakerWidget" )
    {
        QObject::connect(first, SIGNAL(positionChanged(qint64)), second,
                                SLOT(setCurrentPosition(qint64)));
    }

    if( (from == "MusicLocalSongsManagerWidget" && to == "MusicApplication") ||
        (from == "MusicMyDownloadRecordWidget" && to == "MusicApplication") )
    {
        QObject::connect(first, SIGNAL(addSongToPlay(QStringList)), second,
                                SLOT(addSongToPlayList(QStringList)));
    }

    if(from == "MusicTimerWidget" && to == "MusicApplicationObject" )
    {
        QObject::connect(first, SIGNAL(timerParameterChanged()), second,
                                SLOT(musicToolSetsParameter()));
    }

    if( (from == "MusicToolSetsWidget" && to == "MusicApplication") ||
        (from == "MusicApplicationObject" && to == "MusicApplication") )
    {
        QObject::connect(first, SIGNAL(getCurrentPlayList(QStringList&)), second,
                                SLOT(getCurrentPlayList(QStringList&)));
    }

    if(from == "MusicEqualizerDialog" && to == "MusicPlayer" )
    {
        QObject::connect(first, SIGNAL(setEqEffect(MIntList)), second,
                                SLOT(setEqEffect(MIntList)));
        QObject::connect(first, SIGNAL(setEnaleEffect(bool)), second,
                                SLOT(setEnaleEffect(bool)));
    }

    if(from == "MusicSongSearchOnlineTableWidget" && to == "MusicDownloadStatusLabel" )
    {
        QObject::connect(first, SIGNAL(showDownLoadInfoFor(MusicObject::DownLoadType)), second,
                                SLOT(showDownLoadInfoFor(MusicObject::DownLoadType)));
    }

    if(from == "MusicBgThemeDownload" && to == "MusicTopAreaWidget" )
    {
        QObject::connect(first, SIGNAL(musicBgDownloadFinished()), second,
                                SLOT(musicBgThemeDownloadFinished()));
    }

    if(from == "MusicSongSearchOnlineTableWidget" && to == "MusicSongsSummarizied" )
    {
        QObject::connect(first, SIGNAL(muiscSongToPlayListChanged(QString,QString,QString)), second,
                                SLOT(addNetMusicSongToList(QString,QString,QString)));
    }

    if(from == "MusicSongSearchOnlineTableWidget" && to == "MusicRightAreaWidget" )
    {
        QObject::connect(first, SIGNAL(restartSearchQuery(QString)), second,
                                SLOT(musicResearchButtonSearched(QString)));
    }

    if(from == "MusicNetworkThread" && to == "MusicDownloadStatusLabel" )
    {
        QObject::connect(first, SIGNAL(networkConnectionStateChanged(bool)), second,
                                SLOT(networkConnectionStateChanged(bool)));
    }

    if(from == "MusicSongSearchOnlineTableWidget" && to == "MusicQualityChoiceTableWidget" )
    {
        QObject::connect(first, SIGNAL(getQualityString(QString&)), second,
                                SLOT(getQualityString(QString&)));
        QObject::connect(second, SIGNAL(researchQueryByQuality()), first,
                                 SLOT(researchQueryByQuality()));
    }

    if(from == "MusicSongsListPlayWidget" && to == "MusicRightAreaWidget" )
    {
        QObject::connect(first, SIGNAL(videoButtonClicked(QString)), second,
                                SLOT(musicVideoButtonSearched(QString)));
    }

    if(from == "MusicVideoControl" && to == "MusicRightAreaWidget" )
    {
        QObject::connect(first, SIGNAL(musicVideoSetPopup(bool)), second,
                                SLOT(musicVideoSetPopup(bool)));
        QObject::connect(first, SIGNAL(musicVideoFullscreen(bool)), second,
                                SLOT(musicVideoFullscreen(bool)));
    }

    if(from == "MusicApplicationObject" && to == "MusicEnhancedWidget" )
    {
        QObject::connect(first, SIGNAL(enhancedMusicChanged(int)), second,
                                SLOT(setEnhancedMusicConfig(int)));
    }

    if(from == "MusicVideoControl" && to == "MusicVideoTableWidget" )
    {
        QObject::connect(first, SIGNAL(getMusicMvInfo(MusicSongAttributes&)), second,
                                SLOT(getMusicMvInfo(MusicSongAttributes&)));
        QObject::connect(first, SIGNAL(downloadLocalByControl()), second,
                                SLOT(downloadLocalFromControl()));
    }

}
Example #15
0
Player::Player(QWidget *parent)
    : QWidget(parent)
    , videoWidget(0)
    , coverLabel(0)
    , slider(0)
#ifndef PLAYER_NO_COLOROPTIONS
    , colorDialog(0)
#endif
{
//! [create-objs]
    player = new QMediaPlayer(this);
    // owned by PlaylistModel
    playlist = new QMediaPlaylist();
    player->setPlaylist(playlist);
//! [create-objs]

    connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
    connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
    connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged()));
    connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int)));
    connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
            this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
    connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int)));
    connect(player, SIGNAL(videoAvailableChanged(bool)), this, SLOT(videoAvailableChanged(bool)));
    connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));

//! [2]
    videoWidget = new VideoWidget(this);
    player->setVideoOutput(videoWidget);

    playlistModel = new PlaylistModel(this);
    playlistModel->setPlaylist(playlist);
//! [2]

    playlistView = new QListView(this);
    playlistView->setModel(playlistModel);
    playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));

    connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));

    slider = new QSlider(Qt::Horizontal, this);
    slider->setRange(0, player->duration() / 1000);

    labelDuration = new QLabel(this);
    connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));
    

    QPushButton *openButton = new QPushButton(tr("Open"), this);

    connect(openButton, SIGNAL(clicked()), this, SLOT(open()));

    PlayerControls *controls = new PlayerControls(this, player);
    controls->setState(player->state());
    controls->setVolume(player->volume());
    controls->setMuted(controls->isMuted());

    connect(controls, SIGNAL(play()), player, SLOT(play()));
    connect(controls, SIGNAL(pause()), player, SLOT(pause()));
    connect(controls, SIGNAL(stop()), player, SLOT(stop()));
    connect(controls, SIGNAL(next()), playlist, SLOT(next()));
    connect(controls, SIGNAL(previous()), this, SLOT(previousClicked()));
    connect(controls, SIGNAL(changeVolume(int)), player, SLOT(setVolume(int)));
    connect(controls, SIGNAL(changeMuting(bool)), player, SLOT(setMuted(bool)));
    connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal)));

    connect(controls, SIGNAL(stop()), videoWidget, SLOT(update()));

    connect(player, SIGNAL(stateChanged(QMediaPlayer::State)),
            controls, SLOT(setState(QMediaPlayer::State)));
    connect(player, SIGNAL(volumeChanged(int)), controls, SLOT(setVolume(int)));
    connect(player, SIGNAL(mutedChanged(bool)), controls, SLOT(setMuted(bool)));

    fullScreenButton = new QPushButton(tr("FullScreen"), this);
    fullScreenButton->setCheckable(true);

#ifndef PLAYER_NO_COLOROPTIONS
    colorButton = new QPushButton(tr("Color Options..."), this);
    colorButton->setEnabled(false);
    connect(colorButton, SIGNAL(clicked()), this, SLOT(showColorDialog()));
#endif

    QBoxLayout *displayLayout = new QHBoxLayout;
    displayLayout->addWidget(videoWidget, 2);
    displayLayout->addWidget(playlistView);

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addStretch(1);
    controlLayout->addWidget(controls);
    controlLayout->addStretch(1);
    controlLayout->addWidget(fullScreenButton);
#ifndef PLAYER_NO_COLOROPTIONS
    controlLayout->addWidget(colorButton);
#endif

    QBoxLayout *layout = new QVBoxLayout;
    layout->addLayout(displayLayout);
    QHBoxLayout *hLayout = new QHBoxLayout;
    hLayout->addWidget(slider);
    hLayout->addWidget(labelDuration);
    layout->addLayout(hLayout);
    layout->addLayout(controlLayout);

    setLayout(layout);

    if (!player->isAvailable()) {
        QMessageBox::warning(this, tr("Service not available"),
                             tr("The QMediaPlayer object does not have a valid service.\n"\
                                "Please check the media service plugins are installed."));

        controls->setEnabled(false);
        playlistView->setEnabled(false);
        openButton->setEnabled(false);
#ifndef PLAYER_NO_COLOROPTIONS
        colorButton->setEnabled(false);
#endif
        fullScreenButton->setEnabled(false);
    }

    metaDataChanged();

    QStringList arguments = qApp->arguments();
    arguments.removeAt(0);
    addToPlaylist(arguments);
}
Example #16
0
void GrlMedia::stop()
{
	m_player->stop();
	emit positionChanged(0);
	update();
}
Example #17
0
MusicWindow::MusicWindow(QWidget *parent) : MainWindow(parent)
{
    this->setWindowIcon(QIcon(":/images/icons/app_icon"));

    systemTrayIcon = new MySystemTrayIcon(this);
    connect(systemTrayIcon, SIGNAL(showWindow()), this, SLOT(show()));
    connect(systemTrayIcon, SIGNAL(quit()), this, SLOT(close()));

    player = new MyPlayer();
    connect(player, SIGNAL(playerStateChanged(int)), this, SLOT(playerStateChanged(int)));
    connect(player, SIGNAL(musicChanged(QString,int)), this, SLOT(musicChanged(QString,int)));

    topBar = new TopBar(this);
    connect(topBar, SIGNAL(setMinSize()), this, SLOT(showMinimized()));
    connect(topBar, SIGNAL(setMaxSize()), this, SLOT(setMaxSize()));
    connect(topBar, SIGNAL(closeWindow()), this, SLOT(hide()));
    connect(topBar, SIGNAL(quit()), this, SLOT(close()));
    connect(topBar, SIGNAL(setBackgroud(QString)), this, SLOT(setBackgroud(QString)));
    connect(topBar, SIGNAL(aboutQtMusic()), this, SLOT(aboutQtMusic()));

    fuctionPage = new QStackedWidget;
    fuctionPage->setMinimumWidth(200);

    lyricLabel = new LyricLabel(false, this);
    connect(player, SIGNAL(positionChanged(qint64)), lyricLabel, SLOT(postionChanged(qint64)));
    connect(lyricLabel, SIGNAL(changeTo(qint64)), player, SLOT(setPosition(qint64)));

    networkPage = new NetworkPage();

    QLabel *label2 = new QLabel("Network");
    label2->setAlignment(Qt::AlignCenter);
    QLabel *label3 = new QLabel("Download");
    label3->setAlignment(Qt::AlignCenter);
    fuctionPage->addWidget(lyricLabel);
    fuctionPage->addWidget(networkPage);
    fuctionPage->addWidget(label3);
    fuctionPage->setCurrentIndex(0);
    connect(topBar, SIGNAL(selectFuction(int)), fuctionPage, SLOT(setCurrentIndex(int)));

    musicPage = new MusicPage;
    musicPage->setMaximumWidth(500);
    musicPage->setMinimumWidth(300);
    connect(musicPage, SIGNAL(tryToCreateList(QString)), this, SLOT(tryToCreateList(QString)));
    connect(musicPage, SIGNAL(deleteList(QString)), this, SLOT(deleteList(QString)));
    connect(musicPage, SIGNAL(addMusics()), this, SLOT(addMusics()));
    connect(musicPage, SIGNAL(play(QString,int)), player, SLOT(playTheMusic(QString,int)));
    connect(musicPage, SIGNAL(removeTheMusic(QString,int)), this, SLOT(removeTheMusic(QString,int)));
    connect(musicPage, SIGNAL(removeAllMusics(QString)), this, SLOT(removeAllMusics(QString)));
    connect(musicPage, SIGNAL(moveMusic(QString,int,int)), this, SLOT(moveMusic(QString,int,int)));

    bottomBar = new BottomBar(this);
    connect(bottomBar, SIGNAL(setVoice(int)), player, SLOT(setVoice(int)));
    connect(bottomBar, SIGNAL(setMode(int)), player, SLOT(setPlayMode(int)));
    connect(bottomBar, SIGNAL(setPostion(qint64)), player, SLOT(setPosition(qint64)));
    connect(bottomBar, SIGNAL(setPostion(qint64)), lyricLabel, SLOT(setPostion(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), bottomBar, SLOT(setMaxDuration(qint64)));
    connect(player, SIGNAL(positionChanged(qint64)), bottomBar, SLOT(changePostionTo(qint64)));
    connect(musicPage, SIGNAL(play(QString,int)), bottomBar, SLOT(setPostionAvailable()));
    connect(bottomBar, SIGNAL(tryplay()), this, SLOT(clickPlay()));
    connect(bottomBar, SIGNAL(playPre()), this, SLOT(playPre()));
    connect(bottomBar, SIGNAL(playNext()), this, SLOT(playNext()));
    connect(systemTrayIcon, SIGNAL(setMode(int)), bottomBar, SLOT(setPlayMode(int)));
    connect(bottomBar, SIGNAL(setMode(int)), systemTrayIcon, SLOT(setPlayMode(int)));
    connect(bottomBar, SIGNAL(showLyric(QString)), topBar, SLOT(changeFuction(QString)));
    //connect(lyricLabel, SIGNAL(changeTo(qint64)), bottomBar, SLOT(changePostionTo(qint64)));
    //connect(lyricLabel, SIGNAL(changeTo(qint64)), bottomBar, SIGNAL(setPostion(qint64)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(topBar);

    QSplitter *splitter = new QSplitter(Qt::Horizontal, this);
    //设定分割窗口的分割条在拖动时是否为实时更新 true为实时更新 false则在拖动时只显示一条灰色的线条
    //在拖动到位并弹起鼠标后再显示分隔条
    splitter->setOpaqueResize(false);
    splitter->setChildrenCollapsible(false);
    splitter->addWidget(fuctionPage);
    splitter->addWidget(musicPage);
    splitter->setStretchFactor(0, 10);
    splitter->setStretchFactor(1, 1);
    splitter->setStyleSheet("QSplitter::handle { background-color: rgba(0,0,0,0%) }");
    splitter->setHandleWidth(4);
    mainLayout->addWidget(splitter);
    mainLayout->addWidget(bottomBar);
    mainLayout->setMargin(1);
    mainLayout->setSpacing(3);
    this->setLayout(mainLayout);

    dealMouse();
    readData();
}
Example #18
0
void TreeKeyIdx::root() {
	error = getTreeNodeFromIdxOffset(0, &currentNode);
	positionChanged();
}
Example #19
0
void ObxTreeView::reportPosition()
{
    emit positionChanged(currentPage(), pages());
}
Example #20
0
void TreeKeyIdx::copyFrom(const SWKey &ikey) {
	unsnappedKeyText = ikey;
	SWKey::copyFrom(ikey);
	positionChanged();
}
FastQSPWindow::FastQSPWindow(QWidget *parent)
    : QMainWindow(parent), gameWidth(800), gameHeight(600),
      aspectRatio(qreal(gameWidth) / qreal(gameHeight)), scaleFactor(1),
      gameIsOpen(false), netManager(),
      settings (QSettings::IniFormat, QSettings::UserScope, "FastQSP", "config")
{
// Init audio
#if QT_VERSION < 0x050000
  media = new Phonon::MediaObject(this);
  audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
  Phonon::createPath(media, audioOutput);
#else
  player = new QMediaPlayer();
#endif

  // Start timer
  timer.start();

  // Init view
  scene = new QGraphicsScene(this);
  graphicsView = new QGraphicsView(scene, this);
  graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  graphicsView->setUpdatesEnabled(true);
  graphicsView->setFrameStyle(QFrame::NoFrame);

  webView = new QGraphicsWebView();
  webView->page()->setNetworkAccessManager(&netManager);
  webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
  webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
  webView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
  scene->addItem(webView);
  scene->setBackgroundBrush(QBrush(QColor(0, 0, 0)));
  webView->setRenderHints(
      QPainter::Antialiasing | QPainter::HighQualityAntialiasing |
      QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform |
      QPainter::NonCosmeticDefaultPen);
  webView->settings()->setAttribute(QWebSettings::AutoLoadImages, true);
  webView->setAutoFillBackground(false);

  videoPlayer = new QMediaPlayer();
  videoItem = new QGraphicsVideoItem();
  videoItem->setSize(QSize(gameWidth + 4, gameHeight + 4));
  videoItem->setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
  videoPlayer->setVideoOutput(videoItem);
  videoPlayer->setMuted(true);
  videoPlayer->setNotifyInterval(500);
  scene->addItem(videoItem);
  videoItem->hide();

  savestatus = new QGraphicsTextItem;
  savestatus->setDefaultTextColor(Qt::yellow);
  QFont f;
  f.setBold(true);
  f.setPixelSize(20);
  savestatus->setFont(f);
  savestatus->setVisible(false);
  scene->addItem(savestatus);

  connect(videoPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(replayVideo(qint64)));

  // Filter context menu event
  graphicsView->viewport()->installEventFilter(this);

  // Creating menu
  //-File menu--------------------------------------------------------
  QMenu *fileMenu = new QMenu("File");
  fileMenu->addAction("Open file\tCtrl+O", this, SLOT(openFileDialog()));
  QShortcut *openFile = new QShortcut(QKeySequence("Ctrl+O"), this);
  connect(openFile, SIGNAL(activated()), SLOT(openFileDialog()));

//  fileMenu->addAction("Reload QSP file\tc", this, SLOT(openFileDialog())); //for powerairmax
//  QShortcut *reloadFile = new QShortcut(QKeySequence("c"), this); //for powerairmax
  fileMenu->addAction("Reload QSP file\tF3", this, SLOT(reloadQSP()));
  QShortcut *reloadFile = new QShortcut(QKeySequence("F3"), this);
  connect(reloadFile, SIGNAL(activated()), SLOT(reloadQSP()));

  fileMenu->addAction("Exit\tCtrl+Q", this, SLOT(close()));
  QShortcut *exit = new QShortcut(QKeySequence("Ctrl+Q"), this);
  connect(exit, SIGNAL(activated()), SLOT(close()));

  menuBar()->addMenu(fileMenu);

  //-Game menu--------------------------------------------------------
  gameMenu = new QMenu("Game");
  gameMenu->addAction("Save\tCtrl+S", this, SLOT(saveGameDialog()));
  QShortcut *save = new QShortcut(QKeySequence("Ctrl+S"), this);
  connect(save, SIGNAL(activated()), SLOT(saveGameDialog()));

  gameMenu->addAction("Load\tCtrl+L", this, SLOT(loadGameDialog()));
  QShortcut *load = new QShortcut(QKeySequence("Ctrl+L"), this);
  connect(load, SIGNAL(activated()), SLOT(loadGameDialog()));

//  gameMenu->addAction("Quicksave\tz", this, SLOT(saveGameDialog())); //for powerairmax
//  QShortcut *quicksave = new QShortcut(QKeySequence("z"), this); //for powerairmax
  gameMenu->addAction("Quicksave\tF5", this, SLOT(quicksave()));
  QShortcut *quicksave = new QShortcut(QKeySequence("F5"), this);
  connect(quicksave, SIGNAL(activated()), SLOT(quicksave()));

//  gameMenu->addAction("Quickload\tx", this, SLOT(loadGameDialog())); //for powerairmax
//  QShortcut *quickload = new QShortcut(QKeySequence("x"), this); //for powerairmax
  gameMenu->addAction("Quickload\tF2", this, SLOT(quickload()));
  QShortcut *quickload = new QShortcut(QKeySequence("F2"), this);
  connect(quickload, SIGNAL(activated()), SLOT(quickload()));

  gameMenu->addAction("Restart\tCtrl+R", this, SLOT(restartGame()));
  QShortcut *restart = new QShortcut(QKeySequence("Ctrl+R"), this);
  connect(restart, SIGNAL(activated()), SLOT(restartGame()));

  //Game shortcuts
  QShortcut *next = new QShortcut(QKeySequence("space"), this);
  connect(next, SIGNAL(activated()), SLOT(nextScreen()));

  QShortcut *prev= new QShortcut(QKeySequence("backspace"), this);
  connect(prev, SIGNAL(activated()), SLOT(prevScreen()));

  QShortcut *main_screen= new QShortcut(QKeySequence("escape"), this);
  connect(main_screen, SIGNAL(activated()), SLOT(gotoMainScreen()));

  ignoreCRCAction = new QAction("Ignore version check when loading", this);
  ignoreCRCAction->setCheckable(true);
  ignoreCRCAction->setChecked(settings.value("ignoreCRC", false).toBool());
  connect(ignoreCRCAction, SIGNAL(toggled(bool)), this, SLOT(saveIgnoreCRCState()));
  gameMenu->addAction(ignoreCRCAction);

  // TODO: slows the game, move saving to diffrent thread
  autosaveAction = new QAction("Autosave", this);
  autosaveAction->setCheckable(true);
  autosaveAction->setChecked(false);
  // gameMenu->addAction(autosave);

  menuBar()->addMenu(gameMenu);
  gameMenu->setDisabled(true);

  //-Other menu-------------------------------------------------------
  QMenu *otherMenu = new QMenu("Other");
  otherMenu->addAction("Fullscreen\tAlt+Enter", this, SLOT(toggleFullscreen()));
  QShortcut *fullscreen =
      new QShortcut(QKeySequence(Qt::Key_Return + Qt::AltModifier), this);
  otherMenu->addAction("Show html", this, SLOT(showHtml()));
  connect(fullscreen, SIGNAL(activated()), SLOT(toggleFullscreen()));

  muteAction = new QAction("Mute sound", this);
  muteAction ->setCheckable(true);
  muteAction ->setChecked(settings.value("mutedState", false).toBool());
  connect(muteAction, SIGNAL(toggled(bool)), this, SLOT(saveMutedState()));
  otherMenu->addAction(muteAction);

  menuBar()->addMenu(otherMenu);

  //-Help menu--------------------------------------------------------
  QMenu *helpMenu = new QMenu("Help");
  helpMenu->addAction("About", this, SLOT(about()));
  menuBar()->addMenu(helpMenu);
  //------------------------------------------------------------------

  connect(webView, SIGNAL(linkClicked(const QUrl &)),
          SLOT(linkClicked(const QUrl &)), Qt::DirectConnection);
  connect(webView, SIGNAL(loadFinished(bool)), SLOT(toggleUpdate()),
          Qt::DirectConnection);
  connect(webView, SIGNAL(loadStarted()), SLOT(toggleUpdate()),
          Qt::DirectConnection);

  setCentralWidget(graphicsView);

  // Initializing QSP
  QSPInit();
  QSPCallback::QSPCallback();

//  qDebug() << "QSP init finished";
}