diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/basketlistview.cpp | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/basketlistview.cpp')
-rw-r--r-- | src/basketlistview.cpp | 314 |
1 files changed, 157 insertions, 157 deletions
diff --git a/src/basketlistview.cpp b/src/basketlistview.cpp index 51b9747..3d0ed71 100644 --- a/src/basketlistview.cpp +++ b/src/basketlistview.cpp @@ -19,15 +19,15 @@ ***************************************************************************/ #include "basketlistview.h" -#include <qregexp.h> +#include <tqregexp.h> #include <kglobalsettings.h> #include <kiconloader.h> #include <klocale.h> #include <kstringhandler.h> -#include <qpainter.h> -#include <qbitmap.h> -#include <qpixmapcache.h> -#include <qtooltip.h> +#include <tqpainter.h> +#include <tqbitmap.h> +#include <tqpixmapcache.h> +#include <tqtooltip.h> #include <iostream> #include <kdebug.h> #include "global.h" @@ -39,32 +39,32 @@ /** class BasketListViewItem: */ -BasketListViewItem::BasketListViewItem(QListView *parent, Basket *basket) - : QListViewItem(parent), m_basket(basket) +BasketListViewItem::BasketListViewItem(TQListView *tqparent, Basket *basket) + : TQListViewItem(tqparent), m_basket(basket) , m_isUnderDrag(false) , m_isAbbreviated(false) { setDropEnabled(true); } -BasketListViewItem::BasketListViewItem(QListViewItem *parent, Basket *basket) - : QListViewItem(parent), m_basket(basket) +BasketListViewItem::BasketListViewItem(TQListViewItem *tqparent, Basket *basket) + : TQListViewItem(tqparent), m_basket(basket) , m_isUnderDrag(false) , m_isAbbreviated(false) { setDropEnabled(true); } -BasketListViewItem::BasketListViewItem(QListView *parent, QListViewItem *after, Basket *basket) - : QListViewItem(parent, after), m_basket(basket) +BasketListViewItem::BasketListViewItem(TQListView *tqparent, TQListViewItem *after, Basket *basket) + : TQListViewItem(tqparent, after), m_basket(basket) , m_isUnderDrag(false) , m_isAbbreviated(false) { setDropEnabled(true); } -BasketListViewItem::BasketListViewItem(QListViewItem *parent, QListViewItem *after, Basket *basket) - : QListViewItem(parent, after), m_basket(basket) +BasketListViewItem::BasketListViewItem(TQListViewItem *tqparent, TQListViewItem *after, Basket *basket) + : TQListViewItem(tqparent, after), m_basket(basket) , m_isUnderDrag(false) , m_isAbbreviated(false) { @@ -75,48 +75,48 @@ BasketListViewItem::~BasketListViewItem() { } -bool BasketListViewItem::acceptDrop(const QMimeSource *) const +bool BasketListViewItem::acceptDrop(const TQMimeSource *) const { std::cout << "accept" << std::endl; return true; } -void BasketListViewItem::dropped(QDropEvent *event) +void BasketListViewItem::dropped(TQDropEvent *event) { std::cout << "Dropping into basket " << m_basket->name() << std::endl; m_basket->contentsDropEvent(event); //Global::bnpView->currentBasket()->contentsDropEvent(event); // FIXME } -int BasketListViewItem::width(const QFontMetrics &/* fontMetrics */, const QListView */*listView*/, int /* column */) const +int BasketListViewItem::width(const TQFontMetrics &/* fontMetrics */, const TQListView */*listView*/, int /* column */) const { return listView()->visibleWidth() + 100; /* int BASKET_ICON_SIZE = 16; int MARGIN = 1; - QRect textRect = fontMetrics.boundingRect(0, 0, / *width=* /1, 500000, Qt::AlignAuto | Qt::AlignTop | Qt::ShowPrefix, text(column)); + TQRect textRect = fontMetrics.boundingRect(0, 0, / *width=* /1, 500000, TQt::AlignAuto | TQt::AlignTop | TQt::ShowPrefix, text(column)); return MARGIN + BASKET_ICON_SIZE + MARGIN + textRect.width() + BASKET_ICON_SIZE/2 + MARGIN; */ } -QString BasketListViewItem::escapedName(const QString &string) +TQString BasketListViewItem::escapedName(const TQString &string) { // Underlining the Alt+Letter shortcut (and escape all other '&' characters), if any: - QString basketName = string; - basketName.replace('&', "&&"); // First escape all the amperstamp - QString letter; // Find the letter - QString altKey = /*i18n(*/"Alt"/*)*/; //i18n("The [Alt] key, as shown in shortcuts like Alt+C...", "Alt"); - QString shiftKey = /*i18n(*/"Shift"/*)*/; //i18n("The [Shift] key, as shown in shortcuts like Alt+Shift+1...", "Shift"); - QRegExp altLetterExp( QString("^%1\\+(.)$").arg(altKey) ); - QRegExp altShiftLetterExp( QString("^%1\\+%2\\+(.)$").arg(altKey, shiftKey) ); + TQString basketName = string; + basketName.tqreplace('&', "&&"); // First escape all the amperstamp + TQString letter; // Find the letter + TQString altKey = /*i18n(*/"Alt"/*)*/; //i18n("The [Alt] key, as shown in shortcuts like Alt+C...", "Alt"); + TQString shiftKey = /*i18n(*/"Shift"/*)*/; //i18n("The [Shift] key, as shown in shortcuts like Alt+Shift+1...", "Shift"); + TQRegExp altLetterExp( TQString("^%1\\+(.)$").tqarg(altKey) ); + TQRegExp altShiftLetterExp( TQString("^%1\\+%2\\+(.)$").tqarg(altKey, shiftKey) ); if (altLetterExp.search(m_basket->shortcut().toStringInternal()) != -1) letter = altLetterExp.cap(1); if (letter.isEmpty() && altShiftLetterExp.search(m_basket->shortcut().toStringInternal()) != -1) letter = altShiftLetterExp.cap(1); if (!letter.isEmpty()) { - int index = basketName.find(letter, /*index=*/0, /*caseSensitive=*/false); + int index = basketName.tqfind(letter, /*index=*/0, /*caseSensitive=*/false); if (index != -1) basketName.insert(index, '&'); } @@ -131,21 +131,21 @@ void BasketListViewItem::setup() setText(/*column=*/0, escapedName(m_basket->basketName())); widthChanged(); - QRect textRect = listView()->fontMetrics().boundingRect(0, 0, /*width=*/1, 500000, Qt::AlignAuto | Qt::AlignTop | Qt::ShowPrefix, text(/*column=*/0)); + TQRect textRect = listView()->fontMetrics().boundingRect(0, 0, /*width=*/1, 500000, TQt::AlignAuto | TQt::AlignTop | TQt::ShowPrefix, text(/*column=*/0)); - int height = MARGIN + QMAX(BASKET_ICON_SIZE, textRect.height()) + MARGIN; + int height = MARGIN + TQMAX(BASKET_ICON_SIZE, textRect.height()) + MARGIN; setHeight(height); - QPixmap icon = kapp->iconLoader()->loadIcon(m_basket->icon(), KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); + TQPixmap icon = kapp->iconLoader()->loadIcon(m_basket->icon(), KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); setPixmap(/*column=*/0, icon); - repaint(); + tqrepaint(); } BasketListViewItem* BasketListViewItem::lastChild() { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child) { if (child->nextSibling()) child = child->nextSibling(); @@ -188,21 +188,21 @@ BasketListViewItem* BasketListViewItem::shownItemBelow() return 0; } -QStringList BasketListViewItem::childNamesTree(int deep) +TQStringList BasketListViewItem::childNamesTree(int deep) { - QStringList result; - for (QListViewItem *child = firstChild(); child; child = child->nextSibling()) { + TQStringList result; + for (TQListViewItem *child = firstChild(); child; child = child->nextSibling()) { BasketListViewItem *item = (BasketListViewItem*)child; // Compute indentation spaces: - QString spaces; + TQString spaces; for (int i = 0; i < deep; ++i) spaces += " "; // Append the name: result.append(spaces + item->basket()->basketName()); // Append the childs: if (child->firstChild()) { - QStringList childs = item->childNamesTree(deep + 1); - for (QStringList::iterator it = childs.begin(); it != childs.end(); ++it) + TQStringList childs = item->childNamesTree(deep + 1); + for (TQStringList::iterator it = childs.begin(); it != childs.end(); ++it) result.append(*it); } } @@ -211,14 +211,14 @@ QStringList BasketListViewItem::childNamesTree(int deep) void BasketListViewItem::moveChildsBaskets() { - QListViewItem *insertAfterThis = this; - QListViewItem *nextOne; - for (QListViewItem *child = firstChild(); child; child = nextOne) { + TQListViewItem *insertAfterThis = this; + TQListViewItem *nextOne; + for (TQListViewItem *child = firstChild(); child; child = nextOne) { nextOne = child->nextSibling(); - // Re-insert the item with the good parent: + // Re-insert the item with the good tqparent: takeItem(child); - if (parent()) - parent()->insertItem(child); + if (tqparent()) + tqparent()->insertItem(child); else listView()->insertItem(child); // And move it at the good place: @@ -230,19 +230,19 @@ void BasketListViewItem::moveChildsBaskets() void BasketListViewItem::ensureVisible() { BasketListViewItem *item = this; - while (item->parent()) { - item = (BasketListViewItem*)(item->parent()); + while (item->tqparent()) { + item = (BasketListViewItem*)(item->tqparent()); item->setOpen(true); } } bool BasketListViewItem::isShown() { - QListViewItem *item = parent(); + TQListViewItem *item = tqparent(); while (item) { if (!item->isOpen()) return false; - item = item->parent(); + item = item->tqparent(); } return true; } @@ -253,31 +253,31 @@ bool BasketListViewItem::isCurrentBasket() } // TODO: Move this function from item.cpp to class Tools: -extern void drawGradient( QPainter *p, const QColor &colorTop, const QColor & colorBottom, +extern void drawGradient( TQPainter *p, const TQColor &colorTop, const TQColor & colorBottom, int x, int y, int w, int h, bool sunken, bool horz, bool flat ); /*const*/ -QPixmap BasketListViewItem::circledTextPixmap(const QString &text, int height, const QFont &font, const QColor &color) +TQPixmap BasketListViewItem::circledTextPixmap(const TQString &text, int height, const TQFont &font, const TQColor &color) { - QString key = QString("BLI-%1.%2.%3.%4") - .arg(text).arg(height).arg(font.toString()).arg(color.rgb()); - if (QPixmap* cached=QPixmapCache::find(key)) { + TQString key = TQString("BLI-%1.%2.%3.%4") + .tqarg(text).tqarg(height).tqarg(font.toString()).tqarg(color.rgb()); + if (TQPixmap* cached=TQPixmapCache::tqfind(key)) { return *cached; } // Compute the sizes of the image components: - QRect textRect = QFontMetrics(font).boundingRect(0, 0, /*width=*/1, height, Qt::AlignAuto | Qt::AlignTop, text); + TQRect textRect = TQFontMetrics(font).boundingRect(0, 0, /*width=*/1, height, TQt::AlignAuto | TQt::AlignTop, text); int xMargin = height / 6; int width = xMargin + textRect.width() + xMargin; // Create the gradient image: - QPixmap gradient(3 * width, 3 * height); // We double the size to be able to smooth scale down it (== antialiased curves) - QPainter gradientPainter(&gradient); + TQPixmap gradient(3 * width, 3 * height); // We double the size to be able to smooth scale down it (== antialiased curves) + TQPainter gradientPainter(&gradient); #if 1 // Enable the new look of the gradient: - QColor topColor = KGlobalSettings::highlightColor().light(130); //120 - QColor topMidColor = KGlobalSettings::highlightColor().light(105); //105 - QColor bottomMidColor = KGlobalSettings::highlightColor().dark(130); //120 - QColor bottomColor = KGlobalSettings::highlightColor(); + TQColor topColor = KGlobalSettings::highlightColor().light(130); //120 + TQColor topMidColor = KGlobalSettings::highlightColor().light(105); //105 + TQColor bottomMidColor = KGlobalSettings::highlightColor().dark(130); //120 + TQColor bottomColor = KGlobalSettings::highlightColor(); drawGradient(&gradientPainter, topColor, topMidColor, 0, 0, gradient.width(), gradient.height() / 2, /*sunken=*/false, /*horz=*/true, /*flat=*/false); drawGradient(&gradientPainter, bottomMidColor, bottomColor, @@ -290,11 +290,11 @@ QPixmap BasketListViewItem::circledTextPixmap(const QString &text, int height, c gradientPainter.end(); // Draw the curved rectangle: - QBitmap curvedRectangle(3 * width, 3 * height); - curvedRectangle.fill(Qt::color0); - QPainter curvePainter(&curvedRectangle); - curvePainter.setPen(Qt::color1); - curvePainter.setBrush(Qt::color1); + TQBitmap curvedRectangle(3 * width, 3 * height); + curvedRectangle.fill(TQt::color0); + TQPainter curvePainter(&curvedRectangle); + curvePainter.setPen(TQt::color1); + curvePainter.setBrush(TQt::color1); curvePainter.setClipRect(0, 0, 3*(height / 5), 3*(height)); // If the width is small, don't fill the right part of the pixmap curvePainter.drawEllipse(0, 3*(-height / 4), 3*(height), 3*(height * 3 / 2)); // Don't forget we double the sizes curvePainter.setClipRect(3*(width - height / 5), 0, 3*(height / 5), 3*(height)); @@ -303,48 +303,48 @@ QPixmap BasketListViewItem::circledTextPixmap(const QString &text, int height, c curvePainter.fillRect(3*(height / 6), 0, 3*(width - 2 * height / 6), 3*(height), curvePainter.brush()); curvePainter.end(); - // Apply the curved rectangle as the mask of the gradient: + // Apply the curved rectangle as the tqmask of the gradient: gradient.setMask(curvedRectangle); - QImage resultImage = gradient.convertToImage(); + TQImage resultImage = gradient.convertToImage(); resultImage.setAlphaBuffer(true); // Scale down the image smoothly to get anti-aliasing: - QPixmap pmScaled; + TQPixmap pmScaled; pmScaled.convertFromImage(resultImage.smoothScale(width, height)); // Draw the text, and return the result: - QPainter painter(&pmScaled); + TQPainter painter(&pmScaled); painter.setPen(color); painter.setFont(font); - painter.drawText(0+1, 0, width, height, Qt::AlignHCenter | Qt::AlignVCenter, text); + painter.drawText(0+1, 0, width, height, TQt::AlignHCenter | TQt::AlignVCenter, text); painter.end(); - QPixmapCache::insert(key, pmScaled); + TQPixmapCache::insert(key, pmScaled); return pmScaled; } -QPixmap BasketListViewItem::foundCountPixmap(bool isLoading, int countFound, bool childsAreLoading, int countChildsFound, const QFont &font, int height) +TQPixmap BasketListViewItem::foundCountPixmap(bool isLoading, int countFound, bool childsAreLoading, int countChildsFound, const TQFont &font, int height) { if (isLoading) - return QPixmap(); + return TQPixmap(); - QFont boldFont(font); + TQFont boldFont(font); boldFont.setBold(true); - QString text; + TQString text; if (childsAreLoading) { if (countChildsFound > 0) - text = i18n("%1+%2+").arg(QString::number(countFound), QString::number(countChildsFound)); + text = i18n("%1+%2+").tqarg(TQString::number(countFound), TQString::number(countChildsFound)); else - text = i18n("%1+").arg(QString::number(countFound)); + text = i18n("%1+").tqarg(TQString::number(countFound)); } else { if (countChildsFound > 0) - text = i18n("%1+%2").arg(QString::number(countFound), QString::number(countChildsFound)); + text = i18n("%1+%2").tqarg(TQString::number(countFound), TQString::number(countChildsFound)); else if (countFound > 0) - text = QString::number(countFound); + text = TQString::number(countFound); else - return QPixmap(); + return TQPixmap(); } return circledTextPixmap(text, height, boldFont, KGlobalSettings::highlightedTextColor()); @@ -352,7 +352,7 @@ QPixmap BasketListViewItem::foundCountPixmap(bool isLoading, int countFound, boo bool BasketListViewItem::haveChildsLoading() { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child) { BasketListViewItem *childItem = (BasketListViewItem*)child; if (!childItem->basket()->isLoaded() && !childItem->basket()->isLocked()) @@ -373,7 +373,7 @@ bool BasketListViewItem::haveHiddenChildsLoading() bool BasketListViewItem::haveChildsLocked() { - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child) { BasketListViewItem *childItem = (BasketListViewItem*)child; if (/*!*/childItem->basket()->isLocked()) @@ -395,7 +395,7 @@ bool BasketListViewItem::haveHiddenChildsLocked() int BasketListViewItem::countChildsFound() { int count = 0; - QListViewItem *child = firstChild(); + TQListViewItem *child = firstChild(); while (child) { BasketListViewItem *childItem = (BasketListViewItem*)child; count += childItem->basket()->countFounds(); @@ -412,11 +412,11 @@ int BasketListViewItem::countHiddenChildsFound() return countChildsFound(); } -void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*colorGroup*/, int /*column*/, int width, int /*align*/) +void BasketListViewItem::paintCell(TQPainter *painter, const TQColorGroup &/*tqcolorGroup*/, int /*column*/, int width, int /*align*/) { - // Workaround a Qt bug: + // Workaround a TQt bug: // When the splitter is moved to hide the tree view and then the application is restarted, - // Qt try to draw items with a negative size! + // TQt try to draw items with a negative size! if (width <= 0) { std::cout << "width <= 0" << std::endl; return; @@ -429,7 +429,7 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color // If we are filtering all baskets, and are effectively filtering on something: bool showLoadingIcon = false; bool showEncryptedIcon = false; - QPixmap countPixmap; + TQPixmap countPixmap; bool showCountPixmap = Global::bnpView->isFilteringAllBaskets() && Global::bnpView->currentBasket()->decoration()->filterBar()->filterData().isFiltering; if (showCountPixmap) { @@ -444,59 +444,59 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color bool drawRoundRect = m_basket->backgroundColorSetting().isValid() || m_basket->textColorSetting().isValid(); - QColor textColor = (drawRoundRect ? m_basket->textColor() : (isCurrentBasket() ? KGlobalSettings::highlightedTextColor() : KGlobalSettings::textColor())); + TQColor textColor = (drawRoundRect ? m_basket->textColor() : (isCurrentBasket() ? KGlobalSettings::highlightedTextColor() : KGlobalSettings::textColor())); BasketListViewItem *shownAbove = shownItemAbove(); BasketListViewItem *shownBelow = shownItemBelow(); // Don't forget to update the key computation if parameters // affecting the rendering logic change - QString key = QString("BLVI::pC-%1.%2.%3.%4.%5.%6.%7.%8.%9.%10.%11.%12.%13.%14.%15") - .arg(effectiveWidth) - .arg(drawRoundRect) - .arg(textColor.rgb()) - .arg(m_basket->backgroundColor().rgb()) - .arg(isCurrentBasket()) - .arg(shownBelow && shownBelow->isCurrentBasket()) - .arg(shownAbove && shownAbove->isCurrentBasket()) - .arg(showLoadingIcon) - .arg(showEncryptedIcon) - .arg(showCountPixmap) - .arg(m_basket->countFounds()) - .arg(countHiddenChildsFound()) - .arg(m_isUnderDrag) - .arg(m_basket->basketName()) - .arg(m_basket->icon()); - if (QPixmap* cached = QPixmapCache::find(key)) { - // Qt's documentation recommends copying the pointer - // into a QPixmap immediately - QPixmap cachedBuffer = *cached; + TQString key = TQString("BLVI::pC-%1.%2.%3.%4.%5.%6.%7.%8.%9.%10.%11.%12.%13.%14.%15") + .tqarg(effectiveWidth) + .tqarg(drawRoundRect) + .tqarg(textColor.rgb()) + .tqarg(m_basket->backgroundColor().rgb()) + .tqarg(isCurrentBasket()) + .tqarg(shownBelow && shownBelow->isCurrentBasket()) + .tqarg(shownAbove && shownAbove->isCurrentBasket()) + .tqarg(showLoadingIcon) + .tqarg(showEncryptedIcon) + .tqarg(showCountPixmap) + .tqarg(m_basket->countFounds()) + .tqarg(countHiddenChildsFound()) + .tqarg(m_isUnderDrag) + .tqarg(m_basket->basketName()) + .tqarg(m_basket->icon()); + if (TQPixmap* cached = TQPixmapCache::tqfind(key)) { + // TQt's documentation recommends copying the pointer + // into a TQPixmap immediately + TQPixmap cachedBuffer = *cached; painter->drawPixmap(0, 0, cachedBuffer); return; } // Bufferize the drawing of items (otherwize, resizing the splitter make the tree act like a Christmas Tree ;-D ): - QPixmap theBuffer(width, height()); - QPainter thePainter(&theBuffer); + TQPixmap theBuffer(width, height()); + TQPainter thePainter(&theBuffer); // Fill with the basket background color: - QColor background = (isCurrentBasket() ? KGlobalSettings::highlightColor() : listView()->paletteBackgroundColor()); + TQColor background = (isCurrentBasket() ? KGlobalSettings::highlightColor() : listView()->paletteBackgroundColor()); thePainter.fillRect(0, 0, width, height(), background); int textWidth = effectiveWidth - MARGIN - BASKET_ICON_SIZE - MARGIN - MARGIN; // Draw the rounded rectangle: if (drawRoundRect) { - QRect textRect = listView()->fontMetrics().boundingRect(0, 0, /*width=*/1, 500000, Qt::AlignAuto | Qt::AlignTop | Qt::ShowPrefix, text(/*column=*/0)); + TQRect textRect = listView()->fontMetrics().boundingRect(0, 0, /*width=*/1, 500000, TQt::AlignAuto | TQt::AlignTop | TQt::ShowPrefix, text(/*column=*/0)); int xRound = MARGIN; int yRound = MARGIN; int hRound = height() - 2 * MARGIN; - int wRound = QMIN(BASKET_ICON_SIZE + MARGIN + textRect.width() + hRound/2, effectiveWidth - MARGIN - MARGIN); + int wRound = TQMIN(BASKET_ICON_SIZE + MARGIN + textRect.width() + hRound/2, effectiveWidth - MARGIN - MARGIN); if (wRound > 0) { // Do not crash if there is no space anymore to draw the rounded rectangle: - QPixmap buffer(wRound * 2, hRound * 2); + TQPixmap buffer(wRound * 2, hRound * 2); buffer.fill(background); - QPainter pBuffer(&buffer); - QColor colorRound = m_basket->backgroundColor(); + TQPainter pBuffer(&buffer); + TQColor colorRound = m_basket->backgroundColor(); pBuffer.setPen(colorRound); pBuffer.setBrush(colorRound); if (wRound > hRound) { // If the rectangle is smaller in width than in height, don't overlap ellipses... @@ -506,17 +506,17 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color } else pBuffer.drawEllipse(0, 0, wRound * 2, hRound * 2); pBuffer.end(); - QImage imageToScale = buffer.convertToImage(); - QPixmap pmScaled; + TQImage imageToScale = buffer.convertToImage(); + TQPixmap pmScaled; pmScaled.convertFromImage(imageToScale.smoothScale(wRound, hRound)); thePainter.drawPixmap(xRound, yRound, pmScaled); textWidth -= hRound/2; } } - QColor bgColor = listView()->paletteBackgroundColor(); - QColor selColor = KGlobalSettings::highlightColor(); - QColor midColor = Tools::mixColor(bgColor, selColor); + TQColor bgColor = listView()->paletteBackgroundColor(); + TQColor selColor = KGlobalSettings::highlightColor(); + TQColor midColor = Tools::mixColor(bgColor, selColor); // Draw the left selection roundings: if (isCurrentBasket()) { thePainter.setPen(bgColor); @@ -561,7 +561,7 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color thePainter.setPen(textColor); if (textWidth > 0) { // IF there is space left to draw the text: int xText = MARGIN + BASKET_ICON_SIZE + MARGIN; - QString theText = m_basket->basketName(); + TQString theText = m_basket->basketName(); if (painter->fontMetrics().width(theText) > textWidth) { theText = KStringHandler::rPixelSqueeze(theText, painter->fontMetrics(), textWidth); m_isAbbreviated = true; @@ -570,7 +570,7 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color m_isAbbreviated = false; } theText = escapedName(theText); - thePainter.drawText(xText, 0, textWidth, height(), Qt::AlignAuto | Qt::AlignVCenter | Qt::ShowPrefix, theText); + thePainter.drawText(xText, 0, textWidth, height(), TQt::AlignAuto | TQt::AlignVCenter | TQt::ShowPrefix, theText); } // If we are filtering all baskets, and are effectively filtering on something: @@ -580,12 +580,12 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color effectiveWidth += countPixmap.width() + MARGIN; } if (showLoadingIcon) { - QPixmap icon = kapp->iconLoader()->loadIcon("find", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); + TQPixmap icon = kapp->iconLoader()->loadIcon("tqfind", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); thePainter.drawPixmap(effectiveWidth, 0, icon); effectiveWidth += BASKET_ICON_SIZE + MARGIN; } if (showEncryptedIcon && !showLoadingIcon) { - QPixmap icon = kapp->iconLoader()->loadIcon("encrypted", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); + TQPixmap icon = kapp->iconLoader()->loadIcon("encrypted", KIcon::NoGroup, 16, KIcon::DefaultState, 0L, /*canReturnNull=*/false); thePainter.drawPixmap(effectiveWidth, 0, icon); } @@ -594,7 +594,7 @@ void BasketListViewItem::paintCell(QPainter *painter, const QColorGroup &/*color } thePainter.end(); - QPixmapCache::insert(key, theBuffer); + TQPixmapCache::insert(key, theBuffer); // Apply the buffer: painter->drawPixmap(0, 0, theBuffer); } @@ -611,19 +611,19 @@ bool BasketListViewItem::isAbbreviated() /** class BasketListViewToolTip: */ -class BasketTreeListView_ToolTip : public QToolTip { +class BasketTreeListView_ToolTip : public TQToolTip { public: BasketTreeListView_ToolTip(BasketTreeListView* basketView) - : QToolTip(basketView->viewport()) + : TQToolTip(basketView->viewport()) , m_basketView(basketView) {} public: - void maybeTip(const QPoint& pos) + void maybeTip(const TQPoint& pos) { - QListViewItem *item = m_basketView->itemAt(m_basketView->contentsToViewport(pos)); + TQListViewItem *item = m_basketView->itemAt(m_basketView->contentsToViewport(pos)); BasketListViewItem* bitem = dynamic_cast<BasketListViewItem*>(item); if (bitem && bitem->isAbbreviated()) { - tip(m_basketView->itemRect(bitem), bitem->basket()->basketName()); + tip(m_basketView->tqitemRect(bitem), bitem->basket()->basketName()); } } private: @@ -632,30 +632,30 @@ private: /** class BasketTreeListView: */ -BasketTreeListView::BasketTreeListView(QWidget *parent, const char *name) - : KListView(parent, name), m_autoOpenItem(0) +BasketTreeListView::BasketTreeListView(TQWidget *tqparent, const char *name) + : KListView(tqparent, name), m_autoOpenItem(0) , m_itemUnderDrag(0) { - setWFlags(Qt::WStaticContents | WNoAutoErase); - clearWFlags(Qt::WStaticContents | WNoAutoErase); - //viewport()->clearWFlags(Qt::WStaticContents); - connect( &m_autoOpenTimer, SIGNAL(timeout()), this, SLOT(autoOpen()) ); + setWFlags(TQt::WStaticContents | WNoAutoErase); + clearWFlags(TQt::WStaticContents | WNoAutoErase); + //viewport()->clearWFlags(TQt::WStaticContents); + connect( &m_autoOpenTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(autoOpen()) ); new BasketTreeListView_ToolTip(this); } -void BasketTreeListView::viewportResizeEvent(QResizeEvent *event) +void BasketTreeListView::viewportResizeEvent(TQResizeEvent *event) { KListView::viewportResizeEvent(event); triggerUpdate(); } -void BasketTreeListView::contentsDragEnterEvent(QDragEnterEvent *event) +void BasketTreeListView::contentsDragEnterEvent(TQDragEnterEvent *event) { if (event->provides("application/x-qlistviewitem")) { - QListViewItemIterator it(this); // TODO: Don't show expanders if it's not a basket drag... + TQListViewItemIterator it(this); // TODO: Don't show expanders if it's not a basket drag... while (it.current()) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); if (!item->firstChild()) { item->setExpandable(true); item->setOpen(true); @@ -670,9 +670,9 @@ void BasketTreeListView::contentsDragEnterEvent(QDragEnterEvent *event) void BasketTreeListView::removeExpands() { - QListViewItemIterator it(this); + TQListViewItemIterator it(this); while (it.current()) { - QListViewItem *item = it.current(); + TQListViewItem *item = it.current(); if (!item->firstChild()) item->setExpandable(false); ++it; @@ -680,7 +680,7 @@ void BasketTreeListView::removeExpands() viewport()->update(); } -void BasketTreeListView::contentsDragLeaveEvent(QDragLeaveEvent *event) +void BasketTreeListView::contentsDragLeaveEvent(TQDragLeaveEvent *event) { std::cout << "BasketTreeListView::contentsDragLeaveEvent" << std::endl; m_autoOpenItem = 0; @@ -690,7 +690,7 @@ void BasketTreeListView::contentsDragLeaveEvent(QDragLeaveEvent *event) KListView::contentsDragLeaveEvent(event); } -void BasketTreeListView::contentsDropEvent(QDropEvent *event) +void BasketTreeListView::contentsDropEvent(TQDropEvent *event) { std::cout << "BasketTreeListView::contentsDropEvent()" << std::endl; if (event->provides("application/x-qlistviewitem")) @@ -699,7 +699,7 @@ void BasketTreeListView::contentsDropEvent(QDropEvent *event) } else { std::cout << "Forwarding dropped data to the basket" << std::endl; - QListViewItem *item = itemAt(contentsToViewport(event->pos())); + TQListViewItem *item = itemAt(contentsToViewport(event->pos())); BasketListViewItem* bitem = dynamic_cast<BasketListViewItem*>(item); if (bitem) { bitem->basket()->blindDrop(event); @@ -717,13 +717,13 @@ void BasketTreeListView::contentsDropEvent(QDropEvent *event) Global::bnpView->save(); // TODO: Don't save if it was not a basket drop... } -void BasketTreeListView::contentsDragMoveEvent(QDragMoveEvent *event) +void BasketTreeListView::contentsDragMoveEvent(TQDragMoveEvent *event) { std::cout << "BasketTreeListView::contentsDragMoveEvent" << std::endl; if (event->provides("application/x-qlistviewitem")) KListView::contentsDragMoveEvent(event); else { - QListViewItem *item = itemAt(contentsToViewport(event->pos())); + TQListViewItem *item = itemAt(contentsToViewport(event->pos())); BasketListViewItem* bitem = dynamic_cast<BasketListViewItem*>(item); if (m_autoOpenItem != item) { m_autoOpenItem = item; @@ -745,7 +745,7 @@ void BasketTreeListView::setItemUnderDrag(BasketListViewItem* item) if (m_itemUnderDrag) { // Remove drag status from the old item m_itemUnderDrag->setUnderDrag(false); - repaintItem(m_itemUnderDrag); + tqrepaintItem(m_itemUnderDrag); } m_itemUnderDrag = item; @@ -753,7 +753,7 @@ void BasketTreeListView::setItemUnderDrag(BasketListViewItem* item) if (m_itemUnderDrag) { // add drag status to the new item m_itemUnderDrag->setUnderDrag(true); - repaintItem(m_itemUnderDrag); + tqrepaintItem(m_itemUnderDrag); } } } @@ -765,23 +765,23 @@ void BasketTreeListView::autoOpen() Global::bnpView->setCurrentBasket(item->basket()); } -void BasketTreeListView::resizeEvent(QResizeEvent *event) +void BasketTreeListView::resizeEvent(TQResizeEvent *event) { KListView::resizeEvent(event); } -void BasketTreeListView::paintEmptyArea(QPainter *painter, const QRect &rect) +void BasketTreeListView::paintEmptyArea(TQPainter *painter, const TQRect &rect) { - QListView::paintEmptyArea(painter, rect); + TQListView::paintEmptyArea(painter, rect); BasketListViewItem *last = Global::bnpView->lastListViewItem(); if (last && !last->isShown()) last = last->shownItemAbove(); if (last && last->isCurrentBasket()) { int y = last->itemPos() + last->height(); - QColor bgColor = paletteBackgroundColor(); - QColor selColor = KGlobalSettings::highlightColor(); - QColor midColor = Tools::mixColor(bgColor, selColor); + TQColor bgColor = paletteBackgroundColor(); + TQColor selColor = KGlobalSettings::highlightColor(); + TQColor midColor = Tools::mixColor(bgColor, selColor); painter->setPen(selColor); painter->drawPoint(visibleWidth() - 1, y); painter->drawPoint(visibleWidth() - 2, y); @@ -792,11 +792,11 @@ void BasketTreeListView::paintEmptyArea(QPainter *painter, const QRect &rect) } } -/** We should NEVER get focus (because of QWidget::NoFocus focusPolicy()) +/** We should NEVER get focus (because of TQ_NoFocus focusPolicy()) * but KListView can programatically give us the focus. * So we give it to the basket. */ -void BasketTreeListView::focusInEvent(QFocusEvent*) +void BasketTreeListView::focusInEvent(TQFocusEvent*) { //KListView::focusInEvent(event); Basket *basket = Global::bnpView->currentBasket(); |