Commit 6df2292a authored by Scott Wheeler's avatar Scott Wheeler

A cubic assload of source cleanups.

svn path=/trunk/kdemultimedia/juk/; revision=176264
parent bb258845
......@@ -3,12 +3,12 @@ bin_PROGRAMS = juk
## INCLUDES were found outside kdevelop specific part
juk_SOURCES = audiodata.cpp cacheitem.cpp filelistitemdata.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 = 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_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 filelistitemdata.cpp filelistitemdata.h cacheitem.cpp cacheitem.h audiodata.cpp audiodata.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 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
install-data-local:
$(mkinstalldirs) $(kde_appsdir)/Multimedia/
......
This diff is collapsed.
......@@ -62,8 +62,6 @@ AudioData::AudioData(const char* filein)
success = false;
fileglob = strdup(filein);
lengthchar = 0;
FILE* file;
if ((file = fopen(filein, "r")))
......@@ -80,8 +78,6 @@ AudioData::AudioData(const char* filein)
AudioData::~AudioData()
{
free(fileglob);
if(lengthchar)
free(lengthchar);
}
bool AudioData::readLayerInfo (FILE* file)
......@@ -164,23 +160,27 @@ bool AudioData::headCheck(unsigned long head)
return true;
}
int AudioData::getBitrate(){
int AudioData::getBitrate() const
{
return (bitrates[version][layer - 1][bitrate_index]);
}
int AudioData::getSamplerate(){
int AudioData::getSamplerate() const
{
return (s_freq[version][sampling_frequency]);
}
const char* AudioData::getMpegver(){
QString AudioData::getMpegver() const
{
return (version_names[version]);
}
int AudioData::getLayer() {
int AudioData::getLayer() const
{
return layer;
}
const char* AudioData::getMode(int mode)
QString AudioData::getMode(int mode)
{
if ((mode >= 0) && (mode < 5))
return (mode_names[mode]);
......@@ -188,16 +188,18 @@ const char* AudioData::getMode(int mode)
return "Stereo";
}
int AudioData::getMode()
int AudioData::getMode() const
{
return mode;
}
int AudioData::getLength() {
int AudioData::getLength() const
{
return length;
}
char* AudioData::getLengthChar() {
QString AudioData::getLengthChar() const
{
if(success) {
int min, sec;
char buf[6];
......@@ -205,18 +207,18 @@ char* AudioData::getLengthChar() {
min=length/60;
sec=length%60;
sprintf (buf, "%d:%02d", min, sec);
lengthchar=strdup (buf);
return lengthchar;
return buf;
}
else
return 0;
}
int AudioData::getSize() {
int AudioData::getSize() const
{
return filelen;
}
bool AudioData::getResult()
bool AudioData::getResult() const
{
return success;
}
......@@ -8,6 +8,7 @@
fileinfo.h was modified to just include header information instead of
header and id3 information. These changes were made by Scott Wheeler
(scott@slackorama.net) on 1/13/2002 based on Mp3Kult v0.5.
***************************************************************************/
/***************************************************************************
......@@ -17,39 +18,46 @@
* (at your option) any later version. *
***************************************************************************/
#ifndef AUDIODATA_H
#define AUDIODATA_H
#include <qstring.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
// I've started hacking a little on this file; both the API and the
// implementation. There's still a lot of ugly, non-Qt-happy stuff
// in here, but that will be fixed, well, as I feel motivated.
// (And fortunately I can blame someone else for this file. ;-) )
class AudioData
{
public:
AudioData(const char* filein);
~AudioData();
virtual ~AudioData();
int getBitrate();
int getSamplerate();
const char* getMpegver();
int getLayer();
static const char* getMode(int mode);
int getMode();
int getLength();
char* getLengthChar();
int getSize();
int getBitrate() const;
int getSamplerate() const;
QString getMpegver() const;
int getLayer() const;
static QString getMode(int mode);
int getMode() const;
int getLength() const;
QString getLengthChar() const;
int getSize() const;
bool getResult();
bool getResult() const;
private:
bool success;
char* fileglob;
int length;
char* lengthchar;
int version;
int filelen;
int layer;
......
/***************************************************************************
filelistitemdata.cpp - description
cache.cpp - description
-------------------
begin : Fri Mar 22 2002
begin : Sat Sep 7 2002
copyright : (C) 2002 by Scott Wheeler
email : scott@slackorama.net
***************************************************************************/
***************************************************************************/
/***************************************************************************
* *
......@@ -15,60 +15,50 @@
* *
***************************************************************************/
#include "filelistitemdata.h"
#include "cache.h"
Cache *Cache::cache = 0;
////////////////////////////////////////////////////////////////////////////////
// public methods
// Cache public methods
////////////////////////////////////////////////////////////////////////////////
FileListItemData::FileListItemData(QFileInfo &file) : QFileInfo(file)
Cache *Cache::instance()
{
referenceCount = 1;
// initialize pointers to null
cache = 0;
tag = 0;
audioData = 0;
if(!cache)
cache = new Cache();
return(cache);
}
FileListItemData::~FileListItemData()
Cache::Item *Cache::item(const QString &fileName) const
{
delete(cache);
delete(tag);
delete(audioData);
return(0);
}
FileListItemData *FileListItemData::newUser()
{
referenceCount++;
return(this);
}
////////////////////////////////////////////////////////////////////////////////
// Cache protected methods
////////////////////////////////////////////////////////////////////////////////
void FileListItemData::deleteUser()
Cache::Cache()
{
if(--referenceCount == 0)
delete(this);
}
Tag *FileListItemData::getTag()
Cache::~Cache()
{
if(!tag)
tag = new Tag(filePath());
return(tag);
delete(cache);
}
AudioData *FileListItemData::getAudioData()
////////////////////////////////////////////////////////////////////////////////
// Cache::Item public methods
////////////////////////////////////////////////////////////////////////////////
Cache::Item::Item()
{
if(!audioData) {
audioData = new AudioData(filePath());
}
return(audioData);
}
void FileListItemData::setFile(QString file)
Cache::Item::~Item()
{
delete(tag);
tag = 0;
QFileInfo::setFile(file);
}
/***************************************************************************
filelistitemdata.h - description
cache.h - description
-------------------
begin : Fri Mar 22 2002
begin : Sat Sep 7 2002
copyright : (C) 2002 by Scott Wheeler
email : scott@slackorama.net
***************************************************************************/
***************************************************************************/
/***************************************************************************
* *
......@@ -15,37 +15,37 @@
* *
***************************************************************************/
#ifndef FILELISTITEMDATA_H
#define FILELISTITEMDATA_H
#include <qfileinfo.h>
#ifndef CACHE_H
#define CACHE_H
#include <stdlib.h>
#include <qstring.h>
#include "tag.h"
#include "cacheitem.h"
#include "audiodata.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 FileListItemData : public QFileInfo
class Cache
{
public:
FileListItemData(QFileInfo &file);
~FileListItemData();
FileListItemData *newUser();
void deleteUser();
class Item;
Tag *getTag();
AudioData *getAudioData();
static Cache *instance();
Item *item(const QString &fileName) const;
void setFile(QString file);
protected:
Cache();
virtual ~Cache();
private:
int referenceCount;
static Cache *cache;
};
CacheItem *cache;
Tag *tag;
AudioData *audioData;
class Cache::Item
{
public:
Item();
virtual ~Item();
};
#endif
......@@ -22,7 +22,7 @@ class CacheItem
{
public:
CacheItem();
~CacheItem();
virtual ~CacheItem();
};
#endif
......@@ -29,6 +29,7 @@ CustomAction::CustomAction(const QString &text, QObject *parent, const char *nam
CustomAction::~CustomAction()
{
}
int CustomAction::plug(QWidget *parent, int index)
......
......@@ -24,12 +24,16 @@
#include <qstring.h>
#include <qobject.h>
// Many months after writing this, despite having felt rather clever at the time
// I am now rather convinced that this is The Wrong Way (tm) to have handled
// things and will hopefully un-hack this later.
class CustomAction : public KAction
{
Q_OBJECT
public:
CustomAction(const QString &text, QObject *parent, const char *name);
~CustomAction();
virtual ~CustomAction();
virtual int plug(QWidget *parent, int index = -1);
virtual void unplug(QWidget *widget);
......
# KDE tags expanded automatically by am_edit - $Revision$
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
......@@ -11,8 +12,9 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
####### kdevelop will overwrite this part!!! (begin)##########
@SET_MAKE@
####### kdevelop will overwrite this part!!! (begin)##########
SHELL = @SHELL@
......@@ -21,10 +23,6 @@ top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
#>-
bindir = @bindir@
#>+ 3
DEPDIR = .deps
bindir = @bindir@
sbindir = @sbindir@
......@@ -37,13 +35,9 @@ infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
......@@ -52,11 +46,11 @@ AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
......@@ -69,9 +63,11 @@ host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AMTAR = @AMTAR@
ARTSCCONFIG = @ARTSCCONFIG@
AS = @AS@
AUTODIRS = @AUTODIRS@
AWK = @AWK@
CC = @CC@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
......@@ -80,6 +76,7 @@ CXXCPP = @CXXCPP@
DCOPIDL = @DCOPIDL@
DCOPIDL2CPP = @DCOPIDL2CPP@
DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DPMSINC = @DPMSINC@
DPMSLIB = @DPMSLIB@
......@@ -92,6 +89,7 @@ GLLIB = @GLLIB@
GMSGFMT = @GMSGFMT@
IDL = @IDL@
IDL_DEPENDENCIES = @IDL_DEPENDENCIES@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAR = @JAR@
JAVAC = @JAVAC@
JAVAH = @JAVAH@
......@@ -152,7 +150,6 @@ LIB_SMB = @LIB_SMB@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MCOPIDL = @MCOPIDL@
MEINPROC = @MEINPROC@
MICO_INCLUDES = @MICO_INCLUDES@
......@@ -198,7 +195,10 @@ X_LDFLAGS = @X_LDFLAGS@
X_PRE_LIBS = @X_PRE_LIBS@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__include = @am__include@
am__quote = @am__quote@
idldir = @idldir@
install_sh = @install_sh@
jni_includes = @jni_includes@
kde_appsdir = @kde_appsdir@
kde_bindir = @kde_bindir@
......@@ -227,145 +227,165 @@ qt_libraries = @qt_libraries@
x_includes = @x_includes@
x_libraries = @x_libraries@
EXTRA_DIST = id3v1.genreml
####### kdevelop will overwrite this part!!! (end)############
datadir = $(kde_datadir)/juk
EXTRA_DIST = id3v1.genreml
data_DATA = id3v1.genreml
subdir = juk/data
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = ../../config.h
CONFIG_CLEAN_FILES =
DATA = $(data_DATA)
DIST_COMMON = Makefile.am Makefile.in
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DATA = $(data_DATA)
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
#>- all: all-redirect
DIST_COMMON = Makefile.am Makefile.in
#>- all: all-am
#>+ 1
all: docs-am all-redirect
all: docs-am all-am
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && $(AUTOMAKE) --gnu juk/data/Makefile
#>+ 2
cd $(top_srcdir) && $(AUTOMAKE) --gnu juk/data/Makefile
cd $(top_srcdir) && perl admin/am_edit juk/data/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --gnu juk/data/Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu juk/data/Makefile
cd $(top_srcdir) && perl admin/am_edit juk/data/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
uninstall-info-am:
install-dataDATA: $(data_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(datadir)
@list='$(data_DATA)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p"; \
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(datadir)/$$p; \
else if test -f $$p; then \
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p"; \
$(INSTALL_DATA) $$p $(DESTDIR)$(datadir)/$$p; \
fi; fi; \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(datadir)/$$f"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(datadir)/$$f; \
done
uninstall-dataDATA:
@$(NORMAL_UNINSTALL)
list='$(data_DATA)'; for p in $$list; do \
rm -f $(DESTDIR)$(datadir)/$$p; \
@list='$(data_DATA)'; for p in $$list; do \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " rm -f $(DESTDIR)$(datadir)/$$f"; \
rm -f $(DESTDIR)$(datadir)/$$f; \
done
tags: TAGS
TAGS:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
subdir = juk/data
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu juk/data/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
cp -pR $$d/$$file $(distdir) \
|| exit 1; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
all-am: Makefile $(DATA)
install-data-am: install-dataDATA
install-data: install-data-am
installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-dataDATA
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
all-am: Makefile $(DATA)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(datadir)
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \