diff options
Diffstat (limited to 'noatun/modules/splitplaylist/view.cpp')
-rw-r--r-- | noatun/modules/splitplaylist/view.cpp | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/noatun/modules/splitplaylist/view.cpp b/noatun/modules/splitplaylist/view.cpp index 7f5584f9..8df38afd 100644 --- a/noatun/modules/splitplaylist/view.cpp +++ b/noatun/modules/splitplaylist/view.cpp @@ -10,13 +10,13 @@ // Abandon All Hope, Ye Who Enter Here -#include <qdragobject.h> -#include <qheader.h> -#include <qlayout.h> -#include <qmap.h> -#include <qregexp.h> -#include <qtextstream.h> -#include <qpainter.h> +#include <tqdragobject.h> +#include <tqheader.h> +#include <tqlayout.h> +#include <tqmap.h> +#include <tqregexp.h> +#include <tqtextstream.h> +#include <tqpainter.h> #include <kaction.h> #include <kdebug.h> @@ -43,8 +43,8 @@ #define SPL SplitPlaylist::SPL() -SafeListViewItem::SafeListViewItem(QListView *parent, QListViewItem *after, const KURL &text) - : QCheckListItem(parent,0, QCheckListItem::CheckBox), PlaylistItemData(), removed(false) +SafeListViewItem::SafeListViewItem(TQListView *parent, TQListViewItem *after, const KURL &text) + : TQCheckListItem(parent,0, TQCheckListItem::CheckBox), PlaylistItemData(), removed(false) { addRef(); setUrl(text); @@ -65,8 +65,8 @@ SafeListViewItem::SafeListViewItem(QListView *parent, QListViewItem *after, cons PlaylistItemData::added(); } -SafeListViewItem::SafeListViewItem(QListView *parent, QListViewItem *after, const QMap<QString,QString> &props) - : QCheckListItem(parent, 0, QCheckListItem::CheckBox), removed(false) +SafeListViewItem::SafeListViewItem(TQListView *parent, TQListViewItem *after, const TQMap<TQString,TQString> &props) + : TQCheckListItem(parent, 0, TQCheckListItem::CheckBox), removed(false) { addRef(); @@ -75,10 +75,10 @@ SafeListViewItem::SafeListViewItem(QListView *parent, QListViewItem *after, cons // A version of setProperty that assumes a key is unique, // and doesn't call modified for every new key. // Ugly, but this function is a very hot path on playlist loading - for (QMap<QString,QString>::ConstIterator i=props.begin(); i!=props.end(); ++i ) + for (TQMap<TQString,TQString>::ConstIterator i=props.begin(); i!=props.end(); ++i ) { - QString n = i.key(); - QString val = i.data(); + TQString n = i.key(); + TQString val = i.data(); if (n=="enabled") { @@ -109,12 +109,12 @@ SafeListViewItem::~SafeListViewItem() remove(); } -QString SafeListViewItem::file() const +TQString SafeListViewItem::file() const { return localFilename(); } -static void pad(QString &str) +static void pad(TQString &str) { int len=str.length(); int at = 0; @@ -123,11 +123,11 @@ static void pad(QString &str) static const int paddingsize=12; // not static for reason - const QChar chars[paddingsize] = + const TQChar chars[paddingsize] = { - QChar('0'), QChar('0'), QChar('0'), QChar('0'), - QChar('0'), QChar('0'), QChar('0'), QChar('0'), - QChar('0'), QChar('0'), QChar('0'), QChar('0') + TQChar('0'), TQChar('0'), TQChar('0'), TQChar('0'), + TQChar('0'), TQChar('0'), TQChar('0'), TQChar('0'), + TQChar('0'), TQChar('0'), TQChar('0'), TQChar('0') }; for (int i=0; i < len; i++) @@ -155,19 +155,19 @@ static void pad(QString &str) } } -int SafeListViewItem::compare(QListViewItem * i, int col, bool) const +int SafeListViewItem::compare(TQListViewItem * i, int col, bool) const { - QString text1 = text(col); - QString text2 = i->text(col); + TQString text1 = text(col); + TQString text2 = i->text(col); pad(text1); pad(text2); return text1.compare(text2); } -QString SafeListViewItem::property(const QString &n, const QString &def) const +TQString SafeListViewItem::property(const TQString &n, const TQString &def) const { - for (QValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) + for (TQValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) { if ((*i).key==n) return (*i).value; @@ -180,7 +180,7 @@ QString SafeListViewItem::property(const QString &n, const QString &def) const return def; } -void SafeListViewItem::setProperty(const QString &n, const QString &val) +void SafeListViewItem::setProperty(const TQString &n, const TQString &val) { if (n=="enabled") { @@ -201,7 +201,7 @@ void SafeListViewItem::setProperty(const QString &n, const QString &val) modified(); } -void SafeListViewItem::clearProperty(const QString &n) +void SafeListViewItem::clearProperty(const TQString &n) { if (n=="enabled") { @@ -210,7 +210,7 @@ void SafeListViewItem::clearProperty(const QString &n) return; } - for (QValueList<Property>::Iterator i=mProperties.begin(); i != mProperties.end(); ++i) + for (TQValueList<Property>::Iterator i=mProperties.begin(); i != mProperties.end(); ++i) { if ((*i).key==n) { @@ -221,18 +221,18 @@ void SafeListViewItem::clearProperty(const QString &n) } } -QStringList SafeListViewItem::properties() const +TQStringList SafeListViewItem::properties() const { - QStringList list; - for (QValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) + TQStringList list; + for (TQValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) list += (*i).key; list += "enabled"; return list; } -bool SafeListViewItem::isProperty(const QString &n) const +bool SafeListViewItem::isProperty(const TQString &n) const { - for (QValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) + for (TQValueList<Property>::ConstIterator i=mProperties.begin(); i != mProperties.end(); ++i) { if ((*i).key==n) return true; @@ -243,7 +243,7 @@ bool SafeListViewItem::isProperty(const QString &n) const void SafeListViewItem::downloaded(int percent) { if (!removed) - setText(1, QString::number(percent)+'%'); + setText(1, TQString::number(percent)+'%'); } void SafeListViewItem::downloadTimeout() @@ -285,25 +285,25 @@ void SafeListViewItem::stateChange(bool s) // if you uncheck this, uncheck thet others that // are selected too - QPtrList<QListViewItem> list=SPL->view->listView()->selectedItems(); + TQPtrList<TQListViewItem> list=SPL->view->listView()->selectedItems(); // but not if I'm not selected if (list.containsRef(this)) - for (QListViewItem *i=list.first(); i != 0; i=list.next()) - static_cast<QCheckListItem*>(i)->setOn(s); + for (TQListViewItem *i=list.first(); i != 0; i=list.next()) + static_cast<TQCheckListItem*>(i)->setOn(s); else - QCheckListItem::stateChange(s); + TQCheckListItem::stateChange(s); } -void SafeListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align) +void SafeListViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align) { - QCheckListItem::paintCell(p, cg, column, width, align); + TQCheckListItem::paintCell(p, cg, column, width, align); if (SPL->current() == this) { p->save(); p->setRasterOp(XorROP); - p->fillRect(0, 0, width, height(), QColor(255,255,255)); + p->fillRect(0, 0, width, height(), TQColor(255,255,255)); p->restore(); } @@ -354,11 +354,11 @@ List::List(View *parent) setDropVisualizer(true); setDragEnabled(true); setItemsMovable(true); - setSelectionMode(QListView::Extended); - connect(this, SIGNAL(dropped(QDropEvent*, QListViewItem*)), SLOT(dropEvent(QDropEvent*, QListViewItem*))); - connect(this, SIGNAL(moved()), SLOT(move())); - connect(this, SIGNAL(aboutToMove()), parent, SLOT(setNoSorting())); - connect(this, SIGNAL(deleteCurrentItem()), parent, SLOT(deleteSelected())); + setSelectionMode(TQListView::Extended); + connect(this, TQT_SIGNAL(dropped(TQDropEvent*, TQListViewItem*)), TQT_SLOT(dropEvent(TQDropEvent*, TQListViewItem*))); + connect(this, TQT_SIGNAL(moved()), TQT_SLOT(move())); + connect(this, TQT_SIGNAL(aboutToMove()), parent, TQT_SLOT(setNoSorting())); + connect(this, TQT_SIGNAL(deleteCurrentItem()), parent, TQT_SLOT(deleteSelected())); } List::~List() @@ -370,12 +370,12 @@ void List::move() emit modified(); } -bool List::acceptDrag(QDropEvent *event) const +bool List::acceptDrag(TQDropEvent *event) const { return KURLDrag::canDecode(event) || KListView::acceptDrag(event); } -void List::dropEvent(QDropEvent *event, QListViewItem *after) +void List::dropEvent(TQDropEvent *event, TQListViewItem *after) { static_cast<View*>(parent())->setNoSorting(); KURL::List textlist; @@ -390,7 +390,7 @@ void List::dropEvent(QDropEvent *event, QListViewItem *after) emit modified(); } -void List::keyPressEvent(QKeyEvent *e) +void List::keyPressEvent(TQKeyEvent *e) { if (e->key()==Key_Enter || e->key()==Key_Return) { @@ -425,18 +425,18 @@ class NoatunSaver : public PlaylistSaver List *mList; SafeListViewItem *after, *mFirst; public: - NoatunSaver(List *l, QListViewItem *after=0) + NoatunSaver(List *l, TQListViewItem *after=0) : mList(l) { this->after = static_cast<SafeListViewItem*>(after); mFirst = 0; } - QListViewItem *getAfter() { return after; } - QListViewItem *getFirst() { return mFirst; } + TQListViewItem *getAfter() { return after; } + TQListViewItem *getFirst() { return mFirst; } protected: - virtual void readItem(const QMap<QString,QString> &properties) + virtual void readItem(const TQMap<TQString,TQString> &properties) { after = new SafeListViewItem(mList, after, properties); if (mFirst==0) @@ -474,10 +474,10 @@ bool View::saveToURL(const KURL &url) void View::exportTo(const KURL &url) { - QString local(napp->tempSaveName(url.path())); - QFile saver(local); + TQString local(napp->tempSaveName(url.path())); + TQFile saver(local); saver.open(IO_ReadWrite | IO_Truncate); - QTextStream t(&saver); + TQTextStream t(&saver); // navigate the list for (SafeListViewItem *i=static_cast<SafeListViewItem*>(listView()->firstChild()); i != 0; i=static_cast<SafeListViewItem*>(i->itemBelow())) @@ -495,7 +495,7 @@ void View::exportTo(const KURL &url) saver.remove(); } -QListViewItem *List::openGlobal(const KURL &u, QListViewItem *after) +TQListViewItem *List::openGlobal(const KURL &u, TQListViewItem *after) { clear(); NoatunSaver saver(this, after); @@ -505,7 +505,7 @@ QListViewItem *List::openGlobal(const KURL &u, QListViewItem *after) } // for m3u files -QListViewItem *List::importGlobal(const KURL &u, QListViewItem *after) +TQListViewItem *List::importGlobal(const KURL &u, TQListViewItem *after) { NoatunSaver saver(this, after); if (!saver.metalist(u)) @@ -524,7 +524,7 @@ QListViewItem *List::importGlobal(const KURL &u, QListViewItem *after) return saver.getAfter(); } -QListViewItem *List::addFile(const KURL& url, bool play, QListViewItem *after) +TQListViewItem *List::addFile(const KURL& url, bool play, TQListViewItem *after) { // when a new item is added, we don't want to sort anymore SPL->view->setNoSorting(); @@ -536,7 +536,7 @@ QListViewItem *List::addFile(const KURL& url, bool play, QListViewItem *after) ) { // a playlist is requested - QListViewItem *i = importGlobal(url, after); + TQListViewItem *i = importGlobal(url, after); if (play) SPL->listItemSelected(i); return i; @@ -552,7 +552,7 @@ QListViewItem *List::addFile(const KURL& url, bool play, QListViewItem *after) } else { - QListViewItem *i = new SafeListViewItem(this, after, url); + TQListViewItem *i = new SafeListViewItem(this, after, url); if (play) SPL->listItemSelected(i); return i; @@ -569,22 +569,22 @@ void List::addNextPendingDirectory() currentJobURL= *pendingIt; listJob= KIO::listRecursive(currentJobURL, false,false); connect( - listJob, SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)), - SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&)) + listJob, TQT_SIGNAL(entries(KIO::Job*, const KIO::UDSEntryList&)), + TQT_SLOT(slotEntries(KIO::Job*, const KIO::UDSEntryList&)) ); connect( - listJob, SIGNAL(result(KIO::Job *)), - SLOT(slotResult(KIO::Job *)) + listJob, TQT_SIGNAL(result(KIO::Job *)), + TQT_SLOT(slotResult(KIO::Job *)) ); connect( - listJob, SIGNAL(redirection(KIO::Job *, const KURL &)), - SLOT(slotRedirection(KIO::Job *, const KURL &)) + listJob, TQT_SIGNAL(redirection(KIO::Job *, const KURL &)), + TQT_SLOT(slotRedirection(KIO::Job *, const KURL &)) ); pendingAddDirectories.remove(pendingIt); } } -void List::addDirectoryRecursive(const KURL &dir, QListViewItem *after) +void List::addDirectoryRecursive(const KURL &dir, TQListViewItem *after) { if (!after) after=lastItem(); recursiveAddAfter= after; @@ -602,7 +602,7 @@ void List::slotResult(KIO::Job *job) void List::slotEntries(KIO::Job *, const KIO::UDSEntryList &entries) { - QMap<QString,KURL> __list; // temp list to sort entries + TQMap<TQString,KURL> __list; // temp list to sort entries KIO::UDSEntryListConstIterator it = entries.begin(); KIO::UDSEntryListConstIterator end = entries.end(); @@ -619,7 +619,7 @@ void List::slotEntries(KIO::Job *, const KIO::UDSEntryList &entries) if (!file.isDir()) __list.insert(file.url().path(), file.url()); } - QMap<QString,KURL>::Iterator __it; + TQMap<TQString,KURL>::Iterator __it; for( __it = __list.begin(); __it != __list.end(); ++__it ) { recursiveAddAfter= addFile(__it.data(), false, recursiveAddAfter); @@ -638,25 +638,25 @@ View::View(SplitPlaylist *) { list=new List(this); setCentralWidget(list); - connect(list, SIGNAL(modified(void)), this, SLOT(setModified(void)) ); + connect(list, TQT_SIGNAL(modified(void)), this, TQT_SLOT(setModified(void)) ); // connect the click on the header with sorting - connect(list->header(),SIGNAL(clicked(int)),this,SLOT(headerClicked(int)) ); + connect(list->header(),TQT_SIGNAL(clicked(int)),this,TQT_SLOT(headerClicked(int)) ); - mOpen=new KAction(i18n("Add &Files..."), "queue", 0, this, SLOT(addFiles()), actionCollection(), "add_files"); - (void) new KAction(i18n("Add Fol&ders..."), "folder", 0, this, SLOT(addDirectory()), actionCollection(), "add_dir"); - mDelete=new KAction(i18n("Delete"), "editdelete", Key_Delete, this, SLOT(deleteSelected()), actionCollection(), "delete"); + mOpen=new KAction(i18n("Add &Files..."), "queue", 0, this, TQT_SLOT(addFiles()), actionCollection(), "add_files"); + (void) new KAction(i18n("Add Fol&ders..."), "folder", 0, this, TQT_SLOT(addDirectory()), actionCollection(), "add_dir"); + mDelete=new KAction(i18n("Delete"), "editdelete", Key_Delete, this, TQT_SLOT(deleteSelected()), actionCollection(), "delete"); - mClose=KStdAction::close(this, SLOT(close()), actionCollection()); - mFind=KStdAction::find(this, SLOT(find()), actionCollection()); + mClose=KStdAction::close(this, TQT_SLOT(close()), actionCollection()); + mFind=KStdAction::find(this, TQT_SLOT(find()), actionCollection()); - (void) KStdAction::configureToolbars(this, SLOT(configureToolBars()), actionCollection()); - mOpenNew=KStdAction::openNew(this, SLOT(openNew()), actionCollection()); - mOpenpl=KStdAction::open(this, SLOT(open()), actionCollection()); - mSave=KStdAction::save(this, SLOT(save()), actionCollection()); - mSaveAs=KStdAction::saveAs(this, SLOT(saveAs()), actionCollection()); + (void) KStdAction::configureToolbars(this, TQT_SLOT(configureToolBars()), actionCollection()); + mOpenNew=KStdAction::openNew(this, TQT_SLOT(openNew()), actionCollection()); + mOpenpl=KStdAction::open(this, TQT_SLOT(open()), actionCollection()); + mSave=KStdAction::save(this, TQT_SLOT(save()), actionCollection()); + mSaveAs=KStdAction::saveAs(this, TQT_SLOT(saveAs()), actionCollection()); - (void) new KAction(i18n("Shuffle"), "misc", 0, SPL, SLOT( randomize() ), actionCollection(), "shuffle"); - (void) new KAction(i18n("Clear"), "editclear", 0, list, SLOT( clear() ), actionCollection(), "clear"); + (void) new KAction(i18n("Shuffle"), "misc", 0, SPL, TQT_SLOT( randomize() ), actionCollection(), "shuffle"); + (void) new KAction(i18n("Clear"), "editclear", 0, list, TQT_SLOT( clear() ), actionCollection(), "clear"); createGUI("splui.rc"); @@ -669,10 +669,10 @@ View::View(SplitPlaylist *) void View::find() { mFinder->show(); - connect(mFinder, SIGNAL(search(Finder*)), SLOT(findIt(Finder*))); + connect(mFinder, TQT_SIGNAL(search(Finder*)), TQT_SLOT(findIt(Finder*))); } -static bool testWord(QListViewItem *i, const QString &finder) +static bool testWord(TQListViewItem *i, const TQString &finder) { PlaylistItemData *item=static_cast<SafeListViewItem*>(i); if (item->title().find(finder, 0, false) >=0) @@ -688,7 +688,7 @@ static bool testWord(QListViewItem *i, const QString &finder) return false; } -static bool testWord(QListViewItem *i, const QRegExp &finder) +static bool testWord(TQListViewItem *i, const TQRegExp &finder) { PlaylistItemData *item=static_cast<SafeListViewItem*>(i); if (item->title().find(finder) >=0) @@ -706,7 +706,7 @@ static bool testWord(QListViewItem *i, const QRegExp &finder) void View::findIt(Finder *f) { - QListViewItem *search=list->currentItem(); + TQListViewItem *search=list->currentItem(); if (list->currentItem()) { @@ -728,7 +728,7 @@ void View::findIt(Finder *f) { if (f->regexp()) { - if (testWord(search, QRegExp(f->string(), false))) + if (testWord(search, TQRegExp(f->string(), false))) break; } else @@ -746,12 +746,12 @@ void View::findIt(Finder *f) { if (f->isForward()) { - if (KMessageBox::questionYesNo(this, i18n("End of playlist reached. Continue searching from beginning?"),QString::null,KStdGuiItem::cont(),KStdGuiItem::cancel()) == KMessageBox::Yes) + if (KMessageBox::questionYesNo(this, i18n("End of playlist reached. Continue searching from beginning?"),TQString::null,KStdGuiItem::cont(),KStdGuiItem::cancel()) == KMessageBox::Yes) search=list->firstChild(); } else { - if (KMessageBox::questionYesNo(this, i18n("Beginning of playlist reached. Continue searching from end?"),QString::null,KStdGuiItem::cont(),KStdGuiItem::cancel()) == KMessageBox::Yes) + if (KMessageBox::questionYesNo(this, i18n("Beginning of playlist reached. Continue searching from end?"),TQString::null,KStdGuiItem::cont(),KStdGuiItem::cancel()) == KMessageBox::Yes) search=list->lastChild(); } } @@ -760,8 +760,8 @@ void View::findIt(Finder *f) if (search) { { // select none - QPtrList<QListViewItem> sel=list->selectedItems(); - for (QListViewItem *i=sel.first(); i!=0; i=sel.next()) + TQPtrList<TQListViewItem> sel=list->selectedItems(); + for (TQListViewItem *i=sel.first(); i!=0; i=sel.next()) list->setSelected(i, false); } list->setSelected(search, true); @@ -781,7 +781,7 @@ View::~View() void View::init() { // see if we are importing an old-style list - bool importing= ! QFile(napp->dirs()->saveLocation("data", "noatun/") + "splitplaylist.xml").exists(); + bool importing= ! TQFile(napp->dirs()->saveLocation("data", "noatun/") + "splitplaylist.xml").exists(); if (importing) { @@ -802,7 +802,7 @@ void View::init() // this has to come after openGlobal, since openGlobal emits modified() setModified(config.readBoolEntry("modified", false)); - QString path = config.readPathEntry("file"); + TQString path = config.readPathEntry("file"); // don't call setPath with an empty path, that would make the url "valid" if ( !path.isEmpty() ) mPlaylistFile.setPath(path); @@ -860,18 +860,18 @@ void List::clear() { SPL->setCurrent(0); - QListView::clear(); + TQListView::clear(); } void View::deleteSelected() { - QPtrList<QListViewItem> items(list->selectedItems()); + TQPtrList<TQListViewItem> items(list->selectedItems()); bool stopped=false; // noatun shouldn't play files for now - QListViewItem *afterLast=0; + TQListViewItem *afterLast=0; - for (QPtrListIterator<QListViewItem> it(items); it.current(); ++it) + for (TQPtrListIterator<TQListViewItem> it(items); it.current(); ++it) { SafeListViewItem *i = static_cast<SafeListViewItem*>(*it); if (!stopped && SPL->current() == i) @@ -895,7 +895,7 @@ void View::addFiles() { KURL::List files=KFileDialog::getOpenURLs(":mediadir", napp->mimeTypes(), this, i18n("Select File to Play")); - QListViewItem *last = list->lastItem(); + TQListViewItem *last = list->lastItem(); for(KURL::List::Iterator it=files.begin(); it!=files.end(); ++it) last = addFile(KURL(*it), false); @@ -904,7 +904,7 @@ void View::addFiles() void View::addDirectory() { - QString file=KFileDialog::getExistingDirectory(0, this, i18n("Select Folder")); + TQString file=KFileDialog::getExistingDirectory(0, this, i18n("Select Folder")); if (!file) return; KURL url; @@ -914,17 +914,17 @@ void View::addDirectory() setModified(true); } -void View::closeEvent(QCloseEvent*) +void View::closeEvent(TQCloseEvent*) { hide(); } -void View::showEvent(QShowEvent *) +void View::showEvent(TQShowEvent *) { emit shown(); } -void View::hideEvent(QHideEvent *) +void View::hideEvent(TQHideEvent *) { emit hidden(); } @@ -964,7 +964,7 @@ void View::configureToolBars() { saveMainWindowSettings(KGlobal::config(), "SPL Window"); KEditToolbar dlg(actionCollection(), "splui.rc"); - connect(&dlg, SIGNAL(newToolbarConfig()), SLOT(newToolBarConfig())); + connect(&dlg, TQT_SIGNAL(newToolbarConfig()), TQT_SLOT(newToolBarConfig())); dlg.exec(); } |