Add wating message when douleclicking item
This commit is contained in:
parent
6eea5688a8
commit
18e1588d73
1 changed files with 1 additions and 8 deletions
|
|
@ -296,16 +296,12 @@ void MainWindow::on_songListView_doubleClicked(const QModelIndex &index)
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Temporarily disconnect the signal to prevent multiple invocations
|
|
||||||
// This happens when the dialog closes and triggers another double-click event
|
|
||||||
disconnect(ui->songListView, &QTableView::doubleClicked, this, &MainWindow::on_songListView_doubleClicked);
|
disconnect(ui->songListView, &QTableView::doubleClicked, this, &MainWindow::on_songListView_doubleClicked);
|
||||||
|
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
|
|
||||||
// Different behavior based on which column was clicked
|
|
||||||
if (index.column() == 0)
|
if (index.column() == 0)
|
||||||
{
|
{
|
||||||
// Column 0 (play indicator): Stop current playback and play this song
|
|
||||||
if (isPlaying)
|
if (isPlaying)
|
||||||
{
|
{
|
||||||
audioPlayer->stop();
|
audioPlayer->stop();
|
||||||
|
|
@ -316,14 +312,13 @@ void MainWindow::on_songListView_doubleClicked(const QModelIndex &index)
|
||||||
updateControls();
|
updateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush the generation queue when user selects a different song
|
|
||||||
flushGenerationQueue();
|
flushGenerationQueue();
|
||||||
|
ui->nowPlayingLabel->setText("Now Playing: Waiting for generation...");
|
||||||
currentSong = songModel->getSong(row);
|
currentSong = songModel->getSong(row);
|
||||||
ensureSongsInQueue(true);
|
ensureSongsInQueue(true);
|
||||||
}
|
}
|
||||||
else if (index.column() == 1 || index.column() == 2)
|
else if (index.column() == 1 || index.column() == 2)
|
||||||
{
|
{
|
||||||
// Column 1 (caption): Edit the song
|
|
||||||
SongItem song = songModel->getSong(row);
|
SongItem song = songModel->getSong(row);
|
||||||
|
|
||||||
SongDialog dialog(this, song.caption, song.lyrics, song.vocalLanguage);
|
SongDialog dialog(this, song.caption, song.lyrics, song.vocalLanguage);
|
||||||
|
|
@ -334,14 +329,12 @@ void MainWindow::on_songListView_doubleClicked(const QModelIndex &index)
|
||||||
QString lyrics = dialog.getLyrics();
|
QString lyrics = dialog.getLyrics();
|
||||||
QString vocalLanguage = dialog.getVocalLanguage();
|
QString vocalLanguage = dialog.getVocalLanguage();
|
||||||
|
|
||||||
// Update the model - use column 1 for the song name
|
|
||||||
songModel->setData(songModel->index(row, 1), caption, SongListModel::CaptionRole);
|
songModel->setData(songModel->index(row, 1), caption, SongListModel::CaptionRole);
|
||||||
songModel->setData(songModel->index(row, 1), lyrics, SongListModel::LyricsRole);
|
songModel->setData(songModel->index(row, 1), lyrics, SongListModel::LyricsRole);
|
||||||
songModel->setData(songModel->index(row, 1), vocalLanguage, SongListModel::VocalLanguageRole);
|
songModel->setData(songModel->index(row, 1), vocalLanguage, SongListModel::VocalLanguageRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reconnect the signal after dialog is closed
|
|
||||||
connect(ui->songListView, &QTableView::doubleClicked, this, &MainWindow::on_songListView_doubleClicked);
|
connect(ui->songListView, &QTableView::doubleClicked, this, &MainWindow::on_songListView_doubleClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue