Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

playlistwidgetgui.cpp

Go to the documentation of this file.
00001 /*
00002                     This file is part of the Opie Project
00003 
00004                       Copyright (c)  2002 Max Reiss <harlekin@handhelds.org>
00005                              Copyright (c)  2002 L. Potter <ljp@llornkcor.com>
00006                              Copyright (c)  2002 Holger Freyther <zecke@handhelds.org>
00007               =.
00008             .=l.
00009      .>+-=
00010 _;:,   .>  :=|.         This program is free software; you can
00011 .> <`_,  > .  <=          redistribute it and/or  modify it under
00012 :`=1 )Y*s>-.--  :           the terms of the GNU General Public
00013 .="- .-=="i,   .._         License as published by the Free Software
00014 - .  .-<_>   .<>         Foundation; either version 2 of the License,
00015   ._= =}    :          or (at your option) any later version.
00016   .%`+i>    _;_.
00017   .i_,=:_.   -<s.       This program is distributed in the hope that
00018   + . -:.    =       it will be useful,  but WITHOUT ANY WARRANTY;
00019   : ..  .:,   . . .    without even the implied warranty of
00020   =_    +   =;=|`    MERCHANTABILITY or FITNESS FOR A
00021  _.=:.    :  :=>`:     PARTICULAR PURPOSE. See the GNU
00022 ..}^=.=    =    ;      General Public License for more
00023 ++=  -.   .`   .:       details.
00024 :   = ...= . :.=-
00025 -.  .:....=;==+<;          You should have received a copy of the GNU
00026  -_. . .  )=. =           General Public License along with
00027   --    :-=`           this library; see the file COPYING.LIB.
00028                              If not, write to the Free Software Foundation,
00029                              Inc., 59 Temple Place - Suite 330,
00030                              Boston, MA 02111-1307, USA.
00031 
00032 */
00033 
00034 #include <qtoolbar.h>
00035 #include <qpe/qpeapplication.h>
00036 
00037 #include <qlayout.h>
00038 #include <qmenubar.h>
00039 
00040 #include "playlistselection.h"
00041 #include "playlistwidget.h"
00042 #include "mediaplayerstate.h"
00043 #include "inputDialog.h"
00044 #include "playlistfileview.h"
00045 
00046 
00047 PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
00048     : QMainWindow( parent, name )  {
00049 
00050     d = new PlayListWidgetPrivate;
00051     d->setDocumentUsed = FALSE;
00052 
00053     setBackgroundMode( PaletteButton );
00054     setToolBarsMovable( FALSE );
00055 
00056     // Create Toolbar
00057     QToolBar *toolbar = new QToolBar( this );
00058     toolbar->setHorizontalStretchable( TRUE );
00059 
00060     // Create Menubar
00061     QMenuBar *menu = new QMenuBar( toolbar );
00062     menu->setMargin( 0 );
00063 
00064     bar = new QToolBar( this );
00065     bar->setLabel( tr( "Play Operations" ) );
00066 
00067     tbDeletePlaylist = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ),
00068                                         "", bar, "close" );
00069     tbDeletePlaylist->setFlat( TRUE );
00070     tbDeletePlaylist->setFixedSize( 20, 20 );
00071 
00072     tbDeletePlaylist->hide();
00073 
00074     pmPlayList = new QPopupMenu( this );
00075     menu->insertItem( tr( "File" ), pmPlayList );
00076 
00077     pmView = new QPopupMenu( this );
00078     menu->insertItem( tr( "View" ), pmView );
00079     pmView->isCheckable();
00080 
00081     skinsMenu = new QPopupMenu( this );
00082     pmView->insertItem( tr( "Skins" ), skinsMenu );
00083     skinsMenu->isCheckable();
00084 
00085     gammaMenu = new QPopupMenu( this );
00086     pmView->insertItem( tr( "Gamma (Video)" ),  gammaMenu );
00087 
00088     gammaSlider = new QSlider( QSlider::Vertical,  gammaMenu );
00089     gammaSlider->setRange( -40, 40 );
00090     gammaSlider->setTickmarks( QSlider::Left );
00091     gammaSlider->setTickInterval( 20 );
00092     gammaSlider->setFocusPolicy( QWidget::StrongFocus );
00093     gammaSlider->setValue( 0 );
00094     gammaSlider->setMinimumHeight( 50 );
00095 
00096     gammaLCD = new QLCDNumber( 3,  gammaMenu );
00097     gammaLCD-> setFrameShape ( QFrame::NoFrame );
00098     gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
00099 
00100     gammaMenu->insertItem( gammaSlider );
00101     gammaMenu->insertItem( gammaLCD );
00102 
00103     connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) );
00104 
00105     vbox5 = new QVBox( this );
00106     QVBox *vbox4 = new QVBox( vbox5 );
00107     QHBox *hbox6 = new QHBox( vbox4 );
00108 
00109     tabWidget = new QTabWidget( hbox6, "tabWidget" );
00110 
00111     playListTab = new QWidget( tabWidget, "PlayListTab" );
00112     tabWidget->insertTab( playListTab, "Playlist");
00113 
00114     QGridLayout *Playout = new QGridLayout( playListTab );
00115     Playout->setSpacing( 2);
00116     Playout->setMargin( 2);
00117 
00118     // Add the playlist area
00119     QVBox *vbox3 = new QVBox( playListTab );
00120     d->playListFrame = vbox3;
00121 
00122     QHBox *hbox2 = new QHBox( vbox3 );
00123     d->selectedFiles = new PlayListSelection( hbox2 );
00124 
00125     vbox1 = new QVBox( hbox2 );
00126     QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
00127     QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
00128 
00129     Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
00130 
00131     QWidget *aTab;
00132     aTab = new QWidget( tabWidget, "aTab" );
00133 
00134     QGridLayout *Alayout = new QGridLayout( aTab );
00135     Alayout->setSpacing( 2 );
00136     Alayout->setMargin( 2 );
00137     // no m3u's here please
00138     audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
00139     Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
00140     tabWidget->insertTab( aTab, tr( "Audio" ) );
00141 
00142     QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
00143 
00144     QWidget *vTab;
00145     vTab = new QWidget( tabWidget, "vTab" );
00146 
00147     QGridLayout *Vlayout = new QGridLayout( vTab );
00148     Vlayout->setSpacing( 2 );
00149     Vlayout->setMargin( 2 );
00150     videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
00151     Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
00152 
00153     QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
00154 
00155     tabWidget->insertTab( vTab, tr( "Video" ) );
00156 
00157     //playlists list
00158     QWidget *LTab;
00159     LTab = new QWidget( tabWidget, "LTab" );
00160     QGridLayout *Llayout = new QGridLayout( LTab );
00161     Llayout->setSpacing( 2 );
00162     Llayout->setMargin( 2 );
00163 
00164     playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
00165     Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
00166 
00167     tabWidget->insertTab( LTab, tr( "Lists" ) );
00168 
00169     setCentralWidget( vbox5 );
00170 }
00171 
00172 
00173 
00174 PlayListWidgetGui::~PlayListWidgetGui()  {
00175 }
00176 
00177 void PlayListWidgetGui::setView( char view )  {
00178     if ( view == 'l' )
00179         showMaximized();
00180     else
00181         hide();
00182 }
00183 
00184 
00185 void PlayListWidgetGui::setActiveWindow()  {
00186     // When we get raised we need to ensure that it switches views
00187     MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
00188     mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
00189     mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
00190 }
00191 
00192 

Generated on Sat Nov 5 16:17:33 2005 for OPIE by  doxygen 1.4.2