├── MvGather.pro.user.nP3052 ├── images ├── delete.png ├── icon.png ├── list.png ├── load.jpg ├── magnet.png ├── player.png ├── share.png ├── download.ico ├── tipBusy.png ├── tipBackgound.png └── downloadManage.png ├── skin ├── images │ ├── bg.png │ ├── downsolidarrow.png │ ├── rightsolidarrow.png │ ├── appbar.black_down.png │ └── appbar.black_right.png └── icons │ └── dark │ ├── appbar.app.png │ ├── appbar.close.png │ ├── appbar.list.png │ ├── appbar.lock.png │ ├── appbar.minus.png │ ├── appbar.share.png │ ├── appbar.magnet.png │ ├── appbar.player.png │ ├── appbar.download.png │ ├── appbar.list.dark.png │ ├── appbar.share.dark.png │ ├── appbar.control.down.png │ ├── appbar.magnet.dark.png │ ├── appbar.page.delete.png │ ├── appbar.player.dark.png │ ├── appbar.clothes.shirt.png │ ├── appbar.download.dark.png │ └── appbar.fullscreen.box.png ├── .gitignore ├── MyWidgets ├── MagnetWidget │ ├── loginformwin.cpp │ ├── loginformwin.h │ ├── vcodedialog.h │ ├── vcodedialog.cpp │ ├── loginform.h │ ├── vcodedialog.ui │ ├── magnetwidget.h │ ├── loginform.ui │ └── loginform.cpp ├── SetColorWidget │ ├── setcolorwidget.h │ ├── setcolorwidget.cpp │ ├── setcolorcenterwin.h │ └── setcolorcenterwin.ui ├── PreferSetting │ ├── prefersourcewidgetwin.h │ ├── prefersettingmainwin.h │ ├── prefersourcewidgetwin.cpp │ ├── prefersettingmainwin.cpp │ ├── prefersourcewidget.h │ ├── prefersetting.h │ ├── prefersourcewidget.ui │ ├── prefersourcewidget.cpp │ └── prefersetting.cpp ├── PlayerWidget │ ├── analyzer.h │ ├── playerlistarea.h │ ├── progressbar.h │ ├── tvlistwidget.h │ ├── playerlistwidgetitem.h │ ├── playerwidget.h │ ├── playerlistwidgetitem.cpp │ ├── playerwin.h │ ├── progressbar.cpp │ ├── analyzer.cpp │ ├── tvlistwidget.cpp │ └── playerlistarea.cpp ├── imgbtn.h ├── MyDialog │ ├── myinputdialogmainwin.h │ ├── myinputdialogmainwin.cpp │ ├── myinputdialog.h │ └── myinputdialog.cpp ├── ListShowWidget │ ├── loadimgthread.h │ ├── imagelabel.h │ ├── listshowwidgetitem.h │ ├── listshowwidget.h │ ├── loadimgthread.cpp │ ├── imagelabel.cpp │ ├── listshowwidgetitem.cpp │ └── listshowwidget.cpp ├── imgbtn.cpp ├── mytip.h ├── BrowseWidget │ ├── adshow.h │ ├── adshow.cpp │ └── browsewidget.h ├── RecommendWidget │ ├── recommendwidget.h │ └── recommendwidget.cpp ├── ThreadDownload │ ├── downloadwidget.h │ ├── downloadwidget.ui │ └── downloadwidget.cpp └── mytip.cpp ├── main.cpp ├── README.md ├── QFramer ├── QFramer.pri ├── fcheckablebutton.h ├── fcheckablebutton.cpp ├── fbasepushbutton.h ├── fshadowlabel.h ├── fbasepushbutton.cpp ├── fnofocusdelegate.h ├── fstatebutton.h ├── fmovablewidget.h ├── fwigglywidget.h ├── futil.h ├── fnofocusdelegate.cpp ├── fmovablewidget.cpp ├── fshadowlabel.cpp ├── ftabwidget.h ├── flywidget.h ├── fbasedialog.h ├── fwigglywidget.cpp ├── fstatebutton.cpp ├── fcenterwindow.h ├── fmainwindow.h ├── fnavgationbar.h ├── ftabwidget.cpp ├── flywidget.cpp ├── ftitlebar.h ├── futil.cpp ├── fbasedialog.cpp ├── fnavgationbar.cpp └── fmainwindow.cpp ├── mainwindow.h ├── centerwindow.h ├── rs.qrc ├── MvGather.pro └── mainwindow.cpp /MvGather.pro.user.nP3052: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/delete.png -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/icon.png -------------------------------------------------------------------------------- /images/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/list.png -------------------------------------------------------------------------------- /images/load.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/load.jpg -------------------------------------------------------------------------------- /images/magnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/magnet.png -------------------------------------------------------------------------------- /images/player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/player.png -------------------------------------------------------------------------------- /images/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/share.png -------------------------------------------------------------------------------- /images/download.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/download.ico -------------------------------------------------------------------------------- /images/tipBusy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/tipBusy.png -------------------------------------------------------------------------------- /skin/images/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/images/bg.png -------------------------------------------------------------------------------- /images/tipBackgound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/tipBackgound.png -------------------------------------------------------------------------------- /images/downloadManage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/images/downloadManage.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.app.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.close.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.list.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.lock.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.minus.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.share.png -------------------------------------------------------------------------------- /skin/images/downsolidarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/images/downsolidarrow.png -------------------------------------------------------------------------------- /skin/images/rightsolidarrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/images/rightsolidarrow.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.magnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.magnet.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.player.png -------------------------------------------------------------------------------- /skin/images/appbar.black_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/images/appbar.black_down.png -------------------------------------------------------------------------------- /skin/images/appbar.black_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/images/appbar.black_right.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.download.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.list.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.list.dark.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.share.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.share.dark.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.control.down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.control.down.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.magnet.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.magnet.dark.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.page.delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.page.delete.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.player.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.player.dark.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.clothes.shirt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.clothes.shirt.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.download.dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.download.dark.png -------------------------------------------------------------------------------- /skin/icons/dark/appbar.fullscreen.box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xsjqqq123/MvGather/HEAD/skin/icons/dark/appbar.fullscreen.box.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/loginformwin.cpp: -------------------------------------------------------------------------------- 1 | #include "loginformwin.h" 2 | 3 | LoginFormWin::LoginFormWin(QWidget *parent) : 4 | FBaseDialog(parent) 5 | { 6 | loginForm = new LoginForm; 7 | connect(loginForm,SIGNAL(loginSuccess(QString,QString)),this,SLOT(hide())); 8 | this->normalSize = QSize(300,200); 9 | getTitleBar()->getTitleLabel()->setText("登录百度云"); 10 | this->layout()->addWidget(loginForm); 11 | } 12 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/loginformwin.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGINFORMWIN_H 2 | #define LOGINFORMWIN_H 3 | #include "loginform.h" 4 | #include "QFramer/fbasedialog.h" 5 | #include 6 | class LoginFormWin : public FBaseDialog 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit LoginFormWin(QWidget *parent = 0); 11 | LoginForm *loginForm; 12 | public slots: 13 | private: 14 | 15 | 16 | }; 17 | 18 | #endif // LOGINFORMWIN_H 19 | -------------------------------------------------------------------------------- /MyWidgets/SetColorWidget/setcolorwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef SETCOLORWIDGET_H 2 | #define SETCOLORWIDGET_H 3 | #include "QFramer/fbasedialog.h" 4 | #include "setcolorcenterwin.h" 5 | class SetColorWidget : public FBaseDialog//皮肤颜色设置 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit SetColorWidget(QWidget *parent = 0); 10 | 11 | signals: 12 | 13 | public slots: 14 | private: 15 | SetColorCenterWin *setColorCenterWin; 16 | 17 | }; 18 | 19 | #endif // SETCOLORWIDGET_H 20 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | MainWindow w; 8 | w.show(); 9 | 10 | QStringList arguments = a.arguments(); 11 | arguments.removeFirst(); 12 | QString filePath = arguments.join(" "); 13 | if (filePath != "") 14 | { 15 | w.centerWindow->play(filePath); 16 | } 17 | 18 | return a.exec(); 19 | } 20 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/vcodedialog.h: -------------------------------------------------------------------------------- 1 | #ifndef VCODEDIALOG_H 2 | #define VCODEDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class VcodeDialog; 8 | } 9 | 10 | class VcodeDialog : public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit VcodeDialog(QWidget *parent = 0); 15 | ~VcodeDialog(); 16 | void setPixmap(QPixmap pix); 17 | QString getText(); 18 | private: 19 | Ui::VcodeDialog *ui; 20 | }; 21 | 22 | #endif // VCODEDIALOG_H 23 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersourcewidgetwin.h: -------------------------------------------------------------------------------- 1 | #ifndef PREFERSOURCEWIDGETWIN_H 2 | #define PREFERSOURCEWIDGETWIN_H 3 | #include "QFramer/fbasedialog.h" 4 | #include "prefersourcewidget.h" 5 | class PreferSourceWidgetWin : public FBaseDialog 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit PreferSourceWidgetWin(QWidget *parent = 0); 10 | 11 | signals: 12 | 13 | public slots: 14 | private: 15 | preferSourceWidget *prefer; 16 | 17 | }; 18 | 19 | #endif // PREFERSOURCEWIDGETWIN_H 20 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/analyzer.h: -------------------------------------------------------------------------------- 1 | #ifndef ANALYZER_H 2 | #define ANALYZER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class Analyzer : public QObject//视频真实地址解析类 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit Analyzer(QObject *parent = 0); 14 | 15 | signals: 16 | 17 | public slots: 18 | QString funTvAnalyze(QString url);//风行网视频地址解析 19 | 20 | }; 21 | 22 | #endif // ANALYZER_H 23 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersettingmainwin.h: -------------------------------------------------------------------------------- 1 | #ifndef PREFERSETTINGMAINWIN_H 2 | #define PREFERSETTINGMAINWIN_H 3 | #include "QFramer/fbasedialog.h" 4 | #include "prefersetting.h" 5 | 6 | class PreferSettingMainWin : public FBaseDialog//视频质量偏好设置 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit PreferSettingMainWin(QWidget *parent = 0); 11 | 12 | signals: 13 | 14 | public slots: 15 | private: 16 | PreferSetting *preferSetting; 17 | 18 | }; 19 | 20 | #endif // PREFERSETTINGMAINWIN_H 21 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersourcewidgetwin.cpp: -------------------------------------------------------------------------------- 1 | #include "prefersourcewidgetwin.h" 2 | 3 | PreferSourceWidgetWin::PreferSourceWidgetWin(QWidget *parent) 4 | { 5 | setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); 6 | this->normalSize = QSize(200,300); 7 | getTitleBar()->getTitleLabel()->setText("视频源偏好设置"); 8 | prefer = new preferSourceWidget(this); 9 | connect(prefer,SIGNAL(closeSig()),this,SLOT(close())); 10 | this->layout()->addWidget(prefer); 11 | } 12 | -------------------------------------------------------------------------------- /MyWidgets/imgbtn.h: -------------------------------------------------------------------------------- 1 | #ifndef IMGBTN_H 2 | #define IMGBTN_H 3 | 4 | #include 5 | 6 | class ImgBtn : public QLabel// 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit ImgBtn(QWidget *parent = 0,QString picPath=""); 11 | protected: 12 | virtual void enterEvent(QEvent * event); 13 | virtual void leaveEvent(QEvent * event); 14 | virtual void mouseReleaseEvent(QMouseEvent * e); 15 | signals: 16 | void clicked(); 17 | public slots: 18 | 19 | }; 20 | 21 | #endif // IMGBTN_H 22 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/vcodedialog.cpp: -------------------------------------------------------------------------------- 1 | #include "vcodedialog.h" 2 | #include "ui_vcodedialog.h" 3 | 4 | VcodeDialog::VcodeDialog(QWidget *parent) : 5 | QDialog(parent), 6 | ui(new Ui::VcodeDialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | VcodeDialog::~VcodeDialog() 12 | { 13 | delete ui; 14 | } 15 | 16 | void VcodeDialog::setPixmap(QPixmap pix) 17 | { 18 | ui->label->setPixmap(pix); 19 | } 20 | 21 | QString VcodeDialog::getText() 22 | { 23 | return ui->lineEdit->text(); 24 | } 25 | -------------------------------------------------------------------------------- /MyWidgets/MyDialog/myinputdialogmainwin.h: -------------------------------------------------------------------------------- 1 | #ifndef MYINPUTDIALOGMAINWIN_H 2 | #define MYINPUTDIALOGMAINWIN_H 3 | #include "QFramer/fbasedialog.h" 4 | #include "myinputdialog.h" 5 | class MyInputDialogMainWin : public FBaseDialog 6 | { 7 | Q_OBJECT 8 | public: 9 | explicit MyInputDialogMainWin(QWidget *parent = 0); 10 | MyInputDialog *centerWidget; 11 | signals: 12 | public slots: 13 | void urlInputInit(QString defaultUrl); 14 | QString getText(); 15 | 16 | }; 17 | 18 | #endif // MYINPUTDIALOGMAINWIN_H 19 | -------------------------------------------------------------------------------- /MyWidgets/SetColorWidget/setcolorwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "setcolorwidget.h" 2 | 3 | SetColorWidget::SetColorWidget(QWidget *parent) : 4 | FBaseDialog(parent) 5 | { 6 | //setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint); 7 | 8 | this->normalSize = QSize(400,300); 9 | setColorCenterWin = new SetColorCenterWin(this); 10 | connect(setColorCenterWin,SIGNAL(closeS()),this,SLOT(close())); 11 | getTitleBar()->getTitleLabel()->setText("选择颜色"); 12 | this->layout()->addWidget(setColorCenterWin); 13 | } 14 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersettingmainwin.cpp: -------------------------------------------------------------------------------- 1 | #include "prefersettingmainwin.h" 2 | 3 | PreferSettingMainWin::PreferSettingMainWin(QWidget *parent) : 4 | FBaseDialog(parent) 5 | { 6 | setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); 7 | this->normalSize = QSize(200,400); 8 | getTitleBar()->getTitleLabel()->setText("偏好设置(可拖放修改)"); 9 | preferSetting = new PreferSetting(this); 10 | connect(preferSetting,SIGNAL(closeSig()),this,SLOT(close())); 11 | this->layout()->addWidget(preferSetting); 12 | } 13 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/loadimgthread.h: -------------------------------------------------------------------------------- 1 | #ifndef LOADIMGTHREAD_H 2 | #define LOADIMGTHREAD_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class LoadImgThread : public QThread 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit LoadImgThread(QObject *parent = 0,QString url=""); 13 | protected: 14 | void run(); 15 | signals: 16 | void imageReady(QByteArray data); 17 | private: 18 | QNetworkAccessManager *manager; 19 | QString url; 20 | }; 21 | 22 | #endif // LOADIMGTHREAD_H 23 | -------------------------------------------------------------------------------- /MyWidgets/imgbtn.cpp: -------------------------------------------------------------------------------- 1 | #include "imgbtn.h" 2 | 3 | ImgBtn::ImgBtn(QWidget *parent, QString picPath) : 4 | QLabel(parent) 5 | { 6 | setScaledContents(true); 7 | setPixmap(QPixmap(picPath)); 8 | setToolTip("删除"); 9 | } 10 | 11 | void ImgBtn::enterEvent(QEvent *event) 12 | { 13 | setStyleSheet("background-color:rgba(255,255,255,20);border-radius:5px;"); 14 | } 15 | 16 | void ImgBtn::leaveEvent(QEvent *event) 17 | { 18 | setStyleSheet("background-color:rgba(255,255,255,0);"); 19 | } 20 | 21 | void ImgBtn::mouseReleaseEvent(QMouseEvent *e) 22 | { 23 | emit clicked(); 24 | } 25 | -------------------------------------------------------------------------------- /MyWidgets/MyDialog/myinputdialogmainwin.cpp: -------------------------------------------------------------------------------- 1 | #include "myinputdialogmainwin.h" 2 | 3 | MyInputDialogMainWin::MyInputDialogMainWin(QWidget *parent) : 4 | FBaseDialog(parent) 5 | { 6 | centerWidget = new MyInputDialog(this); 7 | this->fMainLayout->addWidget(centerWidget); 8 | 9 | } 10 | 11 | void MyInputDialogMainWin::urlInputInit(QString defaultUrl) 12 | { 13 | getTitleBar()->getTitleLabel()->setText("请输入:"); 14 | centerWidget->setLblText("直链Url:"); 15 | centerWidget->setLineEditText(defaultUrl); 16 | } 17 | 18 | QString MyInputDialogMainWin::getText() 19 | { 20 | return centerWidget->getText(); 21 | } 22 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersourcewidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PREFERSOURCEWIDGET_H 2 | #define PREFERSOURCEWIDGET_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class preferSourceWidget; 8 | } 9 | 10 | class preferSourceWidget : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit preferSourceWidget(QWidget *parent = 0); 16 | ~preferSourceWidget(); 17 | signals: 18 | void closeSig(); 19 | private slots: 20 | void on_saveBtn_clicked(); 21 | 22 | void on_upBtn_clicked(); 23 | 24 | void on_downBtn_clicked(); 25 | 26 | void on_resetBtn_clicked(); 27 | 28 | private: 29 | Ui::preferSourceWidget *ui; 30 | }; 31 | 32 | #endif // PREFERSOURCEWIDGET_H 33 | -------------------------------------------------------------------------------- /MyWidgets/mytip.h: -------------------------------------------------------------------------------- 1 | #ifndef MYTIP_H 2 | #define MYTIP_H 3 | 4 | #include 5 | #include 6 | class MyTip : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit MyTip(QWidget *parent = 0); 11 | protected: 12 | void paintEvent(QPaintEvent *e); 13 | void mouseReleaseEvent(QMouseEvent *); 14 | signals: 15 | 16 | public slots: 17 | void setText(QString text); 18 | void timeToClose(int second); 19 | void timeToHide(int second); 20 | void busyAnglePlus(); 21 | void setBusyIndicatorShow(bool on); 22 | private: 23 | bool isBusyIndicatorShow; 24 | QString text; 25 | qreal busyAngle; 26 | QTimer *busyAnglePlusTimer; 27 | }; 28 | 29 | #endif // MYTIP_H 30 | -------------------------------------------------------------------------------- /MyWidgets/BrowseWidget/adshow.h: -------------------------------------------------------------------------------- 1 | #ifndef ADSHOW_H 2 | #define ADSHOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | class AdShow : public QWidget 12 | { 13 | Q_OBJECT 14 | public: 15 | explicit AdShow(QWidget *parent = 0); 16 | signals: 17 | 18 | public slots: 19 | void getData(); 20 | void showPicAd(QString picUrl,QString txt); 21 | private: 22 | QGridLayout *mainGird; 23 | QLabel *imgLbl; 24 | QLabel *txtLbl; 25 | QNetworkAccessManager *manager; 26 | QString urlToGo; 27 | QString host; 28 | }; 29 | 30 | #endif // ADSHOW_H 31 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/imagelabel.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGELABEL_H 2 | #define IMAGELABEL_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "loadimgthread.h" 10 | class ImageLabel : public QLabel 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit ImageLabel(QObject *parent = 0,QString url="",int timeToDelay=0);//time表示推迟创建线程加载图片的时间 15 | bool isImgLoaded; 16 | signals: 17 | void clicked(); 18 | protected: 19 | virtual void mouseReleaseEvent(QMouseEvent * e); 20 | public slots: 21 | void getImage(); 22 | void readImage(QByteArray data); 23 | private: 24 | QString url; 25 | QList imgThreadList; 26 | 27 | }; 28 | 29 | #endif // IMAGELABEL_H 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MvGather 2 | ======== 3 | 4 | <<<<<<< HEAD 5 | MvGather中文名影视集结号,是个在线视频客户端,同时也是本地视频播放器。 6 | 基于Qt5.3及QtAV开发,同时使用QCFramer皮肤框架。 7 | 主要用于解决ubuntu及其它linux发行版上网页观看视频占用大量CPU。 8 | 9 | # 10 | 下载: 11 | ubuntu: 12 | deb下载地址:http://mvgather.com/?content/read-10.html 13 | 14 | # For Developers 15 | #### Requirements 16 | Qt:http://qt-project.org/downloads 17 | QtAV:https://github.com/wang-bin/QtAV 18 | QFramer:https://github.com/dragondjf/QFramer 19 | 20 | 21 | **MvGather is free software licensed under the term of LGPL v2.1.你可以任意使用本源码,但不得在windows上传播,毕竟windows上官方都有相似客户端。 22 | 23 | **QtAV is free software licensed under the term of LGPL v2.1. The player example is licensed under GPL v3. If you use QtAV or its constituent libraries, 24 | you must adhere to the terms of the license in question.** 25 | ======= 26 | 27 | -------------------------------------------------------------------------------- /MyWidgets/MyDialog/myinputdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef MYINPUTDIALOG_H 2 | #define MYINPUTDIALOG_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | class MyInputDialog : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit MyInputDialog(QWidget *parent = 0); 14 | 15 | signals: 16 | void acceptSignal(QString inputText); 17 | public slots: 18 | void setPixMap(QPixmap pix); 19 | void setLblText(QString txt); 20 | void setLineEditText(QString txt); 21 | QString getText(); 22 | void emitAccept(); 23 | private: 24 | QGridLayout *mainLayout; 25 | QLabel *txtOrImgLbl; 26 | QLineEdit *inputL; 27 | QPushButton *okBtn; 28 | QSpacerItem *spaceItem; 29 | 30 | }; 31 | 32 | #endif // MYINPUTDIALOG_H 33 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerlistarea.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYERLISTAREA_H 2 | #define PLAYERLISTAREA_H 3 | 4 | #include 5 | #include 6 | #include "playerlistwidgetitem.h" 7 | #include "../mytip.h" 8 | #include 9 | class PlayerListArea : public QScrollArea//视频播放列表 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit PlayerListArea(QWidget *parent = 0); 14 | protected: 15 | void contextMenuEvent(QContextMenuEvent *event); 16 | signals: 17 | void play(QString tvId,QString tvNo); 18 | void syncMv(); 19 | public slots: 20 | void updateList(); 21 | void sendPlay(QString tvId,QString tvNo); 22 | void openUrl(); 23 | void sendSyncMv(); 24 | private: 25 | QWidget *mainWidget; 26 | QGridLayout *mainWidgetGLayout; 27 | PlayerListWidgetItem *listWidgetItem; 28 | MyTip myTipWin; 29 | }; 30 | 31 | #endif // PLAYERLISTAREA_H 32 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersetting.h: -------------------------------------------------------------------------------- 1 | #ifndef PREFERSETTING_H 2 | #define PREFERSETTING_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class PreferSetting : public QWidget//视频质量偏好设置 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit PreferSetting(QWidget *parent = 0); 14 | 15 | signals: 16 | void closeSig(); 17 | public slots: 18 | void saveQuality(); 19 | void UpQuality(); 20 | void DownQuality(); 21 | void DeleteQuality(); 22 | void AddQuality(); 23 | void ResetQuality(); 24 | private: 25 | QGridLayout *mainLayout; 26 | QListWidget *qualityListWidget; 27 | QPushButton *qualityUpBtn; 28 | QPushButton *qualityDownBtn; 29 | QPushButton *qualityAddBtn; 30 | QPushButton *qualityDeleteBtn; 31 | QPushButton *qualityResetBtn; 32 | QPushButton *qualitySaveBtn; 33 | QString preferQualitysSetting; 34 | }; 35 | 36 | #endif // PREFERSETTING_H 37 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/listshowwidgetitem.h: -------------------------------------------------------------------------------- 1 | #ifndef LISTSHOWWIDGETITEM_H 2 | #define LISTSHOWWIDGETITEM_H 3 | 4 | #include 5 | #include 6 | #include "imagelabel.h" 7 | #include 8 | #include 9 | class ListShowWidgetItem : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit ListShowWidgetItem(QWidget *parent = 0,QString tvUrl="",QString imgUrl="",QString title="",QString descripe="",int timeToDelay=0); 14 | ImageLabel *ImgLbl; 15 | protected: 16 | //void paintEvent(QPaintEvent *); 17 | signals: 18 | void clicked(QString tvUrl,QString title); 19 | public slots: 20 | void SendClicked(); 21 | void loadImg(); 22 | void backgroundColorChange(); 23 | private: 24 | QString tvUrl; 25 | QString imgUrl; 26 | QString title; 27 | QString descripe; 28 | QGridLayout *mainGLayout; 29 | 30 | QLabel *titleLbl; 31 | QLabel *descripeLbl; 32 | }; 33 | 34 | #endif // LISTSHOWWIDGETITEM_H 35 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/progressbar.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESSBAR_H 2 | #define PROGRESSBAR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | class ProgressBar : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit ProgressBar(QWidget *parent = 0); 13 | ~ProgressBar(); 14 | protected: 15 | void paintEvent(QPaintEvent *e); 16 | void mouseReleaseEvent(QMouseEvent *); 17 | void mouseMoveEvent(QMouseEvent *e); 18 | void leaveEvent(QEvent * event); 19 | void enterEvent(QEvent * event); 20 | 21 | signals: 22 | void posChange(qreal posPercent); 23 | public slots: 24 | void setPercentPos(qreal posPercent); 25 | void drawTimeText(QString timeText); 26 | void setSmallHeight(); 27 | void setBigHeight(); 28 | private: 29 | qreal posPercent; 30 | QString timeText; 31 | QTimer *timer; 32 | int progressBarHeight; 33 | bool isMouseIn; 34 | QPoint indicateLinePoint; 35 | }; 36 | 37 | #endif // PROGRESSBAR_H 38 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/listshowwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef LISTSHOWWIDGET_H 2 | #define LISTSHOWWIDGET_H 3 | 4 | #include 5 | #include "listshowwidgetitem.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | class ListShowWidget : public QScrollArea 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit ListShowWidget(QWidget *parent = 0); 15 | int page; 16 | signals: 17 | void pageChanged(); 18 | void clicked(QString,QString); 19 | public slots: 20 | void loadDataToList(QStringList args); 21 | void pagePlus(); 22 | void pageMinus(); 23 | void showPage(); 24 | void sendclicked(QString tvUrl,QString title); 25 | void loadSeeImg(); 26 | private: 27 | QGridLayout *mainLayout; 28 | QGridLayout *areaWidgetLayout;//areaWidget中组织item的layout 29 | ListShowWidgetItem *Item; 30 | QWidget *areaWidget; 31 | QPushButton *nextBtn;//下一页 32 | QPushButton *preBtn;//上一页 33 | QTimer *checkSeeImgTimer; 34 | }; 35 | 36 | #endif // LISTSHOWWIDGET_H 37 | -------------------------------------------------------------------------------- /MyWidgets/SetColorWidget/setcolorcenterwin.h: -------------------------------------------------------------------------------- 1 | #ifndef SETCOLORCENTERWIN_H 2 | #define SETCOLORCENTERWIN_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | namespace Ui { 9 | class SetColorCenterWin; 10 | } 11 | 12 | class SetColorCenterWin : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit SetColorCenterWin(QWidget *parent = 0); 18 | ~SetColorCenterWin(); 19 | void initUi(); 20 | signals: 21 | void closeS(); 22 | private slots: 23 | void setAppColor(); 24 | void on_backColorCombo_currentTextChanged(const QString &arg1); 25 | 26 | void on_btnColorCombo_currentTextChanged(const QString &arg1); 27 | 28 | void on_preSetColor_currentIndexChanged(int index); 29 | 30 | void on_saveBtn_clicked(); 31 | 32 | void on_backColorBtn_clicked(); 33 | 34 | void on_btnColorBtn_clicked(); 35 | 36 | private: 37 | Ui::SetColorCenterWin *ui; 38 | QByteArray backColor; 39 | QByteArray btnColor; 40 | }; 41 | 42 | #endif // SETCOLORCENTERWIN_H 43 | -------------------------------------------------------------------------------- /QFramer/QFramer.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | QFramer/fbasedialog.h \ 3 | QFramer/fbasepushbutton.h \ 4 | QFramer/fcenterwindow.h \ 5 | QFramer/fcheckablebutton.h \ 6 | QFramer/flywidget.h \ 7 | QFramer/fmainwindow.h \ 8 | QFramer/fmovablewidget.h \ 9 | QFramer/fnavgationbar.h \ 10 | QFramer/fnofocusdelegate.h \ 11 | QFramer/fshadowlabel.h \ 12 | QFramer/fstatebutton.h \ 13 | QFramer/ftabwidget.h \ 14 | QFramer/ftitlebar.h \ 15 | QFramer/futil.h \ 16 | QFramer/fwigglywidget.h 17 | 18 | SOURCES += \ 19 | QFramer/fbasedialog.cpp \ 20 | QFramer/fbasepushbutton.cpp \ 21 | QFramer/fcenterwindow.cpp \ 22 | QFramer/fcheckablebutton.cpp \ 23 | QFramer/flywidget.cpp \ 24 | QFramer/fmainwindow.cpp \ 25 | QFramer/fmovablewidget.cpp \ 26 | QFramer/fnavgationbar.cpp \ 27 | QFramer/fnofocusdelegate.cpp \ 28 | QFramer/fshadowlabel.cpp \ 29 | QFramer/fstatebutton.cpp \ 30 | QFramer/ftabwidget.cpp \ 31 | QFramer/ftitlebar.cpp \ 32 | QFramer/futil.cpp \ 33 | QFramer/fwigglywidget.cpp 34 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/tvlistwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef TVLISTWIDGET_H 2 | #define TVLISTWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | class TvListWidget : public QWidget 23 | { 24 | Q_OBJECT 25 | public: 26 | explicit TvListWidget(QWidget *parent = 0); 27 | signals: 28 | void play(QString url,QString quality); 29 | public slots: 30 | void loadTvSources(); 31 | void itemDoubleClicked(QTreeWidgetItem *item,int i); 32 | void customContextMenuRequested(QPoint p); 33 | void play(QAction *act); 34 | private: 35 | QGridLayout *mainLayout; 36 | QTreeWidget *treeWidget; 37 | QActionGroup *actGoup; 38 | }; 39 | 40 | #endif // TVLISTWIDGET_H 41 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerlistwidgetitem.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYERLISTWIDGETITEM_H 2 | #define PLAYERLISTWIDGETITEM_H 3 | 4 | #include 5 | #include "../imgbtn.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | class PlayerListWidgetItem : public QWidget 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit PlayerListWidgetItem(QWidget *parent = 0,QString tvId="0",QString tvName="none"); 15 | 16 | signals: 17 | void deleteItem(QString tvId); 18 | void sendPlay(QString tvId,QString tvNo); 19 | void updatePlayList(); 20 | public slots: 21 | void addSerial(QString tvNo,QString historyNo); 22 | void play(int btNo); 23 | void updateHistoryNo(int historyNo); 24 | int getRow(); 25 | void sendUpdatePlayList(); 26 | private: 27 | QGridLayout *mainGLayout; 28 | QHBoxLayout *hLayout; 29 | QString tvId; 30 | ImgBtn *deleteBtn; 31 | QPushButton *serialBtn; 32 | QButtonGroup *serialBtnGroup; 33 | int row; 34 | int column; 35 | }; 36 | 37 | #endif // PLAYERLISTWIDGETITEM_H 38 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "centerwindow.h" 8 | #include "QFramer/fmainwindow.h" 9 | #include "MyWidgets/PreferSetting/prefersettingmainwin.h" 10 | #include "MyWidgets/SetColorWidget/setcolorwidget.h" 11 | #include "MyWidgets/PreferSetting/prefersourcewidgetwin.h" 12 | class MainWindow : public FMainWindow 13 | { 14 | Q_OBJECT 15 | public: 16 | MainWindow(QWidget *parent = 0); 17 | ~MainWindow(); 18 | CenterWindow* centerWindow; 19 | protected: 20 | //void closeEvent(QCloseEvent *event); 21 | //void contextMenuEvent(QContextMenuEvent *event); 22 | void keyPressEvent(QKeyEvent *keyEvent); 23 | // void dragEnterEvent(QDragEnterEvent *event); 24 | // void dropEvent(QDropEvent *event); 25 | public slots: 26 | void getIntofullScreenMode(bool b); 27 | void getIntoWideMode(bool b); 28 | void popupSettingMenu(); 29 | void toggleStayOnTop(); 30 | void appColorChange(); 31 | private: 32 | 33 | bool isNowStayOnTop; 34 | SetColorWidget *setColorWidget; 35 | }; 36 | 37 | #endif // MAINWINDOW_H 38 | -------------------------------------------------------------------------------- /MyWidgets/RecommendWidget/recommendwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef RECOMMENDWIDGET_H 2 | #define RECOMMENDWIDGET_H 3 | 4 | #include 5 | #include "../ListShowWidget/listshowwidget.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "../mytip.h" 15 | class RecommendWidget : public QWidget 16 | { 17 | Q_OBJECT 18 | public: 19 | explicit RecommendWidget(QWidget *parent = 0); 20 | bool isFirstLoad; 21 | signals: 22 | 23 | void addDownloadTaskSignal(QString url); 24 | public slots: 25 | void loadDataFromServer(int page); 26 | void loadData(); 27 | void reLoadData(); 28 | 29 | void addDownloadTask(QString url,QString title); 30 | void search(); 31 | void counter();//服务器计数 32 | private: 33 | QNetworkAccessManager *manager; 34 | QGridLayout *mainGLayout; 35 | ListShowWidget *listShowWidget; 36 | QPushButton *dyRecommendBtn; 37 | QPushButton *searchBtn; 38 | QLineEdit *searchLineEdit; 39 | QString hostName; 40 | MyTip myTipWin; 41 | }; 42 | 43 | #endif // RECOMMENDWIDGET_H 44 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/loginform.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGINFORM_H 2 | #define LOGINFORM_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "../mytip.h" 18 | namespace Ui { 19 | class LoginForm; 20 | } 21 | 22 | class LoginForm : public QWidget 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | explicit LoginForm(QWidget *parent = 0); 28 | ~LoginForm(); 29 | void init(QNetworkAccessManager *manager = NULL); 30 | bool isInitMark; 31 | signals: 32 | void panInfoChanger(QString text); 33 | void loginSuccess(QString userName,QString token); 34 | public slots: 35 | QString getToken(); 36 | private slots: 37 | void on_lineEdit_editingFinished(); 38 | void on_pushButton_clicked(); 39 | 40 | private: 41 | Ui::LoginForm *ui; 42 | QString token; 43 | QNetworkAccessManager *manager; 44 | QString codestring; 45 | QString vcodetype; 46 | QString verifycode; 47 | MyTip myTipWin; 48 | 49 | }; 50 | 51 | #endif // LOGINFORM_H 52 | -------------------------------------------------------------------------------- /MyWidgets/MyDialog/myinputdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "myinputdialog.h" 2 | 3 | MyInputDialog::MyInputDialog(QWidget *parent) : 4 | QWidget(parent) 5 | { 6 | txtOrImgLbl = new QLabel; 7 | inputL = new QLineEdit; 8 | okBtn = new QPushButton; 9 | okBtn->setText("确定"); 10 | spaceItem = new QSpacerItem(60,25); 11 | mainLayout = new QGridLayout(this); 12 | mainLayout->setSpacing(3); 13 | mainLayout->setMargin(3); 14 | 15 | mainLayout->addWidget(txtOrImgLbl,0,0,1,1); 16 | mainLayout->addWidget(inputL,0,1,1,3); 17 | mainLayout->addItem(spaceItem,1,0,1,3); 18 | mainLayout->addWidget(okBtn,1,3,1,1); 19 | 20 | connect(okBtn,SIGNAL(clicked()),this,SLOT(emitAccept())); 21 | connect(inputL,SIGNAL(returnPressed()),this,SLOT(emitAccept())); 22 | } 23 | 24 | void MyInputDialog::setPixMap(QPixmap pix) 25 | { 26 | txtOrImgLbl->setPixmap(pix); 27 | } 28 | 29 | void MyInputDialog::setLblText(QString txt) 30 | { 31 | txtOrImgLbl->setText(txt); 32 | } 33 | 34 | void MyInputDialog::setLineEditText(QString txt) 35 | { 36 | inputL->setText(txt); 37 | } 38 | 39 | QString MyInputDialog::getText() 40 | { 41 | return inputL->text(); 42 | } 43 | 44 | void MyInputDialog::emitAccept() 45 | { 46 | emit acceptSignal(inputL->text()); 47 | } 48 | -------------------------------------------------------------------------------- /QFramer/fcheckablebutton.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FCHECKABLEBUTTON_H 24 | #define FCHECKABLEBUTTON_H 25 | 26 | #include 27 | 28 | class FCheckabelButton : public QPushButton 29 | { 30 | public: 31 | FCheckabelButton(const QString& text); 32 | }; 33 | 34 | #endif // FCHECKABLEBUTTON_H 35 | -------------------------------------------------------------------------------- /QFramer/fcheckablebutton.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fcheckablebutton.h" 24 | 25 | FCheckabelButton::FCheckabelButton(const QString& text) 26 | { 27 | setFlat(true); 28 | setCheckable(true); 29 | setFixedSize(80, 60); 30 | setText(text); 31 | setFocusPolicy(Qt::NoFocus); 32 | setObjectName("checkable"); 33 | } 34 | -------------------------------------------------------------------------------- /QFramer/fbasepushbutton.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FBASEPUSHBUTTON_H 24 | #define FBASEPUSHBUTTON_H 25 | 26 | #include 27 | 28 | class FBasePushButton : public QPushButton 29 | { 30 | Q_OBJECT 31 | public: 32 | explicit FBasePushButton(QWidget *parent = 0); 33 | 34 | signals: 35 | 36 | public slots: 37 | 38 | }; 39 | 40 | #endif // FBASEPUSHBUTTON_H 41 | -------------------------------------------------------------------------------- /QFramer/fshadowlabel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FSHADOWLABEL_H 24 | #define FSHADOWLABEL_H 25 | 26 | #include 27 | 28 | 29 | class FShadowLabel : public QLabel 30 | { 31 | Q_OBJECT 32 | public: 33 | explicit FShadowLabel(const QString &text, QWidget *parent = 0); 34 | explicit FShadowLabel(QWidget *parent = 0); 35 | 36 | signals: 37 | 38 | public slots: 39 | 40 | }; 41 | 42 | #endif // FSHADOWLABEL_H 43 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersourcewidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | preferSourceWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 235 10 | 299 11 | 12 | 13 | 14 | Form 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 | -------------------------------------------------------------------------------- /QFramer/fbasepushbutton.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fbasepushbutton.h" 24 | #include 25 | 26 | 27 | FBasePushButton::FBasePushButton(QWidget *parent) : 28 | QPushButton(parent) 29 | { 30 | setFixedSize(60, 30); 31 | QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); 32 | shadow_effect->setOffset(-5, 5); 33 | shadow_effect->setColor(Qt::gray); 34 | shadow_effect->setBlurRadius(8); 35 | setGraphicsEffect(shadow_effect); 36 | } 37 | -------------------------------------------------------------------------------- /MyWidgets/ThreadDownload/downloadwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef DOWNLOADWIDGET_H 2 | #define DOWNLOADWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "../mytip.h" 17 | namespace Ui { 18 | class DownloadWidget; 19 | } 20 | 21 | class DownloadWidget : public QWidget 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit DownloadWidget(QWidget *parent = 0, QString url = "", QString fileSavePath="", qint64 taskId = 0, int percent = 0); 27 | ~DownloadWidget(); 28 | protected: 29 | void closeEvent(QCloseEvent *); 30 | signals: 31 | void play(QString filePath); 32 | public slots: 33 | void startDownload(QString url,QString fileSavePath); 34 | QString getRealUrl(QString url); 35 | void readyReadStandardOutput(); 36 | void readyReadStandardError(); 37 | void saveSetting(); 38 | void on_startBtn_clicked(); 39 | 40 | void on_playBtn_clicked(); 41 | 42 | void on_pauseBtn_clicked(); 43 | 44 | void on_deleteBtn_clicked(); 45 | 46 | private: 47 | Ui::DownloadWidget *ui; 48 | QProcess *process; 49 | QString url; 50 | QString fileSavePath; 51 | qint64 taskId; 52 | double percent; 53 | QString realUrl; 54 | QNetworkAccessManager *manager; 55 | QTimer *saveSettingTimer; 56 | MyTip myTipWin; 57 | 58 | }; 59 | 60 | #endif // DOWNLOADWIDGET_H 61 | -------------------------------------------------------------------------------- /QFramer/fnofocusdelegate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FNOFOCUSDELEGATE_H 24 | #define FNOFOCUSDELEGATE_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | class FNoFocusDelegate : public QStyledItemDelegate 33 | { 34 | Q_OBJECT 35 | public: 36 | explicit FNoFocusDelegate(QObject *parent = 0); 37 | void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; 38 | signals: 39 | 40 | public slots: 41 | 42 | }; 43 | 44 | #endif // FNOFOCUSDELEGATE_H 45 | -------------------------------------------------------------------------------- /QFramer/fstatebutton.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FSTATEBUTTON_H 24 | #define FSTATEBUTTON_H 25 | 26 | #include 27 | 28 | 29 | class FStateButton : public QPushButton 30 | { 31 | Q_OBJECT 32 | private: 33 | QString fStateIcon; 34 | QString bStateIcon; 35 | int state; 36 | int bflag; 37 | private slots: 38 | void changeState(); 39 | public: 40 | explicit FStateButton(const QString &ficon, const QString &bicon, int buttonFlag = 0, QWidget *parent = 0); 41 | int getState(); 42 | signals: 43 | void stateChanged(); 44 | public slots: 45 | 46 | }; 47 | 48 | #endif // FSTATEBUTTON_H 49 | -------------------------------------------------------------------------------- /QFramer/fmovablewidget.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FMOVABLEWIDGET_H 24 | #define FMOVABLEWIDGET_H 25 | 26 | #include 27 | #include 28 | 29 | 30 | class FMovableWidget : public QFrame 31 | { 32 | Q_OBJECT 33 | private: 34 | QPoint dragPosition; 35 | bool leftbuttonpressed; 36 | protected: 37 | void mouseMoveEvent(QMouseEvent *e); 38 | void mousePressEvent(QMouseEvent *e); 39 | void mouseReleaseEvent(QMouseEvent *e); 40 | 41 | public: 42 | explicit FMovableWidget(QWidget *parent = 0); 43 | 44 | signals: 45 | 46 | public slots: 47 | 48 | }; 49 | 50 | #endif // FMOVABLEWIDGET_H 51 | -------------------------------------------------------------------------------- /QFramer/fwigglywidget.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FWIGGLYWIDGET_H 24 | #define FWIGGLYWIDGET_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | class FWigglyWidget : public QLabel 33 | { 34 | Q_OBJECT 35 | 36 | public: 37 | FWigglyWidget(const QString &text, QWidget *parent = 0); 38 | 39 | protected: 40 | void paintEvent(QPaintEvent *event); 41 | void timerEvent(QTimerEvent *event); 42 | 43 | private: 44 | QBasicTimer timer; 45 | QString text; 46 | int step; 47 | }; 48 | 49 | 50 | #endif // FWIGGLYWIDGET_H 51 | -------------------------------------------------------------------------------- /QFramer/futil.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef UTIL_H 24 | #define UTIL_H 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 35 | void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg); 36 | void loadFonts(QApplication& app); 37 | #endif 38 | 39 | 40 | QString getQssFromFile(QString filename); 41 | QString readFile(const QString filename); 42 | void setSkinForApp(QString filename); 43 | 44 | #endif // UTIL_H 45 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/loadimgthread.cpp: -------------------------------------------------------------------------------- 1 | #include "loadimgthread.h" 2 | #include 3 | #include 4 | LoadImgThread::LoadImgThread(QObject *parent, QString url) : 5 | QThread(parent) 6 | { 7 | this->url=url; 8 | } 9 | 10 | void LoadImgThread::run() 11 | { 12 | manager = new QNetworkAccessManager; 13 | QByteArray data; 14 | int tryTimes=5; 15 | //尝试tryTimes次 16 | QString realUrl_temp = this->url; 17 | while(tryTimes --) 18 | { 19 | QEventLoop loop; 20 | QNetworkReply *reply = manager->head(QNetworkRequest(realUrl_temp)); 21 | connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 22 | loop.exec(); 23 | QVariant varLocation = reply->header(QNetworkRequest::LocationHeader); 24 | if(!varLocation.isNull()) 25 | { 26 | realUrl_temp = varLocation.toString(); 27 | //qDebug()<url = realUrl_temp; 34 | 35 | QTime time; 36 | time= QTime::currentTime(); 37 | qsrand(time.msec()+time.second()*1000); 38 | int msec = qrand()%2000; 39 | QEventLoop loop0; 40 | QTimer::singleShot(msec,&loop0,SLOT(quit())); 41 | loop0.exec(); 42 | 43 | QNetworkReply *reply1 = manager->get(QNetworkRequest(QUrl(url))); 44 | QEventLoop loop1; 45 | QTimer::singleShot(20000,&loop1,SLOT(quit())); 46 | QObject::connect(reply1, SIGNAL(finished()), &loop1, SLOT(quit())); 47 | loop1.exec(); 48 | data = reply1->readAll(); 49 | emit imageReady(data); 50 | 51 | delete reply1; 52 | delete manager; 53 | } 54 | -------------------------------------------------------------------------------- /QFramer/fnofocusdelegate.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fnofocusdelegate.h" 24 | #include 25 | 26 | 27 | FNoFocusDelegate::FNoFocusDelegate(QObject *parent) : 28 | QStyledItemDelegate(parent) 29 | { 30 | } 31 | 32 | void FNoFocusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const 33 | { 34 | QStyleOptionViewItem itemOption(option); 35 | if (itemOption.state & QStyle::State_HasFocus) 36 | { 37 | QPen penVal(Qt::white); 38 | penVal.setWidth(0); 39 | painter->setPen (penVal); 40 | } 41 | QStyledItemDelegate::paint(painter, itemOption, index); 42 | } 43 | -------------------------------------------------------------------------------- /QFramer/fmovablewidget.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fmovablewidget.h" 24 | 25 | 26 | FMovableWidget::FMovableWidget(QWidget *parent) : 27 | QFrame(parent) 28 | { 29 | } 30 | 31 | 32 | void FMovableWidget::mousePressEvent(QMouseEvent *e) 33 | { 34 | if(e->button() & Qt::LeftButton) 35 | { 36 | dragPosition = e->globalPos() - frameGeometry().topLeft(); 37 | leftbuttonpressed = true; 38 | } 39 | e->accept(); 40 | } 41 | 42 | 43 | void FMovableWidget::mouseReleaseEvent(QMouseEvent *e) 44 | { 45 | leftbuttonpressed = false; 46 | e->accept(); 47 | } 48 | 49 | void FMovableWidget::mouseMoveEvent(QMouseEvent *e) 50 | { 51 | if(leftbuttonpressed) 52 | { 53 | move(e->globalPos() - dragPosition); 54 | } 55 | e->accept(); 56 | } 57 | -------------------------------------------------------------------------------- /QFramer/fshadowlabel.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fshadowlabel.h" 24 | #include 25 | 26 | 27 | FShadowLabel::FShadowLabel(const QString &text, QWidget *parent) : 28 | QLabel(text, parent) 29 | { 30 | QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); 31 | shadow_effect->setOffset(-5, 5); 32 | shadow_effect->setColor(Qt::darkGreen); 33 | shadow_effect->setBlurRadius(8); 34 | setGraphicsEffect(shadow_effect); 35 | } 36 | 37 | FShadowLabel::FShadowLabel(QWidget *parent) : 38 | QLabel(parent) 39 | { 40 | QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); 41 | shadow_effect->setOffset(-5, 5); 42 | shadow_effect->setColor(Qt::darkGreen); 43 | shadow_effect->setBlurRadius(8); 44 | setGraphicsEffect(shadow_effect); 45 | } 46 | -------------------------------------------------------------------------------- /centerwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef CENTERWINDOW_H 2 | #define CENTERWINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "QFramer/fcenterwindow.h" 14 | #include "MyWidgets/PlayerWidget/playerwidget.h" 15 | #include "MyWidgets/BrowseWidget/browsewidget.h" 16 | #include "MyWidgets/RecommendWidget/recommendwidget.h" 17 | #include "MyWidgets/MagnetWidget/magnetwidget.h" 18 | #include "MyWidgets/ThreadDownload/downloadwidget.h" 19 | class CenterWindow : public FCenterWindow 20 | { 21 | Q_OBJECT 22 | public: 23 | explicit CenterWindow(QWidget *parent = 0); 24 | PlayerWidget *playerWidget; 25 | signals: 26 | void getIntofullScreenSignal(bool b); 27 | void getIntoWideSignal(bool b); 28 | public slots: 29 | void addMvToPlaylist(QString tvUrl); 30 | void getIntofullScreenMode(bool b); 31 | void getIntoWideModel(bool b); 32 | void switchToPlayerAndPlay(QString fileSavePath); 33 | void checkVersion(); 34 | void timeToCheckV(); 35 | void play(QString fileSavePath); 36 | void firstLoadList(int i); 37 | void addDownloadTask(QString url); 38 | void loadDownloadSettings(); 39 | void hideMouse(); 40 | void setIndex0(); 41 | 42 | private: 43 | 44 | BrowseWidget *browseWidget; 45 | RecommendWidget *recommendWidget; 46 | MagnetWidget *magnetWidget; 47 | QScrollArea *downloadManageWidget; 48 | DownloadWidget *downLoadWidget; 49 | QString version; 50 | QWidget *downloadManageScrollAreaWidget; 51 | QVBoxLayout *downloadManageScrollAreaWidgetMainLayout; 52 | bool isDownLoadManagerFirstLoad; 53 | QTimer *hideMouseTimer; 54 | MyTip myTipWin; 55 | 56 | }; 57 | 58 | #endif // CENTERWINDOW_H 59 | -------------------------------------------------------------------------------- /QFramer/ftabwidget.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FTABWIDGET_H 24 | #define FTABWIDGET_H 25 | 26 | #include 27 | #include 28 | #include"fcheckablebutton.h" 29 | #include"QBoxLayout" 30 | 31 | 32 | class FTabWidget : public QWidget 33 | { 34 | Q_OBJECT 35 | 36 | private: 37 | QList buttons; 38 | QList buttonTitles; 39 | 40 | private: 41 | void initUI(); 42 | void initConnect(); 43 | 44 | public: 45 | QWidget* tabTile; 46 | QBoxLayout* mainLayout; 47 | QStackedLayout* stackLayout; 48 | QVBoxLayout* tabLayout; 49 | public: 50 | explicit FTabWidget(QWidget *parent = 0); 51 | QList getButtons(); 52 | 53 | signals: 54 | void indexChanged(int i); 55 | public slots: 56 | void addWidget(const QString &tile, const QString &objectName, QWidget *widget); 57 | void setButtonChecked(); 58 | }; 59 | 60 | #endif // FTABWIDGET_H 61 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/imagelabel.cpp: -------------------------------------------------------------------------------- 1 | #include "imagelabel.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | ImageLabel::ImageLabel(QObject *parent, QString url, int timeToDelay) 9 | { 10 | setAttribute(Qt::WA_TranslucentBackground, true); 11 | //setScaledContents(true); 12 | // setMaximumSize(260,290); 13 | // setMinimumSize(240,280); 14 | setMaximumSize(115,160); 15 | setMinimumSize(115,160); 16 | //setStyleSheet("border-width: 3px;border-color: rgba(255,170,0,150);"); 17 | 18 | this->url=url; 19 | QPixmap p; 20 | p.load(":/images/images/load.jpg"); 21 | p = p.scaled(this->width(),this->height(),Qt::KeepAspectRatio); 22 | setPixmap(p); 23 | //QTimer::singleShot(timeToDelay,this,SLOT(getImage())); 24 | isImgLoaded =false; 25 | 26 | QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); 27 | shadow_effect->setOffset(3, 3); 28 | shadow_effect->setColor(Qt::black); 29 | shadow_effect->setBlurRadius(5); 30 | setGraphicsEffect(shadow_effect); 31 | } 32 | 33 | void ImageLabel::mouseReleaseEvent(QMouseEvent *e) 34 | { 35 | Q_UNUSED(e) 36 | emit clicked(); 37 | } 38 | void ImageLabel::getImage() 39 | { 40 | foreach (LoadImgThread *t, imgThreadList) { 41 | t->terminate(); 42 | } 43 | imgThreadList.clear(); 44 | LoadImgThread *t1 = new LoadImgThread(0,this->url); 45 | imgThreadList.append(t1); 46 | connect(t1,SIGNAL(imageReady(QByteArray)),this,SLOT(readImage(QByteArray))); 47 | connect(t1,SIGNAL(finished()),t1,SLOT(deleteLater())); 48 | t1->start(); 49 | } 50 | 51 | void ImageLabel::readImage(QByteArray data) 52 | { 53 | QPixmap pix; 54 | if(pix.loadFromData(data)) 55 | { 56 | pix = pix.scaled(this->width(),this->height(),Qt::KeepAspectRatio,Qt::SmoothTransformation); 57 | this->setPixmap(pix); 58 | 59 | } 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /QFramer/flywidget.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FLYWIDGET_H 24 | #define FLYWIDGET_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | class FlyWidget : public QWidget 34 | { 35 | Q_OBJECT 36 | private: 37 | QWidget* p; 38 | 39 | protected: 40 | void mousePressEvent(QMouseEvent *event); 41 | void mouseMoveEvent(QMouseEvent *event); 42 | void mouseDoubleClickEvent(QMouseEvent * event); 43 | void paintEvent(QPaintEvent *event); 44 | void enterEvent(QEvent *event); 45 | void leaveEvent(QEvent *event); 46 | 47 | private: 48 | QPoint m_CurrentPos; 49 | QPixmap m_Pixmap; 50 | public: 51 | QMenu* settingmenu; 52 | public: 53 | explicit FlyWidget(QWidget *parent = 0); 54 | void initData(); 55 | void initUI(); 56 | void initConnect(); 57 | void setMenu(QMenu* menu); 58 | signals: 59 | 60 | public slots: 61 | 62 | }; 63 | 64 | #endif // FLYWIDGET_H 65 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/vcodedialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | VcodeDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 324 10 | 113 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | img 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Qt::Horizontal 31 | 32 | 33 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | buttonBox 43 | accepted() 44 | VcodeDialog 45 | accept() 46 | 47 | 48 | 248 49 | 254 50 | 51 | 52 | 157 53 | 274 54 | 55 | 56 | 57 | 58 | buttonBox 59 | rejected() 60 | VcodeDialog 61 | reject() 62 | 63 | 64 | 316 65 | 260 66 | 67 | 68 | 286 69 | 274 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /QFramer/fbasedialog.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FBASEDIALOG_H 24 | #define FBASEDIALOG_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include "ftitlebar.h" 31 | #include 32 | 33 | class FBaseDialog : public QDialog 34 | { 35 | Q_OBJECT 36 | private: 37 | QPoint dragPosition; 38 | 39 | private: 40 | void mouseMoveEvent(QMouseEvent *e); 41 | void mousePressEvent(QMouseEvent *e); 42 | void mouseReleaseEvent(QMouseEvent *e); 43 | 44 | FTitleBar* titlebar; 45 | 46 | protected: 47 | void showEvent(QShowEvent * event); 48 | void closeEvent(QCloseEvent * event); 49 | public: 50 | QSize normalSize; 51 | QVBoxLayout* fMainLayout; 52 | 53 | public: 54 | explicit FBaseDialog(QWidget *parent = 0); 55 | void initData(); 56 | void initUI(); 57 | void initConnect(); 58 | FTitleBar* getTitleBar(); 59 | 60 | signals: 61 | 62 | public slots: 63 | virtual void animationClose(); 64 | }; 65 | 66 | #endif // FBASEDIALOG_H 67 | -------------------------------------------------------------------------------- /rs.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | skin/qss/template.qss 4 | 5 | 6 | images/delete.png 7 | images/download.ico 8 | images/downloadManage.png 9 | images/icon.png 10 | images/list.png 11 | images/load.jpg 12 | images/magnet.png 13 | images/player.png 14 | images/share.png 15 | images/tipBackgound.png 16 | images/tipBusy.png 17 | skin/images/appbar.black_down.png 18 | skin/images/appbar.black_right.png 19 | skin/images/bg.png 20 | skin/images/downsolidarrow.png 21 | skin/images/rightsolidarrow.png 22 | 23 | 24 | skin/icons/dark/appbar.app.png 25 | skin/icons/dark/appbar.close.png 26 | skin/icons/dark/appbar.clothes.shirt.png 27 | skin/icons/dark/appbar.control.down.png 28 | skin/icons/dark/appbar.fullscreen.box.png 29 | skin/icons/dark/appbar.lock.png 30 | skin/icons/dark/appbar.minus.png 31 | skin/icons/dark/appbar.page.delete.png 32 | skin/icons/dark/appbar.download.png 33 | skin/icons/dark/appbar.list.png 34 | skin/icons/dark/appbar.player.png 35 | skin/icons/dark/appbar.share.png 36 | skin/icons/dark/appbar.magnet.png 37 | skin/icons/dark/appbar.download.dark.png 38 | skin/icons/dark/appbar.list.dark.png 39 | skin/icons/dark/appbar.magnet.dark.png 40 | skin/icons/dark/appbar.player.dark.png 41 | skin/icons/dark/appbar.share.dark.png 42 | 43 | 44 | -------------------------------------------------------------------------------- /MyWidgets/BrowseWidget/adshow.cpp: -------------------------------------------------------------------------------- 1 | #include "adshow.h" 2 | #include 3 | #include 4 | #include 5 | AdShow::AdShow(QWidget *parent) : 6 | QWidget(parent) 7 | { 8 | mainGird = new QGridLayout(this); 9 | imgLbl = new QLabel; 10 | //imgLbl->setScaledContents(true); 11 | txtLbl = new QLabel; 12 | txtLbl->setOpenExternalLinks(true); 13 | txtLbl->setWordWrap(true); 14 | mainGird->addWidget(imgLbl,0,0,2,5); 15 | mainGird->addWidget(txtLbl,2,0,1,5); 16 | setLayout(mainGird); 17 | 18 | host = "http://www.mvgather.com"; 19 | QTimer::singleShot(5000, this, SLOT(getData())); 20 | 21 | 22 | } 23 | 24 | void AdShow::getData() 25 | { 26 | QString url; 27 | url.append(host); 28 | url.append("/mvgather/announcement/announcement.php"); 29 | manager = new QNetworkAccessManager; 30 | QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url))); 31 | QEventLoop loop; 32 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 33 | loop.exec(); 34 | QString data = QString(reply->readAll()); 35 | //qDebug()<setText(list_temp.value(1,"")); 49 | }else if(list_temp.value(0,"") == "pic") 50 | { 51 | showPicAd(list_temp.value(1,""),list_temp.value(2,"")); 52 | } 53 | } 54 | 55 | void AdShow::showPicAd(QString picUrl, QString txt) 56 | { 57 | txtLbl->setText(txt); 58 | QNetworkReply *reply1 = manager->get(QNetworkRequest(QUrl(picUrl))); 59 | QEventLoop loop1; 60 | QObject::connect(reply1, SIGNAL(finished()), &loop1, SLOT(quit())); 61 | loop1.exec(); 62 | QByteArray data = reply1->readAll(); 63 | if(data =="") 64 | { 65 | return; 66 | } 67 | QPixmap pix; 68 | pix.loadFromData(data); 69 | imgLbl->setPixmap(pix); 70 | } 71 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/listshowwidgetitem.cpp: -------------------------------------------------------------------------------- 1 | #include "listshowwidgetitem.h" 2 | #include 3 | #include 4 | ListShowWidgetItem::ListShowWidgetItem(QWidget *parent, QString tvUrl, QString imgUrl, QString title, QString descripe,int timeToDelay) 5 | { 6 | this->tvUrl = tvUrl;//对于百度视频,tvUrl代表其ID 7 | this->imgUrl = imgUrl; 8 | this->title = title; 9 | this->descripe = descripe; 10 | 11 | mainGLayout = new QGridLayout(this); 12 | ImgLbl = new ImageLabel(this,imgUrl,timeToDelay); 13 | connect(ImgLbl,SIGNAL(clicked()),this,SLOT(SendClicked())); 14 | titleLbl = new QLabel(title,this); 15 | descripeLbl = new QLabel(""+descripe+"",this);//""+descripe+"" 16 | titleLbl->setToolTip(title); 17 | descripeLbl->setToolTip(descripe); 18 | //descripeLbl->setStyleSheet(""); 19 | 20 | mainGLayout->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter); 21 | mainGLayout->setSpacing(2); 22 | mainGLayout->setMargin(4); 23 | 24 | mainGLayout->addWidget(ImgLbl,0,0,6,1); 25 | mainGLayout->addWidget(titleLbl,6,0,1,1); 26 | mainGLayout->addWidget(descripeLbl,7,0,1,1); 27 | 28 | // setMaximumSize(210,350); 29 | // setMinimumSize(190,340); 30 | 31 | setMaximumSize(130,230); 32 | setMinimumSize(120,220); 33 | 34 | }/* 35 | 36 | void ListShowWidgetItem::paintEvent(QPaintEvent *) 37 | { 38 | QPainter painter(this); 39 | painter.setBrush(QBrush(QColor(255,255,255,10))); 40 | painter.setPen(QColor(0,0,0,0)); 41 | painter.drawRect(this->rect()); 42 | }*/ 43 | 44 | void ListShowWidgetItem::SendClicked() 45 | { 46 | 47 | //titleLbl->setStyleSheet("background-color:#7B7B7B;radius:3px"); 48 | ImgLbl->setStyleSheet("border:3px solid #7B7B7B"); 49 | QTimer::singleShot(300,this,SLOT(backgroundColorChange())); 50 | emit clicked(this->tvUrl,this->title); 51 | 52 | } 53 | 54 | void ListShowWidgetItem::loadImg() 55 | { 56 | ImgLbl->getImage(); 57 | } 58 | 59 | void ListShowWidgetItem::backgroundColorChange() 60 | { 61 | //titleLbl->setStyleSheet(""); 62 | ImgLbl->setStyleSheet(""); 63 | } 64 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersourcewidget.cpp: -------------------------------------------------------------------------------- 1 | #include "prefersourcewidget.h" 2 | #include "ui_prefersourcewidget.h" 3 | #include 4 | preferSourceWidget::preferSourceWidget(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::preferSourceWidget) 7 | { 8 | ui->setupUi(this); 9 | QSettings settings("MvGather", "xusongjie"); 10 | QString preferSource = settings.value("app/preferSource", "letv#youku#tudou#imgotv#fun#funsion#hunantv#qq#qiyi#sohu#pptv#pps#1905").toString(); 11 | ui->listWidget->addItems(preferSource.split("#")); 12 | 13 | } 14 | 15 | preferSourceWidget::~preferSourceWidget() 16 | { 17 | delete ui; 18 | } 19 | 20 | void preferSourceWidget::on_saveBtn_clicked() 21 | { 22 | QStringList list_temp; 23 | int totalRows = ui->listWidget->count(); 24 | for(int i=0;ilistWidget->item(i)->text()); 27 | } 28 | QSettings settings("MvGather", "xusongjie"); 29 | settings.setValue("app/preferSource", list_temp.join("#")); 30 | emit closeSig(); 31 | } 32 | 33 | void preferSourceWidget::on_upBtn_clicked() 34 | { 35 | int currentItemIndex = ui->listWidget->currentRow(); 36 | if(currentItemIndex <= 0) 37 | { 38 | return; 39 | } 40 | QListWidgetItem *currentItem= ui->listWidget->takeItem(ui->listWidget->currentRow()); 41 | ui->listWidget->insertItem(currentItemIndex-1,currentItem); 42 | ui->listWidget->setCurrentItem(currentItem); 43 | } 44 | 45 | void preferSourceWidget::on_downBtn_clicked() 46 | { 47 | int currentItemIndex = ui->listWidget->currentRow(); 48 | if(currentItemIndex >= ui->listWidget->count()-1||currentItemIndex<0 ) 49 | { 50 | return; 51 | } 52 | QListWidgetItem *currentItem= ui->listWidget->takeItem(ui->listWidget->currentRow()); 53 | ui->listWidget->insertItem(currentItemIndex+1,currentItem); 54 | ui->listWidget->setCurrentItem(currentItem); 55 | } 56 | 57 | void preferSourceWidget::on_resetBtn_clicked() 58 | { 59 | QString str("letv#youku#tudou#imgotv#fun#funsion#hunantv#qq#qiyi#sohu#pptv#pps#1905"); 60 | ui->listWidget->clear(); 61 | ui->listWidget->addItems(str.split("#")); 62 | } 63 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/magnetwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef MAGNETWIDGET_H 2 | #define MAGNETWIDGET_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "loginformwin.h" 21 | #include "vcodedialog.h" 22 | #include "../mytip.h" 23 | namespace Ui { 24 | class MagnetWidget; 25 | } 26 | 27 | class MagnetWidget : public QWidget 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | explicit MagnetWidget(QWidget *parent = 0); 33 | ~MagnetWidget(); 34 | bool isFirstLoad; 35 | signals: 36 | void addDownloadTask(QString url); 37 | public slots: 38 | void getMp4baMagnetList(); 39 | private slots: 40 | void on_searchLineEdit_returnPressed(); 41 | 42 | void getMagnetList(QString keyWord); 43 | void setPanInfo(QString text); 44 | void getRealUrl(QString path); 45 | void newMagnetTask(QString url); 46 | void newUrlTask(QString UrlText);// 47 | void on_searchBtn_clicked(); 48 | 49 | void on_loginBtn_clicked(); 50 | 51 | void loginSuccess(QString userName,QString token); 52 | 53 | void on_panMovieListWidget_doubleClicked(const QModelIndex &index); 54 | 55 | void on_panMovieListWidget_customContextMenuRequested(const QPoint &pos); 56 | 57 | void on_clearTaskBtn_clicked(); 58 | 59 | void on_downloadMagnetlistWidget_customContextMenuRequested(const QPoint &pos); 60 | 61 | void on_magnetSearchTbWidget_customContextMenuRequested(const QPoint &pos); 62 | 63 | 64 | void on_deleteFiles_clicked(); 65 | 66 | void on_newMagnet_clicked(); 67 | 68 | void on_refreshTaskBtn_clicked(); 69 | 70 | void on_refreshFilesList_clicked(); 71 | 72 | void on_newUrlTaskBtn_clicked(); 73 | 74 | private: 75 | Ui::MagnetWidget *ui; 76 | QNetworkAccessManager *searchManager; 77 | QNetworkAccessManager *panManager; 78 | LoginFormWin loginFormWin; 79 | QString token; 80 | QString userName; 81 | MyTip myTipWin; 82 | }; 83 | 84 | #endif // MAGNETWIDGET_H 85 | -------------------------------------------------------------------------------- /MyWidgets/mytip.cpp: -------------------------------------------------------------------------------- 1 | #include "mytip.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | MyTip::MyTip(QWidget *parent) : 8 | QWidget(parent) 9 | { 10 | setWindowFlags(Qt::FramelessWindowHint|Qt::Tool | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint); 11 | setAttribute(Qt::WA_TranslucentBackground, true); 12 | resize(200,60); 13 | QDesktopWidget* desktop = QApplication::desktop(); 14 | move(desktop->width()-this->width()-10, this->height()/2); 15 | busyAngle = 1.0; 16 | busyAnglePlusTimer = new QTimer(this); 17 | connect(busyAnglePlusTimer,SIGNAL(timeout()),SLOT(busyAnglePlus())); 18 | busyAnglePlusTimer->start(100); 19 | text = "busy"; 20 | isBusyIndicatorShow = false; 21 | } 22 | 23 | void MyTip::paintEvent(QPaintEvent *e) 24 | { 25 | QPainter painter(this); 26 | painter.setRenderHint(QPainter::Antialiasing); 27 | painter.save(); 28 | painter.setPen(Qt::NoPen); 29 | painter.setBrush(QBrush(QColor(10,10,10,200))); 30 | //painter.drawRect(this->rect()); 31 | painter.drawRoundedRect(this->rect(),5,5); 32 | 33 | painter.setPen(Qt::white); 34 | painter.scale(1.2,1.2); 35 | painter.drawText(30,this->height()/2,text); 36 | painter.restore(); 37 | if(isBusyIndicatorShow) 38 | { 39 | QPixmap pixBusy(":/images/images/tipBusy.png"); 40 | painter.translate(this->width()-25,this->height()/2); 41 | painter.rotate(busyAngle); 42 | painter.scale(0.6,0.6); 43 | painter.drawPixmap(-20,-20,pixBusy); 44 | } 45 | } 46 | 47 | void MyTip::mouseReleaseEvent(QMouseEvent *) 48 | { 49 | this->hide(); 50 | } 51 | 52 | void MyTip::setText(QString text) 53 | { 54 | this->text = text; 55 | } 56 | 57 | void MyTip::timeToClose(int second) 58 | { 59 | QTimer::singleShot(second*1000,this,SLOT(close())); 60 | } 61 | 62 | void MyTip::timeToHide(int second) 63 | { 64 | QTimer::singleShot(second*1000,this,SLOT(hide())); 65 | } 66 | 67 | void MyTip::busyAnglePlus() 68 | { 69 | if(busyAngle >= 361.0) 70 | { 71 | busyAngle = 1.0; 72 | } 73 | busyAngle += 60.0; 74 | repaint(); 75 | } 76 | 77 | void MyTip::setBusyIndicatorShow(bool on) 78 | { 79 | isBusyIndicatorShow = on; 80 | } 81 | -------------------------------------------------------------------------------- /QFramer/fwigglywidget.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fwigglywidget.h" 24 | 25 | FWigglyWidget::FWigglyWidget(const QString &newtext, QWidget *parent) 26 | : QLabel(newtext, parent) 27 | { 28 | text = newtext; 29 | step = 0; 30 | timer.start(60, this); 31 | } 32 | 33 | void FWigglyWidget::paintEvent(QPaintEvent * /* event */) 34 | 35 | { 36 | static const int sineTable[16] = { 37 | 0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38 38 | }; 39 | 40 | QFontMetrics metrics(font()); 41 | int x = (width() - metrics.width(text)) / 2; 42 | int y = (height() + metrics.ascent() - metrics.descent()) / 2; 43 | QColor color; 44 | QPainter painter(this); 45 | 46 | for (int i = 0; i < text.size(); ++i) { 47 | int index = (step + i) % 16; 48 | color.setHsv((15 - index) * 16, 255, 255); 49 | painter.setPen(color); 50 | painter.drawText(x, y - ((sineTable[index] * metrics.height()) / 400), 51 | QString(text[i])); 52 | x += metrics.width(text[i]); 53 | } 54 | } 55 | 56 | void FWigglyWidget::timerEvent(QTimerEvent *event) 57 | { 58 | if (event->timerId() == timer.timerId()) { 59 | ++step; 60 | update(); 61 | } else { 62 | QLabel::timerEvent(event); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /QFramer/fstatebutton.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fstatebutton.h" 24 | 25 | #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 26 | #include 27 | #else 28 | #include 29 | #endif 30 | 31 | #include 32 | 33 | 34 | FStateButton::FStateButton(const QString &ficon, const QString &bicon, int buttonFlag, QWidget *parent): 35 | QPushButton(parent), fStateIcon(ficon), bStateIcon(bicon), bflag(buttonFlag) 36 | { 37 | state = 0; 38 | if(bflag == 0) 39 | { 40 | setIcon(QIcon(fStateIcon)); 41 | setIconSize(QPixmap(fStateIcon).size()); 42 | } 43 | else if (bflag == 1) 44 | { 45 | setText(fStateIcon);; 46 | } 47 | connect(this, SIGNAL(clicked()), this, SLOT(changeState())); 48 | } 49 | 50 | void FStateButton::changeState() 51 | { 52 | state = qAbs(1 - state); 53 | if(state == 0){ 54 | if(bflag == 0){ 55 | setIcon(QIcon(fStateIcon)); 56 | setMask(QBitmap(fStateIcon).mask()); 57 | } 58 | else if(bflag == 1) 59 | { 60 | setText(fStateIcon); 61 | } 62 | 63 | } 64 | else if(state == 1) 65 | { 66 | if(bflag == 0){ 67 | setIcon(QIcon(bStateIcon)); 68 | setMask(QBitmap(bStateIcon).mask()); 69 | } 70 | else if(bflag == 1) 71 | { 72 | setText(bStateIcon); 73 | } 74 | } 75 | emit stateChanged(); 76 | } 77 | 78 | int FStateButton::getState() 79 | { 80 | return state; 81 | } 82 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYERWIDGET_H 2 | #define PLAYERWIDGET_H 3 | 4 | #include 5 | #include 6 | #include "playerlistarea.h" 7 | #include "playerwin.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "progressbar.h" 13 | #include "tvlistwidget.h" 14 | #include "analyzer.h" 15 | #include "../mytip.h" 16 | #include 17 | #include 18 | 19 | class PlayerWidget : public QWidget 20 | { 21 | Q_OBJECT 22 | public: 23 | explicit PlayerWidget(QWidget *parent = 0); 24 | void initUI(); 25 | PlayerWin *playerWin; 26 | 27 | signals: 28 | void hideToFullScreen(bool b); 29 | void getIntoWideModel(bool b); 30 | public slots: 31 | void addTvList(QString TvName,QStringList playno_hrefs);//tvname即视频中文名,playno_hrefs,即集数编号与视频网站对应地址,格式为playno#href 32 | void play(QString tvId,QString tvNO); 33 | void getRealHref(QString href); 34 | void addMplayListAndPlay(QString filesUrl, QString quality); 35 | void SendHideToFullScreen(bool b); 36 | void SendGetIntoWideModel(bool b); 37 | void updatePlayList(); 38 | void Player2Ready(int sliceIndex); 39 | void makePlayer2Ready(); 40 | void writeQuitPro(); 41 | void handlePlayFinished(); 42 | void handleLoadingMedia(); 43 | void PlayNewUrls(QString urlsToPlay,QString quality); 44 | void loadSlice(int i); 45 | void addFilesTimer(); 46 | void syncMv(); 47 | void anyliseData(QByteArray data,QString tvId,QString tvUrl,QString source); 48 | void UpdateAllHrefs(); 49 | void getFlvxzTokens(); 50 | void checkClipboard(); 51 | void playNextOne(); 52 | void seekPos(qreal pos); 53 | void reset(); 54 | private: 55 | QGridLayout *mainGLayout; 56 | QTabWidget * PlayerListAreaTab; 57 | PlayerListArea *listArea; 58 | TvListWidget *tvListWidget; 59 | ProgressBar *progressBar; 60 | 61 | QString allHrefs;// 62 | QString playingHref;//当前正在播放的视频地址 63 | QString readyHref;//将要播放的视频地址 64 | int currentSlice;//当前视频分片数 65 | int totalSlices;//总分片数量 66 | int nextSliceIndex;//当前视频分片数 67 | int totalSeries;//剧集总数 68 | QString quality;//清晰度标记 69 | QStringList fileList_temp; 70 | QTimer *timerToUpdateAllHrefs; 71 | QTimer *clipBoardWatcherTimer; 72 | QString clipBoardHrefPre; 73 | QString flvxzTokens; 74 | QString playingTvId; 75 | int playingTvNO; 76 | MyTip *myTipWin; 77 | 78 | 79 | 80 | }; 81 | 82 | #endif // PLAYERWIDGET_H 83 | -------------------------------------------------------------------------------- /QFramer/fcenterwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FCENTERWINDOW_H 24 | #define FCENTERWINDOW_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "fnavgationbar.h" 32 | 33 | class FCenterWindow : public QFrame 34 | { 35 | Q_OBJECT 36 | private: 37 | FNavgationBar* navagationBar; 38 | QStackedWidget* stackWidget; 39 | QBoxLayout* navlayout; 40 | QVBoxLayout* mainLayout; 41 | int currentIndex; 42 | int preindex; 43 | public: 44 | enum Alignment_Direction{ 45 | TopLeft, 46 | TopCenter, 47 | TopRight, 48 | RightTop, 49 | RightCenter, 50 | RightBottom, 51 | BottomRight, 52 | BottomCenter, 53 | BottomLeft, 54 | LeftBottom, 55 | LeftCenter, 56 | LeftTop, 57 | }; 58 | 59 | enum animation_Direction{ 60 | animationTop, 61 | animationRight, 62 | animationBottom, 63 | animationLeft, 64 | animationTopLeft, 65 | animationTopRight, 66 | animationBottomRight, 67 | animationBottomLeft, 68 | animationCenter 69 | }; 70 | 71 | public: 72 | explicit FCenterWindow(QWidget *parent = 0); 73 | void initData(); 74 | void initUI(); 75 | void initConnect(); 76 | void addWidget(const QString& tile, const QString &obejctName, QWidget* widget); 77 | void setAlignment(Alignment_Direction direction); 78 | FNavgationBar* getNavgationBar(); 79 | signals: 80 | 81 | public slots: 82 | void switchscreen(const int index); 83 | void switchscreen(); 84 | void swicthLayout(QBoxLayout::Direction direction); 85 | virtual void cloudAntimation(animation_Direction direction); 86 | }; 87 | 88 | #endif // FCENTERWINDOW_H 89 | -------------------------------------------------------------------------------- /QFramer/fmainwindow.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FMAINWINDOW_H 24 | #define FMAINWINDOW_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include "flywidget.h" 31 | #include "ftitlebar.h" 32 | #include "fcenterwindow.h" 33 | 34 | 35 | enum enum_Direction{ 36 | eLeft, 37 | eTop, 38 | eRight, 39 | eBottom, 40 | eNormal 41 | }; 42 | 43 | class FMainWindow : public QMainWindow 44 | { 45 | Q_OBJECT 46 | private: 47 | QPoint dragPosition; 48 | bool leftbuttonpressed; 49 | bool lockmoved; 50 | bool locked; 51 | 52 | void readSettings(); 53 | void writeSettings(); 54 | 55 | FTitleBar * titleBar; 56 | QStatusBar *pstatusbar; 57 | QSystemTrayIcon *trayicon; 58 | FlyWidget* flyWidget; 59 | 60 | protected: 61 | void mouseMoveEvent(QMouseEvent *e); 62 | void mousePressEvent(QMouseEvent *e); 63 | void mouseReleaseEvent(QMouseEvent *e); 64 | void mouseDoubleClickEvent(QMouseEvent *e); 65 | //void keyPressEvent(QKeyEvent *e); 66 | void closeEvent(QCloseEvent * event); 67 | void SetCursorStyle(enum_Direction i); 68 | 69 | public: 70 | FMainWindow(QWidget *parent = 0); 71 | void initData(); 72 | void initUI(); 73 | void initConnect(); 74 | FTitleBar* getTitleBar(); 75 | QStatusBar* getStatusBar(); 76 | QSystemTrayIcon* getQSystemTrayIcon(); 77 | FlyWidget* getFlyWidget(); 78 | void animationClose(); 79 | bool isMoved(); 80 | bool isLocked(); 81 | 82 | ~FMainWindow(); 83 | 84 | signals: 85 | void Hidden(); 86 | public slots: 87 | void swithMaxNormal(); 88 | void showFlyWidget(); 89 | void onSystemTrayIconClicked(QSystemTrayIcon::ActivationReason reason); 90 | void setLockMoved(bool flag); 91 | void setLocked(bool flag); 92 | void quitProcess(); 93 | }; 94 | 95 | #endif // MAINWINDOW_H 96 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerlistwidgetitem.cpp: -------------------------------------------------------------------------------- 1 | #include "playerlistwidgetitem.h" 2 | #include 3 | #include 4 | #include 5 | PlayerListWidgetItem::PlayerListWidgetItem(QWidget *parent, QString tvId, QString tvName) : 6 | QWidget(parent) 7 | { 8 | mainGLayout = new QGridLayout; 9 | //mainGLayout->setAlignment(Qt::AlignHCenter);// 10 | setLayout(mainGLayout); 11 | hLayout = new QHBoxLayout; 12 | mainGLayout->addLayout(hLayout,0,0,1,5); 13 | 14 | hLayout->setMargin(0); 15 | hLayout->setSpacing(0); 16 | mainGLayout->setMargin(0);// 17 | //mainGLayout->setSpacing(0); 18 | 19 | deleteBtn = new ImgBtn(0,"://skin/icons/dark/appbar.page.delete.png"); 20 | QLabel *tvNameLbl= new QLabel(tvName); 21 | tvNameLbl->setMaximumWidth(180); 22 | tvNameLbl->setToolTip(tvName); 23 | hLayout->addWidget(deleteBtn); 24 | hLayout->addWidget(tvNameLbl); 25 | 26 | deleteBtn->setMaximumSize(30,30); 27 | connect(deleteBtn,SIGNAL(clicked()),this,SLOT(sendUpdatePlayList())); 28 | 29 | //tvNameLbl->setMaximumSize(230,30); 30 | 31 | 32 | row = 1; 33 | column =0; 34 | serialBtnGroup = new QButtonGroup; 35 | serialBtnGroup->setExclusive(true); 36 | connect(serialBtnGroup,SIGNAL(buttonClicked(int)),this,SLOT(play(int))); 37 | connect(serialBtnGroup,SIGNAL(buttonClicked(int)),this,SLOT(updateHistoryNo(int))); 38 | 39 | this->tvId = tvId; 40 | } 41 | 42 | void PlayerListWidgetItem::addSerial(QString tvNo, QString historyNo) 43 | { 44 | 45 | serialBtn = new QPushButton; 46 | //serialBtn->setFlat(true); 47 | serialBtn->setMaximumWidth(36); 48 | serialBtn->setMinimumWidth(34); 49 | serialBtn->setText(tvNo); 50 | serialBtn->resize(50,30); 51 | serialBtn->setCheckable(true); 52 | serialBtn->setFocusPolicy(Qt::NoFocus); 53 | if(historyNo==tvNo) 54 | { 55 | serialBtn->setChecked(true); 56 | } 57 | serialBtnGroup->addButton(serialBtn,tvNo.toInt()); 58 | 59 | 60 | mainGLayout->addWidget(serialBtn,row,column,1,1); 61 | if(column>3) 62 | { 63 | row++; 64 | column=0; 65 | }else 66 | { 67 | column++; 68 | } 69 | } 70 | 71 | void PlayerListWidgetItem::play(int btNo) 72 | { 73 | //QString tvNo = serialBtnGroup->checkedButton()->text(); 74 | emit sendPlay(this->tvId,QString::number(btNo)); 75 | } 76 | 77 | void PlayerListWidgetItem::updateHistoryNo(int historyNo) 78 | { 79 | QSqlQuery query_update(QString("update playlistTB set historyNo='%1' where tvId='%2'").arg(historyNo).arg(this->tvId)); 80 | query_update.exec(); 81 | } 82 | 83 | int PlayerListWidgetItem::getRow() 84 | { 85 | return this->row; 86 | } 87 | 88 | void PlayerListWidgetItem::sendUpdatePlayList() 89 | { 90 | QSqlQuery query_delete(QString("DELETE FROM playlistTB WHERE tvId='%1'").arg(this->tvId)); 91 | query_delete.exec(); 92 | emit updatePlayList(); 93 | } 94 | -------------------------------------------------------------------------------- /QFramer/fnavgationbar.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FNAVGATIONBAR_H 24 | #define FNAVGATIONBAR_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include "fcheckablebutton.h" 32 | 33 | 34 | class FNavgationBar : public QFrame 35 | { 36 | Q_OBJECT 37 | private: 38 | QHBoxLayout* mainlayout_topLeft; 39 | QHBoxLayout* mainlayout_topCenter; 40 | QHBoxLayout* mainlayout_topRight; 41 | QHBoxLayout* mainlayout_bottomLeft; 42 | QHBoxLayout* mainlayout_bottomCenter; 43 | QHBoxLayout* mainlayout_bottomRight; 44 | QVBoxLayout* mainlayout_leftTop; 45 | QVBoxLayout* mainlayout_leftCenter; 46 | QVBoxLayout* mainlayout_leftBottom; 47 | QVBoxLayout* mainlayout_rightTop; 48 | QVBoxLayout* mainlayout_rightCenter; 49 | QVBoxLayout* mainlayout_rightBottom; 50 | int cIndex; 51 | public: 52 | 53 | QList buttons; 54 | QList buttonTitles; 55 | public: 56 | explicit FNavgationBar(QWidget *parent = 0); 57 | void initData(); 58 | void initConnect(); 59 | void initUI(); 60 | int currentIndex(); 61 | int count(); 62 | void setCurrentIndex(int index); 63 | void addNavgationTile(const QString& tile, const QString &objectName); 64 | void setAlignment_topLeft(); 65 | void setAlignment_topCenter(); 66 | void setAlignment_topRight(); 67 | void setAlignment_bottomLeft(); 68 | void setAlignment_bottomCenter(); 69 | void setAlignment_bottomRight(); 70 | void setAlignment_leftTop(); 71 | void setAlignment_leftCenter(); 72 | void setAlignment_leftBottom(); 73 | void setAlignment_rightTop(); 74 | void setAlignment_rightCenter(); 75 | void setAlignment_rightBottom(); 76 | signals: 77 | void indexChanged(int i); 78 | private slots: 79 | void setButtonChecked(); 80 | 81 | }; 82 | 83 | #endif // FNAVGATIONBAR_H 84 | -------------------------------------------------------------------------------- /MyWidgets/SetColorWidget/setcolorcenterwin.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SetColorCenterWin 4 | 5 | 6 | 7 | 0 8 | 0 9 | 450 10 | 266 11 | 12 | 13 | 14 | Form 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 | Qt::Horizontal 79 | 80 | 81 | 82 | 320 83 | 20 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 保存 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /MyWidgets/BrowseWidget/browsewidget.h: -------------------------------------------------------------------------------- 1 | #ifndef BROWSEWIDGET_H 2 | #define BROWSEWIDGET_H 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "../ListShowWidget/listshowwidget.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "adshow.h" 17 | #include "../mytip.h" 18 | class BrowseWidget : public QWidget 19 | { 20 | Q_OBJECT 21 | public: 22 | explicit BrowseWidget(QWidget *parent = 0); 23 | void initUi(); 24 | bool isFirstLoad; 25 | signals: 26 | void play(QString tvUrl); 27 | public slots: 28 | void updateShowWidget(); 29 | void getTuiMvList(); 30 | void sendPlay(QString tvUrl, QString title); 31 | void search(); 32 | private: 33 | QNetworkAccessManager *manager; 34 | ListShowWidget *showWidget;//显示视频列表 35 | QWidget *navPanelTWidget;//导航分类面版,上部分,用于放置五个大分类 36 | QWidget *navPanelBWidget;//导航分类面版,下部分,用于放置各种小分类 37 | QGridLayout *mainGLayout;//对本部件整个排列 38 | QWidget *moPanelWidget;//mo指movie,电视剧tv、动漫ct、综艺va、微电影vm 39 | QWidget *tvPanelWidget; 40 | QWidget *ctPanelWidget; 41 | QWidget *vaPanelWidget; 42 | QWidget *vmPanelWidget; 43 | QWidget *tuiPanelWidget; 44 | 45 | QGridLayout *navGLayout;//检索总分类,用于存放 电影、电视剧、动漫、综艺、微电影\主页推荐 按钮 46 | QStackedLayout *navSLayout;//用于存放 电影、电视剧、动漫、综艺、微电影共五大分类的layout 47 | QButtonGroup *navBtnGroup; 48 | 49 | QGridLayout *moGLayout;//电影分类 50 | QButtonGroup *moCatGroup;//电影"类型"按钮分组 51 | QButtonGroup *moAreaGroup;//电影“地区”分类处按钮分组 52 | QButtonGroup *moYearGroup;//电影“年代”分类处按钮分组 53 | QButtonGroup *moRankGroup;//电影“排序方式”分类处按钮分组 54 | 55 | QGridLayout *tvGLayout;//电视剧分类 56 | QButtonGroup *tvCatGroup;//电视剧"类型"按钮分组 57 | QButtonGroup *tvAreaGroup;//电视剧“地区”分类处按钮分组 58 | QButtonGroup *tvYearGroup;//电视剧“年代”分类处按钮分组 59 | QButtonGroup *tvRankGroup;//电视剧“排序方式”分类处按钮分组 60 | 61 | QGridLayout *ctGLayout;//动漫分类 62 | QButtonGroup *ctCatGroup;//动漫"类型"按钮分组 63 | QButtonGroup *ctAreaGroup;//动漫“地区”分类处按钮分组 64 | QButtonGroup *ctYearGroup;//动漫“年代”分类处按钮分组 65 | QButtonGroup *ctRankGroup;//动漫“排序方式”分类处按钮分组 66 | 67 | QGridLayout *vaGLayout;//综艺分类 68 | QButtonGroup *vaCatGroup;//综艺"类型"按钮分组 69 | QButtonGroup *vaAreaGroup;//综艺“地区”分类处按钮分组 70 | QButtonGroup *vaYearGroup;//综艺“年代”分类处按钮分组 71 | QButtonGroup *vaRankGroup;//综艺“排序方式”分类处按钮分组 72 | 73 | QGridLayout *vmGLayout;//微电影分类 74 | QButtonGroup *vmCatGroup;//微电影"类型"按钮分组 75 | QButtonGroup *vmAreaGroup;//微电影“地区”分类处按钮分组 76 | QButtonGroup *vmYearGroup;//微电影“年代”分类处按钮分组 77 | QButtonGroup *vmRankGroup;//微电影“排序方式”分类处按钮分组 78 | 79 | QGridLayout *tuiGLayout;//主页与搜索 80 | QButtonGroup *tuiGroup;//推荐按钮分组 81 | 82 | QLineEdit *searchLineEdit;//搜索 83 | QPushButton *searchBtn; 84 | 85 | AdShow *adShowPanel; 86 | MyTip myTipWin; 87 | }; 88 | 89 | #endif // BROWSEWIDGET_H 90 | -------------------------------------------------------------------------------- /QFramer/ftabwidget.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "ftabwidget.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | FTabWidget::FTabWidget(QWidget *parent) : 29 | QWidget(parent) 30 | { 31 | initUI(); 32 | initConnect(); 33 | } 34 | 35 | void FTabWidget::initUI() 36 | { 37 | tabTile = new QWidget; 38 | tabTile->setObjectName(QString("FTabTile")); 39 | 40 | stackLayout = new QStackedLayout; 41 | tabLayout = new QVBoxLayout; 42 | tabLayout->addStretch(); 43 | tabLayout->setContentsMargins(0, 0, 0, 0); 44 | tabLayout->setSpacing(0); 45 | tabTile->setLayout(tabLayout); 46 | 47 | mainLayout = new QHBoxLayout; 48 | mainLayout->addWidget(tabTile); 49 | mainLayout->addLayout(stackLayout); 50 | mainLayout->setContentsMargins(0, 0, 0, 0); 51 | mainLayout->setSpacing(0); 52 | setLayout(mainLayout); 53 | } 54 | 55 | void FTabWidget::initConnect() 56 | { 57 | 58 | 59 | } 60 | 61 | void FTabWidget::addWidget(const QString &tile, const QString &objectName, QWidget *widget) 62 | { 63 | buttonTitles << tile; 64 | FCheckabelButton* button = new FCheckabelButton(tile); 65 | buttons.append(button); 66 | // button->setObjectName(objectName); 67 | button->setFixedSize(200, 60); 68 | tabLayout->insertWidget(tabLayout->count() - 1, button); 69 | connect(button, SIGNAL(clicked()), this, SLOT(setButtonChecked())); 70 | // widget->setObjectName(objectName); 71 | stackLayout->addWidget(widget); 72 | } 73 | 74 | QList FTabWidget::getButtons() 75 | { 76 | return buttons; 77 | } 78 | 79 | void FTabWidget::setButtonChecked() 80 | { 81 | for (int i = 0; i < buttons.size(); ++i) { 82 | if (buttons.at(i) == sender()) 83 | { 84 | buttons.at(i)->setChecked(true); 85 | stackLayout->setCurrentIndex(i); 86 | emit indexChanged(i); 87 | } 88 | else{ 89 | buttons.at(i)->setChecked(false); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /QFramer/flywidget.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "flywidget.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | FlyWidget::FlyWidget(QWidget *parent) : 31 | QWidget(parent) 32 | { 33 | p = parent; 34 | settingmenu = NULL; 35 | setWindowFlags(Qt::FramelessWindowHint); 36 | setWindowFlags(Qt::ToolTip); 37 | initData(); 38 | initUI(); 39 | initConnect(); 40 | } 41 | 42 | void FlyWidget::initData() 43 | { 44 | m_Pixmap.load(QString(":/images/skin/images/QFramer.png")); 45 | } 46 | 47 | void FlyWidget::initUI() 48 | { 49 | resize(m_Pixmap.size()); 50 | setMask(m_Pixmap.mask()); 51 | } 52 | 53 | void FlyWidget::initConnect() 54 | { 55 | 56 | } 57 | 58 | void FlyWidget::setMenu(QMenu *menu) 59 | { 60 | settingmenu = menu; 61 | } 62 | 63 | void FlyWidget::mousePressEvent(QMouseEvent *event) 64 | { 65 | //按住左键可以托动窗口,按下右键关闭程序 66 | if(event->button() == Qt::LeftButton) 67 | { 68 | m_CurrentPos = event->globalPos() - frameGeometry().topLeft(); 69 | event->accept(); 70 | } 71 | else if(event->button() == Qt::RightButton) 72 | { 73 | settingmenu->exec(QCursor::pos()); 74 | } 75 | } 76 | 77 | void FlyWidget::mouseDoubleClickEvent(QMouseEvent *event) 78 | { 79 | p->setVisible(not p->isVisible()); 80 | } 81 | 82 | void FlyWidget::mouseMoveEvent(QMouseEvent *event) 83 | { 84 | if (event->buttons() && Qt::LeftButton) 85 | { 86 | move(event->globalPos() - m_CurrentPos); 87 | event->accept(); 88 | } 89 | } 90 | 91 | void FlyWidget::paintEvent(QPaintEvent *event) 92 | { 93 | QPainter painter(this); 94 | painter.drawPixmap(0, 0, m_Pixmap); 95 | } 96 | 97 | void FlyWidget::leaveEvent(QEvent *event) 98 | { 99 | //鼠标离开窗口时是普通的指针 100 | setCursor(Qt::ArrowCursor); 101 | } 102 | 103 | void FlyWidget::enterEvent(QEvent *event) 104 | { 105 | //鼠标留在窗口上时是一个手指 106 | setCursor(Qt::PointingHandCursor); 107 | } 108 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/loginform.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LoginForm 4 | 5 | 6 | 7 | 0 8 | 0 9 | 250 10 | 171 11 | 12 | 13 | 14 | Form 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 | img 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Qt::Horizontal 70 | 71 | 72 | 73 | 179 74 | 20 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | QPushButton{ 83 | background-color: rgba(0, 82, 112, 100); 84 | color: white; 85 | border: 1px; 86 | } 87 | 88 | QPushButton:hover{ 89 | background-color: rgba(0, 82, 112, 200); 90 | color: white; 91 | border: 1px; 92 | } 93 | 94 | QPushButton:disabled{ 95 | background-color: transparent; 96 | color: gray; 97 | } 98 | 99 | 100 | 登录 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerwin.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAYERWIN_H 2 | #define PLAYERWIN_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "../mytip.h" 28 | #include "MyWidgets/MyDialog/myinputdialogmainwin.h" 29 | using namespace QtAV; 30 | class PlayerWin : public QWidget//输出·视频图像与控制区的播放部分 31 | { 32 | Q_OBJECT 33 | public: 34 | explicit PlayerWin(QWidget *parent = 0); 35 | AVPlayer *player; 36 | int state;//0表示停止,1表示播放,2表示暂停 37 | QString currentPlayer; 38 | bool isFullScreen; 39 | GLWidgetRenderer *renderer; 40 | protected: 41 | void mouseDoubleClickEvent(QMouseEvent *event); 42 | void mousePressEvent(QMouseEvent *event); 43 | void paintEvent(QPaintEvent *); 44 | void resizeEvent(QResizeEvent *event); 45 | void mouseMoveEvent(QMouseEvent *e); 46 | //void keyReleaseEvent(QKeyEvent *e); 47 | signals: 48 | void hideToFullScreen(bool FullScreen); 49 | void getIntoWideModel(bool ok); 50 | void percentChange(qreal percent); 51 | void playFinished(); 52 | void loadingMedia(); 53 | void callForPlayer2Ready(); 54 | void progressBarDrawTxt(QString txt); 55 | void sendloadSlice(int slice);//加载指定视频片,-1指上一片,0重载当前,1下一片 56 | void resetSig(); 57 | public slots: 58 | //void finished(int i); 59 | void setState(int i);//0表示停止,1表示播放,2表示暂停 60 | void setProgressbarPosition(); 61 | void seekPos(qreal pos); 62 | void setPauseState(); 63 | void setStopState(); 64 | void openFile(); 65 | void openUrl(); 66 | void setWideModel(); 67 | void setFullScreenMode(); 68 | void loadSlice(int slice); 69 | void loadPreSlice(); 70 | void loadCurSlice(); 71 | void loadNextSlice(); 72 | void handleMediaStatusChanged(QtAV::MediaStatus status); 73 | void handleError(QtAV::AVError error); 74 | void newPlay(QString file); 75 | void setTotalSlices(int i); 76 | void showSubtitle(bool b); 77 | void getLocalFileSubList(QString filePath); 78 | void getSubFileFromShooter(QString Url); 79 | QString computerLocalFileHash(QString filePath); 80 | void changeSub(QAction *act); 81 | void loadLocalSub(); 82 | void closeSub(); 83 | 84 | private: 85 | 86 | bool isWideModel; 87 | QTimer *updateProgressBarT; 88 | QTimer *setContralBarViewT;//检查鼠标位置,进入区域时,显示下方进度条 89 | int EndOfMediaMark;//标记,播放到98%,解析下一片视频并切换播放器.1表示已经发出信号,0表示没有。 90 | QGridLayout *mainGLayout; 91 | 92 | int totalSlices;//总分片数量 93 | QLabel *playerMaskLbl; 94 | MyTip myTipWin; 95 | SubtitleFilter *subFilter; 96 | QNetworkAccessManager *manager; 97 | QStringList subDownloadUrlList; 98 | 99 | 100 | }; 101 | 102 | #endif // PLAYERWIN_H 103 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/progressbar.cpp: -------------------------------------------------------------------------------- 1 | #include "progressbar.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "qmath.h" 7 | #include 8 | ProgressBar::ProgressBar(QWidget *parent) : 9 | QWidget(parent) 10 | { 11 | setAttribute(Qt::WA_TranslucentBackground, true); 12 | setMaximumHeight(4); 13 | posPercent=0; 14 | timeText ="Waited..."; 15 | isMouseIn =false; 16 | progressBarHeight = 1; 17 | indicateLinePoint = QPoint(0,0); 18 | timer = new QTimer; 19 | connect(timer,SIGNAL(timeout()),this,SLOT(setSmallHeight())); 20 | timer->setInterval(2000); 21 | setMouseTracking(true); 22 | } 23 | 24 | ProgressBar::~ProgressBar() 25 | { 26 | 27 | } 28 | 29 | void ProgressBar::paintEvent(QPaintEvent *e) 30 | { 31 | QPainter painter(this); 32 | QPen pen; 33 | painter.setRenderHint(QPainter::Antialiasing, true); 34 | pen.setWidth(0); 35 | painter.setBrush(Qt::black); 36 | painter.setPen(pen); 37 | painter.drawRect(this->rect()); 38 | 39 | pen.setWidth(4); 40 | pen.setColor(Qt::darkGray); 41 | painter.setPen(pen); 42 | painter.drawLine(QPoint(5,6),QPoint(this->width()-5,6)); 43 | 44 | pen.setColor(Qt::darkCyan); 45 | painter.setPen(pen); 46 | painter.drawLine(QPoint(5,6),QPoint((this->width()-10)*posPercent+5,6)); 47 | 48 | pen.setColor(Qt::blue); 49 | pen.setWidth(1); 50 | painter.setPen(pen); 51 | painter.drawLine(indicateLinePoint.x(),3,indicateLinePoint.x(),this->height()); 52 | 53 | pen.setColor(Qt::white); 54 | painter.setPen(pen); 55 | painter.drawText(5,30,this->timeText); 56 | } 57 | 58 | void ProgressBar::mouseReleaseEvent(QMouseEvent *) 59 | { 60 | QPoint p =this->mapFromGlobal(QCursor::pos()); 61 | if(p.x()>5 && p.x()<(this->width()-5)) 62 | { 63 | qreal a = p.x()-5; 64 | qreal b = this->width()-10; 65 | posPercent=(a/b); 66 | emit posChange(posPercent); 67 | } 68 | repaint(); 69 | } 70 | 71 | void ProgressBar::mouseMoveEvent(QMouseEvent *e) 72 | { 73 | indicateLinePoint = e->pos(); 74 | repaint(); 75 | } 76 | 77 | void ProgressBar::leaveEvent(QEvent * event) 78 | { 79 | isMouseIn = false; 80 | setSmallHeight(); 81 | } 82 | 83 | void ProgressBar::enterEvent(QEvent *event) 84 | { 85 | isMouseIn = true; 86 | setBigHeight(); 87 | } 88 | 89 | void ProgressBar::setPercentPos(qreal posPercent) 90 | { 91 | if(posPercent<1 && posPercent>0) 92 | { 93 | this->posPercent = posPercent; 94 | }else 95 | { 96 | this->posPercent = posPercent - qFloor(posPercent); 97 | } 98 | 99 | repaint(); 100 | } 101 | void ProgressBar::drawTimeText(QString timeText) 102 | { 103 | this->timeText = timeText; 104 | setMaximumHeight(40); 105 | repaint(); 106 | if(timer->isActive()) 107 | { 108 | timer->stop(); 109 | timer->start(); 110 | }else 111 | { 112 | timer->start(); 113 | } 114 | if(timeText.contains("暂停")) 115 | { 116 | timer->stop(); 117 | } 118 | } 119 | 120 | void ProgressBar::setSmallHeight() 121 | { 122 | if(!isMouseIn) 123 | { 124 | progressBarHeight=1; 125 | setMaximumHeight(4); 126 | } 127 | 128 | } 129 | 130 | void ProgressBar::setBigHeight() 131 | { 132 | progressBarHeight=10; 133 | setMaximumHeight(40); 134 | 135 | } 136 | -------------------------------------------------------------------------------- /MvGather.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2014-11-09T22:59:28 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui network sql av 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = MvGather 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp\ 16 | mainwindow.cpp \ 17 | centerwindow.cpp \ 18 | MyWidgets/PlayerWidget/analyzer.cpp \ 19 | MyWidgets/PlayerWidget/playerlistarea.cpp \ 20 | MyWidgets/PlayerWidget/playerlistwidgetitem.cpp \ 21 | MyWidgets/PlayerWidget/playerwidget.cpp \ 22 | MyWidgets/PlayerWidget/playerwin.cpp \ 23 | MyWidgets/PlayerWidget/progressbar.cpp \ 24 | MyWidgets/PlayerWidget/tvlistwidget.cpp \ 25 | MyWidgets/imgbtn.cpp \ 26 | MyWidgets/mytip.cpp \ 27 | MyWidgets/BrowseWidget/adshow.cpp \ 28 | MyWidgets/BrowseWidget/browsewidget.cpp \ 29 | MyWidgets/ListShowWidget/imagelabel.cpp \ 30 | MyWidgets/ListShowWidget/listshowwidget.cpp \ 31 | MyWidgets/ListShowWidget/listshowwidgetitem.cpp \ 32 | MyWidgets/ListShowWidget/loadimgthread.cpp \ 33 | MyWidgets/RecommendWidget/recommendwidget.cpp \ 34 | MyWidgets/MagnetWidget/loginform.cpp \ 35 | MyWidgets/MagnetWidget/magnetwidget.cpp \ 36 | MyWidgets/MagnetWidget/vcodedialog.cpp \ 37 | MyWidgets/PreferSetting/prefersetting.cpp \ 38 | MyWidgets/PreferSetting/prefersettingmainwin.cpp \ 39 | MyWidgets/MagnetWidget/loginformwin.cpp \ 40 | MyWidgets/MyDialog/myinputdialog.cpp \ 41 | MyWidgets/MyDialog/myinputdialogmainwin.cpp \ 42 | MyWidgets/SetColorWidget/setcolorwidget.cpp \ 43 | MyWidgets/SetColorWidget/setcolorcenterwin.cpp \ 44 | MyWidgets/PreferSetting/prefersourcewidget.cpp \ 45 | MyWidgets/PreferSetting/prefersourcewidgetwin.cpp \ 46 | MyWidgets/ThreadDownload/downloadwidget.cpp 47 | 48 | HEADERS += mainwindow.h \ 49 | centerwindow.h \ 50 | MyWidgets/PlayerWidget/analyzer.h \ 51 | MyWidgets/PlayerWidget/playerlistarea.h \ 52 | MyWidgets/PlayerWidget/playerlistwidgetitem.h \ 53 | MyWidgets/PlayerWidget/playerwidget.h \ 54 | MyWidgets/PlayerWidget/playerwin.h \ 55 | MyWidgets/PlayerWidget/progressbar.h \ 56 | MyWidgets/PlayerWidget/tvlistwidget.h \ 57 | MyWidgets/imgbtn.h \ 58 | MyWidgets/mytip.h \ 59 | MyWidgets/BrowseWidget/adshow.h \ 60 | MyWidgets/BrowseWidget/browsewidget.h \ 61 | MyWidgets/ListShowWidget/imagelabel.h \ 62 | MyWidgets/ListShowWidget/listshowwidget.h \ 63 | MyWidgets/ListShowWidget/listshowwidgetitem.h \ 64 | MyWidgets/ListShowWidget/loadimgthread.h \ 65 | MyWidgets/RecommendWidget/recommendwidget.h \ 66 | MyWidgets/MagnetWidget/loginform.h \ 67 | MyWidgets/MagnetWidget/magnetwidget.h \ 68 | MyWidgets/MagnetWidget/vcodedialog.h \ 69 | MyWidgets/PreferSetting/prefersetting.h \ 70 | MyWidgets/PreferSetting/prefersettingmainwin.h \ 71 | MyWidgets/MagnetWidget/loginformwin.h \ 72 | MyWidgets/MyDialog/myinputdialog.h \ 73 | MyWidgets/MyDialog/myinputdialogmainwin.h \ 74 | MyWidgets/SetColorWidget/setcolorwidget.h \ 75 | MyWidgets/SetColorWidget/setcolorcenterwin.h \ 76 | MyWidgets/PreferSetting/prefersourcewidget.h \ 77 | MyWidgets/PreferSetting/prefersourcewidgetwin.h \ 78 | MyWidgets/ThreadDownload/downloadwidget.h 79 | 80 | include(./QFramer/QFramer.pri) 81 | 82 | RESOURCES += \ 83 | rs.qrc 84 | 85 | FORMS += \ 86 | MyWidgets/MagnetWidget/loginform.ui \ 87 | MyWidgets/MagnetWidget/magnetwidget.ui \ 88 | MyWidgets/MagnetWidget/vcodedialog.ui \ 89 | MyWidgets/SetColorWidget/setcolorcenterwin.ui \ 90 | MyWidgets/PreferSetting/prefersourcewidget.ui \ 91 | MyWidgets/ThreadDownload/downloadwidget.ui 92 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/analyzer.cpp: -------------------------------------------------------------------------------- 1 | #include "analyzer.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | Analyzer::Analyzer(QObject *parent) : 10 | QObject(parent) 11 | { 12 | } 13 | 14 | QString Analyzer::funTvAnalyze(QString url)//http://www.sufeinet.com/thread-8196-1-1.html 15 | { 16 | //qDebug()< -1) { 37 | mediaid = rx_mediaid.cap(0); 38 | } 39 | int pos_serial = rx_serial.indexIn(mediaidPart); 40 | if (pos_serial > -1) { 41 | serial = rx_serial.cap(0); 42 | } 43 | mediaid.replace("m-",""); 44 | serial.replace("e-",""); 45 | //qDebug()<get(QNetworkRequest(QUrl(apiUrl1))); 50 | QEventLoop loop; 51 | QTimer::singleShot(8000,&loop,SLOT(quit()));// 52 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 53 | loop.exec(); 54 | QByteArray data = reply->readAll(); 55 | QRegExp rx_hashid("hashid\":\".*\""); 56 | rx_hashid.setMinimal(true); 57 | int pos_hashid = rx_hashid.indexIn(data); 58 | if (pos_hashid > -1) { 59 | hashid = rx_hashid.cap(0); 60 | } 61 | hashid.replace(QRegExp("hashid\":\"|\""),""); 62 | //qDebug()<get(QNetworkRequest(QUrl(apiUrl2))); 71 | QTimer::singleShot(8000,&loop,SLOT(quit()));// 72 | QObject::connect(reply2, SIGNAL(finished()), &loop, SLOT(quit())); 73 | loop.exec(); 74 | data = reply2->readAll(); 75 | 76 | QString token; 77 | QJsonParseError *error=new QJsonParseError; 78 | QJsonDocument doc =QJsonDocument::fromJson(data,error); 79 | if(error->error==QJsonParseError::NoError) 80 | { 81 | QJsonObject rootObj = doc.object(); 82 | token = rootObj["token"].toString(); 83 | } 84 | 85 | //get realUrl 86 | QString apiUrl3 = QString("http://jobsfe.funshion.com/query/v1/mp4/%1.json?clifz=fun&mac=&tm=1395365896&token=%2").arg(hashid).arg(token); 87 | QNetworkReply *reply3 = manager->get(QNetworkRequest(QUrl(apiUrl3))); 88 | QTimer::singleShot(8000,&loop,SLOT(quit()));// 89 | QObject::connect(reply3, SIGNAL(finished()), &loop, SLOT(quit())); 90 | loop.exec(); 91 | data = reply3->readAll(); 92 | 93 | QJsonDocument realUrlDoc =QJsonDocument::fromJson(data,error); 94 | if(error->error==QJsonParseError::NoError) 95 | { 96 | QJsonObject rootObj = realUrlDoc.object(); 97 | QJsonArray playlistArray = rootObj["playlist"].toArray(); 98 | QJsonObject obj = playlistArray.first().toObject(); 99 | realUrl = obj["urls"].toArray().first().toString(); 100 | } 101 | 102 | 103 | return realUrl; 104 | } 105 | -------------------------------------------------------------------------------- /QFramer/ftitlebar.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #ifndef FTITLEBAR_H 24 | #define FTITLEBAR_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | #define Title_Height 30 32 | 33 | class FTitleBar : public QFrame 34 | { 35 | Q_OBJECT 36 | private: 37 | QIcon* logoIcon; 38 | QIcon* settingsIcon; 39 | QIcon* skinIcon; 40 | QIcon* minIcon; 41 | QIcon* maxIcon; 42 | QIcon* normalIcon; 43 | QIcon* closeIcon; 44 | QLabel* titleLabel; 45 | QPushButton* logoButton; 46 | QPushButton* settingButton; 47 | QPushButton* skinButton; 48 | QPushButton* fixButton; 49 | QPushButton* minButton; 50 | QPushButton* maxButton; 51 | QPushButton* closeButton; 52 | bool normal_max_flag; 53 | bool fixflag; 54 | 55 | private: 56 | void initData(); 57 | void initConnect(); 58 | void initUI(); 59 | 60 | public: 61 | QString title; 62 | static FTitleBar* instance; 63 | 64 | public: 65 | explicit FTitleBar(QWidget *parent = 0); 66 | static FTitleBar* getInstace(); 67 | 68 | bool getFixedflag(); 69 | 70 | void setTitleBarHeight(int height); 71 | void setSettingMenu(QMenu* menu); 72 | 73 | void setLogoButton(const char * str, const char *objectName=NULL); 74 | QPushButton* getLogoButton(); 75 | void setLogoButtonVisible(bool visible); 76 | bool isLogoButtonVisible(); 77 | 78 | void setTitleLabel(QString str , const char *objectName=NULL); 79 | QLabel* getTitleLabel(); 80 | void setTitleLabelVisible(bool visible); 81 | bool isTitleLabelVisible(); 82 | 83 | void setSettingButton(const char * str, const char *objectName=NULL); 84 | QPushButton* getSettingButton(); 85 | void setSettingButtonVisible(bool visible); 86 | bool isSettingButtonVisible(); 87 | 88 | void setSkinButton(const char * str, const char *objectName=NULL); 89 | QPushButton* getSkinButton(); 90 | void setSkinButtonVisible(bool visible); 91 | bool isSkinButtonVisible(); 92 | 93 | void setFixButton(const char * str, const char *objectName=NULL); 94 | QPushButton* getFixButton(); 95 | void setFixButtonVisible(bool visible); 96 | bool isFixButtonVisible(); 97 | 98 | void setMinButton(const char * str, const char *objectName=NULL); 99 | QPushButton* getMinButton(); 100 | void setMinButtonVisible(bool visible); 101 | bool isMinButtonVisible(); 102 | 103 | void setMaxButton(const char * str, const char *objectName=NULL); 104 | QPushButton* getMaxButton(); 105 | void setMaxButtonVisible(bool visible); 106 | bool isMaxButtonVisible(); 107 | 108 | void setCloseButton(const char * str, const char *objectName=NULL); 109 | QPushButton* getCloseButton(); 110 | void setCloseButtonVisible(bool visible); 111 | bool isCloseButtonVisible(); 112 | 113 | signals: 114 | void maximumed(); 115 | void minimuned(); 116 | void normaled(); 117 | void closed(); 118 | 119 | public slots: 120 | void switchMaxMin(); 121 | void changeSkin(); 122 | void clearChecked(); 123 | void changeFix(); 124 | 125 | }; 126 | 127 | #endif // FTITLEBAR_H 128 | -------------------------------------------------------------------------------- /QFramer/futil.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "futil.h" 24 | 25 | #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) 26 | void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) 27 | { 28 | QByteArray localMsg = msg.toLocal8Bit(); 29 | QString outmsg; 30 | 31 | switch (type) { 32 | case QtDebugMsg: 33 | fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 34 | outmsg = QString("Debug: %1 %2 %3 %4\r\n").arg(localMsg.constData(), context.file, QString(context.line), context.function); 35 | break; 36 | case QtWarningMsg: 37 | fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 38 | outmsg = QString("Warning: %1 %2 %3 %4 \r\n").arg(localMsg.constData(), context.file, QString(context.line), context.function); 39 | break; 40 | case QtCriticalMsg: 41 | fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 42 | outmsg = QString("Critical: %1 %2 %3 %4 \r\n").arg(localMsg.constData(), context.file, QString(context.line), context.function); 43 | break; 44 | case QtFatalMsg: 45 | fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function); 46 | outmsg = QString("Fatal: %1 %2 %3 %4 \r\n").arg(localMsg.constData(), context.file, QString(context.line), context.function); 47 | abort(); 48 | } 49 | 50 | QFile outFile("debuglog.txt"); 51 | outFile.open(QIODevice::WriteOnly | QIODevice::Append); 52 | QTextStream ts(&outFile); 53 | ts << outmsg <setStyleSheet(qss); 108 | } 109 | -------------------------------------------------------------------------------- /MyWidgets/ThreadDownload/downloadwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DownloadWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 606 10 | 112 11 | 12 | 13 | 14 | 15 | 16777215 16 | 112 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | 30 | 399 31 | 20 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 24 40 | 41 | 42 | 43 | 44 | 45 | 46 | none 47 | 48 | 49 | 50 | 51 | 52 | 53 | 0Kb/s 54 | 55 | 56 | 57 | 58 | 59 | 60 | QPushButton{ 61 | background-color: rgba(0, 82, 112, 100); 62 | color: white; 63 | border: 1px; 64 | } 65 | 66 | QPushButton:hover{ 67 | background-color: rgba(0, 82, 112, 200); 68 | color: white; 69 | border: 1px; 70 | } 71 | 72 | QPushButton:disabled{ 73 | background-color: transparent; 74 | color: gray; 75 | } 76 | 77 | 78 | 开始 79 | 80 | 81 | 82 | 83 | 84 | 85 | QPushButton{ 86 | background-color: rgba(0, 82, 112, 100); 87 | color: white; 88 | border: 1px; 89 | } 90 | 91 | QPushButton:hover{ 92 | background-color: rgba(0, 82, 112, 200); 93 | color: white; 94 | border: 1px; 95 | } 96 | 97 | QPushButton:disabled{ 98 | background-color: transparent; 99 | color: gray; 100 | } 101 | 102 | 103 | 暂停 104 | 105 | 106 | 107 | 108 | 109 | 110 | QPushButton{ 111 | background-color: rgba(0, 82, 112, 100); 112 | color: white; 113 | border: 1px; 114 | } 115 | 116 | QPushButton:hover{ 117 | background-color: rgba(0, 82, 112, 200); 118 | color: white; 119 | border: 1px; 120 | } 121 | 122 | QPushButton:disabled{ 123 | background-color: transparent; 124 | color: gray; 125 | } 126 | 127 | 128 | 播放 129 | 130 | 131 | 132 | 133 | 134 | 135 | QPushButton{ 136 | background-color: rgba(255, 255, 255, 0); 137 | color: white; 138 | border: 1px; 139 | } 140 | 141 | QPushButton:hover{ 142 | background-color: rgba(255, 255, 255, 10); 143 | border: 1px; 144 | } 145 | 146 | QPushButton:pressed{ 147 | background-color: rgba(255, 255, 255, 50); 148 | } 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /QFramer/fbasedialog.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fbasedialog.h" 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | FBaseDialog::FBaseDialog(QWidget *parent) : 33 | QDialog(parent) 34 | { 35 | setWindowFlags(Qt::FramelessWindowHint); 36 | setAttribute(Qt::WA_DeleteOnClose); 37 | initData(); 38 | initUI(); 39 | initConnect(); 40 | } 41 | 42 | void FBaseDialog::initData() 43 | { 44 | 45 | } 46 | 47 | void FBaseDialog::initUI() 48 | { 49 | //resize(0, 0); 50 | titlebar = new FTitleBar; 51 | titlebar->setSettingButtonVisible(false); 52 | titlebar->setSkinButtonVisible(false); 53 | titlebar->setFixButtonVisible(false); 54 | titlebar->setMinButtonVisible(false); 55 | titlebar->setMaxButtonVisible(false); 56 | 57 | fMainLayout = new QVBoxLayout; 58 | 59 | fMainLayout->addWidget(titlebar); 60 | fMainLayout->setContentsMargins(0, 0, 0, 0); 61 | fMainLayout->setSpacing(0); 62 | setLayout(fMainLayout); 63 | } 64 | 65 | void FBaseDialog::initConnect() 66 | { 67 | connect(titlebar->getCloseButton(), SIGNAL(clicked()), this, SLOT(animationClose())); 68 | } 69 | 70 | FTitleBar* FBaseDialog::getTitleBar() 71 | { 72 | return titlebar; 73 | } 74 | 75 | void FBaseDialog::mousePressEvent(QMouseEvent *e) 76 | { 77 | if(e->button() & Qt::LeftButton) 78 | { 79 | dragPosition = e->globalPos() - frameGeometry().topLeft(); 80 | } 81 | e->accept(); 82 | } 83 | 84 | void FBaseDialog::mouseReleaseEvent(QMouseEvent *e) 85 | { 86 | e->accept(); 87 | } 88 | 89 | void FBaseDialog::mouseMoveEvent(QMouseEvent *e) 90 | { 91 | if(e->y() < height() - 30){ 92 | move(e->globalPos() - dragPosition); 93 | e->accept(); 94 | } 95 | else{ 96 | e->ignore(); 97 | } 98 | 99 | } 100 | 101 | void FBaseDialog::showEvent(QShowEvent *event) 102 | { 103 | 104 | QDesktopWidget* desktopWidget = QApplication::desktop(); 105 | QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry"); 106 | animation->setDuration(200); 107 | int w = desktopWidget->availableGeometry().width(); 108 | int h = desktopWidget->availableGeometry().height(); 109 | animation->setStartValue(QRect(w * 0.5, h*0.5, 0, 0)); 110 | animation->setEndValue(QRect(w /2 - normalSize.width()/2, 111 | h / 2 - normalSize.height() / 2, 112 | normalSize.width(), normalSize.height())); 113 | animation->start(); 114 | QWidget::showEvent(event); 115 | } 116 | 117 | void FBaseDialog::closeEvent(QCloseEvent *event) 118 | { 119 | 120 | QWidget::closeEvent(event); 121 | } 122 | 123 | 124 | void FBaseDialog::animationClose() 125 | { 126 | QRect noraml = geometry(); 127 | QRect closeRect = QRect(noraml.x(), noraml.y() + noraml.height()/2, noraml.width(), 0); 128 | QPropertyAnimation *animation = new QPropertyAnimation(this, "geometry"); 129 | //connect(animation, SIGNAL(finished()), this, SLOT(close())); 130 | connect(animation, SIGNAL(finished()), this, SLOT(hide())); 131 | animation->setDuration(100); 132 | animation->setStartValue(noraml); 133 | animation->setEndValue(closeRect); 134 | animation->start(); 135 | } 136 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/tvlistwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "tvlistwidget.h" 2 | #include 3 | #include 4 | #include 5 | TvListWidget::TvListWidget(QWidget *parent) : 6 | QWidget(parent) 7 | { 8 | mainLayout = new QGridLayout(this); 9 | mainLayout->setMargin(0); 10 | 11 | treeWidget = new QTreeWidget(this); 12 | actGoup = new QActionGroup(0); 13 | connect(actGoup,SIGNAL(triggered(QAction*)),this,SLOT(play(QAction*))); 14 | 15 | treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);// 16 | treeWidget->setColumnCount(1); 17 | treeWidget->setHeaderHidden(true); 18 | treeWidget->setAttribute(Qt::WA_TranslucentBackground, true); 19 | 20 | connect(treeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this,SLOT(itemDoubleClicked(QTreeWidgetItem*,int))); 21 | connect(treeWidget,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenuRequested(QPoint))); 22 | 23 | mainLayout->addWidget(treeWidget,0,0,1,1); 24 | 25 | QTimer::singleShot(500,this,SLOT(loadTvSources())); 26 | 27 | 28 | 29 | } 30 | 31 | void TvListWidget::loadTvSources() 32 | { 33 | // QFile file("tvSourceJson.php"); 34 | // file.open(QFile::ReadOnly); 35 | // QByteArray source = file.readAll(); 36 | QByteArray source; 37 | 38 | QDir dir; 39 | QDir dir2(dir.homePath()+"/视频"); 40 | QDir dir3(dir.homePath()+"/Videos"); 41 | QString sourcePath; 42 | if(dir2.exists()) 43 | { 44 | sourcePath = dir.homePath()+"/视频/MvGather/tvSources.json"; 45 | }else if(dir3.exists()) 46 | { 47 | sourcePath = dir.homePath()+"/Videos/MvGather/tvSources.json"; 48 | }else 49 | { 50 | sourcePath = dir.homePath()+"/MvGather/tvSources.json"; 51 | } 52 | QFile file(sourcePath); 53 | if(file.exists()) 54 | { 55 | file.open(QFile::ReadOnly); 56 | source = file.readAll(); 57 | }else 58 | { 59 | QString url("http://www.mvgather.com/mvgather/api/tvSourceJson.php"); 60 | 61 | for(int i=0;i<2;i++) 62 | { 63 | if(source != "") 64 | { 65 | break; 66 | } 67 | QNetworkAccessManager *manager = new QNetworkAccessManager(this); 68 | QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url))); 69 | QEventLoop loop; 70 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 71 | loop.exec(); 72 | source = reply->readAll(); 73 | } 74 | 75 | } 76 | 77 | 78 | QJsonParseError *error = new QJsonParseError; 79 | QJsonDocument doc = QJsonDocument::fromJson(source,error); 80 | //qDebug()<errorString(); 81 | if(error->error != QJsonParseError::NoError) 82 | { 83 | return; 84 | } 85 | if(doc.isObject()) 86 | { 87 | QJsonObject obj_root = doc.object(); 88 | foreach (QString key, obj_root.keys()) { 89 | QTreeWidgetItem *root = new QTreeWidgetItem(QStringList()<setData(0,Qt::AccessibleDescriptionRole,QVariant(tvUrl)); 100 | root->addChild(leaf); 101 | } 102 | treeWidget->addTopLevelItem(root); 103 | } 104 | } 105 | 106 | 107 | treeWidget->expand(treeWidget->model()->index(treeWidget->indexOfTopLevelItem(treeWidget->findItems("Local TV",Qt::MatchExactly).first()),0)); 108 | } 109 | 110 | void TvListWidget::itemDoubleClicked(QTreeWidgetItem *item, int i) 111 | { 112 | QString urls = item->data(0,Qt::AccessibleDescriptionRole).toString(); 113 | QStringList urlList = urls.split("#"); 114 | QString url = urlList.value(0,""); 115 | emit play(url,"高清"); 116 | 117 | } 118 | 119 | void TvListWidget::customContextMenuRequested(QPoint p) 120 | { 121 | QTreeWidgetItem *item = treeWidget->itemAt(p); 122 | if(!item || item->childCount()>0) 123 | { 124 | return; 125 | } 126 | QString urls = item->data(0,Qt::AccessibleDescriptionRole).toString(); 127 | QStringList urlList = urls.split("#"); 128 | QMenu *menu = new QMenu; 129 | for(int i=0; iaddAction(QString("源: %1").arg(i+1)); 132 | act->setToolTip(urlList.value(i,"")); 133 | act->setData(QVariant(urlList.value(i,""))); 134 | menu->addAction(act); 135 | actGoup->addAction(act); 136 | 137 | } 138 | menu->exec(treeWidget->mapToGlobal(p)); 139 | 140 | 141 | } 142 | 143 | void TvListWidget::play(QAction *act) 144 | { 145 | QString url = act->data().toString(); 146 | emit play(url,"高清"); 147 | } 148 | -------------------------------------------------------------------------------- /MyWidgets/PreferSetting/prefersetting.cpp: -------------------------------------------------------------------------------- 1 | #include "prefersetting.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | PreferSetting::PreferSetting(QWidget *parent) 8 | { 9 | mainLayout = new QGridLayout(this); 10 | qualityListWidget = new QListWidget; 11 | //qualityListWidget->setMinimumSize(200,300); 12 | qualityListWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); 13 | qualityUpBtn = new QPushButton("↑"); 14 | qualityDownBtn = new QPushButton("↓"); 15 | qualityAddBtn = new QPushButton("添加"); 16 | qualityDeleteBtn = new QPushButton("删除"); 17 | qualityResetBtn =new QPushButton("重置"); 18 | qualitySaveBtn = new QPushButton("保存"); 19 | mainLayout->addWidget(qualityListWidget,0,0,5,2); 20 | mainLayout->addWidget(qualityUpBtn,5,0,1,1); 21 | mainLayout->addWidget(qualityDownBtn,5,1,1,1); 22 | mainLayout->addWidget(qualityAddBtn,6,0,1,1); 23 | mainLayout->addWidget(qualityDeleteBtn,6,1,1,1); 24 | mainLayout->addWidget(qualityResetBtn,7,0,1,1); 25 | mainLayout->addWidget(qualitySaveBtn,7,1,1,1); 26 | 27 | 28 | connect(qualityUpBtn,SIGNAL(clicked()),this,SLOT(UpQuality())); 29 | connect(qualityDownBtn,SIGNAL(clicked()),this,SLOT(DownQuality())); 30 | connect(qualityDeleteBtn,SIGNAL(clicked()),this,SLOT(DeleteQuality())); 31 | connect(qualityAddBtn,SIGNAL(clicked()),this,SLOT(AddQuality())); 32 | connect(qualityResetBtn,SIGNAL(clicked()),this,SLOT(ResetQuality())); 33 | connect(qualitySaveBtn,SIGNAL(clicked()),this,SLOT(saveQuality())); 34 | 35 | QSettings settings("MvGather", "xusongjie"); 36 | preferQualitysSetting = settings.value("app/preferQualitys", "").toString(); 37 | if(preferQualitysSetting =="") 38 | { 39 | preferQualitysSetting="高清#超清#M3U8#分段_高清_FLV#分段_高清_MP4#分段_高清_M3U8#分段_720P_FLV#分段_720P_MP4#分段_720P_M3U8#分段_1080P_FLV#分段_1080P_MP4#分段_1080P_M3U8#分段_超清_FLV#分段_超清_MP4#分段_超清_M3U8#分段_标清_FLV#分段_标清_MP4#分段_标清_M3U8#分段_高码1080P_FLV#分段_高码1080P_MP4#分段_高码1080P_M3U8#分段_原画_FLV#分段_原画_MP4#分段_原画_M3U8#分段_4K_FLV#分段_4K_MP4#分段_4K_M3U8#分段_高码4K_FLV#分段_高码4K_MP4#分段_高码4K_M3U8#分段_低清_FLV#分段_低清_MP4#分段_低清_M3U8#单段_高清_MP4#单段_高清_M3U8#单段_高清_FLV#单段_720P_FLV#单段_720P_MP4#单段_720P_M3U8#单段_1080P_FLV#单段_1080P_MP4#单段_1080P_M3U8#单段_超清_FLV#单段_超清_MP4#单段_超清_M3U8#单段_标清_FLV#单段_标清_MP4#单段_标清_M3U8#单段_高码1080P_FLV#单段_高码1080P_MP4#单段_高码1080P_M3U8#单段_原画_FLV#单段_原画_MP4#单段_原画_M3U8#单段_4K_FLV#单段_4K_MP4#单段_4K_M3U8#单段_高码4K_FLV#单段_高码4K_MP4#单段_高码4K_M3U8#单段_低清_FLV#单段_低清_MP4#单段_低清_M3U8"; 40 | } 41 | qualityListWidget->addItems(preferQualitysSetting.split("#")); 42 | qualityListWidget->setCurrentRow(0); 43 | //qualityListWidget->setDragEnabled(true); 44 | qualityListWidget->setDragDropMode(QAbstractItemView::InternalMove); 45 | qualityListWidget->setSelectionMode(QAbstractItemView::ContiguousSelection); 46 | } 47 | 48 | void PreferSetting::saveQuality() 49 | { 50 | QStringList list_temp; 51 | int totalRows = qualityListWidget->count(); 52 | for(int i=0;iitem(i)->text()); 55 | } 56 | QSettings settings("MvGather", "xusongjie"); 57 | settings.setValue("app/preferQualitys", list_temp.join("#")); 58 | emit closeSig(); 59 | } 60 | 61 | void PreferSetting::UpQuality() 62 | { 63 | int currentItemIndex = qualityListWidget->currentRow(); 64 | if(currentItemIndex <= 0) 65 | { 66 | return; 67 | } 68 | QListWidgetItem *currentItem= qualityListWidget->takeItem(qualityListWidget->currentRow()); 69 | qualityListWidget->insertItem(currentItemIndex-1,currentItem); 70 | qualityListWidget->setCurrentItem(currentItem); 71 | } 72 | 73 | void PreferSetting::DownQuality() 74 | { 75 | int currentItemIndex = qualityListWidget->currentRow(); 76 | if(currentItemIndex >= qualityListWidget->count()-1||currentItemIndex<0 ) 77 | { 78 | return; 79 | } 80 | QListWidgetItem *currentItem= qualityListWidget->takeItem(qualityListWidget->currentRow()); 81 | qualityListWidget->insertItem(currentItemIndex+1,currentItem); 82 | qualityListWidget->setCurrentItem(currentItem); 83 | } 84 | 85 | void PreferSetting::DeleteQuality() 86 | { 87 | qualityListWidget->takeItem(qualityListWidget->currentRow()); 88 | } 89 | 90 | void PreferSetting::AddQuality() 91 | { 92 | bool ok; 93 | QString text = QInputDialog::getText(this, tr("请输入"), 94 | tr("视频清晰度名称:"), QLineEdit::Normal, 95 | "高清", &ok); 96 | if (ok && !text.isEmpty()) 97 | qualityListWidget->addItem(text); 98 | } 99 | 100 | void PreferSetting::ResetQuality() 101 | { 102 | qualityListWidget->clear(); 103 | preferQualitysSetting="高清#超清#M3U8#分段_高清_FLV#分段_高清_MP4#分段_高清_M3U8#分段_720P_FLV#分段_720P_MP4#分段_720P_M3U8#分段_1080P_FLV#分段_1080P_MP4#分段_1080P_M3U8#分段_超清_FLV#分段_超清_MP4#分段_超清_M3U8#分段_标清_FLV#分段_标清_MP4#分段_标清_M3U8#分段_高码1080P_FLV#分段_高码1080P_MP4#分段_高码1080P_M3U8#分段_原画_FLV#分段_原画_MP4#分段_原画_M3U8#分段_4K_FLV#分段_4K_MP4#分段_4K_M3U8#分段_高码4K_FLV#分段_高码4K_MP4#分段_高码4K_M3U8#分段_低清_FLV#分段_低清_MP4#分段_低清_M3U8#单段_高清_MP4#单段_高清_M3U8#单段_高清_FLV#单段_720P_FLV#单段_720P_MP4#单段_720P_M3U8#单段_1080P_FLV#单段_1080P_MP4#单段_1080P_M3U8#单段_超清_FLV#单段_超清_MP4#单段_超清_M3U8#单段_标清_FLV#单段_标清_MP4#单段_标清_M3U8#单段_高码1080P_FLV#单段_高码1080P_MP4#单段_高码1080P_M3U8#单段_原画_FLV#单段_原画_MP4#单段_原画_M3U8#单段_4K_FLV#单段_4K_MP4#单段_4K_M3U8#单段_高码4K_FLV#单段_高码4K_MP4#单段_高码4K_M3U8#单段_低清_FLV#单段_低清_MP4#单段_低清_M3U8"; 104 | qualityListWidget->addItems(preferQualitysSetting.split("#")); 105 | qualityListWidget->setCurrentRow(0); 106 | } 107 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "QFramer/fmainwindow.h" 3 | #include 4 | #include 5 | #include 6 | MainWindow::MainWindow(QWidget *parent) 7 | : FMainWindow(parent) 8 | { 9 | centerWindow = new CenterWindow; 10 | setCentralWidget(centerWindow); 11 | getTitleBar()->getTitleLabel()->setText("影视集结号3.2.1"); 12 | getTitleBar()->getSkinButton()->setVisible(false); 13 | getTitleBar()->getFixButton()->setVisible(false); 14 | getTitleBar()->getLogoButton()->setIcon(QIcon(":/images/images/icon.png")); 15 | getQSystemTrayIcon()->setIcon(QIcon(":/images/images/icon.png")); 16 | //getStatusBar()->setMaximumHeight(20); 17 | 18 | connect(centerWindow,SIGNAL(getIntofullScreenSignal(bool)),this,SLOT(getIntofullScreenMode(bool))); 19 | connect(centerWindow,SIGNAL(getIntoWideSignal(bool)),this,SLOT(getIntoWideMode(bool))); 20 | 21 | connect(getTitleBar()->getSettingButton(),SIGNAL(clicked()),this,SLOT(popupSettingMenu())); 22 | connect(getTitleBar()->getLogoButton(),SIGNAL(clicked()),this,SLOT(toggleStayOnTop())); 23 | 24 | isNowStayOnTop = false; 25 | 26 | appColorChange(); 27 | } 28 | 29 | void MainWindow::keyPressEvent(QKeyEvent *keyEvent) 30 | { 31 | if (keyEvent->key() == Qt::Key_Space) { 32 | if(centerWindow->playerWidget->playerWin->state==1) 33 | { 34 | centerWindow->playerWidget->playerWin->setState(2); 35 | }else if(centerWindow->playerWidget->playerWin->state==2) 36 | { 37 | centerWindow->playerWidget->playerWin->setState(1); 38 | } 39 | }else if(keyEvent->key() == Qt::Key_Left) 40 | { 41 | centerWindow->playerWidget->playerWin->player->seekBackward(); 42 | }else if(keyEvent->key() == Qt::Key_Right) 43 | { 44 | centerWindow->playerWidget->playerWin->player->seekForward(); 45 | }else if(keyEvent->key() == Qt::Key_Escape) 46 | { 47 | centerWindow->playerWidget->playerWin->setFullScreenMode(); 48 | } 49 | } 50 | /* 51 | 52 | void MainWindow::dragEnterEvent(QDragEnterEvent *event) 53 | { 54 | if (event->mimeData()->hasFormat("text/uri-list")) { 55 | event->acceptProposedAction(); 56 | } 57 | } 58 | 59 | void MainWindow::dropEvent(QDropEvent *event) 60 | { 61 | QList urls = event->mimeData()->urls(); 62 | if (urls.isEmpty()) { 63 | return; 64 | } 65 | 66 | QString fileName = urls.first().toLocalFile(); 67 | if (fileName.isEmpty()) { 68 | return; 69 | } 70 | centerWindow->play(fileName); 71 | }*/ 72 | 73 | MainWindow::~MainWindow() 74 | { 75 | 76 | } 77 | 78 | void MainWindow::getIntofullScreenMode(bool b) 79 | { 80 | if(b) 81 | { 82 | showNormal(); 83 | }else 84 | { 85 | showFullScreen(); 86 | } 87 | getTitleBar()->setVisible(b); 88 | getStatusBar()->setVisible(b); 89 | } 90 | 91 | void MainWindow::getIntoWideMode(bool b) 92 | { 93 | getStatusBar()->setVisible(b); 94 | } 95 | 96 | void MainWindow::popupSettingMenu() 97 | { 98 | QMenu *menu= new QMenu; 99 | QAction *preferSetAct = new QAction(tr("视频质量优先级设置"), this); 100 | QAction *preferSourceAct = new QAction(tr("视频来源优先级设置"), this); 101 | QAction *preferColorAct = new QAction(tr("软件皮肤设置"), this); 102 | QAction *checkVAct = new QAction(tr("检查更新"), this); 103 | 104 | menu->addAction(preferSetAct); 105 | menu->addAction(preferSourceAct); 106 | menu->addAction(preferColorAct); 107 | menu->addAction(checkVAct); 108 | 109 | QAction *resultAct = menu->exec(QCursor::pos()); 110 | if(resultAct == preferSetAct) 111 | { 112 | PreferSettingMainWin *s = new PreferSettingMainWin(0); 113 | s->show(); 114 | 115 | }else if(resultAct == checkVAct) 116 | { 117 | centerWindow->checkVersion(); 118 | }else if(resultAct == preferColorAct) 119 | { 120 | setColorWidget = new SetColorWidget; 121 | setColorWidget->show(); 122 | }else if(resultAct == preferSourceAct) 123 | { 124 | PreferSourceWidgetWin *s = new PreferSourceWidgetWin(0); 125 | s->show(); 126 | } 127 | getTitleBar()->clearChecked(); 128 | } 129 | 130 | void MainWindow::toggleStayOnTop() 131 | { 132 | QMenu *menu = new QMenu; 133 | QAction *onTopAct = new QAction(menu); 134 | onTopAct->setText("置顶"); 135 | onTopAct->setCheckable(true); 136 | onTopAct->setChecked(isNowStayOnTop?true:false); 137 | menu->addAction(onTopAct); 138 | QAction *returnAct = menu->exec(QCursor::pos()); 139 | if(returnAct == onTopAct) 140 | { 141 | 142 | if(isNowStayOnTop) 143 | { 144 | setWindowFlags(Qt::FramelessWindowHint); 145 | isNowStayOnTop = false; 146 | 147 | }else 148 | { 149 | setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint); 150 | isNowStayOnTop = true; 151 | } 152 | } 153 | this->show(); 154 | getTitleBar()->clearChecked(); 155 | return; 156 | } 157 | void MainWindow::appColorChange() 158 | { 159 | QSettings settings("MvGather", "xusongjie"); 160 | QByteArray backgroundColor = settings.value("app/backgroundColor", "0,112,132").toByteArray(); 161 | QByteArray btnColor = settings.value("app/btnColor", "0, 82, 112").toByteArray(); 162 | 163 | QFile file(":/qss/skin/qss/template.qss"); 164 | file.open(QFile::ReadOnly); 165 | QByteArray styleData = file.readAll(); 166 | styleData.replace("backgroundColor",backgroundColor);//background color change 167 | styleData.replace("btnColor",btnColor);//some button color change 168 | qApp->setStyleSheet(styleData); 169 | } 170 | -------------------------------------------------------------------------------- /MyWidgets/ListShowWidget/listshowwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "listshowwidget.h" 2 | #include "qmath.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | ListShowWidget::ListShowWidget(QWidget *parent) : 8 | QScrollArea(parent) 9 | { 10 | setMinimumWidth(200); 11 | areaWidgetLayout= new QGridLayout; 12 | areaWidget= new QWidget; 13 | QSizePolicy policy; 14 | policy.setHorizontalPolicy(QSizePolicy::Preferred); 15 | areaWidget->setSizePolicy(policy); 16 | areaWidget->setLayout(areaWidgetLayout); 17 | setWidget(areaWidget); 18 | 19 | page=1; 20 | checkSeeImgTimer = new QTimer; 21 | connect(checkSeeImgTimer,SIGNAL(timeout()),this,SLOT(loadSeeImg())); 22 | checkSeeImgTimer->setInterval(1000); 23 | checkSeeImgTimer->start(); 24 | 25 | this->setWidgetResizable(true); 26 | 27 | setObjectName("listScroll"); 28 | setStyleSheet("#listScroll{background: transparent;border:none;border-right:1px solid rgba(255,255,255,30)}"); 29 | areaWidget->setStyleSheet("background: transparent;border:none;"); 30 | } 31 | 32 | void ListShowWidget::pagePlus() 33 | { 34 | page++; 35 | emit pageChanged(); 36 | } 37 | 38 | void ListShowWidget::pageMinus() 39 | { 40 | if(page>1) 41 | { 42 | page--; 43 | emit pageChanged(); 44 | } 45 | 46 | } 47 | 48 | void ListShowWidget::showPage() 49 | { 50 | preBtn = new QPushButton; 51 | nextBtn = new QPushButton; 52 | preBtn->setText("上一页"); 53 | nextBtn->setText("下一页"); 54 | int br=areaWidgetLayout->rowCount(); 55 | areaWidgetLayout->addWidget(preBtn,br+1,0,1,1); 56 | areaWidgetLayout->addWidget(nextBtn,br+1,1,1,1); 57 | connect(preBtn,SIGNAL(clicked()),this,SLOT(pageMinus())); 58 | connect(nextBtn,SIGNAL(clicked()),this,SLOT(pagePlus())); 59 | 60 | } 61 | 62 | void ListShowWidget::sendclicked(QString tvUrl, QString title) 63 | { 64 | emit clicked(tvUrl,title); 65 | 66 | } 67 | 68 | void ListShowWidget::loadSeeImg() 69 | { 70 | if(areaWidgetLayout->count()<1) 71 | { 72 | return; 73 | } 74 | int verticalScrollBarValue=0; 75 | if(this->verticalScrollBar()) 76 | { 77 | verticalScrollBarValue=this->verticalScrollBar()->value(); 78 | } 79 | QRect rec= areaWidgetLayout->cellRect(0,0); 80 | int cellHeight = rec.height(); 81 | int seeTotalHeight = verticalScrollBarValue+this->viewport()->height(); 82 | 83 | if(cellHeight<10) 84 | { 85 | cellHeight=225; 86 | } 87 | int seeRowCount = qFloor(seeTotalHeight/cellHeight)+1; 88 | int count; 89 | 90 | if(areaWidgetLayout->count()>seeRowCount*areaWidgetLayout->columnCount()) 91 | { 92 | count=seeRowCount*areaWidgetLayout->columnCount(); 93 | }else 94 | { 95 | count=areaWidgetLayout->count(); 96 | } 97 | for(int i=0;i(areaWidgetLayout->itemAt(i)->widget())) 100 | { 101 | ListShowWidgetItem* item = qobject_cast(areaWidgetLayout->itemAt(i)->widget()); 102 | if(!item->ImgLbl->isImgLoaded) 103 | { 104 | item->ImgLbl->getImage(); 105 | item->ImgLbl->isImgLoaded =true; 106 | } 107 | } 108 | } 109 | 110 | } 111 | 112 | void ListShowWidget::loadDataToList(QStringList args)//传入数据并重新排列 113 | { 114 | //item 120*225 115 | int viewWith = this->viewport()->width(); 116 | while(areaWidgetLayout->count() > 0) 117 | { 118 | QWidget* widget = areaWidgetLayout->itemAt(0)->widget(); 119 | areaWidgetLayout->removeWidget(widget); 120 | delete widget; 121 | } 122 | //qDebug()<width(); 123 | 124 | //qDebug()<<"view width"<width()-this->verticalScrollBar()->width(); 126 | int columnMax=0; 127 | if(viewWith >500){ 128 | columnMax=qFloor(viewWith/125)-1; 129 | }else 130 | { 131 | columnMax=4; 132 | } 133 | 134 | int row=0; 135 | int column=0; 136 | int timeToDelay=0;//time表示推迟创建线程加载图片的时间 137 | foreach (QString arg, args) { 138 | //数据格式以#分隔,tvUrl#imgUrl#title#descripe 139 | QStringList list_temp = arg.split('#'); 140 | QString tvUrl= list_temp.value(0,""); 141 | QString imgUrl= list_temp.value(1,""); 142 | QString title= list_temp.value(2,""); 143 | QString descripe= list_temp.value(3,""); 144 | 145 | Item =new ListShowWidgetItem(0,tvUrl,imgUrl,title,descripe,timeToDelay); 146 | //Item->setStyleSheet("background: black;border:none;"); 147 | timeToDelay+=300; 148 | connect(Item,SIGNAL(clicked(QString,QString)),this,SLOT(sendclicked(QString,QString))); 149 | 150 | areaWidgetLayout->addWidget(Item,row,column,1,1); 151 | 152 | if(viewWith<500) 153 | { 154 | if(column>0) 155 | { 156 | column=0; 157 | row++; 158 | }else 159 | { 160 | column++; 161 | } 162 | }else 163 | { 164 | if(column>columnMax-1) 165 | { 166 | column=0; 167 | row++; 168 | }else 169 | { 170 | column++; 171 | } 172 | } 173 | } 174 | if(viewWith<=500) 175 | { 176 | int heightMax=(qFloor(areaWidgetLayout->count()/(columnMax))+1+0.3)*225; 177 | areaWidget->resize(500,heightMax); 178 | }else 179 | { 180 | int heightMax=(qFloor(areaWidgetLayout->count()/(columnMax+1))+1+0.3)*225; 181 | areaWidget->resize(viewWith,heightMax); 182 | } 183 | this->verticalScrollBar()->setValue(0); 184 | } 185 | -------------------------------------------------------------------------------- /MyWidgets/PlayerWidget/playerlistarea.cpp: -------------------------------------------------------------------------------- 1 | #include "playerlistarea.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | PlayerListArea::PlayerListArea(QWidget *parent) : 17 | QScrollArea(parent) 18 | { 19 | setContextMenuPolicy(Qt::DefaultContextMenu); 20 | // setMaximumWidth(260); 21 | // setMinimumWidth(220); 22 | setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 23 | setAttribute(Qt::WA_TranslucentBackground, true); 24 | mainWidget = new QWidget; 25 | // QSizePolicy policy; 26 | // policy.setVerticalPolicy(QSizePolicy::Fixed); 27 | // mainWidget->setSizePolicy(policy); 28 | //mainWidget->setMaximumWidth(this->viewport()->width()); 29 | setWidget(mainWidget); 30 | mainWidgetGLayout = new QGridLayout; 31 | mainWidget->setLayout(mainWidgetGLayout); 32 | mainWidgetGLayout->setAlignment(Qt::AlignLeft|Qt::AlignTop); 33 | // mainWidgetGLayout->setMargin(0); 34 | // mainWidgetGLayout->setSpacing(0); 35 | //QTimer::singleShot(1000, this, SLOT(updateList())); 36 | this->setWidgetResizable(true); 37 | updateList(); 38 | mainWidget->setObjectName("playerListAreaMainWidget"); 39 | //mainWidget->setStyleSheet("#playerListAreaMainWidget{background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 82, 112, 255), stop:0.5 rgba(0, 211, 197, 255), stop:1 rgba(0, 82, 112, 255));}"); 40 | } 41 | 42 | void PlayerListArea::contextMenuEvent(QContextMenuEvent *event) 43 | { 44 | QMenu *menu= new QMenu; 45 | QAction *openUrlAct = new QAction(tr("添加网页视频播放地址"), this); 46 | openUrlAct->setToolTip("从剪贴板中读取视频所在页url,进行播放,注意以http://开头!"); 47 | QAction *syncAct = new QAction(tr("同步视频列表"), this); 48 | connect(openUrlAct, SIGNAL(triggered()), this, SLOT(openUrl())); 49 | connect(syncAct, SIGNAL(triggered()), this, SLOT(sendSyncMv())); 50 | menu->addAction(openUrlAct); 51 | menu->addAction(syncAct); 52 | menu->exec(QCursor::pos()); 53 | 54 | } 55 | void PlayerListArea::updateList() 56 | { 57 | while(mainWidgetGLayout->count() > 0) 58 | { 59 | QWidget* widget = mainWidgetGLayout->itemAt(0)->widget(); 60 | mainWidgetGLayout->removeWidget(widget); 61 | delete widget; 62 | } 63 | QSqlQuery query_select("select * from playlistTB ORDER BY tvId DESC"); 64 | query_select.exec(); 65 | while(query_select.next()) 66 | { 67 | 68 | //tvId VARCHAR( 30 ) NOT NULL,tvName VARCHAR( 30 ),tvno_hrefs VARCHAR( 30 ),historyNo VARCHAR( 30 ) 69 | QString tvId =query_select.value("tvId").toString();// 70 | QString tvName =query_select.value("tvName").toString(); 71 | QString tvno_hrefs =query_select.value("tvno_hrefs").toString(); 72 | QString historyNo =query_select.value("historyNo").toString(); 73 | QString source =query_select.value("source").toString(); 74 | //letv#youku#tudou#imgotv#fun#funsion#hunantv#qq#qiyi#sohu#pptv#pps#1905 75 | if(source.contains("qiyi")) 76 | { 77 | source = "爱奇艺"; 78 | }else if(source.contains("letv")) 79 | { 80 | source = "乐视"; 81 | }else if(source.contains("tudou"))// 82 | { 83 | source = "土豆"; 84 | }else if(source.contains("youku")) 85 | { 86 | source = "优酷"; 87 | }else if(source.contains("imgotv")) 88 | { 89 | source = "芒果"; 90 | }else if(source.contains("fun")) 91 | { 92 | source = "风行"; 93 | }else if(source.contains("qq")) 94 | { 95 | source = "qq影视"; 96 | }else if(source.contains("huashu")) 97 | { 98 | source = "华数TV"; 99 | } 100 | 101 | listWidgetItem = new PlayerListWidgetItem(0,tvId,tvName+"("+source+")"); 102 | connect(listWidgetItem,SIGNAL(sendPlay(QString,QString)),this,SLOT(sendPlay(QString,QString))); 103 | connect(listWidgetItem,SIGNAL(updatePlayList()),this,SLOT(updateList())); 104 | mainWidgetGLayout->addWidget(listWidgetItem); 105 | QStringList tvno_hrefList = tvno_hrefs.split("$"); 106 | tvno_hrefList.removeAll(""); 107 | foreach (QString tvno_href , tvno_hrefList) { 108 | QStringList tempList = tvno_href.split("#"); 109 | listWidgetItem->addSerial(tempList.first(),historyNo); 110 | } 111 | listWidgetItem->setMaximumHeight((listWidgetItem->getRow()+1)*50); 112 | 113 | } 114 | this->verticalScrollBar()->setSliderPosition(0); 115 | } 116 | 117 | void PlayerListArea::sendPlay(QString tvId, QString tvNo) 118 | { 119 | emit play(tvId,tvNo); 120 | 121 | } 122 | 123 | void PlayerListArea::openUrl() 124 | { 125 | bool ok; 126 | QClipboard *clipboard = QApplication::clipboard(); 127 | QString originalText = clipboard->text(); 128 | QString str = QInputDialog::getText(this, tr("输入需解析播放的url地址"), 129 | tr("Url:"), QLineEdit::Normal, 130 | originalText, &ok); 131 | if (ok && !str.isEmpty()) 132 | { 133 | if(!str.startsWith("http://")) 134 | { 135 | str.prepend("http://"); 136 | } 137 | str = "1#"+str; 138 | //tvId:该视频唯一编号,tvName:视频中文名.tvno_hrefs:集数与相应地址...historyNo:上次观看到的集数 139 | qint64 tvId = QDateTime::currentMSecsSinceEpoch(); 140 | QSqlQuery query_insert; 141 | query_insert.exec(QString("INSERT INTO playlistTB VALUES ('%1','%2','%3','%4','','','')").arg(tvId).arg(QDateTime::currentDateTime().toString("yyyy.M.d h:m:s")).arg(str).arg("0")); 142 | 143 | updateList(); 144 | } 145 | 146 | } 147 | 148 | void PlayerListArea::sendSyncMv() 149 | { 150 | emit syncMv(); 151 | } 152 | -------------------------------------------------------------------------------- /MyWidgets/ThreadDownload/downloadwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "downloadwidget.h" 2 | #include "ui_downloadwidget.h" 3 | #include 4 | #include 5 | DownloadWidget::DownloadWidget(QWidget *parent , QString url, QString fileSavePath, qint64 taskId,int percent) : 6 | QWidget(parent), 7 | ui(new Ui::DownloadWidget) 8 | { 9 | ui->setupUi(this); 10 | process = new QProcess(this); 11 | connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(readyReadStandardOutput())); 12 | connect(process,SIGNAL(readyReadStandardError()),this,SLOT(readyReadStandardError())); 13 | manager = new QNetworkAccessManager(this); 14 | saveSettingTimer = new QTimer(this); 15 | connect(saveSettingTimer,SIGNAL(timeout()),this,SLOT(saveSetting())); 16 | 17 | this->url = url; 18 | this->fileSavePath = fileSavePath; 19 | this->taskId = taskId; 20 | this->percent = percent; 21 | ui->startBtn->setEnabled(percent==100?false:true); 22 | ui->pauseBtn->setEnabled(false); 23 | ui->playBtn->setEnabled(percent>2?true:false); 24 | ui->fileNameLbl->setText(QFileInfo(fileSavePath).fileName()); 25 | ui->progressBar->setValue(percent); 26 | ui->deleteBtn->setIcon(QIcon(QPixmap("://skin/icons/dark/appbar.page.delete.png"))); 27 | } 28 | 29 | DownloadWidget::~DownloadWidget() 30 | { 31 | process->terminate(); 32 | process->waitForFinished(); 33 | delete ui; 34 | } 35 | 36 | void DownloadWidget::closeEvent(QCloseEvent *) 37 | { 38 | 39 | } 40 | 41 | void DownloadWidget::startDownload(QString url, QString fileSavePath) 42 | { 43 | myTipWin.show(); 44 | myTipWin.setBusyIndicatorShow(true); 45 | myTipWin.setText("获取信息中"); 46 | this->realUrl = getRealUrl(url); 47 | QFileInfo finfo(fileSavePath); 48 | QDir dir; 49 | dir.mkpath(finfo.dir().path()); 50 | process->start(QString("axel -n 5 -o \"%0\" \"%1\"").arg(fileSavePath).arg(this->realUrl)); 51 | saveSettingTimer->start(10*1000); 52 | //qDebug()<realUrl<url; 65 | while(tryTimes --) 66 | { 67 | QEventLoop loop; 68 | QNetworkReply *reply = manager->head(QNetworkRequest(realUrl_temp)); 69 | connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 70 | loop.exec(); 71 | QVariant varLocation = reply->header(QNetworkRequest::LocationHeader); 72 | if(!varLocation.isNull()) 73 | { 74 | realUrl_temp = varLocation.toString(); 75 | //qDebug()<get(request0); 97 | QEventLoop loop0; 98 | QObject::connect(reply0, SIGNAL(finished()), &loop0, SLOT(quit())); 99 | loop0.exec(); 100 | QByteArray data0 = reply0->readAll(); 101 | realUrl = data0; 102 | } 103 | //qDebug()<readAll(); 111 | if(!data.contains("[")) 112 | { 113 | return; 114 | } 115 | //qDebug()<<"data:"<speedLbl->setText(str.replace(" ","")); 125 | } 126 | if(rx_percent.indexIn(data) != -1) 127 | { 128 | QString str = rx_percent.cap(0); 129 | int v = str.replace("%","").toInt(); 130 | ui->progressBar->setValue(v); 131 | this->percent = v; 132 | if(v == 100) 133 | { 134 | ui->pauseBtn->setEnabled(false); 135 | ui->speedLbl->setText("[0KB/s]"); 136 | } 137 | //qDebug()<<"str"<readAllStandardError(); 145 | } 146 | 147 | void DownloadWidget::saveSetting() 148 | { 149 | QSqlQuery query_update; 150 | query_update.exec(QString("update dtaskTB SET percent = '%0' WHERE taskId = '%1'").arg(this->percent).arg(this->taskId)); 151 | if(ui->progressBar->value()>2) 152 | { 153 | ui->playBtn->setEnabled(true); 154 | } 155 | } 156 | 157 | void DownloadWidget::on_startBtn_clicked() 158 | { 159 | ui->startBtn->setEnabled(false); 160 | ui->pauseBtn->setEnabled(true); 161 | startDownload(this->url,this->fileSavePath); 162 | } 163 | 164 | void DownloadWidget::on_playBtn_clicked() 165 | { 166 | emit play(this->fileSavePath); 167 | } 168 | 169 | void DownloadWidget::on_pauseBtn_clicked() 170 | { 171 | if(process->state() == QProcess::Running) 172 | { 173 | ui->speedLbl->setText("[0KB/s]"); 174 | process->terminate(); 175 | ui->pauseBtn->setText("继续"); 176 | saveSettingTimer->stop(); 177 | }else if(process->state() == QProcess::NotRunning) 178 | { 179 | process->start(QString("axel -n 5 -o \"%0\" \"%1\"").arg(fileSavePath).arg(this->realUrl)); 180 | ui->pauseBtn->setText("暂停"); 181 | saveSettingTimer->start(10*1000); 182 | } 183 | } 184 | 185 | void DownloadWidget::on_deleteBtn_clicked() 186 | { 187 | QSqlQuery query_delete(QString("delete from dtaskTB where taskId='%0'").arg(taskId)); 188 | query_delete.exec(); 189 | process->terminate(); 190 | this->hide(); 191 | 192 | //删除相关文件 193 | /* 194 | QFile file; 195 | QFileInfo finfo(fileSavePath); 196 | QString dirName = finfo.absolutePath(); 197 | 198 | file.setFileName(fileSavePath); 199 | file.remove(); 200 | file.setFileName(fileSavePath+".st"); 201 | file.remove(); 202 | 203 | QDir dir; 204 | dir.rmdir(dirName);*/ 205 | } 206 | -------------------------------------------------------------------------------- /MyWidgets/RecommendWidget/recommendwidget.cpp: -------------------------------------------------------------------------------- 1 | #include "recommendwidget.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | RecommendWidget::RecommendWidget(QWidget *parent) : 12 | QWidget(parent) 13 | { 14 | hostName="www.mvgather.com"; 15 | isFirstLoad = true; 16 | mainGLayout = new QGridLayout; 17 | 18 | mainGLayout->setMargin(0); 19 | setLayout(mainGLayout); 20 | 21 | listShowWidget = new ListShowWidget; 22 | dyRecommendBtn = new QPushButton; 23 | searchBtn = new QPushButton; 24 | searchLineEdit = new QLineEdit; 25 | 26 | searchBtn->setStyleSheet("QPushButton{background-color: rgba(0, 82, 112, 100);color: white;border: 1px;}QPushButton:hover{background-color: rgba(0, 82, 112, 200);color: white;border: 1px;}QPushButton:disabled{background-color: transparent;color: gray;}"); 27 | 28 | mainGLayout->addWidget(listShowWidget,0,0,10,10); 29 | mainGLayout->addWidget(dyRecommendBtn,0,10,1,1); 30 | mainGLayout->addWidget(searchLineEdit,1,10,1,2); 31 | mainGLayout->addWidget(searchBtn,1,12,1,1); 32 | 33 | connect(listShowWidget,SIGNAL(clicked(QString,QString)),this,SLOT(addDownloadTask(QString,QString)));//this->tvUrl,this->title 34 | connect(listShowWidget,SIGNAL(pageChanged()),this,SLOT(loadData())); 35 | 36 | connect(dyRecommendBtn,SIGNAL(clicked()),this,SLOT(reLoadData())); 37 | dyRecommendBtn->setText("电影推荐"); 38 | 39 | searchBtn->setText("搜索"); 40 | connect(searchBtn,SIGNAL(clicked()),this,SLOT(search())); 41 | 42 | connect(searchLineEdit,SIGNAL(returnPressed()),this,SLOT(search())); 43 | searchLineEdit->setMaximumWidth(200); 44 | 45 | manager = new QNetworkAccessManager; 46 | QTimer::singleShot(5000,this,SLOT(counter())); 47 | //QTimer::singleShot(2000,this,SLOT(loadData())); 48 | 49 | } 50 | 51 | void RecommendWidget::loadDataFromServer(int page) 52 | { 53 | myTipWin.show(); 54 | myTipWin.setBusyIndicatorShow(true); 55 | myTipWin.setText("正在请求数据"); 56 | QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(QString("http://%1/mvgather/api/getMvList.php?page=%2").arg(hostName).arg(page)))); 57 | QEventLoop loop; 58 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 59 | loop.exec(); 60 | QByteArray data = reply->readAll(); 61 | 62 | QStringList args; 63 | QString tvUrl; 64 | QString imgUrl; 65 | QString title; 66 | QString descripe; 67 | QStringList tempList = QString(data).split("$"); 68 | 69 | tempList.removeAll(""); 70 | foreach (QString alist, tempList) { 71 | tvUrl =alist.split("#").value(1,""); 72 | imgUrl =alist.split("#").value(2,""); 73 | title =alist.split("#").value(0,""); 74 | descripe =alist.split("#").value(3,""); 75 | args<loadDataToList(args); 87 | listShowWidget->showPage(); 88 | myTipWin.setText("加载完毕"); 89 | myTipWin.timeToHide(2); 90 | } 91 | 92 | } 93 | 94 | void RecommendWidget::loadData() 95 | { 96 | int page= listShowWidget->page; 97 | loadDataFromServer(page); 98 | } 99 | 100 | void RecommendWidget::reLoadData() 101 | { 102 | listShowWidget->page = 1; 103 | loadDataFromServer(1); 104 | } 105 | 106 | void RecommendWidget::addDownloadTask(QString url, QString title)//tvUrl,title 107 | { 108 | emit addDownloadTaskSignal(url); 109 | 110 | // QString fileSavePath; 111 | // if(url.contains("plyz")) 112 | // { 113 | // QString fileName = url.split("=").last(); 114 | // QString dirname = QFileDialog::getExistingDirectory(this, tr("选择保存目录:"), QDir::homePath()); 115 | // if(dirname=="") 116 | // { 117 | // dirname = QDir::homePath(); 118 | // } 119 | // fileSavePath=QString("%0/%1").arg(dirname).arg(fileName); 120 | 121 | // if(fileSavePath.isEmpty()) return; 122 | // fileSavePath = QFileInfo(fileSavePath).absoluteFilePath(); 123 | // } 124 | // //qDebug()<<"file"<show(); 128 | 129 | } 130 | 131 | void RecommendWidget::search() 132 | { 133 | if(searchLineEdit->text().trimmed()=="") 134 | { 135 | searchLineEdit->setText("在此填入文字!"); 136 | searchLineEdit->selectAll(); 137 | searchLineEdit->setFocus(); 138 | return; 139 | } 140 | if(searchLineEdit->text().contains("*")) 141 | { 142 | searchLineEdit->setText("请不要搞破坏!"); 143 | return; 144 | } 145 | if(searchLineEdit->text().contains(" ")) 146 | { 147 | searchLineEdit->setText("请不要输入空格符!"); 148 | return; 149 | } 150 | QString keyWord=searchLineEdit->text().trimmed(); 151 | QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(QString("http://%1/mvgather/api/search.php?keyWord=%2").arg(hostName).arg(keyWord)))); 152 | QEventLoop loop; 153 | QTimer::singleShot(10000,&loop,SLOT(quit())); 154 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 155 | loop.exec(); 156 | QByteArray data = reply->readAll(); 157 | 158 | QStringList args; 159 | QString tvUrl; 160 | QString imgUrl; 161 | QString title; 162 | QString descripe; 163 | QStringList tempList = QString(data).split("$"); 164 | 165 | tempList.removeAll(""); 166 | foreach (QString alist, tempList) { 167 | tvUrl =alist.split("#").value(1,""); 168 | imgUrl =alist.split("#").value(2,""); 169 | title =alist.split("#").value(0,""); 170 | descripe =alist.split("#").value(3,""); 171 | args<loadDataToList(args); 184 | } 185 | 186 | } 187 | 188 | void RecommendWidget::counter() 189 | { 190 | QList list = QNetworkInterface::allAddresses(); 191 | QString ip; 192 | foreach (QHostAddress address, list) 193 | { 194 | if(address.protocol() == QAbstractSocket::IPv4Protocol) 195 | ip =address.toString(); 196 | } 197 | if(ip=="") 198 | { 199 | ip="none"; 200 | } 201 | QNetworkReply *reply =manager->get(QNetworkRequest(QUrl(QString("http://%1/mvgather/userHome/useCounter.php?ip=%2").arg(hostName).arg(ip)))); 202 | QEventLoop loop; 203 | QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); 204 | loop.exec(); 205 | } 206 | 207 | -------------------------------------------------------------------------------- /MyWidgets/MagnetWidget/loginform.cpp: -------------------------------------------------------------------------------- 1 | #include "loginform.h" 2 | #include "ui_loginform.h" 3 | #include 4 | LoginForm::LoginForm(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::LoginForm) 7 | { 8 | setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint); 9 | 10 | ui->setupUi(this); 11 | ui->vCodeLbl->setVisible(false); 12 | ui->vCodelineEdit->setVisible(false); 13 | 14 | ui->lineEdit_2->setEchoMode(QLineEdit::Password); 15 | ui->lineEdit_2->setStyleSheet("lineedit-password-character: 42"); 16 | 17 | isInitMark = false; 18 | 19 | } 20 | 21 | LoginForm::~LoginForm() 22 | { 23 | delete ui; 24 | } 25 | 26 | void LoginForm::init(QNetworkAccessManager *manager) 27 | { 28 | this->manager = manager; 29 | QSettings settings("MvGather", "xusongjie"); 30 | QString str = settings.value("app/usrInfo", "").toString(); 31 | ui->lineEdit->setText(str.split("#").value(0,"")); 32 | ui->lineEdit_2->setText(str.split("#").value(1,"")); 33 | 34 | QEventLoop loop; 35 | QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("http://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&class=login&logintype=dialogLogin"))); 36 | QObject::connect(reply,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 37 | loop.exec(); 38 | //QByteArray data = reply->readAll(); 39 | 40 | QNetworkReply *reply1 = manager->get(QNetworkRequest(QUrl("http://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&class=login&logintype=dialogLogin"))); 41 | QObject::connect(reply1,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 42 | loop.exec(); 43 | QByteArray data = reply1->readAll(); 44 | 45 | QRegExp rx("token\" : \".*\""); 46 | rx.setMinimal(true); 47 | int pos = rx.indexIn(data); 48 | if (pos > -1) { 49 | QString tempStr = rx.cap(0); 50 | this->token = tempStr.replace(QRegExp("token\" : \"|\""),""); 51 | isInitMark = true; 52 | }else 53 | { 54 | myTipWin.show(); 55 | myTipWin.setBusyIndicatorShow(false); 56 | myTipWin.setText("获取token失败"); 57 | myTipWin.timeToHide(2); 58 | isInitMark = false; 59 | } 60 | //qDebug()<token; 61 | on_lineEdit_editingFinished(); 62 | 63 | } 64 | 65 | QString LoginForm::getToken() 66 | { 67 | return token; 68 | } 69 | 70 | void LoginForm::on_lineEdit_editingFinished() 71 | { 72 | 73 | QEventLoop loop; 74 | QNetworkReply *replyLoginCheck = manager->get(QNetworkRequest(QUrl(QString("http://passport.baidu.com/v2/api/?logincheck&token=%0&tpl=mm&apiver=v3&username=%1&isphone=false").arg(token).arg(ui->lineEdit->text())))); 75 | QObject::connect(replyLoginCheck,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 76 | loop.exec(); 77 | QByteArray dataLoginCheck = replyLoginCheck->readAll(); 78 | //qDebug()<error==QJsonParseError::NoError) 83 | { 84 | QJsonObject rootObj = doc.object(); 85 | QJsonObject dataObj = rootObj["data"].toObject(); 86 | this->codestring = dataObj["codeString"].toString(); 87 | this->vcodetype = dataObj["vcodetype"].toString(); 88 | } 89 | if(!this->codestring.isEmpty()) 90 | { 91 | QNetworkReply *replyVerifycode = manager->get(QNetworkRequest(QUrl(QString("http://passport.baidu.com/cgi-bin/genimage?%0").arg(codestring)))); 92 | QObject::connect(replyVerifycode,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 93 | loop.exec(); 94 | QByteArray dataVerifycode = replyVerifycode->readAll(); 95 | QPixmap pixmap; 96 | pixmap.loadFromData(dataVerifycode); 97 | ui->vCodeLbl->setPixmap(pixmap); 98 | ui->vCodeLbl->setVisible(true); 99 | ui->vCodelineEdit->setVisible(true); 100 | 101 | }else 102 | { 103 | ui->vCodeLbl->setVisible(false); 104 | ui->vCodelineEdit->setVisible(false); 105 | } 106 | } 107 | 108 | void LoginForm::on_pushButton_clicked() 109 | { 110 | myTipWin.show(); 111 | myTipWin.setBusyIndicatorShow(true); 112 | myTipWin.setText("正在登录"); 113 | ui->pushButton->setEnabled(false); 114 | QEventLoop loop; 115 | QByteArray postData; 116 | postData.append("staticpage=http://www.baidu.com/cache/user/html/v3Jump.html&"); 117 | postData.append("charset=utf-8&"); 118 | 119 | postData.append(QString("token=%0&").arg(token)); 120 | postData.append("isPhone=false&"); 121 | postData.append("quick_user=0&"); 122 | postData.append("u=http://www.baidu.com/&"); 123 | postData.append("safeflg=0&"); 124 | postData.append("loginType=dialogLogin&"); 125 | postData.append("logLoginType=pc_loginDialog&"); 126 | postData.append("tpl=mn&"); 127 | postData.append("loginmerge=true&"); 128 | postData.append("splogin=rate&"); 129 | 130 | postData.append(QString("username=%0&").arg(ui->lineEdit->text())); 131 | postData.append(QString("password=%0&").arg(ui->lineEdit_2->text())); 132 | 133 | postData.append(QString("codestring=%0&").arg(codestring)); 134 | postData.append(QString("verifycode=%0&").arg(ui->vCodelineEdit->text())); 135 | postData.append("mem_pass=on"); 136 | 137 | QNetworkRequest re(QUrl("http://passport.baidu.com/v2/api/?login")); 138 | re.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded"); 139 | QNetworkReply *reply2 = manager->post(re,postData); 140 | QTimer::singleShot(5000,&loop,SLOT(quit())); 141 | QObject::connect(reply2,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 142 | loop.exec(); 143 | QByteArray data = reply2->readAll(); 144 | //qDebug()<lineEdit->text()); 152 | str.append("#"); 153 | str.append(ui->lineEdit_2->text()); 154 | settings.setValue("app/usrInfo", str); 155 | 156 | QEventLoop loop; 157 | QNetworkReply *replyDiskInfo = manager->get(QNetworkRequest(QUrl(QString("http://pan.baidu.com/api/quota?channel=chunlei&clienttype=0&web=1")))); 158 | QTimer::singleShot(5000,&loop,SLOT(quit())); 159 | QObject::connect(replyDiskInfo,SIGNAL(finished()), &loop, SLOT(quit()), Qt::DirectConnection); 160 | loop.exec(); 161 | QByteArray dataDiskInfo = replyDiskInfo->readAll(); 162 | //qDebug()<error==QJsonParseError::NoError) 166 | { 167 | QJsonObject rootObj = doc.object(); 168 | QVariantMap rootMap = rootObj.toVariantMap(); 169 | QString errnoV = rootMap.value("errno").toString(); 170 | //qDebug()<hide(); 176 | emit panInfoChanger(QString("%0 GB/%1 GB").arg(QString::number(used/(1024*1024*1024))).arg(QString::number(total/(1024*1024*1024)))); 177 | emit loginSuccess(ui->lineEdit->text(),this->token); 178 | } 179 | 180 | } 181 | }else 182 | { 183 | on_lineEdit_editingFinished(); 184 | myTipWin.setText("登录失败"); 185 | } 186 | myTipWin.timeToHide(2); 187 | 188 | ui->pushButton->setEnabled(true); 189 | } 190 | -------------------------------------------------------------------------------- /QFramer/fnavgationbar.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fnavgationbar.h" 24 | #include 25 | #include 26 | #include 27 | 28 | 29 | FNavgationBar::FNavgationBar(QWidget *parent) 30 | :QFrame(parent) 31 | { 32 | initData(); 33 | initUI(); 34 | initConnect(); 35 | } 36 | 37 | void FNavgationBar::initData() 38 | { 39 | cIndex = 0; 40 | } 41 | 42 | void FNavgationBar::initUI() 43 | { 44 | setObjectName(QString("FNavgationBar")); 45 | //setFixedHeight(66); 46 | } 47 | 48 | void FNavgationBar::initConnect() 49 | { 50 | for(int i=0; isetObjectName(objectName); 62 | connect(button, SIGNAL(clicked()), this, SLOT(setButtonChecked())); 63 | } 64 | 65 | void FNavgationBar::setAlignment_topLeft() 66 | { 67 | mainlayout_topLeft = new QHBoxLayout; 68 | for(int i=0; i < buttons.length(); i++) 69 | { 70 | mainlayout_topLeft->addWidget(buttons.at(i)); 71 | } 72 | mainlayout_topLeft->addStretch(); 73 | mainlayout_topLeft->setContentsMargins(0, 0, 0, 0); 74 | mainlayout_topLeft->setSpacing(0); 75 | setLayout(mainlayout_topLeft); 76 | } 77 | 78 | void FNavgationBar::setAlignment_topCenter() 79 | { 80 | mainlayout_topCenter = new QHBoxLayout; 81 | mainlayout_topCenter->addStretch(); 82 | for(int i=0; i < buttons.length(); i++) 83 | { 84 | mainlayout_topCenter->addWidget(buttons.at(i)); 85 | } 86 | mainlayout_topCenter->addStretch(); 87 | mainlayout_topCenter->setContentsMargins(0, 0, 0, 0); 88 | mainlayout_topCenter->setSpacing(0); 89 | setLayout(mainlayout_topCenter); 90 | } 91 | 92 | void FNavgationBar::setAlignment_topRight() 93 | { 94 | mainlayout_topRight = new QHBoxLayout; 95 | mainlayout_topRight->addStretch(); 96 | for(int i=0; i < buttons.length(); i++) 97 | { 98 | mainlayout_topRight->addWidget(buttons.at(i)); 99 | } 100 | mainlayout_topRight->setContentsMargins(0, 0, 0, 0); 101 | mainlayout_topRight->setSpacing(0); 102 | setLayout(mainlayout_topRight); 103 | } 104 | 105 | 106 | void FNavgationBar::setAlignment_bottomLeft() 107 | { 108 | mainlayout_bottomLeft = new QHBoxLayout; 109 | for(int i=0; i < buttons.length(); i++) 110 | { 111 | mainlayout_bottomLeft->addWidget(buttons.at(i)); 112 | } 113 | mainlayout_bottomLeft->addStretch(); 114 | mainlayout_bottomLeft->setContentsMargins(0, 0, 0, 0); 115 | mainlayout_bottomLeft->setSpacing(0); 116 | setLayout(mainlayout_bottomLeft); 117 | } 118 | 119 | 120 | void FNavgationBar::setAlignment_bottomCenter() 121 | { 122 | mainlayout_bottomCenter = new QHBoxLayout; 123 | mainlayout_bottomCenter->addStretch(); 124 | for(int i=0; i < buttons.length(); i++) 125 | { 126 | mainlayout_bottomCenter->addWidget(buttons.at(i)); 127 | } 128 | mainlayout_bottomCenter->addStretch(); 129 | mainlayout_bottomCenter->setContentsMargins(0, 0, 0, 0); 130 | mainlayout_bottomCenter->setSpacing(0); 131 | setLayout(mainlayout_bottomCenter); 132 | } 133 | 134 | void FNavgationBar::setAlignment_bottomRight() 135 | { 136 | mainlayout_bottomRight = new QHBoxLayout; 137 | mainlayout_bottomRight->addStretch(); 138 | for(int i=0; i < buttons.length(); i++) 139 | { 140 | mainlayout_bottomRight->addWidget(buttons.at(i)); 141 | } 142 | mainlayout_bottomRight->setContentsMargins(0, 0, 0, 0); 143 | mainlayout_bottomRight->setSpacing(0); 144 | setLayout(mainlayout_bottomRight); 145 | } 146 | 147 | void FNavgationBar::setAlignment_leftTop() 148 | { 149 | mainlayout_leftTop = new QVBoxLayout; 150 | for(int i=0; i < buttons.length(); i++) 151 | { 152 | mainlayout_leftTop->addWidget(buttons.at(i)); 153 | } 154 | mainlayout_leftTop->addStretch(); 155 | mainlayout_leftTop->setContentsMargins(0, 0, 0, 0); 156 | mainlayout_leftTop->setSpacing(0); 157 | setLayout(mainlayout_leftTop); 158 | } 159 | 160 | void FNavgationBar::setAlignment_leftCenter() 161 | { 162 | mainlayout_leftCenter = new QVBoxLayout; 163 | mainlayout_leftCenter->addStretch(); 164 | for(int i=0; i < buttons.length(); i++) 165 | { 166 | mainlayout_leftCenter->addWidget(buttons.at(i)); 167 | } 168 | mainlayout_leftCenter->addStretch(); 169 | mainlayout_leftCenter->setContentsMargins(0, 0, 0, 0); 170 | mainlayout_leftCenter->setSpacing(0); 171 | setLayout(mainlayout_leftCenter); 172 | } 173 | 174 | void FNavgationBar::setAlignment_leftBottom() 175 | { 176 | mainlayout_leftBottom = new QVBoxLayout; 177 | mainlayout_leftBottom->addStretch(); 178 | for(int i=0; i < buttons.length(); i++) 179 | { 180 | mainlayout_leftBottom->addWidget(buttons.at(i)); 181 | } 182 | mainlayout_leftBottom->setContentsMargins(0, 0, 0, 0); 183 | mainlayout_leftBottom->setSpacing(0); 184 | setLayout(mainlayout_leftBottom); 185 | } 186 | 187 | void FNavgationBar::setAlignment_rightTop() 188 | { 189 | mainlayout_rightTop = new QVBoxLayout; 190 | for(int i=0; i < buttons.length(); i++) 191 | { 192 | mainlayout_rightTop->addWidget(buttons.at(i)); 193 | } 194 | mainlayout_rightTop->addStretch(); 195 | mainlayout_rightTop->setContentsMargins(0, 0, 0, 0); 196 | mainlayout_rightTop->setSpacing(0); 197 | setLayout(mainlayout_rightTop); 198 | } 199 | 200 | void FNavgationBar::setAlignment_rightCenter() 201 | { 202 | mainlayout_rightCenter = new QVBoxLayout; 203 | mainlayout_rightCenter->addStretch(); 204 | for(int i=0; i < buttons.length(); i++) 205 | { 206 | mainlayout_rightCenter->addWidget(buttons.at(i)); 207 | } 208 | mainlayout_rightCenter->addStretch(); 209 | mainlayout_rightCenter->setContentsMargins(0, 0, 0, 0); 210 | mainlayout_rightCenter->setSpacing(0); 211 | setLayout(mainlayout_rightCenter); 212 | } 213 | 214 | void FNavgationBar::setAlignment_rightBottom() 215 | { 216 | mainlayout_rightBottom = new QVBoxLayout; 217 | mainlayout_rightBottom->addStretch(); 218 | for(int i=0; i < buttons.length(); i++) 219 | { 220 | mainlayout_rightBottom->addWidget(buttons.at(i)); 221 | } 222 | mainlayout_rightBottom->setContentsMargins(0, 0, 0, 0); 223 | mainlayout_rightBottom->setSpacing(0); 224 | setLayout(mainlayout_rightBottom); 225 | } 226 | 227 | int FNavgationBar::currentIndex() 228 | { 229 | return cIndex; 230 | } 231 | 232 | void FNavgationBar::setCurrentIndex(int index) 233 | { 234 | buttons.at(index)->click(); 235 | } 236 | 237 | int FNavgationBar::count() 238 | { 239 | return buttons.size(); 240 | } 241 | 242 | void FNavgationBar::setButtonChecked() 243 | { 244 | for (int i = 0; i < buttons.size(); ++i) { 245 | if (buttons.at(i) == sender()) 246 | { 247 | buttons.at(i)->setChecked(true); 248 | emit indexChanged(i); 249 | cIndex = i; 250 | } 251 | else{ 252 | buttons.at(i)->setChecked(false); 253 | } 254 | } 255 | } 256 | 257 | -------------------------------------------------------------------------------- /QFramer/fmainwindow.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 dragondjf 4 | ** 5 | ** QFramer is a frame based on Qt5.3, you will be more efficient with it. 6 | ** As an Qter, Qt give us a nice coding experience. With user interactive experience(UE) 7 | ** become more and more important in modern software, deveployers should consider business and UE. 8 | ** So, QFramer is born. QFramer's goal is to be a mature solution 9 | ** which you only need to be focus on your business but UE for all Qters. 10 | ** 11 | ** Version : 0.2.5.0 12 | ** Author : dragondjf 13 | ** Website : https://github.com/dragondjf 14 | ** Project : https://github.com/dragondjf/QCFramer 15 | ** Blog : http://my.oschina.net/dragondjf/home/?ft=atme 16 | ** Wiki : https://github.com/dragondjf/QCFramer/wiki 17 | ** Lincence: LGPL V2 18 | ** QQ: 465398889 19 | ** Email: dragondjf@gmail.com, ding465398889@163.com, 465398889@qq.com 20 | ** 21 | ****************************************************************************/ 22 | 23 | #include "fmainwindow.h" 24 | #include "futil.h" 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | 35 | FMainWindow::FMainWindow(QWidget *parent) 36 | : QMainWindow(parent) 37 | { 38 | //qDebug("mainwindow init"); 39 | initData(); 40 | initUI(); 41 | initConnect(); 42 | } 43 | 44 | void FMainWindow::initData() 45 | { 46 | leftbuttonpressed = false; 47 | lockmoved = false; 48 | locked = false; 49 | } 50 | 51 | void FMainWindow::initUI() 52 | { 53 | titleBar = FTitleBar::getInstace(); 54 | 55 | setObjectName(QString("FMainWindow")); 56 | QDesktopWidget* desktopWidget = QApplication::desktop(); 57 | setMaximumSize(desktopWidget->availableGeometry().size()); 58 | readSettings(); 59 | 60 | setWindowFlags(Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint); 61 | //setWindowTitle("QFramer"); 62 | 63 | pstatusbar = new QStatusBar; 64 | pstatusbar->setFixedHeight(15); 65 | setStatusBar(pstatusbar); 66 | trayicon = new QSystemTrayIcon(QIcon(QString(":/images/images/icon.png")), this); 67 | trayicon->setObjectName(QString("trayicon")); 68 | trayicon->setToolTip(QString(qApp->applicationName())); 69 | trayicon->show(); 70 | 71 | //flyWidget = new FlyWidget(this); 72 | //flyWidget->move(desktopWidget->availableGeometry().width() * 0.8, desktopWidget->availableGeometry().height() *0.2); 73 | } 74 | 75 | 76 | void FMainWindow::initConnect( ) 77 | { 78 | connect(titleBar, SIGNAL(minimuned()), this, SIGNAL(Hidden())); 79 | //connect(titleBar, SIGNAL(closed()), this, SIGNAL(Hidden())); 80 | connect(titleBar, SIGNAL(minimuned()), this, SLOT(hide())); 81 | //connect(titleBar, SIGNAL(minimuned()), this, SLOT(showFlyWidget())); 82 | connect(titleBar, SIGNAL(maximumed()), this, SLOT(swithMaxNormal())); 83 | connect(titleBar, SIGNAL(closed()), this, SLOT(quitProcess())); 84 | //connect(titleBar, SIGNAL(closed()), this, SLOT(showFlyWidget())); 85 | connect(trayicon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), 86 | this, SLOT(onSystemTrayIconClicked(QSystemTrayIcon::ActivationReason))); 87 | } 88 | 89 | 90 | void FMainWindow::readSettings() 91 | { 92 | QDesktopWidget* desktopWidget = QApplication::desktop(); 93 | int w = desktopWidget->availableGeometry().width(); 94 | int h = desktopWidget->availableGeometry().height(); 95 | QSettings settings("MvGather", "xusongjie"); 96 | resize(settings.value("FMainWindow/size", QSize(w * 0.6, h * 0.6)).toSize()); 97 | //qDebug()<show(); 170 | } 171 | 172 | void FMainWindow::mousePressEvent(QMouseEvent *e) 173 | { 174 | if(e->button() & Qt::LeftButton) 175 | { 176 | if(e->y() < titleBar->height() and e->x() > titleBar->width() - 120) 177 | { 178 | leftbuttonpressed = false; 179 | } 180 | else 181 | { 182 | dragPosition = e->globalPos() - frameGeometry().topLeft(); 183 | leftbuttonpressed = true; 184 | } 185 | } 186 | e->accept(); 187 | } 188 | 189 | void FMainWindow::mouseDoubleClickEvent(QMouseEvent *e) 190 | { 191 | if(e->y() < titleBar->height() and e->x() < titleBar->width() - 120) 192 | { 193 | swithMaxNormal(); 194 | e->accept(); 195 | }else{ 196 | e->ignore(); 197 | } 198 | } 199 | 200 | void FMainWindow::SetCursorStyle(enum_Direction direction) 201 | { 202 | //设置上下左右以及右上、右下、左上、坐下的鼠标形状 203 | switch(direction) 204 | { 205 | case eTop: 206 | case eBottom: 207 | setCursor(Qt::SizeVerCursor); 208 | break; 209 | case eRight: 210 | case eLeft: 211 | setCursor(Qt::SizeHorCursor); 212 | break; 213 | case eNormal: 214 | setCursor(Qt::ArrowCursor); 215 | default: 216 | setCursor(Qt::ArrowCursor); 217 | break; 218 | } 219 | } 220 | 221 | void FMainWindow::mouseReleaseEvent(QMouseEvent *e) 222 | { 223 | leftbuttonpressed = false; 224 | titleBar->clearChecked(); 225 | e->accept(); 226 | } 227 | 228 | void FMainWindow::mouseMoveEvent(QMouseEvent *e) 229 | { 230 | if(isMaximized()) 231 | { 232 | e->ignore(); 233 | } 234 | else 235 | { 236 | 237 | if(e->y() < titleBar->height() and e->x() > titleBar->width() - 120) 238 | { 239 | e->ignore(); 240 | } 241 | else{ 242 | if(leftbuttonpressed) 243 | { 244 | if(getTitleBar()->getFixedflag()) 245 | { 246 | move(e->globalPos() - dragPosition); 247 | } 248 | e->accept(); 249 | } 250 | 251 | } 252 | } 253 | 254 | } 255 | 256 | //void FMainWindow::keyPressEvent(QKeyEvent *e) 257 | //{ 258 | // if(e->key() == Qt::Key_Escape){ 259 | // close(); 260 | // } 261 | // else if (e->key() == Qt::Key_F11) { 262 | // titleBar->getMaxButton()->click(); 263 | // } 264 | //} 265 | 266 | void FMainWindow::closeEvent(QCloseEvent *event) 267 | { 268 | QMainWindow::closeEvent(event); 269 | } 270 | 271 | 272 | void FMainWindow::animationClose() 273 | { 274 | writeSettings(); 275 | QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); 276 | connect(animation, SIGNAL(finished()), this, SLOT(close())); 277 | animation->setDuration(500); 278 | animation->setStartValue(1); 279 | animation->setEndValue(0); 280 | animation->start(); 281 | } 282 | 283 | void FMainWindow::onSystemTrayIconClicked(QSystemTrayIcon::ActivationReason reason) 284 | { 285 | switch(reason) 286 | { 287 | //单击 288 | case QSystemTrayIcon::Trigger: 289 | //双击 290 | case QSystemTrayIcon::DoubleClick: 291 | if(isHidden()) 292 | { 293 | //恢复窗口显示 294 | show(); 295 | //一下两句缺一均不能有效将窗口置顶 296 | setWindowState(Qt::WindowActive); 297 | activateWindow(); 298 | setLocked(locked); 299 | } 300 | else 301 | { 302 | if(not locked) 303 | { 304 | hide(); 305 | } 306 | } 307 | break; 308 | case QSystemTrayIcon::Context: 309 | break; 310 | default: 311 | break; 312 | } 313 | } 314 | 315 | FMainWindow::~FMainWindow() 316 | { 317 | //printf("111111\n"); 318 | } 319 | --------------------------------------------------------------------------------