上下曲目按钮调试完成
This commit is contained in:
parent
c2d65b957d
commit
32c85bbe1f
|
@ -155,6 +155,20 @@ void MainWindow::playNextSong()
|
|||
write(this->fifo_fd, changeSongBuf, len); // 将获取的下一首歌曲名写入到有名管道中
|
||||
}
|
||||
|
||||
void MainWindow::playLastSong()
|
||||
{
|
||||
index--;
|
||||
if(index == -1)
|
||||
index = vectorSong.size() - 1; // 当索引到达歌曲 0 时,将索引置为最后一个歌曲,循环索引
|
||||
char changeSongBuf[128] = "";
|
||||
// 将 loadfile 'song_name_path' 写入字符数组
|
||||
int len = sprintf(changeSongBuf, "loadfile /home/flykhan/qtmplayer/song/%s\n", vectorSong[index].c_str());
|
||||
// int len = sprintf(changeSongBuf, "loadfile ./song/%s\n", vectorSong[index].c_str());
|
||||
qDebug() << changeSongBuf << endl; // 控制台打印下一首歌的名字
|
||||
// write(this->fifo_fd, changeSongBuf.toUtf8().toStdString().c_str(),changeSongBuf.toUtf8().toStdString().size());
|
||||
write(this->fifo_fd, changeSongBuf, len); // 将获取的下一首歌曲名写入到有名管道中
|
||||
}
|
||||
|
||||
void MainWindow::setCurrentTimeLabel(int time)
|
||||
{
|
||||
int m = 0, s = 0;
|
||||
|
@ -272,7 +286,7 @@ void MainWindow::on_play_btn_clicked()
|
|||
|
||||
void MainWindow::on_back_btn_clicked()
|
||||
{
|
||||
|
||||
playLastSong();
|
||||
}
|
||||
|
||||
void MainWindow::on_front_btn_clicked()
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void playNextSong(); // 切换歌曲槽函数I
|
||||
void playLastSong();
|
||||
void setCurrentTimeLabel(int time); // 设置当前时间标签槽函数
|
||||
void setCurrentSlider(int currentProgress); // 设置当前进度条
|
||||
|
||||
|
|
Loading…
Reference in New Issue