Commit c67272ad authored by Scott Wheeler's avatar Scott Wheeler

Added a simple splash screen that shows things as items are loaded.

Started work on the "Genre List Editor", but that doesn't work yet.

Hmm, fixed some other stuff that I'm too tired to remember.

svn path=/trunk/kdemultimedia/juk/; revision=193005
parent b45646b5
......@@ -3,12 +3,12 @@ bin_PROGRAMS = juk
## INCLUDES were found outside kdevelop specific part
juk_SOURCES = statuslabel.cpp cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_SOURCES = genrelisteditor.cpp genrelisteditorbase.ui splashscreen.cpp statuslabel.cpp cachedtag.cpp oggtag.cpp id3tag.cpp collectionlist.cpp playlistitem.cpp playlist.cpp playlistsplitter.cpp listboxpixmap.cpp playlistbox.cpp tageditor.cpp cache.cpp audiodata.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp tag.cpp customaction.cpp slideraction.cpp juk.cpp main.cpp
juk_LDADD = -lid3 -lsoundserver_idl $(LIB_KFILE) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) $(LIBSOCKET)
SUBDIRS = pics data
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h statuslabel.cpp statuslabel.h
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc slideraction.cpp slideraction.h customaction.h customaction.cpp tag.cpp tag.h player.cpp player.h genre.h genre.cpp hi16-app-juk.png hi32-app-juk.png hi48-app-juk.png genrelist.cpp genrelist.h genrelistlist.cpp genrelistlist.h genrelistreader.cpp genrelistreader.h audiodata.cpp audiodata.h cache.cpp cache.h tageditor.cpp tageditor.h playlistbox.cpp playlistbox.h listboxpixmap.cpp listboxpixmap.h playlistsplitter.cpp playlistsplitter.h playlist.cpp playlist.h playlistitem.cpp playlistitem.h collectionlist.cpp collectionlist.h id3tag.cpp id3tag.h oggtag.cpp oggtag.h cachedtag.cpp cachedtag.h statuslabel.cpp statuslabel.h splashscreen.cpp splashscreen.h genrelisteditorbase.ui genrelisteditor.cpp genrelisteditor.h
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Multimedia/
......
......@@ -22,6 +22,7 @@
#include "collectionlist.h"
#include "playlistsplitter.h"
#include "cache.h"
#include "splashscreen.h"
////////////////////////////////////////////////////////////////////////////////
// static methods
......@@ -148,6 +149,8 @@ CollectionListItem::CollectionListItem(const QFileInfo &file) : PlaylistItem(Col
else
kdError() << "CollectionListItems should not be created before"
<< "CollectionList::initialize() has been called." << endl;
SplashScreen::increment();
}
CollectionListItem::~CollectionListItem()
......
......@@ -62,11 +62,17 @@ protected:
// These methods are used by CollectionListItem, which is a friend class.
void addToDict(const QString &file, CollectionListItem *item);
void removeFromDict(const QString &file);
/** This checks to see if the artist given is in the artist list maintained
by the collection list (for use in autocompletion and the TagEditor
combo boxes), and if it is not, it adds it to the list. */
/**
* This checks to see if the artist given is in the artist list maintained
* by the collection list (for use in autocompletion and the TagEditor
* combo boxes), and if it is not, it adds it to the list.
*/
void addArtist(const QString &artist);
/** This is similar to addArtist(), but is for album names. */
/**
* This is similar to addArtist(), but is for album names.
*/
void addAlbum(const QString &album);
private:
......
......@@ -21,10 +21,9 @@
// public members
////////////////////////////////////////////////////////////////////////////////
Genre::Genre() : QString()
Genre::Genre() : QString(), ID3v1(255)
{
name = QString::null;
ID3v1 = 255;
}
Genre::Genre(const QString &genreName, int ID3v1Number) : QString(genreName)
......
......@@ -32,7 +32,6 @@ public:
void setID3v1(int number);
private:
QString name;
int ID3v1;
};
......
......@@ -24,14 +24,13 @@
// public members
////////////////////////////////////////////////////////////////////////////////
GenreList::GenreList(bool createIndex) : QValueList<Genre>()
GenreList::GenreList(bool createIndex) : QValueList<Genre>(), hasIndex(createIndex)
{
hasIndex = createIndex;
}
GenreList::GenreList(const QString &file, bool createIndex) : QValueList<Genre>()
GenreList::GenreList(const QString &file, bool createIndex) : QValueList<Genre>(), hasIndex(createIndex)
{
hasIndex = createIndex;
load(file);
}
......@@ -53,7 +52,7 @@ void GenreList::load(const QString &file)
initializeIndex();
}
QString GenreList::name(int ID3v1)
QString GenreList::ID3v1Name(int ID3v1)
{
if(hasIndex && ID3v1 >= 0 && ID3v1 < int(index.size()))
return(index[ID3v1]);
......@@ -87,6 +86,16 @@ int GenreList::findIndex(const QString &item)
return(-1);
}
QString GenreList::name() const
{
return(listName);
}
void GenreList::setName(const QString &n)
{
listName = n;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
......
......@@ -32,21 +32,38 @@ public:
virtual ~GenreList();
void load(const QString &file);
QString name(int ID3v1);
/**
* Do a "reverse" lookup. Given an ID3v1 genre name, find the index.
* Given an ID3v1 "number", look up the name.
*/
QString ID3v1Name(int ID3v1);
/**
* Do a "reverse" lookup. Given an ID3v1 genre name, find the index. Though
* I didn't realize it at the time that I wrote it, this is a
* reimplimentation from QValueList; ours however caches the last search so
* it should speed things up a bit for "two in a row" searches that are
* common.
*/
int findIndex(const QString &item);
QString name() const;
void setName(const QString &n);
bool readOnly() const { return readOnlyList; }
void setReadOnly(bool ro) { readOnlyList = ro; }
private:
QValueVector<QString> index;
bool hasIndex;
/**
* This is used for creating a mapping between ID3v1 genre numbers and the
* name that is associated with those genres. There is no reason that this
* should be called for GenreLists other than the ID3v1 GenreList.
*/
void initializeIndex();
QValueVector<QString> index;
bool hasIndex;
QString listName;
bool readOnlyList;
};
#endif
/***************************************************************************
genrelisteditor.cpp - description
-------------------
begin : Sun Dec 8 2002
copyright : (C) 2002 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kcombobox.h>
#include <klistview.h>
#include <klineedit.h>
#include <kdebug.h>
#include "genrelisteditor.h"
#include "genrelistlist.h"
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
GenreListEditor::GenreListEditor(QWidget *parent, const char *name ) : GenreListEditorBase(parent, name, true)
{
loadID3v1Genres();
loadLists();
}
GenreListEditor::~GenreListEditor()
{
}
////////////////////////////////////////////////////////////////////////////////
// private methods
////////////////////////////////////////////////////////////////////////////////
void GenreListEditor::loadID3v1Genres()
{
GenreList ID3v1List = GenreListList::ID3v1List();
for(GenreList::Iterator it = ID3v1List.begin(); it != ID3v1List.end(); it++) {
ID3v1Box->insertItem(*it);
}
}
void GenreListEditor::loadLists()
{
GenreListList lists = GenreListList::lists();
for(GenreListList::Iterator it = lists.begin(); it != lists.end(); it++) {
listDict.insert((*it).name(), &(*it));
selectListBox->insertItem((*it).name());
}
updateGenreList();
}
void GenreListEditor::updateGenreList()
{
GenreList *currentList = listDict[selectListBox->currentText()];
if(currentList) {
genreList->clear();
for(GenreList::Iterator it = currentList->begin(); it != currentList->end(); it++)
new KListViewItem(genreList, *it, currentList->ID3v1Name((*it).getID3v1()));
}
}
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////
void GenreListEditor::updateGenreBoxes(QListViewItem *item)
{
if(item) {
genreNameBox->setText(item->text(0));
ID3v1Box->setCurrentItem(GenreListList::ID3v1List().findIndex(item->text(1)));
}
}
void GenreListEditor::updateGenreName(const QString &name)
{
QListViewItem *current = genreList->currentItem();
if(!name.isEmpty() && current)
current->setText(0, name);
}
#include "genrelisteditor.moc"
/***************************************************************************
genrelisteditor.h - description
-------------------
begin : Sun Dec 8 2002
copyright : (C) 2002 by Scott Wheeler
email : wheeler@kde.org
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef GENRELISTEDITOR_H
#define GENRELISTEDITOR_H
#include <qdict.h>
#include "genrelisteditorbase.h"
class GenreList;
class GenreListEditor : public GenreListEditorBase
{
Q_OBJECT
public:
GenreListEditor(QWidget *parent = 0, const char *name = 0);
~GenreListEditor();
private:
void loadID3v1Genres();
void loadLists();
void updateGenreList();
QDict<GenreList> listDict;
private slots:
virtual void updateGenreBoxes(QListViewItem *item);
virtual void updateGenreName(const QString &name);
};
#endif
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
<class>GenreListEditorBase</class>
<widget class="QDialog">
<property name="name">
<cstring>listEditor</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>522</width>
<height>392</height>
</rect>
</property>
<property name="caption">
<string>Genre List Editor</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>listInfoGroup</cstring>
</property>
<property name="title">
<string>Genre Lists</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KComboBox">
<property name="name">
<cstring>selectListBox</cstring>
</property>
</widget>
<widget class="Line">
<property name="name">
<cstring>leftColumnLine1</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>newListButton</cstring>
</property>
<property name="text">
<string>New Genre List...</string>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>renameListButton</cstring>
</property>
<property name="text">
<string>Rename Genre List...</string>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>duplicateListButton</cstring>
</property>
<property name="text">
<string>Duplicate Genre List...</string>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>deleteListButton</cstring>
</property>
<property name="text">
<string>Delete Genre List</string>
</property>
</widget>
<widget class="Line">
<property name="name">
<cstring>leftColumnLine2</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>setDefaultListButton</cstring>
</property>
<property name="text">
<string>Set Default Genre List</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>genreInfoGroup</cstring>
</property>
<property name="title">
<string>Genre Settings</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KListView">
<column>
<property name="text">
<string>Genre Name</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>ID3v1 Genre</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<property name="name">
<cstring>genreList</cstring>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>genreNameLabel</cstring>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
<widget class="KLineEdit">
<property name="name">
<cstring>genreNameBox</cstring>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>ID3v1Label</cstring>
</property>
<property name="text">
<string>ID3v1 Genre Mapping</string>
</property>
</widget>
<widget class="KComboBox">
<property name="name">
<cstring>ID3v1Box</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Genre to use in the ID3v1 tag</string>
</property>
</widget>
<widget class="Line">
<property name="name">
<cstring>rightColumnLine</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>newGenreButton</cstring>
</property>
<property name="text">
<string>New Genre</string>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>deleteGenreButton</cstring>
</property>
<property name="text">
<string>Delete Genre</string>
</property>
</widget>
</vbox>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>okCancelLayout</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>okCancelSpacer</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>131</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="KPushButton">
<property name="name">
<cstring>okButton</cstring>
</property>
<property name="text">
<string>OK</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="KPushButton">
<property name="name">
<cstring>cancelButton</cstring>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<connections>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>listEditor</receiver>
<slot>reject()</slot>
</connection>
<connection>
<sender>okButton</sender>
<signal>clicked()</signal>
<receiver>listEditor</receiver>
<slot>accept()</slot>
</connection>
<connection>
<sender>genreList</sender>
<signal>executed(QListViewItem*)</signal>
<receiver>listEditor</receiver>
<slot>updateGenreBoxes(QListViewItem*)</slot>
</connection>
<connection>
<sender>genreNameBox</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>listEditor</receiver>
<slot>updateGenreName(const QString&amp;)</slot>
</connection>
</connections>
<slots>
<slot access="protected" specifier="pure virtual">updateGenreBoxes(QListViewItem *)</slot>
<slot access="protected" specifier="pure virtual">updateGenreName(const QString &amp;name)</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kcombobox.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>klistview.h</includehint>
<includehint>klineedit.h</includehint>
<includehint>kcombobox.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
</includehints>