forked from FilipBE/qtextended
/
qmplayer.h
136 lines (126 loc) · 3.1 KB
/
qmplayer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef QMPLAYER_H
#define QMPLAYER_H
#include <QWidget>
#include <QListWidget>
#include <QVBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QProcess>
#include <QDir>
#include <QProgressDialog>
#include <QErrorMessage>
#include <QProgressBar>
#include <QApplication>
#include <QMouseEvent>
#include <QMessageBox>
#include <QHttp>
#include <QTcpServer>
#include <QTcpSocket>
#include <QTextCodec>
#include <QLineEdit>
#include <QStringList>
#include <QTimer>
#include <QMenuBar>
#ifdef QTOPIA
#include <QSoftMenuBar>
#include <QtopiaApplication>
#else
#include <QCoreApplication>
#endif
#ifdef Q_WS_WIN
#include <Windows.h>
#endif
#define NUM_MENU_ITEMS 3
class QMplayer : public QWidget
{
Q_OBJECT
public:
QMplayer(QWidget *parent = 0, Qt::WFlags f = 0);
~QMplayer();
enum Screen
{
ScreenInit,
ScreenScan,
ScreenPlay,
ScreenFullscreen,
ScreenStopped,
ScreenDownload,
ScreenConnect,
ScreenTube,
ScreenCmd,
ScreenEncoding,
ScreenEncodingInProgress,
};
private:
Screen screen;
int maxScanLevel;
int delTmpFiles;
bool abort;
int useBluetooth;
QVBoxLayout* layout;
QHBoxLayout* buttonLayout;
QListWidget* lw;
QListWidgetItem *scanItem;
QListWidgetItem *sharingItem;
QListWidgetItem *encodingItem;
QLabel* label;
QLineEdit *lineEdit;
QPushButton* bOk;
QPushButton* bBack;
QPushButton* bUp;
QPushButton* bDown;
QProcess* process;
QProgressBar *progress;
QTcpServer *tcpServer;
QStringList mpargs;
QStringList mplist;
#ifdef QTOPIA
QMenu* softm;
QAction *rmMpAction, *rmDlAction, *rmFlvAction;
#endif
bool mpgui;
bool tube;
QString ubasedir;
QString ufname;
double uload;
QProcess *upr;
bool ufinished;
void showScreen(QMplayer::Screen scr);
void scan();
int scanDir(QString const& path, int level, int maxLevel, int min, int max, bool followSymLinks);
void sharing();
void play(QStringList & args);
void encode(QString filename);
void setRes(int xy);
bool installMplayer();
bool installYoutubeDl();
bool runServer();
bool runClient();
bool download(QString url, QString destPath, QString filename, bool justCheck);
bool startMencoder(QString srcFile, QString dstFile);
void console(QString s);
bool youtubeDl();
bool runCmd(QString cmd, int maxp=0);
void playerStopped();
void setDlText();
QString getEncFilename(QString srcFile, QString dstIdentifier);
bool isPlaylist(QString fileName);
protected:
void mousePressEvent(QMouseEvent * event);
void closeEvent(QCloseEvent *event);
private slots:
void okClicked();
void backClicked();
void upClicked();
void downClicked();
void newConnection();
void processFinished(int exitCode, QProcess::ExitStatus exitStatus);
void removeMplayer();
void removeYoutubeDl();
void removeFlv();
void sTimerEvent();
void uReadyRead();
void mencoderReadyRead();
void uFinished(int exitCode, QProcess::ExitStatus exitStatus);
};
#endif // QMPLAYER_H