author | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
commit | f180c1a5e8fc889ff1fb390d5cc94cdbc5085046 (patch) (unidiff) | |
tree | 5e9ea6f1313f4c33d57fb266523c1cfbe0826756 /core/multimedia/opieplayer/playlistselection.cpp | |
parent | c0446b55fc32b7fdea9f58db06e40da703f5e8ff (diff) | |
download | opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.zip opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.gz opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.bz2 |
fucked up- no workie.. back out
Diffstat (limited to 'core/multimedia/opieplayer/playlistselection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index f17ab6f..a82b594 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp | |||
@@ -1,7 +1,7 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
@@ -30,12 +30,11 @@ | |||
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | 32 | ||
33 | |||
34 | class PlayListSelectionItem : public QListViewItem { | 33 | class PlayListSelectionItem : public QListViewItem { |
35 | public: | 34 | public: |
36 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { | 35 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { |
37 | setText( 0, f->name() ); | 36 | setText( 0, f->name() ); |
38 | setPixmap( 0, f->pixmap() ); | 37 | setPixmap( 0, f->pixmap() ); |
39 | } | 38 | } |
40 | 39 | ||
41 | ~PlayListSelectionItem() { | 40 | ~PlayListSelectionItem() { |
@@ -71,19 +70,19 @@ void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | |||
71 | p->fillRect( r, QBrush( white ) ); | 70 | p->fillRect( r, QBrush( white ) ); |
72 | QImage logo = Resource::loadImage( "mpegplayer/background" ); | 71 | QImage logo = Resource::loadImage( "mpegplayer/background" ); |
73 | if ( !logo.isNull() ) | 72 | if ( !logo.isNull() ) |
74 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 73 | p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
75 | } | 74 | } |
76 | #endif | 75 | #endif |
77 | 76 | ||
78 | 77 | ||
79 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 78 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
80 | if ( event->state() == QMouseEvent::LeftButton ) { | 79 | if ( event->state() == QMouseEvent::LeftButton ) { |
81 | QListViewItem *currentItem = selectedItem(); | 80 | QListViewItem *currentItem = selectedItem(); |
82 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 81 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
83 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 82 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
84 | moveSelectedUp(); | 83 | moveSelectedUp(); |
85 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 84 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
86 | moveSelectedDown(); | 85 | moveSelectedDown(); |
87 | } | 86 | } |
88 | } | 87 | } |
89 | 88 | ||
@@ -91,13 +90,13 @@ void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | |||
91 | const DocLnk *PlayListSelection::current() { | 90 | const DocLnk *PlayListSelection::current() { |
92 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 91 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
93 | if ( item ) | 92 | if ( item ) |
94 | return item->file(); | 93 | return item->file(); |
95 | return NULL; | 94 | return NULL; |
96 | } | 95 | } |
97 | 96 | ||
98 | 97 | ||
99 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { | 98 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { |
100 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); | 99 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); |
101 | QListViewItem *current = selectedItem(); | 100 | QListViewItem *current = selectedItem(); |
102 | if ( current ) | 101 | if ( current ) |
103 | item->moveItem( current ); | 102 | item->moveItem( current ); |
@@ -109,7 +108,7 @@ void PlayListSelection::addToSelection( const DocLnk &lnk ) { | |||
109 | void PlayListSelection::removeSelected() { | 108 | void PlayListSelection::removeSelected() { |
110 | QListViewItem *item = selectedItem(); | 109 | QListViewItem *item = selectedItem(); |
111 | if ( item ) | 110 | if ( item ) |
112 | delete item; | 111 | delete item; |
113 | setSelected( currentItem(), TRUE ); | 112 | setSelected( currentItem(), TRUE ); |
114 | ensureItemVisible( selectedItem() ); | 113 | ensureItemVisible( selectedItem() ); |
115 | } | 114 | } |
@@ -118,7 +117,7 @@ void PlayListSelection::removeSelected() { | |||
118 | void PlayListSelection::moveSelectedUp() { | 117 | void PlayListSelection::moveSelectedUp() { |
119 | QListViewItem *item = selectedItem(); | 118 | QListViewItem *item = selectedItem(); |
120 | if ( item && item->itemAbove() ) | 119 | if ( item && item->itemAbove() ) |
121 | item->itemAbove()->moveItem( item ); | 120 | item->itemAbove()->moveItem( item ); |
122 | ensureItemVisible( selectedItem() ); | 121 | ensureItemVisible( selectedItem() ); |
123 | } | 122 | } |
124 | 123 | ||
@@ -136,7 +135,7 @@ bool PlayListSelection::prev() { | |||
136 | if ( item && item->itemAbove() ) | 135 | if ( item && item->itemAbove() ) |
137 | setSelected( item->itemAbove(), TRUE ); | 136 | setSelected( item->itemAbove(), TRUE ); |
138 | else | 137 | else |
139 | return FALSE; | 138 | return FALSE; |
140 | ensureItemVisible( selectedItem() ); | 139 | ensureItemVisible( selectedItem() ); |
141 | return TRUE; | 140 | return TRUE; |
142 | } | 141 | } |
@@ -147,7 +146,7 @@ bool PlayListSelection::next() { | |||
147 | if ( item && item->itemBelow() ) | 146 | if ( item && item->itemBelow() ) |
148 | setSelected( item->itemBelow(), TRUE ); | 147 | setSelected( item->itemBelow(), TRUE ); |
149 | else | 148 | else |
150 | return FALSE; | 149 | return FALSE; |
151 | ensureItemVisible( selectedItem() ); | 150 | ensureItemVisible( selectedItem() ); |
152 | return TRUE; | 151 | return TRUE; |
153 | } | 152 | } |
@@ -158,7 +157,7 @@ bool PlayListSelection::first() { | |||
158 | if ( item ) | 157 | if ( item ) |
159 | setSelected( item, TRUE ); | 158 | setSelected( item, TRUE ); |
160 | else | 159 | else |
161 | return FALSE; | 160 | return FALSE; |
162 | ensureItemVisible( selectedItem() ); | 161 | ensureItemVisible( selectedItem() ); |
163 | return TRUE; | 162 | return TRUE; |
164 | } | 163 | } |
@@ -168,11 +167,11 @@ bool PlayListSelection::last() { | |||
168 | QListViewItem *prevItem = NULL; | 167 | QListViewItem *prevItem = NULL; |
169 | QListViewItem *item = firstChild(); | 168 | QListViewItem *item = firstChild(); |
170 | while ( ( item = item->nextSibling() ) ) | 169 | while ( ( item = item->nextSibling() ) ) |
171 | prevItem = item; | 170 | prevItem = item; |
172 | if ( prevItem ) | 171 | if ( prevItem ) |
173 | setSelected( prevItem, TRUE ); | 172 | setSelected( prevItem, TRUE ); |
174 | else | 173 | else |
175 | return FALSE; | 174 | return FALSE; |
176 | ensureItemVisible( selectedItem() ); | 175 | ensureItemVisible( selectedItem() ); |
177 | return TRUE; | 176 | return TRUE; |
178 | } | 177 | } |