author | ar <ar> | 2004-05-03 21:35:18 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-03 21:35:18 (UTC) |
commit | 412619441fab46fc79c695a23ccf9e38135bdfad (patch) (side-by-side diff) | |
tree | 19d9b8af14cf6c345ef532bb32368b9c7b43c50f /noncore/apps/tinykate/libkate/document | |
parent | d1095d71394779557f446e2a67ba55bc62eec859 (diff) | |
download | opie-412619441fab46fc79c695a23ccf9e38135bdfad.zip opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.gz opie-412619441fab46fc79c695a23ccf9e38135bdfad.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'noncore/apps/tinykate/libkate/document') (more/less context) (ignore whitespace changes)
4 files changed, 184 insertions, 173 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp index 22a4917..4c15fd0 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp +++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp @@ -22,24 +22,25 @@ #include "katebuffer.h" +#include "kdebug.h" -// Includes for reading file -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> +/* OPIE */ +#include <opie2/odebug.h> +/* QT */ #include <qfile.h> #include <qtextstream.h> - #include <qtimer.h> #include <qtextcodec.h> -// - +/* STD */ +// Includes for reading file +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> #include <assert.h> -#include <kdebug.h> /** * Create an empty buffer. @@ -65,35 +66,35 @@ KWBuffer::clear() void KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) { - if (line) { - qDebug("insert File only supports insertion at line 0 == file opening"); - return; - } - clear(); - QFile iofile(file); - iofile.open(IO_ReadOnly); - QTextStream stream(&iofile); - stream.setCodec(codec); - QString qsl; - int count=0; - for (count=0;((qsl=stream.readLine())!=QString::null); count++) - { - if (count==0) - { - (*m_stringListIt)->append(qsl.unicode(),qsl.length()); - } - else - { - TextLine::Ptr tl=new TextLine(); - tl ->append(qsl.unicode(),qsl.length()); - m_stringListIt=m_stringList.append(tl); - } - } - if (count!=0) - { - m_stringListCurrent=count-1; - m_lineCount=count; - } + if (line) { + odebug << "insert File only supports insertion at line 0 == file opening" << oendl; + return; + } + clear(); + QFile iofile(file); + iofile.open(IO_ReadOnly); + QTextStream stream(&iofile); + stream.setCodec(codec); + QString qsl; + int count=0; + for (count=0;((qsl=stream.readLine())!=QString::null); count++) + { + if (count==0) + { + (*m_stringListIt)->append(qsl.unicode(),qsl.length()); + } + else + { + TextLine::Ptr tl=new TextLine(); + tl ->append(qsl.unicode(),qsl.length()); + m_stringListIt=m_stringList.append(tl); + } + } + if (count!=0) + { + m_stringListCurrent=count-1; + m_lineCount=count; + } } void @@ -121,9 +122,9 @@ KWBuffer::slotLoadFile() int KWBuffer::count() { - qDebug("m_stringList.count %d",m_stringList.count()); + odebug << "m_stringList.count " << m_stringList.count() << "" << oendl; return m_lineCount; -// return m_stringList.count(); +// return m_stringList.count(); // return m_totalLines; } @@ -148,9 +149,9 @@ void KWBuffer::seek(int i) TextLine::Ptr KWBuffer::line(int i) { - if (i>=m_stringList.count()) return 0; - seek(i); - return *m_stringListIt; + if (i>=m_stringList.count()) return 0; + seek(i); + return *m_stringListIt; } void diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp index 0c742d7..6dc4fd2 100644 --- a/noncore/apps/tinykate/libkate/document/katedocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp @@ -6,7 +6,7 @@ (C) 2002 by Joseph Wenninger email : crossfire@babylon2k.de jowenn@kde.org - + ***************************************************************************/ /*************************************************************************** @@ -39,20 +39,31 @@ */ #include "katedocument.h" +#include "kmessagebox.h" +#include "kglobal.h" +//#include "kcharsets.h" +#include "kdebug.h" +//#include "kinstance.h" -#include <qfileinfo.h> -#include <qdatetime.h> +#include "kglobalsettings.h" +//#include "kaction.h" +//#include "kstdaction.h" -#include <kmessagebox.h> -#include <qpe/config.h> -#include <qstring.h> +#include "../view/kateview.h" +#include "katebuffer.h" +#include "katetextline.h" -#include <sys/time.h> -#include <unistd.h> +#include "katecmd.h" -#include <stdio.h> +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> +/* QT */ +#include <qfileinfo.h> +#include <qdatetime.h> +#include <qstring.h> #include <qtimer.h> #include <qobject.h> #include <qapplication.h> @@ -62,21 +73,11 @@ #include <qfile.h> #include <qtextstream.h> #include <qtextcodec.h> -#include <kglobal.h> -//#include <kcharsets.h> -#include <kdebug.h> -//#include <kinstance.h> - -#include <kglobalsettings.h> -//#include <kaction.h> -//#include <kstdaction.h> - -#include "../view/kateview.h" -#include "katebuffer.h" -#include "katetextline.h" - -#include "katecmd.h" +/* STD */ +#include <sys/time.h> +#include <unistd.h> +#include <stdio.h> KateAction::KateAction(Action a, PointStruc &cursor, int len, const QString &text) : action(a), cursor(cursor), len(len), text(text) { @@ -130,7 +131,7 @@ QStringList KateDocument::replaceWithList = QStringList(); uint KateDocument::uniqueID = 0; -QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; +QPtrDict<KateDocument::KateDocPrivate>* KateDocument::d_ptr = 0; KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, @@ -141,8 +142,8 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, myFontMetrics (myFont), myFontMetricsBold (myFontBold), myFontMetricsItalic (myFontItalic), myFontMetricsBI (myFontBI), hlManager(HlManager::self ()) { - - d(this)->hlSetByUser = false; + + d(this)->hlSetByUser = false; PreHighlightedTill=0; RequestPreHighlightTill=0; @@ -152,7 +153,7 @@ KateDocument::KateDocument(bool bSingleViewMode, bool bBrowserView, m_url = QString::null; // NOTE: QFont::CharSet doesn't provide all the charsets KDE supports - // (esp. it doesn't distinguish between UTF-8 and iso10646-1) + // (esp. it doesn't distinguish between UTF-8 and iso10646-1) myEncoding = QString::fromLatin1(QTextCodec::codecForLocale()->name()); @@ -292,20 +293,20 @@ KateDocument::~KateDocument() void KateDocument::openURL(const QString &filename) { - m_file=filename; + m_file=filename; fileInfo->setFile (m_file); setMTime(); if (!fileInfo->exists() || !fileInfo->isReadable()) { - qDebug("File doesn't exit or couldn't be read"); + odebug << "File doesn't exit or couldn't be read" << oendl; return ; } buffer->clear(); #warning fixme // buffer->insertFile(0, m_file, KGlobal::charsets()->codecForName(myEncoding)); - qDebug("Telling buffer to open file"); + odebug << "Telling buffer to open file" << oendl; buffer->insertFile(0, m_file, QTextCodec::codecForLocale()); setMTime(); @@ -321,13 +322,13 @@ void KateDocument::openURL(const QString &filename) updateViews(); emit fileNameChanged(); - + return ; } bool KateDocument::saveFile() { - + QFile f( m_file ); if ( !f.open( IO_WriteOnly ) ) return false; // Error @@ -611,7 +612,7 @@ void KateDocument::readConfig() colors[0] = config->readColorEntry("Color Background", colors[0]); colors[1] = config->readColorEntry("Color Selected", colors[1]); - + // config->sync(); } @@ -683,7 +684,7 @@ void KateDocument::setHighlight(int n) { } void KateDocument::makeAttribs() { - qDebug("KateDocument::makeAttribs()"); + odebug << "KateDocument::makeAttribs()" << oendl; m_numAttribs = hlManager->makeAttribs(m_highlight, m_attribs, maxAttribs); updateFontData(); updateLines(); @@ -1923,8 +1924,8 @@ void KateDocument::updateLines(int startLine, int endLine, int flags, int cursor updateMaxLength(textLine); } endCtx = textLine->getContext(); -// qDebug("DOHIGHLIGHT"); - +// odebug << "DOHIGHLIGHT" << oendl; + ctxNum = m_highlight->doHighlight(ctxNum,textLine); textLine->setContext(ctxNum); line++; diff --git a/noncore/apps/tinykate/libkate/document/katehighlight.cpp b/noncore/apps/tinykate/libkate/document/katehighlight.cpp index 0d2c283..539d356 100644 --- a/noncore/apps/tinykate/libkate/document/katehighlight.cpp +++ b/noncore/apps/tinykate/libkate/document/katehighlight.cpp @@ -1,8 +1,8 @@ /* Copyright (C) 1998, 1999 Jochen Wilhelmy digisnap@cs.tu-berlin.de - (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> - (C) 2002 Joseph Wenninger <jowenn@kde.org> + (C) 2002, 2001 The Kate Team <kwrite-devel@kde.org> + (C) 2002 Joseph Wenninger <jowenn@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either @@ -19,26 +19,30 @@ Boston, MA 02111-1307, USA. */ -#include <string.h> - -#include <qtextstream.h> -#include <qpe/config.h> -#include <kglobal.h> -//#include <kinstance.h> -//#include <kmimemagic.h> -#include <klocale.h> -//#include <kregexp.h> -#include <kglobalsettings.h> -#include <kdebug.h> -#include <kstddirs.h> - #include "katehighlight.h" - - #include "katetextline.h" #include "katedocument.h" #include "katesyntaxdocument.h" +#include "kglobal.h" +//#include "kinstance.h" +//#include "kmimemagic.h" +#include "klocale.h" +//#include "kregexp.h" +#include "kglobalsettings.h" +#include "kdebug.h" +#include "kstddirs.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/config.h> + +/* QT */ +#include <qtextstream.h> + +/* STD */ +#include <string.h> + HlManager *HlManager::s_pSelf = 0; @@ -120,8 +124,8 @@ const QChar *HlStringDetect::checkHgl(const QChar *s, int len, bool) { if (!_inSensitive) {if (memcmp(s, str.unicode(), str.length()*sizeof(QChar)) == 0) return s + str.length();} else { - QString tmp=QString(s,str.length()).upper(); - if (tmp==str) return s+str.length(); + QString tmp=QString(s,str.length()).upper(); + if (tmp==str) return s+str.length(); } return 0L; } @@ -213,10 +217,10 @@ const QChar *HlInt::checkHgl(const QChar *str, int len, bool) { { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } return s; @@ -248,14 +252,14 @@ const QChar *HlFloat::checkHgl(const QChar *s, int len, bool) { if ((*s&0xdf) == 'E') s++; else if (!p) return 0L; - else - { + else + { if (subItems) { - for (HlItem *it=subItems->first();it;it=subItems->next()) + for (HlItem *it=subItems->first();it;it=subItems->next()) { s1=it->checkHgl(s, len, false); - if (s1) return s1; + if (s1) return s1; } } return s; @@ -345,7 +349,7 @@ const QChar *HlCHex::checkHgl(const QChar *str, int len, bool) { int pos=rx.search(line,0); if(pos > -1) return str+rx.matchedLength(); else - return 0L; + return 0L; #else if (str[0] == '0' && ((str[1]&0xdf) == 'X' )) { @@ -400,7 +404,7 @@ const QChar *HlRegExpr::checkHgl(const QChar *s, int len, bool lineStart) int pos = Expr->search( line, 0 ); if (pos==-1) return 0L; else - return (s+Expr->matchedLength()); + return (s+Expr->matchedLength()); }; @@ -411,9 +415,9 @@ HlLineContinue::HlLineContinue(int attribute, int context) const QChar *HlLineContinue::checkHgl(const QChar *s, int len, bool) { if ((s[0].latin1() == '\\') && (len == 1)) - { + { return s + 1; - } + } return 0L; } @@ -621,7 +625,7 @@ int Highlight::doHighlight(int ctxNum, TextLine *textLine) s2 = item->checkHgl(s1, len-z, z==0); if (s2 > s1) { - qDebug("An item has been detected"); + odebug << "An item has been detected" << oendl; textLine->setAttribs(item->attr,s1 - str,s2 - str); ctxNum = item->ctx; context = contextList[ctxNum]; @@ -853,7 +857,7 @@ void Highlight::done() void Highlight::createItemData(ItemDataList &list) { - qDebug("Highlight::createItemData"); + odebug << "Highlight::createItemData" << oendl; // If no highlighting is selected we need only one default. if (noHl) @@ -874,7 +878,7 @@ void Highlight::createItemData(ItemDataList &list) internalIDList.setAutoDelete(true); syntaxContextData *data; - qDebug("Trying to read itemData section"); + odebug << "Trying to read itemData section" << oendl; //Tell the syntax document class which file we want to parse and which data group HlManager::self()->syntax->setIdentifier(identifier); @@ -882,7 +886,7 @@ void Highlight::createItemData(ItemDataList &list) //begin with the real parsing while (HlManager::self()->syntax->nextGroup(data)) { - qDebug("Setting up one itemData element"); + odebug << "Setting up one itemData element" << oendl; // read all attributes color=HlManager::self()->syntax->groupData(data,QString("color")); selColor=HlManager::self()->syntax->groupData(data,QString("selColor")); @@ -933,12 +937,12 @@ void Highlight::createItemData(ItemDataList &list) int Highlight::lookupAttrName(const QString& name, ItemDataList &iDl) { - for (int i=0;i<iDl.count();i++) - { - if (iDl.at(i)->name==name) return i; - } - kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; - return 0; + for (int i=0;i<iDl.count();i++) + { + if (iDl.at(i)->name==name) return i; + } + kdDebug(13010)<<"Couldn't resolve itemDataName"<<endl; + return 0; } @@ -1077,11 +1081,11 @@ void Highlight::readCommentConfig() { if (HlManager::self()->syntax->groupData(data,"name")=="singleLine") - cslStart=HlManager::self()->syntax->groupData(data,"start"); - if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") + cslStart=HlManager::self()->syntax->groupData(data,"start"); + if (HlManager::self()->syntax->groupData(data,"name")=="multiLine") { - cmlStart=HlManager::self()->syntax->groupData(data,"start"); - cmlEnd=HlManager::self()->syntax->groupData(data,"end"); + cmlStart=HlManager::self()->syntax->groupData(data,"start"); + cmlEnd=HlManager::self()->syntax->groupData(data,"end"); } } HlManager::self()->syntax->freeGroupInfo(data); @@ -1112,10 +1116,10 @@ void Highlight::readGlobalKeywordConfig() syntaxContextData * data=HlManager::self()->syntax->getConfig("general","keywords"); if (data) { - kdDebug(13010)<<"Found global keyword config"<<endl; + kdDebug(13010)<<"Found global keyword config"<<endl; if (HlManager::self()->syntax->groupItemData(data,QString("casesensitive"))!="0") - casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} + casesensitive=true; else {casesensitive=false; kdDebug(13010)<<"Turning on case insensitiveness"<<endl;} //get the weak deliminators weakDeliminator=(!HlManager::self()->syntax->groupItemData(data,QString("weakDeliminator"))); @@ -1133,7 +1137,7 @@ void Highlight::readGlobalKeywordConfig() deliminatorChars = deliminator.unicode(); deliminatorLen = deliminator.length(); - HlManager::self()->syntax->freeGroupInfo(data); + HlManager::self()->syntax->freeGroupInfo(data); } else { @@ -1204,25 +1208,25 @@ void Highlight::makeContextList() //Let's create all items for the context while (HlManager::self()->syntax->nextItem(data)) { -// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; - c=createHlItem(data,iDl); - if (c) - { +// kdDebug(13010)<< "In make Contextlist: Item:"<<endl; + c=createHlItem(data,iDl); + if (c) + { contextList[i]->items.append(c); // Not supported completely atm and only one level. Subitems.(all have to be matched to at once) - datasub=HlManager::self()->syntax->getSubItems(data); - bool tmpbool; - if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) - { + datasub=HlManager::self()->syntax->getSubItems(data); + bool tmpbool; + if (tmpbool=HlManager::self()->syntax->nextItem(datasub)) + { c->subItems=new QList<HlItem>; - for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) + for (;tmpbool;tmpbool=HlManager::self()->syntax->nextItem(datasub)) c->subItems->append(createHlItem(datasub,iDl)); } - HlManager::self()->syntax->freeGroupInfo(datasub); + HlManager::self()->syntax->freeGroupInfo(datasub); // end of sublevel - } -// kdDebug(13010)<<"Last line in loop"<<endl; + } +// kdDebug(13010)<<"Last line in loop"<<endl; } i++; } @@ -1312,7 +1316,7 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { ItemData *itemData; int nAttribs, z; - qDebug("HlManager::makeAttribs"); + odebug << "HlManager::makeAttribs" << oendl; defaultStyleList.setAutoDelete(true); getDefaults(defaultStyleList); @@ -1321,7 +1325,7 @@ int HlManager::makeAttribs(Highlight *highlight, Attribute *a, int maxAttribs) { highlight->getItemDataList(itemDataList); nAttribs = itemDataList.count(); for (z = 0; z < nAttribs; z++) { - qDebug("HlManager::makeAttribs: createing one attribute definition"); + odebug << "HlManager::makeAttribs: createing one attribute definition" << oendl; itemData = itemDataList.at(z); if (itemData->defStyle) { // default style @@ -1415,7 +1419,7 @@ void HlManager::setDefaults(ItemStyleList &list) { ItemStyle *i; char s[64]; #warning fixme -/* +/* config = KateFactory::instance()->config(); config->setGroup("Default Item Styles"); for (z = 0; z < defaultStyles(); z++) { diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index 6059e9b..9fa4452 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp @@ -16,15 +16,20 @@ ***************************************************************************/ #include "katesyntaxdocument.h" -#include <kateconfig.h> +#include "kateconfig.h" +#include "kdebug.h" +#include "kstddirs.h" +#include "klocale.h" +#include "kmessagebox.h" +#include "kglobal.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> + +/* QT */ #include <qfile.h> -#include <kdebug.h> -#include <kstddirs.h> -#include <klocale.h> -#include <kmessagebox.h> #include <qstringlist.h> -#include <kglobal.h> -#include <qpe/qpeapplication.h> #include <qdir.h> SyntaxDocument::SyntaxDocument() @@ -39,7 +44,7 @@ void SyntaxDocument::setIdentifier(const QString& identifier) #warning FIXME delete m_root; m_root=Opie::Core::XMLElement::load(identifier); if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); - + } SyntaxDocument::~SyntaxDocument() @@ -76,13 +81,13 @@ void SyntaxDocument::setupModeList(bool force) } else { - qDebug("Found a description file:"+path+(*it)); + odebug << "Found a description file:"+path+(*it) << oendl; setIdentifier(path+(*it)); Opie::Core::XMLElement *e=m_root; if (e) { - e=e->firstChild(); - qDebug(e->tagName()); + e=e->firstChild(); + odebug << e->tagName() << oendl; if (e->tagName()=="language") { syntaxModeListItem *mli=new syntaxModeListItem; @@ -90,7 +95,7 @@ void SyntaxDocument::setupModeList(bool force) mli->section = e->attribute("section"); mli->mimetype = e->attribute("mimetype"); mli->extension = e->attribute("extensions"); - qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); + odebug << QString("valid description for: %1/%2").arg(mli->section).arg(mli->name) << oendl; if (mli->section.isEmpty()) mli->section=i18n("Other"); @@ -180,9 +185,9 @@ void SyntaxDocument::freeGroupInfo( syntaxContextData* data) syntaxContextData* SyntaxDocument::getSubItems(syntaxContextData* data) { syntaxContextData *retval=new syntaxContextData; - retval->parent=0; - retval->currentGroup=0; - retval->item=0; + retval->parent=0; + retval->currentGroup=0; + retval->item=0; if (data != 0) { retval->parent=data->currentGroup; @@ -212,8 +217,8 @@ syntaxContextData* SyntaxDocument::getConfig(const QString& mainGroupName, const if (e1->tagName()==Config) { syntaxContextData *data=new ( syntaxContextData); - data->currentGroup=0; - data->parent=0; + data->currentGroup=0; + data->parent=0; data->item=e1; return data; } @@ -254,8 +259,8 @@ syntaxContextData* SyntaxDocument::getGroupInfo(const QString& mainGroupName, co { syntaxContextData *data=new ( syntaxContextData); data->parent=e1; - data->currentGroup=0; - data->item=0; + data->currentGroup=0; + data->item=0; return data; } @@ -284,19 +289,19 @@ QStringList& SyntaxDocument::finddata(const QString& mainGroup,const QString& ty { if (e->tagName()==mainGroup) { - for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) - { - if (e1->tagName()!="list") continue; - - if (e1->attribute("name")==type) - { - for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) - { - qDebug("FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value()); - m_data+=e2->firstChild()->value().stripWhiteSpace(); - } - break; - } + for (Opie::Core::XMLElement *e1=e->firstChild();e1;e1=e1->nextChild()) + { + if (e1->tagName()!="list") continue; + + if (e1->attribute("name")==type) + { + for (Opie::Core::XMLElement *e2=e1->firstChild();e2;e2=e2->nextChild()) + { + odebug << "FOUND A LIST ENTRY("+e2->tagName()+"):"+e2->firstChild()->value() << oendl; + m_data+=e2->firstChild()->value().stripWhiteSpace(); + } + break; + } } break; } |