From 27dfc34d411dee76f09f5e516c60b0a64eb35948 Mon Sep 17 00:00:00 2001 From: ar Date: Mon, 31 May 2004 15:26:50 +0000 Subject: - convert qWarning to owarn --- diff --git a/noncore/apps/opie-write/qrichtext_p.h b/noncore/apps/opie-write/qrichtext_p.h index e368edb..3778feb 100644 --- a/noncore/apps/opie-write/qrichtext_p.h +++ b/noncore/apps/opie-write/qrichtext_p.h @@ -50,6 +50,9 @@ // // +#include +using namespace Opie::Core; + #ifndef QT_H #include "qstring.h" #include "qlist.h" @@ -124,17 +127,17 @@ public: void setCustomItem( QTextCustomItem *i ); struct CustomData { - QTextFormat *format; - QTextCustomItem *custom; - QString anchorName; - QString anchorHref; + QTextFormat *format; + QTextCustomItem *custom; + QString anchorName; + QString anchorHref; }; void loseCustomItem(); union { - QTextFormat* format; - CustomData* custom; + QTextFormat* format; + CustomData* custom; } d; bool isAnchor() const { return ( type & Anchor) != 0; } @@ -144,8 +147,8 @@ public: private: QTextStringChar &operator=( const QTextStringChar & ) { - //abort(); - return *this; + //abort(); + return *this; } friend class QComplexText; friend class QTextParagraph; @@ -208,14 +211,14 @@ private: inline bool QTextString::isBidi() const { if ( bidiDirty ) - checkBidi(); + checkBidi(); return bidi; } inline bool QTextString::isRightToLeft() const { if ( bidiDirty ) - checkBidi(); + checkBidi(); return rightToLeft; } @@ -384,7 +387,7 @@ class Q_EXPORT QTextCustomItem { public: QTextCustomItem( QTextDocument *p ) - : xpos(0), ypos(-1), width(-1), height(0), parent( p ) + : xpos(0), ypos(-1), width(-1), height(0), parent( p ) {} virtual ~QTextCustomItem(); virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0; @@ -438,7 +441,7 @@ class Q_EXPORT QTextImage : public QTextCustomItem { public: QTextImage( QTextDocument *p, const QMap &attr, const QString& context, - QMimeSourceFactory &factory ); + QMimeSourceFactory &factory ); virtual ~QTextImage(); Placement placement() const { return place; } @@ -463,7 +466,7 @@ class Q_EXPORT QTextHorizontalLine : public QTextCustomItem { public: QTextHorizontalLine( QTextDocument *p, const QMap &attr, const QString& context, - QMimeSourceFactory &factory ); + QMimeSourceFactory &factory ); virtual ~QTextHorizontalLine(); void adjustToPainter( QPainter* ); @@ -532,11 +535,11 @@ class Q_EXPORT QTextTableCell : public QLayoutItem public: QTextTableCell( QTextTable* table, - int row, int column, - const QMap &attr, - const QStyleSheetItem* style, - const QTextFormat& fmt, const QString& context, - QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); + int row, int column, + const QMap &attr, + const QStyleSheetItem* style, + const QTextFormat& fmt, const QString& context, + QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); virtual ~QTextTableCell(); QSize sizeHint() const ; @@ -606,7 +609,7 @@ public: void adjustToPainter( QPainter *p ); void pageBreak( int y, QTextFlow* flow ); void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, - const QColorGroup& cg, bool selected ); + const QColorGroup& cg, bool selected ); bool noErase() const { return TRUE; } bool ownLine() const { return TRUE; } @@ -684,9 +687,9 @@ class Q_EXPORT QTextDocument : public QObject public: enum SelectionIds { - Standard = 0, - Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to - // remove multiple lines with removeSelectedText() + Standard = 0, + Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to + // remove multiple lines with removeSelectedText() }; QTextDocument( QTextDocument *p ); @@ -791,11 +794,11 @@ public: void doLayout( QPainter *p, int w ); void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, - QPixmap *&doubleBuffer, const QColorGroup &cg, - bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); + QPixmap *&doubleBuffer, const QColorGroup &cg, + bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, - bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, - bool resetChanged = TRUE ); + bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, + bool resetChanged = TRUE ); void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); @@ -858,7 +861,7 @@ private: bool hasPrefix(const QChar* doc, int length, int pos, QChar c); bool hasPrefix(const QChar* doc, int length, int pos, const QString& s); QTextCustomItem* parseTable( const QMap &attr, const QTextFormat &fmt, - const QChar* doc, int length, int& pos, QTextParagraph *curpar ); + const QChar* doc, int length, int& pos, QTextParagraph *curpar ); bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE ); bool eat(const QChar* doc, int length, int& pos, QChar c); QString parseOpenTag(const QChar* doc, int length, int& pos, QMap &attr, bool& emptyTag); @@ -871,9 +874,9 @@ private: private: struct Q_EXPORT Focus { - QTextParagraph *parag; - int start, len; - QString href; + QTextParagraph *parag; + int start, len; + QString href; }; int cx, cy, cw, vw; @@ -931,7 +934,7 @@ class Q_EXPORT QTextDeleteCommand : public QTextCommand { public: QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray &str, - const QByteArray& oldStyle ); + const QByteArray& oldStyle ); QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray &str ); virtual ~QTextDeleteCommand(); @@ -951,10 +954,10 @@ class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand { public: QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray &str, - const QByteArray& oldStyleInfo ) - : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} + const QByteArray& oldStyleInfo ) + : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray &str ) - : QTextDeleteCommand( p, idx, str ) {} + : QTextDeleteCommand( p, idx, str ) {} virtual ~QTextInsertCommand() {} Commands type() const { return Insert; } @@ -1011,37 +1014,37 @@ struct Q_EXPORT QTextLineStart { QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) #ifndef QT_NO_COMPLEXTEXT - , bidicontext( 0 ) + , bidicontext( 0 ) #endif { } QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), - w( 0 ) + w( 0 ) #ifndef QT_NO_COMPLEXTEXT - , bidicontext( 0 ) + , bidicontext( 0 ) #endif { } #ifndef QT_NO_COMPLEXTEXT QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0), - status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } + status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } #endif virtual ~QTextLineStart() { #ifndef QT_NO_COMPLEXTEXT - if ( bidicontext && bidicontext->deref() ) - delete bidicontext; + if ( bidicontext && bidicontext->deref() ) + delete bidicontext; #endif } #ifndef QT_NO_COMPLEXTEXT void setContext( QBidiContext *c ) { - if ( c == bidicontext ) - return; - if ( bidicontext && bidicontext->deref() ) - delete bidicontext; - bidicontext = c; - if ( bidicontext ) - bidicontext->ref(); + if ( c == bidicontext ) + return; + if ( bidicontext && bidicontext->deref() ) + delete bidicontext; + bidicontext = c; + if ( bidicontext ) + bidicontext->ref(); } QBidiContext *context() const { return bidicontext; } #endif @@ -1183,7 +1186,7 @@ public: int alignment() const; virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE, - int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); + int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); virtual int topMargin() const; virtual int bottomMargin() const; @@ -1246,9 +1249,9 @@ public: protected: virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg ); virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart, - int y, int baseLine, int w, int h, int selection, - QTextStringChar *formatChar, const QColorGroup& cg, - bool rightToLeft ); + int y, int baseLine, int w, int h, int selection, + QTextStringChar *formatChar, const QColorGroup& cg, + bool rightToLeft ); private: QMap &selections() const; @@ -1315,10 +1318,10 @@ public: protected: virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, - QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 ); + QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 ); #ifndef QT_NO_COMPLEXTEXT virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, - QTextStringChar *last, int align, int space ); + QTextStringChar *last, int align, int space ); #endif void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls ); @@ -1379,7 +1382,7 @@ class Q_EXPORT QTextPreProcessor { public: enum Ids { - Standard = 0 + Standard = 0 }; QTextPreProcessor(); @@ -1399,18 +1402,18 @@ class Q_EXPORT QTextFormat public: enum Flags { - NoFlags, - Bold = 1, - Italic = 2, - Underline = 4, - Family = 8, - Size = 16, - Color = 32, - Misspelled = 64, - VAlign = 128, - StrikeOut= 256, - Font = Bold | Italic | Underline | Family | Size | StrikeOut, - Format = Font | Color | Misspelled | VAlign + NoFlags, + Bold = 1, + Italic = 2, + Underline = 4, + Family = 8, + Size = 16, + Color = 32, + Misspelled = 64, + VAlign = 128, + StrikeOut= 256, + Font = Bold | Italic | Underline | Family | Size | StrikeOut, + Format = Font | Color | Misspelled | VAlign }; enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }; @@ -1729,14 +1732,14 @@ inline void QTextDocument::setTabStops( int tw ) inline QString QTextDocument::originalText() const { if ( oTextValid ) - return oText; + return oText; return text(); } inline void QTextDocument::setFlow( QTextFlow *f ) { if ( flow_ ) - delete flow_; + delete flow_; flow_ = f; } @@ -1786,11 +1789,11 @@ inline void QTextFormat::removeRef() { ref--; if ( !collection ) - return; + return; if ( this == collection->defFormat ) - return; + return; if ( ref == 0 ) - collection->remove( this ); + collection->remove( this ); } inline QString QTextFormat::key() const @@ -1843,9 +1846,9 @@ inline void QTextParagraph::clearBackgroundColor() inline void QTextParagraph::append( const QString &s, bool reallyAtEnd ) { if ( reallyAtEnd ) - insert( str->length(), s ); + insert( str->length(), s ); else - insert( QMAX( str->length() - 1, 0 ), s ); + insert( QMAX( str->length() - 1, 0 ), s ); } inline QTextParagraph *QTextParagraph::prev() const @@ -1866,7 +1869,7 @@ inline bool QTextParagraph::hasAnySelection() const inline void QTextParagraph::setEndState( int s ) { if ( s == state ) - return; + return; state = s; } @@ -1883,7 +1886,7 @@ inline void QTextParagraph::setParagId( int i ) inline int QTextParagraph::paragId() const { if ( id == -1 ) - qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this ); + owarn << "invalid parag id!!!!!!!! (" << (void*)this << ")" << oendl; return id; } @@ -1910,14 +1913,14 @@ inline QTextString *QTextParagraph::string() const inline QTextDocument *QTextParagraph::document() const { if ( hasdoc ) - return (QTextDocument*) docOrPseudo; + return (QTextDocument*) docOrPseudo; return 0; } inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const { if ( hasdoc ) - return 0; + return 0; return (QTextParagraphPseudoDocument*) docOrPseudo; } diff --git a/noncore/apps/tableviewer/browsekeyentry.cpp b/noncore/apps/tableviewer/browsekeyentry.cpp index 04e7902..bab9af6 100644 --- a/noncore/apps/tableviewer/browsekeyentry.cpp +++ b/noncore/apps/tableviewer/browsekeyentry.cpp @@ -16,9 +16,14 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ +**********************************************************************/ #include "browsekeyentry.h" +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include #include #include @@ -28,9 +33,6 @@ #include #include -//#include -#include -// For qWarning(const char *) /*! \class TVBrowseKeyEntry @@ -42,7 +44,7 @@ */ /*! - Constructs the widget + Constructs the widget */ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) @@ -80,37 +82,37 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) ws->addWidget(dateKey, stack_elem++); ws->raiseWidget(0); - + // TODO connect slots and signals.... - connect(changeKeyButton, SIGNAL(clicked()), + connect(changeKeyButton, SIGNAL(clicked()), this, SLOT(changeKeyMenuSlot())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), this, SLOT(resetKeySlot())); - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(dayKey, SIGNAL(textChanged(const QString&)), + connect(dayKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(monthKey, SIGNAL(textChanged(const QString&)), + connect(monthKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(yearKey, SIGNAL(textChanged(const QString&)), + connect(yearKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(secondKey, SIGNAL(textChanged(const QString&)), + connect(secondKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(minuteKey, SIGNAL(textChanged(const QString&)), + connect(minuteKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(hourKey, SIGNAL(textChanged(const QString&)), + connect(hourKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - + h_layout->addWidget(ws); h_layout->addWidget(resetButton); h_layout->addWidget(changeKeyButton); } /*! - Destructs the widget + Destructs the widget */ TVBrowseKeyEntry::~TVBrowseKeyEntry() { @@ -136,8 +138,8 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param) case kt_date: ws->raiseWidget(2); break; - default: - return; + default: + return; } } @@ -146,7 +148,7 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param) */ void TVBrowseKeyEntry::changeKeyMenuSlot() { - if(ts) + if(ts) keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); } /*! @@ -165,15 +167,15 @@ void TVBrowseKeyEntry::setTableState(TableState *t) { keyMenu->clear(); for (i = 0; i < t->kRep->getNumFields(); i++) { - keyMenu->insertItem(ts->kRep->getKeyName(i), this, + keyMenu->insertItem(ts->kRep->getKeyName(i), this, SLOT(changeKeySlot(int)), 0, i); keyMenu->setItemParameter(i, i); } } /*! - Searches on the current value of the key entry provided that the - current key is of type text WARNING, TODO fix memory leaks + Searches on the current value of the key entry provided that the + current key is of type text WARNING, TODO fix memory leaks */ void TVBrowseKeyEntry::searchOnText() { @@ -228,8 +230,7 @@ void TVBrowseKeyEntry::searchOnText() break; } default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; } emit searchOnKey(ts->current_column, sendkey); @@ -239,4 +240,4 @@ void TVBrowseKeyEntry::searchOnText() This signal indicates that a search on key index currentKeyId should be done searching for the value v. -*/ +*/ diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp index b58af85..c35dbea 100644 --- a/noncore/apps/tableviewer/db/common.cpp +++ b/noncore/apps/tableviewer/db/common.cpp @@ -16,8 +16,8 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ -#include "common.h" +**********************************************************************/ +#include "common.h" #include "datacache.h" /* OPIE */ @@ -88,13 +88,13 @@ int QStringVector::compareItems(Item a, Item b) { QString *qa = (QString *)a; QString *qb = (QString *)b; - + return QString::compare(*qa, *qb); } /*! \class TVVariant - A way of abstracting void * and keeping information on + A way of abstracting void * and keeping information on the keytypes and behaviours in one place */ @@ -320,7 +320,7 @@ void TVVariant::load(QDataStream &s ) } break; default: - ofatal << "Unrecognized data type" << oendl; + ofatal << "Unrecognized data type" << oendl; } } @@ -382,7 +382,7 @@ const QString TVVariant::toString() const return ((QDate*)d->value.ptr)->toString(); case Time: return ((QTime*)d->value.ptr)->toString(); - case Int: + case Int: return QString::number(d->value.i); case Invalid: default: @@ -424,7 +424,7 @@ const QDate TVVariant::toDate() const return QDate(); return QDate(year, month, day); } - + return QDate(); } @@ -433,7 +433,7 @@ const QTime TVVariant::toTime() const { if(d->typ == Time) return *((QTime *)d->value.ptr); - + if(d->typ == String) { QString q = toString(); int hour = parseNextNumber(&q); @@ -454,7 +454,7 @@ const QTime TVVariant::toTime() const else \ detach(); \ return *((Q##f*)d->value.ptr); } - + TV_VARIANT_AS(String) TV_VARIANT_AS(Date) TV_VARIANT_AS(Time) @@ -560,7 +560,7 @@ bool TVVariant::closer(TVVariant n, TVVariant o) { /* Nothing is close to an invalid, so nothing can be closer */ if(d->typ == Invalid) - return FALSE; + return FALSE; /* can't be closer if of different type */ if(n.type() != type()) @@ -572,7 +572,7 @@ bool TVVariant::closer(TVVariant n, TVVariant o) switch(type()){ case String: { - /* case for strings is close is a substring.. closer is + /* case for strings is close is a substring.. closer is * earlier alphabetically */ QString qs1 = n.toString().lower(); QString qs2 = o.toString().lower(); @@ -582,7 +582,7 @@ bool TVVariant::closer(TVVariant n, TVVariant o) return FALSE; /* contains sub-str, if later than is not closer */ - if(QString::compare(qs1, qs2) > 0) + if(QString::compare(qs1, qs2) > 0) return FALSE; return TRUE; } @@ -593,13 +593,13 @@ bool TVVariant::closer(TVVariant n, TVVariant o) int iv = toInt(); int diff1 = (i1 - iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = (i2 - iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; - if (diff1 < diff2) + if (diff1 < diff2) return TRUE; return FALSE; } @@ -610,10 +610,10 @@ bool TVVariant::closer(TVVariant n, TVVariant o) /* definition of closer is the least difference in days */ int diff1 = i1.daysTo(iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = i2.daysTo(iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; if (diff1 < diff2) @@ -627,10 +627,10 @@ bool TVVariant::closer(TVVariant n, TVVariant o) /* definition of closer is the least difference in days */ int diff1 = i1.msecsTo(iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = i2.msecsTo(iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; if (diff1 < diff2) return TRUE; @@ -649,7 +649,7 @@ bool TVVariant::close(TVVariant n) { /* Nothing is close to an invalid, so nothing can be closer */ if(type() == Invalid) - return FALSE; + return FALSE; /* can't be close if of different type */ if(n.type() != type()) @@ -657,7 +657,7 @@ bool TVVariant::close(TVVariant n) switch(type()){ case String: { - /* case for strings is close is a substring.. closer is + /* case for strings is close is a substring.. closer is * earlier alphabetically */ QString qs1 = n.toString().lower(); QString qsv = toString().lower(); @@ -666,7 +666,7 @@ bool TVVariant::close(TVVariant n) return FALSE; return TRUE; } - case Int: + case Int: case Date: case Time: return TRUE; @@ -681,14 +681,14 @@ bool TVVariant::close(TVVariant n) /*! \class Key \brief document me! - + document me! */ Key::Key() : kname(), kexample(), kflags(0) { } Key::Key(QString name, TVVariant example, int flags) : - kname(name), kexample(example), kflags(flags) { } + kname(name), kexample(example), kflags(flags) { } Key::Key(const Key &other) { @@ -697,7 +697,7 @@ Key::Key(const Key &other) kflags = other.kflags; } -Key& Key::operator=(const Key& key) +Key& Key::operator=(const Key& key) { kname = key.kname; kexample = key.kexample; @@ -777,13 +777,13 @@ void Key::setNewFlag(bool v) /*! Constructs a KeyList */ -KeyList::KeyList() : QIntDict(20) +KeyList::KeyList() : QIntDict(20) { setAutoDelete(TRUE); } /* Should be deep copy, but isn't */ -KeyList::KeyList(const KeyList &k) : QIntDict(k) +KeyList::KeyList(const KeyList &k) : QIntDict(k) { KeyListIterator it(k); while(it.current()) { @@ -822,7 +822,7 @@ bool KeyList::operator!=(const KeyList &other) /*! Returns the number of keys stored in the KeyList */ -int KeyList::getNumFields() const +int KeyList::getNumFields() const { return count(); } @@ -847,27 +847,26 @@ int KeyList::addKey(QString name, TVVariant::KeyType type) /* generate a valid type for the example? */ TVVariant e = TVVariant("0"); switch(type) { - case TVVariant::String: + case TVVariant::String: return addKey(name, TVVariant("").asString()); break; - case TVVariant::Date: + case TVVariant::Date: return addKey(name, TVVariant(QDate::currentDate()).asDate()); break; - case TVVariant::Time: + case TVVariant::Time: return addKey(name, TVVariant(QTime(0,0,0)).toTime()); break; - case TVVariant::Int: + case TVVariant::Int: return addKey(name, TVVariant(0).toInt()); break; default: - qWarning(QObject::tr("KeyList::addKey() Cannot make default " - "value for type %1, Key not added.").arg(type)); + owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl; break; } return -1; } -void KeyList::setKeyFlags(int i, int flag) +void KeyList::setKeyFlags(int i, int flag) { if(find(i)) find(i)->setFlags(flag); @@ -880,28 +879,28 @@ int KeyList::getKeyFlags(int i) const return 0; } -bool KeyList::checkNewFlag(int i) const +bool KeyList::checkNewFlag(int i) const { if (find(i)) return find(i)->newFlag(); return false; } -void KeyList::setNewFlag(int i, bool f) +void KeyList::setNewFlag(int i, bool f) { if(!find(i)) return; find(i)->setNewFlag(f); } -bool KeyList::checkDeleteFlag(int i) const +bool KeyList::checkDeleteFlag(int i) const { if (find(i)) return find(i)->delFlag(); return false; } -void KeyList::setDeleteFlag(int i, bool f) +void KeyList::setDeleteFlag(int i, bool f) { if(!find(i)) return; @@ -918,7 +917,7 @@ QString KeyList::getKeyName(int i) const return QString(); } -void KeyList::setKeyName(int i, const QString &n) +void KeyList::setKeyName(int i, const QString &n) { if(find(i)) find(i)->setName(n); @@ -934,7 +933,7 @@ TVVariant::KeyType KeyList::getKeyType(int i) const return TVVariant::Invalid; } -void KeyList::setKeyType(int i, TVVariant::KeyType t) +void KeyList::setKeyType(int i, TVVariant::KeyType t) { if(!find(i)) return; @@ -1040,9 +1039,9 @@ QDataStream &operator>>( QDataStream &s, KeyList &k) /*! - Constructs a DataElem. This function needs a container because the - size, types of keys and primary key are all defined by the containing - database + Constructs a DataElem. This function needs a container because the + size, types of keys and primary key are all defined by the containing + database */ DataElem::DataElem(DBStore *c) : values(20) { @@ -1086,7 +1085,7 @@ QDataStream &operator>>( QDataStream &s, DataElem &d) s >> size; /* redundent data but makes streaming easier */ if (size != d.getNumFields()) { - owarn << "DataSize mis-match" << oendl; + owarn << "DataSize mis-match" << oendl; return s; /* sanity check failed.. don't load */ } @@ -1109,37 +1108,37 @@ KeyList DataElem::getKeys() const return *(contained->getKeys()); } -/*! +/*! This function determines whether field index i of the element has been set yet. - \return A boolean value that is TRUE if the specfied field of this - element has been set and FALSE if the field has not yet been set + \return A boolean value that is TRUE if the specfied field of this + element has been set and FALSE if the field has not yet been set */ bool DataElem::hasValidValue(int i) const { if(!values.find(i)) return FALSE; - if(!contained->getKeys()->validIndex(i)) + if(!contained->getKeys()->validIndex(i)) return FALSE; return values.find(i)->isValid(); } -/*! +/*! This function determines whether field name qs of the element has been set yet. - \return A boolean value that is TRUE if the specfied field of this - element has been set and FALSE if the field has not yet been set + \return A boolean value that is TRUE if the specfied field of this + element has been set and FALSE if the field has not yet been set */ -bool DataElem::hasValidValue(QString qs) const +bool DataElem::hasValidValue(QString qs) const { int i = contained->getKeyIndex(qs); return hasValidValue(i); } /*! returns the type of the field specified by index i */ -TVVariant::KeyType DataElem::getFieldType(int i) const +TVVariant::KeyType DataElem::getFieldType(int i) const { return contained->getKeyType(i); } @@ -1151,9 +1150,9 @@ TVVariant::KeyType DataElem::getFieldType(QString qs) const return contained->getKeyType(i); } -/*! - returns a pointer to the data stored in field index i for this - data element, (value may not be valid) +/*! + returns a pointer to the data stored in field index i for this + data element, (value may not be valid) */ TVVariant DataElem::getField(int i) const { @@ -1162,9 +1161,9 @@ TVVariant DataElem::getField(int i) const return TVVariant(); } -/*! - returns a pointer to the data stored in field name qs for this - data element, (value may not be valid) +/*! + returns a pointer to the data stored in field name qs for this + data element, (value may not be valid) */ TVVariant DataElem::getField(QString qs) const { @@ -1179,7 +1178,7 @@ TVVariant DataElem::getField(QString qs) const \param i index of the field to set \param q a string that can be parsed to get the value to be set */ -void DataElem::setField(int i, QString q) +void DataElem::setField(int i, QString q) { /* from the type of the field, parse q and store */ TVVariant::KeyType kt = contained->getKeyType(i); @@ -1208,9 +1207,7 @@ void DataElem::setField(int i, QString q) return; } default: - qWarning( - QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q) - ); + owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl; } } @@ -1219,9 +1216,9 @@ void DataElem::setField(int i, QString q) value. \param i index of the field to set - \param value a pointer to the (already allocated) value to set + \param value a pointer to the (already allocated) value to set */ -void DataElem::setField(int i, TVVariant value) +void DataElem::setField(int i, TVVariant value) { if (value.isValid()) { values.remove(i); @@ -1236,7 +1233,7 @@ void DataElem::setField(int i, TVVariant value) \param qs name of the field to set \param q a string that can be parsed to get the value to be set */ -void DataElem::setField(QString qs, QString q) +void DataElem::setField(QString qs, QString q) { /* from the type of the field, parse q and store */ int i = contained->getKeyIndex(qs); @@ -1248,7 +1245,7 @@ void DataElem::setField(QString qs, QString q) value. \param qs name of the field to set - \param value a pointer to the (already allocated) value to set + \param value a pointer to the (already allocated) value to set */ void DataElem::setField(QString qs, TVVariant value) { @@ -1267,7 +1264,7 @@ void DataElem::unsetField(QString qs) } /*! - Converts the data element to a Rich Text QString + Converts the data element to a Rich Text QString */ QString DataElem::toQString() const { @@ -1290,7 +1287,7 @@ QString DataElem::toQString() const } /*! formats individual fields to strings so can be displayed */ -QString DataElem::toQString(int i) const +QString DataElem::toQString(int i) const { if(hasValidValue(i)) { return getField(i).toString(); @@ -1298,7 +1295,7 @@ QString DataElem::toQString(int i) const return ""; } /*! formats individual fields to strings so can be sorted by QListView */ -QString DataElem::toSortableQString(int i) const +QString DataElem::toSortableQString(int i) const { QString scratch = ""; if(hasValidValue(i)) { @@ -1313,13 +1310,13 @@ QString DataElem::toSortableQString(int i) const } case TVVariant::Date: { static QDate epochD(1800, 1, 1); - scratch.sprintf("%08d", + scratch.sprintf("%08d", epochD.daysTo(getField(i).toDate())); break; } case TVVariant::Time: { static QTime epochT(0, 0, 0); - scratch.sprintf("%08d", + scratch.sprintf("%08d", epochT.msecsTo(getField(i).toTime())); break; } @@ -1380,12 +1377,12 @@ bool DataElem::contains(int i, TVVariant v) const /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: break; default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } @@ -1406,12 +1403,12 @@ bool DataElem::startsWith(int i, TVVariant v) const /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: return FALSE; default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } @@ -1432,12 +1429,12 @@ bool DataElem::endsWith(int i, TVVariant v) const /* meaningless for ints */ /* meaningless for time */ /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: case TVVariant::Date: return FALSE; default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } return FALSE; } @@ -1446,9 +1443,9 @@ bool DataElem::endsWith(int i, TVVariant v) const Determins which of the first to parameters are closer to the third, target parameter. - \return + \return
    -
  • TRUE if the first element is a closer match to the target than the +
  • TRUE if the first element is a closer match to the target than the second element
  • FALSE if the first element is not a closer match to the target than the second element
  • @@ -1456,7 +1453,7 @@ bool DataElem::endsWith(int i, TVVariant v) const */ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) { - int type; + int type; if(!d1) return FALSE; @@ -1469,10 +1466,10 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) if(d2) { if (type != d2->getField(column).type()) { /* can't do compare */ - owarn << "Tried to compare two incompatable types" << oendl; + owarn << "Tried to compare two incompatable types" << oendl; return FALSE; } return target.closer(d1->getField(column), d2->getField(column)); - } + } return target.close(d1->getField(column)); } diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp index 6380e1b..de57961 100644 --- a/noncore/apps/tableviewer/db/datacache.cpp +++ b/noncore/apps/tableviewer/db/datacache.cpp @@ -16,7 +16,7 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ +**********************************************************************/ /* * This file is used to load the xml files that represent the database. * The main requirment for said file is each data entry must contain a key, @@ -63,10 +63,10 @@ DBStore::DBStore() archive = 0; } -//TODO +//TODO /*! - Reinitializes the table to empty (include a resize of the master table, - which should free some memory) + Reinitializes the table to empty (include a resize of the master table, + which should free some memory) */ void DBStore::freeTable() { @@ -93,7 +93,7 @@ DBStore::~DBStore() } /*! - This function opens the given xml file, loads it and sets up the + This function opens the given xml file, loads it and sets up the appropriate data structures. \param file_name A string representing the name of the file to be opened @@ -101,7 +101,7 @@ DBStore::~DBStore() */ bool DBStore::openSource(QIODevice *inDev, const QString &source) { - /* first check if db is already open, if contains data.. then clear */ + /* first check if db is already open, if contains data.. then clear */ if(number_elems > 0) { freeTable(); } @@ -109,23 +109,23 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) { if (source == "text/x-xml-tableviewer") { archive = new DBXml(this); } else if (source == "text/csv") { - archive = new DBCsv(this); + archive = new DBCsv(this); } else - return false; + return false; return (archive->openSource(inDev)); } -bool DBStore::saveSource(QIODevice *outDev, const QString &source) +bool DBStore::saveSource(QIODevice *outDev, const QString &source) { /* saving a new file */ if(!archive) { if (source == "text/x-xml-tableviewer") { archive = new DBXml(this); - } else if (source == "text/x-xml-tableviewer") { + } else if (source == "text/x-xml-tableviewer") { archive = new DBCsv(this); } else - return false; + return false; } /* changing file type */ @@ -133,16 +133,16 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) delete archive; if (source == "text/x-xml-tableviewer") { archive = new DBXml(this); - } else if (source == "text/x-xml-tableviewer") { + } else if (source == "text/x-xml-tableviewer") { archive = new DBCsv(this); - } else - return false; + } else + return false; } return (archive->saveSource(outDev)); } -/*! +/*! This function is used to add new elements to the database. If the database has already reached the maximum allowable size this function does not alter the database. @@ -156,9 +156,9 @@ void DBStore::addItem(DataElem *delem) void DBStore::addItemInternal(DataElem *delem) { - /* if already full, don't over fill, do a qWarning though */ + /* if already full, don't over fill, do a owarn though */ if (full) { - owarn << "Attempted to add items to already full table" << oendl; + owarn << "Attempted to add items to already full table" << oendl; return; } @@ -185,13 +185,13 @@ void DBStore::addItemInternal(DataElem *delem) void DBStore::removeItem(DataElem *r) { int position = master_table.findRef(r); - if(position != -1) { - /* there is at least one item, this is it */ - /* replace this with the last element, decrease the element count */ - master_table.insert(position, master_table.at(--number_elems)); - master_table.remove(number_elems); - delete r; - } + if(position != -1) { + /* there is at least one item, this is it */ + /* replace this with the last element, decrease the element count */ + master_table.insert(position, master_table.at(--number_elems)); + master_table.remove(number_elems); + delete r; + } } /*! @@ -201,7 +201,7 @@ void DBStore::removeItem(DataElem *r) */ void DBStore::setName(const QString &n) { - name = n; + name = n; } /*! @@ -211,11 +211,11 @@ void DBStore::setName(const QString &n) */ QString DBStore::getName() { - return name; + return name; } /*! - Retrieves a pointer to the key representation of the database for + Retrieves a pointer to the key representation of the database for other classes to use as reference. \return a pointer to the databases key representaion @@ -235,7 +235,7 @@ void DBStore::setKeys(KeyList *k) } /*! - Sets the current element to the first element of the database + Sets the current element to the first element of the database */ void DBStore::first() { @@ -243,7 +243,7 @@ void DBStore::first() } /*! - Sets the current element to the last element of the database + Sets the current element to the last element of the database */ void DBStore::last() { @@ -257,7 +257,7 @@ void DBStore::last() bool DBStore::next() { unsigned int new_current_elem = current_elem + 1; - if (current_elem < number_elems) + if (current_elem < number_elems) /* was valid before inc (it is possible but unlikely that inc current elem will change it from invalid to valid) */ if (new_current_elem < number_elems) { @@ -278,7 +278,7 @@ bool DBStore::previous() if (current_elem < number_elems) /* was valid */ if (new_current_elem < number_elems) { - /* still is (if was 0, then now -1, but as is unsigned will wrap + /* still is (if was 0, then now -1, but as is unsigned will wrap and hence be invalid */ current_elem = new_current_elem; return true; @@ -288,14 +288,14 @@ bool DBStore::previous() /*! Returns the current data element in the database. Which element is current - is affected by newly added items, findItem, next, previous, first and + is affected by newly added items, findItem, next, previous, first and last functions \return a pointer to the current data element */ -DataElem *DBStore::getCurrentData() +DataElem *DBStore::getCurrentData() { - if (current_elem >= number_elems) + if (current_elem >= number_elems) return NULL; return master_table[current_elem]; } diff --git a/noncore/apps/tableviewer/db/datacache.h b/noncore/apps/tableviewer/db/datacache.h index c5dc637..e38050c 100644 --- a/noncore/apps/tableviewer/db/datacache.h +++ b/noncore/apps/tableviewer/db/datacache.h @@ -27,9 +27,15 @@ #ifndef __DATACACHE_H__ #define __DATACACHE_H__ +#include "common.h" + +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include #include -#include "common.h" class DBStore; @@ -45,12 +51,12 @@ public: } virtual bool openSource(QIODevice *) { - qWarning("DBAccess::openSource not yet implemented"); + owarn << "DBAccess::openSource not yet implemented" << oendl; return false; } virtual bool saveSource(QIODevice *) { - qWarning("DBAccess::saveSource(QString) not yet implemented"); + owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl; return false; } @@ -70,7 +76,7 @@ public: // Add an item void addItem(DataElem *); void addItemInternal(DataElem *); - void removeItem(DataElem *); + void removeItem(DataElem *); // Set the name of the database void setName(const QString &name); @@ -106,15 +112,15 @@ public: void first(); void last(); - bool next(); - bool previous(); + bool next(); + bool previous(); - DataElem* getCurrentData(); + DataElem* getCurrentData(); private: /* does the work of freeing used memory */ void freeTable(); - QString name; + QString name; QVector master_table; DBAccess *archive; @@ -123,7 +129,7 @@ private: unsigned int number_elems; unsigned int table_size; /* should always be a power of 2 */ - bool full; /* since because we are using an int for indexing there is + bool full; /* since because we are using an int for indexing there is an upper limit on the number of items we can store. */ unsigned int current_elem; }; diff --git a/noncore/apps/tableviewer/ui/browsekeyentry.cpp b/noncore/apps/tableviewer/ui/browsekeyentry.cpp index 42e24dd..6b78437 100644 --- a/noncore/apps/tableviewer/ui/browsekeyentry.cpp +++ b/noncore/apps/tableviewer/ui/browsekeyentry.cpp @@ -16,10 +16,13 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ +**********************************************************************/ #include "browsekeyentry.h" #include "commonwidgets.h" +#include +using namespace Opie::Core; + #include #include #include @@ -29,9 +32,6 @@ #include #include -#include -// For qWarning(const char *) - /*! \class TVBrowseKeyEntry \brief a Widget used enter keys into the TVBrowseViewWidget @@ -42,7 +42,7 @@ */ /*! - Constructs the widget + Constructs the widget */ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) : QWidget(parent, name, f) @@ -73,36 +73,36 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) ws->addWidget(dateKey, TVVariant::Date); ws->raiseWidget(TVVariant::String); - + // TODO connect slots and signals.... - connect(changeKeyButton, SIGNAL(clicked()), + connect(changeKeyButton, SIGNAL(clicked()), this, SLOT(changeKeyMenuSlot())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), textKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), intKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), dateKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), timeKey, SLOT(clear())); h_layout->addWidget(ws); h_layout->addWidget(resetButton); h_layout->addWidget(changeKeyButton); - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(intKey, SIGNAL(valueChanged(int)), + connect(intKey, SIGNAL(valueChanged(int)), this, SLOT(searchOnText())); - connect(dateKey, SIGNAL(valueChanged(const QDate&)), + connect(dateKey, SIGNAL(valueChanged(const QDate&)), this, SLOT(searchOnText())); - connect(timeKey, SIGNAL(valueChanged(const QTime&)), + connect(timeKey, SIGNAL(valueChanged(const QTime&)), this, SLOT(searchOnText())); } /*! - Destructs the widget + Destructs the widget */ TVBrowseKeyEntry::~TVBrowseKeyEntry() { @@ -126,7 +126,7 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param) */ void TVBrowseKeyEntry::changeKeyMenuSlot() { - if(ts) + if(ts) keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); } @@ -146,7 +146,7 @@ void TVBrowseKeyEntry::rebuildKeys() { KeyListIterator it(*ts->kRep); for (i = 0; i < ts->kRep->getNumFields(); i++) { - keyMenu->insertItem(it.current()->name(), this, + keyMenu->insertItem(it.current()->name(), this, SLOT(changeKeySlot(int)), 0, i); keyMenu->setItemParameter(i, it.currentKey()); ++it; @@ -163,8 +163,8 @@ void TVBrowseKeyEntry::reset() keyMenu->clear(); } /*! - Searches on the current value of the key entry provided that the - current key is of type text WARNING, TODO fix memory leaks + Searches on the current value of the key entry provided that the + current key is of type text WARNING, TODO fix memory leaks */ void TVBrowseKeyEntry::searchOnText() { @@ -189,11 +189,10 @@ void TVBrowseKeyEntry::searchOnText() sendkey = TVVariant(QDate(dateKey->date())); break; } - case TVVariant::Invalid: - break; + case TVVariant::Invalid: + break; default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; } emit searchOnKey(ts->current_column, sendkey); @@ -203,4 +202,4 @@ void TVBrowseKeyEntry::searchOnText() This signal indicates that a search on key index currentKeyId should be done searching for the value v. -*/ +*/ diff --git a/noncore/apps/tableviewer/ui/filterkeyentry.cpp b/noncore/apps/tableviewer/ui/filterkeyentry.cpp index d108fbd..4d74d6b 100644 --- a/noncore/apps/tableviewer/ui/filterkeyentry.cpp +++ b/noncore/apps/tableviewer/ui/filterkeyentry.cpp @@ -16,10 +16,15 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** -**********************************************************************/ +**********************************************************************/ #include "filterkeyentry.h" #include "commonwidgets.h" +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include #include #include @@ -98,13 +103,13 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f) ws->addWidget(dateEntry, TVVariant::Date); /* connect the signals down */ - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SIGNAL(valueChanged())); - connect(intKey, SIGNAL(valueChanged(int)), + connect(intKey, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged())); - connect(dateKey, SIGNAL(valueChanged(const QDate&)), + connect(dateKey, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(valueChanged())); - connect(timeKey, SIGNAL(valueChanged(const QTime&)), + connect(timeKey, SIGNAL(valueChanged(const QTime&)), this, SIGNAL(valueChanged())); connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); @@ -119,13 +124,13 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f) } /*! - Destructs the widget + Destructs the widget */ TVFilterKeyEntry::~TVFilterKeyEntry() { } -void TVFilterKeyEntry::setKey(int i) +void TVFilterKeyEntry::setKey(int i) { if (!ts) return; @@ -183,25 +188,24 @@ TVVariant TVFilterKeyEntry::getCompareValue() int tmp; switch(current_type) { - case TVVariant::String: - sendkey = TVVariant(QString(textKey->text())); - break; - case TVVariant::Int: { + case TVVariant::String: + sendkey = TVVariant(QString(textKey->text())); + break; + case TVVariant::Int: { sendkey = TVVariant(intKey->value()); - break; - } + break; + } case TVVariant::Time: { - sendkey = TVVariant(QTime(timeKey->time())); - break; + sendkey = TVVariant(QTime(timeKey->time())); + break; } case TVVariant::Date: { - sendkey = TVVariant(QDate(dateKey->date())); - break; + sendkey = TVVariant(QDate(dateKey->date())); + break; } default: { sendkey = TVVariant(0); - qWarning("TVFilterKeyEntry::getCompareValue() " - "cannot work out data type"); + owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl; } } return sendkey; diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp index 22f1fb7..198c8b5 100644 --- a/noncore/apps/tableviewer/ui/tvfilterview.cpp +++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp @@ -18,6 +18,13 @@ ** **********************************************************************/ #include "tvfilterview.h" + +/* OPIE */ +#include +#include +using namespace Opie::Core; + +/* QT */ #include #include #include @@ -26,13 +33,12 @@ #include #include -#include TVFilterView::TVFilterView(TableState *t, QWidget* parent, const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) { - if ( !name ) - setName( "Filter View" ); + if ( !name ) + setName( "Filter View" ); QVBoxLayout *vlayout = new QVBoxLayout(this); @@ -88,8 +94,8 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); - connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, - SLOT(setTerm(QListViewItem*))); + connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, + SLOT(setTerm(QListViewItem*))); ts = t; current = 0; @@ -102,7 +108,7 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, } /*! - Destroys the TVFilterView widget + Destroys the TVFilterView widget */ TVFilterView::~TVFilterView() { @@ -118,26 +124,26 @@ void TVFilterView::reset() keyIds.clear(); } -void TVFilterView::rebuildKeys() +void TVFilterView::rebuildKeys() { int i; if (!ts) return; if(!ts->kRep) return; keyEntry->setTableState(ts); - + /* set up the list of keys that can be compared on */ keyNameCombo->clear(); KeyListIterator it(*ts->kRep); i = 0; while(it.current()) { - if(ts->kRep->validIndex(it.currentKey())) { - keyNameCombo->insertItem(it.current()->name()); - keyIds.insert(i, it.currentKey()); - ++i; - } - ++it; + if(ts->kRep->validIndex(it.currentKey())) { + keyNameCombo->insertItem(it.current()->name()); + keyIds.insert(i, it.currentKey()); + ++i; + } + ++it; } } @@ -146,7 +152,7 @@ bool TVFilterView::passesFilter(DataElem *d) { FilterTerm *t; - + for (t = terms.first(); t != 0; t = terms.next() ) { /* check against filter */ switch(t->ct) { @@ -175,8 +181,7 @@ bool TVFilterView::passesFilter(DataElem *d) { return false; break; default: - qWarning("TVFilterView::passesFilter() " - "unrecognized filter type"); + owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl; return false; } } @@ -194,7 +199,7 @@ bool TVFilterView::filterActive() const } /* SLOTS */ -void TVFilterView::newTerm() +void TVFilterView::newTerm() { if (!ts) return; @@ -212,7 +217,7 @@ void TVFilterView::newTerm() keyNameCombo->setEnabled(true); } -void TVFilterView::updateTerm() +void TVFilterView::updateTerm() { FilterTerm *term; /* Read the widget values (keyname, compare type, value) @@ -231,7 +236,7 @@ void TVFilterView::updateTerm() keyEntry->setKey(term->keyIndex); /* so the next two items make sense */ term->ct = keyEntry->getCompareType(), term->value = keyEntry->getCompareValue(); - + keyString = keyNameCombo->currentText(); switch(term->ct) { @@ -260,14 +265,14 @@ void TVFilterView::updateTerm() vString = term->value.toString(); /* remove old view */ - if (term->view) + if (term->view) delete(term->view); term->view = new QListViewItem(display, 0, keyString, cmpString, vString); display->setSelected(term->view, true); } /* deletes current term */ -void TVFilterView::deleteTerm() +void TVFilterView::deleteTerm() { if(!current) return; if (current->view) @@ -284,7 +289,7 @@ void TVFilterView::deleteTerm() } /* clears all terminations */ -void TVFilterView::clearTerms() +void TVFilterView::clearTerms() { while(current) deleteTerm(); @@ -292,7 +297,7 @@ void TVFilterView::clearTerms() void TVFilterView::setTerm(QListViewItem *target) { - /* Iterate through the list to find item with view=target.. + /* Iterate through the list to find item with view=target.. * set as current, delete */ FilterTerm *term = current; @@ -301,6 +306,6 @@ void TVFilterView::setTerm(QListViewItem *target) break; if (!current) { - current = term; + current = term; } } diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp index 782b629..4b8ce78 100644 --- a/noncore/apps/tinykate/libkate/kateconfig.cpp +++ b/noncore/apps/tinykate/libkate/kateconfig.cpp @@ -24,6 +24,7 @@ /* OPIE */ #include #include +using namespace Opie::Core; /* QT */ #include @@ -556,8 +557,7 @@ void KateConfig::write( const QString &fn ) f.close(); // now rename the file... if ( rename( strNewFile, filename ) < 0 ) { - qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), - filename.latin1() ); + owarn << "problem renaming the file " << strNewFile.latin1() << " to " << filename.latin1() << oendl; QFile::remove( strNewFile ); } } diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp index 4fe319b..5f48f77 100644 --- a/noncore/apps/zsafe/main.cpp +++ b/noncore/apps/zsafe/main.cpp @@ -8,11 +8,19 @@ #include "zsafe.h" + +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #ifdef DESKTOP #include #else #include #endif + +/* STD */ #include #include @@ -58,10 +66,10 @@ int main( int argc, char ** argv ) DeskW = atoi(argv[1]); DeskH = atoi(argv[2]); #else - int w, h; - sscanf (argv[1], "%d", &w); - sscanf (argv[2], "%d", &h); - DeskW = w; + int w, h; + sscanf (argv[1], "%d", &w); + sscanf (argv[2], "%d", &h); + DeskW = w; DeskH = h; #endif } @@ -74,19 +82,16 @@ int main( int argc, char ** argv ) DeskW = a.desktop()->width(); DeskH = a.desktop()->height(); - char buf[128]; - sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); - qWarning (buf); + owarn << "Width: " << DeskW << " Height: " << DeskH << oendl; #ifdef JPATCH_HDE // nothings #else - if (DeskW > 240) + if (DeskW > 240) { DeskW -= 20; DeskH += 25; - sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); - qWarning (buf); + owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl; } #endif diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp index ba02a15..7d0b8c2 100644 --- a/noncore/apps/zsafe/zlistview.cpp +++ b/noncore/apps/zsafe/zlistview.cpp @@ -3,9 +3,14 @@ */ #include "zlistview.h" -#include #include "zsafe.h" +/* OPIE */ +//#include + +/* STD */ +#include + ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id) { zs = zsafe; @@ -18,9 +23,7 @@ ZListView::~ZListView() void ZListView::keyPressEvent ( QKeyEvent *e ) { /* - char buf[64]; - sprintf (buf, "key: %d\n", e->key()); - qWarning (buf); + owarn << "key: " << e->key() << oendl; */ switch (e->key()) diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 6ff05ac..ca3ff52 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -881,7 +881,7 @@ void ZSafe::findPwd() name = dialog->NameField->text(); username = dialog->UsernameField->text(); comment = dialog->CommentField->text(); - qWarning (name); + owarn << name << oendl; } else { @@ -927,7 +927,7 @@ void ZSafe::findPwd() i != NULL; i = i->nextSibling()) { - qWarning (i->text(0)); + owarn << i->text(0) << oendl; i->setSelected(FALSE); // step through all subitems @@ -941,7 +941,7 @@ void ZSafe::findPwd() si != NULL; si = si->nextSibling()) { - qWarning (si->text(0)); + owarn << si->text(0) << oendl; if (si->isSelected()) si->setSelected(FALSE); // ListView->repaintItem(si); @@ -958,7 +958,7 @@ void ZSafe::findPwd() if ((n && u && c ) && !found) { - qWarning ("Found"); + owarn << "Found" << oendl; selectedItem = si; si->setSelected(TRUE); ListView->setCurrentItem(si); @@ -1228,8 +1228,7 @@ void ZSafe::removeAsciiFile() QFile f( fn ); if ( !f.remove() ) { - qWarning( QString("Could not remove file %1").arg(fn), - 2000 ); + owarn << "Could not remove file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not remove text file.") ); return; @@ -1278,8 +1277,7 @@ void ZSafe::writeAllEntries() { QFile f( fn ); if ( !f.open( IO_WriteOnly ) ) { - qWarning( QString("Could not write to file %1").arg(fn), - 2000 ); + owarn << "Could not write to file " << fn << oendl; QMessageBox::critical( 0, "ZSafe", QString("Could not export to text file.") ); return; @@ -1322,10 +1320,10 @@ void ZSafe::writeAllEntries() oneEntry += "\""; oneEntry += si->text(5); oneEntry += "\""; - // qWarning (oneEntry); + // owarn << oneEntry << oendl; t << oneEntry << endl; - // qWarning (si->text(0)); + // owarn << si->text(0) << oendl; } } f.close(); @@ -1373,8 +1371,7 @@ void ZSafe::readAllEntries() QFile f( fn ); if ( !f.open( IO_ReadOnly ) ) { - qWarning( QString("Could not read file %1").arg(fn), - 2000 ); + owarn << "Could not read file " << fn << oendl; QMessageBox::critical( 0, "ZSafe", QString("Could not import text file.") ); return; @@ -1403,7 +1400,7 @@ void ZSafe::readAllEntries() } } - qWarning ("ReadAllEntries(): "); + owarn << "ReadAllEntries(): " << oendl; QTextStream t(&f); while ( !t.eof() ) @@ -1554,8 +1551,7 @@ void ZSafe::writeAllEntries() QString fn = filename + ".txt"; QFile f( fn ); if ( !f.open( IO_WriteOnly ) ) { - qWarning( QString("Could not write to file %1").arg(fn), - 2000 ); + owarn << "Could not write to file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not export to text file.") ); return; @@ -1593,10 +1589,10 @@ void ZSafe::writeAllEntries() comment.replace (QRegExp("\n"), "
    "); oneEntry += comment; oneEntry += "\""; - // qWarning (oneEntry); + // owarn << oneEntry << oendl; t << oneEntry << endl; - // qWarning (si->text(0)); + // owarn << si->text(0) << oendl; } } f.close(); @@ -1608,8 +1604,7 @@ void ZSafe::readAllEntries() QFile f( fn ); if ( !f.open( IO_ReadOnly ) ) { - qWarning( QString("Could not read file %1").arg(fn), - 2000 ); + owarn << "Could not read file " << fn << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Could not import text file.") ); return; @@ -1638,7 +1633,7 @@ void ZSafe::readAllEntries() } } - qWarning ("ReadAllEntries(): "); + owarn << "ReadAllEntries(): " << oendl; QTextStream t(&f); while ( !t.eof() ) @@ -1762,7 +1757,7 @@ void ZSafe::readAllEntries() void ZSafe::resume(int) { - qWarning ("Resume"); + owarn << "Resume" << oendl; // hide the main window infoForm->hide(); @@ -1818,7 +1813,7 @@ bool ZSafe::openDocument(const char* _filename, const char* ) getDocPassword(tr("Enter Password")); if (m_password.isEmpty() && validationFlag == 0) { - qWarning ("Wrong password"); + owarn << "Wrong password" << oendl; QMessageBox::critical( 0, tr("ZSafe"), tr("Wrong password.\n\nZSafe will now exit.") ); exitZs (1); @@ -1827,7 +1822,7 @@ bool ZSafe::openDocument(const char* _filename, const char* ) retval = loadInit(_filename, m_password); if (retval != PWERR_GOOD) { - qWarning ("Error loading Document"); + owarn << "Error loading Document" << oendl; return false; } } @@ -2301,7 +2296,7 @@ void ZSafe::setPasswordDialogDone() void ZSafe::getDocPassword(QString title) { -qWarning ("getDocPassword"); + owarn << "getDocPassword" << oendl; // open the 'Password' dialog PasswordForm *dialog = new PasswordForm(this, title, TRUE); newPwdDialog = dialog; @@ -2480,7 +2475,7 @@ int ZSafe::saveFinalize(void) void ZSafe::quitMe () { - qWarning ("QUIT..."); + owarn << "QUIT..." << oendl; if (modified) { @@ -2684,7 +2679,7 @@ void ZSafe::addCategory() category = dialog->CategoryField->currentText(); icon = dialog->IconField->currentText()+".png"; - qWarning (category); + owarn << category << oendl; QListViewItem *li = new ShadedListItem( 1, ListView ); Category *c1 = new Category(); @@ -3192,7 +3187,7 @@ void ZSafe::editCategory() QListViewItem *catItem = cat->getListItem(); if (catItem) { - qWarning (category); + owarn << category << oendl; catItem->setText( 0, tr( category ) ); cat->setCategoryName (tr(category)); @@ -3593,7 +3588,7 @@ void ZSafe::paintEvent( QPaintEvent * ) void ZSafe::resizeEvent ( QResizeEvent * ) { - // qWarning ("resizeEvent"); + // owarn << "resizeEvent" << oendl; #ifndef DESKTOP DeskW = appl->desktop()->width(); DeskH = appl->desktop()->height(); diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp index d61433f..837fcc5 100644 --- a/noncore/comm/keypebble/krfbdecoder.cpp +++ b/noncore/comm/keypebble/krfbdecoder.cpp @@ -25,9 +25,9 @@ const int endianTest = 1; #define Swap32IfLE(l) \ (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ - (((l) & 0x00ff0000) >> 8) | \ - (((l) & 0x0000ff00) << 8) | \ - (((l) & 0x000000ff) << 24)) : (l)) + (((l) & 0x00ff0000) >> 8) | \ + (((l) & 0x0000ff00) << 8) | \ + (((l) & 0x000000ff) << 24)) : (l)) // // The lengths of the messages we need to wait for @@ -140,7 +140,7 @@ void KRFBDecoder::sendClientInit() con->write( &( con->options()->shared ), 1 ); // Wait for server init - owarn << "Waiting for server init" << oendl; + owarn << "Waiting for server init" << oendl; static QString statusMsg = tr( "Waiting for server initialization..." ); emit status( statusMsg ); @@ -152,7 +152,7 @@ void KRFBDecoder::sendClientInit() void KRFBDecoder::gotServerInit() { - owarn << "Got server init" << oendl; + owarn << "Got server init" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); if ( info ) @@ -186,18 +186,17 @@ void KRFBDecoder::gotServerInit() con->read( &(info->nameLength), 4 ); info->nameLength = Swap32IfLE( info->nameLength ); - owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; - qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", - info->bpp, info->depth, info->bigEndian, info->trueColor ); - qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", - info->redMax, info->greenMax, info->blueMax ); - qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", - info->redShift, info->greenShift,info-> blueShift ); + owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; + owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian + << ", True = " << info->trueColor << oendl; + owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl; + owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift + << ", BlueShift = " << info-> blueShift << oendl; buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); // Wait for desktop name - owarn << "Waiting for desktop name" << oendl; + owarn << "Waiting for desktop name" << oendl; static QString statusMsg = tr( "Waiting for desktop name..." ); emit status( statusMsg ); @@ -212,10 +211,10 @@ void KRFBDecoder::gotDesktopName() assert( info ); assert( currentState == AwaitingDesktopName ); - owarn << "Got desktop name" << oendl; + owarn << "Got desktop name" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), - this, SLOT( gotDesktopName() ) ); + this, SLOT( gotDesktopName() ) ); char *buf = new char[ info->nameLength + 1 ]; CHECK_PTR( buf ); @@ -224,7 +223,7 @@ void KRFBDecoder::gotDesktopName() buf[ info->nameLength ] = '\0'; info->name = buf; - owarn << "Desktop: " << info->name.latin1() << "" << oendl; + owarn << "Desktop: " << info->name.latin1() << "" << oendl; delete buf; @@ -264,12 +263,9 @@ void KRFBDecoder::decidePixelFormat() else chosenDepth = bestDepth; - qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \ - "eight bit %d, chosenDepth=%d", - screenDepth, - info->depth, - bestDepth, - con->options()->colors256, chosenDepth ); + owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth + << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256 + << ", chosenDepth=" << chosenDepth << oendl; format->depth = chosenDepth; @@ -376,10 +372,10 @@ void KRFBDecoder::gotUpdateHeader() { assert( currentState == AwaitingUpdate ); - // owarn << "Got update header" << oendl; + // owarn << "Got update header" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), - this, SLOT( gotUpdateHeader() ) ); + this, SLOT( gotUpdateHeader() ) ); CARD8 msgType; con->read( &msgType, 1 ); @@ -411,7 +407,7 @@ void KRFBDecoder::gotUpdateHeader() con->read( &noRects, 2 ); noRects = Swap16IfLE( noRects ); - // owarn << "Expecting " << noRects << " rects" << oendl; + // owarn << "Expecting " << noRects << " rects" << oendl; // Now wait for the data currentState = AwaitingRectHeader; @@ -423,10 +419,10 @@ void KRFBDecoder::gotRectHeader() { assert( currentState == AwaitingRectHeader ); - // owarn << "Got rect header" << oendl; + // owarn << "Got rect header" << oendl; disconnect( con, SIGNAL( gotEnoughData() ), - this, SLOT( gotRectHeader() ) ); + this, SLOT( gotRectHeader() ) ); con->read( &x, 2 ); x = Swap16IfLE( x ); @@ -441,8 +437,8 @@ void KRFBDecoder::gotRectHeader() con->read( &encoding, 4 ); // CARD32 encodingLocal = Swap32IfLE( encoding ); - // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", - // x, y, w, h, encodingLocal ); + // owarn << "Rect: x=" << x << ", y= " << y << ", w=" << w << ", h=" << h + // << ", encoding= " << encodingLocal << oendl; // // Each encoding needs to be handled differently. Some require @@ -451,31 +447,31 @@ void KRFBDecoder::gotRectHeader() // the remote value as is. // if ( encoding == RawEncoding ) { - // owarn << "Raw encoding" << oendl; + // owarn << "Raw encoding" << oendl; handleRawRect(); } else if ( encoding == CopyRectEncoding ) { -// owarn << "CopyRect encoding" << oendl; +// owarn << "CopyRect encoding" << oendl; handleCopyRect(); } else if ( encoding == RreEncoding ) { - owarn << "RRE encoding" << oendl; + owarn << "RRE encoding" << oendl; handleRRERect(); } else if ( encoding == CorreEncoding ) { - owarn << "CoRRE encoding" << oendl; + owarn << "CoRRE encoding" << oendl; handleCoRRERect(); } else if ( encoding == HexTileEncoding ) { - owarn << "HexTile encoding" << oendl; + owarn << "HexTile encoding" << oendl; handleHexTileRect(); } else { int msg = Swap32IfLE( encoding ); QString protocolError = tr( "Protocol Error: An unknown encoding was " - "used by the server %1" ).arg( msg ); + "used by the server %1" ).arg( msg ); currentState = Error; - owarn << "Unknown encoding, " << msg << "" << oendl; + owarn << "Unknown encoding, " << msg << "" << oendl; emit error( protocolError ); return; } @@ -491,7 +487,7 @@ void KRFBDecoder::handleRawRect() // rectanges nicely. The chunking should be based on the // overall size (but has to be in complete lines). - // owarn << "Handling a raw rect chunk" << oendl; + // owarn << "Handling a raw rect chunk" << oendl; // CARD32 lineCount = w * format->bpp / 8; @@ -514,7 +510,7 @@ void KRFBDecoder::getRawRectChunk( int lines ) CARD32 count = lines * w * format->bpp / 8; // Wait for server init - // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; + // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; currentState = AwaitingRawRectChunk; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); @@ -528,7 +524,7 @@ void KRFBDecoder::gotRawRectChunk() disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotRawRectChunk() ) ); - // owarn << "Got raw rect chunk" << oendl; + // owarn << "Got raw rect chunk" << oendl; // // Read the rect data and copy it to the buffer. @@ -551,7 +547,7 @@ void KRFBDecoder::gotRawRectChunk() else { noRects--; - // owarn << "There are " << noRects << " rects left" << oendl; + // owarn << "There are " << noRects << " rects left" << oendl; if ( noRects ) { currentState = AwaitingRectHeader; @@ -595,7 +591,7 @@ void KRFBDecoder::gotCopyRectPos() noRects--; - // owarn << "There are " << noRects << " rects left" << oendl; + // owarn << "There are " << noRects << " rects left" << oendl; if ( noRects ) { currentState = AwaitingRectHeader; @@ -608,17 +604,17 @@ void KRFBDecoder::gotCopyRectPos() void KRFBDecoder::handleRRERect() { - owarn << "RRE not implemented" << oendl; + owarn << "RRE not implemented" << oendl; } void KRFBDecoder::handleCoRRERect() { - owarn << "CoRRE not implemented" << oendl; + owarn << "CoRRE not implemented" << oendl; } void KRFBDecoder::handleHexTileRect() { - owarn << "HexTile not implemented" << oendl; + owarn << "HexTile not implemented" << oendl; } void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) @@ -644,9 +640,9 @@ void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) } } - // HACK: Scaling + // HACK: Scaling CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor ); - CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor ); + CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor ); con->write( &PointerEventId, 1 ); con->write( &buttonMask, 1 ); @@ -678,7 +674,7 @@ void KRFBDecoder::sendCutEvent( const QString &unicode ) void KRFBDecoder::gotServerCut() { - owarn << "Got server cut" << oendl; + owarn << "Got server cut" << oendl; currentState = AwaitingServerCutLength; connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); @@ -726,7 +722,7 @@ void KRFBDecoder::gotServerCutText() /* For some reason QApplication::clipboard()->setText() segfaults when called * from within keypebble's mass of signals and slots - owarn << "Server cut: " << cutbuf << "" << oendl; + owarn << "Server cut: " << cutbuf << "" << oendl; QString cutText( cutbuf ); // DANGER!! qApp->clipboard()->setText( cutText ); @@ -743,14 +739,14 @@ void KRFBDecoder::gotServerCutText() currentState = Idle; } else { - owarn << "Async handled in weird state" << oendl; + owarn << "Async handled in weird state" << oendl; currentState = oldState; }; } void KRFBDecoder::gotBell() { - owarn << "Got server bell" << oendl; + owarn << "Got server bell" << oendl; buf->soundBell(); // Now wait for the update (again) @@ -763,7 +759,7 @@ void KRFBDecoder::gotBell() currentState = Idle; } else { - owarn << "Async handled in weird state" << oendl; + owarn << "Async handled in weird state" << oendl; currentState = oldState; }; } @@ -819,11 +815,11 @@ int KRFBDecoder::toKeySym( QKeyEvent *k ) // Try and map these "other common keys" first. // if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) { - for(int i = 0; keyMap[i].keycode != 0; i++) { - if (k->key() == keyMap[i].keycode) { - return keyMap[i].keysym; - } - } + for(int i = 0; keyMap[i].keycode != 0; i++) { + if (k->key() == keyMap[i].keycode) { + return keyMap[i].keysym; + } + } } // diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index 6c5f5ea..211314b 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp @@ -110,9 +110,9 @@ namespace { } inline QPixmap* IconViewItem::pixmap()const { -// qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", -// rect().x(),rect().y(),rect().width(),rect().height(), -// iconView()->contentsX(), iconView()->contentsY()); +// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y() +// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX() +// << " " << iconView()->contentsY() << oendl; if (textOnly()&&!m_isDir) { if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp index 36e5dcf..aa15d31 100644 --- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp +++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp @@ -1,7 +1,10 @@ #include "viewmodebutton.h" +/* OPIE */ #include +using namespace Opie::Core; +/* QT */ #include #include @@ -40,6 +43,6 @@ void ViewModeButton::slotChange( int i ) { break; } - qWarning("foo %d" +name, i ); + owarn << "foo " << name << oendl; setIconSet( Resource::loadIconSet( name ) ); } diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 04c50d9..f81066e 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc @@ -1,9 +1,14 @@ -#include +#include "device.h" +/* OPIE */ #include +#include +using namespace Opie::Core; + +/* STD */ +#include -#include "device.h" using namespace OpieTooth; @@ -14,10 +19,10 @@ namespace { QString string( par ); QStringList list = QStringList::split( '\n', string ); for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ - qWarning("parsePID: %s", (*it).latin1() ); + owarn << "parsePID: " << (*it).latin1() << oendl; if( !(*it).startsWith("CSR") ){ - id = (*it).toInt(); - break; + id = (*it).toInt(); + break; } } return id; @@ -27,7 +32,7 @@ namespace { Device::Device(const QString &device, const QString &mode, const QString &speed ) : QObject(0, "device") { - qWarning("OpieTooth::Device create" ); + owarn << "OpieTooth::Device create" << oendl; m_hci = 0; m_process = 0; m_attached = false; @@ -40,10 +45,10 @@ Device::~Device(){ detach(); } void Device::attach(){ - qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); + owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl; if(m_process == 0 ){ m_output.resize(0); - qWarning("new process to create" ); + owarn << "new process to create" << oendl; m_process = new OProcess(); *m_process << "hciattach"; *m_process << "-p"; @@ -55,7 +60,7 @@ void Device::attach(){ connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ - qWarning("Could not start" ); + owarn << "Could not start" << oendl; delete m_process; m_process = 0; } @@ -67,10 +72,10 @@ void Device::detach(){ // kill the pid we got if(m_attached ){ //kill the pid - qWarning( "killing" ); + warn << "killing" << oendl; kill(pid, 9); } - qWarning("detached" ); + owarn << "detached" << oendl; } bool Device::isLoaded()const{ return m_attached; @@ -80,52 +85,52 @@ QString Device::devName()const { }; void Device::slotExited( OProcess* proc) { - qWarning("prcess exited" ); + owarn << "prcess exited" << oendl; if(proc== m_process ){ - qWarning("proc == m_process" ); + owarn << "proc == m_process" << oendl; if( m_process->normalExit() ){ // normal exit - qWarning("normalExit" ); + owarn << "normalExit" << oendl; int ret = m_process->exitStatus(); if( ret == 0 ){ // attached - qWarning("attached" ); - qWarning("Output: %s", m_output.data() ); - pid = parsePid( m_output ); - qWarning("Pid = %d", pid ); - // now hciconfig hci0 up ( determine hciX FIXME) - // and call hciconfig hci0 up - // FIXME hardcoded to hci0 now :( - m_hci = new OProcess( ); - *m_hci << "hciconfig"; - *m_hci << "hci0 up"; - connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), + owarn << "attached" << oendl; + owarn << "Output: " << m_output.data() << oendl; + pid = parsePid( m_output ); + owarn << "Pid = " << pid << oendl; + // now hciconfig hci0 up ( determine hciX FIXME) + // and call hciconfig hci0 up + // FIXME hardcoded to hci0 now :( + m_hci = new OProcess( ); + *m_hci << "hciconfig"; + *m_hci << "hci0 up"; + connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); - if(!m_hci->start() ){ - qWarning("could not start" ); - m_attached = false; - emit device("hci0", false ); - } + if(!m_hci->start() ){ + owarn << "could not start" << oendl; + m_attached = false; + emit device("hci0", false ); + } }else{ - qWarning("crass" ); - m_attached = false; - emit device("hci0", false ); + owarn << "crass" << oendl; + m_attached = false; + emit device("hci0", false ); } } delete m_process; m_process = 0; }else if(proc== m_hci ){ - qWarning("M HCI exited" ); + owarn << "M HCI exited" << oendl; if( m_hci->normalExit() ){ - qWarning("normal exit" ); + owarn << "normal exit" << oendl; int ret = m_hci->exitStatus(); if( ret == 0 ){ - qWarning("attached really really attached" ); - m_attached = true; - emit device("hci0", true ); + owarn << "attached really really attached" << oendl; + m_attached = true; + emit device("hci0", true ); }else{ - qWarning( "failed" ); - emit device("hci0", false ); - m_attached = false; + owarn << "failed" << oendl; + emit device("hci0", false ); + m_attached = false; } }// normal exit delete m_hci; @@ -134,19 +139,19 @@ void Device::slotExited( OProcess* proc) } void Device::slotStdOut(OProcess* proc, char* chars, int len) { - qWarning("std out" ); + owarn << "std out" << oendl; if( len <1 ){ - qWarning( "len < 1 " ); + owarn << "len < 1 " << oendl; return; } if(proc == m_process ){ QCString string( chars, len+1 ); // \0 == +1 - qWarning("output: %s", string.data() ); + owarn << "output: " << string.data() << oendl; m_output.append( string.data() ); } } void Device::slotStdErr(OProcess* proc, char* chars, int len) { - qWarning("std err" ); + owarn << "std err" << oendl; slotStdOut( proc, chars, len ); } diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index 18e1df9..76d9127 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc @@ -1,10 +1,11 @@ - -#include - #include "parser.h" #include "manager.h" +#include +#include +using namespace Opie::Core; + using namespace OpieTooth; @@ -12,7 +13,7 @@ using Opie::Core::OProcess; Manager::Manager( const QString& dev ) : QObject() { - qWarning("created"); + owarn << "created" << oendl; m_device = dev; m_hcitool = 0; m_sdp = 0; @@ -57,7 +58,7 @@ void Manager::isAvailable( Device* /*dev*/ ){ } void Manager::searchDevices( const QString& device ){ - qWarning("search devices"); + owarn << "search devices" << oendl; OProcess* hcitool = new OProcess(); hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); *hcitool << "hcitool" << "scan"; @@ -66,7 +67,7 @@ void Manager::searchDevices( const QString& device ){ connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning("could not start"); + owarn << "could not start" << oendl; RemoteDevice::ValueList list; emit foundDevices( device, list ); delete hcitool; @@ -107,13 +108,13 @@ void Manager::searchServices( const QString& remDevice ){ OProcess *m_sdp =new OProcess(); *m_sdp << "sdptool" << "browse" << remDevice; m_sdp->setName( remDevice.latin1() ); - qWarning("search Services for %s", remDevice.latin1() ); + owarn << "search Services for " << remDevice.latin1() << oendl; connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) ); connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) ); if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { - qWarning("could not start sdptool" ); + owarn << "could not start sdptool" << oendl; delete m_sdp; Services::ValueList list; emit foundServices( remDevice, list ); @@ -140,7 +141,7 @@ void Manager::slotProcessExited(OProcess* proc ) { void Manager::slotSDPOut(OProcess* proc, char* ch, int len) { QCString str(ch, len+1 ); - qWarning("SDP:%s", str.data() ); + owarn << "SDP:" << str.data() << oendl; QMap::Iterator it; it = m_out.find(proc->name() ); QString string; @@ -153,12 +154,12 @@ void Manager::slotSDPOut(OProcess* proc, char* ch, int len) } void Manager::slotSDPExited( OProcess* proc) { - qWarning("proc name %s", proc->name() ); + owarn << "proc name " << proc->name() << oendl; Services::ValueList list; if (proc->normalExit() ) { QMap::Iterator it = m_out.find( proc->name() ); if ( it != m_out.end() ) { - qWarning("found process" ); + owarn << "found process" << oendl; list = parseSDPOutput( it.data() ); m_out.remove( it ); } @@ -168,20 +169,20 @@ void Manager::slotSDPExited( OProcess* proc) } Services::ValueList Manager::parseSDPOutput( const QString& out ) { Services::ValueList list; - qWarning("parsing output" ); + owarn << "parsing output" << oendl; Parser parser( out ); list = parser.services(); return list; } void Manager::slotHCIExited(OProcess* proc ) { - qWarning("process exited"); + owarn << "process exited" << oendl; RemoteDevice::ValueList list; if (proc->normalExit() ) { - qWarning("normalExit %s", proc->name() ); + owarn << "normalExit " << proc->name() << oendl; QMap::Iterator it = m_devices.find(proc->name() ); if (it != m_devices.end() ) { - qWarning("!= end ;)"); + owarn << "!= end ;)" << oendl; list = parseHCIOutput( it.data() ); m_devices.remove( it ); } @@ -191,13 +192,13 @@ void Manager::slotHCIExited(OProcess* proc ) { } void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { QCString str( ch, len+1 ); - qWarning("hci: %s", str.data() ); + owarn << "hci: " << str.data() oendl; QMap::Iterator it; it = m_devices.find( proc->name() ); - qWarning("proc->name %s", proc->name() ); + owarn << "proc->name " << proc->name() << oendl; QString string; if (it != m_devices.end() ) { - qWarning("slotHCIOut "); + owarn << "slotHCIOut " << oendl; string = it.data(); } string.append( str ); @@ -205,20 +206,20 @@ void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { m_devices.replace( proc->name(), string ); } RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { - qWarning("parseHCI %s", output.latin1() ); + owarn << "parseHCI " << output.latin1() << oendl; RemoteDevice::ValueList list; QStringList strList = QStringList::split('\n', output ); QStringList::Iterator it; QString str; for ( it = strList.begin(); it != strList.end(); ++it ) { str = (*it).stripWhiteSpace(); - qWarning("OpieTooth %s", str.latin1() ); + owarn << "OpieTooth " << str.latin1() << oendl; int pos = str.findRev(':' ); if ( pos > 0 ) { QString mac = str.left(17 ); str.remove( 0, 17 ); - qWarning("mac %s", mac.latin1() ); - qWarning("rest:%s", str.latin1() ); + owarn << "mac " << mac.latin1() << oendl; + owarn << "rest: " << str.latin1() << oendl; RemoteDevice rem( mac , str.stripWhiteSpace() ); list.append( rem ); } @@ -243,7 +244,7 @@ void Manager::connectTo( const QString& mac) { void Manager::searchConnections() { - qWarning("searching connections?"); + owarn << "searching connections?" << oendl; OProcess* proc = new OProcess(); m_hcitoolCon = QString::null; @@ -281,15 +282,15 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) { for (; it != list.end(); ++it ) { QString row = (*it).stripWhiteSpace(); QStringList value = QStringList::split(' ', row ); - qWarning("0: %s", value[0].latin1() ); - qWarning("1: %s", value[1].latin1() ); - qWarning("2: %s", value[2].latin1() ); - qWarning("3: %s", value[3].latin1() ); - qWarning("4: %s", value[4].latin1() ); - qWarning("5: %s", value[5].latin1() ); - qWarning("6: %s", value[6].latin1() ); - qWarning("7: %s", value[7].latin1() ); - qWarning("8: %s", value[8].latin1() ); + owan << "0: %s" << value[0].latin1() << oendl; + owan << "1: %s" << value[1].latin1() << oendl; + owan << "2: %s" << value[2].latin1() << oendl; + owan << "3: %s" << value[3].latin1() << oendl; + owan << "4: %s" << value[4].latin1() << oendl; + owan << "5: %s" << value[5].latin1() << oendl; + owan << "6: %s" << value[6].latin1() << oendl; + owan << "7: %s" << value[7].latin1() << oendl; + owan << "8: %s" << value[8].latin1() << oendl; ConnectionState con; con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); con.setConnectionMode( value[1] ); diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 8baf284..7e95907 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc @@ -1,7 +1,13 @@ +#include "parser.h" + +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include -#include "parser.h" using namespace OpieTooth; @@ -13,29 +19,29 @@ namespace { // @eturn 13398 // tactic find " ( int convert( const QString& line, QString& ret ) { -// qWarning("called"); +// owarn << "called" << oendl; ret = QString::null; int i = 0; int pos = line.findRev("\" ("); if ( pos > 0 ) { // it shouldn't be at pos 0 ret = line.left(pos ).stripWhiteSpace(); - // qWarning("ret: %s", ret.latin1() ); + // owarn << "ret: " << ret.latin1() << oendl; ret = ret.replace(QRegExp("[\"]"), ""); - //qWarning("ret: %s", ret.latin1() ); + //owarn << "ret: " << ret.latin1() << oendl; QString dummy = line.mid(pos + 5 ); - //qWarning("dummy: %s", dummy.latin1() ); + //owarn << "dummy: " << dummy.latin1() << oendl; dummy = dummy.replace(QRegExp("[)]"), ""); - //qWarning("dummy: %s", dummy.latin1() ); + //owarn << "dummy: " << dummy.latin1() << oendl; // dummy = dummy.remove( dummy.length() -2, 1 ); // remove the ) bool ok; i = dummy.toInt(&ok, 16 ); //if (ok ) { - // qWarning("converted %d", i); - //}else qWarning("failed" ); - //qWarning("exiting"); + // owarn << "converted " << i << oendl; + //}else owarn << "failed" << oendl; + //owarn << "exiting" << oendl; return i; } - //qWarning("output %d", i ); + //owarn << "output " << i << oendl; return i; } @@ -57,11 +63,11 @@ void Parser::parse( const QString& string) { QStringList list = QStringList::split('\n', string,TRUE ); QStringList::Iterator it; for (it = list.begin(); it != list.end(); ++it ) { - //qWarning("line:%s:line", (*it).latin1() ); + //owarn << "line:" << (*it).latin1() << oendl; if ( (*it).startsWith("Browsing") ) continue; if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins - qWarning("could add"); + owarn << "could add" << oendl; // now see if complete and add if (m_complete ) { if (!m_item.serviceName().isEmpty() ) @@ -80,22 +86,22 @@ void Parser::parse( const QString& string) { } // missed the last one if (m_complete) { -// qWarning("adding"); +// owarn << "adding" << oendl; if (!m_item.serviceName().isEmpty() ) m_list.append(m_item ); } QValueList::Iterator it2; if (m_list.isEmpty() ) - qWarning("m_list is empty"); + owarn << "m_list is empty" << oendl; for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { - qWarning("name %s", (*it2).serviceName().latin1() ); + owarn << "name " << (*it2).serviceName().latin1() << oendl; } } bool Parser::parseName( const QString& str) { if (str.startsWith("Service Name:") ) { m_item.setServiceName( str.mid(13).stripWhiteSpace() ); - qWarning(m_item.serviceName() ); + owarn << m_item.serviceName() << oendl; return true; } return false; @@ -103,13 +109,13 @@ bool Parser::parseName( const QString& str) { bool Parser::parseRecHandle( const QString& str) { if (str.startsWith("Service RecHandle:" ) ) { QString out = str.mid(18 ).stripWhiteSpace(); - qWarning("out %s", out.latin1() ); + owarn << "out " << out.latin1() << oendl; int value = out.mid(2).toInt(&m_ok, 16 ); if (m_ok && (value != -1) ) m_complete = true; else m_complete = false; - qWarning("rec handle %d", value); + owarn << "rec handle " << value << oendl; m_item.setRecHandle( value ); return true; @@ -118,13 +124,13 @@ bool Parser::parseRecHandle( const QString& str) { } bool Parser::parseClassId( const QString& str) { if (str.startsWith("Service Class ID List:") ) { - qWarning("found class id" ); - qWarning("line:%s", str.latin1() ); + owarn << "found class id" << oendl; + owarn << "line: " << str.latin1() << oendl; m_classOver = true; return true; }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place - qWarning("line with class id" ); - qWarning("%s",str.latin1() ); + owarn << "line with class id" << oendl; + owarn << str.latin1() << oendl; // "Obex Object Push" (0x1105) // find backwards the " and the from 0 to pos and the mid pos+1 @@ -133,12 +139,12 @@ bool Parser::parseClassId( const QString& str) { QString classes; int ids; ids = convert( str, classes ); - qWarning("ids %d", ids ); + owarn << "ids " << ids << oendl; m_item.insertClassId( ids, classes ); return true; }else{ - qWarning("Else %d", m_classOver ); + owarn << "Else " << m_classOver << oendl; m_classOver = false; } return false; @@ -150,7 +156,7 @@ bool Parser::parseProtocol( const QString& str) { return true; }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) - qWarning("double protocol filter"); + owarn << "double protocol filter" << oendl; if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now Services::ProtocolDescriptor desc( m_protName, m_protId ); @@ -162,7 +168,7 @@ bool Parser::parseProtocol( const QString& str) { } return true; }else if (m_protocolOver && str.startsWith(" ") ) { - qWarning("tripple protocol filter"); + owarn << "tripple protocol filter" << oendl; m_protocolAdded = true; QString dummy = str.stripWhiteSpace(); int pos = dummy.findRev(':'); @@ -187,7 +193,7 @@ bool Parser::parseProfile( const QString& str) { int pos = str.findRev(':'); if ( pos > 0 ) { int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); - qWarning("dummyInt:%d", dummy ); + owarn << "dummyInt: " << dummy << oendl; Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); m_item.insertProfileDescriptor(desc); } diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc index ab0b3af..0c6cf12 100644 --- a/noncore/settings/mediummount/mediumglobal.cc +++ b/noncore/settings/mediummount/mediumglobal.cc @@ -1,5 +1,12 @@ +#include "mediumglobal.h" + +/* OPIE */ +#include +using namespace Opie::Core; +#include +/* QT */ #include #include #include @@ -9,9 +16,7 @@ #include #include -#include -#include "mediumglobal.h" using namespace MediumMountSetting; @@ -152,7 +157,7 @@ void MediumGlobalWidget::slotGlobalChanged() mode = GLOBAL_ENABLED; }else mode = GLOBAL_DISABLED; - qWarning("enabled = %d", enabled ); + owarn << "enabled = " << enabled << oendl; m_all->setEnabled ( enabled ); m_audio->setEnabled( enabled ); m_image->setEnabled( enabled ); diff --git a/noncore/styles/theme/othemebase.h b/noncore/styles/theme/othemebase.h index e691692..5519798 100644 --- a/noncore/styles/theme/othemebase.h +++ b/noncore/styles/theme/othemebase.h @@ -18,6 +18,11 @@ #ifndef __OTHEMEBASE_H #define __OTHEMEBASE_H +/* OPIE */ +#include +using namespace Opie::Core; + +/* QT */ #include #include #include @@ -39,48 +44,48 @@ class OThemePixmap : public QPixmap { public: - enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, - BottomRight}; - - OThemePixmap( bool timer = true ); - OThemePixmap( const OThemePixmap &p ); - ~OThemePixmap(); - QPixmap* border( BorderType type ); - void setBorder( BorderType type, const QPixmap &p ); - void updateAccessed(); - bool isOld(); + enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, + BottomRight}; + + OThemePixmap( bool timer = true ); + OThemePixmap( const OThemePixmap &p ); + ~OThemePixmap(); + QPixmap* border( BorderType type ); + void setBorder( BorderType type, const QPixmap &p ); + void updateAccessed(); + bool isOld(); protected: - QTime *t; - QPixmap *b[ 8 ]; + QTime *t; + QPixmap *b[ 8 ]; private: - class OThemePixmapPrivate; - OThemePixmapPrivate *d; + class OThemePixmapPrivate; + OThemePixmapPrivate *d; }; inline QPixmap* OThemePixmap::border( BorderType type ) { - return ( b[ type ] ); + return ( b[ type ] ); } inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p ) { - if ( b[ type ] ) { - qWarning( "OThemePixmap: Overwriting existing border!" ); - delete( b[ type ] ); - } - b[ type ] = new QPixmap( p ); + if ( b[ type ] ) { + owarn << "OThemePixmap: Overwriting existing border!" << oendl; + delete( b[ type ] ); + } + b[ type ] = new QPixmap( p ); } inline void OThemePixmap::updateAccessed() { - if (t) - t->start(); + if (t) + t->start(); } inline bool OThemePixmap::isOld() { - return ( t ? t->elapsed() >= 300000 : false ); + return ( t ? t->elapsed() >= 300000 : false ); } /** @@ -106,72 +111,72 @@ inline bool OThemePixmap::isOld() */ class OThemeCache : public QObject { - Q_OBJECT + Q_OBJECT public: - /** - * The scale hints supported by the cache. Note that Tiled is not here - * since tiled pixmaps are kept only once in OThemeBase. - */ - enum ScaleHint{FullScale, HorizontalScale, VerticalScale}; - /** - * The constructor. - * - * @param maxSize The maximum size of the cache in kilobytes. - */ - OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 ); - /** - * Inserts a new pixmap into the cache. - * - * @param pixmap The pixmap to insert. - * @param scale The scaling type of the pixmap. - * @param widgetID The widget ID of the pixmap, usually from OThemeBase's - * WidgetType enum. - * - * @return True if the insert was successful, false otherwise. - */ - bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID, - bool border = false, bool mask = false ); - /** - * Returns a fully scaled pixmap. - * - * @param w The pixmap width to search for. - * @param h The pixmap height to search for. - * @param widgetID The widget ID to search for. - * - * @return True if a pixmap matching the width, height, and widget ID of - * the pixmap exists, NULL otherwise. - */ - OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false, - bool mask = false ); - /** - * Returns a horizontally scaled pixmap. - * - * @param w The pixmap width to search for. - * @param widgetID The widget ID to search for. - * - * @return True if a pixmap matching the width and widget ID of - * the pixmap exists, NULL otherwise. - */ - OThemePixmap* horizontalPixmap( int w, int widgetID ); - /** - * Returns a vertically scaled pixmap. - * - * @param h The pixmap height to search for. - * @param widgetID The widget ID to search for. - * - * @return True if a pixmap matching the height and widget ID of - * the pixmap exists, NULL otherwise. - */ - OThemePixmap* verticalPixmap( int h, int widgetID ); + /** + * The scale hints supported by the cache. Note that Tiled is not here + * since tiled pixmaps are kept only once in OThemeBase. + */ + enum ScaleHint{FullScale, HorizontalScale, VerticalScale}; + /** + * The constructor. + * + * @param maxSize The maximum size of the cache in kilobytes. + */ + OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 ); + /** + * Inserts a new pixmap into the cache. + * + * @param pixmap The pixmap to insert. + * @param scale The scaling type of the pixmap. + * @param widgetID The widget ID of the pixmap, usually from OThemeBase's + * WidgetType enum. + * + * @return True if the insert was successful, false otherwise. + */ + bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID, + bool border = false, bool mask = false ); + /** + * Returns a fully scaled pixmap. + * + * @param w The pixmap width to search for. + * @param h The pixmap height to search for. + * @param widgetID The widget ID to search for. + * + * @return True if a pixmap matching the width, height, and widget ID of + * the pixmap exists, NULL otherwise. + */ + OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false, + bool mask = false ); + /** + * Returns a horizontally scaled pixmap. + * + * @param w The pixmap width to search for. + * @param widgetID The widget ID to search for. + * + * @return True if a pixmap matching the width and widget ID of + * the pixmap exists, NULL otherwise. + */ + OThemePixmap* horizontalPixmap( int w, int widgetID ); + /** + * Returns a vertically scaled pixmap. + * + * @param h The pixmap height to search for. + * @param widgetID The widget ID to search for. + * + * @return True if a pixmap matching the height and widget ID of + * the pixmap exists, NULL otherwise. + */ + OThemePixmap* verticalPixmap( int h, int widgetID ); protected slots: - void flushTimeout(); + void flushTimeout(); protected: - QIntCache cache; - QTimer flushTimer; + QIntCache cache; + QTimer flushTimer; private: - class OThemeCachePrivate; - OThemeCachePrivate *d; + class OThemeCachePrivate; + OThemeCachePrivate *d; }; @@ -189,551 +194,551 @@ private: */ class OThemeBase: public QWindowsStyle { - Q_OBJECT + Q_OBJECT public: - /** - * Constructs a new OThemeBase object. - */ - OThemeBase( const QString &configFile ); - ~OThemeBase(); - /** - * Describes if a pixmap should be scaled fully, horizontally, vertically, - * or not at all and tiled. - */ - enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale}; - /** - * The default arrow types. - */ - enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow}; - /** - * The default frame shading styles. - */ - enum ShadeStyle{Motif, Windows, Next, KDE}; - /** - * The default scrollbar button layout. BottomLeft is like what Next - * uses, BottomRight is like Platinum, and Opposite it like Windows and - * Motif. - */ - enum SButton{SBBottomLeft, SBBottomRight, SBOpposite}; - /** - * The gradient types. Horizontal is left to right, Vertical is top to - * bottom, and diagonal is upper-left to bottom-right. - */ - enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, - GrRectangle, GrElliptic, GrReverseBevel}; - /** - * This provides a list of widget types that OThemeBase recognizes. - */ - /* Internal note: The order here is important. Some widgets inherit - * properties. This is usually for when you have two settings for the - * same widget, ie: on(sunken), and off. The on settings will inherit - * the properties of the off one when nothing is specified in the config. - * - * In order to be able to handle this while still having everything in - * one group that is easy to loop from we have the following order: - * unsunked(off) items, sunken(on)items, and then the ones that don't - * matter. INHERIT_ITEMS define the number of widgets that have inheritence - * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn - * and so on. WIDGETS define the total number of widgets. - */ - enum WidgetType{ - // Off (unsunken widgets) - PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, - ToolButton, ScrollButton, HScrollDeco, VScrollDeco, - ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, - ArrowRight, - // On (sunken widgets) - PushButtonDown, ComboBoxDown, HScrollBarSliderDown, - VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, - HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, - ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, - SunkenArrowRight, - // Everything else (indicators must have separate settings) - HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, - IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, - ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, - DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, - Background}; - - /** - * The scaling type specified by the Config file. - * - * @param widget A Widgets enum value. - * - * @return A ScaleHint enum value. - */ - ScaleHint scaleHint( WidgetType widget ) const; - /** - * The gradient type specified by the KConfig file. - * - * @param widget A Widgets enum value. - * - * @return A Gradient enum value. - */ - Gradient gradientHint( WidgetType widget ) const; - /** - * The color group specified for a given widget. - * If a color group is set in the theme configuration - * that is used, otherwise defaultColor is returned. - * - * @param defaultColor The colorGroup to set if one is available. - * - * @param widget The widget whose color group to retrieve. - * - */ - const QColorGroup* colorGroup( const QColorGroup &defaultGroup, - WidgetType widget ) const; - - QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role, - int w, int h, WidgetType widget ); - /** - * True if the widget has a pixmap or gradient specified. - */ - bool isPixmap( WidgetType widget ) const; - /** - * True if the widget has a color group specified. - */ - bool isColor( WidgetType widget ) const; - /** - * True if the user specified a 3D focus rectangle - */ - bool is3DFocus() const; - /** - * If the user specified a 3D focus rectangle, they may also specify an - * offset from the default rectangle to use when drawing it. This returns - * the specified offset. - */ - int focusOffset() const; - /** - * The border width of the specified widget. - */ - int borderWidth( WidgetType widget ) const; - /** - * Pixmap border width of the specified widget. - */ - int pixBorderWidth( WidgetType widget ) const; - /** - * Returns the border pixmap if enabled for the specified widget. This - * will contain the originial pixmap, plus the edges separated in - * OThemePixmap::border() if valid. If invalid it will return NULL. - */ - OThemePixmap* borderPixmap( WidgetType widget ); - /** - * The highlight width of the specified widget. - */ - int highlightWidth( WidgetType widget ) const; - /** - * The border plus highlight width of the widget. - */ - int decoWidth( WidgetType widget ) const; - /** - * The extent (width for vertical, height for horizontal) requested - * for the scrollbars. - */ - int getSBExtent() const; - /** - * The scrollbar button layout. - */ - SButton scrollBarLayout() const; - /** - * The arrow type. - */ - ArrowStyle arrowType() const; - /** - * The shading type. - */ - ShadeStyle shade() const; - /** - * The frame width. - */ - int frameWidth() const; - /** - * The splitter width. - */ - int splitWidth() const; - /** - * The contrast for some bevel effects such as reverse gradient. - */ - int bevelContrast( WidgetType widget ) const; - /** - * The button text X shift. - */ - int buttonXShift() const; - /** - * The button text Y shift. - */ - int buttonYShift() const; - /** - * Returns either the slider length of the slider pixmap if available, - * otherwise the length specified in the config file. - */ - int sliderButtonLength() const; - /** - * True if rounded buttons are requested. - */ - bool roundButton() const; - /** - * True if rounded comboboxes are requested. - */ - bool roundComboBox() const; - /** - * True if rounded slider grooves are requested. - */ - bool roundSlider() const; - /** - * True if a line should be drawn on the bottom of active tabs. - */ - bool activeTabLine() const; - /** - * True if a line should be drawn on the bottom of inactive tabs. - */ - bool inactiveTabLine() const; - /** - * Returns the current uncached pixmap for the given widget. This will - * usually be either the last scaled or gradient pixmap if those have - * been specified in the config file, the original pixmap if not, or NULL - * if no pixmap has been specified. - */ - OThemePixmap* uncached( WidgetType widget ) const; - /** - * Returns the pixmap for the given widget at the specified width and - * height. This will return NULL if no pixmap or gradient is specified. - * It may also return a different sized pixmap if the scaling - * is set to Tiled. When using this method, you should call it using - * the needed width and height then use QPainter::drawTiledPixmap to - * paint it. Doing this, if the pixmap is scaled it will be the proper - * size, otherwise it will be tiled. - * - * @param w Requested width. - * @param h Requested height. - * @param widget Widget type. - * @return The pixmap or NULL if one is not specified. - */ - virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget ); - /** - * This method reads a configuration file and applies it to the user's - * kstylerc file. It does not signal applications to reload via the - * KDEChangeGeneral atom, if you want to do this you must do so yourself. - * See kcmdisplay's general.cpp for an example. - * - * @param file The configuration file to apply. - */ - static void applyConfigFile( const QString &file ); + /** + * Constructs a new OThemeBase object. + */ + OThemeBase( const QString &configFile ); + ~OThemeBase(); + /** + * Describes if a pixmap should be scaled fully, horizontally, vertically, + * or not at all and tiled. + */ + enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale}; + /** + * The default arrow types. + */ + enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow}; + /** + * The default frame shading styles. + */ + enum ShadeStyle{Motif, Windows, Next, KDE}; + /** + * The default scrollbar button layout. BottomLeft is like what Next + * uses, BottomRight is like Platinum, and Opposite it like Windows and + * Motif. + */ + enum SButton{SBBottomLeft, SBBottomRight, SBOpposite}; + /** + * The gradient types. Horizontal is left to right, Vertical is top to + * bottom, and diagonal is upper-left to bottom-right. + */ + enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, + GrRectangle, GrElliptic, GrReverseBevel}; + /** + * This provides a list of widget types that OThemeBase recognizes. + */ + /* Internal note: The order here is important. Some widgets inherit + * properties. This is usually for when you have two settings for the + * same widget, ie: on(sunken), and off. The on settings will inherit + * the properties of the off one when nothing is specified in the config. + * + * In order to be able to handle this while still having everything in + * one group that is easy to loop from we have the following order: + * unsunked(off) items, sunken(on)items, and then the ones that don't + * matter. INHERIT_ITEMS define the number of widgets that have inheritence + * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn + * and so on. WIDGETS define the total number of widgets. + */ + enum WidgetType{ + // Off (unsunken widgets) + PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, + ToolButton, ScrollButton, HScrollDeco, VScrollDeco, + ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, + ArrowRight, + // On (sunken widgets) + PushButtonDown, ComboBoxDown, HScrollBarSliderDown, + VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, + HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, + ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, + SunkenArrowRight, + // Everything else (indicators must have separate settings) + HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, + IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, + ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, + DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, + Background}; + + /** + * The scaling type specified by the Config file. + * + * @param widget A Widgets enum value. + * + * @return A ScaleHint enum value. + */ + ScaleHint scaleHint( WidgetType widget ) const; + /** + * The gradient type specified by the KConfig file. + * + * @param widget A Widgets enum value. + * + * @return A Gradient enum value. + */ + Gradient gradientHint( WidgetType widget ) const; + /** + * The color group specified for a given widget. + * If a color group is set in the theme configuration + * that is used, otherwise defaultColor is returned. + * + * @param defaultColor The colorGroup to set if one is available. + * + * @param widget The widget whose color group to retrieve. + * + */ + const QColorGroup* colorGroup( const QColorGroup &defaultGroup, + WidgetType widget ) const; + + QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role, + int w, int h, WidgetType widget ); + /** + * True if the widget has a pixmap or gradient specified. + */ + bool isPixmap( WidgetType widget ) const; + /** + * True if the widget has a color group specified. + */ + bool isColor( WidgetType widget ) const; + /** + * True if the user specified a 3D focus rectangle + */ + bool is3DFocus() const; + /** + * If the user specified a 3D focus rectangle, they may also specify an + * offset from the default rectangle to use when drawing it. This returns + * the specified offset. + */ + int focusOffset() const; + /** + * The border width of the specified widget. + */ + int borderWidth( WidgetType widget ) const; + /** + * Pixmap border width of the specified widget. + */ + int pixBorderWidth( WidgetType widget ) const; + /** + * Returns the border pixmap if enabled for the specified widget. This + * will contain the originial pixmap, plus the edges separated in + * OThemePixmap::border() if valid. If invalid it will return NULL. + */ + OThemePixmap* borderPixmap( WidgetType widget ); + /** + * The highlight width of the specified widget. + */ + int highlightWidth( WidgetType widget ) const; + /** + * The border plus highlight width of the widget. + */ + int decoWidth( WidgetType widget ) const; + /** + * The extent (width for vertical, height for horizontal) requested + * for the scrollbars. + */ + int getSBExtent() const; + /** + * The scrollbar button layout. + */ + SButton scrollBarLayout() const; + /** + * The arrow type. + */ + ArrowStyle arrowType() const; + /** + * The shading type. + */ + ShadeStyle shade() const; + /** + * The frame width. + */ + int frameWidth() const; + /** + * The splitter width. + */ + int splitWidth() const; + /** + * The contrast for some bevel effects such as reverse gradient. + */ + int bevelContrast( WidgetType widget ) const; + /** + * The button text X shift. + */ + int buttonXShift() const; + /** + * The button text Y shift. + */ + int buttonYShift() const; + /** + * Returns either the slider length of the slider pixmap if available, + * otherwise the length specified in the config file. + */ + int sliderButtonLength() const; + /** + * True if rounded buttons are requested. + */ + bool roundButton() const; + /** + * True if rounded comboboxes are requested. + */ + bool roundComboBox() const; + /** + * True if rounded slider grooves are requested. + */ + bool roundSlider() const; + /** + * True if a line should be drawn on the bottom of active tabs. + */ + bool activeTabLine() const; + /** + * True if a line should be drawn on the bottom of inactive tabs. + */ + bool inactiveTabLine() const; + /** + * Returns the current uncached pixmap for the given widget. This will + * usually be either the last scaled or gradient pixmap if those have + * been specified in the config file, the original pixmap if not, or NULL + * if no pixmap has been specified. + */ + OThemePixmap* uncached( WidgetType widget ) const; + /** + * Returns the pixmap for the given widget at the specified width and + * height. This will return NULL if no pixmap or gradient is specified. + * It may also return a different sized pixmap if the scaling + * is set to Tiled. When using this method, you should call it using + * the needed width and height then use QPainter::drawTiledPixmap to + * paint it. Doing this, if the pixmap is scaled it will be the proper + * size, otherwise it will be tiled. + * + * @param w Requested width. + * @param h Requested height. + * @param widget Widget type. + * @return The pixmap or NULL if one is not specified. + */ + virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget ); + /** + * This method reads a configuration file and applies it to the user's + * kstylerc file. It does not signal applications to reload via the + * KDEChangeGeneral atom, if you want to do this you must do so yourself. + * See kcmdisplay's general.cpp for an example. + * + * @param file The configuration file to apply. + */ + static void applyConfigFile( const QString &file ); protected: - /** - * Returns a QImage for the given widget if the widget is scaled, NULL - * otherwise. QImages of the original pixmap are stored for scaled - * widgets in order to facilitate fast and accurate smooth-scaling. This - * also saves us a conversion from a pixmap to an image then back again. - */ - QImage* image( WidgetType widget ) const; - /** - * Returns the gradient high color if one is specified, NULL otherwise. - */ - QColor* gradientHigh( WidgetType widget ) const; - /** - * Returns the gradient low color if one is specified, NULL otherwise. - */ - QColor* gradientLow( WidgetType widget ) const; - /** - * Reads in all the configuration file entries supported. - * - * @param colorStyle The style for the color groups. In KDE, colors were - * calculated a little differently for Motif vs Windows styles. This - * is obsolete. - */ - void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle ); - void readWidgetConfig( int i, Config *config, QString *pixnames, - QString *brdnames, bool *loadArray ); - void copyWidgetConfig( int sourceID, int destID, QString *pixnames, - QString *brdnames ); - /** - * Makes a full color group based on the given foreground and background - * colors. This is the same code used by KDE (kapp.cpp) in previous - * versions. - */ - QColorGroup* makeColorGroup( QColor &fg, QColor &bg, - Qt::GUIStyle style = Qt::WindowsStyle ); - OThemePixmap* scale( int w, int h, WidgetType widget ); - OThemePixmap* scaleBorder( int w, int h, WidgetType type ); - OThemePixmap* gradient( int w, int h, WidgetType widget ); - OThemePixmap* blend( WidgetType widget ); - void generateBorderPix( int i ); - void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames ); - void applyMiscResourceGroup( Config *config ); - void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames, - bool *loadArray ); - void readMiscResourceGroup(); - /** - * Attempts to load a pixmap from the default OThemeBase locations. - */ - OThemePixmap* loadPixmap( QString &name ); - /** - * Attempts to load a image from the default OThemeBase locations. - */ - QImage* loadImage( QString &name ); + /** + * Returns a QImage for the given widget if the widget is scaled, NULL + * otherwise. QImages of the original pixmap are stored for scaled + * widgets in order to facilitate fast and accurate smooth-scaling. This + * also saves us a conversion from a pixmap to an image then back again. + */ + QImage* image( WidgetType widget ) const; + /** + * Returns the gradient high color if one is specified, NULL otherwise. + */ + QColor* gradientHigh( WidgetType widget ) const; + /** + * Returns the gradient low color if one is specified, NULL otherwise. + */ + QColor* gradientLow( WidgetType widget ) const; + /** + * Reads in all the configuration file entries supported. + * + * @param colorStyle The style for the color groups. In KDE, colors were + * calculated a little differently for Motif vs Windows styles. This + * is obsolete. + */ + void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle ); + void readWidgetConfig( int i, Config *config, QString *pixnames, + QString *brdnames, bool *loadArray ); + void copyWidgetConfig( int sourceID, int destID, QString *pixnames, + QString *brdnames ); + /** + * Makes a full color group based on the given foreground and background + * colors. This is the same code used by KDE (kapp.cpp) in previous + * versions. + */ + QColorGroup* makeColorGroup( QColor &fg, QColor &bg, + Qt::GUIStyle style = Qt::WindowsStyle ); + OThemePixmap* scale( int w, int h, WidgetType widget ); + OThemePixmap* scaleBorder( int w, int h, WidgetType type ); + OThemePixmap* gradient( int w, int h, WidgetType widget ); + OThemePixmap* blend( WidgetType widget ); + void generateBorderPix( int i ); + void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames ); + void applyMiscResourceGroup( Config *config ); + void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames, + bool *loadArray ); + void readMiscResourceGroup(); + /** + * Attempts to load a pixmap from the default OThemeBase locations. + */ + OThemePixmap* loadPixmap( QString &name ); + /** + * Attempts to load a image from the default OThemeBase locations. + */ + QImage* loadImage( QString &name ); private: - SButton sbPlacement; - ArrowStyle arrowStyle; - ShadeStyle shading; - int defaultFrame; - int btnXShift, btnYShift; - int sliderLen; - int splitterWidth; - int focus3DOffset; - int sbExtent; - bool smallGroove; - bool roundedButton, roundedCombo, roundedSlider; - bool aTabLine, iTabLine; - bool focus3D; - OThemeCache *cache; - int cacheSize; - QString configFileName; - QString configFilePath; + SButton sbPlacement; + ArrowStyle arrowStyle; + ShadeStyle shading; + int defaultFrame; + int btnXShift, btnYShift; + int sliderLen; + int splitterWidth; + int focus3DOffset; + int sbExtent; + bool smallGroove; + bool roundedButton, roundedCombo, roundedSlider; + bool aTabLine, iTabLine; + bool focus3D; + OThemeCache *cache; + int cacheSize; + QString configFileName; + QString configFilePath; protected: - QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor; + QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor; private: - /** - * The theme pixmaps. Many of these may be NULL if no pixmap is specified. - * There may also be duplicate pixmap pointers if more than one widget - * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and - * this acts as a cache. Otherwise this will hold whatever the last scaled - * pixmap was. - */ - OThemePixmap *pixmaps[ WIDGETS ]; - /** - * The theme images. These are for scaled images and are kept in order - * to maintain fast smoothscaling. - */ - QImage *images[ WIDGETS ]; - /** - * The border widths - */ - unsigned char borders[ WIDGETS ]; - /** - * The highlight widths - */ - unsigned char highlights[ WIDGETS ]; - /** - * The scale hints for pixmaps and gradients. - */ - ScaleHint scaleHints[ WIDGETS ]; - /** - * All the color groups. - */ - QColorGroup *colors[ WIDGETS ]; - /** - * Gradient low colors (or blend background). - */ - QColor *grLowColors[ WIDGETS ]; - /** - * Gradient high colors. - */ - QColor *grHighColors[ WIDGETS ]; - /** - * Gradient types. - */ - Gradient gradients[ WIDGETS ]; - /** - * Blend intensity factors - */ - float blends[ WIDGETS ]; - /** - * Bevel contrasts - */ - unsigned char bContrasts[ WIDGETS ]; - /** - * Duplicate pixmap entries (used during destruction). - */ - bool duplicate[ WIDGETS ]; - /** - * Pixmapped border widths - */ - int pbWidth[ WIDGETS ]; - /** - * Pixmapped borders - */ - OThemePixmap *pbPixmaps[ WIDGETS ]; - /** - * Duplicate border pixmapped border entries - */ - bool pbDuplicate[ WIDGETS ]; + /** + * The theme pixmaps. Many of these may be NULL if no pixmap is specified. + * There may also be duplicate pixmap pointers if more than one widget + * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and + * this acts as a cache. Otherwise this will hold whatever the last scaled + * pixmap was. + */ + OThemePixmap *pixmaps[ WIDGETS ]; + /** + * The theme images. These are for scaled images and are kept in order + * to maintain fast smoothscaling. + */ + QImage *images[ WIDGETS ]; + /** + * The border widths + */ + unsigned char borders[ WIDGETS ]; + /** + * The highlight widths + */ + unsigned char highlights[ WIDGETS ]; + /** + * The scale hints for pixmaps and gradients. + */ + ScaleHint scaleHints[ WIDGETS ]; + /** + * All the color groups. + */ + QColorGroup *colors[ WIDGETS ]; + /** + * Gradient low colors (or blend background). + */ + QColor *grLowColors[ WIDGETS ]; + /** + * Gradient high colors. + */ + QColor *grHighColors[ WIDGETS ]; + /** + * Gradient types. + */ + Gradient gradients[ WIDGETS ]; + /** + * Blend intensity factors + */ + float blends[ WIDGETS ]; + /** + * Bevel contrasts + */ + unsigned char bContrasts[ WIDGETS ]; + /** + * Duplicate pixmap entries (used during destruction). + */ + bool duplicate[ WIDGETS ]; + /** + * Pixmapped border widths + */ + int pbWidth[ WIDGETS ]; + /** + * Pixmapped borders + */ + OThemePixmap *pbPixmaps[ WIDGETS ]; + /** + * Duplicate border pixmapped border entries + */ + bool pbDuplicate[ WIDGETS ]; private: - class OThemeBasePrivate; - OThemeBasePrivate *d; + class OThemeBasePrivate; + OThemeBasePrivate *d; }; inline bool OThemeBase::isPixmap( WidgetType widget ) const { - return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone ); + return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone ); } inline bool OThemeBase::isColor( WidgetType widget ) const { - return ( colors[ widget ] != NULL ); + return ( colors[ widget ] != NULL ); } inline bool OThemeBase::is3DFocus() const { - return ( focus3D ); + return ( focus3D ); } inline int OThemeBase::focusOffset() const { - return ( focus3DOffset ); + return ( focus3DOffset ); } inline int OThemeBase::bevelContrast( WidgetType widget ) const { - return ( bContrasts[ widget ] ); + return ( bContrasts[ widget ] ); } inline OThemeBase::ScaleHint OThemeBase::scaleHint( WidgetType widget ) const { - return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale ); + return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale ); } inline OThemeBase::Gradient OThemeBase::gradientHint( WidgetType widget ) const { - return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone ); + return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone ); } inline OThemePixmap* OThemeBase::uncached( WidgetType widget ) const { - return ( pixmaps[ widget ] ); + return ( pixmaps[ widget ] ); } inline QBrush OThemeBase::pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role, int w, int h, WidgetType widget ) { - if ( pixmaps[ widget ] || images[ widget ] ) - return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) ); - else - return ( group.color( role ) ); + if ( pixmaps[ widget ] || images[ widget ] ) + return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) ); + else + return ( group.color( role ) ); } inline const QColorGroup* OThemeBase::colorGroup( const QColorGroup &defaultGroup, WidgetType widget ) const { - return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup ); + return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup ); } inline int OThemeBase::borderWidth( WidgetType widget ) const { - return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] ); + return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] ); } inline int OThemeBase::pixBorderWidth( WidgetType widget ) const { - return ( pbWidth[ widget ] ); + return ( pbWidth[ widget ] ); } inline int OThemeBase::highlightWidth( WidgetType widget ) const { - return ( pbWidth[ widget ] ? 0 : highlights[ widget ] ); + return ( pbWidth[ widget ] ? 0 : highlights[ widget ] ); } inline int OThemeBase::decoWidth( WidgetType widget ) const { - return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] ); + return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] ); } inline QColor* OThemeBase::gradientHigh( WidgetType widget ) const { - return ( grHighColors[ widget ] ); + return ( grHighColors[ widget ] ); } inline QColor* OThemeBase::gradientLow( WidgetType widget ) const { - return ( grLowColors[ widget ] ); + return ( grLowColors[ widget ] ); } inline QImage* OThemeBase::image( WidgetType widget ) const { - return ( images[ widget ] ); + return ( images[ widget ] ); } inline OThemeBase::SButton OThemeBase::scrollBarLayout() const { - return ( sbPlacement ); + return ( sbPlacement ); } inline OThemeBase::ArrowStyle OThemeBase::arrowType() const { - return ( arrowStyle ); + return ( arrowStyle ); } inline OThemeBase::ShadeStyle OThemeBase::shade() const { - return ( shading ); + return ( shading ); } inline int OThemeBase::frameWidth() const { - return ( defaultFrame ); + return ( defaultFrame ); } inline int OThemeBase::buttonXShift() const { - return ( btnXShift ); + return ( btnXShift ); } inline int OThemeBase::splitWidth() const { - return ( splitterWidth ); + return ( splitterWidth ); } inline int OThemeBase::buttonYShift() const { - return ( btnYShift ); + return ( btnYShift ); } inline int OThemeBase::sliderButtonLength() const { - if ( isPixmap( Slider ) ) - return ( uncached( Slider ) ->width() ); - else - return ( sliderLen ); + if ( isPixmap( Slider ) ) + return ( uncached( Slider ) ->width() ); + else + return ( sliderLen ); } inline bool OThemeBase::roundButton() const { - return ( roundedButton ); + return ( roundedButton ); } inline bool OThemeBase::roundComboBox() const { - return ( roundedCombo ); + return ( roundedCombo ); } inline bool OThemeBase::roundSlider() const { - return ( roundedSlider ); + return ( roundedSlider ); } inline bool OThemeBase::activeTabLine() const { - return ( aTabLine ); + return ( aTabLine ); } inline bool OThemeBase::inactiveTabLine() const { - return ( iTabLine ); + return ( iTabLine ); } inline int OThemeBase::getSBExtent() const { - return ( sbExtent ); + return ( sbExtent ); } inline OThemePixmap* OThemeBase::borderPixmap( WidgetType widget ) { - return ( pbPixmaps[ widget ] ); + return ( pbPixmaps[ widget ] ); } #endif -- cgit v0.9.0.2