052421aa574c077e64b5a97c547f6743ac0c8f64
[vlc-remote] / browsemainwindow.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 BROWSEMAINWINDOW_H
19 #define BROWSEMAINWINDOW_H
20
21 #include <QMainWindow>
22 #include <QtNetwork>
23 #include <QtXml>
24 #include <QListWidgetItem>
25 #include "vlcbrowseelement.h"
26 #include "favouritesmainwindow.h"
27
28 namespace Ui {
29     class BrowseMainWindow;
30 }
31
32 class BrowseMainWindow : public QMainWindow {
33     Q_OBJECT
34 public:
35     explicit BrowseMainWindow(QWidget *parent = 0);
36     ~BrowseMainWindow();
37
38 public slots:
39     void init();
40     void browseDirectory(QString);
41     void onBrowse();
42     void onPlay();
43     void onAddToPlaylist();
44     void onListSelectionChanged();
45     void finished(QNetworkReply * reply);
46     void readReady();
47     void error(QNetworkReply::NetworkError code);
48     void showCurrentDirectory();
49     void setHomeFolder();
50     void showHomeFolder();
51     void showUserHomeFolder();
52     void setFavourite();
53     void showFavourites();
54     void setHomeDirectory();
55
56 protected slots:
57     void parseXmlDirectory();
58     void updateList();
59
60 protected:
61     void changeEvent(QEvent *e);
62     VlcBrowseElement getElementFromText(QString text);
63     QString getExtension(QString path, QString extension);
64
65 private:
66     Ui::BrowseMainWindow *ui;
67     FavouritesMainWindow *mFavouritesMainWindow;
68     QNetworkAccessManager * mNetManager;
69     QString mCurrentDir;
70     QString mIp;
71     QList<VlcBrowseElement>* mContents;
72     VlcBrowseElement mCurrentElement;
73     QByteArray mResponse;
74 };
75
76 #endif // BROWSEMAINWINDOW_H