Beispiel #1
0
void WidgetArea::moveEvent(QMoveEvent *event)
{
    if(m_skipNextMove)
        m_skipNextMove = false;
    else
        moveWidgets(event->oldPos() - pos());
}
Beispiel #2
0
void WidgetArea::mouseMoveEvent(QMouseEvent *event)
{
    if(event->buttons() != Qt::LeftButton)
        return;

    if(!m_draggin)
    {
        if ((event->globalPos() - m_mouse_orig).manhattanLength() < QApplication::startDragDistance())
              return;
        m_draggin = true;
    }

    QPoint n = event->globalPos() - m_mouse_orig;

    if(!m_active_bookmk)
    {
        moveWidgets(n);

        if(m_prev)
            m_prev->prepareRender();
        else if(m_actShowPreview->isChecked())
            m_prev = new WidgetAreaPreview(this, (QWidget*)parent());
    }
    else
    {
        m_active_bookmk->main += n;
        update();
    }

    m_mouse_orig = event->globalPos();
}
    void LayerManager::setView(const QPointF& coordinate)
    {
        QPoint oldMapPx = mapmiddle_px;

        mapmiddle_px = layer()->mapadapter()->coordinateToDisplay(coordinate);

        scroll += mapmiddle_px - oldMapPx;
        zoomImageScroll+= mapmiddle_px - oldMapPx;


        mapmiddle = coordinate;

        //TODO: muss wegen moveTo() raus
        if (!checkOffscreen())
        {
            newOffscreenImage();
        }
        else
        {
            //TODO:
            // verschiebung ausrechnen
            // oder immer neues offscreenimage
            //newOffscreenImage();
            moveWidgets();
        }
    }
Beispiel #4
0
void WidgetArea::wheelEvent(QWheelEvent *ev)
{
    // Move area only if the mouse is not in some of the widgets
    QPoint pos = mapFromGlobal(QCursor::pos());
    for(w_map::iterator itr = m_widgets.begin(); itr != m_widgets.end(); ++itr)
        if((*itr)->geometry().contains(pos))
            return;

    int move = qApp->wheelScrollLines()*10*(float(ev->delta())/120);
    switch(ev->orientation())
    {
        case Qt::Vertical:
            moveWidgets(QPoint(0, move));
            break;
        case Qt::Horizontal:
            moveWidgets(QPoint(move, 0));
            break;
    }
}
    void LayerManager::scrollView(const QPoint& point)
    {
        scroll += point;
        zoomImageScroll+=point;
        mapmiddle_px += point;

        mapmiddle = layer()->mapadapter()->displayToCoordinate(mapmiddle_px);
        if (!checkOffscreen())
        {
            newOffscreenImage();
        }
        else
        {
            moveWidgets();
        }
    }
Beispiel #6
0
MusicControl::MusicControl(QWidget *parent) : QWidget(parent)
{
    setStyleSheet("QPushButton{ background-color: transparent; border: none; color:white; }"
                  "QPushButton:pressed{ background-color: qradialgradient(spread:pad, cx:0.468355, cy:0.472, radius:0.449, fx:0.472658, fy:0.477045, stop:0.261603 rgba(255, 255, 255, 130), stop:1 rgba(255, 255, 255, 0));}"
                  "QPushButton:checked{ background-color: qradialgradient(spread:pad, cx:0.468355, cy:0.472, radius:0.449, fx:0.472658, fy:0.477045, stop:0.261603 rgba(255, 255, 255, 130), stop:1 rgba(255, 255, 255, 0));}"
                  "QLabel{ color:white; }");

    m_c = Core::instance();
    connect(m_c, SIGNAL(lengthChanged()), this, SLOT(updateTime()));
    connect(m_c, SIGNAL(posChanged(int)), this, SLOT(updateTime()));
    connect(m_c, SIGNAL(tagsChanged()), this, SLOT(showTags()));
    connect(m_c, SIGNAL(currentMusicChanged()), this, SLOT(musicChanged()));
    connect(m_c, SIGNAL(videoAppearanceChanged(bool)), this, SLOT(moveWidgets()));
    connect(m_c, SIGNAL(isPlayingChanged()), this, SLOT(isPlayingChanged()));

    m_cover = new Cover(this);

    m_musicTagsLabel = new QLabel(this);
    m_musicTagsLabel->setAlignment(Qt::AlignCenter);
    m_musicTagsLabel->setText(QString(tr("<b>Welcome!</b>")));
    QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
    shadowEffect->setOffset(1, 1);
    m_musicTagsLabel->setGraphicsEffect(shadowEffect);

//Player button, slider and label
    m_previousButton = new QPushButton(this);
    m_previousButton->setIcon(QIcon(QString(":/Player_Previous.png")));
    m_previousButton->setIconSize(QSize(32, 32));
    m_previousButton->setShortcut(QKeySequence(Qt::Key_Left));
    m_previousButton->setToolTip(tr("Previous media in the playlist"));
    connect(m_previousButton, SIGNAL(clicked()), this, SLOT(previous()));

    m_playButton = new QPushButton(this);
    m_playButton->setIcon(QIcon(QString(":/Player_Play.png")));
    m_playButton->setIconSize(QSize(50, 50));
    m_playButton->setShortcut(QKeySequence(Qt::Key_Space));
    m_playButton->setToolTip(tr("Play/Pause"));
    connect(m_playButton, SIGNAL(clicked()), this, SLOT(play()));

    m_nextButton = new QPushButton(this);
    m_nextButton->setIcon(QIcon(QString(":/Player_Next.png")));
    m_nextButton->setIconSize(QSize(32, 32));
    m_nextButton->setShortcut(QKeySequence(Qt::Key_Right));
    m_nextButton->setToolTip(tr("Next media in the playlist"));
    connect(m_nextButton, SIGNAL(clicked()), this, SLOT(next()));

    m_volumeIcon = new QPushButton(this);
    m_volumeIcon->setIcon(QIcon(":/Volume.png"));
    m_volumeIcon->setIconSize(m_volumeIcon->size());
    m_volumeIcon->setToolTip(tr("Mute or not"));
    connect(m_volumeIcon, SIGNAL(clicked()), this, SLOT(mute()));
    m_volumeIcon->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));

    m_volumeSlider = new QSlider(this);
    m_volumeSlider->setOrientation(Qt::Vertical);
    m_volumeSlider->setToolTip(tr("Change the volume"));
    m_volumeSlider->setValue(m_c->volume());
    m_volumeSlider->setMaximum(200);
    connect(m_volumeSlider, SIGNAL(valueChanged(int)), m_c, SLOT(setVolume(int)));

    m_seekSlider = new QSlider(this);
    m_seekSlider->setOrientation(Qt::Horizontal);
    m_seekSlider->setToolTip(tr("Change the position in the media"));
    connect(m_seekSlider, SIGNAL(sliderMoved(int)), m_c, SLOT(setPosition(int)));

    m_timeLabel = new QLabel(this);
    m_timeLabel->setMinimumSize(150, 0);
    m_timeLabel->setAlignment(Qt::AlignRight);
    m_timeLabel->setText("0:00 / 0:00");

    m_randButton = new QPushButton(this);
    m_randButton->setIconSize(QSize(22, 22));
    m_randButton->setIcon(QIcon(QString(":/Random.png")));
    m_randButton->setCheckable(true);
    m_randButton->setToolTip(tr("Random medias in the playlist or not"));
    m_randButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));

    m_repeatButton = new QPushButton(this);
    m_repeatButton->setIconSize(QSize(22, 22));
    m_repeatButton->setIcon(QIcon(QString(":/Repeat.png")));
    m_repeatButton->setCheckable(true);
    m_repeatButton->setToolTip(tr("Repeat the media or not"));
    m_repeatButton->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));

    moveWidgets();
}
Beispiel #7
0
void MusicControl::resizeEvent(QResizeEvent *)
{
    moveWidgets();
}