diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 08:42:58 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-01 08:42:58 +0000 |
commit | 9902f14bc9162d7b286b3f99b27989237db9f264 (patch) | |
tree | b95be3be1992566418b2c2e2ed16bdb29453a8d4 /ksystemlog/src/logListItem.cpp | |
parent | 437249c71459e9ea15be70788687cb8695e249c2 (diff) | |
download | ksystemlog-9902f14bc9162d7b286b3f99b27989237db9f264.tar.gz ksystemlog-9902f14bc9162d7b286b3f99b27989237db9f264.zip |
TQt4 port ksystemlog
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ksystemlog@1239000 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksystemlog/src/logListItem.cpp')
-rw-r--r-- | ksystemlog/src/logListItem.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/ksystemlog/src/logListItem.cpp b/ksystemlog/src/logListItem.cpp index 4b2e808..ebbed6b 100644 --- a/ksystemlog/src/logListItem.cpp +++ b/ksystemlog/src/logListItem.cpp @@ -18,15 +18,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -//Qt includes -#include <qstringlist.h> -#include <qdatetime.h> -#include <qobject.h> +//TQt includes +#include <tqstringlist.h> +#include <tqdatetime.h> +#include <tqobject.h> -#include <qpainter.h> -#include <qpen.h> -#include <qclipboard.h> -#include <qcolor.h> +#include <tqpainter.h> +#include <tqpen.h> +#include <tqclipboard.h> +#include <tqcolor.h> //KDE includes #include <klocale.h> @@ -45,15 +45,15 @@ #include "logListItem.h" -LogListItem::LogListItem(QListView* list, LogLine* l) : +LogListItem::LogListItem(TQListView* list, LogLine* l) : KListViewItem(list), line(l) { } -LogListItem::LogListItem(QListViewItem* parent, LogLine* l) : - KListViewItem(parent), +LogListItem::LogListItem(TQListViewItem* tqparent, LogLine* l) : + KListViewItem(tqparent), line(l) { @@ -64,11 +64,11 @@ LogListItem::~LogListItem() { } -QString LogListItem::getFormattedText() { +TQString LogListItem::getFormattedText() { return(ItemFactory::createFormattedText(line)); } -QString LogListItem::getToolTipText() { +TQString LogListItem::getToolTipText() { return(ItemFactory::createToolTipText(line)); } @@ -76,7 +76,7 @@ LogLine* LogListItem::getLogLine() { return(line); } -int LogListItem::compare(QListViewItem* it, int col, bool ascending) const { +int LogListItem::compare(TQListViewItem* it, int col, bool ascending) const { if (col==0) { @@ -94,19 +94,19 @@ int LogListItem::compare(QListViewItem* it, int col, bool ascending) const { return(1); } else { - return(QListViewItem::compare(it, col, ascending)); + return(TQListViewItem::compare(it, col, ascending)); } } -QDateTime& LogListItem::getTime() { +TQDateTime& LogListItem::getTime() { return(line->getTime()); } -QString LogListItem::exportToText() { +TQString LogListItem::exportToText() { int columnCount=listView()->columns(); - QString exporting; + TQString exporting; if (columnCount==0) return(exporting); @@ -131,7 +131,7 @@ QString LogListItem::exportToText() { * TODO Retest this method */ -void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) { +void LogListItem::paintCell(TQPainter* p, const TQColorGroup& cg, int column, int width, int align) { /* For debugging KListViewItem::paintCell( p, cg, column, width, align ); return; @@ -146,12 +146,12 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int } //flicker-free drawing - static QPixmap buffer; + static TQPixmap buffer; buffer.resize(width, height()); //If there is a problem, let KListViewItem class draw this item if( buffer.isNull() ) { - kdDebug() << "LogListItem::paintCell() : QPixmap null" << endl; + kdDebug() << "LogListItem::paintCell() : TQPixmap null" << endl; KListViewItem::paintCell(p, cg, column, width, align); return; } @@ -159,7 +159,7 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int //kdDebug() << "LogListItem::paintCell() : Painting the cell" << endl; //Initialize our drawing object - QPainter pBuf( &buffer, true ); + TQPainter pBuf( &buffer, true ); //Use or not an alternate background @@ -180,12 +180,12 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int pBuf.drawLine(width-1, 0, width-1, height()); //Gets the current font and font metric - QFont font(p->font()); - QFontMetrics fm(p->fontMetrics()); + TQFont font(p->font()); + TQFontMetrics fm(p->fontMetrics()); if (line->isParentLogLine()==true && column==0) { - //Draw 3 gray lines around the parent item + //Draw 3 gray lines around the tqparent item pBuf.setPen(cg.button()); pBuf.drawLine(0, 0, width, 0); pBuf.drawLine(0, height()-1, width, height()-1); @@ -200,7 +200,7 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int //Draw the item name in bold if it is a recent one if (line->isRecent()==true && column==lv->columns()-1) font.setBold(true); - //Draw in italic and bold if it's a parent item + //Draw in italic and bold if it's a tqparent item else if (line->isParentLogLine()==true && column==0) { font.setItalic(true); font.setBold(true); @@ -211,7 +211,7 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int pBuf.setFont(font); - QFontMetrics fmName(font); + TQFontMetrics fmName(font); //Draw the pixmap m_loadingPix if (pixmap(column)) { @@ -227,7 +227,7 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int text_x=1; - //If this is the first column and also a parent log line + //If this is the first column and also a tqparent log line if (line->isParentLogLine()==true && column==0) { if (KSystemLogConfig::colorizeLogLines() && ((ParentLogLine*)line)->getGroupBy()==GROUP_BY_LOG_LEVEL) pBuf.setPen( isSelected() ? cg.text() : line->getLogLevel()->color); @@ -243,10 +243,10 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int pBuf.setPen( isSelected() ? cg.highlightedText() : cg.text() ); } - QString name = text(column); + TQString name = text(column); if( fmName.width(name) + text_x + lv->itemMargin()*2 > width ) { int ellWidth = fmName.width( "..." ); - QString text = QString::fromLatin1(""); + TQString text = TQString::tqfromLatin1(""); int i = 0; int len = name.length(); while ( i < len && fmName.width( text + name[ i ] ) + ellWidth < width - text_x - lv->itemMargin()*2 ) { @@ -271,7 +271,7 @@ void LogListItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int bool detailedView = PlaylistBrowser::instance()->viewMode() == PlaylistBrowser::DetailedView; //flicker-free drawing -static QPixmap buffer; +static TQPixmap buffer; buffer.resize( width, height() ); if( buffer.isNull() ) { @@ -279,7 +279,7 @@ if( buffer.isNull() ) { return; } -QPainter pBuf( &buffer, true ); +TQPainter pBuf( &buffer, true ); // use alternate background pBuf.fillRect( buffer.rect(), isSelected() ? cg.highlight() : backgroundColor() ); @@ -291,7 +291,7 @@ if( detailedView ) { KListView *lv = (KListView *)listView(); -QRect rect( ((lv->treeStepSize()-9) / 2) + 1, (height()-9) / 2, 9, 9 ); +TQRect rect( ((lv->treeStepSize()-9) / 2) + 1, (height()-9) / 2, 9, 9 ); if( m_loading && m_loadingPix ) { pBuf.drawPixmap( (lv->treeStepSize() - m_loadingPix->width())/2, @@ -304,7 +304,7 @@ else if( m_trackCount ) { pBuf.setPen( cg.mid() ); pBuf.drawRect( rect ); //fill the rect with base color if the item has alternate color and viceversa - QColor color = backgroundColor() == lv->alternateBackground() ? cg.base() : lv->alternateBackground(); + TQColor color = backgroundColor() == lv->alternateBackground() ? cg.base() : lv->alternateBackground(); pBuf.fillRect( rect.x()+1, rect.y()+1, rect.width()-2, rect.height()-2, color ); // +/- drawing pBuf.setPen( cg.text() ); @@ -313,8 +313,8 @@ else if( m_trackCount ) { pBuf.drawLine( rect.x()+4, rect.y()+2, rect.x()+4, rect.y()+6 ); } -QFont font( p->font() ); -QFontMetrics fm( p->fontMetrics() ); +TQFont font( p->font() ); +TQFontMetrics fm( p->fontMetrics() ); // Use underlined font for "Current Playlist" if ( m_url.protocol() == "cur" ) @@ -342,12 +342,12 @@ if( m_modified && m_savePix ) { // draw the playlist name in bold font.setBold( PlaylistBrowser::instance()->viewMode() == PlaylistBrowser::DetailedView ); pBuf.setFont( font ); -QFontMetrics fmName( font ); +TQFontMetrics fmName( font ); -QString name = text(0); +TQString name = text(0); if( fmName.width( name ) + text_x + lv->itemMargin()*2 > width ) { int ellWidth = fmName.width( "..." ); - QString text = QString::fromLatin1(""); + TQString text = TQString::tqfromLatin1(""); int i = 0; int len = name.length(); while ( i < len && fmName.width( text + name[ i ] ) + ellWidth < width - text_x - lv->itemMargin()*2 ) { @@ -360,7 +360,7 @@ if( fmName.width( name ) + text_x + lv->itemMargin()*2 > width ) { pBuf.drawText( text_x, 0, width, textHeight, AlignVCenter, name ); if( detailedView ) { - QString info; + TQString info; text_x = lv->treeStepSize() + 3; font.setBold( false ); @@ -375,7 +375,7 @@ if( fmName.width( name ) + text_x + lv->itemMargin()*2 > width ) { // draw the number of tracks and the total length of the playlist info += i18n("1 Track", "%n Tracks", m_trackCount); if( m_length ) - info += QString(" - [%2]").arg( MetaBundle::prettyTime( m_length ) ); + info += TQString(" - [%2]").tqarg( MetaBundle::prettyTime( m_length ) ); } pBuf.drawText( text_x, textHeight, width, fm.lineSpacing(), AlignVCenter, info); |