Update async methods! Now valid ip is detected
[vlc-remote] / playlistmainwindow.h
1 /*   VLC-REMOTE for MAEMO 5
2  *   Copyright (C) 2010 Schutz Sacha <istdasklar@gmail.com>
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
27 #ifndef LIST_ITEM_TYPE_OFFSET
28 #define LIST_ITEM_TYPE_OFFSET 1000
29 #endif
30
31 namespace Ui {
32     class PlayListMainWindow;
33 }
34
35 class PlayListMainWindow : public QMainWindow {
36     Q_OBJECT
37 public:
38     explicit PlayListMainWindow(QWidget *parent = 0);
39     ~PlayListMainWindow();
40     void init();
41 public slots:
42     void onClear();
43     void onShuffle();
44     void onLoop();
45     void onPlay();
46     void onRepeat();
47     void onRemove();
48     void requestPlayList();
49     void onListSelectionChanged();
50     void finished(QNetworkReply * reply);
51     void readReady();
52     void showPlayList();
53
54 protected slots:
55     void parseXmlPlayList();
56     void updateList();
57
58 protected:
59     void changeEvent(QEvent *e);
60     VlcPlayListElementSimple getElementFromText(QString text);
61
62 private:
63     Ui::PlayListMainWindow *ui;
64     QTimer * mTimer;
65     QString mIp;
66     QNetworkAccessManager * mNetManager;
67     QList<VlcPlayListElementSimple>* mContents;
68     VlcPlayListElementSimple mCurrentElement;
69     int mCurrentVlcIndex;
70     int mCurrentDepth;
71     QByteArray mResponse;
72 };
73
74 #endif // PLAYLISTMAINWINDOW_H