Browse Source

V1.6.1

1.修复视频文件不能打开的bug
叶海辉 6 năm trước cách đây
mục cha
commit
b544dc13e3
47 tập tin đã thay đổi với 1642 bổ sung3667 xóa
  1. 0 2
      VideoPlayer.pro
  2. BIN
      ffmpeg/bin/SDL2.dll
  3. BIN
      image/close_normal.png
  4. BIN
      image/showmaxsizebtn.png
  5. BIN
      image/showminisizebtn.png
  6. BIN
      image/shownormalbtn.png
  7. 4 0
      resources.qrc
  8. 0 23
      src/CustomTitleWidget/CustomTitleWidget.pri
  9. 0 138
      src/CustomTitleWidget/customtitle.cpp
  10. 0 57
      src/CustomTitleWidget/customtitle.h
  11. 0 297
      src/CustomTitleWidget/customtitle.ui
  12. 0 113
      src/CustomTitleWidget/frmmain.cpp
  13. 0 49
      src/CustomTitleWidget/frmmain.h
  14. 0 508
      src/CustomTitleWidget/frmmain.ui
  15. 0 77
      src/CustomTitleWidget/frmmessagebox.cpp
  16. 0 35
      src/CustomTitleWidget/frmmessagebox.h
  17. 0 275
      src/CustomTitleWidget/frmmessagebox.ui
  18. 0 24
      src/CustomTitleWidget/iconhelper.cpp
  19. 0 37
      src/CustomTitleWidget/iconhelper.h
  20. BIN
      src/CustomTitleWidget/image/add-line_horizontal.png
  21. BIN
      src/CustomTitleWidget/image/add-line_vertical.png
  22. BIN
      src/CustomTitleWidget/image/array_down.png
  23. 0 354
      src/CustomTitleWidget/image/black.css
  24. 0 350
      src/CustomTitleWidget/image/blue.css
  25. BIN
      src/CustomTitleWidget/image/checkbox_checked.png
  26. BIN
      src/CustomTitleWidget/image/checkbox_unchecked.png
  27. BIN
      src/CustomTitleWidget/image/error.png
  28. BIN
      src/CustomTitleWidget/image/fontawesome-webfont.ttf
  29. 0 353
      src/CustomTitleWidget/image/gray.css
  30. BIN
      src/CustomTitleWidget/image/info.png
  31. 0 347
      src/CustomTitleWidget/image/navy.css
  32. BIN
      src/CustomTitleWidget/image/qt_zh_CN.qm
  33. BIN
      src/CustomTitleWidget/image/question.png
  34. BIN
      src/CustomTitleWidget/image/radio_normal.png
  35. BIN
      src/CustomTitleWidget/image/radio_selected.png
  36. BIN
      src/CustomTitleWidget/image/sub-line_horizontal.png
  37. BIN
      src/CustomTitleWidget/image/sub-line_vertical.png
  38. 0 121
      src/CustomTitleWidget/myhelper.h
  39. 0 22
      src/CustomTitleWidget/rc.qrc
  40. 2 11
      src/main.cpp
  41. 442 23
      src/videoplayer/videoplayer.cpp
  42. 38 4
      src/videoplayer/videoplayer.h
  43. 680 281
      src/videoplayer/videoplayer.ui
  44. 7 1
      src/videoplayer/videoplayer_showvideowidget.cpp
  45. 388 154
      src/videoplayer/videoplayer_thread.cpp
  46. 79 9
      src/videoplayer/videoplayer_thread.h
  47. 2 2
      说明.txt

+ 0 - 2
VideoPlayer.pro

@@ -11,8 +11,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 TARGET = VideoPlayer
 TEMPLATE = app
 
-include(src/CustomTitleWidget/CustomTitleWidget.pri)
-
 SOURCES += src/main.cpp \
     src/videoplayer/videoplayer_thread.cpp \
     src/videoplayer/videoplayer.cpp \

BIN
ffmpeg/bin/SDL2.dll


BIN
image/close_normal.png


BIN
image/showmaxsizebtn.png


BIN
image/showminisizebtn.png


BIN
image/shownormalbtn.png


+ 4 - 0
resources.qrc

@@ -8,5 +8,9 @@
         <file>image/start_focus.png</file>
         <file>image/start_normal.png</file>
         <file>image/start1_normal.png</file>
+        <file>image/close_normal.png</file>
+        <file>image/showmaxsizebtn.png</file>
+        <file>image/showminisizebtn.png</file>
+        <file>image/shownormalbtn.png</file>
     </qresource>
 </RCC>

+ 0 - 23
src/CustomTitleWidget/CustomTitleWidget.pri

@@ -1,23 +0,0 @@
-
-INCLUDEPATH += $$PWD
-DEPENDPATH += $$PWD
-
-SOURCES += \
-        $$PWD/frmmain.cpp \
-    $$PWD/iconhelper.cpp \
-    $$PWD/frmmessagebox.cpp \
-    src/CustomTitleWidget/customtitle.cpp
-
-HEADERS  += $$PWD/frmmain.h \
-    $$PWD/iconhelper.h \
-    $$PWD/frmmessagebox.h \
-    $$PWD/myhelper.h \
-    src/CustomTitleWidget/customtitle.h
-
-FORMS    += $$PWD/frmmain.ui \
-    $$PWD/frmmessagebox.ui \
-    src/CustomTitleWidget/customtitle.ui
-
-
-RESOURCES += \
-    $$PWD/rc.qrc

+ 0 - 138
src/CustomTitleWidget/customtitle.cpp

@@ -1,138 +0,0 @@
-#include "customtitle.h"
-#include "ui_customtitle.h"
-
-#include "iconhelper.h"
-#include "myhelper.h"
-
-CustomTitle::CustomTitle(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::CustomTitle)
-{
-    ui->setupUi(this);
-
-//    myHelper::FormInCenter(this);
-    this->InitStyle();
-
-    dialog = new QDialog;
-    ui->verticalLayout_content->addWidget(dialog);
-    dialog->show();
-}
-
-CustomTitle::~CustomTitle()
-{
-    delete ui;
-}
-
-void CustomTitle::doClose()
-{
-    close();
-}
-
-QWidget *CustomTitle::getContentWidget()
-{
-    return ui->widget;
-}
-
-QDialog *CustomTitle::getContentDialog()
-{
-    return dialog;
-}
-
-void CustomTitle::InitStyle()
-{
-    //设置窗体标题栏隐藏
-    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
-    this->setAttribute(Qt::WA_TranslucentBackground, true);
-    location = this->geometry();
-    max = false;
-    mousePressed = false;
-
-    //安装事件监听器,让标题栏识别鼠标双击
-    ui->lab_Title->installEventFilter(this);
-
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Min, QChar(0xf068), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu, QChar(0xf0c9), 10);
-    IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
-}
-
-bool CustomTitle::eventFilter(QObject *obj, QEvent *event)
-{
-    if (event->type() == QEvent::MouseButtonDblClick) {
-        this->on_btnMenu_Max_clicked();
-        return true;
-    }
-    return QObject::eventFilter(obj, event);
-}
-
-void CustomTitle::mouseMoveEvent(QMouseEvent *e)
-{
-    if (mousePressed && (e->buttons() && Qt::LeftButton) && !max) {
-        this->move(e->globalPos() - mousePoint);
-        e->accept();
-    }
-}
-
-void CustomTitle::mousePressEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::LeftButton) {
-        mousePressed = true;
-        mousePoint = e->globalPos() - this->pos();
-        e->accept();
-    }
-}
-
-void CustomTitle::mouseReleaseEvent(QMouseEvent *)
-{
-    mousePressed = false;
-}
-
-void CustomTitle::mouseDoubleClickEvent(QMouseEvent *e)
-{
-    on_btnMenu_Max_clicked();
-}
-
-void CustomTitle::on_btnMenu_Close_clicked()
-{
-//    qApp->exit();
-    doClose();
-}
-
-void CustomTitle::on_btnMenu_Max_clicked()
-{
-    if (max) {
-        this->setGeometry(location);
-        IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
-        ui->btnMenu_Max->setToolTip("最大化");
-    } else {
-        location = this->geometry();
-        this->setGeometry(qApp->desktop()->availableGeometry());
-        IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf079), 10);
-        ui->btnMenu_Max->setToolTip("还原");
-    }
-    max = !max;
-}
-
-void CustomTitle::on_btnMenu_Min_clicked()
-{
-    this->showMinimized();
-}
-
-void CustomTitle::setTitle(QString str)
-{
-    ui->lab_Title->setText(str);
-    this->setWindowTitle(str);
-}
-
-void CustomTitle::showMaximized()
-{
-    this->show();
-    max = false;
-    on_btnMenu_Max_clicked();
-}
-
-void CustomTitle::changeMax()
-{
-    on_btnMenu_Max_clicked();
-}

+ 0 - 57
src/CustomTitleWidget/customtitle.h

@@ -1,57 +0,0 @@
-#ifndef CUSTOMTITLE_H
-#define CUSTOMTITLE_H
-
-#include <QDialog>
-
-namespace Ui {
-class CustomTitle;
-}
-
-class CustomTitle : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit CustomTitle(QWidget *parent = 0);
-    ~CustomTitle();
-
-    QWidget *getContentWidget();
-    QDialog *getContentDialog();
-
-    void setTitle(QString str);
-
-    void showMaximized();
-
-    void changeMax();
-
-    virtual void doClose();
-
-protected:
-    bool eventFilter(QObject *obj, QEvent *event);
-    void mouseMoveEvent(QMouseEvent *e);
-    void mousePressEvent(QMouseEvent *e);
-    void mouseReleaseEvent(QMouseEvent *);
-    void mouseDoubleClickEvent(QMouseEvent *e);
-
-private slots:
-    void on_btnMenu_Close_clicked();
-
-    void on_btnMenu_Max_clicked();
-
-    void on_btnMenu_Min_clicked();
-
-private:
-    Ui::CustomTitle *ui;
-
-    QPoint mousePoint;
-    bool mousePressed;
-    bool max;
-    QRect location;
-
-    QDialog *dialog;
-
-    void InitStyle();
-
-};
-
-#endif // CUSTOMTITLE_H

+ 0 - 297
src/CustomTitleWidget/customtitle.ui

@@ -1,297 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>CustomTitle</class>
- <widget class="QDialog" name="CustomTitle">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>642</width>
-    <height>466</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>frmMain</string>
-  </property>
-  <property name="styleSheet">
-   <string notr="true"/>
-  </property>
-  <property name="sizeGripEnabled">
-   <bool>true</bool>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <property name="margin">
-    <number>0</number>
-   </property>
-   <item>
-    <widget class="QWidget" name="widget_frame" native="true">
-     <property name="styleSheet">
-      <string notr="true">QWidget#widget_frame
-{
-background-color: rgba(0, 0, 0, 30);
-}</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="margin">
-       <number>3</number>
-      </property>
-      <item>
-       <widget class="QWidget" name="widget_back" native="true">
-        <property name="styleSheet">
-         <string notr="true"/>
-        </property>
-        <layout class="QVBoxLayout" name="verticalLayout_4">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="margin">
-          <number>1</number>
-         </property>
-         <item>
-          <widget class="QWidget" name="widget_title" native="true">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>100</width>
-             <height>60</height>
-            </size>
-           </property>
-           <layout class="QHBoxLayout" name="horizontalLayout_2">
-            <property name="spacing">
-             <number>0</number>
-            </property>
-            <property name="margin">
-             <number>0</number>
-            </property>
-            <item>
-             <widget class="QLabel" name="lab_Ico">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="minimumSize">
-               <size>
-                <width>60</width>
-                <height>60</height>
-               </size>
-              </property>
-              <property name="text">
-               <string/>
-              </property>
-              <property name="alignment">
-               <set>Qt::AlignCenter</set>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QLabel" name="lab_Title">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="styleSheet">
-               <string notr="true">font: 10pt &quot;微软雅黑&quot;;
-font-size:20px;
-font-weight:bold;</string>
-              </property>
-              <property name="text">
-               <string>我的播放器</string>
-              </property>
-              <property name="alignment">
-               <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-              </property>
-             </widget>
-            </item>
-            <item>
-             <widget class="QWidget" name="widget_menu" native="true">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-                <horstretch>0</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <layout class="QHBoxLayout" name="horizontalLayout">
-               <property name="spacing">
-                <number>0</number>
-               </property>
-               <property name="margin">
-                <number>0</number>
-               </property>
-               <item>
-                <widget class="QPushButton" name="btnMenu">
-                 <property name="sizePolicy">
-                  <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-                   <horstretch>0</horstretch>
-                   <verstretch>0</verstretch>
-                  </sizepolicy>
-                 </property>
-                 <property name="minimumSize">
-                  <size>
-                   <width>31</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="cursor">
-                  <cursorShape>ArrowCursor</cursorShape>
-                 </property>
-                 <property name="focusPolicy">
-                  <enum>Qt::NoFocus</enum>
-                 </property>
-                 <property name="toolTip">
-                  <string>菜单</string>
-                 </property>
-                 <property name="text">
-                  <string/>
-                 </property>
-                 <property name="flat">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QPushButton" name="btnMenu_Min">
-                 <property name="sizePolicy">
-                  <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-                   <horstretch>0</horstretch>
-                   <verstretch>0</verstretch>
-                  </sizepolicy>
-                 </property>
-                 <property name="minimumSize">
-                  <size>
-                   <width>31</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="cursor">
-                  <cursorShape>ArrowCursor</cursorShape>
-                 </property>
-                 <property name="focusPolicy">
-                  <enum>Qt::NoFocus</enum>
-                 </property>
-                 <property name="toolTip">
-                  <string>最小化</string>
-                 </property>
-                 <property name="text">
-                  <string/>
-                 </property>
-                 <property name="flat">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QPushButton" name="btnMenu_Max">
-                 <property name="sizePolicy">
-                  <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-                   <horstretch>0</horstretch>
-                   <verstretch>0</verstretch>
-                  </sizepolicy>
-                 </property>
-                 <property name="minimumSize">
-                  <size>
-                   <width>31</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="cursor">
-                  <cursorShape>ArrowCursor</cursorShape>
-                 </property>
-                 <property name="focusPolicy">
-                  <enum>Qt::NoFocus</enum>
-                 </property>
-                 <property name="toolTip">
-                  <string>最大化</string>
-                 </property>
-                 <property name="text">
-                  <string/>
-                 </property>
-                 <property name="flat">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-               <item>
-                <widget class="QPushButton" name="btnMenu_Close">
-                 <property name="sizePolicy">
-                  <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-                   <horstretch>0</horstretch>
-                   <verstretch>0</verstretch>
-                  </sizepolicy>
-                 </property>
-                 <property name="minimumSize">
-                  <size>
-                   <width>40</width>
-                   <height>0</height>
-                  </size>
-                 </property>
-                 <property name="cursor">
-                  <cursorShape>ArrowCursor</cursorShape>
-                 </property>
-                 <property name="focusPolicy">
-                  <enum>Qt::NoFocus</enum>
-                 </property>
-                 <property name="toolTip">
-                  <string>关闭</string>
-                 </property>
-                 <property name="text">
-                  <string/>
-                 </property>
-                 <property name="flat">
-                  <bool>true</bool>
-                 </property>
-                </widget>
-               </item>
-              </layout>
-             </widget>
-            </item>
-           </layout>
-          </widget>
-         </item>
-         <item>
-          <widget class="QWidget" name="widget" native="true">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <layout class="QVBoxLayout" name="verticalLayout_3">
-            <property name="spacing">
-             <number>0</number>
-            </property>
-            <property name="margin">
-             <number>0</number>
-            </property>
-            <item>
-             <layout class="QVBoxLayout" name="verticalLayout_content"/>
-            </item>
-           </layout>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>

+ 0 - 113
src/CustomTitleWidget/frmmain.cpp

@@ -1,113 +0,0 @@
-#include "frmmain.h"
-#include "ui_frmmain.h"
-#include "iconhelper.h"
-#include "myhelper.h"
-
-frmMain::frmMain(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::frmMain)
-{
-    ui->setupUi(this);
-
-    myHelper::FormInCenter(this);
-    this->InitStyle();
-}
-
-frmMain::~frmMain()
-{
-    delete ui;
-}
-
-void frmMain::InitStyle()
-{
-    //设置窗体标题栏隐藏
-    this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
-    location = this->geometry();
-    max = false;
-    mousePressed = false;
-
-    //安装事件监听器,让标题栏识别鼠标双击
-    ui->lab_Title->installEventFilter(this);
-
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Min, QChar(0xf068), 10);
-    IconHelper::Instance()->SetIcon(ui->btnMenu, QChar(0xf0c9), 10);
-    IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
-}
-
-bool frmMain::eventFilter(QObject *obj, QEvent *event)
-{
-    if (event->type() == QEvent::MouseButtonDblClick) {
-        this->on_btnMenu_Max_clicked();
-        return true;
-    }
-    return QObject::eventFilter(obj, event);
-}
-
-void frmMain::mouseMoveEvent(QMouseEvent *e)
-{
-    if (mousePressed && (e->buttons() && Qt::LeftButton) && !max) {
-        this->move(e->globalPos() - mousePoint);
-        e->accept();
-    }
-}
-
-void frmMain::mousePressEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::LeftButton) {
-        mousePressed = true;
-        mousePoint = e->globalPos() - this->pos();
-        e->accept();
-    }
-}
-
-void frmMain::mouseReleaseEvent(QMouseEvent *)
-{
-    mousePressed = false;
-}
-
-void frmMain::on_btnMenu_Close_clicked()
-{
-    qApp->exit();
-}
-
-void frmMain::on_btnMenu_Max_clicked()
-{
-    if (max) {
-        this->setGeometry(location);
-        IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
-        ui->btnMenu_Max->setToolTip("最大化");
-    } else {
-        location = this->geometry();
-        this->setGeometry(qApp->desktop()->availableGeometry());
-        IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf079), 10);
-        ui->btnMenu_Max->setToolTip("还原");
-    }
-    max = !max;
-}
-
-void frmMain::on_btnMenu_Min_clicked()
-{
-    this->showMinimized();
-}
-
-void frmMain::on_pushButton_clicked()
-{
-    myHelper::ShowMessageBoxInfo("恭喜你获得我公司送出的1000万元大礼一份!");
-}
-
-void frmMain::on_pushButton_2_clicked()
-{
-    int result = myHelper::ShowMessageBoxQuesion("确定真的不要我了吗?");
-    if (result == 1) {
-        myHelper::ShowMessageBoxInfo("你好狠心啊!");
-    } else {
-        myHelper::ShowMessageBoxInfo("亲爱的,我就知道你不会离开我的!");
-    }
-}
-
-void frmMain::on_pushButton_3_clicked()
-{
-    myHelper::ShowMessageBoxError("天空飘来五个字!");
-}

+ 0 - 49
src/CustomTitleWidget/frmmain.h

@@ -1,49 +0,0 @@
-#ifndef FRMMAIN_H
-#define FRMMAIN_H
-
-#include <QDialog>
-
-namespace Ui {
-class frmMain;
-}
-
-class frmMain : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit frmMain(QWidget *parent = 0);
-    ~frmMain();
-
-protected:
-    bool eventFilter(QObject *obj, QEvent *event);
-    void mouseMoveEvent(QMouseEvent *e);
-    void mousePressEvent(QMouseEvent *e);
-    void mouseReleaseEvent(QMouseEvent *);
-
-private slots:
-    void on_btnMenu_Close_clicked();
-
-    void on_btnMenu_Max_clicked();
-
-    void on_btnMenu_Min_clicked();
-
-    void on_pushButton_clicked();
-
-    void on_pushButton_2_clicked();
-
-    void on_pushButton_3_clicked();
-
-private:
-    Ui::frmMain *ui;
-
-    QPoint mousePoint;
-    bool mousePressed;
-    bool max;
-    QRect location;
-
-    void InitStyle();
-
-};
-
-#endif // FRMMAIN_H

+ 0 - 508
src/CustomTitleWidget/frmmain.ui

@@ -1,508 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>frmMain</class>
- <widget class="QDialog" name="frmMain">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>656</width>
-    <height>527</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>frmMain</string>
-  </property>
-  <property name="sizeGripEnabled">
-   <bool>true</bool>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <property name="margin">
-    <number>0</number>
-   </property>
-   <item>
-    <widget class="QWidget" name="widget_title" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>100</width>
-       <height>33</height>
-      </size>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="margin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QLabel" name="lab_Ico">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="minimumSize">
-         <size>
-          <width>30</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="lab_Title">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="styleSheet">
-         <string notr="true">font: 10pt &quot;微软雅黑&quot;;</string>
-        </property>
-        <property name="text">
-         <string>自定义UI演示(作者:刘典武 QQ:517216493)</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widget_menu" native="true">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="margin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QPushButton" name="btnMenu">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>31</width>
-             <height>0</height>
-            </size>
-           </property>
-           <property name="cursor">
-            <cursorShape>ArrowCursor</cursorShape>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>菜单</string>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="flat">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnMenu_Min">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>31</width>
-             <height>0</height>
-            </size>
-           </property>
-           <property name="cursor">
-            <cursorShape>ArrowCursor</cursorShape>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>最小化</string>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="flat">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnMenu_Max">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>31</width>
-             <height>0</height>
-            </size>
-           </property>
-           <property name="cursor">
-            <cursorShape>ArrowCursor</cursorShape>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>最大化</string>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="flat">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="btnMenu_Close">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>40</width>
-             <height>0</height>
-            </size>
-           </property>
-           <property name="cursor">
-            <cursorShape>ArrowCursor</cursorShape>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>关闭</string>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="flat">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QWidget" name="widget_main" native="true">
-     <property name="styleSheet">
-      <string notr="true">font: 10pt &quot;微软雅黑&quot;;</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_3">
-        <item>
-         <widget class="QLineEdit" name="lineEdit">
-          <property name="text">
-           <string>今天天气不错</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton">
-          <property name="minimumSize">
-           <size>
-            <width>100</width>
-            <height>0</height>
-           </size>
-          </property>
-          <property name="text">
-           <string>信息框</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_2">
-          <property name="minimumSize">
-           <size>
-            <width>100</width>
-            <height>0</height>
-           </size>
-          </property>
-          <property name="text">
-           <string>询问框</string>
-          </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QPushButton" name="pushButton_3">
-          <property name="minimumSize">
-           <size>
-            <width>100</width>
-            <height>0</height>
-           </size>
-          </property>
-          <property name="text">
-           <string>错误框</string>
-          </property>
-         </widget>
-        </item>
-       </layout>
-      </item>
-      <item>
-       <widget class="QGroupBox" name="groupBox">
-        <property name="title">
-         <string/>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout_4">
-         <item>
-          <widget class="QRadioButton" name="radioButton">
-           <property name="text">
-            <string>男</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QRadioButton" name="radioButton_2">
-           <property name="text">
-            <string>女</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="checkBox">
-           <property name="text">
-            <string>中国</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="checkBox_2">
-           <property name="text">
-            <string>美国</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QComboBox" name="comboBox">
-           <item>
-            <property name="text">
-             <string>测试项目1</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>测试项目2</string>
-            </property>
-           </item>
-           <item>
-            <property name="text">
-             <string>测试项目3</string>
-            </property>
-           </item>
-          </widget>
-         </item>
-         <item>
-          <widget class="QDateEdit" name="dateEdit">
-           <property name="calendarPopup">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item>
-       <widget class="QTabWidget" name="tabWidget">
-        <property name="currentIndex">
-         <number>0</number>
-        </property>
-        <widget class="QWidget" name="tab">
-         <attribute name="title">
-          <string>选项卡1</string>
-         </attribute>
-         <layout class="QVBoxLayout" name="verticalLayout_3">
-          <item>
-           <widget class="QTreeWidget" name="treeWidget">
-            <column>
-             <property name="text">
-              <string>学号</string>
-             </property>
-            </column>
-            <column>
-             <property name="text">
-              <string>成绩</string>
-             </property>
-            </column>
-            <item>
-             <property name="text">
-              <string>061104023</string>
-             </property>
-             <property name="text">
-              <string>105</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>061104056</string>
-             </property>
-             <property name="text">
-              <string>245</string>
-             </property>
-            </item>
-            <item>
-             <property name="text">
-              <string>061104065</string>
-             </property>
-             <property name="text">
-              <string>265</string>
-             </property>
-            </item>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-        <widget class="QWidget" name="tab_2">
-         <attribute name="title">
-          <string>选项卡2</string>
-         </attribute>
-         <layout class="QVBoxLayout" name="verticalLayout_4">
-          <item>
-           <widget class="QTableWidget" name="tableWidget">
-            <property name="selectionBehavior">
-             <enum>QAbstractItemView::SelectRows</enum>
-            </property>
-            <row>
-             <property name="text">
-              <string>1</string>
-             </property>
-            </row>
-            <row>
-             <property name="text">
-              <string>2</string>
-             </property>
-            </row>
-            <row>
-             <property name="text">
-              <string>3</string>
-             </property>
-            </row>
-            <column>
-             <property name="text">
-              <string>学号</string>
-             </property>
-            </column>
-            <column>
-             <property name="text">
-              <string>成绩</string>
-             </property>
-            </column>
-            <item row="0" column="0">
-             <property name="text">
-              <string>061104023</string>
-             </property>
-            </item>
-            <item row="0" column="1">
-             <property name="text">
-              <string>105</string>
-             </property>
-            </item>
-            <item row="1" column="0">
-             <property name="text">
-              <string>061104025</string>
-             </property>
-            </item>
-            <item row="1" column="1">
-             <property name="text">
-              <string>108</string>
-             </property>
-            </item>
-            <item row="2" column="0">
-             <property name="text">
-              <string>061104056</string>
-             </property>
-            </item>
-            <item row="2" column="1">
-             <property name="text">
-              <string>235</string>
-             </property>
-            </item>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </widget>
-      </item>
-      <item>
-       <widget class="QProgressBar" name="progressBar">
-        <property name="value">
-         <number>24</number>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QSlider" name="horizontalSlider">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QScrollBar" name="horizontalScrollBar">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <resources/>
- <connections/>
-</ui>

+ 0 - 77
src/CustomTitleWidget/frmmessagebox.cpp

@@ -1,77 +0,0 @@
-#include "frmmessagebox.h"
-#include "ui_frmmessagebox.h"
-#include "iconhelper.h"
-#include "myhelper.h"
-
-frmMessageBox::frmMessageBox(QWidget *parent) :
-    QDialog(parent),
-    ui(new Ui::frmMessageBox)
-{
-    ui->setupUi(this);
-
-    this->mousePressed = false;
-    //设置窗体标题栏隐藏
-    this->setWindowFlags(Qt::FramelessWindowHint);
-    //设置窗体关闭时自动释放内存
-    this->setAttribute(Qt::WA_DeleteOnClose);
-    //设置图形字体
-    IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
-    IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
-    //关联关闭按钮
-    connect(ui->btnMenu_Close, SIGNAL(clicked()), this, SLOT(close()));
-    connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close()));
-    //窗体居中显示
-    myHelper::FormInCenter(this);
-
-}
-
-frmMessageBox::~frmMessageBox()
-{
-    delete ui;
-}
-
-void frmMessageBox::SetMessage(const QString &msg, int type)
-{
-    if (type == 0) {
-        ui->labIcoMain->setStyleSheet("border-image: url(:/image/info.png);");
-        ui->btnCancel->setVisible(false);
-        ui->lab_Title->setText("提示");
-    } else if (type == 1) {
-        ui->labIcoMain->setStyleSheet("border-image: url(:/image/question.png);");
-        ui->lab_Title->setText("询问");
-    } else if (type == 2) {
-        ui->labIcoMain->setStyleSheet("border-image: url(:/image/error.png);");
-        ui->btnCancel->setVisible(false);
-        ui->lab_Title->setText("错误");
-    }
-
-    ui->labInfo->setText(msg);
-}
-
-void frmMessageBox::on_btnOk_clicked()
-{
-    done(1);
-    this->close();
-}
-
-void frmMessageBox::mouseMoveEvent(QMouseEvent *e)
-{
-    if (mousePressed && (e->buttons() && Qt::LeftButton)) {
-        this->move(e->globalPos() - mousePoint);
-        e->accept();
-    }
-}
-
-void frmMessageBox::mousePressEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::LeftButton) {
-        mousePressed = true;
-        mousePoint = e->globalPos() - this->pos();
-        e->accept();
-    }
-}
-
-void frmMessageBox::mouseReleaseEvent(QMouseEvent *)
-{
-    mousePressed = false;
-}

+ 0 - 35
src/CustomTitleWidget/frmmessagebox.h

@@ -1,35 +0,0 @@
-#ifndef FRMMESSAGEBOX_H
-#define FRMMESSAGEBOX_H
-
-#include <QDialog>
-
-namespace Ui {
-class frmMessageBox;
-}
-
-class frmMessageBox : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit frmMessageBox(QWidget *parent = 0);
-    ~frmMessageBox();
-
-    void SetMessage(const QString &msg, int type);
-
-protected:
-    void mouseMoveEvent(QMouseEvent *e);
-    void mousePressEvent(QMouseEvent *e);
-    void mouseReleaseEvent(QMouseEvent *);
-
-private slots:
-    void on_btnOk_clicked();
-
-private:
-    Ui::frmMessageBox *ui;
-
-    QPoint mousePoint;              //鼠标拖动自定义标题栏时的坐标
-    bool mousePressed;              //鼠标是否按下
-};
-
-#endif // FRMMESSAGEBOX_H

+ 0 - 275
src/CustomTitleWidget/frmmessagebox.ui

@@ -1,275 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>frmMessageBox</class>
- <widget class="QDialog" name="frmMessageBox">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>303</width>
-    <height>143</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>提示</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <property name="spacing">
-    <number>0</number>
-   </property>
-   <property name="margin">
-    <number>0</number>
-   </property>
-   <item>
-    <widget class="QWidget" name="widget_title" native="true">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize">
-      <size>
-       <width>100</width>
-       <height>28</height>
-      </size>
-     </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_2">
-      <property name="spacing">
-       <number>0</number>
-      </property>
-      <property name="margin">
-       <number>0</number>
-      </property>
-      <item>
-       <widget class="QLabel" name="lab_Ico">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="minimumSize">
-         <size>
-          <width>31</width>
-          <height>0</height>
-         </size>
-        </property>
-        <property name="text">
-         <string/>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QLabel" name="lab_Title">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="styleSheet">
-         <string notr="true">font: 10pt &quot;微软雅黑&quot;;</string>
-        </property>
-        <property name="text">
-         <string>提示</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item>
-       <widget class="QWidget" name="widget_menu" native="true">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <property name="spacing">
-          <number>0</number>
-         </property>
-         <property name="margin">
-          <number>0</number>
-         </property>
-         <item>
-          <widget class="QPushButton" name="btnMenu_Close">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Minimum" vsizetype="Expanding">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
-           <property name="minimumSize">
-            <size>
-             <width>40</width>
-             <height>0</height>
-            </size>
-           </property>
-           <property name="cursor">
-            <cursorShape>ArrowCursor</cursorShape>
-           </property>
-           <property name="focusPolicy">
-            <enum>Qt::NoFocus</enum>
-           </property>
-           <property name="toolTip">
-            <string>关闭</string>
-           </property>
-           <property name="text">
-            <string/>
-           </property>
-           <property name="flat">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-   <item>
-    <widget class="QWidget" name="widget_main" native="true">
-     <property name="styleSheet">
-      <string notr="true">font: 11pt &quot;微软雅黑&quot;;</string>
-     </property>
-     <layout class="QVBoxLayout" name="verticalLayout_2">
-      <property name="spacing">
-       <number>5</number>
-      </property>
-      <property name="margin">
-       <number>5</number>
-      </property>
-      <item>
-       <widget class="QGroupBox" name="groupBox">
-        <property name="title">
-         <string/>
-        </property>
-        <widget class="QLabel" name="labIcoMain">
-         <property name="geometry">
-          <rect>
-           <x>10</x>
-           <y>10</y>
-           <width>45</width>
-           <height>45</height>
-          </rect>
-         </property>
-         <property name="styleSheet">
-          <string notr="true">border-image: url(:/image/question.png);</string>
-         </property>
-         <property name="text">
-          <string/>
-         </property>
-        </widget>
-        <widget class="QLabel" name="labInfo">
-         <property name="geometry">
-          <rect>
-           <x>70</x>
-           <y>10</y>
-           <width>211</width>
-           <height>41</height>
-          </rect>
-         </property>
-         <property name="text">
-          <string>确定要删除吗?</string>
-         </property>
-         <property name="scaledContents">
-          <bool>false</bool>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-        <widget class="QWidget" name="layoutWidget">
-         <property name="geometry">
-          <rect>
-           <x>10</x>
-           <y>60</y>
-           <width>271</width>
-           <height>34</height>
-          </rect>
-         </property>
-         <layout class="QHBoxLayout" name="horizontalLayout_3">
-          <item>
-           <spacer name="horizontalSpacer">
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>40</width>
-              <height>20</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-          <item>
-           <widget class="QPushButton" name="btnOk">
-            <property name="cursor">
-             <cursorShape>PointingHandCursor</cursorShape>
-            </property>
-            <property name="focusPolicy">
-             <enum>Qt::StrongFocus</enum>
-            </property>
-            <property name="styleSheet">
-             <string notr="true"/>
-            </property>
-            <property name="text">
-             <string>确定(&amp;O)</string>
-            </property>
-            <property name="icon">
-             <iconset>
-              <normaloff>:/image/update.png</normaloff>:/image/update.png</iconset>
-            </property>
-            <property name="iconSize">
-             <size>
-              <width>20</width>
-              <height>20</height>
-             </size>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QPushButton" name="btnCancel">
-            <property name="cursor">
-             <cursorShape>PointingHandCursor</cursorShape>
-            </property>
-            <property name="focusPolicy">
-             <enum>Qt::StrongFocus</enum>
-            </property>
-            <property name="styleSheet">
-             <string notr="true"/>
-            </property>
-            <property name="text">
-             <string>取消(&amp;C)</string>
-            </property>
-            <property name="icon">
-             <iconset>
-              <normaloff>:/image/close.png</normaloff>:/image/close.png</iconset>
-            </property>
-            <property name="iconSize">
-             <size>
-              <width>20</width>
-              <height>20</height>
-             </size>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </widget>
-       </widget>
-      </item>
-     </layout>
-    </widget>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 0 - 24
src/CustomTitleWidget/iconhelper.cpp

@@ -1,24 +0,0 @@
-#include "iconhelper.h"
-
-IconHelper* IconHelper::_instance = 0;
-IconHelper::IconHelper(QObject*):
-    QObject(qApp)
-{
-    int fontId = QFontDatabase::addApplicationFont(":/image/fontawesome-webfont.ttf");
-    QString fontName = QFontDatabase::applicationFontFamilies(fontId).at(0);
-    iconFont = QFont(fontName);
-}
-
-void IconHelper::SetIcon(QLabel* lab, QChar c, int size)
-{
-    iconFont.setPointSize(size);
-    lab->setFont(iconFont);
-    lab->setText(c);
-}
-
-void IconHelper::SetIcon(QPushButton* btn, QChar c, int size)
-{
-    iconFont.setPointSize(size);
-    btn->setFont(iconFont);
-    btn->setText(c);
-}

+ 0 - 37
src/CustomTitleWidget/iconhelper.h

@@ -1,37 +0,0 @@
-#ifndef ICONHELPER_H
-#define ICONHELPER_H
-
-#include <QObject>
-#include <QFont>
-#include <QFontDatabase>
-#include <QMutex>
-#include <QLabel>
-#include <QPushButton>
-#include <QApplication>
-
-class IconHelper : public QObject
-{
-private:
-    explicit IconHelper(QObject *parent = 0);
-    QFont iconFont;
-    static IconHelper* _instance;
-
-public:
-    static IconHelper* Instance()
-    {
-        static QMutex mutex;
-        if (!_instance) {
-            QMutexLocker locker(&mutex);
-            if (!_instance) {
-                _instance = new IconHelper;
-            }
-        }
-        return _instance;
-    }
-
-    void SetIcon(QLabel* lab, QChar c, int size = 10);
-    void SetIcon(QPushButton* btn, QChar c, int size = 10);
-
-};
-
-#endif // ICONHELPER_H

BIN
src/CustomTitleWidget/image/add-line_horizontal.png


BIN
src/CustomTitleWidget/image/add-line_vertical.png


BIN
src/CustomTitleWidget/image/array_down.png


+ 0 - 354
src/CustomTitleWidget/image/black.css

@@ -1,354 +0,0 @@
-QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#CustomTitle,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
-	border:1px solid #4D4D4D;
-	border-radius:0px;	
-}
-
-.QFrame{
-	border:1px solid #636363;
-	border-radius:5px;
-}
-/*
-QWidget#widget_title{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
-}*/
-
-QWidget#widget_title{
-        background-color:rgb(60, 65, 68);
-}
-
-QLabel#lab_Ico,QLabel#lab_Title{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-/*
-QLineEdit {
-	border: 1px solid #636363;
-	border-radius: 5px;
-	padding: 2px;
-	background: none;
-	selection-background-color: #4D4D4D;
-}
-
-QLineEdit[echoMode="2"] { 
-	lineedit-password-character: 9679; 
-}*/
-
-.QGroupBox{
-	border: 1px solid #636363;
-	border-radius: 5px;
-}
-
-/*
-.QPushButton{
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 5px;	
-	min-height: 20px;
-	border-radius:5px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-.QPushButton[focusPolicy="0"] {
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 0px;	
-	min-height: 10px;
-	border-radius:3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-.QPushButton:hover{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
-}
-
-.QPushButton:pressed{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929);
-}
-*/
-
-QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #636363);
-}
-
-QPushButton#btnMenu_Close:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
-}
-
-QCheckBox {
-	spacing: 2px; 
-}
-
-QCheckBox::indicator {
-	width: 20px;
-	height: 20px;
-}
-
-QCheckBox::indicator:unchecked {
-	image: url(:/image/checkbox_unchecked.png);
-}
-
-QCheckBox::indicator:checked {
-	image: url(:/image/checkbox_checked.png); 
-}
-
-QRadioButton {
-	spacing: 2px;
-}
-
-QRadioButton::indicator {
-	width: 15px; 
-	height: 15px; 
-}
-
-QRadioButton::indicator::unchecked {
-	image: url(:/image/radio_normal.png); 
-}
-
-QRadioButton::indicator::checked {
-	image: url(:/image/radio_selected.png); 
-}
-/*
-QComboBox,QDateEdit{
-	border-radius: 3px;
-	padding: 1px 10px 1px 5px;
-	border: 1px solid #636363;
-}
-
-QComboBox::drop-down,QDateEdit::drop-down {
-	subcontrol-origin: padding;
-	subcontrol-position: top right;
-	width: 15px; 
-	border-left-width: 1px;
-	border-left-style: solid;
-	border-top-right-radius: 3px;
-	border-bottom-right-radius: 3px;
-	border-left-color: #636363;
-}
-
-QComboBox::down-arrow,QDateEdit::down-arrow {
-	image: url(:/image/array_down.png); 
-}
-*/
-QMenu {
-	background-color:#F0F0F0;
-	margin: 2px;
-}
-
-QMenu::item {	
-	padding: 2px 12px 2px 12px;
-}
-
-QMenu::indicator {
-	width: 13px;
-	height: 13px;
-}
-
-QMenu::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QMenu::separator {
-	height: 1px;
-	background: #636363;
-}
-
-QProgressBar {
-	border-radius: 5px;
-	text-align: center;
-	border: 1px solid #636363;
-}
-
-QProgressBar::chunk {
-	width: 5px; 
-	margin: 0.5px;
-	background-color: #4D4D4D;
-}
-
-QSlider::groove:horizontal,QSlider::add-page:horizontal { 
-	background: #808080; 
-	height: 8px; 
-	border-radius: 3px; 
-}
-
-QSlider::sub-page:horizontal {
-	height: 8px; 
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QSlider::handle:horizontal {
-	width: 13px; 
-	margin-top: -3px; 
-	margin-bottom: -3px; 
-	border-radius: 6px;
-	background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #636363);
-}
-
-QSlider::handle:horizontal:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #4D4D4D);
-}
-
-QSlider::groove:vertical,QSlider::sub-page:vertical {
-	background:#808080; 
-	width: 8px; 
-	border-radius: 3px;
-}
-
-QSlider::add-page:vertical {
-	width: 8px;
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QSlider::handle:vertical {
-	height: 14px; 
-	margin-left: -3px;
-	margin-right: -3px;
-	border-radius: 6px;
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #636363);
-}
-
-QSlider::handle:vertical:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #4D4D4D);
-}
-
-QScrollBar:vertical {
-	width:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-top:10px; 
-	padding-bottom:10px;
-}
-
-QScrollBar:horizontal {
-	height:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-left:10px; padding-right:10px;
-}
-
-QScrollBar::handle:vertical {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757); 
-}
-
-QScrollBar::handle:horizontal {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757); 
-}
-
-QScrollBar::handle:vertical:hover {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QScrollBar::handle:horizontal:hover {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QScrollBar::add-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: bottom; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_vertical.png);
-}
-
-QScrollBar::add-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: right;
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_horizontal.png);
-}
-
-QScrollBar::sub-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: top; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_vertical.png);
-}
-
-QScrollBar::sub-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: left;
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_horizontal.png);
-}
-
-QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
-	width:10px;
-	background: #C0C0C0;
-}
-
-QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
-	height:10px;
-	background: #C0C0C0;
-}
-
-QScrollArea {
-	border: 0px ; 
-}
-
-/*
-QTreeView,QListView,QTableView{
-	border: 1px solid #636363; 
-	selection-background-color: #4D4D4D;
-	selection-color: #F0F0F0;
-}*/
-
-QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757); 
-}
-
-QTableView::item, QListView::item, QTreeView::item {
-	padding: 5px; 
-	margin: 0px; 
-}
-
-QHeaderView::section {
-	padding:3px;
-	margin:0px;
-	color:#F0F0F0;
-	border: 1px solid #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757);
-}
-
-QTabBar::tab {
-	border-bottom-left-radius:0px;
-	border-bottom-right-radius:0px;
-	color: #F0F0F0;
-	min-width: 60px;
-	min-height: 20px;
-	padding: 3px 8px 3px 8px;
-	margin:1px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #636363, stop:1 #575757); 
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4D4D4D, stop:1 #292929); 
-}
-
-QStatusBar::item {
-     border: 1px solid #636363;
-     border-radius: 3px;
-}

+ 0 - 350
src/CustomTitleWidget/image/blue.css

@@ -1,350 +0,0 @@
-QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
-	border:1px solid #1B89CA;
-	border-radius:0px;	
-}
-
-.QFrame{
-	border:1px solid #5CACEE;
-	border-radius:5px;
-}
-
-QWidget#widget_title{
-/*	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);*/
-    background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgb(26,171,218), stop:1 rgb(41,174,218));
-}
-
-QLabel#lab_Ico,QLabel#lab_Title{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QLineEdit {
-	border: 1px solid #5CACEE;
-        border-radius: 2px;
-	padding: 2px;
-	background: none;
-	selection-background-color: #1B89CA;
-}
-
-QLineEdit[echoMode="2"] { 
-	lineedit-password-character: 9679; 
-}
-
-.QGroupBox{
-	border: 1px solid #5CACEE;
-	border-radius: 5px;
-}
-
-.QPushButton{
-        border-style: none;
-        border: 0px;
-        color: #F0F0F0;
-/*	padding: 5px;	*/
-/*        min-height: 20px;*/
-        border-radius:5px;
-        background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
-}
-
-.QPushButton[focusPolicy="0"] {
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 0px;	
-	min-height: 10px;
-	border-radius:3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-.QPushButton:hover{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
-}
-
-.QPushButton:pressed{
-        background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
-}
-
-QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #5CACEE);
-}
-
-QPushButton#btnMenu_Close:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
-}
-
-QCheckBox {
-	spacing: 2px; 
-}
-
-QCheckBox::indicator {
-	width: 20px;
-	height: 20px;
-}
-
-QCheckBox::indicator:unchecked {
-	image: url(:/image/checkbox_unchecked.png);
-}
-
-QCheckBox::indicator:checked {
-	image: url(:/image/checkbox_checked.png); 
-}
-
-QRadioButton {
-	spacing: 2px;
-}
-
-QRadioButton::indicator {
-	width: 15px; 
-	height: 15px; 
-}
-
-QRadioButton::indicator::unchecked {
-	image: url(:/image/radio_normal.png); 
-}
-
-QRadioButton::indicator::checked {
-	image: url(:/image/radio_selected.png); 
-}
-
-QComboBox,QDateEdit{
-	border-radius: 3px;
-	padding: 1px 10px 1px 5px;
-	border: 1px solid #5CACEE;
-}
-
-QComboBox::drop-down,QDateEdit::drop-down {
-	subcontrol-origin: padding;
-	subcontrol-position: top right;
-	width: 15px; 
-	border-left-width: 1px;
-	border-left-style: solid;
-	border-top-right-radius: 3px;
-	border-bottom-right-radius: 3px;
-	border-left-color: #5CACEE;
-}
-
-QComboBox::down-arrow,QDateEdit::down-arrow {
-	image: url(:/image/array_down.png); 
-}
-
-/*QMenu {
-	background-color:#F0F0F0;
-	margin: 2px;
-}
-
-QMenu::item {	
-	padding: 2px 12px 2px 12px;
-}
-
-QMenu::indicator {
-	width: 13px;
-	height: 13px;
-}
-
-QMenu::item:selected {
-	color: #FFFFFF;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QMenu::separator {
-	height: 1px;
-	background: #5CACEE;
-}*/
-
-QProgressBar {
-	border-radius: 5px;
-	text-align: center;
-	border: 1px solid #5CACEE;
-}
-
-QProgressBar::chunk {
-	width: 5px; 
-	margin: 0.5px;
-	background-color: #1B89CA;
-}
-
-QSlider::groove:horizontal,QSlider::add-page:horizontal { 
-	background: #808080; 
-	height: 8px; 
-	border-radius: 3px; 
-}
-
-QSlider::sub-page:horizontal {
-	height: 8px; 
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QSlider::handle:horizontal {
-	width: 13px; 
-	margin-top: -3px; 
-	margin-bottom: -3px; 
-	border-radius: 6px;
-	background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #5CACEE);
-}
-
-QSlider::handle:horizontal:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #1B89CA);
-}
-
-QSlider::groove:vertical,QSlider::sub-page:vertical {
-	background:#808080; 
-	width: 8px; 
-	border-radius: 3px;
-}
-
-QSlider::add-page:vertical {
-	width: 8px;
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QSlider::handle:vertical {
-	height: 14px; 
-	margin-left: -3px;
-	margin-right: -3px;
-	border-radius: 6px;
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #5CACEE);
-}
-
-QSlider::handle:vertical:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #1B89CA);
-}
-
-QScrollBar:vertical {
-	width:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-top:10px; 
-	padding-bottom:10px;
-}
-
-QScrollBar:horizontal {
-	height:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-left:10px; padding-right:10px;
-}
-
-QScrollBar::handle:vertical {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD); 
-}
-
-QScrollBar::handle:horizontal {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD); 
-}
-
-QScrollBar::handle:vertical:hover {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QScrollBar::handle:horizontal:hover {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QScrollBar::add-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: bottom; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_vertical.png);
-}
-
-QScrollBar::add-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: right;
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_horizontal.png);
-}
-
-QScrollBar::sub-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: top; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_vertical.png);
-}
-
-QScrollBar::sub-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: left;
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_horizontal.png);
-}
-
-QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
-	width:10px;
-	background: #C0C0C0;
-}
-
-QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
-	height:10px;
-	background: #C0C0C0;
-}
-
-QScrollArea {
-	border: 0px ; 
-}
-
-QTreeView,QListView,QTableView{
-	border: 1px solid #5CACEE; 
-	selection-background-color: #1B89CA;
-	selection-color: #F0F0F0;
-}
-
-QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
-/*	color: #F0F0F0;*/
-        background-color: rgb(219,240,255);
-        background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5);
-}
-
-QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
-/*	color: #F0F0F0;*/
-        background-color: rgb(240,249,255);
-        background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
-}
-
-QTableView::item, QListView::item, QTreeView::item {
-/*	padding: 5px; */
-	margin: 0px; 
-}
-
-QHeaderView::section {
-	padding:3px;
-	margin:0px;
-	color:#F0F0F0;
-	border: 1px solid #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD);
-}
-
-QTabBar::tab {
-	border-bottom-left-radius:0px;
-	border-bottom-right-radius:0px;
-	color: #F0F0F0;
-	min-width: 60px;
-	min-height: 20px;
-	padding: 3px 8px 3px 8px;
-	margin:1px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #5CACEE, stop:1 #4F94CD); 
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #1B89CA, stop:1 #1077B5); 
-}
-
-QStatusBar::item {
-     border: 1px solid #5CACEE;
-     border-radius: 3px;
-}

BIN
src/CustomTitleWidget/image/checkbox_checked.png


BIN
src/CustomTitleWidget/image/checkbox_unchecked.png


BIN
src/CustomTitleWidget/image/error.png


BIN
src/CustomTitleWidget/image/fontawesome-webfont.ttf


+ 0 - 353
src/CustomTitleWidget/image/gray.css

@@ -1,353 +0,0 @@
-QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
-	border:1px solid #454648;
-	border-radius:0px;	
-}
-
-.QFrame{
-	border:1px solid #B8B8B8;
-	border-radius:5px;
-}
-
-QWidget#widget_title{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
-}
-
-QWidget#widget_back{
-        background-color: rgb(22, 22, 22);
-        border:1px solid rgba(0, 0, 0, 30);
-        border-radius:2px;
-}
-
-QLabel#lab_Ico,QLabel#lab_Title{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QLineEdit {
-	border: 1px solid #B8B8B8;
-	border-radius: 5px;
-	padding: 2px;
-	background: none;
-	selection-background-color: #454648;
-}
-
-QLineEdit[echoMode="2"] { 
-	lineedit-password-character: 9679; 
-}
-
-.QGroupBox{
-	border: 1px solid #B8B8B8;
-	border-radius: 5px;
-}
-/*
-.QPushButton{
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 5px;	
-	min-height: 20px;
-	border-radius:5px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-.QPushButton[focusPolicy="0"] {
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 0px;	
-	min-height: 10px;
-	border-radius:3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-.QPushButton:hover{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
-}
-
-.QPushButton:pressed{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A);
-}*/
-
-QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #B8B8B8);
-}
-
-QPushButton#btnMenu_Close:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
-}
-
-QCheckBox {
-	spacing: 2px; 
-}
-
-QCheckBox::indicator {
-	width: 20px;
-	height: 20px;
-}
-
-QCheckBox::indicator:unchecked {
-	image: url(:/image/checkbox_unchecked.png);
-}
-
-QCheckBox::indicator:checked {
-	image: url(:/image/checkbox_checked.png); 
-}
-
-QRadioButton {
-	spacing: 2px;
-}
-
-QRadioButton::indicator {
-	width: 15px; 
-	height: 15px; 
-}
-
-QRadioButton::indicator::unchecked {
-	image: url(:/image/radio_normal.png); 
-}
-
-QRadioButton::indicator::checked {
-	image: url(:/image/radio_selected.png); 
-}
-
-QComboBox,QDateEdit{
-	border-radius: 3px;
-	padding: 1px 10px 1px 5px;
-	border: 1px solid #B8B8B8;
-}
-
-QComboBox::drop-down,QDateEdit::drop-down {
-	subcontrol-origin: padding;
-	subcontrol-position: top right;
-	width: 15px; 
-	border-left-width: 1px;
-	border-left-style: solid;
-	border-top-right-radius: 3px;
-	border-bottom-right-radius: 3px;
-	border-left-color: #B8B8B8;
-}
-
-QComboBox::down-arrow,QDateEdit::down-arrow {
-	image: url(:/image/array_down.png); 
-}
-
-QMenu {
-	background-color:#F0F0F0;
-	margin: 2px;
-}
-
-QMenu::item {	
-	padding: 2px 12px 2px 12px;
-}
-
-QMenu::indicator {
-	width: 13px;
-	height: 13px;
-}
-
-QMenu::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QMenu::separator {
-	height: 1px;
-	background: #B8B8B8;
-}
-
-QProgressBar {
-	border-radius: 5px;
-	text-align: center;
-	border: 1px solid #B8B8B8;
-}
-
-QProgressBar::chunk {
-	width: 5px; 
-	margin: 0.5px;
-	background-color: #454648;
-}
-
-QSlider::groove:horizontal,QSlider::add-page:horizontal { 
-	background: #808080; 
-	height: 8px; 
-	border-radius: 3px; 
-}
-
-QSlider::sub-page:horizontal {
-	height: 8px; 
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QSlider::handle:horizontal {
-	width: 13px; 
-	margin-top: -3px; 
-	margin-bottom: -3px; 
-	border-radius: 6px;
-	background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #B8B8B8);
-}
-
-QSlider::handle:horizontal:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #454648);
-}
-
-QSlider::groove:vertical,QSlider::sub-page:vertical {
-	background:#808080; 
-	width: 8px; 
-	border-radius: 3px;
-}
-
-QSlider::add-page:vertical {
-	width: 8px;
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QSlider::handle:vertical {
-	height: 14px; 
-	margin-left: -3px;
-	margin-right: -3px;
-	border-radius: 6px;
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #B8B8B8);
-}
-
-QSlider::handle:vertical:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #454648);
-}
-
-QScrollBar:vertical {
-	width:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-top:10px; 
-	padding-bottom:10px;
-}
-
-QScrollBar:horizontal {
-	height:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-left:10px; padding-right:10px;
-}
-
-QScrollBar::handle:vertical {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6); 
-}
-
-QScrollBar::handle:horizontal {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6); 
-}
-
-QScrollBar::handle:vertical:hover {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QScrollBar::handle:horizontal:hover {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QScrollBar::add-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: bottom; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_vertical.png);
-}
-
-QScrollBar::add-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: right;
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_horizontal.png);
-}
-
-QScrollBar::sub-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: top; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_vertical.png);
-}
-
-QScrollBar::sub-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: left;
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_horizontal.png);
-}
-
-QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
-	width:10px;
-	background: #C0C0C0;
-}
-
-QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
-	height:10px;
-	background: #C0C0C0;
-}
-
-QScrollArea {
-	border: 0px ; 
-}
-
-QTreeView,QListView,QTableView{
-	border: 1px solid #B8B8B8; 
-	selection-background-color: #454648;
-	selection-color: #F0F0F0;
-}
-
-QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6); 
-}
-
-QTableView::item, QListView::item, QTreeView::item {
-	padding: 5px; 
-	margin: 0px; 
-}
-
-QHeaderView::section {
-	padding:3px;
-	margin:0px;
-	color:#F0F0F0;
-	border: 1px solid #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6);
-}
-
-QTabBar::tab {
-	border-bottom-left-radius:0px;
-	border-bottom-right-radius:0px;
-	color: #F0F0F0;
-	min-width: 60px;
-	min-height: 20px;
-	padding: 3px 8px 3px 8px;
-	margin:1px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #B8B8B8, stop:1 #D6D6D6); 
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #454648, stop:1 #7A7A7A); 
-}
-
-QStatusBar::item {
-     border: 1px solid #B8B8B8;
-     border-radius: 3px;
-}

BIN
src/CustomTitleWidget/image/info.png


+ 0 - 347
src/CustomTitleWidget/image/navy.css

@@ -1,347 +0,0 @@
-QWidget#frmLogin,QWidget#frmPopup,QWidget#frmHostInfo,QWidget#frmLogout,QWidget#frmConfig,QWidget#frmData,QWidget#frmDefence,QWidget#frmHost,QWidget#frmMain,QWidget#frmPwd,QWidget#frmSelect,QWidget#frmMessageBox{
-	border:1px solid #0F7DBE;
-	border-radius:0px;	
-}
-
-.QFrame{
-	border:1px solid #50A3F0;
-	border-radius:5px;
-}
-
-QWidget#widget_title{
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
-}
-
-QLabel#lab_Ico,QLabel#lab_Title{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QLineEdit {
-	border: 1px solid #50A3F0;
-	border-radius: 5px;
-	padding: 2px;
-	background: none;
-	selection-background-color: #0F7DBE;
-}
-
-QLineEdit[echoMode="2"] { 
-	lineedit-password-character: 9679; 
-}
-
-.QGroupBox{
-	border: 1px solid #50A3F0;
-	border-radius: 5px;
-}
-
-.QPushButton{
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 5px;	
-	min-height: 20px;
-	border-radius:5px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-.QPushButton[focusPolicy="0"] {
-	border-style: none;
-	border: 0px;
-	color: #F0F0F0;
-	padding: 0px;	
-	min-height: 10px;
-	border-radius:3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-.QPushButton:hover{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
-}
-
-.QPushButton:pressed{ 
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3);
-}
-
-QPushButton#btnMenu,QPushButton#btnMenu_Min,QPushButton#btnMenu_Max,QPushButton#btnMenu_Close{
-	border-radius:0px;
-	color: #F0F0F0;
-	background-color:rgba(0,0,0,0);
-	border-style:none;
-}
-
-QPushButton#btnMenu:hover,QPushButton#btnMenu_Min:hover,QPushButton#btnMenu_Max:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(25, 134, 199, 0), stop:1 #50A3F0);
-}
-
-QPushButton#btnMenu_Close:hover{
-	background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(238, 0, 0, 128), stop:1 rgba(238, 44, 44, 255));
-}
-
-QCheckBox {
-	spacing: 2px; 
-}
-
-QCheckBox::indicator {
-	width: 20px;
-	height: 20px;
-}
-
-QCheckBox::indicator:unchecked {
-	image: url(:/image/checkbox_unchecked.png);
-}
-
-QCheckBox::indicator:checked {
-	image: url(:/image/checkbox_checked.png); 
-}
-
-QRadioButton {
-	spacing: 2px;
-}
-
-QRadioButton::indicator {
-	width: 15px; 
-	height: 15px; 
-}
-
-QRadioButton::indicator::unchecked {
-	image: url(:/image/radio_normal.png); 
-}
-
-QRadioButton::indicator::checked {
-	image: url(:/image/radio_selected.png); 
-}
-
-QComboBox,QDateEdit{
-	border-radius: 3px;
-	padding: 1px 10px 1px 5px;
-	border: 1px solid #50A3F0;
-}
-
-QComboBox::drop-down,QDateEdit::drop-down {
-	subcontrol-origin: padding;
-	subcontrol-position: top right;
-	width: 15px; 
-	border-left-width: 1px;
-	border-left-style: solid;
-	border-top-right-radius: 3px;
-	border-bottom-right-radius: 3px;
-	border-left-color: #50A3F0;
-}
-
-QComboBox::down-arrow,QDateEdit::down-arrow {
-	image: url(:/image/array_down.png); 
-}
-
-QMenu {
-	background-color:#F0F0F0;
-	margin: 2px;
-}
-
-QMenu::item {	
-	padding: 2px 12px 2px 12px;
-}
-
-QMenu::indicator {
-	width: 13px;
-	height: 13px;
-}
-
-QMenu::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QMenu::separator {
-	height: 1px;
-	background: #50A3F0;
-}
-
-QProgressBar {
-	border-radius: 5px;
-	text-align: center;
-	border: 1px solid #50A3F0;
-}
-
-QProgressBar::chunk {
-	width: 5px; 
-	margin: 0.5px;
-	background-color: #0F7DBE;
-}
-
-QSlider::groove:horizontal,QSlider::add-page:horizontal { 
-	background: #808080; 
-	height: 8px; 
-	border-radius: 3px; 
-}
-
-QSlider::sub-page:horizontal {
-	height: 8px; 
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QSlider::handle:horizontal {
-	width: 13px; 
-	margin-top: -3px; 
-	margin-bottom: -3px; 
-	border-radius: 6px;
-	background: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,stop:0.6 #F0F0F0, stop:0.778409 #50A3F0);
-}
-
-QSlider::handle:horizontal:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #0F7DBE);
-}
-
-QSlider::groove:vertical,QSlider::sub-page:vertical {
-	background:#808080; 
-	width: 8px; 
-	border-radius: 3px;
-}
-
-QSlider::add-page:vertical {
-	width: 8px;
-	border-radius: 3px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QSlider::handle:vertical {
-	height: 14px; 
-	margin-left: -3px;
-	margin-right: -3px;
-	border-radius: 6px;
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0, stop:0.778409 #50A3F0);
-}
-
-QSlider::handle:vertical:hover {
-	background: qradialgradient(spread: pad, cx: 0.5, cy: 0.5, radius: 0.5, fx: 0.5, fy: 0.5, stop: 0.6 #F0F0F0,stop:0.778409 #0F7DBE);
-}
-
-QScrollBar:vertical {
-	width:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-top:10px; 
-	padding-bottom:10px;
-}
-
-QScrollBar:horizontal {
-	height:10px; 
-	background-color:rgba(0,0,0,0%); 
-	padding-left:10px; padding-right:10px;
-}
-
-QScrollBar::handle:vertical {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA); 
-}
-
-QScrollBar::handle:horizontal {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA); 
-}
-
-QScrollBar::handle:vertical:hover {
-	width:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QScrollBar::handle:horizontal:hover {
-	height:10px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QScrollBar::add-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: bottom; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_vertical.png);
-}
-
-QScrollBar::add-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: right;
-	subcontrol-origin: margin;
-	border-image:url(:/image/add-line_horizontal.png);
-}
-
-QScrollBar::sub-line:vertical {
-	height:10px;
-	width:10px;
-	subcontrol-position: top; 
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_vertical.png);
-}
-
-QScrollBar::sub-line:horizontal {
-	height:10px;
-	width:10px;
-	subcontrol-position: left;
-	subcontrol-origin: margin;
-	border-image:url(:/image/sub-line_horizontal.png);
-}
-
-QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical {
-	width:10px;
-	background: #C0C0C0;
-}
-
-QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal {
-	height:10px;
-	background: #C0C0C0;
-}
-
-QScrollArea {
-	border: 0px ; 
-}
-
-QTreeView,QListView,QTableView{
-	border: 1px solid #50A3F0; 
-	selection-background-color: #0F7DBE;
-	selection-color: #F0F0F0;
-}
-
-QTableView::item:selected, QListView::item:selected, QTreeView::item:selected {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QTableView::item:hover, QListView::item:hover, QTreeView::item:hover {
-	color: #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA); 
-}
-
-QTableView::item, QListView::item, QTreeView::item {
-	padding: 5px; 
-	margin: 0px; 
-}
-
-QHeaderView::section {
-	padding:3px;
-	margin:0px;
-	color:#F0F0F0;
-	border: 1px solid #F0F0F0;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA);
-}
-
-QTabBar::tab {
-	border-bottom-left-radius:0px;
-	border-bottom-right-radius:0px;
-	color: #F0F0F0;
-	min-width: 60px;
-	min-height: 20px;
-	padding: 3px 8px 3px 8px;
-	margin:1px;
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #50A3F0, stop:1 #489CEA); 
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
-	background: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #0F7DBE, stop:1 #1582C3); 
-}
-
-QStatusBar::item {
-     border: 1px solid #50A3F0;
-     border-radius: 3px;
-}

BIN
src/CustomTitleWidget/image/qt_zh_CN.qm


BIN
src/CustomTitleWidget/image/question.png


BIN
src/CustomTitleWidget/image/radio_normal.png


BIN
src/CustomTitleWidget/image/radio_selected.png


BIN
src/CustomTitleWidget/image/sub-line_horizontal.png


BIN
src/CustomTitleWidget/image/sub-line_vertical.png


+ 0 - 121
src/CustomTitleWidget/myhelper.h

@@ -1,121 +0,0 @@
-#ifndef MYHELPER_H
-#define MYHELPER_H
-
-#include <QtCore>
-#include <QtGui>
-#include <QDesktopWidget>
-#include "frmmessagebox.h"
-
-class myHelper: public QObject
-{
-
-public:
-
-    //设置为开机启动
-    static void AutoRunWithSystem(bool IsAutoRun, QString AppName, QString AppPath)
-    {
-        QSettings *reg = new QSettings(
-            "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
-            QSettings::NativeFormat);
-
-        if (IsAutoRun) {
-            reg->setValue(AppName, AppPath);
-        } else {
-            reg->setValue(AppName, "");
-        }
-    }
-
-    //设置编码为UTF8
-    static void SetUTF8Code()
-    {
-#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
-        QTextCodec *codec = QTextCodec::codecForName("UTF-8");
-        QTextCodec::setCodecForLocale(codec);
-        QTextCodec::setCodecForCStrings(codec);
-        QTextCodec::setCodecForTr(codec);
-#endif
-    }
-
-	    //设置编码为GBK
-    static void SetGBKCode()
-    {
-#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
-        QTextCodec *codec = QTextCodec::codecForName("GBK");
-        QTextCodec::setCodecForLocale(codec);
-        QTextCodec::setCodecForCStrings(codec);
-        QTextCodec::setCodecForTr(codec);
-#endif
-    }
-
-    //设置皮肤样式
-    static void SetStyle(const QString &styleName)
-    {
-        QFile file(QString(":/image/%1.css").arg(styleName));
-        file.open(QFile::ReadOnly);
-        QString qss = QLatin1String(file.readAll());
-        qApp->setStyleSheet(qss);
-        qApp->setPalette(QPalette(QColor("#F0F0F0")));
-    }
-
-    //加载中文字符
-    static void SetChinese()
-    {
-        QTranslator *translator = new QTranslator(qApp);
-        translator->load(":/image/qt_zh_CN.qm");
-        qApp->installTranslator(translator);
-    }
-
-    //判断是否是IP地址
-    static bool IsIP(QString IP)
-    {
-        QRegExp RegExp("((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");
-        return RegExp.exactMatch(IP);
-    }
-
-    //显示信息框,仅确定按钮
-    static void ShowMessageBoxInfo(QString info)
-    {
-        frmMessageBox *msg = new frmMessageBox;
-        msg->SetMessage(info, 0);
-        msg->exec();
-    }
-
-    //显示错误框,仅确定按钮
-    static void ShowMessageBoxError(QString info)
-    {
-        frmMessageBox *msg = new frmMessageBox;
-        msg->SetMessage(info, 2);
-        msg->exec();
-    }
-
-    //显示询问框,确定和取消按钮
-    static int ShowMessageBoxQuesion(QString info)
-    {
-        frmMessageBox *msg = new frmMessageBox;
-        msg->SetMessage(info, 1);
-        return msg->exec();
-    }
-
-    //延时
-    static void Sleep(int sec)
-    {
-        QTime dieTime = QTime::currentTime().addMSecs(sec);
-        while ( QTime::currentTime() < dieTime ) {
-            QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
-        }
-    }
-
-    //窗体居中显示
-    static void FormInCenter(QWidget *frm)
-    {
-        int frmX = frm->width();
-        int frmY = frm->height();
-        QDesktopWidget w;
-        int deskWidth = w.width();
-        int deskHeight = w.height();
-        QPoint movePoint(deskWidth / 2 - frmX / 2, deskHeight / 2 - frmY / 2);
-        frm->move(movePoint);
-    }
-};
-
-#endif // MYHELPER_H

+ 0 - 22
src/CustomTitleWidget/rc.qrc

@@ -1,22 +0,0 @@
-<RCC>
-    <qresource prefix="/">
-        <file>image/add-line_horizontal.png</file>
-        <file>image/add-line_vertical.png</file>
-        <file>image/array_down.png</file>
-        <file>image/checkbox_checked.png</file>
-        <file>image/checkbox_unchecked.png</file>
-        <file>image/error.png</file>
-        <file>image/fontawesome-webfont.ttf</file>
-        <file>image/info.png</file>
-        <file>image/qt_zh_CN.qm</file>
-        <file>image/question.png</file>
-        <file>image/radio_normal.png</file>
-        <file>image/radio_selected.png</file>
-        <file>image/sub-line_horizontal.png</file>
-        <file>image/sub-line_vertical.png</file>
-        <file>image/navy.css</file>
-        <file>image/black.css</file>
-        <file>image/blue.css</file>
-        <file>image/gray.css</file>
-    </qresource>
-</RCC>

+ 2 - 11
src/main.cpp

@@ -9,26 +9,17 @@
 #include <QTextCodec>
 
 #include "videoplayer/videoplayer.h"
-#include "CustomTitleWidget/myhelper.h"
 
 #undef main
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
 
-//    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
-//    QTextCodec::setCodecForLocale(codec);
+    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
+    QTextCodec::setCodecForLocale(codec);
 //    QTextCodec::setCodecForCStrings(codec);
 //    QTextCodec::setCodecForTr(codec);
 
-    myHelper::SetUTF8Code();
-//    myHelper::SetStyle("black");//黑色风格
-//    myHelper::SetStyle("blue");//蓝色风格
-    myHelper::SetStyle("gray");//灰色风格
-//    myHelper::SetStyle("navy");//天蓝色风格
-    myHelper::SetChinese();
-
-
     VideoPlayer w;
     w.show();
 

+ 442 - 23
src/videoplayer/videoplayer.cpp

@@ -15,13 +15,18 @@
 #include <QFontDatabase>
 #include <QMouseEvent>
 
-Q_DECLARE_METATYPE(VideoPlayer_Thread::PlayerState);
+#define MARGINS 2 //窗体边框
+
+Q_DECLARE_METATYPE(VideoPlayer_Thread::PlayerState)
 
 VideoPlayer::VideoPlayer(QWidget *parent) :
-    CustomTitle(parent),
+    QWidget(parent),
     ui(new Ui::VideoPlayer)
 {
-    ui->setupUi(getContentDialog());
+    ui->setupUi(this);
+
+    setWindowFlags(Qt::FramelessWindowHint);//|Qt::WindowStaysOnTopHint);  //使窗口的标题栏隐藏
+    setAttribute(Qt::WA_TranslucentBackground);
 
     av_register_all(); //初始化FFMPEG  调用了这个才能正常使用编码器和解码器
     avformat_network_init(); //支持打开网络文件
@@ -39,8 +44,11 @@ VideoPlayer::VideoPlayer(QWidget *parent) :
     connect(mPlayer,SIGNAL(sig_TotalTimeChanged(qint64)),this,SLOT(slotTotalTimeChanged(qint64)));
     connect(mPlayer,SIGNAL(sig_StateChanged(VideoPlayer_Thread::PlayerState)),this,SLOT(slotStateChanged(VideoPlayer_Thread::PlayerState)));
 
-    ui->verticalLayout_show_video->addWidget(mPlayer->getVideoWidget()); //将显示视频的控件加入
-    mPlayer->getVideoWidget()->show();
+    mPlayer->setVideoWidget(ui->widget_videoPlayer);
+
+//    ui->horizontalSlider_videoPlayer->setValue(50);
+//    mPlayer->setVolume(0.5);
+
 
     mTimer = new QTimer; //定时器-获取当前视频时间
     connect(mTimer,SIGNAL(timeout()),this,SLOT(slotTimerTimeOut()));
@@ -55,14 +63,52 @@ VideoPlayer::VideoPlayer(QWidget *parent) :
 //    connect(ui->horizontalSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotSliderMoved(int)));
     connect(ui->horizontalSlider,SIGNAL(sig_valueChanged(int)),this,SLOT(slotSliderMoved(int)));
 
+    connect(ui->horizontalSlider_volume,SIGNAL(valueChanged(int)),this,SLOT(slotSliderMoved(int)));
+
     resize(1024,768);
-    setTitle("我的播放器");
 
-    ui->widget_right->hide();
+    setTitle(QStringLiteral("我的播放器"));
+
     ui->widget_video->hide();
 
     ui->pushButton_pause->hide();
 
+
+
+
+///改变窗体大小相关
+    isMax = false;
+
+    int w = this->width();
+    int h = this->height();
+
+    QRect screenRect = QApplication::desktop()->screenGeometry();//获取设备屏幕大小
+    int x = (screenRect.width() - w) / 2;
+    int y = (screenRect.height() - h) / 2;
+
+    mLocation = QRect(x, y, w, h);
+    this->setGeometry(mLocation);
+
+    isLeftPressDown = false;
+    this->dir = NONE;
+    this->setMouseTracking(true);// 追踪鼠标
+    ui->widget_frame->setMouseTracking(true);
+    ui->widget_back->setMouseTracking(true);
+    ui->widget_container->setMouseTracking(true);
+//    ui->widget_center->setMouseTracking(true);
+
+    this->setFocusPolicy(Qt::ClickFocus);
+
+    ui->widget_frame->setContentsMargins(MARGINS,MARGINS,MARGINS,MARGINS);
+    showBorderRadius(true);
+
+//    ui->widget_frame->setContentsMargins(1, 1, 1, 1);
+
+    //安装事件监听器,让标题栏识别鼠标双击
+//    ui->widget_beingClass_back->installEventFilter(this);
+
+
+
 }
 
 VideoPlayer::~VideoPlayer()
@@ -76,19 +122,11 @@ void VideoPlayer::doClose()
     close();
 }
 
-//void VideoPlayer::mousePressEvent(QMouseEvent *e)
-//{qDebug()<<"ccc";
-//    if (e->button() == Qt::LeftButton)
-//    {
-
-//    }
-//}
-
-//void VideoPlayer::mouseDoubleClickEvent(QMouseEvent *e)
-//{
-//    qDebug()<<"ddd";
-////    if (e->type() == Qt::mou)
-//}
+void VideoPlayer::setTitle(QString str)
+{
+    ui->label_titleName->setText(str);
+    this->setWindowTitle(str);
+}
 
 void VideoPlayer::slotTotalTimeChanged(qint64 uSec)
 {
@@ -111,6 +149,11 @@ void VideoPlayer::slotSliderMoved(int value)
     {
         mPlayer->seek((qint64)value * 1000000);
     }
+    else if (QObject::sender() == ui->horizontalSlider_volume)
+    {
+        mPlayer->setVolume(value / 100.0);
+        ui->label_volume->setText(QString("%1").arg(value));
+    }
 }
 
 void VideoPlayer::slotTimerTimeOut()
@@ -156,11 +199,8 @@ void VideoPlayer::slotBtnClick()
             s.replace("/","\\");
 
             mPlayer->stop(true); //如果在播放则先停止
-
             mPlayer->setFileName(s);
-
             mTimer->start();
-
         }
     }
 
@@ -190,3 +230,382 @@ void VideoPlayer::slotStateChanged(VideoPlayer_Thread::PlayerState state)
     }
 }
 
+
+
+
+////////////改变窗体大小相关
+
+void VideoPlayer::mouseReleaseEvent(QMouseEvent *event)
+{
+    if(event->button() == Qt::LeftButton){
+        isLeftPressDown = false;
+        if(dir != NONE) {
+            this->releaseMouse();
+            this->setCursor(QCursor(Qt::ArrowCursor));
+        }
+    }
+}
+
+void VideoPlayer::mousePressEvent(QMouseEvent *event)
+{
+//    qDebug()<<__FUNCTION__;
+    if (event->type() == QEvent::MouseButtonDblClick)
+    {
+        if (event->button() == Qt::LeftButton)
+        {
+//            if(QApplication::keyboardModifiers() == (Qt::ControlModifier|Qt::ShiftModifier|Qt::AltModifier))
+            {
+                doChangeFullScreen(); //ctrl + 左键
+            }
+        }
+    }
+
+    switch(event->button()) {
+    case Qt::LeftButton:
+        if (isMax || this->isFullScreen()) break;
+        isLeftPressDown = true;
+        checkCursorDirect(event->globalPos());
+
+        if(dir != NONE) {
+            this->mouseGrabber();
+        } else {
+            dragPosition = event->globalPos() - this->frameGeometry().topLeft();
+        }
+        break;
+//    case Qt::RightButton:
+//        if (!this->isFullScreen())
+//            mAction_FullScreen->setText(tr("show fullscreen"));
+//        else
+//            mAction_FullScreen->setText(tr("quit fullscreen"));
+//        mPopMenu->exec(QCursor::pos());
+//        break;
+    default:
+        QWidget::mousePressEvent(event);
+    }
+
+}
+
+void VideoPlayer::mouseMoveEvent(QMouseEvent *event)
+{
+//    qDebug()<<__FUNCTION__;
+
+    if (isMax || this->isFullScreen()) return;
+
+    QPoint gloPoint = event->globalPos();
+    QRect rect = this->rect();
+    QPoint tl = mapToGlobal(rect.topLeft());
+    QPoint rb = mapToGlobal(rect.bottomRight());
+
+    if(!isLeftPressDown) {
+        checkCursorDirect(gloPoint);
+    } else {
+
+        if(dir != NONE) {
+            QRect rMove(tl, rb);
+
+            switch(dir) {
+            case LEFT:
+                if(rb.x() - gloPoint.x() <= this->minimumWidth())
+                    rMove.setX(tl.x());
+                else
+                    rMove.setX(gloPoint.x());
+                break;
+            case RIGHT:
+                rMove.setWidth(gloPoint.x() - tl.x());
+                break;
+            case UP:
+                if(rb.y() - gloPoint.y() <= this->minimumHeight())
+                    rMove.setY(tl.y());
+                else
+                    rMove.setY(gloPoint.y());
+                break;
+            case DOWN:
+                rMove.setHeight(gloPoint.y() - tl.y());
+                break;
+            case LEFTTOP:
+                if(rb.x() - gloPoint.x() <= this->minimumWidth())
+                    rMove.setX(tl.x());
+                else
+                    rMove.setX(gloPoint.x());
+                if(rb.y() - gloPoint.y() <= this->minimumHeight())
+                    rMove.setY(tl.y());
+                else
+                    rMove.setY(gloPoint.y());
+                break;
+            case RIGHTTOP:
+                rMove.setWidth(gloPoint.x() - tl.x());
+                rMove.setY(gloPoint.y());
+                break;
+            case LEFTBOTTOM:
+                rMove.setX(gloPoint.x());
+                rMove.setHeight(gloPoint.y() - tl.y());
+                break;
+            case RIGHTBOTTOM:
+                rMove.setWidth(gloPoint.x() - tl.x());
+                rMove.setHeight(gloPoint.y() - tl.y());
+                break;
+            default:
+                break;
+            }
+            this->setGeometry(rMove);
+//            emit sig_WindowMoved(rMove);
+        } else {
+            checkCursorDirect(event->globalPos());
+
+            if (dir == NONE && !isMax)
+            {
+                QPoint point = event->globalPos() - dragPosition;
+
+                QRect mLimitRect = QApplication::desktop()->availableGeometry();
+
+                if (point.x() < mLimitRect.x())
+                    point.setX(mLimitRect.x());
+
+                if (point.x() > (mLimitRect.x()+mLimitRect.width()-this->width()))
+                    point.setX(mLimitRect.x()+mLimitRect.width()-this->width());
+
+
+                if (point.y() < mLimitRect.y())
+                    point.setY(mLimitRect.y());
+
+                if (point.y() > (mLimitRect.y()+mLimitRect.height()-this->height()))
+                    point.setY(mLimitRect.y()+mLimitRect.height()-this->height());
+
+                move(point);
+            }
+
+            event->accept();
+        }
+    }
+//    QWidget::mouseMoveEvent(event);、
+    event->accept();
+}
+
+void VideoPlayer::checkCursorDirect(const QPoint &cursorGlobalPoint)
+{
+    // 获取窗体在屏幕上的位置区域,tl为topleft点,rb为rightbottom点
+    QRect rect = this->rect();
+    QPoint tl = mapToGlobal(rect.topLeft());
+    QPoint rb = mapToGlobal(rect.bottomRight());
+
+    int x = cursorGlobalPoint.x();
+    int y = cursorGlobalPoint.y();
+
+    if(tl.x() + PADDING >= x && tl.x() <= x && tl.y() + PADDING >= y && tl.y() <= y) {
+        // 左上角
+        dir = LEFTTOP;
+        this->setCursor(QCursor(Qt::SizeFDiagCursor));  // 设置鼠标形状
+    } else if(x >= rb.x() - PADDING && x <= rb.x() && y >= rb.y() - PADDING && y <= rb.y()) {
+        // 右下角
+        dir = RIGHTBOTTOM;
+        this->setCursor(QCursor(Qt::SizeFDiagCursor));
+    } else if(x <= tl.x() + PADDING && x >= tl.x() && y >= rb.y() - PADDING && y <= rb.y()) {
+        //左下角
+        dir = LEFTBOTTOM;
+        this->setCursor(QCursor(Qt::SizeBDiagCursor));
+    } else if(x <= rb.x() && x >= rb.x() - PADDING && y >= tl.y() && y <= tl.y() + PADDING) {
+        // 右上角
+        dir = RIGHTTOP;
+        this->setCursor(QCursor(Qt::SizeBDiagCursor));
+    } else if(x <= tl.x() + PADDING && x >= tl.x()) {
+        // 左边
+        dir = LEFT;
+        this->setCursor(QCursor(Qt::SizeHorCursor));
+    } else if( x <= rb.x() && x >= rb.x() - PADDING) {
+        // 右边
+        dir = RIGHT;
+        this->setCursor(QCursor(Qt::SizeHorCursor));
+    }else if(y >= tl.y() && y <= tl.y() + PADDING){
+        // 上边
+        dir = UP;
+        this->setCursor(QCursor(Qt::SizeVerCursor));
+    } else if(y <= rb.y() && y >= rb.y() - PADDING) {
+        // 下边
+        dir = DOWN;
+        this->setCursor(QCursor(Qt::SizeVerCursor));
+    }else {
+        // 默认
+        dir = NONE;
+        this->setCursor(QCursor(Qt::ArrowCursor));
+    }
+}
+
+
+void VideoPlayer::on_btnMenu_Close_clicked()
+{
+    qDebug()<<__FUNCTION__;
+
+    close();
+
+//    QTimer::singleShot(500,this,[&]()
+//    {
+//        QPoint pt(0, 0);
+//        QMouseEvent evt(QEvent::Leave, pt, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+//        qApp->sendEvent(ui->btnMenu_Close, &evt);
+//    });
+
+
+}
+
+void VideoPlayer::on_btnMenu_Max_clicked()
+{
+    doChangeFullScreen();
+}
+
+void VideoPlayer::on_btnMenu_Min_clicked()
+{
+    if (this->isFullScreen())
+    {
+//        mAnimation->stop();
+//        mTimer_CheckTitle->stop();
+        ui->widget_title->move(ui->widget_title->x(), 0 - ui->widget_title->height());
+        ui->widget_title->hide();
+    }
+    this->showMinimized();
+
+    QTimer::singleShot(500,this,[&]()
+    {
+        QPoint pt(0, 0);
+        QMouseEvent evt(QEvent::Leave, pt, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
+        qApp->sendEvent(ui->btnMenu_Min, &evt);
+    });
+}
+
+void VideoPlayer::doShowFullScreen()
+{
+    this->show();
+    this->showFullScreen();
+    this->raise();
+    ui->widget_frame->setContentsMargins(0,0,0,0); //隐藏边框
+
+    showBorderRadius(false);
+
+    ui->btnMenu_Max->setIcon(QIcon(":/image/shownormalbtn.png"));
+
+    ui->widget_title->hide(); //隐藏标题栏
+//    ui->verticalLayout_titleWidget_Back->removeWidget(ui->widget_title);
+//    ui->widget_title->setParent(NULL);
+//    ui->widget_title->setWindowFlags(Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint|Qt::Tool|Qt::X11BypassWindowManagerHint);
+//    ui->widget_title->resize(QApplication::desktop()->screen()->width(), ui->widget_title->height());
+//    ui->widget_title->move(0,0);
+//    ui->widget_title->show();
+
+}
+
+void VideoPlayer::doShowNormal()
+{
+    qDebug()<<__FUNCTION__;
+
+    this->show();
+    this->showNormal();
+    this->raise();
+
+    if (!isMax)
+    {
+        ui->widget_frame->setContentsMargins(MARGINS,MARGINS,MARGINS,MARGINS);
+        showBorderRadius(true);
+    } else {
+        ui->widget_frame->setContentsMargins(0,0,0,0);
+        showBorderRadius(false);
+    }
+
+
+    ui->btnMenu_Max->setIcon(QIcon(":/image/showmaxsizebtn.png"));
+
+    QTimer::singleShot(20,this,[&]()
+    {
+        ui->verticalLayout_titleWidget_Back->addWidget(ui->widget_title);
+        ui->widget_title->show();
+    });
+
+}
+
+
+void VideoPlayer::showBorderRadius(bool isShow)
+{
+    QString str;
+
+    if (isShow)
+    {
+        str = QString("QWidget#widget_frame\
+                        {\
+                            border:3px solid  rgb(46, 165, 255);\
+                            background-color: rgba(255, 255, 255, 0);\
+                            border-radius:5px;\
+                        }\
+                        QWidget#widget_back\
+                        {\
+                        border-radius:3px;\
+                        }\
+                        QWidget#widget_title\
+                        {\
+                            border-top-right-radius:5px;\
+                            border-top-left-radius:5px;\
+                        }\
+                        QWidget#widget_container\
+                        {\
+                            border-bottom-right-radius:5px;\
+                            border-bottom-left-radius:5px;\
+                        }\
+                        QStackedWidget\
+                        {\
+                            border-bottom-right-radius:5px;\
+                            border-bottom-left-radius:5px;\
+                        }\
+                        QWidget#page_courseList\
+                        {\
+                            border-bottom-right-radius:5px;\
+                            border-bottom-left-radius:5px;\
+                        }");
+    }
+    else
+    {
+        str = QString("QWidget#widget_frame\
+                        {\
+                            border:3px solid  rgb(46, 165, 255);\
+                            background-color: rgba(255, 255, 255, 0);\
+                            border-radius:0px;\
+                        }\
+                        QWidget#widget_back\
+                        {\
+                        border-radius:0px;\
+                        }\
+                        QWidget#widget_title\
+                        {\
+                            border-top-right-radius:0px;\
+                            border-top-left-radius:0px;\
+                        }\
+                        QWidget#widget_container\
+                        {\
+                            border-bottom-right-radius:0px;\
+                            border-bottom-left-radius:0px;\
+                        }\
+                        QStackedWidget\
+                        {\
+                            border-bottom-right-radius:0px;\
+                            border-bottom-left-radius:0px;\
+                        }\
+                        QWidget#page_courseList\
+                        {\
+                            border-bottom-right-radius:0px;\
+                            border-bottom-left-radius:0px;\
+                        }");
+    }
+
+    ui->widget_frame->setStyleSheet(str);
+
+}
+
+void VideoPlayer::doChangeFullScreen()
+{
+    if (this->isFullScreen())
+    {
+        this->doShowNormal();
+//        mAction_FullScreen->setText(tr("show fullscreen"));
+    }
+    else
+    {
+        this->doShowFullScreen();
+//        mAction_FullScreen->setText(tr("quit fullscreen"));
+    }
+}

+ 38 - 4
src/videoplayer/videoplayer.h

@@ -8,7 +8,6 @@
 #define VIDEOPLAYER_H
 
 #include <QWidget>
-#include <customtitle.h>
 
 #include <QImage>
 #include <QPaintEvent>
@@ -17,13 +16,18 @@
 
 #include "videoplayer/videoplayer_thread.h"
 
+//鼠标实现改变窗口大小
+#define PADDING 6
+enum Direction { UP=0, DOWN, LEFT, RIGHT, LEFTTOP, LEFTBOTTOM, RIGHTBOTTOM, RIGHTTOP, NONE };
+
+
 namespace Ui {
 class VideoPlayer;
 }
 
 ///这个是播放器的主界面 包括那些按钮和进度条之类的
 
-class VideoPlayer : public CustomTitle
+class VideoPlayer : public QWidget
 {
     Q_OBJECT
 
@@ -31,10 +35,10 @@ public:
     explicit VideoPlayer(QWidget *parent = 0);
     ~VideoPlayer();
 
+    void setTitle(QString str);
+
 protected:
     void doClose();
-//    void mousePressEvent(QMouseEvent *e);
-//    void mouseDoubleClickEvent(QMouseEvent *);
 
 private:
     Ui::VideoPlayer *ui;
@@ -51,6 +55,36 @@ private slots:
 
     void slotStateChanged(VideoPlayer_Thread::PlayerState state);
 
+
+///以下是改变窗体大小相关
+    ////////
+protected:
+//    bool eventFilter(QObject *obj, QEvent *event);
+    void mouseReleaseEvent(QMouseEvent *event);
+    void mouseMoveEvent(QMouseEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+
+private:
+    bool isMax; //是否最大化
+    QRect mLocation;
+
+    bool isLeftPressDown;  // 判断左键是否按下
+    QPoint dragPosition;   // 窗口移动拖动时需要记住的点
+    int dir;        // 窗口大小改变时,记录改变方向
+
+    void checkCursorDirect(const QPoint &cursorGlobalPoint);
+
+    void doShowFullScreen();
+    void doShowNormal();
+
+    void showBorderRadius(bool isShow);
+    void doChangeFullScreen();
+
+private slots:
+    void on_btnMenu_Close_clicked();
+    void on_btnMenu_Max_clicked();
+    void on_btnMenu_Min_clicked();
+
 };
 
 #endif // VIDEOPLAYER_H

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 680 - 281
src/videoplayer/videoplayer.ui


+ 7 - 1
src/videoplayer/videoplayer_showvideowidget.cpp

@@ -24,6 +24,12 @@ VideoPlayer_ShowVideoWidget::~VideoPlayer_ShowVideoWidget()
 void VideoPlayer_ShowVideoWidget::paintEvent(QPaintEvent *event)
 {
     QPainter painter(this);
+	
+	painter.setRenderHint(QPainter::Antialiasing);
+    painter.setRenderHint(QPainter::TextAntialiasing);
+    painter.setRenderHint(QPainter::SmoothPixmapTransform);
+    painter.setRenderHint(QPainter::HighQualityAntialiasing);
+	
     painter.setBrush(Qt::black);
     painter.drawRect(0,0,this->width(),this->height()); //先画成黑色
 
@@ -31,7 +37,7 @@ void VideoPlayer_ShowVideoWidget::paintEvent(QPaintEvent *event)
     if (mImage.size().width() <= 0) return;
 
     ///将图像按比例缩放成和窗口一样大小
-    QImage img = mImage.scaled(this->size(),Qt::KeepAspectRatio);
+    QImage img = mImage.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); //这里效率比较低下  还不知道如何优化
 
     int x = this->width() - img.width();
     int y = this->height() - img.height();

+ 388 - 154
src/videoplayer/videoplayer_thread.cpp

@@ -1,10 +1,4 @@
-/**
- * 叶海辉
- * QQ群121376426
- * http://blog.yundiantech.com/
- */
-
-#include "videoplayer_thread.h"
+#include "videoplayer_thread.h"
 
 #include <stdio.h>
 
@@ -15,6 +9,37 @@
 
 #define FLUSH_DATA "FLUSH"
 
+//清空
+static void packet_queue_flush(PacketQueue *q)
+{
+    AVPacketList *pkt, *pkt1;
+
+    SDL_LockMutex(q->mutex);
+    for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1)
+    {
+        pkt1 = pkt->next;
+
+        if(pkt1->pkt.data != (uint8_t *)"FLUSH")
+        {
+
+        }
+        av_free_packet(&pkt->pkt);
+        av_freep(&pkt);
+
+    }
+    q->last_pkt = NULL;
+    q->first_pkt = NULL;
+    q->nb_packets = 0;
+    q->size = 0;
+    SDL_UnlockMutex(q->mutex);
+}
+
+static void packet_queue_deinit(PacketQueue *q) {
+    packet_queue_flush(q);
+    SDL_DestroyMutex(q->mutex);
+    SDL_DestroyCond(q->cond);
+}
+
 void packet_queue_init(PacketQueue *q) {
     memset(q, 0, sizeof(PacketQueue));
     q->mutex = SDL_CreateMutex();
@@ -84,29 +109,6 @@ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) {
     return ret;
 }
 
-static void packet_queue_flush(PacketQueue *q)
-{
-    AVPacketList *pkt, *pkt1;
-
-    SDL_LockMutex(q->mutex);
-    for(pkt = q->first_pkt; pkt != NULL; pkt = pkt1)
-    {
-        pkt1 = pkt->next;
-
-        if(pkt1->pkt.data != (uint8_t *)"FLUSH")
-        {
-
-        }
-        av_free_packet(&pkt->pkt);
-        av_freep(&pkt);
-
-    }
-    q->last_pkt = NULL;
-    q->first_pkt = NULL;
-    q->nb_packets = 0;
-    q->size = 0;
-    SDL_UnlockMutex(q->mutex);
-}
 
 static int audio_decode_frame(VideoState *is, double *pts_ptr)
 {
@@ -124,6 +126,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
 
             if (is->isPause == true) //判断暂停
             {
+                return -1;
                 SDL_Delay(10);
                 continue;
             }
@@ -256,12 +259,16 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
         memset(pkt, 0, sizeof(*pkt));
 
         if (is->quit)
+        {
+            packet_queue_flush(&is->audioq);
             return -1;
+        }
 
         if (is->isPause == true) //判断暂停
         {
-            SDL_Delay(10);
-            continue;
+            return -1;
+//            SDL_Delay(10);
+//            continue;
         }
 
         if (packet_queue_get(&is->audioq, pkt, 0) <= 0)
@@ -289,6 +296,60 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
     return 0;
 }
 
+typedef     signed char         int8_t;
+typedef     signed short        int16_t;
+typedef     signed int          int32_t;
+typedef     unsigned char       uint8_t;
+typedef     unsigned short      uint16_t;
+typedef     unsigned int        uint32_t;
+typedef unsigned long       DWORD;
+typedef int                 BOOL;
+typedef unsigned char       BYTE;
+typedef unsigned short      WORD;
+typedef float               FLOAT;
+typedef FLOAT               *PFLOAT;
+typedef int                 INT;
+typedef unsigned int        UINT;
+typedef unsigned int        *PUINT;
+
+typedef unsigned long ULONG_PTR, *PULONG_PTR;
+typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
+
+#define MAKEWORD(a, b)      ((WORD)(((BYTE)(((DWORD_PTR)(a)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(b)) & 0xff))) << 8))
+#define MAKELONG(a, b)      ((LONG)(((WORD)(((DWORD_PTR)(a)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(b)) & 0xffff))) << 16))
+#define LOWORD(l)           ((WORD)(((DWORD_PTR)(l)) & 0xffff))
+#define HIWORD(l)           ((WORD)((((DWORD_PTR)(l)) >> 16) & 0xffff))
+#define LOBYTE(w)           ((BYTE)(((DWORD_PTR)(w)) & 0xff))
+#define HIBYTE(w)           ((BYTE)((((DWORD_PTR)(w)) >> 8) & 0xff))
+
+void RaiseVolume(char* buf, int size, int uRepeat, double vol)//buf为需要调节音量的音频数据块首地址指针,size为长度,uRepeat为重复次数,通常设为1,vol为增益倍数,可以小于1
+{
+    if (!size)
+    {
+        return;
+    }
+    for (int i = 0; i < size; i += 2)
+    {
+        short wData;
+        wData = MAKEWORD(buf[i], buf[i + 1]);
+        long dwData = wData;
+        for (int j = 0; j < uRepeat; j++)
+        {
+            dwData = dwData * vol;
+            if (dwData < -0x8000)
+            {
+                dwData = -0x8000;
+            }
+            else if (dwData > 0x7FFF)
+            {
+                dwData = 0x7FFF;
+            }
+        }
+        wData = LOWORD(dwData);
+        buf[i] = LOBYTE(wData);
+        buf[i + 1] = HIBYTE(wData);
+    }
+}
 
 static void audio_callback(void *userdata, Uint8 *stream, int len) {
     VideoState *is = (VideoState *) userdata;
@@ -296,13 +357,14 @@ static void audio_callback(void *userdata, Uint8 *stream, int len) {
     int len1, audio_data_size;
 
     double pts;
-
+//qDebug()<<__FUNCTION__<<"111...";
     /*   len是由SDL传入的SDL缓冲区的大小,如果这个缓冲未满,我们就一直往里填充数据 */
     while (len > 0) {
         /*  audio_buf_index 和 audio_buf_size 标示我们自己用来放置解码出来的数据的缓冲区,*/
         /*   这些数据待copy到SDL缓冲区, 当audio_buf_index >= audio_buf_size的时候意味着我*/
         /*   们的缓冲为空,没有数据可供copy,这时候需要调用audio_decode_frame来解码出更
          /*   多的桢数据 */
+//        qDebug()<<__FUNCTION__<<is->audio_buf_index<<is->audio_buf_size;
         if (is->audio_buf_index >= is->audio_buf_size) {
 
             audio_data_size = audio_decode_frame(is, &pts);
@@ -327,16 +389,29 @@ static void audio_callback(void *userdata, Uint8 *stream, int len) {
 
         if (is->audio_buf == NULL) return;
 
+        if (is->isMute) //静音
+        {
+            memset(is->audio_buf + is->audio_buf_index, 0, len1);
+        }
+        else
+        {
+            RaiseVolume((char*)is->audio_buf + is->audio_buf_index, len1, 1, is->mVolume);
+        }
+
         memcpy(stream, (uint8_t *) is->audio_buf + is->audio_buf_index, len1);
-//        SDL_MixAudio(stream, (uint8_t * )is->audio_buf + is->audio_buf_index, len1, 50);
 
+
+//        SDL_memset(stream, 0x0, len);// make sure this is silence.
+//        SDL_MixAudio(stream, (uint8_t *) is->audio_buf + is->audio_buf_index, len1, SDL_MIX_MAXVOLUME);
+
+//        SDL_MixAudio(stream, (uint8_t * )is->audio_buf + is->audio_buf_index, len1, 50);
 //        SDL_MixAudioFormat(stream, (uint8_t * )is->audio_buf + is->audio_buf_index, AUDIO_S16SYS, len1, 50);
 
         len -= len1;
         stream += len1;
         is->audio_buf_index += len1;
     }
-
+//qDebug()<<__FUNCTION__<<"222...";
 }
 
 static double get_audio_clock(VideoState *is)
@@ -383,12 +458,9 @@ int audio_stream_component_open(VideoState *is, int stream_index)
     AVFormatContext *ic = is->ic;
     AVCodecContext *codecCtx;
     AVCodec *codec;
-    SDL_AudioSpec wanted_spec, spec;
+
     int64_t wanted_channel_layout = 0;
     int wanted_nb_channels;
-    /*  SDL支持的声道数为 1, 2, 4, 6 */
-    /*  后面我们会使用这个数组来纠正不支持的声道数目 */
-    const int next_nb_channels[] = { 0, 0, 1, 6, 2, 6, 4, 6 };
 
     if (stream_index < 0 || stream_index >= ic->nb_streams) {
         return -1;
@@ -405,91 +477,12 @@ int audio_stream_component_open(VideoState *is, int stream_index)
         wanted_channel_layout &= ~AV_CH_LAYOUT_STEREO_DOWNMIX;
     }
 
-    wanted_spec.channels = av_get_channel_layout_nb_channels(
-            wanted_channel_layout);
-    wanted_spec.freq = codecCtx->sample_rate;
-    if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
-        //fprintf(stderr,"Invalid sample rate or channel count!\n");
-        return -1;
-    }
-    wanted_spec.format = AUDIO_S16SYS; // 具体含义请查看“SDL宏定义”部分
-    wanted_spec.silence = 0;            // 0指示静音
-    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;  // 自定义SDL缓冲区大小
-    wanted_spec.callback = audio_callback;        // 音频解码的关键回调函数
-    wanted_spec.userdata = is;                    // 传给上面回调函数的外带数据
-
-//    SDL_AudioDeviceID audioID = 1;// = SDL_OpenAudioDevice("",0,&wanted_spec, &spec,1);
-//    int num = SDL_GetNumAudioDevices(0);
-//    for (int i=0;i<num;i++)
-//    {
-//        qDebug()<<SDL_GetAudioDeviceName(i,0);
-//    }
-
-//    ///  打开SDL播放设备 - 开始
-//    SDL_LockAudio();
-//    SDL_AudioSpec spec;
-//    SDL_AudioSpec wanted_spec;
-//    wanted_spec.freq = aCodecCtx->sample_rate;
-//    wanted_spec.format = AUDIO_S16SYS;
-//    wanted_spec.channels = aCodecCtx->channels;
-//    wanted_spec.silence = 0;
-//    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;
-//    wanted_spec.callback = audio_callback;
-//    wanted_spec.userdata = &mVideoState;
-//    if(SDL_OpenAudio(&wanted_spec, &spec) < 0)
-//    {
-//        fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError());
-//        return;
-//    }
-//    SDL_UnlockAudio();
-//    SDL_PauseAudio(0);
-//    ///  打开SDL播放设备 - 结束
-
-    /*  打开音频设备,这里使用一个while来循环尝试打开不同的声道数(由上面 */
-    /*  next_nb_channels数组指定)直到成功打开,或者全部失败 */
-//    while (SDL_OpenAudio(&wanted_spec, &spec) < 0) {
-    do {
-
-        is->audioID = SDL_OpenAudioDevice(SDL_GetAudioDeviceName(0,0),0,&wanted_spec, &spec,0);
-
-//        qDebug()<<"audioID"<<audioID;
-
-//        if (audioID >= 1) break;
-
-        fprintf(stderr,"SDL_OpenAudio (%d channels): %s\n",wanted_spec.channels, SDL_GetError());
-        qDebug()<<QString("SDL_OpenAudio (%1 channels): %2").arg(wanted_spec.channels).arg(SDL_GetError());
-        wanted_spec.channels = next_nb_channels[FFMIN(7, wanted_spec.channels)];
-        if (!wanted_spec.channels) {
-            fprintf(stderr,"No more channel combinations to tyu, audio open failed\n");
-//            return -1;
-            break;
-        }
-        wanted_channel_layout = av_get_default_channel_layout(
-                wanted_spec.channels);
-    }while(is->audioID == 0);
-
-    /* 检查实际使用的配置(保存在spec,由SDL_OpenAudio()填充) */
-    if (spec.format != AUDIO_S16SYS) {
-        fprintf(stderr,"SDL advised audio format %d is not supported!\n",spec.format);
-        return -1;
-    }
-
-    if (spec.channels != wanted_spec.channels) {
-        wanted_channel_layout = av_get_default_channel_layout(spec.channels);
-        if (!wanted_channel_layout) {
-            fprintf(stderr,"SDL advised channel count %d is not supported!\n",spec.channels);
-            return -1;
-        }
-    }
-
-    is->audio_hw_buf_size = spec.size;
-
     /* 把设置好的参数保存到大结构中 */
     is->audio_src_fmt = is->audio_tgt_fmt = AV_SAMPLE_FMT_S16;
-    is->audio_src_freq = is->audio_tgt_freq = spec.freq;
+    is->audio_src_freq = is->audio_tgt_freq = 44100;
     is->audio_src_channel_layout = is->audio_tgt_channel_layout =
             wanted_channel_layout;
-    is->audio_src_channels = is->audio_tgt_channels = spec.channels;
+    is->audio_src_channels = is->audio_tgt_channels = 2;
 
     codec = avcodec_find_decoder(codecCtx->codec_id);
     if (!codec || (avcodec_open2(codecCtx, codec, NULL) < 0)) {
@@ -504,9 +497,7 @@ int audio_stream_component_open(VideoState *is, int stream_index)
         is->audio_buf_size = 0;
         is->audio_buf_index = 0;
         memset(&is->audio_pkt, 0, sizeof(is->audio_pkt));
-        packet_queue_init(&is->audioq);
-//        SDL_PauseAudio(0); // 开始播放静音
-        SDL_PauseAudioDevice(is->audioID,0);
+//        packet_queue_init(&is->audioq);
         break;
     default:
         break;
@@ -550,16 +541,17 @@ int video_thread(void *arg)
     while(1)
     {
         if (is->quit)
-        {
+        {qDebug()<<__FUNCTION__<<"quit!";
+            packet_queue_flush(&is->videoq); //清空队列
             break;
         }
-
+//qDebug()<<__FUNCTION__<<"000!";
         if (is->isPause == true) //判断暂停
         {
             SDL_Delay(10);
             continue;
         }
-
+//qDebug()<<__FUNCTION__<<"000!";
         if (packet_queue_get(&is->videoq, packet, 0) <= 0)
         {
             if (is->readFinished)
@@ -572,7 +564,7 @@ int video_thread(void *arg)
                 continue;
             }
         }
-
+//qDebug()<<__FUNCTION__<<"111!";
         //收到这个数据 说明刚刚执行过跳转 现在需要把解码器的数据 清除一下
         if(strcmp((char*)packet->data,FLUSH_DATA) == 0)
         {
@@ -626,6 +618,11 @@ int video_thread(void *arg)
                 break;
             }
 
+            if (is->readFinished && is->audioq.size == 0)
+            {//读取完了 且音频数据也播放完了 就剩下视频数据了  直接显示出来了 不用同步了
+                break;
+            }
+
             audio_pts = is->audio_clock;
 
             //主要是 跳转的时候 我们把video_clock设置成0了
@@ -633,7 +630,7 @@ int video_thread(void *arg)
             //否则当从后面跳转到前面的时候 会卡在这里
             video_pts = is->video_clock;
 
-
+//qDebug()<<__FUNCTION__<<video_pts<<audio_pts;
             if (video_pts <= audio_pts) break;
 
             int delayTime = (video_pts - audio_pts) * 1000;
@@ -651,41 +648,99 @@ int video_thread(void *arg)
 
             //把这个RGB数据 用QImage加载
             QImage tmpImg((uchar *)out_buffer_rgb,pCodecCtx->width,pCodecCtx->height,QImage::Format_RGB32);
-            QImage image = tmpImg.copy(); //把图像复制一份 传递给界面显示
+//            QImage image = tmpImg.copy(); //把图像复制一份 传递给界面显示
+			QImage image = tmpImg.convertToFormat(QImage::Format_RGB888,Qt::NoAlpha); //去掉透明的部分 有些奇葩的视频会透明
             is->player->disPlayVideo(image); //调用激发信号的函数
         }
 
         av_free_packet(packet);
 
     }
-
+qDebug()<<__FUNCTION__<<"quit 222!";
     av_free(pFrame);
     av_free(pFrameRGB);
     av_free(out_buffer_rgb);
 
+    sws_freeContext(img_convert_ctx);
+
     if (!is->quit)
     {
         is->quit = true;
     }
 
     is->videoThreadFinished = true;
+qDebug()<<__FUNCTION__<<"finished!";
+
+//qDebug()<<__FUNCTION__<<"videoThreadFinished"<<is->videoThreadFinished;
 
     return 0;
 }
 
-
 VideoPlayer_Thread::VideoPlayer_Thread()
 {
+//    mVideoState.readThreadFinished = true;
+//    mVideoState.videoThreadFinished = true;
 
-    mVideoWidget = new VideoPlayer_ShowVideoWidget;
-    connect(this,SIGNAL(sig_GetOneFrame(QImage)),mVideoWidget,SLOT(slotGetOneFrame(QImage)));
+    memset(&mVideoState,0,sizeof(VideoState)); //为了安全起见  先将结构体的数据初始化成0了
 
+    mVideoWidget = NULL;
     mPlayerState = Stop;
+
+    mAudioID = 0;
+    mIsMute = false;
+
+    mVolume = 1;
+
+//    packet_queue_init(&mVideoState.audioq);
+//    packet_queue_init(&mVideoState.videoq);
+
+//    while (1)
+//    {
+//       openSDL();
+//       if (mAudioID > 0)
+//       {
+//           break;
+//       }
+//       SDL_Delay(1);
+//    }
+
+
 }
 
 VideoPlayer_Thread::~VideoPlayer_Thread()
 {
+    ///关闭SDL音频播放设备
+    qDebug()<<__FUNCTION__<<"111...";
+    if (mAudioID != 0)
+    {
+        SDL_LockAudioDevice(mAudioID);
+//        SDL_PauseAudioDevice(mAudioID,1);
+        SDL_CloseAudioDevice(mAudioID);
+        SDL_UnlockAudioDevice(mAudioID);
+
+        mAudioID = 0;
+    }
+
+    deInit();
+
+    qDebug()<<__FUNCTION__<<"222...";
+}
+
+void VideoPlayer_Thread::deInit()
+{
+//    packet_queue_deinit(&mVideoState.videoq);
+//    packet_queue_deinit(&mVideoState.audioq);
 
+    if (mVideoState.swr_ctx != NULL)
+    {
+        swr_free(&mVideoState.swr_ctx);
+        mVideoState.swr_ctx = NULL;
+    }
+
+    if (mVideoState.audio_frame!= NULL) {
+        avcodec_free_frame(&mVideoState.audio_frame);
+        mVideoState.audio_frame = NULL;
+    }
 }
 
 bool VideoPlayer_Thread::setFileName(QString path)
@@ -697,8 +752,10 @@ bool VideoPlayer_Thread::setFileName(QString path)
 
     mFileName = path;
 
-    mPlayerState = Playing;
-    emit sig_StateChanged(Playing);
+//    mPlayerState = Playing;
+//    emit sig_StateChanged(Playing);
+
+    memset(&mVideoState,0,sizeof(VideoState)); //为了安全起见  先将结构体的数据初始化成0了
 
     this->start(); //启动线程
 
@@ -706,6 +763,23 @@ bool VideoPlayer_Thread::setFileName(QString path)
 
 }
 
+bool VideoPlayer_Thread::replay()
+{
+    while (this->isRunning())
+    {
+        SDL_Delay(5);
+    }
+
+    if (mPlayerState != Stop)
+    {
+        return false;
+    }
+//    memset(&mVideoState,0,sizeof(VideoState)); //为了安全起见  先将结构体的数据初始化成0了
+
+    this->start(); //启动线程
+    return true;
+}
+
 bool VideoPlayer_Thread::play()
 {
     mVideoState.isPause = false;
@@ -739,34 +813,40 @@ bool VideoPlayer_Thread::pause()
 
 bool VideoPlayer_Thread::stop(bool isWait)
 {
+    qDebug()<<__FUNCTION__<<"111...";
     if (mPlayerState == Stop)
     {
+        qDebug()<<__FUNCTION__<<"333...";
         return false;
     }
 
-    mVideoState.quit = 1;
-
     mPlayerState = Stop;
-    emit sig_StateChanged(Stop);
-
+    mVideoState.quit = true;
+qDebug()<<__FUNCTION__<<"222...";
     if (isWait)
     {
-        while(!mVideoState.readThreadFinished || !mVideoState.videoThreadFinished)
+        while(!mVideoState.readThreadFinished)
         {
-            SDL_Delay(10);
+//            qDebug()<<mVideoState.readThreadFinished<<mVideoState.videoThreadFinished;
+            SDL_Delay(3);
         }
     }
 
-    ///关闭SDL音频播放设备
-    if (mVideoState.audioID != 0)
-    {
-        SDL_LockAudio();
-        SDL_PauseAudioDevice(mVideoState.audioID,1);
-        SDL_UnlockAudio();
+//    ///关闭SDL音频播放设备
+//    qDebug()<<__FUNCTION__<<mAudioID;
+//    if (mAudioID != 0)
+//    {
+//        SDL_LockAudio();
+//        SDL_PauseAudioDevice(mAudioID,1);
+//        SDL_CloseAudioDevice(mAudioID);
+//        SDL_UnlockAudio();
 
-        mVideoState.audioID = 0;
-    }
+//        mAudioID = 0;
+//    }
+
+qDebug()<<__FUNCTION__<<"999...";
 
+//    emit sig_StateChanged(Stop);
 
     return true;
 }
@@ -780,6 +860,12 @@ void VideoPlayer_Thread::seek(int64_t pos)
     }
 }
 
+void VideoPlayer_Thread::setVolume(float value)
+{
+    mVolume = value;
+    mVideoState.mVolume = value;
+}
+
 double VideoPlayer_Thread::getCurrentTime()
 {
     return mVideoState.audio_clock;
@@ -795,14 +881,111 @@ void VideoPlayer_Thread::disPlayVideo(QImage img)
     emit sig_GetOneFrame(img);  //发送信号
 }
 
-void VideoPlayer_Thread::run()
+void VideoPlayer_Thread::setVideoWidget(VideoPlayer_ShowVideoWidget*widget)
+{
+    mVideoWidget = widget;
+    connect(this,SIGNAL(sig_GetOneFrame(QImage)),mVideoWidget,SLOT(slotGetOneFrame(QImage)));
+}
+
+int VideoPlayer_Thread::openSDL()
+{
+
+    VideoState *is = &mVideoState;
+
+    SDL_AudioSpec wanted_spec, spec;
+    int64_t wanted_channel_layout = 0;
+    int wanted_nb_channels = 2;
+    int samplerate = 44100;
+    /*  SDL支持的声道数为 1, 2, 4, 6 */
+//    /*  后面我们会使用这个数组来纠正不支持的声道数目 */
+//    const int next_nb_channels[] = { 0, 0, 1, 6, 2, 6, 4, 6 };
+
+    if (!wanted_channel_layout
+            || wanted_nb_channels
+                    != av_get_channel_layout_nb_channels(
+                            wanted_channel_layout)) {
+        wanted_channel_layout = av_get_default_channel_layout(
+                wanted_nb_channels);
+        wanted_channel_layout &= ~AV_CH_LAYOUT_STEREO_DOWNMIX;
+    }
+
+    wanted_spec.channels = av_get_channel_layout_nb_channels(
+            wanted_channel_layout);
+    wanted_spec.freq = samplerate;
+    if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
+        //fprintf(stderr,"Invalid sample rate or channel count!\n");
+        return -1;
+    }
+    wanted_spec.format = AUDIO_S16SYS; // 具体含义请查看“SDL宏定义”部分
+    wanted_spec.silence = 0;            // 0指示静音
+    wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE;  // 自定义SDL缓冲区大小
+    wanted_spec.callback = audio_callback;        // 音频解码的关键回调函数
+    wanted_spec.userdata = is;                    // 传给上面回调函数的外带数据
+
+    int num = SDL_GetNumAudioDevices(0);
+    for (int i=0;i<num;i++)
+    {
+        mAudioID = SDL_OpenAudioDevice(SDL_GetAudioDeviceName(i,0), false, &wanted_spec, &spec,0);
+        if (mAudioID > 0)
+        {
+            break;
+        }
+    }
+
+    /* 检查实际使用的配置(保存在spec,由SDL_OpenAudio()填充) */
+    if (spec.format != AUDIO_S16SYS) {
+        qDebug()<<"SDL advised audio format %d is not supported!"<<spec.format;
+        return -1;
+    }
+
+    if (spec.channels != wanted_spec.channels) {
+        wanted_channel_layout = av_get_default_channel_layout(spec.channels);
+        if (!wanted_channel_layout) {
+            fprintf(stderr,"SDL advised channel count %d is not supported!\n",spec.channels);
+            return -1;
+        }
+    }
+
+    is->audio_hw_buf_size = spec.size;
+
+    /* 把设置好的参数保存到大结构中 */
+    is->audio_src_fmt = is->audio_tgt_fmt = AV_SAMPLE_FMT_S16;
+    is->audio_src_freq = is->audio_tgt_freq = spec.freq;
+    is->audio_src_channel_layout = is->audio_tgt_channel_layout =
+            wanted_channel_layout;
+    is->audio_src_channels = is->audio_tgt_channels = spec.channels;
+
+    is->audio_buf_size = 0;
+    is->audio_buf_index = 0;
+    memset(&is->audio_pkt, 0, sizeof(is->audio_pkt));
+
+    return 0;
+}
+
+void VideoPlayer_Thread::closeSDL()
 {
-    char file_path[1280] = {0};;
+    if (mAudioID > 0)
+    {
+        SDL_CloseAudioDevice(mAudioID);
+    }
+
+    mAudioID = -1;
+}
 
+void VideoPlayer_Thread::run()
+{
+    char file_path[1280] = {0};
     strcpy(file_path,mFileName.toUtf8().data());
 
     memset(&mVideoState,0,sizeof(VideoState)); //为了安全起见  先将结构体的数据初始化成0了
 
+    mVideoState.isMute = mIsMute;
+    mVideoState.mVolume = mVolume;
+
+//    mVideoState.Init();
+
+//    seek((23*60+50)*1000000);
+
     VideoState *is = &mVideoState;
 
     AVFormatContext *pFormatCtx;
@@ -898,7 +1081,10 @@ void VideoPlayer_Thread::run()
     }
 
     is->video_st = pFormatCtx->streams[videoStream];
-    packet_queue_init(&is->videoq);
+
+    packet_queue_init(&mVideoState.audioq);
+    packet_queue_init(&mVideoState.videoq);
+
 
     ///创建一个线程专门用来解码视频
     is->video_tid = SDL_CreateThread(video_thread, "video_thread", &mVideoState);
@@ -911,7 +1097,17 @@ void VideoPlayer_Thread::run()
     AVPacket *packet = (AVPacket *) malloc(sizeof(AVPacket)); //分配一个packet 用来存放读取的视频
 //    av_new_packet(packet, y_size); //av_read_frame 会给它分配空间 因此这里不需要了
 
-    av_dump_format(pFormatCtx, 0, file_path, 0); //输出视频信息
+//    av_dump_format(pFormatCtx, 0, file_path, 0); //输出视频信息
+
+    qDebug()<<__FUNCTION__<<is->quit;
+    mPlayerState = Playing;
+    emit sig_StateChanged(Playing);
+
+    openSDL();
+
+    SDL_LockAudioDevice(mAudioID);
+    SDL_PauseAudioDevice(mAudioID,0);
+    SDL_UnlockAudioDevice(mAudioID);
 
     while (1)
     {
@@ -965,11 +1161,14 @@ void VideoPlayer_Thread::run()
         //这里做了个限制  当队列里面的数据超过某个大小的时候 就暂停读取  防止一下子就把视频读完了,导致的空间分配不足
         /* 这里audioq.size是指队列中的所有数据包带的音频数据的总量或者视频数据总量,并不是包的数量 */
         //这个值可以稍微写大一些
+//        qDebug()<<__FUNCTION__<<is->audioq.size<<MAX_AUDIO_SIZE<<is->videoq.size<<MAX_VIDEO_SIZE;
         if (is->audioq.size > MAX_AUDIO_SIZE || is->videoq.size > MAX_VIDEO_SIZE) {
             SDL_Delay(10);
             continue;
         }
 
+//        qDebug()<<__FUNCTION__<<"is->isPause"<<is->isPause;
+
         if (is->isPause == true)
         {
             SDL_Delay(10);
@@ -980,6 +1179,8 @@ void VideoPlayer_Thread::run()
         {
             is->readFinished = true;
 
+//            qDebug()<<__FUNCTION__<<"av_read_frame<0";
+
             if (is->quit)
             {
                 break; //解码线程也执行完了 可以退出了
@@ -1006,17 +1207,50 @@ void VideoPlayer_Thread::run()
         }
     }
 
+    qDebug()<<__FUNCTION__<<"333";
+
     ///文件读取结束 跳出循环的情况
     ///等待播放完毕
     while (!is->quit) {
         SDL_Delay(100);
     }
 
-    stop();
+    if (mPlayerState != Stop) //不是外部调用的stop 是正常播放结束
+    {
+        stop();
+    }
+
+    SDL_LockAudioDevice(mAudioID);
+    SDL_PauseAudioDevice(mAudioID,1);
+    SDL_UnlockAudioDevice(mAudioID);
+
+    closeSDL();
 
+ qDebug()<<__FUNCTION__<<"444";
+    while(!mVideoState.videoThreadFinished)
+    {
+//        qDebug()<<__FUNCTION__<<"videoThreadFinished"<<mVideoState.videoThreadFinished;
+        msleep(10);
+    } //确保视频线程结束后 再销毁队列
+
+    qDebug()<<__FUNCTION__<<"555";
+
+    avcodec_close(aCodecCtx);
     avcodec_close(pCodecCtx);
     avformat_close_input(&pFormatCtx);
+    avformat_free_context(pFormatCtx);
+
+    free(packet);
+
+    packet_queue_deinit(&mVideoState.videoq);
+    packet_queue_deinit(&mVideoState.audioq);
 
     is->readThreadFinished = true;
 
+    emit sig_StateChanged(Stop);
+
+qDebug()<<__FUNCTION__<<"finished!";
+
+
+//    SDL_Quit();
 }

+ 79 - 9
src/videoplayer/videoplayer_thread.h

@@ -1,10 +1,4 @@
-/**
- * 叶海辉
- * QQ群121376426
- * http://blog.yundiantech.com/
- */
-
-#ifndef VIDEOPLAYER_THREAD_H
+#ifndef VIDEOPLAYER_THREAD_H
 #define VIDEOPLAYER_THREAD_H
 
 #include <QThread>
@@ -90,10 +84,69 @@ typedef struct VideoState {
     bool videoThreadFinished;
 
     SDL_Thread *video_tid;  //视频线程id
-    SDL_AudioDeviceID audioID;
 
     VideoPlayer_Thread *player; //记录下这个类的指针  主要用于在线程里面调用激发信号的函数
 
+    bool isMute; //静音标识
+    float mVolume; //0~1 超过1 表示放大倍数
+
+//    VideoState()
+//    {
+//        isMute = false;
+
+////        Init();
+//    }
+
+//    void Init()
+//    {
+//        player = NULL;
+//        readThreadFinished = false;
+//        videoThreadFinished = false;
+//        quit = false;
+//        audio_frame = NULL;
+//        video_clock = 0;
+//        audio_clock = 0;
+
+//        ic = NULL;
+//        videoStream = 0;
+//        audioStream = 0;
+//        audio_frame = NULL;// 解码音频过程中的使用缓存
+//        audio_st = NULL; //音频流
+//        audio_buf_size = 0;
+//        audio_buf_index = 0;
+//        audio_pkt_data = NULL;
+//        audio_pkt_size = 0;
+//        audio_buf = NULL;
+//        audio_src_channels = 0;
+//        audio_tgt_channels = 0;
+//        audio_src_channel_layout = 0;
+//        audio_tgt_channel_layout = 0;
+//        audio_src_freq = 0;
+//        audio_tgt_freq = 0;
+//        swr_ctx = NULL; //用于解码后的音频格式转换
+//        audio_hw_buf_size = false;
+
+//        audio_clock = 0; ///音频时钟
+//        video_clock = 0; ///<pts of last decoded frame / predicted pts of next decoded frame
+
+//        video_st = NULL;
+
+//        /// 跳转相关的变量
+//        seek_req = 0; //跳转标志
+//        seek_pos = 0; //跳转的位置 -- 微秒
+//        seek_flag_audio = 0;//跳转标志 -- 用于音频线程中
+//        seek_flag_video = 0;//跳转标志 -- 用于视频线程中
+//        seek_time = 0; //跳转的时间(秒)  值和seek_pos是一样的
+
+//        ///播放控制相关
+//        isPause = false;  //暂停标志
+//        quit = false;  //停止
+//        readFinished = false; //文件读取完毕
+//        readThreadFinished = false;
+//        videoThreadFinished = false;
+
+//    }
+
 } VideoState;
 
 class VideoPlayer_Thread : public QThread
@@ -114,21 +167,27 @@ public:
 
     bool setFileName(QString path);
 
+    bool replay(); //重新播放
+
     bool play();
     bool pause();
     bool stop(bool isWait = false); //参数表示是否等待所有的线程执行完毕再返回
 
     void seek(int64_t pos); //单位是微秒
 
+    void setMute(bool isMute){mIsMute = isMute;}
+    void setVolume(float value);
+
     int64_t getTotalTime(); //单位微秒
     double getCurrentTime(); //单位秒
 
     void disPlayVideo(QImage img);
 
+    void setVideoWidget(VideoPlayer_ShowVideoWidget*widget);
     QWidget *getVideoWidget(){return mVideoWidget;}
 
 signals:
-    void sig_GetOneFrame(QImage); //获取到一帧图像 就发送此信号
+    void sig_GetOneFrame(QImage); //获取到一帧图像 就发送此信号
 
     void sig_StateChanged(VideoPlayer_Thread::PlayerState state);
     void sig_TotalTimeChanged(qint64 uSec); //获取到视频时长的时候激发此信号
@@ -141,11 +200,22 @@ private:
 
     VideoState mVideoState;
 
+
     PlayerState mPlayerState; //播放状态
 
     ///用自己的控件替代SLD 是因为SDL会导致QSS样式失效
     VideoPlayer_ShowVideoWidget *mVideoWidget; //显示视频用的控件
 
+    bool mIsMute;
+    float mVolume; //0~1 超过1 表示放大倍数
+
+    SDL_AudioDeviceID mAudioID;
+
+    int openSDL();
+    void closeSDL();
+
+    void deInit();
+
 };
 
 #endif // VIDEOPLAYER_THREAD_H

+ 2 - 2
说明.txt

@@ -1,7 +1,7 @@
 这是Qt的工程,建议使用Qt Creator 打开
 
 
-从零开始学习音视频编程技术(十一) FFMPEG Qt视频播放器之美化界面
+从零开始学习音视频编程技术(二十二) 录屏软件开发之BUG修复
 
 FFMPEG的版本是2.5.2
 SDL的版本是2.04
@@ -10,7 +10,7 @@ SDL
 
 
 关于代码的解释 请参考:
-http://blog.yundiantech.com/?log=blog&id=14
+http://blog.yundiantech.com/?log=blog&id=35
 
 
 Qt开发环境的搭建 请参考:

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác