diff options
Diffstat (limited to 'src/svnfrontend/blamedisplay_impl.cpp')
-rw-r--r-- | src/svnfrontend/blamedisplay_impl.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/src/svnfrontend/blamedisplay_impl.cpp b/src/svnfrontend/blamedisplay_impl.cpp index 36381e4..4a79b6e 100644 --- a/src/svnfrontend/blamedisplay_impl.cpp +++ b/src/svnfrontend/blamedisplay_impl.cpp @@ -37,16 +37,16 @@ #include <ktextbrowser.h> #include <klistviewsearchline.h> -#include <qpixmap.h> -#include <qpainter.h> -#include <qheader.h> -#include <qmap.h> -#include <qpopupmenu.h> -#include <qvbox.h> -#include <qtooltip.h> -#include <qwhatsthis.h> -#include <qlayout.h> -#include <qtextcodec.h> +#include <tqpixmap.h> +#include <tqpainter.h> +#include <tqheader.h> +#include <tqmap.h> +#include <tqpopupmenu.h> +#include <tqvbox.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqtextcodec.h> #define COL_LINENR 0 #define COL_REV 1 @@ -66,31 +66,31 @@ public: void localeChanged() { if (!codec_searched) { - cc = QTextCodec::codecForName(Kdesvnsettings::locale_for_blame()); + cc = TQTextCodec::codecForName(Kdesvnsettings::locale_for_blame()); codec_searched = true; } if (cc) { m_tLine=cc->toUnicode(line().data(),line().size()); m_tAuthor=cc->toUnicode(author().data(),author().size()); } else { - m_tLine=QString::FROMUTF8(line().data(),line().size()); - m_tAuthor=QString::FROMUTF8(author().data(),author().size()); + m_tLine=TQString::FROMUTF8(line().data(),line().size()); + m_tAuthor=TQString::FROMUTF8(author().data(),author().size()); } } - const QString& tAuthor()const{return m_tAuthor;} - const QString& tLine()const{return m_tLine;} + const TQString& tAuthor()const{return m_tAuthor;} + const TQString& tLine()const{return m_tLine;} static void reset_codec(){codec_searched = false; cc=0;} protected: - QString m_tAuthor,m_tLine; + TQString m_tAuthor,m_tLine; static bool codec_searched; - static QTextCodec * cc; + static TQTextCodec * cc; }; -QTextCodec* LocalizedAnnotatedLine::cc = 0; +TQTextCodec* LocalizedAnnotatedLine::cc = 0; bool LocalizedAnnotatedLine::codec_searched = false; class BlameDisplayItem:public KListViewItem @@ -99,11 +99,11 @@ public: BlameDisplayItem(KListView*,const svn::AnnotateLine&,bool,BlameDisplay_impl*); BlameDisplayItem(KListView*,BlameDisplayItem*,const svn::AnnotateLine&,bool,BlameDisplay_impl*); virtual ~BlameDisplayItem(){} - virtual int compare(QListViewItem *i, int col, bool ascending)const; - virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment); + virtual int compare(TQListViewItem *i, int col, bool ascending)const; + virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int tqalignment); virtual int rtti()const{return 1000;} - virtual int width( const QFontMetrics & fm, const QListView * lv, int c ) const; + virtual int width( const TQFontMetrics & fm, const TQListView * lv, int c ) const; apr_int64_t lineNumber(){return m_Content.lineNumber();} svn_revnum_t rev(){return m_Content.revision();} @@ -114,9 +114,9 @@ public: if (m_disp){ setText(COL_AUT,m_Content.tAuthor()); } - QString _line = m_Content.tLine(); - _line.replace("\t"," "); - setText(COL_LINE,QString("%1").arg(_line)); + TQString _line = m_Content.tLine(); + _line.tqreplace("\t"," "); + setText(COL_LINE,TQString("%1").tqarg(_line)); } protected: @@ -142,10 +142,10 @@ BlameDisplayItem::BlameDisplayItem(KListView*lv,BlameDisplayItem*it,const svn::A #define BORDER 4 -int BlameDisplayItem::width (const QFontMetrics & fm, const QListView * lv, int c ) const +int BlameDisplayItem::width (const TQFontMetrics & fm, const TQListView * lv, int c ) const { if (c == COL_LINE) { - return KListViewItem::width(QFontMetrics(KGlobalSettings::fixedFont()),lv,c)+2*BORDER; + return KListViewItem::width(TQFontMetrics(KGlobalSettings::fixedFont()),lv,c)+2*BORDER; } return KListViewItem::width(fm,lv,c)+2*BORDER; } @@ -153,20 +153,20 @@ int BlameDisplayItem::width (const QFontMetrics & fm, const QListView * lv, int void BlameDisplayItem::display() { if (m_disp){ - setText(COL_REV,QString("%1").arg(m_Content.revision())); + setText(COL_REV,TQString("%1").tqarg(m_Content.revision())); setText(COL_AUT,m_Content.tAuthor()); if (m_Content.date().isValid()) { setText(COL_DATE,KGlobal::locale()->formatDateTime(m_Content.date())); } } - setText(COL_LINENR,QString("%1").arg(m_Content.lineNumber()+1)); - QString _line = m_Content.tLine(); - _line.replace("\t"," "); - setText(COL_LINE,QString("%1").arg(_line)); + setText(COL_LINENR,TQString("%1").tqarg(m_Content.lineNumber()+1)); + TQString _line = m_Content.tLine(); + _line.tqreplace("\t"," "); + setText(COL_LINE,TQString("%1").tqarg(_line)); } -int BlameDisplayItem::compare(QListViewItem *item, int col, bool ascending)const +int BlameDisplayItem::compare(TQListViewItem *item, int col, bool ascending)const { Q_UNUSED(ascending); BlameDisplayItem* k = static_cast<BlameDisplayItem*>(item); @@ -182,19 +182,19 @@ int BlameDisplayItem::compare(QListViewItem *item, int col, bool ascending)const return k->m_Content.lineNumber()-m_Content.lineNumber(); } -void BlameDisplayItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) +void BlameDisplayItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int tqalignment) { - if (alignment & (AlignTop || AlignBottom) == 0) - alignment |= AlignVCenter; + if (tqalignment & (AlignTop || AlignBottom) == 0) + tqalignment |= AlignVCenter; /* don't copy string */ - const QString & str = text(column);; + const TQString & str = text(column);; if (column == COL_LINE) { p->setFont(KGlobalSettings::fixedFont()); } - QColorGroup _cg = cg; - QColor _bgColor; + TQColorGroup _cg = cg; + TQColor _bgColor; if (column==COL_LINENR || isSelected()) { _bgColor = KGlobalSettings::highlightColor(); p->setPen(KGlobalSettings::highlightedTextColor()); @@ -202,7 +202,7 @@ void BlameDisplayItem::paintCell(QPainter *p, const QColorGroup &cg, int column, if (Kdesvnsettings::self()->colored_blame()) { _bgColor = cb->rev2color(m_Content.revision()); } else { - _bgColor = listView()->viewport()->colorGroup().base(); + _bgColor = listView()->viewport()->tqcolorGroup().base(); } } @@ -213,7 +213,7 @@ void BlameDisplayItem::paintCell(QPainter *p, const QColorGroup &cg, int column, if (str.isEmpty()) return; - p->drawText(BORDER, 0, width - 2*BORDER, height(), alignment, str); + p->drawText(BORDER, 0, width - 2*BORDER, height(), tqalignment, str); } class BlameDisplayData @@ -230,31 +230,31 @@ class BlameDisplayData } ~BlameDisplayData(){} svn_revnum_t max,min; - QMap<svn_revnum_t,QColor> m_shadingMap; - QMap<svn_revnum_t,svn::LogEntry> m_logCache; + TQMap<svn_revnum_t,TQColor> m_shadingMap; + TQMap<svn_revnum_t,svn::LogEntry> m_logCache; - QColor m_lastCalcColor; + TQColor m_lastCalcColor; unsigned int rev_count; bool up; SimpleLogCb*m_cb; - QString m_File; + TQString m_File; KDialogBase*m_dlg; - QString reposRoot; + TQString reposRoot; }; -BlameDisplay_impl::BlameDisplay_impl(QWidget*parent,const char*name) - : BlameDisplay(parent,name) +BlameDisplay_impl::BlameDisplay_impl(TQWidget*tqparent,const char*name) + : BlameDisplay(tqparent,name) { m_Data = new BlameDisplayData(); - connect(m_BlameList,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged())); + connect(m_BlameList,TQT_SIGNAL(selectionChanged()),this,TQT_SLOT(slotSelectionChanged())); } -BlameDisplay_impl::BlameDisplay_impl(const QString&what,const svn::AnnotatedFile&blame,QWidget*parent,const char*name) - : BlameDisplay(parent,name) +BlameDisplay_impl::BlameDisplay_impl(const TQString&what,const svn::AnnotatedFile&blame,TQWidget*tqparent,const char*name) + : BlameDisplay(tqparent,name) { m_Data = new BlameDisplayData(); - connect(m_BlameList,SIGNAL(selectionChanged()),this,SLOT(slotSelectionChanged())); + connect(m_BlameList,TQT_SIGNAL(selectionChanged()),this,TQT_SLOT(slotSelectionChanged())); setContent(what,blame); } @@ -263,21 +263,21 @@ void BlameDisplay_impl::setCb(SimpleLogCb*_cb) m_Data->m_cb = _cb; } -void BlameDisplay_impl::setContent(const QString&what,const svn::AnnotatedFile&blame) +void BlameDisplay_impl::setContent(const TQString&what,const svn::AnnotatedFile&blame) { m_Data->m_File = what; m_SearchWidget = new KListViewSearchLineWidget(m_BlameList,this); EncodingSelector_impl*m_Ls = new EncodingSelector_impl(Kdesvnsettings::locale_for_blame(),this); - connect(m_Ls,SIGNAL(TextCodecChanged(const QString&)), - this,SLOT(slotTextCodecChanged(const QString&))); + connect(m_Ls,TQT_SIGNAL(TextCodecChanged(const TQString&)), + this,TQT_SLOT(slotTextCodecChanged(const TQString&))); BlameDisplayLayout->remove(m_BlameList); BlameDisplayLayout->addWidget(m_Ls); BlameDisplayLayout->addWidget(m_SearchWidget); BlameDisplayLayout->addWidget(m_BlameList); - m_BlameList->setColumnAlignment(COL_REV,Qt::AlignRight); - m_BlameList->setColumnAlignment(COL_LINENR,Qt::AlignRight); + m_BlameList->setColumnAlignment(COL_REV,TQt::AlignRight); + m_BlameList->setColumnAlignment(COL_LINENR,TQt::AlignRight); m_BlameList->clear(); if (m_Data->m_dlg) { @@ -296,18 +296,18 @@ void BlameDisplay_impl::setContent(const QString&what,const svn::AnnotatedFile&b if (disp) { lastRev = (*bit).revision(); } - if (m_Data->m_shadingMap.find((*bit).revision())==m_Data->m_shadingMap.end()) { - m_Data->m_shadingMap[(*bit).revision()]=QColor(); + if (m_Data->m_shadingMap.tqfind((*bit).revision())==m_Data->m_shadingMap.end()) { + m_Data->m_shadingMap[(*bit).revision()]=TQColor(); } } if (Kdesvnsettings::self()->colored_blame()) { - QColor a(160,160,160); + TQColor a(160,160,160); int offset = 10; int r=0; int g=0;int b=0; uint colinc=0; for (svn_revnum_t i = m_Data->min; i<= m_Data->max;++i) { - if (m_Data->m_shadingMap.find(i)==m_Data->m_shadingMap.end()) { + if (m_Data->m_shadingMap.tqfind(i)==m_Data->m_shadingMap.end()) { continue; } a.setRgb(a.red()+offset,a.green()+offset,a.blue()+offset); @@ -338,13 +338,13 @@ void BlameDisplay_impl::setContent(const QString&what,const svn::AnnotatedFile&b } } -const QColor BlameDisplay_impl::rev2color(svn_revnum_t r )const +const TQColor BlameDisplay_impl::rev2color(svn_revnum_t r )const { - if (m_Data->m_shadingMap.find(r)!=m_Data->m_shadingMap.end() && m_Data->m_shadingMap[r].isValid()) + if (m_Data->m_shadingMap.tqfind(r)!=m_Data->m_shadingMap.end() && m_Data->m_shadingMap[r].isValid()) { return m_Data->m_shadingMap[r]; } else { - return m_BlameList->viewport()->colorGroup().base(); + return m_BlameList->viewport()->tqcolorGroup().base(); } } @@ -361,7 +361,7 @@ void BlameDisplay_impl::slotGoLine() if (!ok) { return; } - QListViewItem*item = m_BlameList->firstChild(); + TQListViewItem*item = m_BlameList->firstChild(); --line; while (item) { if (item->rtti()==1000) { @@ -376,11 +376,11 @@ void BlameDisplay_impl::slotGoLine() } } -void BlameDisplay_impl::slotContextMenuRequested(KListView*,QListViewItem*item, const QPoint&pos) +void BlameDisplay_impl::slotContextMenuRequested(KListView*,TQListViewItem*item, const TQPoint&pos) { if (item==0||item->rtti()!=1000) return; BlameDisplayItem*bit = static_cast<BlameDisplayItem*>(item); - QPopupMenu popup; + TQPopupMenu popup; popup.insertItem(i18n("Log message for revision"),101); int r = popup.exec(pos); @@ -398,11 +398,11 @@ void BlameDisplay_impl::showCommit(BlameDisplayItem*bit) { if (!bit) return; WidgetBlockStack a(m_BlameList); - QString text; - if (m_Data->m_logCache.find(bit->rev())!=m_Data->m_logCache.end()) { + TQString text; + if (m_Data->m_logCache.tqfind(bit->rev())!=m_Data->m_logCache.end()) { text = m_Data->m_logCache[bit->rev()].message; } else { - CursorStack a(Qt::BusyCursor); + CursorStack a(TQt::BusyCursor); svn::LogEntry t; if (m_Data->m_cb && m_Data->m_cb->getSingleLog(t,bit->rev(),m_Data->m_File,m_Data->max,m_Data->reposRoot)) { m_Data->m_logCache[bit->rev()] = t; @@ -410,13 +410,13 @@ void BlameDisplay_impl::showCommit(BlameDisplayItem*bit) } } KDialogBase* dlg = new KDialogBase( - KApplication::activeModalWidget(), - "simplelog",true,QString(i18n("Logmessage for revision %1").arg(bit->rev())), + TQT_TQWIDGET(KApplication::activeModalWidget()), + "simplelog",true,TQString(i18n("Logmessage for revision %1").tqarg(bit->rev())), KDialogBase::Close); - QWidget* Dialog1Layout = dlg->makeVBoxMainWidget(); + TQWidget* Dialog1Layout = dlg->makeVBoxMainWidget(); KTextBrowser*ptr = new KTextBrowser(Dialog1Layout); ptr->setFont(KGlobalSettings::fixedFont()); - ptr->setWordWrap(QTextEdit::NoWrap); + ptr->setWordWrap(TQTextEdit::NoWrap); ptr->setText(text); dlg->resize(dlg->configDialogSize(*(Kdesvnsettings::self()->config()),"simplelog_display")); dlg->exec(); @@ -425,7 +425,7 @@ void BlameDisplay_impl::showCommit(BlameDisplayItem*bit) void BlameDisplay_impl::slotShowCurrentCommit() { - QListViewItem*item = m_BlameList->selectedItem(); + TQListViewItem*item = m_BlameList->selectedItem(); if (item==0||item->rtti()!=1000) return; BlameDisplayItem*bit = static_cast<BlameDisplayItem*>(item); showCommit(bit); @@ -434,7 +434,7 @@ void BlameDisplay_impl::slotShowCurrentCommit() void BlameDisplay_impl::slotSelectionChanged() { if (!m_Data->m_dlg) return; - QListViewItem*item = m_BlameList->selectedItem(); + TQListViewItem*item = m_BlameList->selectedItem(); if (item==0||item->rtti()!=1000) { m_Data->m_dlg->enableButton(KDialogBase::User2,false); } else { @@ -442,43 +442,43 @@ void BlameDisplay_impl::slotSelectionChanged() } } -void BlameDisplay_impl::displayBlame(SimpleLogCb*_cb,const QString&item,const svn::AnnotatedFile&blame,QWidget*,const char*name) +void BlameDisplay_impl::displayBlame(SimpleLogCb*_cb,const TQString&item,const svn::AnnotatedFile&blame,TQWidget*,const char*name) { int buttons = KDialogBase::Close|KDialogBase::User1|KDialogBase::User2; KDialogBase * dlg = new KDialogBase( - KApplication::activeModalWidget(), - name,true,QString(i18n("Blame %1")).arg(item),buttons,KDialogBase::Close,false, + TQT_TQWIDGET(KApplication::activeModalWidget()), + name,true,TQString(i18n("Blame %1")).tqarg(item),buttons,KDialogBase::Close,false, KGuiItem(i18n("Goto line")),KGuiItem(i18n("Log message for revision"),"kdesvnlog")); - QWidget* Dialog1Layout = dlg->makeVBoxMainWidget(); + TQWidget* Dialog1Layout = dlg->makeVBoxMainWidget(); BlameDisplay_impl*ptr = new BlameDisplay_impl(Dialog1Layout); dlg->resize(dlg->configDialogSize(*(Kdesvnsettings::self()->config()),"blame_dlg")); ptr->setContent(item,blame); ptr->setCb(_cb); ptr->m_Data->m_dlg = dlg; dlg->enableButton(KDialogBase::User2,false); - connect(dlg,SIGNAL(user1Clicked()),ptr,SLOT(slotGoLine())); - connect(dlg,SIGNAL(user2Clicked()),ptr,SLOT(slotShowCurrentCommit())); + connect(dlg,TQT_SIGNAL(user1Clicked()),ptr,TQT_SLOT(slotGoLine())); + connect(dlg,TQT_SIGNAL(user2Clicked()),ptr,TQT_SLOT(slotShowCurrentCommit())); Dialog1Layout->adjustSize(); dlg->exec(); dlg->saveDialogSize(*(Kdesvnsettings::self()->config()),"blame_dlg",false); } -void BlameDisplay_impl::slotItemDoubleClicked(QListViewItem*item) +void BlameDisplay_impl::slotItemDoubleClicked(TQListViewItem*item) { if (item==0||item->rtti()!=1000) return; BlameDisplayItem*bit = static_cast<BlameDisplayItem*>(item); showCommit(bit); } -void BlameDisplay_impl::slotTextCodecChanged(const QString&what) +void BlameDisplay_impl::slotTextCodecChanged(const TQString&what) { if (Kdesvnsettings::locale_for_blame()!=what) { Kdesvnsettings::setLocale_for_blame(what); Kdesvnsettings::self()->writeConfig(); LocalizedAnnotatedLine::reset_codec(); - QListViewItemIterator it(m_BlameList); + TQListViewItemIterator it(m_BlameList); while ( it.current() ) { BlameDisplayItem*_it = static_cast<BlameDisplayItem*>(it.current()); _it->localeChanged(); |