1 /****************************************************************************
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the examples of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
11 ** Licensees holding valid Qt Commercial licenses may use this file in
12 ** accordance with the Qt Commercial License Agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and Nokia.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** GNU General Public License Usage
29 ** Alternatively, this file may be used under the terms of the GNU
30 ** General Public License version 3.0 as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL included in the
32 ** packaging of this file. Please review the following information to
33 ** ensure the GNU General Public License version 3.0 requirements will be
34 ** met: http://www.gnu.org/copyleft/gpl.html.
36 ** If you have questions regarding the use of this file, please contact
37 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
45 #include <QMainWindow>
47 #if QT_VERSION < 0x040600
48 #include <audiooutput.h>
49 #include <seekslider.h>
50 #include <mediaobject.h>
51 #include <volumeslider.h>
52 #include <backendcapabilities.h>
54 #include <phonon/audiooutput.h>
55 #include <phonon/seekslider.h>
56 #include <phonon/mediaobject.h>
57 #include <phonon/volumeslider.h>
58 #include <phonon/backendcapabilities.h>
61 #include "playlistmanager.h"
68 class MainWindow : public QMainWindow
76 QSize sizeHint() const
78 return QSize(800, 480);
86 void shuffleToggle ();
89 void stateChanged(Phonon::State newState, Phonon::State oldState);
90 void tick(qint64 time);
91 void sourceChanged(const Phonon::MediaSource &source);
94 void tableClicked(int row, int column);
99 void cellClicked(int row, int column);
100 void savePlaylist ();
101 void loadPlaylist ();
102 void playlistChanged (int from);
103 void itemUpdated (int index);
104 void setItem (int ind, bool doplay);
105 void removeSelectedItem ();
106 void removeAllButSelectedItem ();
107 void highlightRow (int i);
108 void unhighlightRow (int i);
110 void itemRemoved (int i);
112 void playlistControl (const QString&);
115 void contextMenuEvent (QContextMenuEvent*e);
120 void setupShuffleList();
121 void setRowFromItem (int row, const PlaylistItem& item);
122 void buttonUp (int i);
123 void buttonDown (int i);
124 void buttonDel (int i);
126 Phonon::SeekSlider *seekSlider;
127 Phonon::MediaObject *mediaObject;
128 Phonon::AudioOutput *audioOutput;
129 Phonon::VolumeSlider *volumeSlider;
131 PlaylistManager plman;
134 QAction *pauseAction;
136 QAction *repeatAction;
137 QAction *shuffleAction;
138 QAction *volumeAction;
139 QAction *volumeAddedAction;
141 QAction *previousAction;
142 QAction *addFilesAction;
143 QAction *addFoldersAction;
144 QAction *addUrlAction;
145 QAction *savePlaylistAction;
146 QAction *loadPlaylistAction;
147 QAction *clearPlaylistAction;
149 QAction *aboutAction;
150 QAction *aboutQtAction;
151 QAction *removeSelected;
152 QAction *removeAllButSelected;
153 QAction *optionAction;
157 QTableWidget *musicTable;
161 QList<int> shuffleList;