-rw-r--r-- | libopie2/opieui/big-screen/owidgetstack.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 1 | ||||
-rw-r--r-- | libopie2/opieui/olistview.cpp | 20 | ||||
-rw-r--r-- | libopie2/opieui/oselector.cpp | 2 | ||||
-rw-r--r-- | libopie2/opieui/owait.cpp | 1 |
5 files changed, 17 insertions, 9 deletions
diff --git a/libopie2/opieui/big-screen/owidgetstack.cpp b/libopie2/opieui/big-screen/owidgetstack.cpp index de7f83f..9c9f7ec 100644 --- a/libopie2/opieui/big-screen/owidgetstack.cpp +++ b/libopie2/opieui/big-screen/owidgetstack.cpp @@ -345,97 +345,97 @@ void OWidgetStack::resizeEvent( QResizeEvent* ev ) { * If in BigScreen mode the current mainwindow will be reparented * and hidden. The position will be taken by the new one. * If the old MainWindow was hidden the new window will * also be hidden. If the window was visible the new mainwindow * will be made visible too and the old one hidden. If there * was no mainwindow it will be hidden as well. * * @param wid The new mainwindow */ void OWidgetStack::setMainWindow( QWidget* wid ) { if (m_mode == BigScreen ) { bool wasVisible = false; if (m_mWidget ) { wasVisible = !m_mWidget->isHidden(); /* hidden by default */ m_mWidget->reparent(0, WType_TopLevel, QPoint(10, 10) ); } wid->reparent(this, 0, frameRect().topLeft() ); if (wasVisible) wid->show(); } m_mWidget = wid; } /** * this is an overloaded member and only differs * in the type of arguments. * @see setMainWindow(QWidget*) */ void OWidgetStack::setMainWindow( int id) { setMainWindow( widget( id ) ); } /* * this function switches to a stack ;) */ void OWidgetStack::switchStack() { if (m_stack ) { m_stack->setGeometry( frameRect() ); return; } m_mode = SmallScreen; m_stack = new QWidgetStack(this); connect(m_stack, SIGNAL(aboutToShow(QWidget*) ), this, SIGNAL(aboutToShow(QWidget*) ) ); connect(m_stack, SIGNAL(aboutToShow(int) ), this, SIGNAL(aboutToShow(int) ) ); /* now reparent the widgets... luckily QWidgetSatck does most of the work */ if (m_list.isEmpty() ) return; QMap<int, QWidget*>::Iterator it = m_list.begin(); for ( ; it != m_list.end(); ++it ) m_stack->addWidget( it.data(), it.key() ); } /* * we will switch to top level mode * reparent the list of widgets and then delete the stack */ void OWidgetStack::switchTop() { m_mode = BigScreen; /* this works because it is guaranteed that switchStack was called at least once*/ if (!m_stack && m_mWidget) { m_mWidget->setGeometry( frameRect() ); return; }else if (!m_stack) return; if (!m_list.isEmpty() ) { QMap<int, QWidget*>::Iterator it = m_list.begin(); for ( ; it != m_list.end(); ++it ) { /* better than reparenting twice */ if ( it.data() == m_mWidget ) { m_mWidget->reparent(this, 0, frameRect().topLeft() ); m_mWidget->setGeometry( frameRect() ); m_mWidget->show(); }else /* ### FIXME we need to place the widget better */ it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); } } delete m_stack; m_stack = 0; } } -}
\ No newline at end of file +} diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index 6763ee6..4870cd9 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp @@ -100,192 +100,193 @@ using namespace Opie::Ui::Internal; static int findItemCB( QComboBox *box, const QString &str ) { for ( int i = 0; i < box->count(); i++ ) { if ( box->text ( i ) == str ) return i; } return -1; } /* static same as anon. namespace */ static int qt_version() { const char *qver = qVersion(); return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); } /** * Constructs the Selector object * @param withpreview If a font preview should be given * @param parent The parent of the Font Selector * @param name The name of the object * @param fl WidgetFlags */ OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) { d = new OFontSelectorPrivate(); QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); gridLayout->setRowStretch( 4, 10 ); d->m_font_family_list = new QListBox( this, "FontListBox" ); gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); QLabel *label = new QLabel( tr( "Style" ), this ); gridLayout->addWidget( label, 0, 1 ); d->m_font_style_list = new QComboBox( this, "StyleListBox" ); connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); gridLayout->addWidget( d->m_font_style_list, 1, 1 ); label = new QLabel( tr( "Size" ), this ); gridLayout->addWidget( label, 2, 1 ); d->m_font_size_list = new QComboBox( this, "SizeListBox" ); connect( d->m_font_size_list, SIGNAL( activated(int) ), this, SLOT( fontSizeClicked(int) ) ); gridLayout->addWidget( d->m_font_size_list, 3, 1 ); d->m_pointbug = ( qt_version() <= 233 ); if ( withpreview ) { d->m_preview = new QMultiLineEdit ( this, "Preview" ); d->m_preview->setAlignment ( AlignCenter ); d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); d->m_preview->setMargin ( 3 ); d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); gridLayout->addRowSpacing ( 5, 4 ); gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); gridLayout->setRowStretch ( 6, 5 ); } else d->m_preview = 0; loadFonts ( d->m_font_family_list ); } OFontSelector::~OFontSelector() { delete d; } /** * This methods tries to set the font * @param f The wishes font * @return success or failure */ bool OFontSelector::setSelectedFont ( const QFont &f ) { return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); } /** * This is an overloaded method @see setSelectedFont * @param familyStr The family of the font * @param styleStr The style of the font * @param sizeVal The size of font * @param charset The charset to be used. Will be deprecated by QT3 */ bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) { + Q_CONST_UNUSED( charset ) QString sizeStr = QString::number ( sizeVal ); QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); if ( !family ) family = d->m_font_family_list->findItem ( "Helvetica" ); if ( !family ) family = d->m_font_family_list->firstItem(); d->m_font_family_list->setCurrentItem ( family ); fontFamilyClicked ( d->m_font_family_list->index ( family )); int style = findItemCB ( d->m_font_style_list, styleStr ); if ( style < 0 ) style = findItemCB ( d->m_font_style_list, "Regular" ); if ( style < 0 && d->m_font_style_list->count() > 0 ) style = 0; d->m_font_style_list->setCurrentItem ( style ); fontStyleClicked ( style ); int size = findItemCB ( d->m_font_size_list, sizeStr ); if ( size < 0 ) size = findItemCB ( d->m_font_size_list, "10" ); if ( size < 0 && d->m_font_size_list->count() > 0 ) size = 0; d->m_font_size_list->setCurrentItem ( size ); fontSizeClicked ( size ); return (( family ) && ( style >= 0 ) && ( size >= 0 )); } /** * This method returns the name, style and size of the currently selected * font or false if no font is selected * @param family The font family will be written there * @param style The style will be written there * @param size The size will be written there * @return success or failure */ bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) { QString dummy; return selectedFont ( family, style, size, dummy ); } /** * This method does return the font family or QString::null if there is * no font item selected * @return the font family */ QString OFontSelector::fontFamily() const { FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); return fli ? fli->family() : QString::null; } /** * This method will return the style of the font or QString::null * @return the style of the font */ QString OFontSelector::fontStyle() const { FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); int fst = d->m_font_style_list->currentItem(); return ( fli && fst >= 0 ) ? fli->styles() [fst] : QString::null; } /** * This method will return the font size or 10 if no font size is available */ int OFontSelector::fontSize() const { FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); int fsi = d->m_font_size_list->currentItem(); return ( fli && fsi >= 0 ) ? fli->sizes() [fsi] : 10; } /** * returns the charset of the font or QString::null */ QString OFontSelector::fontCharSet() const { FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); return fli ? d->m_fdb. charSets ( fli->family()) [0] : QString::null; } /** * Overloaded member function see above * @see selectedFont */ bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) { int ffa = d->m_font_family_list->currentItem(); diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp index b90c786..67b4b83 100644 --- a/libopie2/opieui/olistview.cpp +++ b/libopie2/opieui/olistview.cpp @@ -94,242 +94,244 @@ int OListView::addColumn( const QIconSet& iconset, const QString& label, int wid header()->setStretchEnabled( true, columns()-1 ); } #endif return result; } void OListView::removeColumn( int index ) { QListView::removeColumn(index); #if QT_VERSION > 290 if ( m_fullWidth && index == columns() ) { header()->setStretchEnabled( true, columns()-1 ); } #endif } const QColor& OListView::alternateBackground() const { return m_alternateBackground; } void OListView::setAlternateBackground( const QColor &c ) { m_alternateBackground = c; repaint(); } const QPen& OListView::columnSeparator() const { return m_columnSeparator; } void OListView::setColumnSeparator( const QPen& p ) { m_columnSeparator = p; repaint(); } void OListView::expand(QListViewItem *item) { ((OListViewItem*)item)->expand(); } OListViewItem* OListView::childFactory() { return new OListViewItem( this ); } #ifndef QT_NO_DATASTREAM void OListView::serializeTo( QDataStream& s ) const { #warning Caution... the binary format is still under construction... odebug << "storing OListView..." << oendl; // store number of columns and the labels s << columns(); for ( int i = 0; i < columns(); ++i ) s << columnText( i ); // calculate the number of top-level items to serialize int items = 0; QListViewItem* item = firstChild(); while ( item ) { item = item->nextSibling(); items++; } // store number of items and the items itself s << items; item = firstChild(); for ( int i = 0; i < items; ++i ) { s << *static_cast<OListViewItem*>( item ); item = item->nextSibling(); } odebug << "OListview stored." << oendl; } void OListView::serializeFrom( QDataStream& s ) { #warning Caution... the binary format is still under construction... 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; - odebug << "read text '" << coltext << "' for column " << i << "" << oendl; + 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; } odebug << "OListView loaded." << oendl; } void OListView::expand() { odebug << "OListView::expand" << oendl; QListViewItemIterator it( this ); while ( it.current() ) { it.current()->setOpen( true ); ++it; } } void OListView::collapse() { odebug << "OListView::collapse" << oendl; QListViewItemIterator it( this ); while ( it.current() ) { it.current()->setOpen( false ); ++it; } } QDataStream& operator<<( QDataStream& s, const OListView& lv ) { lv.serializeTo( s ); + return s; } QDataStream& operator>>( QDataStream& s, OListView& lv ) { lv.serializeFrom( s ); + return s; } #endif // QT_NO_DATASTREAM /*====================================================================================== * OListViewItem *======================================================================================*/ OListViewItem::OListViewItem(QListView *parent) : QListViewItem(parent) { init(); } OListViewItem::OListViewItem(QListViewItem *parent) : QListViewItem(parent) { init(); } OListViewItem::OListViewItem(QListView *parent, QListViewItem *after) : QListViewItem(parent, after) { init(); } OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after) : QListViewItem(parent, after) { init(); } OListViewItem::OListViewItem(QListView *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } OListViewItem::OListViewItem(QListViewItem *parent, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } OListViewItem::OListViewItem(QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } OListViewItem::OListViewItem(QListViewItem *parent, QListViewItem *after, QString label1, QString label2, QString label3, QString label4, QString label5, QString label6, QString label7, QString label8) : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) { init(); } OListViewItem::~OListViewItem() { } void OListViewItem::init() { m_known = false; } const QColor &OListViewItem::backgroundColor() { return isAlternate() ? static_cast<OListView*>(listView())->alternateBackground() : listView()->viewport()->colorGroup().base(); } bool OListViewItem::isAlternate() { OListView *lv = static_cast<OListView*>( listView() ); // check if the item above is an OListViewItem OListViewItem *above = static_cast<OListViewItem*>( itemAbove() ); /*if (! itemAbove()->inherits( "OListViewItem" )) return false;*/ @@ -349,416 +351,418 @@ bool OListViewItem::isAlternate() if (parent()) { item = static_cast<OListViewItem *>(parent()); if ( item /*&& item->inherits( "OListViewItem" )*/ ) previous = item->m_odd; item = static_cast<OListViewItem *>(parent()->firstChild()); /* if ( !item.inherits( "OListViewItem" ) item = 0; */ } else { item = static_cast<OListViewItem *>(lv->firstChild()); } while(item) { item->m_odd = previous = !previous; item->m_known = true; item = static_cast<OListViewItem *>(item->nextSibling()); /* if (!item.inherits( "OListViewItem" ) ) break; */ } } return m_odd; } void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) { QColorGroup _cg = cg; const QPixmap *pm = listView()->viewport()->backgroundPixmap(); if (pm && !pm->isNull()) { _cg.setBrush( QColorGroup::Base, QBrush(backgroundColor(), *pm) ); p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); } else if ( isAlternate() ) { _cg.setColor( QColorGroup::Base, static_cast<OListView*>( listView() )->alternateBackground() ); } QListViewItem::paintCell( p, _cg, column, width, alignment ); //FIXME: Use styling here! const QPen& pen = static_cast<OListView*>( listView() )->columnSeparator(); p->setPen( pen ); p->drawLine( width-1, 0, width-1, height() ); } OListViewItem* OListViewItem::childFactory() { return new OListViewItem( this ); } #ifndef QT_NO_DATASTREAM void OListViewItem::serializeTo( QDataStream& s ) const { #warning Caution... the binary format is still under construction... odebug << "storing OListViewItem..." << oendl; // store item text for ( int i = 0; i < listView()->columns(); ++i ) { s << text( i ); } // calculate the number of children to serialize int items = 0; QListViewItem* item = firstChild(); while ( item ) { item = item->nextSibling(); items++; } // store number of items and the items itself s << items; item = firstChild(); for ( int i = 0; i < items; ++i ) { s << *static_cast<OListViewItem*>( item ); item = item->nextSibling(); } odebug << "OListviewItem stored." << oendl; } 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; - odebug << "read text '" << coltext << "' for column " << i << "" << oendl; + odebug << "read text '" << coltext << "' for column " << i << "" << oendl; setText( i, coltext ); } int items; s >> items; - odebug << "read number of items = " << items << "" << oendl; + 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 ) { lvi.serializeTo( s ); + return s; } QDataStream& operator>>( QDataStream& s, OListViewItem& lvi ) { lvi.serializeFrom( s ); + return s; } #endif // QT_NO_DATASTREAM /*====================================================================================== * OCheckListItem *======================================================================================*/ OCheckListItem::OCheckListItem( QCheckListItem* parent, const QString& text, Type t ) :QCheckListItem( parent, text, t ) { init(); } OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, Type t) :QCheckListItem( parent, text, t ) { init(); } OCheckListItem::OCheckListItem( QListView* parent, const QString& text, Type t ) :QCheckListItem( parent, text, t ) { init(); } OCheckListItem::OCheckListItem( QListViewItem* parent, const QString& text, const QPixmap& p ) :QCheckListItem( parent, text, p ) { init(); } OCheckListItem::OCheckListItem( QListView* parent, const QString& text, const QPixmap& p ) :QCheckListItem( parent, text, p ) { init(); } OCheckListItem::~OCheckListItem() { } void OCheckListItem::init() { m_known = false; } const QColor &OCheckListItem::backgroundColor() { return isAlternate() ? static_cast<OListView*>(listView())->alternateBackground() : listView()->viewport()->colorGroup().base(); } bool OCheckListItem::isAlternate() { OListView *lv = static_cast<OListView*>( listView() ); // check if the item above is an OCheckListItem OCheckListItem *above = static_cast<OCheckListItem*>( itemAbove() ); /*if (! itemAbove()->inherits( "OCheckListItem" )) return false;*/ // check if we have a valid alternate background color if (!(lv && lv->alternateBackground().isValid())) return false; m_known = above ? above->m_known : true; if (m_known) { m_odd = above ? !above->m_odd : false; } else { OCheckListItem *item; bool previous = true; if (parent()) { item = static_cast<OCheckListItem *>(parent()); if ( item /*&& item->inherits( "OCheckListItem" )*/ ) previous = item->m_odd; item = static_cast<OCheckListItem *>(parent()->firstChild()); /* if ( !item.inherits( "OCheckListItem" ) item = 0; */ } else { item = static_cast<OCheckListItem *>(lv->firstChild()); } while(item) { item->m_odd = previous = !previous; item->m_known = true; item = static_cast<OCheckListItem *>(item->nextSibling()); /* if (!item.inherits( "OCheckListItem" ) ) break; */ } } return m_odd; } void OCheckListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) { QColorGroup _cg = cg; const QPixmap *pm = listView()->viewport()->backgroundPixmap(); if (pm && !pm->isNull()) { _cg.setBrush( QColorGroup::Base, QBrush(backgroundColor(), *pm) ); p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); } else if ( isAlternate() ) { _cg.setColor( QColorGroup::Base, static_cast<OListView*>( listView() )->alternateBackground() ); } QCheckListItem::paintCell( p, _cg, column, width, alignment ); //FIXME: Use styling here! const QPen& pen = static_cast<OListView*>( listView() )->columnSeparator(); p->setPen( pen ); p->drawLine( width-1, 0, width-1, height() ); } /*====================================================================================== * ONamedListView *======================================================================================*/ ONamedListView::ONamedListView( QWidget *parent, const char *name ) :OListView( parent, name ) { } ONamedListView::~ONamedListView() { } void ONamedListView::addColumns( const QStringList& columns ) { for ( QStringList::ConstIterator it = columns.begin(); it != columns.end(); ++it ) { - odebug << "adding column " << *it << "" << oendl; + 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 ) return i; return -1; } 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 ) { - odebug << "checked " << item->text( column ) << "" << oendl; + odebug << "checked " << item->text( column ) << "" << oendl; if ( recurse < 0 || recurse > 0 ) { - odebug << "recursion is " << recurse << " - recursing into..." << oendl; + 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; } ONamedListViewItem* ONamedListView::find( const QString& column, const QString& text, int recurse ) const { int col = findColumn( column ); if ( col != -1 ) return find( (ONamedListViewItem*) firstChild(), col, text, recurse ); else return 0; } ONamedListViewItem* ONamedListView::find( ONamedListViewItem* item, const QString& column, const QString& text, int recurse ) const { int col = findColumn( column ); if ( col != -1 ) return find( item, col, text, recurse ); else return 0; } /*====================================================================================== * ONamedListViewItem *======================================================================================*/ ONamedListViewItem::ONamedListViewItem( QListView* parent, const QStringList& texts ) :OListViewItem( parent ) { setText( texts ); } ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, const QStringList& texts ) :OListViewItem( parent ) { setText( texts ); } ONamedListViewItem::ONamedListViewItem( QListView* parent, QListViewItem* after, const QStringList& texts ) :OListViewItem( parent, after ) { setText( texts ); } ONamedListViewItem::ONamedListViewItem( QListViewItem* parent, QListViewItem* after, const QStringList& texts ) :OListViewItem( parent, after ) { setText( texts ); } ONamedListViewItem::~ONamedListViewItem() { } void ONamedListViewItem::setText( const QStringList& texts ) { int col = 0; for ( QStringList::ConstIterator it = texts.begin(); it != texts.end(); ++it ) { - odebug << "setting column " << col << " = text " << *it << "" << oendl; + 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 - owarn << "ONamedListViewItem::setText(): Warning! Columntext '" << column << "' not found." << oendl; + 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 ); if ( col != -1 ) return ( (ONamedListView*) listView() )->find( (ONamedListViewItem*) firstChild(), col, text, recurse ); else return 0; } } } diff --git a/libopie2/opieui/oselector.cpp b/libopie2/opieui/oselector.cpp index 5f6f10f..05543c5 100644 --- a/libopie2/opieui/oselector.cpp +++ b/libopie2/opieui/oselector.cpp @@ -53,192 +53,194 @@ OXYSelector::OXYSelector( QWidget *parent, const char *name ) OXYSelector::~OXYSelector() {} void OXYSelector::setRange( int _minX, int _minY, int _maxX, int _maxY ) { px = 2; py = 2; minX = _minX; minY = _minY; maxX = _maxX; maxY = _maxY; } void OXYSelector::setValues( int _xPos, int _yPos ) { xPos = _xPos; yPos = _yPos; if ( xPos > maxX ) xPos = maxX; else if ( xPos < minX ) xPos = minX; if ( yPos > maxY ) yPos = maxY; else if ( yPos < minY ) yPos = minY; int xp = 2 + (width() - 4) * xPos / (maxX - minX); int yp = height() - 2 - (height() - 4) * yPos / (maxY - minY); setPosition( xp, yp ); } QRect OXYSelector::contentsRect() const { return QRect( 2, 2, width()-4, height()-4 ); } void OXYSelector::paintEvent( QPaintEvent *ev ) { QRect cursorRect( px - STORE_W, py - STORE_W, STORE_W2, STORE_W2); QRect paintRect = ev->rect(); QPainter painter; painter.begin( this ); QBrush brush; qDrawShadePanel( &painter, 0, 0, width(), height(), colorGroup(), TRUE, 2, &brush ); drawContents( &painter ); if (paintRect.contains(cursorRect)) { bitBlt( &store, 0, 0, this, px - STORE_W, py - STORE_W, STORE_W2, STORE_W2, CopyROP ); drawCursor( &painter, px, py ); } else if (paintRect.intersects(cursorRect)) { repaint( cursorRect, false); } painter.end(); } void OXYSelector::mousePressEvent( QMouseEvent *e ) { int xVal, yVal; valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); setValues( xVal, yVal ); emit valueChanged( xPos, yPos ); } void OXYSelector::mouseMoveEvent( QMouseEvent *e ) { int xVal, yVal; valuesFromPosition( e->pos().x() - 2, e->pos().y() - 2, xVal, yVal ); setValues( xVal, yVal ); emit valueChanged( xPos, yPos ); } void OXYSelector::wheelEvent( QWheelEvent *e ) { #if QT_VERSION > 290 if ( e->orientation() == Qt::Horizontal ) setValues( xValue() + e->delta()/120, yValue() ); else setValues( xValue(), yValue() + e->delta()/120 ); emit valueChanged( xPos, yPos ); + #else + Q_UNUSED( e ) #endif } void OXYSelector::valuesFromPosition( int x, int y, int &xVal, int &yVal ) const { xVal = ( (maxX-minX) * (x-2) ) / ( width()-4 ); yVal = maxY - ( ( (maxY-minY) * (y-2) ) / ( height()-4 ) ); if ( xVal > maxX ) xVal = maxX; else if ( xVal < minX ) xVal = minX; if ( yVal > maxY ) yVal = maxY; else if ( yVal < minY ) yVal = minY; } void OXYSelector::setPosition( int xp, int yp ) { if ( xp < 2 ) xp = 2; else if ( xp > width() - 2 ) xp = width() - 2; if ( yp < 2 ) yp = 2; else if ( yp > height() - 2 ) yp = height() - 2; QPainter painter; painter.begin( this ); bitBlt( this, px - STORE_W, py - STORE_W, &store, 0, 0, STORE_W2, STORE_W2, CopyROP ); bitBlt( &store, 0, 0, this, xp - STORE_W, yp - STORE_W, STORE_W2, STORE_W2, CopyROP ); drawCursor( &painter, xp, yp ); px = xp; py = yp; painter.end(); } void OXYSelector::drawContents( QPainter * ) {} void OXYSelector::drawCursor( QPainter *p, int xp, int yp ) { p->setPen( QPen( white ) ); p->drawLine( xp - 6, yp - 6, xp - 2, yp - 2 ); p->drawLine( xp - 6, yp + 6, xp - 2, yp + 2 ); p->drawLine( xp + 6, yp - 6, xp + 2, yp - 2 ); p->drawLine( xp + 6, yp + 6, xp + 2, yp + 2 ); } //----------------------------------------------------------------------------- /* * 1D value selector with contents drawn by derived class. * See OColorDialog for example. */ OSelector::OSelector( QWidget *parent, const char *name ) : QWidget( parent, name ), QRangeControl() { _orientation = Horizontal; _indent = TRUE; } OSelector::OSelector( Orientation o, QWidget *parent, const char *name ) : QWidget( parent, name ), QRangeControl() { _orientation = o; _indent = TRUE; } OSelector::~OSelector() {} QRect OSelector::contentsRect() const { if ( orientation() == Vertical ) return QRect( 2, 5, width()-9, height()-10 ); else return QRect( 5, 2, width()-10, height()-9 ); } void OSelector::paintEvent( QPaintEvent * ) { QPainter painter; diff --git a/libopie2/opieui/owait.cpp b/libopie2/opieui/owait.cpp index 9519888..ec1f25a 100644 --- a/libopie2/opieui/owait.cpp +++ b/libopie2/opieui/owait.cpp @@ -1,112 +1,113 @@ /* This file is part of the Opie Project Copyright (C) 2003 Maximilian Reiss <harlekin@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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. */ #include "owait.h" /* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/resource.h> /* QT */ #include <qlayout.h> #include <qpainter.h> using namespace Opie::Ui; static int frame = 0; /** * This will construct a modal dialog. * * The default timer length is 10. * * @param parent The parent of the widget * @param msg The name of the object * @param dispIcon Display Icon? */ OWait::OWait( QWidget *parent, const char* msg, bool dispIcon ) :QDialog( parent, msg, TRUE, WStyle_Customize ) { + Q_UNUSED( dispIcon ) QHBoxLayout * hbox = new QHBoxLayout( this ); m_lb = new QLabel( this ); m_lb->setBackgroundMode ( NoBackground ); hbox->addWidget( m_lb ); hbox->activate(); m_pix = Resource::loadPixmap( "BigBusy" ); m_aniSize = m_pix.height(); resize( m_aniSize, m_aniSize ); m_timerLength = 10; m_waitTimer = new QTimer( this ); connect( m_waitTimer, SIGNAL( timeout() ), this, SLOT( hide() ) ); } void OWait::timerEvent( QTimerEvent * ) { frame = ( ++frame ) % 4; repaint(); } void OWait::paintEvent( QPaintEvent * ) { QPainter p( m_lb ); p.drawPixmap( 0, 0, m_pix, m_aniSize * frame, 0, m_aniSize, m_aniSize ); } void OWait::show() { move( ( ( qApp->desktop() ->width() ) / 2 ) - ( m_aniSize / 2 ), ( ( qApp->desktop() ->height() ) / 2 ) - ( m_aniSize / 2 ) ); startTimer( 300 ); m_waitTimer->start( m_timerLength * 1000, true ); QDialog::show(); } void OWait::hide() { killTimers(); m_waitTimer->stop(); frame = 0; QDialog::hide(); } void OWait::setTimerLength( int length ) { m_timerLength = length; } OWait::~OWait() {} |