VideoControl::VideoControl(QWidget *parent) : QWidget(parent) { setStyleSheet("background:black;"); m_timeSlider = new QSlider(Qt::Horizontal, this); m_menuButton = new QToolButton(this); m_playButton = new QPushButton(this); m_volumnButton = new QToolButton(this); m_volumnSlider = new QSlider(Qt::Vertical, this); m_volumnSlider->setRange(0, 100); m_volumnSlider->setValue(100); m_playButton->setIcon(QIcon(":/video/play")); m_volumnButton->setIcon(QIcon(":/video/volumn")); m_menuButton->setIcon(QIcon(":/video/menu")); m_playButton->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnButton->setCursor(QCursor(Qt::PointingHandCursor)); m_menuButton->setCursor(QCursor(Qt::PointingHandCursor)); m_timeSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_popupVolumn.setStyleSheet(BarrageCore::MMenuStyle01); m_timeSlider->setStyleSheet(BarrageCore::MSliderStyle02); m_volumnSlider->setStyleSheet(BarrageCore::MSliderStyle01); m_playButton->setStyleSheet(BarrageCore::MPushButtonStyle02); m_volumnButton->setStyleSheet(BarrageCore::MToolButtonStyle02); m_menuButton->setStyleSheet(BarrageCore::MToolButtonStyle02); QVBoxLayout *controlVLayout = new QVBoxLayout(this); controlVLayout->setSpacing(0); controlVLayout->setContentsMargins(0, 0, 0, 0); QWidget *controlBWidget = new QWidget(this); QHBoxLayout *controlBLayout = new QHBoxLayout(controlBWidget); controlBLayout->setContentsMargins(9, 0, 9, 0); controlBLayout->addWidget(m_menuButton); controlBLayout->addWidget(m_playButton); controlBLayout->addWidget(m_volumnButton); controlBLayout->addStretch(1); controlBLayout->addWidget(createBarrageWidget(), 15); controlBLayout->addStretch(1); controlBWidget->setLayout(controlBLayout); controlVLayout->addWidget(m_timeSlider); controlVLayout->addWidget(controlBWidget); setLayout(controlVLayout); QWidgetAction *widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(m_volumnSlider); m_popupVolumn.addAction(widgetAction); m_volumnButton->setMenu(&m_popupVolumn); m_volumnButton->setPopupMode(QToolButton::InstantPopup); connect(m_menuButton, SIGNAL(clicked()), SLOT(openFileDialog())); connect(m_timeSlider, SIGNAL(sliderReleased()), SLOT(sliderReleased())); connect(m_volumnSlider, SIGNAL(valueChanged(int)), parent, SLOT(volumnChanged(int))); connect(m_playButton, SIGNAL(clicked()), parent, SLOT(play())); }
MusicVideoControl::MusicVideoControl(bool popup, QWidget *parent) : QWidget(parent), m_widgetPopup(popup) { m_timeSlider = new MusicMovingLabelSlider(Qt::Horizontal, this); m_menuButton = new QToolButton(this); m_playButton = new QPushButton(this); m_inSideButton = new QPushButton(this); m_fullButton = new QPushButton(this); m_qualityButton = new QPushButton(tr("NormalMV"), this); m_downloadButton = new QPushButton(tr("DownloadMV"), this); m_volumnButton = new QToolButton(this); m_volumnSlider = new QSlider(Qt::Vertical,this); m_volumnSlider->setRange(0, 100); m_volumnSlider->setValue(100); m_playButton->setIcon(QIcon(":/video/play")); m_volumnButton->setIcon(QIcon(":/video/volumn")); m_menuButton->setIcon(QIcon(":/video/menu")); m_inSideButton->setText(popup ? tr("InlineMode") : tr("PopupMode")); m_fullButton->setText(tr("FullScreenMode")); m_fullButton->setEnabled( popup ); m_inSideButton->setStyleSheet(MusicUIObject::MPushButtonStyle17); m_fullButton->setStyleSheet(MusicUIObject::MPushButtonStyle17); m_qualityButton->setStyleSheet(MusicUIObject::MPushButtonStyle17); m_downloadButton->setStyleSheet(MusicUIObject::MPushButtonStyle17); m_playButton->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnButton->setCursor(QCursor(Qt::PointingHandCursor)); m_menuButton->setCursor(QCursor(Qt::PointingHandCursor)); m_timeSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_inSideButton->setCursor(QCursor(Qt::PointingHandCursor)); m_fullButton->setCursor(QCursor(Qt::PointingHandCursor)); m_qualityButton->setCursor(QCursor(Qt::PointingHandCursor)); m_downloadButton->setCursor(QCursor(Qt::PointingHandCursor)); m_popupVolumn.setStyleSheet(MusicUIObject::MMenuStyle01); m_popupQuality.setStyleSheet(MusicUIObject::MMenuStyle01); m_timeSlider->setStyleSheet(MusicUIObject::MSliderStyle04); m_volumnSlider->setStyleSheet(MusicUIObject::MSliderStyle02); QVBoxLayout *controlVLayout = new QVBoxLayout(this); controlVLayout->setSpacing(0); controlVLayout->setContentsMargins(0, 0, 0, 0); QWidget *controlBWidget = new QWidget(this); QHBoxLayout *controlBLayout = new QHBoxLayout(controlBWidget); controlBLayout->setContentsMargins(9, 0, 9, 0); controlBLayout->addWidget(m_menuButton); controlBLayout->addWidget(m_playButton); controlBLayout->addWidget(m_volumnButton); controlBLayout->addStretch(1); controlBLayout->addWidget(createBarrageWidget(), 15); controlBLayout->addStretch(1); controlBLayout->addWidget(m_qualityButton); controlBLayout->addWidget(m_downloadButton); controlBLayout->addWidget(m_inSideButton); controlBLayout->addWidget(m_fullButton); controlBWidget->setLayout(controlBLayout); controlVLayout->addWidget(m_timeSlider); controlVLayout->addWidget(controlBWidget); setLayout(controlVLayout); QWidgetAction *widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(m_volumnSlider); m_popupVolumn.addAction(widgetAction); m_volumnButton->setMenu(&m_popupVolumn); m_volumnButton->setPopupMode(QToolButton::InstantPopup); m_mvSd = m_popupQuality.addAction(tr("SdMV")); m_mvHd = m_popupQuality.addAction(tr("HdMV")); m_mvSq = m_popupQuality.addAction(tr("SqMV")); connect(&m_popupQuality, SIGNAL(triggered(QAction*)), SLOT(menuActionTriggered(QAction*))); m_qualityButton->setMenu(&m_popupQuality); connect(m_timeSlider, SIGNAL(sliderReleasedAt(int)), SIGNAL(sliderValueChanged(int))); connect(m_volumnSlider, SIGNAL(valueChanged(int)), parent, SLOT(volumnChanged(int))); connect(m_playButton, SIGNAL(clicked()), parent, SLOT(play())); connect(m_inSideButton, SIGNAL(clicked()), SLOT(inSideButtonClicked())); connect(m_fullButton, SIGNAL(clicked()), SLOT(fullButtonClicked())); connect(m_downloadButton, SIGNAL(clicked()), SIGNAL(downloadLocalByControl())); M_CONNECTION->setValue("MusicVideoControl", this); M_CONNECTION->poolConnect("MusicVideoControl", "MusicRightAreaWidget"); M_CONNECTION->poolConnect("MusicVideoControl", "MusicVideoTableWidget"); }