Commit c4aa5cd1 authored by Scott Wheeler's avatar Scott Wheeler

I don't have home internet access at the moment, so this is a whole weeks

worth of major cleanups and redesign things.

svn path=/trunk/kdemultimedia/juk/; revision=177610
parent 6df2292a
......@@ -3,12 +3,12 @@ bin_PROGRAMS = juk
## INCLUDES were found outside kdevelop specific part
juk_SOURCES = cache.cpp audiodata.cpp cacheitem.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp filelistitem.cpp tag.cpp filelist.cpp customaction.cpp playlistwidget.cpp slideraction.cpp taggerwidget.cpp juk.cpp main.cpp
juk_SOURCES = 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 playlistwidget.cpp slideraction.cpp taggerwidget.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 taggerwidget.cpp taggerwidget.h slideraction.cpp slideraction.h playlistwidget.cpp playlistwidget.h customaction.h customaction.cpp filelist.cpp filelist.h tag.cpp tag.h filelistitem.cpp filelistitem.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 cacheitem.cpp cacheitem.h audiodata.cpp audiodata.h cache.cpp cache.h
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc taggerwidget.cpp taggerwidget.h slideraction.cpp slideraction.h playlistwidget.cpp playlistwidget.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
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Multimedia/
......
......@@ -230,12 +230,12 @@ x_libraries = @x_libraries@
bin_PROGRAMS = juk
juk_SOURCES = cache.cpp audiodata.cpp cacheitem.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp filelistitem.cpp tag.cpp filelist.cpp customaction.cpp playlistwidget.cpp slideraction.cpp taggerwidget.cpp juk.cpp main.cpp
juk_SOURCES = 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 playlistwidget.cpp slideraction.cpp taggerwidget.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 taggerwidget.cpp taggerwidget.h slideraction.cpp slideraction.h playlistwidget.cpp playlistwidget.h customaction.h customaction.cpp filelist.cpp filelist.h tag.cpp tag.h filelistitem.cpp filelistitem.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 cacheitem.cpp cacheitem.h audiodata.cpp audiodata.h cache.cpp cache.h
EXTRA_DIST = main.cpp juk.cpp juk.h juk.desktop jukui.rc taggerwidget.cpp taggerwidget.h slideraction.cpp slideraction.h playlistwidget.cpp playlistwidget.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
####### kdevelop will overwrite this part!!! (end)############
......@@ -257,24 +257,28 @@ CONFIG_CLEAN_FILES =
bin_PROGRAMS = juk$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_juk_OBJECTS = cache.$(OBJEXT) audiodata.$(OBJEXT) cacheitem.$(OBJEXT) \
am_juk_OBJECTS = collectionlist.$(OBJEXT) playlistitem.$(OBJEXT) \
playlist.$(OBJEXT) playlistsplitter.$(OBJEXT) \
listboxpixmap.$(OBJEXT) playlistbox.$(OBJEXT) \
tageditor.$(OBJEXT) cache.$(OBJEXT) audiodata.$(OBJEXT) \
genrelistreader.$(OBJEXT) genrelistlist.$(OBJEXT) \
genrelist.$(OBJEXT) genre.$(OBJEXT) player.$(OBJEXT) \
filelistitem.$(OBJEXT) tag.$(OBJEXT) filelist.$(OBJEXT) \
customaction.$(OBJEXT) playlistwidget.$(OBJEXT) \
tag.$(OBJEXT) customaction.$(OBJEXT) playlistwidget.$(OBJEXT) \
slideraction.$(OBJEXT) taggerwidget.$(OBJEXT) juk.$(OBJEXT) \
main.$(OBJEXT)
#>- juk_OBJECTS = $(am_juk_OBJECTS)
#>+ 12
#>+ 14
juk_final_OBJECTS = juk.all_cpp.o
juk_nofinal_OBJECTS = cache.$(OBJEXT) audiodata.$(OBJEXT) cacheitem.$(OBJEXT) \
juk_nofinal_OBJECTS = collectionlist.$(OBJEXT) playlistitem.$(OBJEXT) \
playlist.$(OBJEXT) playlistsplitter.$(OBJEXT) \
listboxpixmap.$(OBJEXT) playlistbox.$(OBJEXT) \
tageditor.$(OBJEXT) cache.$(OBJEXT) audiodata.$(OBJEXT) \
genrelistreader.$(OBJEXT) genrelistlist.$(OBJEXT) \
genrelist.$(OBJEXT) genre.$(OBJEXT) player.$(OBJEXT) \
filelistitem.$(OBJEXT) tag.$(OBJEXT) filelist.$(OBJEXT) \
customaction.$(OBJEXT) playlistwidget.$(OBJEXT) \
tag.$(OBJEXT) customaction.$(OBJEXT) playlistwidget.$(OBJEXT) \
slideraction.$(OBJEXT) taggerwidget.$(OBJEXT) juk.$(OBJEXT) \
main.$(OBJEXT)\
slideraction.moc.o filelistitem.moc.o customaction.moc.o juk.moc.o filelist.moc.o taggerwidget.moc.o \
collectionlist.moc.o \
juk_meta_unload.o
@KDE_USE_FINAL_FALSE@juk_OBJECTS = $(juk_nofinal_OBJECTS)
@KDE_USE_FINAL_TRUE@juk_OBJECTS = $(juk_final_OBJECTS)
......@@ -287,15 +291,17 @@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/audiodata.Po $(DEPDIR)/cache.Po \
@AMDEP_TRUE@ $(DEPDIR)/cacheitem.Po $(DEPDIR)/customaction.Po \
@AMDEP_TRUE@ $(DEPDIR)/filelist.Po $(DEPDIR)/filelistitem.Po \
@AMDEP_TRUE@ $(DEPDIR)/genre.Po $(DEPDIR)/genrelist.Po \
@AMDEP_TRUE@ $(DEPDIR)/genrelistlist.Po \
@AMDEP_TRUE@ $(DEPDIR)/collectionlist.Po \
@AMDEP_TRUE@ $(DEPDIR)/customaction.Po $(DEPDIR)/genre.Po \
@AMDEP_TRUE@ $(DEPDIR)/genrelist.Po $(DEPDIR)/genrelistlist.Po \
@AMDEP_TRUE@ $(DEPDIR)/genrelistreader.Po $(DEPDIR)/juk.Po \
@AMDEP_TRUE@ $(DEPDIR)/main.Po $(DEPDIR)/player.Po \
@AMDEP_TRUE@ $(DEPDIR)/listboxpixmap.Po $(DEPDIR)/main.Po \
@AMDEP_TRUE@ $(DEPDIR)/player.Po $(DEPDIR)/playlist.Po \
@AMDEP_TRUE@ $(DEPDIR)/playlistbox.Po $(DEPDIR)/playlistitem.Po \
@AMDEP_TRUE@ $(DEPDIR)/playlistsplitter.Po \
@AMDEP_TRUE@ $(DEPDIR)/playlistwidget.Po \
@AMDEP_TRUE@ $(DEPDIR)/slideraction.Po $(DEPDIR)/tag.Po \
@AMDEP_TRUE@ $(DEPDIR)/taggerwidget.Po
@AMDEP_TRUE@ $(DEPDIR)/tageditor.Po $(DEPDIR)/taggerwidget.Po
#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
#>+ 2
......@@ -389,20 +395,24 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/audiodata.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cacheitem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/collectionlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/customaction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/filelist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/filelistitem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/genre.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/genrelist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/genrelistlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/genrelistreader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/juk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/listboxpixmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/player.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/playlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/playlistbox.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/playlistitem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/playlistsplitter.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/playlistwidget.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/slideraction.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tag.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/tageditor.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/taggerwidget.Po@am__quote@
distclean-depend:
......@@ -695,32 +705,48 @@ messages: rc.cpp
.NOEXPORT:
#>+ 3
slideraction.moc.cpp: $(srcdir)/slideraction.h
$(MOC) $(srcdir)/slideraction.h -o slideraction.moc.cpp
slideraction.moc: $(srcdir)/slideraction.h
$(MOC) $(srcdir)/slideraction.h -o slideraction.moc
#>+ 3
collectionlist.moc.cpp: $(srcdir)/collectionlist.h
$(MOC) $(srcdir)/collectionlist.h -o collectionlist.moc.cpp
#>+ 3
playlistbox.moc: $(srcdir)/playlistbox.h
$(MOC) $(srcdir)/playlistbox.h -o playlistbox.moc
#>+ 3
filelistitem.moc.cpp: $(srcdir)/filelistitem.h
$(MOC) $(srcdir)/filelistitem.h -o filelistitem.moc.cpp
customaction.moc: $(srcdir)/customaction.h
$(MOC) $(srcdir)/customaction.h -o customaction.moc
#>+ 3
customaction.moc.cpp: $(srcdir)/customaction.h
$(MOC) $(srcdir)/customaction.h -o customaction.moc.cpp
playlistitem.moc: $(srcdir)/playlistitem.h
$(MOC) $(srcdir)/playlistitem.h -o playlistitem.moc
#>+ 3
juk.moc.cpp: $(srcdir)/juk.h
$(MOC) $(srcdir)/juk.h -o juk.moc.cpp
taggerwidget.moc: $(srcdir)/taggerwidget.h
$(MOC) $(srcdir)/taggerwidget.h -o taggerwidget.moc
#>+ 3
filelist.moc.cpp: $(srcdir)/filelist.h
$(MOC) $(srcdir)/filelist.h -o filelist.moc.cpp
playlist.moc: $(srcdir)/playlist.h
$(MOC) $(srcdir)/playlist.h -o playlist.moc
#>+ 3
taggerwidget.moc.cpp: $(srcdir)/taggerwidget.h
$(MOC) $(srcdir)/taggerwidget.h -o taggerwidget.moc.cpp
playlistsplitter.moc: $(srcdir)/playlistsplitter.h
$(MOC) $(srcdir)/playlistsplitter.h -o playlistsplitter.moc
#>+ 3
juk.moc: $(srcdir)/juk.h
$(MOC) $(srcdir)/juk.h -o juk.moc
#>+ 3
tageditor.moc: $(srcdir)/tageditor.h
$(MOC) $(srcdir)/tageditor.h -o tageditor.moc
#>+ 3
clean-metasources:
-rm -f slideraction.moc.cpp filelistitem.moc.cpp customaction.moc.cpp juk.moc.cpp filelist.moc.cpp taggerwidget.moc.cpp
-rm -f slideraction.moc collectionlist.moc.cpp playlistbox.moc customaction.moc playlistitem.moc taggerwidget.moc playlist.moc playlistsplitter.moc juk.moc tageditor.moc
#>+ 2
docs-am:
......@@ -747,12 +773,12 @@ force-reedit:
#>+ 12
juk_meta_unload.cpp: slideraction.moc.cpp customaction.moc.cpp filelistitem.moc.cpp juk.moc.cpp taggerwidget.moc.cpp filelist.moc.cpp
juk_meta_unload.cpp: slideraction.moc collectionlist.moc.cpp playlistbox.moc playlistitem.moc customaction.moc playlist.moc taggerwidget.moc playlistsplitter.moc tageditor.moc juk.moc
@echo 'creating juk_meta_unload.cpp'
@-rm -f juk_meta_unload.cpp
@if test ${kde_qtver} = 2; then \
echo 'static const char * _metalist_juk[] = {' > juk_meta_unload.cpp ;\
cat slideraction.moc.cpp customaction.moc.cpp filelistitem.moc.cpp juk.moc.cpp taggerwidget.moc.cpp filelist.moc.cpp | grep 'char.*className' | sed -e 's/.*[^A-Za-z0-9_:]\([A-Za-z0-9_:]*\)::className.*$$/\"\1\",/' | sort | uniq >> juk_meta_unload.cpp ;\
cat slideraction.moc collectionlist.moc.cpp playlistbox.moc playlistitem.moc customaction.moc playlist.moc taggerwidget.moc playlistsplitter.moc tageditor.moc juk.moc | grep 'char.*className' | sed -e 's/.*[^A-Za-z0-9_:]\([A-Za-z0-9_:]*\)::className.*$$/\"\1\",/' | sort | uniq >> juk_meta_unload.cpp ;\
echo '0};' >> juk_meta_unload.cpp ;\
echo '#include <kunload.h>' >> juk_meta_unload.cpp ;\
echo '_UNLOAD(juk)' >> juk_meta_unload.cpp ;\
......@@ -764,11 +790,11 @@ clean-moc-classes:
-rm -f juk_meta_unload.cpp
#>+ 11
juk.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/cache.cpp $(srcdir)/audiodata.cpp $(srcdir)/cacheitem.cpp $(srcdir)/genrelistreader.cpp $(srcdir)/genrelistlist.cpp $(srcdir)/genrelist.cpp $(srcdir)/genre.cpp $(srcdir)/player.cpp $(srcdir)/filelistitem.cpp $(srcdir)/tag.cpp $(srcdir)/filelist.cpp $(srcdir)/customaction.cpp $(srcdir)/playlistwidget.cpp $(srcdir)/slideraction.cpp $(srcdir)/taggerwidget.cpp $(srcdir)/juk.cpp $(srcdir)/main.cpp $(srcdir)/juk_meta_unload.cpp slideraction.moc.cpp filelistitem.moc.cpp customaction.moc.cpp juk.moc.cpp filelist.moc.cpp taggerwidget.moc.cpp
juk.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/collectionlist.cpp $(srcdir)/playlistitem.cpp $(srcdir)/playlist.cpp $(srcdir)/playlistsplitter.cpp $(srcdir)/listboxpixmap.cpp $(srcdir)/playlistbox.cpp $(srcdir)/tageditor.cpp $(srcdir)/cache.cpp $(srcdir)/audiodata.cpp $(srcdir)/genrelistreader.cpp $(srcdir)/genrelistlist.cpp $(srcdir)/genrelist.cpp $(srcdir)/genre.cpp $(srcdir)/player.cpp $(srcdir)/tag.cpp $(srcdir)/customaction.cpp $(srcdir)/playlistwidget.cpp $(srcdir)/slideraction.cpp $(srcdir)/taggerwidget.cpp $(srcdir)/juk.cpp $(srcdir)/main.cpp $(srcdir)/juk_meta_unload.cpp collectionlist.moc.cpp slideraction.moc playlistbox.moc customaction.moc playlistitem.moc taggerwidget.moc playlist.moc playlistsplitter.moc juk.moc tageditor.moc
@echo 'creating juk.all_cpp.cpp ...'; \
rm -f juk.all_cpp.files juk.all_cpp.final; \
echo "#define KDE_USE_FINAL 1" >> juk.all_cpp.final; \
for file in cache.cpp audiodata.cpp cacheitem.cpp genrelistreader.cpp genrelistlist.cpp genrelist.cpp genre.cpp player.cpp filelistitem.cpp tag.cpp filelist.cpp customaction.cpp playlistwidget.cpp slideraction.cpp taggerwidget.cpp juk.cpp main.cpp juk_meta_unload.cpp slideraction.moc.cpp filelistitem.moc.cpp customaction.moc.cpp juk.moc.cpp filelist.moc.cpp taggerwidget.moc.cpp; do \
for file in 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 playlistwidget.cpp slideraction.cpp taggerwidget.cpp juk.cpp main.cpp juk_meta_unload.cpp collectionlist.moc.cpp; do \
echo "#include \"$$file\"" >> juk.all_cpp.files; \
test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> juk.all_cpp.final; \
done; \
......@@ -798,3 +824,14 @@ cvs-clean:
#>+ 3
kde-rpo-clean:
-rm -f *.rpo
#>+ 10
$(srcdir)/playlist.cpp: playlist.moc
$(srcdir)/slideraction.cpp: slideraction.moc
$(srcdir)/playlistbox.cpp: playlistbox.moc
$(srcdir)/tageditor.cpp: tageditor.moc
$(srcdir)/playlistitem.cpp: playlistitem.moc
$(srcdir)/playlistsplitter.cpp: playlistsplitter.moc
$(srcdir)/customaction.cpp: customaction.moc
$(srcdir)/taggerwidget.cpp: taggerwidget.moc
$(srcdir)/juk.cpp: juk.moc
......@@ -30,7 +30,7 @@ Cache *Cache::instance()
return(cache);
}
Cache::Item *Cache::item(const QString &fileName) const
CacheItem *Cache::item(const QString &file) const
{
return(0);
}
......@@ -41,7 +41,7 @@ Cache::Item *Cache::item(const QString &fileName) const
Cache::Cache()
{
setAutoDelete(true);
}
Cache::~Cache()
......@@ -50,15 +50,20 @@ Cache::~Cache()
}
////////////////////////////////////////////////////////////////////////////////
// Cache::Item public methods
// CacheItem public methods
////////////////////////////////////////////////////////////////////////////////
Cache::Item::Item()
CacheItem::CacheItem()
{
}
Cache::Item::~Item()
CacheItem::CacheItem(const Tag &tag)
{
}
CacheItem::~CacheItem()
{
}
......@@ -19,18 +19,23 @@
#define CACHE_H
#include <qstring.h>
#include <qdict.h>
#include "tag.h"
// Eventually this should implement the same interface as the Tag class; in fact
// there should be an abstract API for both of them to use. But, for the
// moment this is just a place holder to fill in the design.
class Cache
class CacheItem;
class Cache : public QDict<CacheItem>
{
public:
class Item;
static Cache *instance();
Item *item(const QString &fileName) const;
CacheItem *item(const QString &fileName) const;
protected:
Cache();
......@@ -41,11 +46,18 @@ private:
};
class Cache::Item
class CacheItem
{
public:
Item();
virtual ~Item();
CacheItem();
CacheItem(const Tag &tag);
virtual ~CacheItem();
QString track() const { return QString::null; }
QString artist() const { return QString::null; }
QString album() const { return QString::null; }
QString trackNumber() const { return QString::null; }
QString length() const { return QString::null; }
};
#endif
......@@ -82,3 +82,4 @@ KToolBar *CustomAction::getToolBar()
{
return(toolbar);
}
#include "customaction.moc"
......@@ -22,6 +22,8 @@
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <qsplitter.h>
#include "juk.h"
////////////////////////////////////////////////////////////////////////////////
......@@ -53,7 +55,7 @@ void JuK::setupActions()
KStdAction::open(this, SLOT(openFile()), actionCollection());
(void) new KAction(i18n("Open &Directory..."), "fileopen", 0, this, SLOT(openDirectory()), actionCollection(), "openDirectory");
KStdAction::save(this, SLOT(saveFile()), actionCollection());
(void) new KAction(i18n("Delete"), "edittrash", 0, this, SLOT(deleteFile()), actionCollection(), "deleteFile");
(void) new KAction(i18n("Delete"), "edittrash", 0, this, SLOT(remove()), actionCollection(), "remove");
KStdAction::quit(this, SLOT(quit()), actionCollection());
// edit menu
......@@ -63,20 +65,10 @@ void JuK::setupActions()
KStdAction::selectAll(this, SLOT(selectAll()), actionCollection());
// play menu
addToPlaylistAction = new KAction(i18n("&Add to Playlist"), "enqueue", 0, this,
SLOT(addToPlaylist()), actionCollection(), "addToPlaylist");
removeFromPlaylistAction = new KAction(i18n("&Remove from Playlist"), "dequeue", 0, this,
SLOT(removeFromPlaylist()), actionCollection(), "removeFromPlaylist");
playAction = new KAction(i18n("&Play"), "1rightarrow", 0, this, SLOT(playFile()), actionCollection(), "playFile");
pauseAction = new KAction(i18n("P&ause"), "player_pause", 0, this, SLOT(pauseFile()), actionCollection(), "pauseFile");
stopAction = new KAction(i18n("&Stop"), "player_stop", 0, this, SLOT(stopFile()), actionCollection(), "stopFile");
// function menu
showTaggerAction = new KAction(i18n("Tagger"), "tag", 0, this, SLOT(showTagger()), actionCollection(), "showTagger");
showPlaylistAction = new KAction(i18n("Playlist Editor"), "edit", 0, this, SLOT(showPlaylist()), actionCollection(), "showPlaylist");
// just in the toolbar
sliderAction = new SliderAction(i18n("Track Position"), actionCollection(), "trackPositionAction");
......@@ -86,29 +78,23 @@ void JuK::setupActions()
void JuK::setupLayout()
{
// automagically save and restore settings
this->setAutoSaveSettings();
// create the main widgets
tagger = new TaggerWidget(this);
playlist = new PlaylistWidget(this);
setAutoSaveSettings();
showTagger();
splitter = new PlaylistSplitter(this, "playlistSplitter");
setCentralWidget(splitter);
// set the slider to the proper orientation and make it stay that way
sliderAction->updateOrientation();
connect(this, SIGNAL(dockWindowPositionChanged(QDockWindow *)), sliderAction, SLOT(updateOrientation(QDockWindow *)));
// playlist item activation connection
connect(playlist->getPlaylistList(), SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(playItem(QListViewItem *)));
connect(tagger->getTaggerList(), SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(playItem(QListViewItem *)));
tagger->getTaggerList()->setFocus();
connect(splitter, SIGNAL(playlistDoubleClicked(QListViewItem *)), this, SLOT(playItem(QListViewItem *)));
}
void JuK::setupPlayer()
{
trackPositionDragging=false;
noSeek=false;
trackPositionDragging = false;
noSeek = false;
pauseAction->setEnabled(false);
stopAction->setEnabled(false);
......@@ -133,8 +119,7 @@ void JuK::processArgs()
for(int i = 0; i < args->count(); i++)
files.append(args->arg(i));
if(tagger)
tagger->add(files);
splitter->open(files);
}
void JuK::readConfig()
......@@ -172,32 +157,30 @@ void JuK::saveConfig()
void JuK::openFile()
{
QStringList files = KFileDialog::getOpenFileNames(QString::null, "*.mp3|MPEG Audio (*.mp3)");
tagger->add(files);
splitter->open(files);
}
void JuK::openDirectory()
{
tagger->add(KFileDialog::getExistingDirectory());
splitter->open(KFileDialog::getExistingDirectory());
}
void JuK::saveFile()
{
if(tagger && tagger->isVisible())
tagger->save();
splitter->save();
}
void JuK::deleteFile()
void JuK::remove()
{
QPtrList<FileListItem> items(tagger->getSelectedItems());
FileListItem *item = items.first();
QPtrList<PlaylistItem> items(splitter->playlistSelection());
PlaylistItem *item = items.first();
while(item) {
if(item == playingItem)
playingItem = 0;
item = items.next();
if(item == playingItem)
playingItem = 0;
item = items.next();
}
if(tagger && tagger->isVisible())
tagger->deleteFile();
splitter->remove();
}
void JuK::quit()
......@@ -211,78 +194,27 @@ void JuK::quit()
void JuK::cut()
{
if(tagger && tagger->isVisible()) {
QPtrList<FileListItem> items(tagger->getTaggerList()->selectedItems());
FileListItem *item = items.first();
while(item) {
if(item == playingItem)
playingItem = 0;
item = items.next();
}
QPtrList<PlaylistItem> items = splitter->playlistSelection();
tagger->getTaggerList()->remove(items);
PlaylistItem *item = items.first();
while(item) {
if(item == playingItem)
playingItem = 0;
item = items.next();
}
else if(playlist && playlist->isVisible())
removeFromPlaylist();
}
void JuK::selectAll()
{
if(tagger && tagger->isVisible()) {
tagger->getTaggerList()->selectAll(true);
}
else if(playlist && playlist->isVisible()) {
playlist->getPlaylistList()->selectAll(true);
}
splitter->clearSelectedItems();
}
////////////////////////////////////////////////////////////////////////////////
// function menu
////////////////////////////////////////////////////////////////////////////////
void JuK::showTagger()
{
playlist->hide();
tagger->show();
setCentralWidget(tagger);
addToPlaylistAction->setEnabled(true);
removeFromPlaylistAction->setEnabled(false);
showTaggerAction->setEnabled(false);
showPlaylistAction->setEnabled(true);
}
void JuK::showPlaylist()
void JuK::selectAll(bool select)
{
tagger->hide();
playlist->show();
setCentralWidget(playlist);
addToPlaylistAction->setEnabled(false);
removeFromPlaylistAction->setEnabled(true);
showTaggerAction->setEnabled(true);
showPlaylistAction->setEnabled(false);
splitter->selectAll(select);
}
////////////////////////////////////////////////////////////////////////////////
// player menu
////////////////////////////////////////////////////////////////////////////////
void JuK::addToPlaylist()
{
QPtrList<FileListItem> items(tagger->getSelectedItems());
playlist->add(items);
}
void JuK::removeFromPlaylist()
{
QPtrList<FileListItem> items(playlist->getSelectedItems());
playlist->remove(items);
}
void JuK::playFile()
{
if(player.paused()) {
......@@ -294,12 +226,12 @@ void JuK::playFile()
playTimer->start(pollInterval);
}
}
else if(playlist) {
QPtrList<FileListItem> items(playlist->getSelectedItems());
else if(splitter) {
QPtrList<PlaylistItem> items = splitter->playlistSelection();
if(items.count() > 0)
playItem(dynamic_cast<FileListItem *>(items.at(0)));
playItem(items.at(0));
else
playItem(playlist->firstItem());
playItem(splitter->playlistFirstItem());
}
}
......@@ -349,9 +281,9 @@ void JuK::pollPlay()
if(player.paused())
pauseFile();
else {
if(playingItem && dynamic_cast<FileListItem*>(playingItem->itemBelow())) {
if(playingItem && dynamic_cast<PlaylistItem *>(playingItem->itemBelow())) {
playingItem->setPixmap(0, 0);
playingItem = dynamic_cast<FileListItem *>(playingItem->itemBelow());
playingItem = dynamic_cast<PlaylistItem *>(playingItem->itemBelow());
sliderAction->getTrackPositionSlider()->setValue(0);
player.play(playingItem->absFilePath(), player.getVolume());
if(player.playing()) {
......@@ -384,12 +316,12 @@ void JuK::setVolume(int volume)
void JuK::playItem(QListViewItem *item)
{
FileListItem *fileListItem = dynamic_cast<FileListItem *>(item);
PlaylistItem *fileListItem = dynamic_cast<PlaylistItem *>(item);
if(fileListItem)
playItem(fileListItem);
}
void JuK::playItem(FileListItem *item)
void JuK::playItem(PlaylistItem *item)
{
if(player.playing() || player.paused())
stopFile();
......@@ -414,7 +346,9 @@ void JuK::playTaggerItem(QListViewItem *item)
}
void JuK::playTaggerItem(FileListItem *item)
void JuK::playTaggerItem(PlaylistItem *item)
{
}
#include "juk.moc"
......@@ -28,11 +28,14 @@
#include <kmainwindow.h>
#include <qtimer.h>
#include <qwidgetstack.h>
#include "taggerwidget.h"
#include "playlistwidget.h"
#include "slideraction.h"
#include "player.h"
#include "playlistbox.h"
#include "playlistsplitter.h"
class JuK : public KMainWindow
{
......@@ -51,8 +54,7 @@ private:
void saveConfig();
// layout objects
TaggerWidget *tagger;
PlaylistWidget *playlist;
PlaylistSplitter *splitter;
// actions
SliderAction *sliderAction;
......@@ -60,15 +62,9 @@ private:
KAction *pauseAction;
KAction *stopAction;
KAction *showTaggerAction;
KAction *showPlaylistAction;
KAction *addToPlaylistAction;
KAction *removeFromPlaylistAction;
QTimer *playTimer;
Player player;
FileListItem *playingItem;
PlaylistItem *playingItem;
bool trackPositionDragging;
bool noSeek;
......@@ -79,22 +75,14 @@ private slots:
void openFile();
void openDirectory();
void saveFile();
void deleteFile();
void remove();
void quit();
// edit menu
void cut();
void copy() {};
void paste() {};
void selectAll();
// function menu
void showTagger();
void showPlaylist();
// player menu
void addToPlaylist();
void removeFromPlaylist();
void selectAll(bool select = true);
void playFile();
void pauseFile();
......@@ -107,9 +95,9 @@ private slots:
void pollPlay();
void setVolume(int volume);
void playItem(QListViewItem *item);
void playItem(FileListItem *item);
void playItem(PlaylistItem *item);
void playTaggerItem(QListViewItem *item);
void playTaggerItem(FileListItem *item);
void playTaggerItem(PlaylistItem *item);