Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 40bb10e2 authored by Scott Wheeler's avatar Scott Wheeler

Make startup time fast again -- make sure that we don't stat things before

we really need to.

svn path=/trunk/kdemultimedia/juk/; revision=321840
parent be857864
......@@ -266,8 +266,6 @@ void Cache::load()
s >> fileName;
fileName.squeeze();
FileHandle f(fileName);
s >> f;
// f.setFile(fileName);
FileHandle f(fileName, s);
}
}
......@@ -103,6 +103,15 @@ FileHandle::FileHandle(const QString &path) :
setup(QFileInfo(path), path);
}
FileHandle::FileHandle(const QString &path, CacheDataStream &s)
{
d = new FileHandlePrivate;
d->fileInfo = QFileInfo(path);
d->absFilePath = path;
read(s);
Cache::instance()->insert(*this);
}
FileHandle::~FileHandle()
{
if(d->deref())
......
......@@ -37,6 +37,7 @@ public:
FileHandle(const FileHandle &f);
explicit FileHandle(const QFileInfo &info, const QString &path = QString::null);
explicit FileHandle(const QString &path);
FileHandle(const QString &path, CacheDataStream &s);
~FileHandle();
/**
......
......@@ -378,8 +378,7 @@ int Playlist::time() const
QListViewItemIterator it(const_cast<Playlist *>(this));
while (it.current()) {
PlaylistItem *item = static_cast<PlaylistItem *>(it.current());
if(item->file().current())
time += item->file().tag()->seconds();
time += item->file().tag()->seconds();
it++;
}
return time;
......@@ -972,8 +971,12 @@ void Playlist::read(QDataStream &s)
QStringList files;
s >> files;
addFiles(files, false);
QListViewItem *after = 0;
for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
after = createItem(FileHandle(*it), after, false);
PlaylistInterface::update();
m_collection->setupPlaylist(this, "midi");
}
......@@ -1752,7 +1755,7 @@ void processEvents()
{
static QTime time = QTime::currentTime();
if(time.elapsed() > 1000) {
if(time.elapsed() > 500) {
time.restart();
kapp->processEvents();
}
......
......@@ -167,6 +167,10 @@ public:
* This handles adding files of various types -- music, playlist or directory
* files. Music files that are found will be added to this playlist. New
* playlist files that are found will result in new playlists being created.
*
* Note that this should not be used in the case of adding *only* playlist
* items since it has the overhead of checking to see if the file is a playlist
* or directory first.
*/
void addFiles(const QStringList &files, bool importPlaylists,
PlaylistItem *after = 0);
......
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