-rw-r--r-- | libopie2/opieui/oversatileview.cpp | 152 | ||||
-rw-r--r-- | libopie2/opieui/oversatileviewitem.cpp | 2 |
2 files changed, 77 insertions, 77 deletions
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp index 32855be..6808539 100644 --- a/libopie2/opieui/oversatileview.cpp +++ b/libopie2/opieui/oversatileview.cpp @@ -228,65 +228,65 @@ OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) connect( _listview, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( collapsed( QListViewItem * ) ) ); // iconview only signals connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); } OVersatileView::~OVersatileView() { } QPopupMenu* OVersatileView::contextMenu() const { return _contextmenu; } void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) { // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, // do not inherit from QObject - assuming here the programmer is // disciplined enough to only add OVersatileViewItems to an OVersatileView popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); } void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) { // see above popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); } void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) { - if ( not item ) + if ( !item ) _contextmenu->exec( pos ); else emit( contextMenuRequested( item, pos, col ) ); } void OVersatileView::setSynchronization( bool sync ) { _synchronization = sync; } bool OVersatileView::synchronization() { return _synchronization; } void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) { if ( mode == Tree ) { _treeleaf = leaf; _treeopened = opened; _treeclosed = closed; } else if ( mode == Icons ) { _iconleaf = leaf; _iconopened = opened; _iconclosed = closed; } else { qDebug( "OVersatileView::setDefaultPixmaps(): invalid mode" ); @@ -420,686 +420,686 @@ void OVersatileView::doubleClicked( QListViewItem * item ) { emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::doubleClicked( QIconViewItem * item ) { emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::returnPressed( QListViewItem * item ) { emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::returnPressed( QIconViewItem * item ) { emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::onItem( QListViewItem * item ) { emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::onItem( QIconViewItem * item ) { emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::expanded( QListViewItem *item ) // QListView { //qDebug( "OVersatileView::expanded(): opening tree..." ); - if ( not _treeopened.isNull() ) + if ( !_treeopened.isNull() ) item->setPixmap( 0, _treeopened ); emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::collapsed( QListViewItem *item ) // QListView { - if ( not _treeclosed.isNull() ) + if ( !_treeclosed.isNull() ) item->setPixmap( 0, _treeclosed ); emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); } //=============================================================================================// // OVersatileView Case I - API only existing in QListView or QIconView but not in both! //==============================================================================================// int OVersatileView::treeStepSize() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->treeStepSize(); } void OVersatileView::setTreeStepSize( int size ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setTreeStepSize( size ); } QHeader * OVersatileView::header() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return 0; } return _listview->header(); } int OVersatileView::addColumn( const QString &label, int size ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->addColumn( label, size ); } - + int OVersatileView::addColumn( const QIconSet& iconset, const QString &label, int size ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->addColumn( iconset, label, size ); } void OVersatileView::removeColumn( int index ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->removeColumn( index ); } void OVersatileView::setColumnText( int column, const QString &label ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setColumnText( column, label ); } void OVersatileView::setColumnText( int column, const QIconSet& iconset, const QString &label ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setColumnText( column, iconset, label ); } QString OVersatileView::columnText( int column ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return QString::null; } return _listview->columnText( column ); } void OVersatileView::setColumnWidth( int column, int width ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setColumnWidth( column, width ); } int OVersatileView::columnWidth( int column ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->columnWidth( column ); } void OVersatileView::setColumnWidthMode( int column, WidthMode mode ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setColumnWidth( column, mode ); } int OVersatileView::columns() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->columns(); } void OVersatileView::setColumnAlignment( int column, int align ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setColumnAlignment( column, align ); } int OVersatileView::columnAlignment( int column ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->columnAlignment( column ); } OVersatileViewItem * OVersatileView::itemAt( const QPoint & screenPos ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return 0; } return static_cast<OVersatileViewItem*>( _listview->itemAt( screenPos ) ); } QRect OVersatileView::itemRect( const OVersatileViewItem * item ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return QRect( -1, -1, -1, -1 ); } return _listview->itemRect( item ); } int OVersatileView::itemPos( const OVersatileViewItem * item ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->itemPos( item ); } bool OVersatileView::isSelected( const OVersatileViewItem * item ) const // QListView // also in QIconViewItem but !in QIconView *shrug* { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return false; } return _listview->isSelected( item ); } void OVersatileView::setMultiSelection( bool enable ) { _listview->setMultiSelection( enable ); } bool OVersatileView::isMultiSelection() const { return _listview->isMultiSelection(); } OVersatileViewItem * OVersatileView::selectedItem() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return 0; } return static_cast<OVersatileViewItem*>( _listview->selectedItem() ); } void OVersatileView::setOpen( OVersatileViewItem * item, bool open ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setOpen( item, open ); } bool OVersatileView::isOpen( const OVersatileViewItem * item ) const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return false; } return _listview->isOpen( item ); } OVersatileViewItem * OVersatileView::firstChild() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return 0; } return static_cast<OVersatileViewItem*>( _listview->firstChild() ); } int OVersatileView::childCount() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->childCount(); } void OVersatileView::setAllColumnsShowFocus( bool focus ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setAllColumnsShowFocus( focus ); } bool OVersatileView::allColumnsShowFocus() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return false; } return _listview->allColumnsShowFocus(); } void OVersatileView::setItemMargin( int margin ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setItemMargin( margin ); } int OVersatileView::itemMargin() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->itemMargin(); } void OVersatileView::setRootIsDecorated( bool decorate ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setRootIsDecorated( decorate ); } bool OVersatileView::rootIsDecorated() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return false; } return _listview->rootIsDecorated(); } void OVersatileView::setShowSortIndicator( bool show ) // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->setShowSortIndicator( show ); } bool OVersatileView::showSortIndicator() const // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return false; } return _listview->showSortIndicator(); } void OVersatileView::triggerUpdate() // QListView { - if ( not isValidViewMode( Tree ) ) + if ( !isValidViewMode( Tree ) ) { return; } _listview->triggerUpdate(); } // // only in QIconView // uint OVersatileView::count() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return _iconview->count(); } int OVersatileView::index( const OVersatileViewItem *item ) const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->index( item ); } OVersatileViewItem* OVersatileView::firstItem() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->firstItem() ); } OVersatileViewItem* OVersatileView::lastItem() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->lastItem() ); } OVersatileViewItem* OVersatileView::findItem( const QPoint &pos ) const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->findItem( pos ) ); } OVersatileViewItem* OVersatileView::findItem( const QString &text ) const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->findItem( text ) ); } OVersatileViewItem* OVersatileView::findFirstVisibleItem( const QRect &r ) const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->findFirstVisibleItem( r ) ); } OVersatileViewItem* OVersatileView::findLastVisibleItem( const QRect &r ) const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return 0; } return static_cast<OVersatileViewItem*>( _iconview->findLastVisibleItem( r ) ); } void OVersatileView::setGridX( int rx ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setGridX( rx ); } void OVersatileView::setGridY( int ry ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setGridY( ry ); } int OVersatileView::gridX() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->gridX(); } int OVersatileView::gridY() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->gridY(); } void OVersatileView::setSpacing( int sp ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setSpacing( sp ); } int OVersatileView::spacing() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->spacing(); } void OVersatileView::setItemTextPos( QIconView::ItemTextPos pos ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setItemTextPos( pos ); } QIconView::ItemTextPos OVersatileView::itemTextPos() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return (QIconView::ItemTextPos) -1; } return _iconview->itemTextPos(); } void OVersatileView::setItemTextBackground( const QBrush &b ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setItemTextBackground( b ); } QBrush OVersatileView::itemTextBackground() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return QBrush(); } return _iconview->itemTextBackground(); } void OVersatileView::setArrangement( QIconView::Arrangement am ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setArrangement( am ); } QIconView::Arrangement OVersatileView::arrangement() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return (QIconView::Arrangement) -1; } return _iconview->arrangement(); } void OVersatileView::setResizeMode( QIconView::ResizeMode am ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setResizeMode( am ); } QIconView::ResizeMode OVersatileView::resizeMode() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return (QIconView::ResizeMode) -1; } return _iconview->resizeMode(); } void OVersatileView::setMaxItemWidth( int w ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setMaxItemWidth( w ); } int OVersatileView::maxItemWidth() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->maxItemWidth(); } void OVersatileView::setMaxItemTextLength( int w ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setMaxItemTextLength( w ); } int OVersatileView::maxItemTextLength() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return -1; } return _iconview->maxItemTextLength(); } void OVersatileView::setAutoArrange( bool b ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setAutoArrange( b ); } bool OVersatileView::autoArrange() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->autoArrange(); } void OVersatileView::setShowToolTips( bool b ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setShowToolTips( b ); } bool OVersatileView::showToolTips() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->showToolTips(); } bool OVersatileView::sorting() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->sorting(); } bool OVersatileView::sortDirection() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->sortDirection(); } void OVersatileView::setItemsMovable( bool b ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setItemsMovable( b ); } bool OVersatileView::itemsMovable() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->itemsMovable(); } void OVersatileView::setWordWrapIconText( bool b ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->setWordWrapIconText( b ); } bool OVersatileView::wordWrapIconText() const // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return false; } return _iconview->wordWrapIconText(); } void OVersatileView::arrangeItemsInGrid( const QSize &grid, bool update ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->arrangeItemsInGrid( grid, update ); } void OVersatileView::arrangeItemsInGrid( bool update ) // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->arrangeItemsInGrid( update ); } void OVersatileView::updateContents() // QIconView { - if ( not isValidViewMode( Icons ) ) + if ( !isValidViewMode( Icons ) ) { return; } _iconview->updateContents(); } //==============================================================================================// // OVersatileView Case II - QListView / QIconView common API //==============================================================================================// void OVersatileView::clear() { _iconview->clear(); _listview->clear(); } void OVersatileView::setFont( const QFont & font ) { _iconview->setFont( font ); _listview->setFont( font ); } void OVersatileView::setPalette( const QPalette & palette ) { _iconview->setPalette( palette ); _listview->setPalette( palette ); } void OVersatileView::takeItem( OVersatileViewItem * item ) { _iconview->takeItem( item ); _listview->takeItem( item ); } diff --git a/libopie2/opieui/oversatileviewitem.cpp b/libopie2/opieui/oversatileviewitem.cpp index 379ce24..66de8eb 100644 --- a/libopie2/opieui/oversatileviewitem.cpp +++ b/libopie2/opieui/oversatileviewitem.cpp @@ -67,65 +67,65 @@ OVersatileViewItem::OVersatileViewItem( OVersatileView * parent, OVersatileViewI OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, QString a, QString b, QString c, QString d, QString e, QString f, QString g, QString h ) :OListViewItem( parent, a, b, c, d, e, f, g, h ), QIconViewItem( parent->_versatileview->_iconview, a ), _versatileview( parent->_versatileview ) { init(); } OVersatileViewItem::OVersatileViewItem( OVersatileViewItem * parent, OVersatileViewItem* after, QString a, QString b, QString c, QString d, QString e, QString f, QString g, QString h ) :OListViewItem( parent, after, a, b, c, d, e, f, g, h ), QIconViewItem( parent->_versatileview->_iconview, after, a ), _versatileview( parent->_versatileview ) { init(); } OVersatileViewItem::~OVersatileViewItem() { } OVersatileView* OVersatileViewItem::versatileView() const { return _versatileview; } void OVersatileViewItem::init() { - if ( not firstChild() ) + if ( !firstChild() ) { // I'm a sweet yellow and browne autumn leaf OListViewItem::setPixmap( 0, _versatileview->_treeleaf ); QIconViewItem::setPixmap( _versatileview->_iconleaf ); } else { // I'm a node and I have a little baby child if ( isOpen() ) { OListViewItem::setPixmap( 0, _versatileview->_treeopened ); QIconViewItem::setPixmap( _versatileview->_iconopened ); } else { OListViewItem::setPixmap( 0, _versatileview->_treeclosed ); QIconViewItem::setPixmap( _versatileview->_iconclosed ); } } } void OVersatileViewItem::setRenameEnabled( bool allow ) { #if (QT_VERSION >= 0x030000) OListViewItem::setRenameEnabled( 0, allow ); // TODO: Backport to Qt-Embedded 2.x? #endif QIconViewItem::setRenameEnabled( allow ); } |