-rw-r--r-- | libopie2/opieui/big-screen/osplitter.cpp | 25 | ||||
-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 5 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 5 | ||||
-rw-r--r-- | libopie2/opieui/olistview.cpp | 16 | ||||
-rw-r--r-- | libopie2/opieui/opopupmenu.cpp | 30 | ||||
-rw-r--r-- | libopie2/opieui/otaskbarapplet.h | 10 | ||||
-rw-r--r-- | libqtaux/oticker.cpp | 10 |
7 files changed, 56 insertions, 45 deletions
diff --git a/libopie2/opieui/big-screen/osplitter.cpp b/libopie2/opieui/big-screen/osplitter.cpp index f0287ed..f50e7f0 100644 --- a/libopie2/opieui/big-screen/osplitter.cpp +++ b/libopie2/opieui/big-screen/osplitter.cpp @@ -21,24 +21,25 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "osplitter.h" /* OPIE */ #include <opie2/otabwidget.h> +#include <opie2/odebug.h> /* QT */ #include <qvaluelist.h> #include <qvbox.h> using namespace Opie::Ui; using namespace Opie::Ui::Internal; /** * * This is the constructor of OSplitter * You might want to call setSizeChange to tell @@ -72,25 +73,25 @@ OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFl changeTab(); } /** * Destructor destructs this object and cleans up. All child * widgets will be deleted * @see addWidget */ OSplitter::~OSplitter() { - qWarning("Deleted Splitter"); + owarn << "Deleted Splitter" << oendl; m_splitter.setAutoDelete( true ); m_splitter.clear(); delete m_hbox; delete m_tabWidget; } /** * Sets the label for the Splitter. This label will be used * if a parent splitter is arranged as TabWidget but * this splitter is in fullscreen mode. Then a tab with OSplitter::label() @@ -201,25 +202,25 @@ void OSplitter::removeWidget( OSplitter* split) * Warning: No null checking of the widget is done. Only on debug * a message will be outputtet * * @param wid The widget which will be added * @param icon The icon of the possible Tab * @param label The label of the possible Tab */ void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) { #ifdef DEBUG if (!wid ) { - qWarning("Widget is not valid!"); + owarn << "Widget is not valid!" << oendl; return; } #endif OSplitterContainer cont; cont.widget = wid; cont.icon =icon; cont.name = label; m_container.append( cont ); /* * @@ -357,44 +358,44 @@ QSize OSplitter::minimumSizeHint()const } #endif /** * @reimplemented for internal reasons */ void OSplitter::resizeEvent( QResizeEvent* res ) { QFrame::resizeEvent( res ); /* * */ - // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); + // owarn << "Old size was width = " << res->oldSize().width() << " height = " << res->oldSize().height() << "" << oendl; bool mode = true; - qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); + owarn << "New size is width = " << res->size().width() << " height = " << res->size().height() << " " << name() << "" << oendl; if ( res->size().width() > m_size_policy && m_orient == Horizontal ) { changeHBox(); mode = false; } else if ( (res->size().width() <= m_size_policy && m_orient == Horizontal ) || (res->size().height() <= m_size_policy && m_orient == Vertical ) ) { changeTab(); } else if ( res->size().height() > m_size_policy && m_orient == Vertical ) { - qWarning("Changng to vbox %s", name() ); + owarn << "Changng to vbox " << name() << "" << oendl; changeVBox(); mode = false; } emit sizeChanged(mode, m_orient ); } /* * Adds a container to a tab either the parent tab * or our own */ void OSplitter::addToTab( const Opie::Ui::Internal::OSplitterContainer& con ) @@ -435,25 +436,25 @@ void OSplitter::removeFromTab( QWidget* wid ) */ void OSplitter::changeTab() { /* if we're the owner of the tab widget */ if (m_tabWidget ) { raise(); show(); m_tabWidget->setGeometry( frameRect() ); return; } - qWarning(" New Tab Widget %s", name() ); + owarn << " New Tab Widget " << name() << "" << oendl; /* * and add all widgets this will reparent them * delete m_hbox set it to 0 * */ OTabWidget *tab; if ( m_parentTab ) { hide(); tab = m_parentTab; /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ if (!m_container.isEmpty() ) @@ -462,25 +463,25 @@ void OSplitter::changeTab() for (; it != m_container.end(); ++it ) m_parentTab->removePage( (*it).widget ); } } else tab = m_tabWidget = new OTabWidget( this ); connect(tab, SIGNAL(currentChanged(QWidget*) ), this, SIGNAL(currentChanged(QWidget*) ) ); for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { - qWarning("Widget is %s", (*it).name.latin1() ); + owarn << "Widget is " << (*it).name << "" << oendl; addToTab( (*it) ); } for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { split->reparent(this, 0, QPoint(0, 0) ); split->setTabWidget( tab ); } delete m_hbox; m_hbox = 0; @@ -495,80 +496,80 @@ void OSplitter::changeTab() /* * changes over to a box * this is recursive as well */ void OSplitter::changeHBox() { if (m_hbox ) { m_hbox->setGeometry( frameRect() ); return; } - qWarning("new HBox %s", name() ); + owarn << "new HBox " << name() << "" << oendl; m_hbox = new QHBox( this ); commonChangeBox(); } void OSplitter::changeVBox() { if (m_hbox ) { m_hbox->setGeometry( frameRect() ); return; } - qWarning("New VBOX %s", name() ); + owarn << "New VBOX " << name() << "" << oendl; m_hbox = new QVBox( this ); commonChangeBox(); } /* * common box code * first remove and add children * the other splitters * it is recursive as well due the call to setTabWidget */ void OSplitter::commonChangeBox() { - qWarning(" Name of Splitters is %s", name() ); + owarn << " Name of Splitters is " << name() << "" << oendl; for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ if (m_parentTab ) removeFromTab( (*it).widget ); - qWarning("Adding to box %s", (*it).name.latin1() ); + owarn << "Adding to box " << (*it).name << "" << oendl; addToBox( (*it) ); } for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { /* tell them the world had changed */ split->setTabWidget( 0 ); OSplitterContainer con; con.widget = split; // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) // : static_cast<QWidget*>(split->m_hbox); addToBox( con ); } if (m_parentTab ) m_parentTab->addTab(m_hbox, iconName(), label() ); else { - qWarning(" setting Box geometry for %s", name() ); + owarn << " setting Box geometry for " << name() << "" << oendl; m_hbox->setGeometry( frameRect() ); m_hbox->show(); delete m_tabWidget; m_tabWidget = 0; show(); // also show this widget } } /* * sets the tabwidget, removes tabs, and relayouts the widget */ void OSplitter::setTabWidget( OTabWidget* wid) diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index a0a6355..de7f83f 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp @@ -19,24 +19,27 @@ : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "owidgetstack.h" +/* OPIE */ +#include <opie2/odebug.h> + /* QT */ #include <qapplication.h> #include <qwidgetstack.h> namespace Opie { namespace Ui { const int mode_size = 330; /** * This is the standard widget. For simple usage see the example. Normally this widget @@ -298,25 +301,25 @@ void OWidgetStack::hideWidget( int id) { * it takes. */ void OWidgetStack::hideWidget( QWidget* wid) { /* still not smart */ if ( m_mode == BigScreen && m_last != m_mWidget ) m_last->hide(); raiseWidget( wid ); } bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { - qWarning(" %s %s", obj->name(), obj->className() ); + owarn << " " << obj->name() << " " << obj->className() << "" << oendl; if ( e->type() == QEvent::Resize ) { QResizeEvent *res = static_cast<QResizeEvent*>( e ); QSize size = res->size(); if ( size.width() >= mode_size ) switchTop(); else switchStack(); } return false; } diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index a9ec8c4..1f6ca05 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp @@ -27,24 +27,25 @@ */ /* hacky but we need to get FileSelector::filter */ #define private public #include <qpe/fileselector.h> #undef private #include "ofileselector_p.h" /* OPIE */ #include <opie2/ofileselector.h> +#include <opie2/odebug.h> #include <qpe/qpeapplication.h> #include <qpe/mimetype.h> #include <qpe/resource.h> #include <qpe/storage.h> /* QT */ #include <qcombobox.h> #include <qdir.h> #include <qhbox.h> #include <qheader.h> #include <qlabel.h> @@ -537,25 +538,25 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) if (!item) return; #if 0 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); if (!sel->isDir() ) { selector()->m_lneEdit->setText( sel->text(1) ); // if in fileselector mode we will emit selected if ( selector()->mode() == OFileSelector::FileSelector ) { - qWarning("slot Current Changed"); + owarn << "slot Current Changed" << oendl; QStringList str = QStringList::split("->", sel->text(1) ); QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } #endif } void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { @@ -565,25 +566,25 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); if (!sel->isLocked() ) { QStringList str = QStringList::split("->", sel->text(1) ); if (sel->isDir() ) { m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->dirSelected( m_currentDir ); reread( m_all ); } else { // file - qWarning("slot Clicked"); + owarn << "slot Clicked" << oendl; selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); emit selector()->fileSelected( path ); DocLnk lnk( path ); emit selector()->fileSelected( lnk ); } } // not locked } void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { MimeType type( info->absFilePath() ); diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index d7c92fd..0b3bdea 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp @@ -178,25 +178,25 @@ void OListView::serializeFrom( QDataStream& s ) odebug << "loading OListView..." << oendl; int cols; s >> cols; odebug << "read number of columns = " << cols << oendl; while ( columns() < cols ) addColumn( QString::null ); for ( int i = 0; i < cols; ++i ) { QString coltext; s >> coltext; - qDebug( "read text '%s' for column %d", (const char*) coltext, i ); + odebug << "read text '" << coltext << "' for column " << i << "" << oendl; setColumnText( i, coltext ); } int items; s >> items; odebug << "read number of items = " << items << oendl; for ( int i = 0; i < items; ++i ) { OListViewItem* item = childFactory(); s >> *item; } @@ -433,31 +433,31 @@ void OListViewItem::serializeTo( QDataStream& s ) const } void OListViewItem::serializeFrom( QDataStream& s ) { #warning Caution... the binary format is still under construction... odebug << "loading OListViewItem..." << oendl; for ( int i = 0; i < listView()->columns(); ++i ) { QString coltext; s >> coltext; - qDebug( "read text '%s' for column %d", (const char*) coltext, i ); + odebug << "read text '" << coltext << "' for column " << i << "" << oendl; setText( i, coltext ); } int items; s >> items; - qDebug( "read number of items = %d", items ); + odebug << "read number of items = " << items << "" << oendl; for ( int i = 0; i < items; ++i ) { OListViewItem* item = childFactory(); s >> (*item); } odebug << "OListViewItem loaded." << oendl; } QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi ) @@ -606,25 +606,25 @@ ONamedListView::ONamedListView( QWidget *parent, const char *name ) } ONamedListView::~ONamedListView() { } void ONamedListView::addColumns( const QStringList& columns ) { for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) { - qDebug( "adding column %s", (const char*) *it ); + odebug << "adding column " << *it << "" << oendl; addColumn( *it ); } } int ONamedListView::findColumn( const QString& text ) const { //FIXME: If used excessively, this will slow down performance of updates //FIXME: because of the linear search over all column texts. //FIXME: I will optimize later by using a hash map. for ( int i = 0; i < columns(); ++i ) if ( columnText( i ) == text ) @@ -635,29 +635,29 @@ int ONamedListView::findColumn( const QString& text ) const ONamedListViewItem* ONamedListView::find( int column, const QString& text, int recurse ) const { return find( (ONamedListViewItem*) firstChild(), column, text, recurse ); } ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, int column, const QString& text, int recurse ) const { ONamedListViewItem* result; while ( item && item->text( column ) != text ) { - qDebug( "checked %s", (const char*) item->text( column ) ); + odebug << "checked " << item->text( column ) << "" << oendl; if ( recurse < 0 || recurse > 0 ) { - qDebug( "recursion is %d - recursing into...", recurse ); + odebug << "recursion is " << recurse << " - recursing into..." << oendl; result = find( (ONamedListViewItem*) item->firstChild(), column, text, recurse-1 ); if ( result ) return result; } item = (ONamedListViewItem*) item->itemBelow(); } if ( item && item->text( column ) == text ) return item; else return 0; } @@ -716,41 +716,41 @@ ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* af ONamedListViewItem::~ONamedListViewItem() { } void ONamedListViewItem::setText( const QStringList& texts ) { int col = 0; for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) { - qDebug( "setting column %d = text %s", col, (const char*) *it ); + odebug << "setting column " << col << " = text " << *it << "" << oendl; OListViewItem::setText( col++, *it ); } } void ONamedListViewItem::setText( const QString& column, const QString& text ) { //FIXME: If used excessively, this will slow down performance of updates //FIXME: because of the linear search over all column texts. //FIXME: I will optimize later by using a hash map. int col = ( (ONamedListView*) listView() )->findColumn( column ); if ( col != -1 ) OListViewItem::setText( col, text ); else - qWarning( "ONamedListViewItem::setText(): Warning! Columntext '%s' not found.", (const char*) column ); + owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; } ONamedListViewItem* ONamedListViewItem::find( int column, const QString& text, int recurse ) const { return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), column, text, recurse ); } ONamedListViewItem* ONamedListViewItem::find( const QString& column, const QString& text, int recurse ) const { int col = ( (ONamedListView*) listView() )->findColumn( column ); diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp index 3ab8490..50c613f 100644 --- a/libopie2/opieui/opopupmenu.cpp +++ b/libopie2/opieui/opopupmenu.cpp @@ -8,33 +8,33 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* QT */ +/* OPIE */ +#include <opie2/opopupmenu.h> +#include <opie2/oconfig.h> +#include <opie2/odebug.h> +/* QT */ #include <qdrawutil.h> #include <qtimer.h> -/* OPIE */ - -#include <opie2/opopupmenu.h> -#include <opie2/oconfig.h> using namespace Opie::Core; using namespace Opie::Ui; OPopupTitle::OPopupTitle(QWidget *parent, const char *name) : QWidget(parent, name) { setMinimumSize(16, fontMetrics().height()+8); } OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */, const QColor &/* color */, const QColor &/* textColor */, @@ -123,25 +123,25 @@ QSize OPopupTitle::sizeHint() const } class OPopupMenu::OPopupMenuPrivate { public: OPopupMenuPrivate () : noMatches(false) , shortcuts(false) , autoExec(false) , lastHitIndex(-1) , m_ctxMenu(0) {} - + ~OPopupMenuPrivate () { delete m_ctxMenu; } QString m_lastTitle; // variables for keyboard navigation QTimer clearTimer; bool noMatches : 1; bool shortcuts : 1; @@ -169,25 +169,25 @@ OPopupMenu::OPopupMenu(QWidget *parent, const char *name) d = new OPopupMenuPrivate; resetKeyboardVars(); connect(&(d->clearTimer), SIGNAL(timeout()), SLOT(resetKeyboardVars())); } OPopupMenu::~OPopupMenu() { if (OPopupMenuPrivate::s_contextedMenu == this) { OPopupMenuPrivate::s_contextedMenu = 0; OPopupMenuPrivate::s_highlightedItem = -1; } - + delete d; } int OPopupMenu::insertTitle(const QString &text, int id, int index) { OPopupTitle *titleItem = new OPopupTitle(); titleItem->setTitle(text); int ret = insertItem(titleItem, id, index); setItemEnabled(id, false); return ret; } @@ -200,77 +200,77 @@ int OPopupMenu::insertTitle(const QPixmap &icon, const QString &text, int id, setItemEnabled(id, false); return ret; } void OPopupMenu::changeTitle(int id, const QString &text) { QMenuItem *item = findItem(id); if(item){ if(item->widget()) ((OPopupTitle *)item->widget())->setTitle(text); #ifndef NDEBUG else - qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id ); + owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl; #endif } #ifndef NDEBUG else - qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id ); + owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl; #endif } void OPopupMenu::changeTitle(int id, const QPixmap &icon, const QString &text) { QMenuItem *item = findItem(id); if(item){ if(item->widget()) ((OPopupTitle *)item->widget())->setTitle(text, &icon); #ifndef NDEBUG else - qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id ); + owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl; #endif } #ifndef NDEBUG else - qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id ); + owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl; #endif } QString OPopupMenu::title(int id) const { if(id == -1) // obsolete return(d->m_lastTitle); QMenuItem *item = findItem(id); if(item){ if(item->widget()) return(((OPopupTitle *)item->widget())->title()); else - qWarning("OPopupMenu: title() called with non-title id %d.", id); + owarn << "OPopupMenu: title() called with non-title id " << id << "." << oendl; } else - qWarning("OPopupMenu: title() called with invalid id %d.", id); + owarn << "OPopupMenu: title() called with invalid id " << id << "." << oendl; return(QString::null); } QPixmap OPopupMenu::titlePixmap(int id) const { QMenuItem *item = findItem(id); if(item){ if(item->widget()) return(((OPopupTitle *)item->widget())->icon()); else - qWarning("KPopupMenu: titlePixmap() called with non-title id %d.", id); + owarn << "KPopupMenu: titlePixmap() called with non-title id " << id << "." << oendl; } else - qWarning("KPopupMenu: titlePixmap() called with invalid id %d.", id); + owarn << "KPopupMenu: titlePixmap() called with invalid id " << id << "." << oendl; QPixmap tmp; return(tmp); } /** * This is re-implemented for keyboard navigation. */ void OPopupMenu::closeEvent(QCloseEvent*e) { if (d->shortcuts) resetKeyboardVars(); QPopupMenu::closeEvent(e); diff --git a/libopie2/opieui/otaskbarapplet.h b/libopie2/opieui/otaskbarapplet.h index 77cc461..75c07d1 100644 --- a/libopie2/opieui/otaskbarapplet.h +++ b/libopie2/opieui/otaskbarapplet.h @@ -23,27 +23,31 @@ -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef OTASKBARAPPLET_H #define OTASKBARAPPLET_H +/* OPIE */ +#include <opie2/odebug.h> + #include <qpe/taskbarappletinterface.h> #include <qpe/qcom.h> +/* QT */ #include <qwidget.h> class QMouseEvent; namespace Opie { namespace Ui { namespace Internal { /*====================================================================================== * OTaskbarAppletWrapper *======================================================================================*/ class OTaskbarAppletWrapperPrivate; @@ -52,32 +56,32 @@ template<class T> class OTaskbarAppletWrapper : public TaskbarAppletInterface public: OTaskbarAppletWrapper():_applet( 0 ) { } virtual ~OTaskbarAppletWrapper() { delete _applet; } QRESULT queryInterface( const QUuid& uuid, QUnknownInterface** iface ) { - qDebug( "OTaskbarAppletWrapper::queryInterface()" ); + odebug << "OTaskbarAppletWrapper::queryInterface()" << oendl; *iface = 0; if ( uuid == IID_QUnknown ) *iface = this; else if ( uuid == IID_TaskbarApplet ) *iface = this; - else - return QS_FALSE; + else + return QS_FALSE; if ( *iface ) (*iface)->addRef(); return QS_OK; } Q_REFCOUNT virtual T* applet( QWidget* parent ) { if ( !_applet ) _applet = new T( parent ); return _applet; } diff --git a/libqtaux/oticker.cpp b/libqtaux/oticker.cpp index e954cc8..29478fd 100644 --- a/libqtaux/oticker.cpp +++ b/libqtaux/oticker.cpp @@ -22,24 +22,26 @@ -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "oticker.h" /* OPIE */ +#include <opie2/odebug.h> + #include <qpe/config.h> using namespace Opie::Ui; OTicker::OTicker( QWidget* parent ) : QLabel( parent ) { setTextFormat( Qt::RichText ); Config cfg( "qpe" ); cfg.setGroup( "Appearance" ); backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); foregroundcolor = Qt::black; @@ -63,76 +65,76 @@ void OTicker::setForegroundColor( const QColor& backcolor ) } void OTicker::setFrame( int frameStyle ) { setFrameStyle( frameStyle /*WinPanel | Sunken */ ); update(); } void OTicker::setText( const QString& text ) { pos = 0; // reset it everytime the text is changed scrollText = text; - qDebug( scrollText ); + odebug << scrollText << oendl; int pixelLen = 0; bool bigger = false; int contWidth = contentsRect().width(); int contHeight = contentsRect().height(); int pixelTextLen = fontMetrics().width( text ); - qDebug( "<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length() ); + odebug << "<<<<<<<height " << contHeight << ", width " << contWidth << ", text width " << pixelTextLen << " " << scrollText.length() << "\n" << oendl; if ( pixelTextLen < contWidth ) { pixelLen = contWidth; } else { bigger = true; pixelLen = pixelTextLen; } QPixmap pm( pixelLen, contHeight ); // pm.fill( QColor( 167, 212, 167 )); pm.fill( backgroundcolor ); QPainter pmp( &pm ); pmp.setPen( foregroundcolor ); pmp.drawText( 0, 0, pixelTextLen, contHeight, AlignVCenter, scrollText ); pmp.end(); scrollTextPixmap = pm; killTimers(); - // qDebug("Scrollupdate %d", updateTimerTime); + // odebug << "Scrollupdate " << updateTimerTime << "" << oendl; if ( bigger /*pixelTextLen > contWidth*/ ) startTimer( updateTimerTime ); update(); } void OTicker::timerEvent( QTimerEvent * ) { pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - scrollLength; //1; repaint( FALSE ); } void OTicker::drawContents( QPainter *p ) { int pixelLen = scrollTextPixmap.width(); p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap ); if ( pixelLen > contentsRect().width() ) // Scrolling p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap ); } void OTicker::mouseReleaseEvent( QMouseEvent * ) { - // qDebug("<<<<<<<>>>>>>>>>"); + // odebug << "<<<<<<<>>>>>>>>>" << oendl; emit mousePressed(); } void OTicker::setUpdateTime( int time ) { updateTimerTime = time; } void OTicker::setScrollLength( int len ) { scrollLength = len; } |