author | simon <simon> | 2002-12-03 16:56:35 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-03 16:56:35 (UTC) |
commit | 6759138a8d4d6fdd16838511c099c6d7ec03a54f (patch) (unidiff) | |
tree | 90026f799c34ab93d7c0297c7ac287bb5750baf4 | |
parent | b92f6e69e5c243363c0f285dcf1f0d47bbc2cc17 (diff) | |
download | opie-6759138a8d4d6fdd16838511c099c6d7ec03a54f.zip opie-6759138a8d4d6fdd16838511c099c6d7ec03a54f.tar.gz opie-6759138a8d4d6fdd16838511c099c6d7ec03a54f.tar.bz2 |
- removing ten lines of duplicated code
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 20 |
2 files changed, 10 insertions, 20 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp index bdd38e0..c4f93e7 100644 --- a/noncore/multimedia/opieplayer2/playlistfileview.cpp +++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp | |||
@@ -1,14 +1,24 @@ | |||
1 | 1 | ||
2 | #include "playlistfileview.h" | 2 | #include "playlistfileview.h" |
3 | 3 | ||
4 | PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) | 4 | PlayListFileView::PlayListFileView( QWidget *parent, const char *name ) |
5 | : PlayListView( parent, name ) | 5 | : PlayListView( parent, name ) |
6 | { | 6 | { |
7 | addColumn( tr( "Title" ), 140); | ||
8 | addColumn( tr( "Size" ), -1 ); | ||
9 | addColumn(tr( "Media" ), 0 ); | ||
10 | addColumn(tr( "Path" ), -1 ); | ||
11 | setColumnAlignment( 1, Qt::AlignRight ); | ||
12 | setColumnAlignment( 2, Qt::AlignRight ); | ||
13 | setAllColumnsShowFocus( TRUE ); | ||
14 | setSorting( 3, TRUE ); | ||
15 | setMultiSelection( TRUE ); | ||
16 | setSelectionMode( QListView::Extended ); | ||
7 | } | 17 | } |
8 | 18 | ||
9 | PlayListFileView::~PlayListFileView() | 19 | PlayListFileView::~PlayListFileView() |
10 | { | 20 | { |
11 | } | 21 | } |
12 | 22 | ||
13 | /* vim: et sw=4 ts=4 | 23 | /* vim: et sw=4 ts=4 |
14 | */ | 24 | */ |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index de7b6d5..cfca5e3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -90,138 +90,118 @@ PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidg | |||
90 | menu->insertItem( tr( "File" ), pmPlayList ); | 90 | menu->insertItem( tr( "File" ), pmPlayList ); |
91 | 91 | ||
92 | pmView = new QPopupMenu( this ); | 92 | pmView = new QPopupMenu( this ); |
93 | menu->insertItem( tr( "View" ), pmView ); | 93 | menu->insertItem( tr( "View" ), pmView ); |
94 | pmView->isCheckable(); | 94 | pmView->isCheckable(); |
95 | 95 | ||
96 | skinsMenu = new QPopupMenu( this ); | 96 | skinsMenu = new QPopupMenu( this ); |
97 | pmView->insertItem( tr( "Skins" ), skinsMenu ); | 97 | pmView->insertItem( tr( "Skins" ), skinsMenu ); |
98 | skinsMenu->isCheckable(); | 98 | skinsMenu->isCheckable(); |
99 | 99 | ||
100 | gammaMenu = new QPopupMenu( this ); | 100 | gammaMenu = new QPopupMenu( this ); |
101 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); | 101 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); |
102 | 102 | ||
103 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); | 103 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); |
104 | gammaSlider->setRange( -40, 40 ); | 104 | gammaSlider->setRange( -40, 40 ); |
105 | gammaSlider->setTickmarks( QSlider::Left ); | 105 | gammaSlider->setTickmarks( QSlider::Left ); |
106 | gammaSlider->setTickInterval( 20 ); | 106 | gammaSlider->setTickInterval( 20 ); |
107 | gammaSlider->setFocusPolicy( QWidget::StrongFocus ); | 107 | gammaSlider->setFocusPolicy( QWidget::StrongFocus ); |
108 | gammaSlider->setValue( 0 ); | 108 | gammaSlider->setValue( 0 ); |
109 | gammaSlider->setMinimumHeight( 50 ); | 109 | gammaSlider->setMinimumHeight( 50 ); |
110 | 110 | ||
111 | gammaLCD = new QLCDNumber( 3, gammaMenu ); | 111 | gammaLCD = new QLCDNumber( 3, gammaMenu ); |
112 | gammaLCD-> setFrameShape ( QFrame::NoFrame ); | 112 | gammaLCD-> setFrameShape ( QFrame::NoFrame ); |
113 | gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); | 113 | gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); |
114 | 114 | ||
115 | gammaMenu->insertItem( gammaSlider ); | 115 | gammaMenu->insertItem( gammaSlider ); |
116 | gammaMenu->insertItem( gammaLCD ); | 116 | gammaMenu->insertItem( gammaLCD ); |
117 | 117 | ||
118 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); | 118 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); |
119 | 119 | ||
120 | vbox5 = new QVBox( this ); | 120 | vbox5 = new QVBox( this ); |
121 | QVBox *vbox4 = new QVBox( vbox5 ); | 121 | QVBox *vbox4 = new QVBox( vbox5 ); |
122 | QHBox *hbox6 = new QHBox( vbox4 ); | 122 | QHBox *hbox6 = new QHBox( vbox4 ); |
123 | 123 | ||
124 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 124 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
125 | 125 | ||
126 | QWidget *pTab; | 126 | QWidget *pTab; |
127 | pTab = new QWidget( tabWidget, "pTab" ); | 127 | pTab = new QWidget( tabWidget, "pTab" ); |
128 | tabWidget->insertTab( pTab, "Playlist"); | 128 | tabWidget->insertTab( pTab, "Playlist"); |
129 | 129 | ||
130 | QGridLayout *Playout = new QGridLayout( pTab ); | 130 | QGridLayout *Playout = new QGridLayout( pTab ); |
131 | Playout->setSpacing( 2); | 131 | Playout->setSpacing( 2); |
132 | Playout->setMargin( 2); | 132 | Playout->setMargin( 2); |
133 | 133 | ||
134 | // Add the playlist area | 134 | // Add the playlist area |
135 | QVBox *vbox3 = new QVBox( pTab ); | 135 | QVBox *vbox3 = new QVBox( pTab ); |
136 | d->playListFrame = vbox3; | 136 | d->playListFrame = vbox3; |
137 | 137 | ||
138 | QHBox *hbox2 = new QHBox( vbox3 ); | 138 | QHBox *hbox2 = new QHBox( vbox3 ); |
139 | d->selectedFiles = new PlayListSelection( hbox2 ); | 139 | d->selectedFiles = new PlayListSelection( hbox2 ); |
140 | 140 | ||
141 | vbox1 = new QVBox( hbox2 ); | 141 | vbox1 = new QVBox( hbox2 ); |
142 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); | 142 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); |
143 | QVBox *stretch1 = new QVBox( vbox1 ); // add stretch | 143 | QVBox *stretch1 = new QVBox( vbox1 ); // add stretch |
144 | 144 | ||
145 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); | 145 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); |
146 | 146 | ||
147 | QWidget *aTab; | 147 | QWidget *aTab; |
148 | aTab = new QWidget( tabWidget, "aTab" ); | 148 | aTab = new QWidget( tabWidget, "aTab" ); |
149 | 149 | ||
150 | QGridLayout *Alayout = new QGridLayout( aTab ); | 150 | QGridLayout *Alayout = new QGridLayout( aTab ); |
151 | Alayout->setSpacing( 2 ); | 151 | Alayout->setSpacing( 2 ); |
152 | Alayout->setMargin( 2 ); | 152 | Alayout->setMargin( 2 ); |
153 | audioView = new PlayListFileView( aTab, "Audioview" ); | 153 | audioView = new PlayListFileView( aTab, "Audioview" ); |
154 | audioView->addColumn( tr( "Title" ), 140 ); | ||
155 | audioView->addColumn( tr( "Size" ), -1 ); | ||
156 | audioView->addColumn( tr( "Media" ), 0 ); | ||
157 | audioView->addColumn( tr( "Path" ), -1 ); | ||
158 | audioView->setColumnAlignment( 1, Qt::AlignRight ); | ||
159 | audioView->setColumnAlignment( 2, Qt::AlignRight ); | ||
160 | audioView->setAllColumnsShowFocus( TRUE ); | ||
161 | audioView->setSorting( 3, TRUE ); | ||
162 | audioView->setMultiSelection( TRUE ); | ||
163 | audioView->setSelectionMode( QListView::Extended ); | ||
164 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 154 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
165 | tabWidget->insertTab( aTab, tr( "Audio" ) ); | 155 | tabWidget->insertTab( aTab, tr( "Audio" ) ); |
166 | 156 | ||
167 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); | 157 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); |
168 | 158 | ||
169 | QWidget *vTab; | 159 | QWidget *vTab; |
170 | vTab = new QWidget( tabWidget, "vTab" ); | 160 | vTab = new QWidget( tabWidget, "vTab" ); |
171 | 161 | ||
172 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 162 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
173 | Vlayout->setSpacing( 2 ); | 163 | Vlayout->setSpacing( 2 ); |
174 | Vlayout->setMargin( 2 ); | 164 | Vlayout->setMargin( 2 ); |
175 | videoView = new PlayListFileView( vTab, "Videoview" ); | 165 | videoView = new PlayListFileView( vTab, "Videoview" ); |
176 | videoView->addColumn( tr( "Title" ), 140); | ||
177 | videoView->addColumn( tr( "Size" ), -1 ); | ||
178 | videoView->addColumn(tr( "Media" ), 0 ); | ||
179 | videoView->addColumn(tr( "Path" ), -1 ); | ||
180 | videoView->setColumnAlignment( 1, Qt::AlignRight ); | ||
181 | videoView->setColumnAlignment( 2, Qt::AlignRight ); | ||
182 | videoView->setAllColumnsShowFocus( TRUE ); | ||
183 | videoView->setSorting( 3, TRUE ); | ||
184 | videoView->setMultiSelection( TRUE ); | ||
185 | videoView->setSelectionMode( QListView::Extended ); | ||
186 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 166 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
187 | 167 | ||
188 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); | 168 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); |
189 | 169 | ||
190 | tabWidget->insertTab( vTab, tr( "Video" ) ); | 170 | tabWidget->insertTab( vTab, tr( "Video" ) ); |
191 | 171 | ||
192 | //playlists list | 172 | //playlists list |
193 | QWidget *LTab; | 173 | QWidget *LTab; |
194 | LTab = new QWidget( tabWidget, "LTab" ); | 174 | LTab = new QWidget( tabWidget, "LTab" ); |
195 | QGridLayout *Llayout = new QGridLayout( LTab ); | 175 | QGridLayout *Llayout = new QGridLayout( LTab ); |
196 | Llayout->setSpacing( 2 ); | 176 | Llayout->setSpacing( 2 ); |
197 | Llayout->setMargin( 2 ); | 177 | Llayout->setMargin( 2 ); |
198 | 178 | ||
199 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); | 179 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); |
200 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 180 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
201 | 181 | ||
202 | tabWidget->insertTab( LTab, tr( "Lists" ) ); | 182 | tabWidget->insertTab( LTab, tr( "Lists" ) ); |
203 | 183 | ||
204 | setCentralWidget( vbox5 ); | 184 | setCentralWidget( vbox5 ); |
205 | } | 185 | } |
206 | 186 | ||
207 | 187 | ||
208 | 188 | ||
209 | PlayListWidgetGui::~PlayListWidgetGui() { | 189 | PlayListWidgetGui::~PlayListWidgetGui() { |
210 | } | 190 | } |
211 | 191 | ||
212 | void PlayListWidgetGui::setView( char view ) { | 192 | void PlayListWidgetGui::setView( char view ) { |
213 | if ( view == 'l' ) | 193 | if ( view == 'l' ) |
214 | showMaximized(); | 194 | showMaximized(); |
215 | else | 195 | else |
216 | hide(); | 196 | hide(); |
217 | } | 197 | } |
218 | 198 | ||
219 | 199 | ||
220 | void PlayListWidgetGui::setActiveWindow() { | 200 | void PlayListWidgetGui::setActiveWindow() { |
221 | // qDebug("SETTING active window"); | 201 | // qDebug("SETTING active window"); |
222 | // When we get raised we need to ensure that it switches views | 202 | // When we get raised we need to ensure that it switches views |
223 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); | 203 | MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); |
224 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate | 204 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate |
225 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back | 205 | mediaPlayerState.setDisplayType( origDisplayType ); // now switch back |
226 | } | 206 | } |
227 | 207 | ||