connect(ui.artist_cb, SIGNAL(currentIndexChanged (int)), this, SLOT(searchSongbyArtist()));
connect(ui.playlistname_cb, SIGNAL(currentIndexChanged (int)), this, SLOT(getPlaylist()));
void MainWindow::searchSongbyArtist()
{
ui.listView->clear();
ui.label->clear();
ui.songname_le->clear();
//If i call this my function start 2 times. I want the the combobox is clean
ui.album_cb->setCurrentItem(0);
ui.playlistname_cb->setCurrentItem(0);
QString artist
= ui.
artist_cb->currentText
();
QSqlQuery select_count
("SELECT song_tbl.song, artist_tbl.artist, album_tbl.album, style_tbl.style, album_tbl.picture, " "song_tbl.soundpath, song_tbl.song_id FROM style_tbl INNER JOIN (artist_tbl INNER JOIN "
"(album_tbl INNER JOIN song_tbl ON album_tbl.album_id = song_tbl.album_id) ON "
"artist_tbl.artist_id = album_tbl.artist_id) ON style_tbl.style_id = album_tbl.style_id "
"WHERE artist_tbl.artist = '" + artist + "'");
while(select_count.next())
{
QString song
= select_count.
value(0).
toString();
QString artist
= select_count.
value(1).
toString();
QString album
= select_count.
value(2).
toString();
QString style
= select_count.
value(3).
toString();
QString picture
= select_count.
value(4).
toString();
QString soundpath
= select_count.
value(5).
toString();
QString song_id
= select_count.
value(6).
toString();
ui.listView->insertItem(
new Q3ListViewItem (ui.listView, song, artist, album, style, picture, soundpath, song_id));
}
if (ui.listView->childCount() > 0)
{
ui.listView->setFocus();
ui.listView->setSelected((ui.listView->firstChild()), true);
}
}
void MainWindow::getPlaylist()
{
ui.listView->setSortColumn(-1);
ui.listView->clear();
ui.label->clear();
ui.songname_le->clear();
//If i call this my function start 2 times. I want the the combobox is clean
ui.album_cb->setCurrentItem(0);
ui.artist_cb->setCurrentItem(0);
QString playlistname
= ui.
playlistname_cb->currentText
();
QSqlQuery select_count
("SELECT song_tbl.song, artist_tbl.artist, album_tbl.album, style_tbl.style, " "album_tbl.picture, song_tbl.soundpath, song_tbl.song_id FROM style_tbl INNER JOIN ((artist_tbl INNER JOIN "
"(album_tbl INNER JOIN song_tbl ON album_tbl.album_id = song_tbl.album_id) ON "
"artist_tbl.artist_id = album_tbl.artist_id) INNER JOIN (playlistname_tbl INNER JOIN "
"playlist_tbl ON playlistname_tbl.playlistname_id = playlist_tbl.playlistname_id) ON "
"song_tbl.song_id = playlist_tbl.song_id) ON style_tbl.style_id = album_tbl.style_id "
"WHERE playlistname_tbl.playlistname = '" + playlistname + "' order by playlist_id desc");
while(select_count.next())
{
QString song
= select_count.
value(0).
toString();
QString artist
= select_count.
value(1).
toString();
QString album
= select_count.
value(2).
toString();
QString style
= select_count.
value(3).
toString();
QString picture
= select_count.
value(4).
toString();
QString soundpath
= select_count.
value(5).
toString();
QString song_id
= select_count.
value(6).
toString();
ui.listView->insertItem(
new Q3ListViewItem (ui.listView, song, artist, album, style, picture, soundpath, song_id));
}
if (ui.listView->childCount() > 0)
{
ui.listView->setFocus();
ui.listView->setSelected((ui.listView->firstChild()), true);
}
}
connect(ui.artist_cb, SIGNAL(currentIndexChanged (int)), this, SLOT(searchSongbyArtist()));
connect(ui.playlistname_cb, SIGNAL(currentIndexChanged (int)), this, SLOT(getPlaylist()));
void MainWindow::searchSongbyArtist()
{
ui.listView->clear();
ui.label->clear();
ui.songname_le->clear();
//If i call this my function start 2 times. I want the the combobox is clean
ui.album_cb->setCurrentItem(0);
ui.playlistname_cb->setCurrentItem(0);
QString artist = ui.artist_cb->currentText();
QSqlQuery select_count("SELECT song_tbl.song, artist_tbl.artist, album_tbl.album, style_tbl.style, album_tbl.picture, "
"song_tbl.soundpath, song_tbl.song_id FROM style_tbl INNER JOIN (artist_tbl INNER JOIN "
"(album_tbl INNER JOIN song_tbl ON album_tbl.album_id = song_tbl.album_id) ON "
"artist_tbl.artist_id = album_tbl.artist_id) ON style_tbl.style_id = album_tbl.style_id "
"WHERE artist_tbl.artist = '" + artist + "'");
while(select_count.next())
{
QString song = select_count.value(0).toString();
QString artist = select_count.value(1).toString();
QString album = select_count.value(2).toString();
QString style = select_count.value(3).toString();
QString picture = select_count.value(4).toString();
QString soundpath = select_count.value(5).toString();
QString song_id = select_count.value(6).toString();
ui.listView->insertItem(
new Q3ListViewItem (ui.listView, song, artist, album, style, picture, soundpath, song_id));
}
if (ui.listView->childCount() > 0)
{
ui.listView->setFocus();
ui.listView->setSelected((ui.listView->firstChild()), true);
}
}
void MainWindow::getPlaylist()
{
ui.listView->setSortColumn(-1);
ui.listView->clear();
ui.label->clear();
ui.songname_le->clear();
//If i call this my function start 2 times. I want the the combobox is clean
ui.album_cb->setCurrentItem(0);
ui.artist_cb->setCurrentItem(0);
QString playlistname = ui.playlistname_cb->currentText();
QSqlQuery select_count("SELECT song_tbl.song, artist_tbl.artist, album_tbl.album, style_tbl.style, "
"album_tbl.picture, song_tbl.soundpath, song_tbl.song_id FROM style_tbl INNER JOIN ((artist_tbl INNER JOIN "
"(album_tbl INNER JOIN song_tbl ON album_tbl.album_id = song_tbl.album_id) ON "
"artist_tbl.artist_id = album_tbl.artist_id) INNER JOIN (playlistname_tbl INNER JOIN "
"playlist_tbl ON playlistname_tbl.playlistname_id = playlist_tbl.playlistname_id) ON "
"song_tbl.song_id = playlist_tbl.song_id) ON style_tbl.style_id = album_tbl.style_id "
"WHERE playlistname_tbl.playlistname = '" + playlistname + "' order by playlist_id desc");
while(select_count.next())
{
QString song = select_count.value(0).toString();
QString artist = select_count.value(1).toString();
QString album = select_count.value(2).toString();
QString style = select_count.value(3).toString();
QString picture = select_count.value(4).toString();
QString soundpath = select_count.value(5).toString();
QString song_id = select_count.value(6).toString();
ui.listView->insertItem(
new Q3ListViewItem (ui.listView, song, artist, album, style, picture, soundpath, song_id));
}
if (ui.listView->childCount() > 0)
{
ui.listView->setFocus();
ui.listView->setSelected((ui.listView->firstChild()), true);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks