author | llornkcor <llornkcor> | 2003-06-12 03:15:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-06-12 03:15:06 (UTC) |
commit | d5fb55632847e18026506af6b482c2cd3def3222 (patch) (unidiff) | |
tree | d2d5a3b1d4c3882f51c979562b35a44f021154f5 /core | |
parent | f0fab7d044feb2fe7f6a8c2a8d41653e1a17a538 (diff) | |
download | opie-d5fb55632847e18026506af6b482c2cd3def3222.zip opie-d5fb55632847e18026506af6b482c2cd3def3222.tar.gz opie-d5fb55632847e18026506af6b482c2cd3def3222.tar.bz2 |
compile
-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.cpp | 28 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/playlistselection.h | 2 |
2 files changed, 15 insertions, 15 deletions
diff --git a/core/apps/embeddedkonsole/playlistselection.cpp b/core/apps/embeddedkonsole/playlistselection.cpp index b9b9401..4dd3126 100644 --- a/core/apps/embeddedkonsole/playlistselection.cpp +++ b/core/apps/embeddedkonsole/playlistselection.cpp | |||
@@ -42,38 +42,38 @@ PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | |||
42 | header()->hide(); | 42 | header()->hide(); |
43 | setSorting( -1, FALSE ); | 43 | setSorting( -1, FALSE ); |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | PlayListSelection::~PlayListSelection() { | 47 | PlayListSelection::~PlayListSelection() { |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
52 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 52 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
53 | if ( event->state() == QMouseEvent::LeftButton ) { | 53 | if ( event->state() == QMouseEvent::LeftButton ) { |
54 | QListViewItem *currentItem = selectedItem(); | 54 | QListViewItem *currentItem = selectedItem(); |
55 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 55 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
56 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 56 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
57 | moveSelectedUp(); | 57 | moveSelectedUp(); |
58 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 58 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
59 | moveSelectedDown(); | 59 | moveSelectedDown(); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | const QString *PlayListSelection::current() { | 64 | const QString *PlayListSelection::current() { |
65 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 65 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
66 | if ( item ) | 66 | if ( item ) |
67 | return item->file(); | 67 | return item->file(); |
68 | return NULL; | 68 | return NULL; |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { | 72 | void PlayListSelection::addToSelection( QListViewItem *lnk ) { |
73 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); | 73 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk->text(0) ) ); |
74 | QListViewItem *current = selectedItem(); | 74 | QListViewItem *current = selectedItem(); |
75 | if ( current ) | 75 | if ( current ) |
76 | item->moveItem( current ); | 76 | item->moveItem( current ); |
77 | setSelected( item, TRUE ); | 77 | setSelected( item, TRUE ); |
78 | ensureItemVisible( selectedItem() ); | 78 | ensureItemVisible( selectedItem() ); |
79 | } | 79 | } |
@@ -82,80 +82,80 @@ void PlayListSelection::addStringToSelection (const QString & lnk) { | |||
82 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) ); | 82 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new QString( lnk ) ); |
83 | QListViewItem *current = selectedItem(); | 83 | QListViewItem *current = selectedItem(); |
84 | if ( current ) | 84 | if ( current ) |
85 | item->moveItem( current ); | 85 | item->moveItem( current ); |
86 | setSelected( item, TRUE ); | 86 | setSelected( item, TRUE ); |
87 | ensureItemVisible( selectedItem() ); | 87 | ensureItemVisible( selectedItem() ); |
88 | 88 | ||
89 | } | 89 | } |
90 | void PlayListSelection::removeSelected() { | 90 | void PlayListSelection::removeSelected() { |
91 | qDebug("removeSelected()"); | 91 | qDebug("removeSelected()"); |
92 | QListViewItem *item = selectedItem(); | 92 | QListViewItem *item = selectedItem(); |
93 | if ( item ) | 93 | if ( item ) |
94 | delete item; | 94 | delete item; |
95 | setSelected( currentItem(), TRUE ); | 95 | setSelected( currentItem(), TRUE ); |
96 | ensureItemVisible( selectedItem() ); | 96 | ensureItemVisible( selectedItem() ); |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | void PlayListSelection::moveSelectedUp() { | 100 | void PlayListSelection::moveSelectedUp() { |
101 | QListViewItem *item = selectedItem(); | 101 | QListViewItem *item = selectedItem(); |
102 | if ( item && item->itemAbove() ) | 102 | if ( item && item->itemAbove() ) |
103 | item->itemAbove()->moveItem( item ); | 103 | item->itemAbove()->moveItem( item ); |
104 | ensureItemVisible( selectedItem() ); | 104 | ensureItemVisible( selectedItem() ); |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void PlayListSelection::moveSelectedDown() { | 108 | void PlayListSelection::moveSelectedDown() { |
109 | QListViewItem *item = selectedItem(); | 109 | QListViewItem *item = selectedItem(); |
110 | if ( item && item->itemBelow() ) | 110 | if ( item && item->itemBelow() ) |
111 | item->moveItem( item->itemBelow() ); | 111 | item->moveItem( item->itemBelow() ); |
112 | ensureItemVisible( selectedItem() ); | 112 | ensureItemVisible( selectedItem() ); |
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | bool PlayListSelection::prev() { | 116 | bool PlayListSelection::prev() { |
117 | QListViewItem *item = selectedItem(); | 117 | QListViewItem *item = selectedItem(); |
118 | if ( item && item->itemAbove() ) | 118 | if ( item && item->itemAbove() ) |
119 | setSelected( item->itemAbove(), TRUE ); | 119 | setSelected( item->itemAbove(), TRUE ); |
120 | else | 120 | else |
121 | return FALSE; | 121 | return FALSE; |
122 | ensureItemVisible( selectedItem() ); | 122 | ensureItemVisible( selectedItem() ); |
123 | return TRUE; | 123 | return TRUE; |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | bool PlayListSelection::next() { | 127 | bool PlayListSelection::next() { |
128 | QListViewItem *item = selectedItem(); | 128 | QListViewItem *item = selectedItem(); |
129 | if ( item && item->itemBelow() ) | 129 | if ( item && item->itemBelow() ) |
130 | setSelected( item->itemBelow(), TRUE ); | 130 | setSelected( item->itemBelow(), TRUE ); |
131 | else | 131 | else |
132 | return FALSE; | 132 | return FALSE; |
133 | ensureItemVisible( selectedItem() ); | 133 | ensureItemVisible( selectedItem() ); |
134 | return TRUE; | 134 | return TRUE; |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | bool PlayListSelection::first() { | 138 | bool PlayListSelection::first() { |
139 | QListViewItem *item = firstChild(); | 139 | QListViewItem *item = firstChild(); |
140 | if ( item ) | 140 | if ( item ) |
141 | setSelected( item, TRUE ); | 141 | setSelected( item, TRUE ); |
142 | else | 142 | else |
143 | return FALSE; | 143 | return FALSE; |
144 | ensureItemVisible( selectedItem() ); | 144 | ensureItemVisible( selectedItem() ); |
145 | return TRUE; | 145 | return TRUE; |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | bool PlayListSelection::last() { | 149 | bool PlayListSelection::last() { |
150 | QListViewItem *prevItem = NULL; | 150 | QListViewItem *prevItem = NULL; |
151 | QListViewItem *item = firstChild(); | 151 | QListViewItem *item = firstChild(); |
152 | while ( ( item = item->nextSibling() ) ) | 152 | while ( ( item = item->nextSibling() ) ) |
153 | prevItem = item; | 153 | prevItem = item; |
154 | if ( prevItem ) | 154 | if ( prevItem ) |
155 | setSelected( prevItem, TRUE ); | 155 | setSelected( prevItem, TRUE ); |
156 | else | 156 | else |
157 | return FALSE; | 157 | return FALSE; |
158 | ensureItemVisible( selectedItem() ); | 158 | ensureItemVisible( selectedItem() ); |
159 | return TRUE; | 159 | return TRUE; |
160 | } | 160 | } |
161 | 161 | ||
diff --git a/core/apps/embeddedkonsole/playlistselection.h b/core/apps/embeddedkonsole/playlistselection.h index c307f14..f340124 100644 --- a/core/apps/embeddedkonsole/playlistselection.h +++ b/core/apps/embeddedkonsole/playlistselection.h | |||
@@ -19,25 +19,25 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef PLAY_LIST_SELECTION_H | 20 | #ifndef PLAY_LIST_SELECTION_H |
21 | #define PLAY_LIST_SELECTION_H | 21 | #define PLAY_LIST_SELECTION_H |
22 | 22 | ||
23 | 23 | ||
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | #include <qpe/applnk.h> | 26 | #include <qpe/applnk.h> |
27 | 27 | ||
28 | class PlayListSelectionItem : public QListViewItem { | 28 | class PlayListSelectionItem : public QListViewItem { |
29 | public: | 29 | public: |
30 | PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) { | 30 | PlayListSelectionItem( QListView *parent, QString *f ) : QListViewItem( parent ), fl( f ) { |
31 | setText(0, *f ); | 31 | setText(0, *f ); |
32 | } | 32 | } |
33 | 33 | ||
34 | ~PlayListSelectionItem() { | 34 | ~PlayListSelectionItem() { |
35 | }; | 35 | }; |
36 | 36 | ||
37 | const QString *file() const { return fl; } | 37 | const QString *file() const { return fl; } |
38 | 38 | ||
39 | private: | 39 | private: |
40 | const QString *fl; | 40 | const QString *fl; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | class PlayListSelection : public QListView { | 43 | class PlayListSelection : public QListView { |