New structure for project.
[vlc-remote] / src / playlistmainwindow.h
1 /*   VLC-REMOTE for MAEMO 5
2 *   Copyright (C) 2010 Schutz Sacha <istdasklar@gmail.com>, Dru Moore <usr@dru-id.co.uk>, Yann Nave <yannux@onbebop.net>
3 *   This program is free software; you can redistribute it and/or modify
4 *   it under the terms of the GNU General Public License version 2,
5 *   or (at your option) any later version, as published by the Free
6 *   Software Foundation
7 *
8 *   This program is distributed in the hope that it will be useful,
9 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
10 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 *   GNU General Public License for more details
12 *
13 *   You should have received a copy of the GNU General Public
14 *   License along with this program; if not, write to the
15 *   Free Software Foundation, Inc.,
16 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 */
18 #ifndef PLAYLISTMAINWINDOW_H
19 #define PLAYLISTMAINWINDOW_H
20
21 #include <QMainWindow>
22 #include <QTimer>
23 #include <QtNetwork>
24 #include <QtXml>
25 #include "vlcplaylistelementsimple.h"
26 #include "vlcstatus.h"
27
28 #ifndef LIST_ITEM_TYPE_OFFSET
29 #define LIST_ITEM_TYPE_OFFSET 1000
30 #endif
31
32 namespace Ui {
33     class PlayListMainWindow;
34 }
35
36 class PlayListMainWindow : public QMainWindow {
37     Q_OBJECT
38 public:
39     explicit PlayListMainWindow(QWidget *parent = 0);
40     ~PlayListMainWindow();
41     void init();
42 public slots:
43     void onClear();
44     void onShuffle();
45     void onLoop();
46     void onPlay();
47     void onRepeat();
48     void onRemove();
49     void requestPlayList();
50     void onListSelectionChanged();
51     void finished(QNetworkReply * reply);
52     void readReady();
53     void error(QNetworkReply::NetworkError code);
54     void showPlayList();
55     void updateUiWithCurrentStatus(VlcStatus * status);
56
57 protected slots:
58     void parseXmlPlayList();
59     void updateList();
60     int parsePlayListItem(QDomNode *node, QString *extension, bool *hasArt, int *currentLeafId, int depth);
61
62 signals:
63     void idUpdated(int id, bool hasArt, QString extension);
64
65 protected:
66     void changeEvent(QEvent *e);
67     VlcPlayListElementSimple getElementFromId(int id);
68     QString getExtension(QString path, QString extension);
69
70 private:
71     Ui::PlayListMainWindow *ui;
72     QTimer * mTimer;
73     QString mIp;
74     QNetworkAccessManager * mNetManager;
75     QList<VlcPlayListElementSimple>* mContents;
76     VlcPlayListElementSimple mCurrentElement;
77     int mCurrentVlcIndex;
78     int mCurrentDepth;
79     QByteArray mResponse;
80 };
81
82 #endif // PLAYLISTMAINWINDOW_H