void MusicMyDownloadRecordWidget::contextMenuEvent(QContextMenuEvent *event) { MusicAbstractTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlay())); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir())); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt())); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll())); rightClickMenu.exec(QCursor::pos()); event->accept(); }
void MusicSongsListWidget::contextMenuEvent(QContextMenuEvent *event) { QTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); QMenu musicPlaybackMode(tr("playbackMode"), &rightClickMenu); bool empty; emit isSearchFileListEmpty(empty); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(tr("changSongName"), this, SLOT(setChangSongName()))->setEnabled(empty); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlayClicked())); rightClickMenu.addMenu(&musicPlaybackMode); QAction *order = musicPlaybackMode.addAction(tr("OrderPlay"), this, SIGNAL(musicPlayOrder())); QAction *random = musicPlaybackMode.addAction(tr("RandomPlay"), this, SIGNAL(musicPlayRandom())); QAction *lCycle = musicPlaybackMode.addAction(tr("ListCycle"), this, SIGNAL(musicPlayListLoop())); QAction *sCycle = musicPlaybackMode.addAction(tr("SingleCycle"), this, SIGNAL(musicPlayOneLoop())); QAction *once = musicPlaybackMode.addAction(tr("PlayOnce"), this, SIGNAL(musicPlayItemOnce())); (m_songplaymode == MusicObject::MC_PlayOrder) ? order->setIcon(QIcon(":/share/selected")) : order->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayRandom) ? random->setIcon(QIcon(":/share/selected")) : random->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayListLoop) ? lCycle->setIcon(QIcon(":/share/selected")) : lCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOneLoop) ? sCycle->setIcon(QIcon(":/share/selected")) : sCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOnce) ? once->setIcon(QIcon(":/share/selected")) : once->setIcon(QIcon()); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/love"), tr("addToLove"), this, SLOT(addMusicSongToLovestListAt())); QMenu musicAddNewFiles(tr("addNewFiles"), &rightClickMenu); rightClickMenu.addMenu(&musicAddNewFiles)->setIcon(QIcon(":/contextMenu/add")); musicAddNewFiles.addAction(tr("openOnlyFiles"), this, SIGNAL(musicAddNewFiles())); musicAddNewFiles.addAction(tr("openOnlyDir"), this, SIGNAL(musicAddNewDir())); QMenu musicToolMenu(tr("musicTool"), &rightClickMenu); musicToolMenu.addAction(tr("bell"), this, SLOT(musicMakeRingWidget())) #ifdef Q_OS_UNIX ->setEnabled(false); #endif ; musicToolMenu.addAction(tr("transform"), this, SLOT(musicTransformWidget())); rightClickMenu.addMenu(&musicToolMenu); rightClickMenu.addAction(tr("musicInfoD"), this, SLOT(musicFileInformation()))->setEnabled(empty); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir()))->setEnabled(empty); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt()))->setEnabled(empty); rightClickMenu.addAction(tr("deleteWithFile"), this, SLOT(setDeleteItemWithFile()))->setEnabled(empty); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll()))->setEnabled(empty); rightClickMenu.exec(QCursor::pos()); //Menu location for the current mouse position event->accept(); }
void MusicSongsListWidget::listCellClicked(int row, int column) { //the playing widget allow deleting if(row == m_playRowIndex) { return; } switch(column) { case 2: setDeleteItemAt(); break; default: break; } }
void MusicMyDownloadRecordWidget::setDeleteItemAll() { selectAll(); setDeleteItemAt(); }
MusicSongsListPlayWidget::MusicSongsListPlayWidget(int index, QWidget *parent) : MusicSongsEnterPlayWidget(index, parent), m_renameLine(nullptr) { m_totalTime = "/00:00"; m_artPictureLabel = new QLabel(this); m_artPictureLabel->setFixedSize(60, 60); m_artPictureLabel->setAttribute(Qt::WA_TranslucentBackground); m_artPictureLabel->setGeometry(0, 0, 60, 60); m_songNameLabel = new QLabel(this); m_songNameLabel->setFixedSize(202, 25); m_songNameLabel->setAttribute(Qt::WA_TranslucentBackground); m_songNameLabel->setStyleSheet(MusicUIObject::MCustomStyle11); m_songNameLabel->setGeometry(65, 5, 182, 25); m_timeLabel = new QLabel(this); m_timeLabel->setFixedSize(100, 20); m_timeLabel->setAttribute(Qt::WA_TranslucentBackground); m_timeLabel->setStyleSheet(MusicUIObject::MCustomStyle11); m_timeLabel->setGeometry(65, 37, 100, 20); m_columnOne = new MusicSongsEnterPlayWidget(index, this); m_columnThree = new MusicSongsEnterPlayWidget(index, this); m_loveButton = new QPushButton(this); m_loveButton->setGeometry(214, 35, 23, 23); m_loveButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 ); m_loveButton->setCursor(QCursor(Qt::PointingHandCursor)); m_loveButton->setToolTip(tr("bestlove")); currentLoveStateClicked(); m_deleteButton = new QPushButton(this); m_deleteButton->setGeometry(235, 35, 23, 23); m_deleteButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 ); m_deleteButton->setIcon(QIcon(":/image/musicdelete")); m_deleteButton->setCursor(QCursor(Qt::PointingHandCursor)); m_deleteButton->setToolTip(tr("deleteMusic")); m_downloadButton = new QPushButton(this); m_downloadButton->setGeometry(170, 35, 23, 23); m_downloadButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 ); m_downloadButton->setIconSize(QSize(23, 23)); m_downloadButton->setCursor(QCursor(Qt::PointingHandCursor)); m_downloadButton->setToolTip(tr("songDownload")); currentDownloadStateClicked(); m_showMVButton = new QPushButton(m_columnThree); m_showMVButton->setGeometry(0, 35, 23, 23); m_showMVButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 ); m_showMVButton->setIcon(QIcon(":/share/showMV2")); m_showMVButton->setCursor(QCursor(Qt::PointingHandCursor)); m_showMVButton->setToolTip(tr("showMV")); m_songShareButton = new QPushButton(m_columnThree); m_songShareButton->setGeometry(0, 7, 23, 23); m_songShareButton->setStyleSheet( MusicUIObject::MPushButtonStyle13 ); m_songShareButton->setIcon(QIcon(":/image/songShare")); m_songShareButton->setCursor(QCursor(Qt::PointingHandCursor)); m_songShareButton->setToolTip(tr("songShare")); connect(m_loveButton, SIGNAL(clicked()), SIGNAL(currentLoveStateChanged())); connect(m_downloadButton, SIGNAL(clicked()), SIGNAL(currentDownloadStateChanged())); connect(m_deleteButton, SIGNAL(clicked()), parent, SLOT(setDeleteItemAt())); connect(this, SIGNAL(renameFinished(QString)), parent, SLOT(setItemRenameFinished(QString))); connect(this, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int))); connect(m_columnOne, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int))); connect(m_columnThree, SIGNAL(enterChanged(int,int)), parent, SLOT(listCellEntered(int,int))); connect(m_showMVButton, SIGNAL(clicked()), SLOT(showMVButtonClicked())); connect(m_songShareButton, SIGNAL(clicked()), SLOT(sharingButtonClicked())); M_CONNECTION->setValue("MusicSongsListPlayWidget", this); M_CONNECTION->poolConnect("MusicSongsListPlayWidget", "MusicRightAreaWidget"); M_CONNECTION->poolConnect("MusicSongsListPlayWidget", "MusicApplication"); M_CONNECTION->poolConnect("MusicLeftAreaWidget", "MusicSongsListPlayWidget"); }
void MusicSongsListWidget::setDeleteItemWithFile() { m_deleteItemWithFile = true; setDeleteItemAt(); m_deleteItemWithFile = false; }
void MusicSongsListWidget::setDeleteItemAll() { selectAll(); setDeleteItemAt(); }