Commit 31938908 authored by Scott Wheeler's avatar Scott Wheeler

JuK now does QTagger-style listing of artist and albums currently in the

list view and I've started on the code to prompt to save a file if you've
modified it and moved to another item.

svn path=/trunk/kdemultimedia/juk/; revision=158016
parent d49300f8
......@@ -69,6 +69,28 @@ AudioData *FileListItem::getAudioData()
void FileListItem::refresh()
{
// This should be the only function that needs to be rewritten if the structure of
// FileListItemData changes. Also, currently this also inserts things into the
// album and artist registries of the FileList. If something like sorted insert
// happens at some point it could either be implemented here or in a subclass of
// QValueList. And another note: the artist/album registry doesn't remove items
// when they no longer exist in the list view. I decided that this is too much work
// for something not very useful at the moment, but at some point, a QValueList of
// a subclass of QPair could track such things...
// if the text has changed and the artist registry of the FileList doens't contain
// this artist, add it to the mentioned registry
FileList *fileList = static_cast<FileList *>(listView());
if(text(ArtistColumn) != getTag()->getArtist() &&
fileList->getArtistList()->contains(getTag()->getArtist()) == 0)
fileList->getArtistList()->append(getTag()->getArtist());
if(text(AlbumColumn) != getTag()->getAlbum() &&
fileList->getAlbumList()->contains(getTag()->getAlbum()) == 0)
fileList->getAlbumList()->append(getTag()->getAlbum());
setText(TrackColumn, getTag()->getTrack());
setText(ArtistColumn, getTag()->getArtist());
setText(AlbumColumn, getTag()->getAlbum());
......
......@@ -72,7 +72,6 @@ QPtrList<QListViewItem> TaggerWidget::getSelectedItems()
void TaggerWidget::save()
{
// kdDebug() << "TaggerWidget::save()" << endl;
QPtrList<QListViewItem> items = taggerList->selectedItems();
if(items.count() > 0) {
......@@ -166,8 +165,9 @@ void TaggerWidget::setupLayout()
//////////////////////////////////////////////////////////////////////////////
taggerList = new FileList(split, "taggerList");
// this connection is a little ugly -- it does a cast
connect(taggerList, SIGNAL(selectionChanged()), this, SLOT(saveChangesPrompt()));
connect(taggerList, SIGNAL(selectionChanged()), this, SLOT(updateBoxes()));
connect(taggerList, SIGNAL(dataChanged()), this, SLOT(updateCombos()));
//////////////////////////////////////////////////////////////////////////////
// now set up a bottom widget of the splitter and make it stay small at
......@@ -288,6 +288,12 @@ void TaggerWidget::readConfig()
// private slots
////////////////////////////////////////////////////////////////////////////////
void TaggerWidget::saveChangesPrompt()
{
if(changed && KMessageBox::warningYesNo(this, i18n("Do you want to save your changes to this file?"), i18n("Save Changes")) == KMessageBox::Yes)
kdDebug() << "TaggerWidget::saveChangesPrompt() -- save changes " << endl;
}
void TaggerWidget::updateBoxes() // this needs to be updated to properly work with multiple selections
{
// kdDebug() << "updateBoxes(): " << item->filePath() << endl;
......@@ -328,3 +334,18 @@ void TaggerWidget::updateBoxes() // this needs to be updated to properly work wi
}
}
}
void TaggerWidget::updateCombos()
{
if(artistNameBox->listBox()) {
artistNameBox->listBox()->clear();
taggerList->getArtistList()->sort();
artistNameBox->listBox()->insertStringList(*taggerList->getArtistList());
}
if(albumNameBox->listBox()) {
albumNameBox->listBox()->clear();
taggerList->getAlbumList()->sort();
albumNameBox->listBox()->insertStringList(*taggerList->getAlbumList());
}
}
......@@ -73,7 +73,9 @@ private:
bool changed;
private slots:
void updateBoxes();
void saveChangesPrompt();
void updateBoxes();
void updateCombos();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment