diff options
Diffstat (limited to 'juk/viewmode.cpp')
-rw-r--r-- | juk/viewmode.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/juk/viewmode.cpp b/juk/viewmode.cpp index 4bd4b9d8..6c46278b 100644 --- a/juk/viewmode.cpp +++ b/juk/viewmode.cpp @@ -17,11 +17,11 @@ #include <kstandarddirs.h> #include <kdebug.h> -#include <qpixmap.h> -#include <qpainter.h> -#include <qfile.h> -#include <qdir.h> -#include <qdatastream.h> +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqfile.h> +#include <tqdir.h> +#include <tqdatastream.h> #include "viewmode.h" #include "playlistbox.h" @@ -34,7 +34,7 @@ //////////////////////////////////////////////////////////////////////////////// ViewMode::ViewMode(PlaylistBox *b) : - QObject(b), + TQObject(b), m_playlistBox(b), m_visible(false), m_needsRefresh(false) @@ -48,8 +48,8 @@ ViewMode::~ViewMode() } void ViewMode::paintCell(PlaylistBox::Item *item, - QPainter *painter, - const QColorGroup &colorGroup, + TQPainter *painter, + const TQColorGroup &colorGroup, int column, int width, int) { if(width < item->pixmap(column)->width()) @@ -58,28 +58,28 @@ void ViewMode::paintCell(PlaylistBox::Item *item, if(m_needsRefresh) updateHeights(); - QFontMetrics fm = painter->fontMetrics(); + TQFontMetrics fm = painter->fontMetrics(); int y = item->listView()->itemMargin() + border; - const QPixmap *pm = item->pixmap(column); + const TQPixmap *pm = item->pixmap(column); if(item->isSelected()) { painter->eraseRect(0, 0, width, item->height()); - QPen oldPen = painter->pen(); - QPen newPen = oldPen; + TQPen oldPen = painter->pen(); + TQPen newPen = oldPen; newPen.setWidth(5); newPen.setJoinStyle(RoundJoin); - newPen.setColor(QColorGroup::Highlight); + newPen.setColor(TQColorGroup::Highlight); painter->setPen(newPen); painter->drawRect(border, border, width - border * 2, item->height() - border * 2 + 1); painter->setPen(oldPen); painter->fillRect(border, border, width - border * 2, item->height() - border * 2 + 1, - colorGroup.brush(QColorGroup::Highlight)); + colorGroup.brush(TQColorGroup::Highlight)); painter->setPen(colorGroup.highlightedText()); } else @@ -91,7 +91,7 @@ void ViewMode::paintCell(PlaylistBox::Item *item, painter->drawPixmap(x, y, *pm); } y += pm->height() + fm.height() - fm.descent(); - for(QStringList::Iterator it = m_lines[item].begin(); it != m_lines[item].end(); ++it) { + for(TQStringList::Iterator it = m_lines[item].begin(); it != m_lines[item].end(); ++it) { int x = (width - fm.width(*it)) / 2; x = QMAX(x, item->listView()->itemMargin()); painter->drawText(x, y, *it); @@ -102,18 +102,18 @@ void ViewMode::paintCell(PlaylistBox::Item *item, paintDropIndicator(painter, width, item->height()); } -bool ViewMode::eventFilter(QObject *watched, QEvent *e) +bool ViewMode::eventFilter(TQObject *watched, TQEvent *e) { - if(m_visible && watched == m_playlistBox->viewport() && e->type() == QEvent::Resize) { - QResizeEvent *re = static_cast<QResizeEvent *>(e); + if(m_visible && watched == m_playlistBox->viewport() && e->type() == TQEvent::Resize) { + TQResizeEvent *re = static_cast<TQResizeEvent *>(e); if(re->size().width() != re->oldSize().width()) m_needsRefresh = true; } - if(e->type() == QEvent::Hide) + if(e->type() == TQEvent::Hide) m_needsRefresh = true; - return QObject::eventFilter(watched, e); + return TQObject::eventFilter(watched, e); } void ViewMode::setShown(bool shown) @@ -127,7 +127,7 @@ void ViewMode::setShown(bool shown) void ViewMode::updateIcons(int size) { - for(QListViewItemIterator it(m_playlistBox); it.current(); ++it) { + for(TQListViewItemIterator it(m_playlistBox); it.current(); ++it) { PlaylistBox::Item *i = static_cast<PlaylistBox::Item *>(*it); i->setPixmap(0, SmallIcon(i->iconName(), size)); } @@ -138,7 +138,7 @@ void ViewMode::setupItem(PlaylistBox::Item *item) const const PlaylistBox *box = item->listView(); const int width = box->width() - box->verticalScrollBar()->width() - border * 2; const int baseHeight = 2 * box->itemMargin() + 32 + border * 2; - const QFontMetrics fm = box->fontMetrics(); + const TQFontMetrics fm = box->fontMetrics(); item->setHeight(baseHeight + (fm.height() - fm.descent()) * lines(item, fm, width).count()); } @@ -147,9 +147,9 @@ void ViewMode::updateHeights() const int width = m_playlistBox->width() - m_playlistBox->verticalScrollBar()->width() - border * 2; const int baseHeight = 2 * m_playlistBox->itemMargin() + 32 + border * 2; - const QFontMetrics fm = m_playlistBox->fontMetrics(); + const TQFontMetrics fm = m_playlistBox->fontMetrics(); - for(QListViewItemIterator it(m_playlistBox); it.current(); ++it) { + for(TQListViewItemIterator it(m_playlistBox); it.current(); ++it) { PlaylistBox::Item *i = static_cast<PlaylistBox::Item *>(it.current()); m_lines[i] = lines(i, fm, width); const int height = baseHeight + (fm.height() - fm.descent()) * m_lines[i].count(); @@ -159,13 +159,13 @@ void ViewMode::updateHeights() m_needsRefresh = false; } -void ViewMode::paintDropIndicator(QPainter *painter, int width, int height) // static +void ViewMode::paintDropIndicator(TQPainter *painter, int width, int height) // static { static const int border = 1; static const int lineWidth = 2; - QPen oldPen = painter->pen(); - QPen newPen = oldPen; + TQPen oldPen = painter->pen(); + TQPen newPen = oldPen; newPen.setWidth(lineWidth); newPen.setStyle(DotLine); @@ -175,19 +175,19 @@ void ViewMode::paintDropIndicator(QPainter *painter, int width, int height) // s painter->setPen(oldPen); } -QStringList ViewMode::lines(const PlaylistBox::Item *item, - const QFontMetrics &fm, +TQStringList ViewMode::lines(const PlaylistBox::Item *item, + const TQFontMetrics &fm, int width) { // Here 32 is a bit arbitrary, but that's the width of the icons in this // mode and seems to a reasonable lower bound. if(width < 32) - return QStringList(); + return TQStringList(); - QString line = item->text(); + TQString line = item->text(); - QStringList l; + TQStringList l; while(!line.isEmpty()) { int textLength = line.length(); @@ -195,7 +195,7 @@ QStringList ViewMode::lines(const PlaylistBox::Item *item, fm.width(line.mid(0, textLength).stripWhiteSpace()) + item->listView()->itemMargin() * 2 > width) { - int i = line.findRev(QRegExp( "\\W"), textLength - 1); + int i = line.findRev(TQRegExp( "\\W"), textLength - 1); if(i > 0) textLength = i; else @@ -223,8 +223,8 @@ CompactViewMode::~CompactViewMode() } void CompactViewMode::paintCell(PlaylistBox::Item *item, - QPainter *painter, - const QColorGroup &colorGroup, + TQPainter *painter, + const TQColorGroup &colorGroup, int column, int width, int align) { item->KListViewItem::paintCell(painter, colorGroup, column, width, align); @@ -244,7 +244,7 @@ void CompactViewMode::setShown(bool shown) void CompactViewMode::updateHeights() { - for(QListViewItemIterator it(playlistBox()); it.current(); ++it) + for(TQListViewItemIterator it(playlistBox()); it.current(); ++it) it.current()->setup(); } @@ -278,7 +278,7 @@ void TreeViewMode::setShown(bool show) if(collectionItem && m_searchCategories.isEmpty()) setupDynamicPlaylists(); else { - for(QDictIterator<PlaylistBox::Item> it(m_searchCategories); it.current(); ++it) + for(TQDictIterator<PlaylistBox::Item> it(m_searchCategories); it.current(); ++it) it.current()->setVisible(true); } @@ -291,17 +291,17 @@ void TreeViewMode::setShown(bool show) } } else { - for(QDictIterator<PlaylistBox::Item> it(m_searchCategories); it.current(); ++it) + for(TQDictIterator<PlaylistBox::Item> it(m_searchCategories); it.current(); ++it) it.current()->setVisible(false); } } -void TreeViewMode::removeItem(const QString &item, unsigned column) +void TreeViewMode::removeItem(const TQString &item, unsigned column) { if(!m_setup) return; - QString itemKey; + TQString itemKey; if(column == PlaylistItem::ArtistColumn) itemKey = "artists" + item; else if(column == PlaylistItem::GenreColumn) @@ -328,12 +328,12 @@ void TreeViewMode::removeItem(const QString &item, unsigned column) emit signalPlaylistDestroyed(itemPlaylist); } -void TreeViewMode::addItems(const QStringList &items, unsigned column) +void TreeViewMode::addItems(const TQStringList &items, unsigned column) { if(!m_setup) return; - QString searchCategory; + TQString searchCategory; if(column == PlaylistItem::ArtistColumn) searchCategory = "artists"; else if(column == PlaylistItem::GenreColumn) @@ -345,7 +345,7 @@ void TreeViewMode::addItems(const QStringList &items, unsigned column) return; } - QValueList<int> columns; + TQValueList<int> columns; columns.append(column); PlaylistSearch::Component::MatchMode mode = PlaylistSearch::Component::ContainsWord; @@ -356,10 +356,10 @@ void TreeViewMode::addItems(const QStringList &items, unsigned column) PlaylistList playlists; playlists.append(CollectionList::instance()); - QString itemKey, item; + TQString itemKey, item; PlaylistBox::Item *itemParent = m_searchCategories[searchCategory]; - for(QStringList::ConstIterator it = items.begin(); it != items.end(); ++it) { + for(TQStringList::ConstIterator it = items.begin(); it != items.end(); ++it) { item = *it; itemKey = searchCategory + item; @@ -384,10 +384,10 @@ void TreeViewMode::setDynamicListsFrozen(bool frozen) if(frozen) return; - QStringList categories; + TQStringList categories; categories << "artists" << "albums" << "genres"; - for(QStringList::ConstIterator it = m_pendingItemsToRemove.begin(); + for(TQStringList::ConstIterator it = m_pendingItemsToRemove.begin(); it != m_pendingItemsToRemove.end(); ++it) { |