#include "iceplayer.h"
IcePlayer::IcePlayer(QWidget *parent)
: QWidget(parent)
{
ice_init_ui();
ice_init_player();
ice_init_connections();
ice_init_windows();
ice_init_menu_actions();
ice_init_network();
iceDir = QApplication::applicationDirPath();
ice_read_list();
}
IcePlayer::~IcePlayer()
{
}
void IcePlayer::ice_init_windows()
{
aboutForm = new ICE_About_Form(this);
iceLrc = new ICE_Lrc(this);
miniForm = new miniwindow();
miniForm->ICE_Set_Parent(this);
miniForm->hide();
}
void IcePlayer::ice_init_menu_actions()
{
modeSingal = new QAction(QString::fromLocal8Bit("单曲播放"), this);
modeListCircle = new QAction(QString::fromLocal8Bit("列表循环"), this);
modeSingalCircle = new QAction(QString::fromLocal8Bit("单曲循环"), this);
modeRandom = new QAction(QString::fromLocal8Bit("随机播放"), this);
connect(modeSingal, SIGNAL(triggered()), this, SLOT(ice_set_play_mode()));
connect(modeListCircle, SIGNAL(triggered()), this, SLOT(ice_set_play_mode()));
connect(modeSingalCircle, SIGNAL(triggered()), this, SLOT(ice_set_play_mode()));
connect(modeRandom, SIGNAL(triggered()), this, SLOT(ice_set_play_mode()));
modeActionGroup = new QActionGroup(this);
modeActionGroup->addAction(modeSingal);
modeActionGroup->addAction(modeListCircle);
modeActionGroup->addAction(modeSingalCircle);
modeActionGroup->addAction(modeRandom);
modeSingal->setCheckable(true);
modeListCircle->setCheckable(true);
modeSingalCircle->setCheckable(true);
modeRandom->setCheckable(true);
modeSingal->setChecked(true);
playModeMenu = new QMenu(modeButton);
playModeMenu->setStyleSheet(
"QMenu{padding:5px;background:white;border:1px solid gray;}"
"QMenu::item{padding:0px 40px 0px 30px;height:25px;}"
"QMenu::item:selected:enabled{background:#0096ff;color:white;}"
"QMenu::item:selected:!enabled{background:transparent;}"
"QMenu::separator{height:1px;background:lightgray;margin:5px 0px 5px 0px;}");
playModeMenu->addActions(modeActionGroup->actions());
contextMenuLess = new QMenu(playlistTable);
contextMenuMore = new QMenu(playlistTable);
addMusic = new QAction(QString::fromLocal8Bit("添加歌曲"),this);
addFileDiv = new QAction(QString::fromLocal8Bit("添加目录"),this);
removeCurr = new QAction(QString::fromLocal8Bit("移除本曲"),this);
removeAll = new QAction(QString::fromLocal8Bit("移除所有"),this);
connect(addMusic, SIGNAL(triggered()), this, SLOT(ice_open_music()));
connect(addFileDiv, SIGNAL(triggered()), this, SLOT(ice_open_dir()));
connect(removeCurr, SIGNAL(triggered()), this, SLOT(ice_remove_current_music()));
connect(removeAll, SIGNAL(triggered()), this, SLOT(ice_clear_list()));
contextMenuLess->addAction(addMusic);
contextMenuLess->addAction(addFileDiv);
contextMenuLess->addSeparator();
contextMenuLess->addAction(removeAll);
contextMenuMore->addAction(addMusic);
contextMenuMore->addAction(addFileDiv);
contextMenuMore->addSeparator();
contextMenuMore->addAction(removeCurr);
contextMenuMore->addAction(removeAll);
contextMenuLess->setStyleSheet(
"QMenu{padding:5px;background:white;border:1px solid gray;}"
"QMenu::item{padding:0px 40px 0px 30px;height:25px;}"
"QMenu::item:selected:enabled{background:#0096ff;color:white;}"
"QMenu::item:selected:!enabled{background:transparent;}"
"QMenu::separator{height:1px;background:lightgray;margin:5px 0px 5px 0px;}");
contextMenuMore->setStyleSheet(
"QMenu{padding:5px;background:white;border:1px solid gray;}"
"QMenu::item{padding:0px 40px 0px 30px;height:25px;}"
"QMenu::item:selected:enabled{background:#0096ff;color:white;}"
"QMenu::item:selected:!enabled{background:transparent;}"
"QMenu::separator{height:1px;background:lightgray;margin:5px 0px 5px 0px;}");
}
void IcePlayer::ice_init_player()
{
mediaPlayer = new QMediaPlayer(this);
mediaList = new QMediaPlaylist(this);
mediaPlayer->setPlaylist(mediaList);
playMode = ICE_Play_Mode::SINGAL;
preIndex = -1;
currentIndex = 0;
mediaList->setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
}
void IcePlayer::ice_init_connections()
{
connect(mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(ice_update_position(qint64)));
connect(mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(ice_update_duration(qint64)));
connect(mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),this, SLOT(ice_update_state(QMediaPlayer::State)));
connect(mediaPlayer, SIGNAL(metaDataChanged()), this, SLOT(ice_update_meta_data()));
connect(playSlider, SIGNAL(sliderMoved(int)), this, SLOT(ice_set_play_position(int)));
connect(playSlider, SIGNAL(sliderReleased()), this, SLOT(ice_set_position()));
connect(volButton, SIGNAL(ICE_Volume_Changed(int)), mediaPlayer, SLOT(setVolume(int)));
connect(playlistTable, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(ice_playlisttable_cell_double_clicked(int, int)));
connect(playlistTable, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ice_playlisttable_menu_requested(const QPoint &)));
connect(addButton, SIGNAL(clicked()), this, SLOT(ice_open_music()));
connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(playButton, SIGNAL(clicked()), this, SLOT(ice_play_button_clicked()));
connect(lyricButton, SIGNAL(clicked()), this, SLOT(ice_lyric_button_clicked()));
connect(logoButton, SIGNAL(clicked()), this, SLOT(ice_logo_button_clicked()));
connect(modeButton, SIGNAL(clicked()), this, SLOT(ice_mode_button_clicked()));
connect(nextButton, SIGNAL(clicked()), this, SLOT(ice_next_button_clicked()));
connect(lastButton, SIGNAL(clicked()), this, SLOT(ice_last_button_clicked()));
connect(pauseButton, SIGNAL(clicked()), this, SLOT(ice_pause_button_clicked()));
connect(minButton, SIGNAL(clicked()), this, SLOT(ice_min_button_clicked()));
connect(mminButton, SIGNAL(clicked()), this, SLOT(showMinimized()));
//connect(this, SIGNAL(destroyed()), this, SLOT(ice_close()));
//connect(mediaList, SIGNAL(mediaInserted()), this, SLOT(ice_write_list()));
}
void IcePlayer::ice_init_ui()
{
picLabel = new QLabel( this);
picLabel->setGeometry(QRect(40, 45, 100, 100));
picLabel->setScaledContents(true);
picLabel->setPixmap(QPixmap(":/IcePlayer/Resources/default_album.jpg"));
nameLabel = new IceLabel(this);
nameLabel->setGeometry(QRect(150, 55, 220, 20));
musicianLabel = new QLabel(this);
musicianLabel->setGeometry(QRect(150, 85, 220, 15));
albumLabel = new QLabel(this);
albumLabel->setGeometry(QRect(150, 115, 220, 15));
playSlider = new QSlider( this);
playSlider->setObjectName(QStringLiteral("playSlider"));
playSlider->setStyleSheet("QSlider::groove:horizontal{border:0px;height:4px;}"
"QSlider::sub-page:horizontal{background:#0096ff;}"
"QSlider::add-page:horizontal{background:lightgray;} "
"QSlider::handle:horizontal{background:white;width:10px;border:#51b5fb 10px;border-radius:5px;margin:-3px 0px -3px 0px;}");
playSlider->setGeometry(QRect(40, 150, 290, 20));
playSlider->setOrientation(Qt::Horizontal);
timeLabel = new QLabel( this);
timeLabel->setObjectName(QStringLiteral("timeLabel"));
timeLabel->setGeometry(QRect(340, 150, 51, 16));
playlistTable = new QTableWidget( this);
playlistTable->setObjectName(QStringLiteral("playlistTable"));
playlistTable->setGeometry(QRect(25, 240, 350, 320));
playlistTable->setItemDelegate(new NoFocusDelegate());
addButton = new ICE_Ice_Button( this);
addButton->setObjectName(QStringLiteral("addButton"));
addButton->setGeometry(QRect(40, 190, 31, 31));
modeButton = new ICE_Ice_Button( this);
modeButton->setObjectName(QStringLiteral("modeButton"));
modeButton->setGeometry(QRect(290, 190, 31, 31));
lastButton = new ICE_Ice_Button( this);
lastButton->setObjectName(QStringLiteral("lastButton"));
lastButton->setGeometry(QRect(120, 185, 41, 41));
nextButton = new ICE_Ice_Button( this);
nextButton->setObjectName(QStringLiteral("nextButton"));
nextButton->setGeometry(QRect(240, 185, 41, 41));
lyricButton = new ICE_Ice_Button( this);
lyricButton->setObjectName(QStringLiteral("lyricButton"));
没有合适的资源?快使用搜索试试~ 我知道了~
漂亮的音乐播放器 A Nice Music Player by Qt5 and C++.zip
共76个文件
png:37个
h:14个
cpp:13个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 11 浏览量
2022-04-28
20:52:58
上传
评论
收藏 407KB ZIP 举报
温馨提示
漂亮的音乐播放器 A Nice Music Player by Qt5 and C++.zip 大学生课程设计 基于C++的课程设计 自己大二写的课程设计
资源推荐
资源详情
资源评论
收起资源包目录
漂亮的音乐播放器 A Nice Music Player by Qt5 and C++.zip (76个子文件)
IcePlayer-master
ICEPLAYER
ICEPLAYER.vcxproj 85KB
logo.ico 13KB
ICEPLAYER.vcxproj.filters 10KB
nofocusdelegate.cpp 360B
mini.cpp 8KB
iceplayer.cpp 39KB
about.cpp 2KB
about.h 314B
~AutoRecover.ICEPLAYER.vcxproj 69KB
mini.h 1KB
network.h 847B
iceplayer.qrc 2KB
iceButton.h 800B
IcePlayer.rc 58B
single_application.cpp 2KB
icevolbutton.h 838B
aboutform.cpp 2KB
single_application.h 594B
lyric.cpp 4KB
iceButton.cpp 1KB
Resources
缩小按钮.png 18KB
default_album.jpg 107KB
音量调节.png 19KB
前进按钮mini.png 19KB
mini.png 22KB
添加歌曲2.png 18KB
暂停按钮-主界面2.png 26KB
播放按钮-主界面2.png 25KB
关闭按钮2.png 22KB
lrc_background.png 269KB
mini底部窗口(2).png 26KB
暂停按钮mini.png 20KB
background.png 22KB
上一曲2.png 20KB
歌词按钮.png 20KB
logo-16.png 18KB
下一曲.png 19KB
左上角logo按钮.png 28KB
下一曲2.png 20KB
左上角logo按钮2.png 29KB
暂停按钮-主界面.png 25KB
logo-48.png 21KB
about.png 491KB
上一曲.png 22KB
full.png 271KB
播放模式.png 19KB
播放按钮-主界面.png 23KB
logo-32.png 20KB
关闭按钮.png 21KB
迷你模式按钮2.png 20KB
音量调节2.png 20KB
歌词按钮2.png 20KB
迷你模式按钮.png 19KB
添加歌曲.png 18KB
缩小按钮2.png 18KB
播放按钮mini.png 19KB
播放模式2.png 22KB
lyric.png 19KB
icelrc.cpp 1KB
iceplayer.ui 574B
aboutform.h 335B
lyric.h 792B
resource.h 385B
main.cpp 1KB
songinfo.h 4KB
IcePlayer.idc 1KB
nofocusdelegate.h 336B
icelabel.h 526B
icevolbutton.cpp 2KB
iceplayer.h 5KB
icelabel.cpp 838B
icelrc.h 469B
network.cpp 573B
ICEPLAYER.sln 1KB
.gitignore 2KB
.gitattributes 378B
共 76 条
- 1
资源评论
我慢慢地也过来了
- 粉丝: 6444
- 资源: 3991
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- GDAL-3.4.3-cp310-cp310-win-amd64.whl
- 基于matlab实现鸡群算法,群体智能算法的一种,立足鸡群的集合特征建立优化过程,与蜂群算法、蛙群算法有相似之处.rar
- 基于matlab实现很好的一个蜂群算法 基于matlab的源程序 从作者那要过来的.rar
- 基于matlab实现多目标优化NSGA3代码.rar
- 基于matlab实现多目标遗传算法(NSGA-III)matlab源代码.rar
- 基于matlab实现多尺度小波分析,用于分析时间多尺度周期
- vscode配置c/c 环境教程
- vscode配置c/c 环境教程
- 基于matlab实现电磁优化计算功能,进行线型规划优化电磁设计.rar
- 基于matlab实现带精英策略的非支配排序遗传算法matlab 源码.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功