diff options
Diffstat (limited to 'juk/playlistcollection.cpp')
-rw-r--r-- | juk/playlistcollection.cpp | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/juk/playlistcollection.cpp b/juk/playlistcollection.cpp index 548734c8..2c30c692 100644 --- a/juk/playlistcollection.cpp +++ b/juk/playlistcollection.cpp @@ -15,7 +15,7 @@ #include <kurl.h> #include <config.h> -#include <qobjectlist.h> +#include <tqobjectlist.h> #include <sys/types.h> #include <dirent.h> @@ -41,8 +41,8 @@ #include <kmessagebox.h> #include <kfiledialog.h> -#include <qwidgetstack.h> -#include <qhbox.h> +#include <tqwidgetstack.h> +#include <tqhbox.h> #define widget (kapp->mainWidget()) @@ -58,7 +58,7 @@ PlaylistCollection *PlaylistCollection::m_instance = 0; // public methods //////////////////////////////////////////////////////////////////////////////// -PlaylistCollection::PlaylistCollection(QWidgetStack *playlistStack) : +PlaylistCollection::PlaylistCollection(TQWidgetStack *playlistStack) : m_playlistStack(playlistStack), m_historyPlaylist(0), m_upcomingPlaylist(0), @@ -91,7 +91,7 @@ PlaylistCollection::~PlaylistCollection() Playlist::setShuttingDown(); } -QString PlaylistCollection::name() const +TQString PlaylistCollection::name() const { return currentPlaylist()->name(); } @@ -151,12 +151,12 @@ bool PlaylistCollection::playing() const return m_playing; } -QStringList PlaylistCollection::playlists() const +TQStringList PlaylistCollection::playlists() const { - QStringList l; + TQStringList l; - QObjectList *childList = m_playlistStack->queryList("Playlist"); - QObject *obj; + TQObjectList *childList = m_playlistStack->queryList("Playlist"); + TQObject *obj; for(obj = childList->first(); obj; obj = childList->next()) { Playlist *p = static_cast<Playlist *>(obj); l.append(p->name()); @@ -166,7 +166,7 @@ QStringList PlaylistCollection::playlists() const return l; } -void PlaylistCollection::createPlaylist(const QString &name) +void PlaylistCollection::createPlaylist(const TQString &name) { raise(new Playlist(this, name)); } @@ -182,7 +182,7 @@ void PlaylistCollection::createDynamicPlaylist(const PlaylistList &playlists) PlaylistCollection::raise(m_dynamicPlaylist); } -void PlaylistCollection::showMore(const QString &artist, const QString &album) +void PlaylistCollection::showMore(const TQString &artist, const TQString &album) { PlaylistList playlists; @@ -223,20 +223,20 @@ void PlaylistCollection::showMore(const QString &artist, const QString &album) // so cache the value we want it to have now. Playlist *belowShowMore = visiblePlaylist(); - PlaylistCollection::setupPlaylist(m_showMorePlaylist, QString::null); + PlaylistCollection::setupPlaylist(m_showMorePlaylist, TQString::null); PlaylistCollection::raise(m_showMorePlaylist); m_belowShowMorePlaylist = belowShowMore; } -void PlaylistCollection::removeTrack(const QString &playlist, const QStringList &files) +void PlaylistCollection::removeTrack(const TQString &playlist, const TQStringList &files) { Playlist *p = playlistByName(playlist); PlaylistItemList itemList; if(!p) return; - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for(it = files.begin(); it != files.end(); ++it) { CollectionListItem *item = CollectionList::instance()->lookup(*it); @@ -250,50 +250,50 @@ void PlaylistCollection::removeTrack(const QString &playlist, const QStringList p->clearItems(itemList); } -QString PlaylistCollection::playlist() const +TQString PlaylistCollection::playlist() const { - return visiblePlaylist() ? visiblePlaylist()->name() : QString::null; + return visiblePlaylist() ? visiblePlaylist()->name() : TQString::null; } -QString PlaylistCollection::playingPlaylist() const +TQString PlaylistCollection::playingPlaylist() const { - return currentPlaylist() && m_playing ? currentPlaylist()->name() : QString::null; + return currentPlaylist() && m_playing ? currentPlaylist()->name() : TQString::null; } -void PlaylistCollection::setPlaylist(const QString &playlist) +void PlaylistCollection::setPlaylist(const TQString &playlist) { Playlist *p = playlistByName(playlist); if(p) raise(p); } -QStringList PlaylistCollection::playlistTracks(const QString &playlist) const +TQStringList PlaylistCollection::playlistTracks(const TQString &playlist) const { Playlist *p = playlistByName(playlist); if(p) return p->files(); - return QStringList(); + return TQStringList(); } -QString PlaylistCollection::trackProperty(const QString &file, const QString &property) const +TQString PlaylistCollection::trackProperty(const TQString &file, const TQString &property) const { CollectionList *l = CollectionList::instance(); CollectionListItem *item = l->lookup(file); - return item ? item->file().property(property) : QString::null; + return item ? item->file().property(property) : TQString::null; } -QPixmap PlaylistCollection::trackCover(const QString &file, const QString &size) const +TQPixmap PlaylistCollection::trackCover(const TQString &file, const TQString &size) const { if(size.lower() != "small" && size.lower() != "large") - return QPixmap(); + return TQPixmap(); CollectionList *l = CollectionList::instance(); CollectionListItem *item = l->lookup(file); if(!item) - return QPixmap(); + return TQPixmap(); if(size.lower() == "small") return item->file().coverInfo()->pixmap(CoverInfo::Thumbnail); @@ -301,9 +301,9 @@ QPixmap PlaylistCollection::trackCover(const QString &file, const QString &size) return item->file().coverInfo()->pixmap(CoverInfo::FullSize); } -void PlaylistCollection::open(const QStringList &l) +void PlaylistCollection::open(const TQStringList &l) { - QStringList files = l; + TQStringList files = l; if(files.isEmpty()) files = MediaFiles::openDialog(widget); @@ -313,14 +313,14 @@ void PlaylistCollection::open(const QStringList &l) bool justPlaylists = true; - for(QStringList::ConstIterator it = l.begin(); it != l.end() && justPlaylists; ++it) + for(TQStringList::ConstIterator it = l.begin(); it != l.end() && justPlaylists; ++it) justPlaylists = !MediaFiles::isPlaylistFile(*it); if(visiblePlaylist() == CollectionList::instance() || justPlaylists || KMessageBox::questionYesNo( widget, i18n("Do you want to add these items to the current list or to the collection list?"), - QString::null, + TQString::null, KGuiItem(i18n("Current")), KGuiItem(i18n("Collection"))) == KMessageBox::No) { @@ -332,7 +332,7 @@ void PlaylistCollection::open(const QStringList &l) dataChanged(); } -void PlaylistCollection::open(const QString &playlist, const QStringList &files) +void PlaylistCollection::open(const TQString &playlist, const TQStringList &files) { Playlist *p = playlistByName(playlist); @@ -346,21 +346,21 @@ void PlaylistCollection::addFolder() DirectoryList l(m_folderList, m_importPlaylists, widget, "directoryList"); DirectoryList::Result result = l.exec(); - if(result.status == QDialog::Accepted) { + if(result.status == TQDialog::Accepted) { m_dirLister.blockSignals(true); const bool reload = m_importPlaylists != result.addPlaylists; m_importPlaylists = result.addPlaylists; - for(QStringList::Iterator it = result.addedDirs.begin(); + for(TQStringList::Iterator it = result.addedDirs.begin(); it != result.addedDirs.end(); it++) { m_dirLister.openURL(*it, true); m_folderList.append(*it); } - for(QStringList::Iterator it = result.removedDirs.begin(); + for(TQStringList::Iterator it = result.removedDirs.begin(); it != result.removedDirs.end(); it++) { m_dirLister.stop(*it); @@ -380,8 +380,8 @@ void PlaylistCollection::addFolder() void PlaylistCollection::rename() { - QString old = visiblePlaylist()->name(); - QString name = playlistNameDialog(i18n("Rename"), old, false); + TQString old = visiblePlaylist()->name(); + TQString name = playlistNameDialog(i18n("Rename"), old, false); m_playlistNames.remove(old); @@ -393,7 +393,7 @@ void PlaylistCollection::rename() void PlaylistCollection::duplicate() { - QString name = playlistNameDialog(i18n("Duplicate"), visiblePlaylist()->name()); + TQString name = playlistNameDialog(i18n("Duplicate"), visiblePlaylist()->name()); if(name.isNull()) return; raise(new Playlist(this, visiblePlaylist()->items(), name)); @@ -486,14 +486,14 @@ void PlaylistCollection::scanFolders() void PlaylistCollection::createPlaylist() { - QString name = playlistNameDialog(); + TQString name = playlistNameDialog(); if(!name.isNull()) raise(new Playlist(this, name)); } void PlaylistCollection::createSearchPlaylist() { - QString name = uniquePlaylistName(i18n("Search Playlist")); + TQString name = uniquePlaylistName(i18n("Search Playlist")); AdvancedSearchDialog::Result r = AdvancedSearchDialog(name, PlaylistSearch(), widget).exec(); @@ -504,12 +504,12 @@ void PlaylistCollection::createSearchPlaylist() void PlaylistCollection::createFolderPlaylist() { - QString folder = KFileDialog::getExistingDirectory(); + TQString folder = KFileDialog::getExistingDirectory(); if(folder.isEmpty()) return; - QString name = uniquePlaylistName(folder.mid(folder.findRev('/') + 1)); + TQString name = uniquePlaylistName(folder.mid(folder.findRev('/') + 1)); name = playlistNameDialog(i18n("Create Folder Playlist"), name); if(!name.isNull()) @@ -588,7 +588,7 @@ void PlaylistCollection::setUpcomingPlaylistEnabled(bool enable) } } -QObject *PlaylistCollection::object() const +TQObject *PlaylistCollection::object() const { return m_actionHandler; } @@ -635,7 +635,7 @@ void PlaylistCollection::raiseDistraction() m_belowDistraction = currentPlaylist(); if(!m_distraction) { - m_distraction = new QHBox(m_playlistStack); + m_distraction = new TQHBox(m_playlistStack); m_playlistStack->addWidget(m_distraction); } @@ -657,12 +657,12 @@ void PlaylistCollection::lowerDistraction() // protected methods //////////////////////////////////////////////////////////////////////////////// -QWidgetStack *PlaylistCollection::playlistStack() const +TQWidgetStack *PlaylistCollection::playlistStack() const { return m_playlistStack; } -void PlaylistCollection::setupPlaylist(Playlist *playlist, const QString &) +void PlaylistCollection::setupPlaylist(Playlist *playlist, const TQString &) { if(!playlist->fileName().isNull()) m_playlistFiles.insert(playlist->fileName()); @@ -670,8 +670,8 @@ void PlaylistCollection::setupPlaylist(Playlist *playlist, const QString &) if(!playlist->name().isNull()) m_playlistNames.insert(playlist->name()); - QObject::connect(playlist, SIGNAL(selectionChanged()), - object(), SIGNAL(signalSelectedItemsChanged())); + TQObject::connect(playlist, TQT_SIGNAL(selectionChanged()), + object(), TQT_SIGNAL(signalSelectedItemsChanged())); } bool PlaylistCollection::importPlaylists() const @@ -679,7 +679,7 @@ bool PlaylistCollection::importPlaylists() const return m_importPlaylists; } -bool PlaylistCollection::containsPlaylistFile(const QString &file) const +bool PlaylistCollection::containsPlaylistFile(const TQString &file) const { return m_playlistFiles.contains(file); } @@ -706,36 +706,36 @@ void PlaylistCollection::clearShowMore(bool raisePlaylist) void PlaylistCollection::enableDirWatch(bool enable) { - QObject *collection = CollectionList::instance(); + TQObject *collection = CollectionList::instance(); m_dirLister.disconnect(object()); if(enable) { - QObject::connect(&m_dirLister, SIGNAL(newItems(const KFileItemList &)), - object(), SLOT(slotNewItems(const KFileItemList &))); - QObject::connect(&m_dirLister, SIGNAL(refreshItems(const KFileItemList &)), - collection, SLOT(slotRefreshItems(const KFileItemList &))); - QObject::connect(&m_dirLister, SIGNAL(deleteItem(KFileItem *)), - collection, SLOT(slotDeleteItem(KFileItem *))); + TQObject::connect(&m_dirLister, TQT_SIGNAL(newItems(const KFileItemList &)), + object(), TQT_SLOT(slotNewItems(const KFileItemList &))); + TQObject::connect(&m_dirLister, TQT_SIGNAL(refreshItems(const KFileItemList &)), + collection, TQT_SLOT(slotRefreshItems(const KFileItemList &))); + TQObject::connect(&m_dirLister, TQT_SIGNAL(deleteItem(KFileItem *)), + collection, TQT_SLOT(slotDeleteItem(KFileItem *))); } } -QString PlaylistCollection::playlistNameDialog(const QString &caption, - const QString &suggest, +TQString PlaylistCollection::playlistNameDialog(const TQString &caption, + const TQString &suggest, bool forceUnique) const { bool ok; - QString name = KInputDialog::getText( + TQString name = KInputDialog::getText( caption, i18n("Please enter a name for this playlist:"), forceUnique ? uniquePlaylistName(suggest) : suggest, &ok); - return ok ? uniquePlaylistName(name) : QString::null; + return ok ? uniquePlaylistName(name) : TQString::null; } -QString PlaylistCollection::uniquePlaylistName(const QString &suggest) const +TQString PlaylistCollection::uniquePlaylistName(const TQString &suggest) const { if(suggest.isEmpty()) return uniquePlaylistName(); @@ -743,50 +743,50 @@ QString PlaylistCollection::uniquePlaylistName(const QString &suggest) const if(!m_playlistNames.contains(suggest)) return suggest; - QString base = suggest; - base.remove(QRegExp("\\s\\([0-9]+\\)$")); + TQString base = suggest; + base.remove(TQRegExp("\\s\\([0-9]+\\)$")); int count = 1; - QString s = QString("%1 (%2)").arg(base).arg(count); + TQString s = TQString("%1 (%2)").arg(base).arg(count); while(m_playlistNames.contains(s)) { count++; - s = QString("%1 (%2)").arg(base).arg(count); + s = TQString("%1 (%2)").arg(base).arg(count); } return s; } -void PlaylistCollection::addNameToDict(const QString &name) +void PlaylistCollection::addNameToDict(const TQString &name) { m_playlistNames.insert(name); } -void PlaylistCollection::addFileToDict(const QString &file) +void PlaylistCollection::addFileToDict(const TQString &file) { m_playlistFiles.insert(file); } -void PlaylistCollection::removeNameFromDict(const QString &name) +void PlaylistCollection::removeNameFromDict(const TQString &name) { m_playlistNames.remove(name); } -void PlaylistCollection::removeFileFromDict(const QString &file) +void PlaylistCollection::removeFileFromDict(const TQString &file) { m_playlistFiles.remove(file); } -void PlaylistCollection::dirChanged(const QString &path) +void PlaylistCollection::dirChanged(const TQString &path) { CollectionList::instance()->addFiles(path); } -Playlist *PlaylistCollection::playlistByName(const QString &name) const +Playlist *PlaylistCollection::playlistByName(const TQString &name) const { - QObjectList *l = m_playlistStack->queryList("Playlist"); + TQObjectList *l = m_playlistStack->queryList("Playlist"); Playlist *list = 0; - QObject *obj; + TQObject *obj; for(obj = l->first(); obj; obj = l->next()) { Playlist *p = static_cast<Playlist*>(obj); @@ -816,7 +816,7 @@ void PlaylistCollection::readConfig() m_importPlaylists = config.readBoolEntry("ImportPlaylists", true); m_folderList = config.readPathListEntry("DirectoryList"); - for(QStringList::ConstIterator it = m_folderList.begin(); it != m_folderList.end(); ++it) + for(TQStringList::ConstIterator it = m_folderList.begin(); it != m_folderList.end(); ++it) m_dirLister.openURL(*it, true); } @@ -833,7 +833,7 @@ void PlaylistCollection::saveConfig() //////////////////////////////////////////////////////////////////////////////// PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection) : - QObject(0, "ActionHandler"), + TQObject(0, "ActionHandler"), m_collection(collection) { KActionMenu *menu; @@ -842,60 +842,60 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection) menu = new KActionMenu(i18n("&New"), "filenew", actions(), "file_new"); - menu->insert(createAction(i18n("&Empty Playlist..."), SLOT(slotCreatePlaylist()), + menu->insert(createAction(i18n("&Empty Playlist..."), TQT_SLOT(slotCreatePlaylist()), "newPlaylist", "window_new", "CTRL+n")); - menu->insert(createAction(i18n("&Search Playlist..."), SLOT(slotCreateSearchPlaylist()), + menu->insert(createAction(i18n("&Search Playlist..."), TQT_SLOT(slotCreateSearchPlaylist()), "newSearchPlaylist", "find", "CTRL+f")); - menu->insert(createAction(i18n("Playlist From &Folder..."), SLOT(slotCreateFolderPlaylist()), + menu->insert(createAction(i18n("Playlist From &Folder..."), TQT_SLOT(slotCreateFolderPlaylist()), "newDirectoryPlaylist", "fileopen", "CTRL+d")); // Guess tag info menu #if HAVE_MUSICBRAINZ - menu = new KActionMenu(i18n("&Guess Tag Information"), QString::null, actions(), "guessTag"); + menu = new KActionMenu(i18n("&Guess Tag Information"), TQString::null, actions(), "guessTag"); menu->setIconSet(SmallIconSet("wizard")); - menu->insert(createAction(i18n("From &File Name"), SLOT(slotGuessTagFromFile()), + menu->insert(createAction(i18n("From &File Name"), TQT_SLOT(slotGuessTagFromFile()), "guessTagFile", "fileimport", "CTRL+g")); - menu->insert(createAction(i18n("From &Internet"), SLOT(slotGuessTagFromInternet()), + menu->insert(createAction(i18n("From &Internet"), TQT_SLOT(slotGuessTagFromInternet()), "guessTagInternet", "connect_established", "CTRL+i")); #else - createAction(i18n("Guess Tag Information From &File Name"), SLOT(slotGuessTagFromFile()), + createAction(i18n("Guess Tag Information From &File Name"), TQT_SLOT(slotGuessTagFromFile()), "guessTag", "fileimport", "CTRL+f"); #endif - createAction(i18n("Play First Track"),SLOT(slotPlayFirst()), "playFirst"); - createAction(i18n("Play Next Album"), SLOT(slotPlayNextAlbum()), "forwardAlbum", "next"); + createAction(i18n("Play First Track"),TQT_SLOT(slotPlayFirst()), "playFirst"); + createAction(i18n("Play Next Album"), TQT_SLOT(slotPlayNextAlbum()), "forwardAlbum", "next"); - createAction(i18n("Open..."), SLOT(slotOpen()), "file_open", "fileopen", "CTRL+o"); - createAction(i18n("Add &Folder..."), SLOT(slotAddFolder()), "openDirectory", "fileopen"); - createAction(i18n("&Rename..."), SLOT(slotRename()), "renamePlaylist", "lineedit"); - createAction(i18n("D&uplicate..."), SLOT(slotDuplicate()), "duplicatePlaylist", "editcopy"); - createAction(i18n("Save"), SLOT(slotSave()), "file_save", "filesave", "CTRL+s"); - createAction(i18n("Save As..."), SLOT(slotSaveAs()), "file_save_as", "filesaveas"); - createAction(i18n("R&emove"), SLOT(slotRemove()), "deleteItemPlaylist", "edittrash"); - createAction(i18n("Reload"), SLOT(slotReload()), "reloadPlaylist", "reload"); - createAction(i18n("Edit Search..."), SLOT(slotEditSearch()), "editSearch", "editclear"); + createAction(i18n("Open..."), TQT_SLOT(slotOpen()), "file_open", "fileopen", "CTRL+o"); + createAction(i18n("Add &Folder..."), TQT_SLOT(slotAddFolder()), "openDirectory", "fileopen"); + createAction(i18n("&Rename..."), TQT_SLOT(slotRename()), "renamePlaylist", "lineedit"); + createAction(i18n("D&uplicate..."), TQT_SLOT(slotDuplicate()), "duplicatePlaylist", "editcopy"); + createAction(i18n("Save"), TQT_SLOT(slotSave()), "file_save", "filesave", "CTRL+s"); + createAction(i18n("Save As..."), TQT_SLOT(slotSaveAs()), "file_save_as", "filesaveas"); + createAction(i18n("R&emove"), TQT_SLOT(slotRemove()), "deleteItemPlaylist", "edittrash"); + createAction(i18n("Reload"), TQT_SLOT(slotReload()), "reloadPlaylist", "reload"); + createAction(i18n("Edit Search..."), TQT_SLOT(slotEditSearch()), "editSearch", "editclear"); - createAction(i18n("&Delete"), SLOT(slotRemoveItems()), "removeItem", "editdelete"); - createAction(i18n("Refresh"), SLOT(slotRefreshItems()), "refresh", "reload"); - createAction(i18n("&Rename File"), SLOT(slotRenameItems()), "renameFile", "filesaveas", "CTRL+r"); + createAction(i18n("&Delete"), TQT_SLOT(slotRemoveItems()), "removeItem", "editdelete"); + createAction(i18n("Refresh"), TQT_SLOT(slotRefreshItems()), "refresh", "reload"); + createAction(i18n("&Rename File"), TQT_SLOT(slotRenameItems()), "renameFile", "filesaveas", "CTRL+r"); - menu = new KActionMenu(i18n("Cover Manager"), QString::null, actions(), "coverManager"); + menu = new KActionMenu(i18n("Cover Manager"), TQString::null, actions(), "coverManager"); menu->setIconSet(SmallIconSet("image")); menu->insert(createAction(i18n("&View Cover"), - SLOT(slotViewCovers()), "viewCover", "viewmag")); + TQT_SLOT(slotViewCovers()), "viewCover", "viewmag")); menu->insert(createAction(i18n("Get Cover From &File..."), - SLOT(slotAddLocalCover()), "addCover", "fileimport", "CTRL+SHIFT+f")); + TQT_SLOT(slotAddLocalCover()), "addCover", "fileimport", "CTRL+SHIFT+f")); // Do not rename googleCover for backward compatibility menu->insert(createAction(i18n("Get Cover From &Internet..."), - SLOT(slotAddInternetCover()), "googleCover", "connect_established", "CTRL+SHIFT+g")); + TQT_SLOT(slotAddInternetCover()), "googleCover", "connect_established", "CTRL+SHIFT+g")); menu->insert(createAction(i18n("&Delete Cover"), - SLOT(slotRemoveCovers()), "removeCover", "editdelete")); + TQT_SLOT(slotRemoveCovers()), "removeCover", "editdelete")); menu->insert(createAction(i18n("Show Cover &Manager"), - SLOT(slotShowCoverManager()), "showCoverManager")); + TQT_SLOT(slotShowCoverManager()), "showCoverManager")); KToggleAction *historyAction = new KToggleAction(i18n("Show &History"), "history", 0, actions(), "showHistory"); @@ -905,16 +905,16 @@ PlaylistCollection::ActionHandler::ActionHandler(PlaylistCollection *collection) new KToggleAction(i18n("Show &Play Queue"), "today", 0, actions(), "showUpcoming"); upcomingAction->setCheckedState(i18n("Hide &Play Queue")); - connect(action<KToggleAction>("showHistory"), SIGNAL(toggled(bool)), - this, SLOT(slotSetHistoryPlaylistEnabled(bool))); - connect(action<KToggleAction>("showUpcoming"), SIGNAL(toggled(bool)), - this, SLOT(slotSetUpcomingPlaylistEnabled(bool))); + connect(action<KToggleAction>("showHistory"), TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(slotSetHistoryPlaylistEnabled(bool))); + connect(action<KToggleAction>("showUpcoming"), TQT_SIGNAL(toggled(bool)), + this, TQT_SLOT(slotSetUpcomingPlaylistEnabled(bool))); } -KAction *PlaylistCollection::ActionHandler::createAction(const QString &text, +KAction *PlaylistCollection::ActionHandler::createAction(const TQString &text, const char *slot, const char *name, - const QString &icon, + const TQString &icon, const KShortcut &shortcut) { if(icon.isNull()) |