├── res
├── Qt.png
├── close.png
├── edit.png
├── max.png
├── menu.png
├── min.png
├── radio.png
├── skin.png
├── table.png
├── title.png
├── normal.png
├── onTopOn.png
├── switch.png
├── bilibili.png
├── onTopOff.png
└── progress.png
├── qss.qrc
├── util
├── util.pri
├── compositionwindoweffect.cpp
└── compositionwindoweffect.h
├── buttonspage.cpp
├── main.cpp
├── tabel.h
├── buttonspage.h
├── progresspage.h
├── qss
├── setTheme.qss
└── windowControl.qss
├── tablepage.cpp
├── tablepage.h
├── progresspage.cpp
├── res.qrc
├── skinpage.h
├── .gitignore
├── README.md
├── circleprogress.h
├── QT_UI_Simplify.pro
├── framelesswindow.h
├── tabel.cpp
├── skinpage.cpp
├── circleprogress.cpp
├── CMakeLists.txt
├── framelesswindow.cpp
├── framelesswindow.ui
└── LICENSE
/res/Qt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/Qt.png
--------------------------------------------------------------------------------
/res/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/close.png
--------------------------------------------------------------------------------
/res/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/edit.png
--------------------------------------------------------------------------------
/res/max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/max.png
--------------------------------------------------------------------------------
/res/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/menu.png
--------------------------------------------------------------------------------
/res/min.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/min.png
--------------------------------------------------------------------------------
/res/radio.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/radio.png
--------------------------------------------------------------------------------
/res/skin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/skin.png
--------------------------------------------------------------------------------
/res/table.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/table.png
--------------------------------------------------------------------------------
/res/title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/title.png
--------------------------------------------------------------------------------
/res/normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/normal.png
--------------------------------------------------------------------------------
/res/onTopOn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/onTopOn.png
--------------------------------------------------------------------------------
/res/switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/switch.png
--------------------------------------------------------------------------------
/res/bilibili.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/bilibili.png
--------------------------------------------------------------------------------
/res/onTopOff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/onTopOff.png
--------------------------------------------------------------------------------
/res/progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Ynnkie/QT_UI_Simplify/HEAD/res/progress.png
--------------------------------------------------------------------------------
/qss.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | qss/setTheme.qss
4 | qss/windowControl.qss
5 |
6 |
7 |
--------------------------------------------------------------------------------
/util/util.pri:
--------------------------------------------------------------------------------
1 | HEADERS += \
2 | $$PWD/compositionwindoweffect.h
3 |
4 | SOURCES += \
5 | $$PWD/compositionwindoweffect.cpp
6 |
7 | LIBS += -luser32 -ldwmapi
8 |
--------------------------------------------------------------------------------
/buttonspage.cpp:
--------------------------------------------------------------------------------
1 | #include "buttonspage.h"
2 |
3 | #include
4 |
5 | ButtonsPage::ButtonsPage(QWidget *parent)
6 | : QWidget{parent}
7 | {
8 | new QLabel("buttons page", this);
9 | }
10 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include "framelesswindow.h"
2 |
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 | FramelessWindow w;
9 | w.show();
10 | return a.exec();
11 | }
12 |
--------------------------------------------------------------------------------
/tabel.h:
--------------------------------------------------------------------------------
1 | #ifndef TABEL_H
2 | #define TABEL_H
3 |
4 | #include
5 |
6 | class Tabel : public QTableWidget
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit Tabel(QWidget *parent = nullptr);
11 |
12 | signals:
13 | };
14 |
15 | #endif // TABEL_H
16 |
--------------------------------------------------------------------------------
/buttonspage.h:
--------------------------------------------------------------------------------
1 | #ifndef BUTTONSPAGE_H
2 | #define BUTTONSPAGE_H
3 |
4 | #include
5 |
6 | class ButtonsPage : public QWidget
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit ButtonsPage(QWidget *parent = nullptr);
11 |
12 | signals:
13 | };
14 |
15 | #endif // BUTTONSPAGE_H
16 |
--------------------------------------------------------------------------------
/progresspage.h:
--------------------------------------------------------------------------------
1 | #ifndef PROGRESSPAGE_H
2 | #define PROGRESSPAGE_H
3 |
4 | #include
5 |
6 | class ProgressPage : public QWidget
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit ProgressPage(QWidget *parent = nullptr);
11 |
12 | signals:
13 | };
14 |
15 | #endif // PROGRESSPAGE_H
16 |
--------------------------------------------------------------------------------
/qss/setTheme.qss:
--------------------------------------------------------------------------------
1 | QWidget#centralwidget
2 | {
3 | background-color: qlineargradient(
4 | spread:pad,
5 | x1:0, y1:0, x2:0, y2:1,
6 | stop:0 %1, stop:1 %2);
7 | border: 1px solid white;
8 | border-color: rgba(255, 255, 255, 128);
9 | border-radius: 25px;
10 | }
11 |
--------------------------------------------------------------------------------
/tablepage.cpp:
--------------------------------------------------------------------------------
1 | #include "tablepage.h"
2 |
3 | #include "tabel.h"
4 |
5 | #include
6 | #include
7 |
8 | TablePage::TablePage(QWidget *parent)
9 | : QWidget{parent}
10 | {
11 | m_tabel = new Tabel();
12 |
13 | QGridLayout* grid = new QGridLayout(this);
14 | grid->addWidget(m_tabel);
15 | }
16 |
--------------------------------------------------------------------------------
/tablepage.h:
--------------------------------------------------------------------------------
1 | #ifndef TABLEPAGE_H
2 | #define TABLEPAGE_H
3 |
4 | #include
5 |
6 | class Tabel;
7 |
8 | class TablePage : public QWidget
9 | {
10 | Q_OBJECT
11 | public:
12 | explicit TablePage(QWidget *parent = nullptr);
13 |
14 | signals:
15 |
16 | private:
17 | Tabel* m_tabel;
18 | };
19 |
20 | #endif // TABLEPAGE_H
21 |
--------------------------------------------------------------------------------
/progresspage.cpp:
--------------------------------------------------------------------------------
1 | #include "progresspage.h"
2 |
3 | #include "circleprogress.h"
4 |
5 | #include
6 |
7 | ProgressPage::ProgressPage(QWidget *parent)
8 | : QWidget{parent}
9 | {
10 | CircleProgress* circle1 = new CircleProgress("湿度:", "度");
11 | circle1->setFixedSize(200, 200);
12 | circle1->setValue(50);
13 |
14 | CircleProgress* circle2 = new CircleProgress("内存:", "%");
15 | circle2->setFixedSize(200, 200);
16 | circle2->setValue(90);
17 |
18 | QHBoxLayout* allLayout = new QHBoxLayout(this);
19 | allLayout->addWidget(circle1);
20 | allLayout->addWidget(circle2);
21 | }
22 |
--------------------------------------------------------------------------------
/util/compositionwindoweffect.cpp:
--------------------------------------------------------------------------------
1 | #include "compositionwindoweffect.h"
2 |
3 | BOOL(WINAPI *CompositionWindowEffect::SetWindowCompositionAttributePtr)(HWND, WINDOWCOMPOSITIONATTRIBDATA *) =
4 | (BOOL(WINAPI *)(HWND, WINDOWCOMPOSITIONATTRIBDATA *))GetProcAddress(GetModuleHandle(TEXT("user32.dll")), "SetWindowCompositionAttribute");
5 |
6 | void CompositionWindowEffect::setAreoEffect(const HWND hwnd)
7 | {
8 | ACCENT_POLICY accent = {ACCENT_STATE::ACCENT_ENABLE_AERO_BLUR, 0, 0, 0};
9 | WINDOWCOMPOSITIONATTRIBDATA data{WINDOWCOMPOSITIONATTRIB::WCA_ACCENT_POLICY, &accent, sizeof(ACCENT_POLICY)};
10 | SetWindowCompositionAttributePtr(hwnd, &data);
11 | }
12 |
--------------------------------------------------------------------------------
/res.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/bilibili.png
4 | res/close.png
5 | res/edit.png
6 | res/max.png
7 | res/menu.png
8 | res/min.png
9 | res/normal.png
10 | res/progress.png
11 | res/Qt.png
12 | res/radio.png
13 | res/skin.png
14 | res/switch.png
15 | res/table.png
16 | res/title.png
17 | res/onTopOff.png
18 | res/onTopOn.png
19 |
20 |
21 |
--------------------------------------------------------------------------------
/skinpage.h:
--------------------------------------------------------------------------------
1 | #ifndef SKINPAGE_H
2 | #define SKINPAGE_H
3 |
4 | #include
5 | #include
6 |
7 | // 主题元素
8 | class SkinItem : public QPushButton
9 | {
10 | Q_OBJECT
11 | public:
12 | explicit SkinItem(QString topColor, QString bottomColor);
13 | inline QString topColor(){return m_topColor;}
14 | inline QString bottomColor(){return m_bottomColor;}
15 |
16 | private:
17 | QString m_topColor;
18 | QString m_bottomColor;
19 | };
20 |
21 | // 主题页面
22 | class SkinPage : public QWidget
23 | {
24 | Q_OBJECT
25 | public:
26 | explicit SkinPage(QWidget *parent = nullptr);
27 |
28 | signals:
29 | void selectSkin(QString topColor, QString bottomColor);
30 |
31 | private:
32 | QList member;
33 | };
34 |
35 | #endif // SKINPAGE_H
36 |
--------------------------------------------------------------------------------
/qss/windowControl.qss:
--------------------------------------------------------------------------------
1 |
2 | QPushButton:hover
3 | {
4 | margin:5;
5 | background: qradialgradient(
6 | cx:0.5, cy:0.5, radius: 0.5,
7 | fx:0.5, fy:0.5,
8 | stop:0 #80ffffff, stop:1 #00ffffff)
9 | }
10 |
11 | QPushButton#bilibiliBtn
12 | {
13 | border-image: url(:/res/bilibili.png);
14 | }
15 |
16 | QPushButton#minBtn
17 | {
18 | border-image: url(:/res/min.png);
19 | }
20 |
21 | QPushButton#closeBtn
22 | {
23 | border-image: url(:/res/close.png);
24 | }
25 |
26 | QPushButton#skinBtn
27 | {
28 | border-image: url(:/res/skin.png);
29 | }
30 |
31 | QPushButton#buttonsPageBtn
32 | {
33 | border-image: url(:/res/switch.png);
34 | }
35 |
36 | QPushButton#progressPageBtn
37 | {
38 | border-image: url(:/res/progress.png);
39 | }
40 |
41 | QPushButton#tablePageBtn
42 | {
43 | border-image: url(:/res/table.png);
44 | }
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # C++ objects and libs
2 | *.slo
3 | *.lo
4 | *.o
5 | *.a
6 | *.la
7 | *.lai
8 | *.so
9 | *.so.*
10 | *.dll
11 | *.dylib
12 |
13 | # Qt-es
14 | object_script.*.Release
15 | object_script.*.Debug
16 | *_plugin_import.cpp
17 | /.qmake.cache
18 | /.qmake.stash
19 | *.pro.user
20 | *.pro.user.*
21 | *.qbs.user
22 | *.qbs.user.*
23 | *.moc
24 | moc_*.cpp
25 | moc_*.h
26 | qrc_*.cpp
27 | ui_*.h
28 | *.qmlc
29 | *.jsc
30 | Makefile*
31 | *build-*
32 | *.qm
33 | *.prl
34 |
35 | # Qt unit tests
36 | target_wrapper.*
37 |
38 | # QtCreator
39 | *.autosave
40 |
41 | # QtCreator Qml
42 | *.qmlproject.user
43 | *.qmlproject.user.*
44 |
45 | # QtCreator CMake
46 | CMakeLists.txt.user*
47 |
48 | # QtCreator 4.8< compilation database
49 | compile_commands.json
50 |
51 | # QtCreator local machine specific files for imported projects
52 | *creator.user*
53 |
54 | *_qmlcache.qrc
55 |
56 | # custom add
57 | build/
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # QT_UI_Simplify
2 | 使用QT_CPP实现一些极简主义的控件
3 |
4 | # 当前实现功能
5 |
6 | + 无边框窗口
7 | + 界面伸缩
8 | + windows半屏全屏(拖拽、按键)
9 | + 半透明渐变、圆角、边框
10 | + 标题栏
11 | + 拖拽、双击
12 | + B站主页跳转、最小化、关闭
13 | + 侧边栏和主体页面
14 | + 页面切换
15 | + 主题页面
16 | + 主题切换
17 | + 按钮悬浮提示
18 |
19 | # 开发经历
20 |
21 | ## V 0.3.1
22 |
23 | + 窗口模糊效果实现
24 | + 圆形进度条优化
25 | + 构造函数中添加前后缀文字设定
26 | + 设置在超过80时进度条变为红色
27 | + 项目添加qmake管理
28 |
29 | ## V 0.2.3
30 |
31 | + 标题栏添加窗口置顶按钮
32 | + 当前窗口置顶或取消置顶
33 | + 软件关闭添加最小化和关闭询问
34 | + 增加系统托盘图标
35 | + 显示窗口
36 | + 退出程序
37 | + 实现圆形进度条控件
38 | + 前后缀文字设定
39 | + 当前值设定
40 | + 值变化动画效果
41 |
42 | ## V 0.2.2
43 |
44 | + 删除多余的窗口移动函数
45 | + 修复标题中鼠标位置判断bug
46 | + 窗口中的控件样式统一用qss文件管理
47 | + 切换主题
48 | + 按钮悬浮提醒
49 | + 标题栏添加功能
50 | + B站主页跳转
51 | + 最小化
52 | + 添加侧边栏和主体页面
53 | + 侧边栏切换页面
54 | + 实现主题页面
55 | + 实现主题切换
56 | + 按钮点击切换主体页面和主题页面
57 |
58 | ## V 0.1.1
59 |
60 | + 实现无边框窗口
61 | + 实现标题栏拖拽、双击、关闭按钮
62 | + 实现界面伸缩
63 | + 实现windows半屏全屏(拖拽、按键)
64 | + 添加qss样式(半透明渐变、圆角、边框)
65 |
--------------------------------------------------------------------------------
/circleprogress.h:
--------------------------------------------------------------------------------
1 | #ifndef CIRCLEPROGRESS_H
2 | #define CIRCLEPROGRESS_H
3 |
4 | #include
5 |
6 | class QPropertyAnimation;
7 |
8 | class CircleProgress : public QWidget
9 | {
10 | Q_OBJECT
11 | public:
12 | explicit CircleProgress(QWidget *parent);
13 | explicit CircleProgress(QString preText = "", QString postText = "", QWidget* parent = nullptr);
14 |
15 | void setValue(int value);
16 | inline void setPreText(QString preText){m_preText = preText;}
17 | inline void setPostText(QString postText){m_postText = postText;}
18 |
19 | protected:
20 | void paintEvent(QPaintEvent *event);
21 |
22 | signals:
23 |
24 | private:
25 | void paintGray(QPainter& painter); // 绘制灰色底槽
26 | void paintProgress(QPainter& painter); // 绘制进度条
27 | void paintText(QPainter& painter); // 绘制中心文字
28 |
29 | private:
30 | int m_value; // 目标值
31 | int m_currProgress; // 当前动画值
32 | QString m_preText; // 前缀文字
33 | QString m_postText; // 后缀文字
34 |
35 | QPropertyAnimation* m_animation; // 动画
36 | };
37 |
38 | #endif // CIRCLEPROGRESS_H
39 |
--------------------------------------------------------------------------------
/QT_UI_Simplify.pro:
--------------------------------------------------------------------------------
1 | QT += core gui
2 |
3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
4 |
5 | CONFIG += c++17
6 |
7 | # You can make your code fail to compile if it uses deprecated APIs.
8 | # In order to do so, uncomment the following line.
9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
10 |
11 | SOURCES += \
12 | buttonspage.cpp \
13 | circleprogress.cpp \
14 | main.cpp \
15 | framelesswindow.cpp \
16 | progresspage.cpp \
17 | skinpage.cpp \
18 | tabel.cpp \
19 | tablepage.cpp
20 |
21 | HEADERS += \
22 | buttonspage.h \
23 | circleprogress.h \
24 | framelesswindow.h \
25 | progresspage.h \
26 | skinpage.h \
27 | tabel.h \
28 | tablepage.h
29 |
30 | FORMS += \
31 | framelesswindow.ui
32 |
33 | include($$PWD/util/util.pri)
34 |
35 | # Default rules for deployment.
36 | qnx: target.path = /tmp/$${TARGET}/bin
37 | else: unix:!android: target.path = /opt/$${TARGET}/bin
38 | !isEmpty(target.path): INSTALLS += target
39 |
40 | RESOURCES += \
41 | qss.qrc \
42 | res.qrc
43 |
44 | DISTFILES += \
45 | README.md
46 |
--------------------------------------------------------------------------------
/framelesswindow.h:
--------------------------------------------------------------------------------
1 | #ifndef FRAMELESSWINDOW_H
2 | #define FRAMELESSWINDOW_H
3 |
4 | #include
5 |
6 | class QSystemTrayIcon;
7 |
8 | QT_BEGIN_NAMESPACE
9 | namespace Ui {
10 | class FramelessWindow;
11 | }
12 | QT_END_NAMESPACE
13 |
14 | // 无边框窗口
15 | class FramelessWindow : public QMainWindow
16 | {
17 | Q_OBJECT
18 | public:
19 | enum PagesIndex{
20 | SkinPage,
21 | ButtonsPage,
22 | ProgressPage,
23 | TablePage,
24 | };
25 |
26 | public:
27 | FramelessWindow(QWidget *parent = nullptr);
28 | ~FramelessWindow();
29 |
30 | void setBackgroundColor(QString topColor, QString bottomColor); // 设置背景颜色
31 | void setPageIndex(int index); // 设置当前显示页面
32 | void setOnTop(); // 设置窗口置顶
33 |
34 | private:
35 | void uiStyleInit(); // ui控件样式初始化
36 | void uiConnectInit(); // ui控件槽函数连接
37 | void trayIconInit(); // 系统托盘图标初始化
38 |
39 | protected:
40 | bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result); // 重写Windows消息
41 |
42 | private:
43 | Ui::FramelessWindow *ui;
44 |
45 | QPoint m_pressPos; // 点击位置
46 | int m_resizePadding; // 拉伸边缘宽度
47 | int m_pageIndex; // 存储除了皮肤页面的当前页号
48 | bool m_isOnTop; // 当前是否置顶
49 |
50 | QSystemTrayIcon* m_trayIcon; // 托盘图标
51 | };
52 | #endif // FRAMELESSWINDOW_H
53 |
--------------------------------------------------------------------------------
/tabel.cpp:
--------------------------------------------------------------------------------
1 | #include "tabel.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | Tabel::Tabel(QWidget *parent)
9 | : QTableWidget{parent}
10 | {
11 | setColumnCount(10); // 设置列数
12 | setRowCount(20); // 设置行数
13 |
14 | QStringList m_Header;
15 | m_Header<setTextAlignment(Qt::AlignCenter);//居中显示
48 | item(rows,columns)->setFont(QFont("Helvetica"));//设置字体为黑体
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/skinpage.cpp:
--------------------------------------------------------------------------------
1 | #include "skinpage.h"
2 |
3 | #include
4 | #include
5 |
6 | SkinPage::SkinPage(QWidget *parent)
7 | : QWidget{parent}
8 | {
9 | // 成员初始化
10 | member << new SkinItem("#c0444444", "#c0444444");
11 | member << new SkinItem("#c0444444", "#c0ffffff");
12 | member << new SkinItem("#c0444444", "#c080d080");
13 | member << new SkinItem("#c0444444", "#c0daa520");
14 | member << new SkinItem("#c0444444", "#c087ceeb");
15 | member << new SkinItem("#c0444444", "#c0ffd0d0");
16 |
17 | QGridLayout* mainLayout = new QGridLayout(this);
18 |
19 | int i = 0; // 用于划分行列
20 | for (const auto& item : member) // 槽函数连接及加入布局
21 | {
22 | connect(item, &SkinItem::clicked, this, [&](){
23 | emit selectSkin(item->topColor(), item->bottomColor());
24 | });
25 |
26 | mainLayout->addWidget(item, i / 3, i % 3);
27 | ++i;
28 | }
29 | }
30 |
31 | SkinItem::SkinItem(QString topColor, QString bottomColor)
32 | : m_topColor(topColor)
33 | , m_bottomColor(bottomColor)
34 | {
35 | setFixedSize(200, 200);
36 | setAttribute(Qt::WA_StyledBackground); // 启用 QSS
37 |
38 | QString styleSheet =
39 | QString(
40 | "background-color: qlineargradient("
41 | "spread:pad, "
42 | "x1:0, y1:0, x2:0, y2:1, "
43 | "stop:0 %1, "
44 | "stop:1 %2);"
45 | "border: 1px solid white;"
46 | "border-color: rgba(255, 255, 255, 128);"
47 | "border-radius: 10px;").arg(m_topColor, m_bottomColor);
48 | setStyleSheet(styleSheet);
49 | }
50 |
--------------------------------------------------------------------------------
/util/compositionwindoweffect.h:
--------------------------------------------------------------------------------
1 | #ifndef COMPOSITIONWINDOWEFFECT_H
2 | #define COMPOSITIONWINDOWEFFECT_H
3 |
4 | #include
5 |
6 | class CompositionWindowEffect
7 | {
8 | public:
9 | enum class WINDOWCOMPOSITIONATTRIB
10 | {
11 | WCA_UNDEFINED,
12 | WCA_NCRENDERING_ENABLED,
13 | WCA_NCRENDERING_POLICY,
14 | WCA_TRANSITIONS_FORCEDISABLED,
15 | WCA_ALLOW_NCPAINT,
16 | WCA_CAPTION_BUTTON_BOUNDS,
17 | WCA_NONCLIENT_RTL_LAYOUT,
18 | WCA_FORCE_ICONIC_REPRESENTATION,
19 | WCA_EXTENDED_FRAME_BOUNDS,
20 | WCA_HAS_ICONIC_BITMAP,
21 | WCA_THEME_ATTRIBUTES,
22 | WCA_NCRENDERING_EXILED,
23 | WCA_NCADORNMENTINFO,
24 | WCA_EXCLUDED_FROM_LIVEPREVIEW,
25 | WCA_VIDEO_OVERLAY_ACTIVE,
26 | WCA_FORCE_ACTIVEWINDOW_APPEARANCE,
27 | WCA_DISALLOW_PEEK,
28 | WCA_CLOAK,
29 | WCA_CLOAKED,
30 | WCA_ACCENT_POLICY,
31 | WCA_FREEZE_REPRESENTATION,
32 | WCA_EVER_UNCLOAKED,
33 | WCA_VISUAL_OWNER,
34 | WCA_HOLOGRAPHIC,
35 | WCA_EXCLUDED_FROM_DDA,
36 | WCA_PASSIVEUPDATEMODE,
37 | WCA_USEDARKMODECOLORS,
38 | WCA_CORNER_STYLE,
39 | WCA_PART_COLOR,
40 | WCA_DISABLE_MOVESIZE_FEEDBACK,
41 | WCA_LAST
42 | };
43 | enum class ACCENT_STATE
44 | {
45 | ACCENT_DISABLED, // 黑色无效果
46 | ACCENT_ENABLE_GRADIENT, // 直接设置颜色
47 | ACCENT_ENABLE_TRANSPARENTGRADIENT, // 跟随系统主题色(需要窗口透明)
48 | ACCENT_ENABLE_AERO_BLUR, // Aero模糊
49 | ACCENT_ENABLE_AERO_BLUR_COLOR, // Aero模糊,但可直接设置颜色
50 | ACCENT_ENABLE_HOSTBACKDROP, // 黑色无效果
51 | ACCENT_INVALID_STATE // 全透明
52 | };
53 | struct ACCENT_POLICY
54 | {
55 | ACCENT_STATE AccentState; // 指定窗口的效果
56 | DWORD AccentFlags; // 可以用于控制无边框时的窗口阴影(参考值:480 影响因素未知)
57 | COLORREF GradientColor; // 控制透明效果的颜色,取决于AccentState
58 | DWORD AnimationId;
59 | };
60 |
61 | struct WINDOWCOMPOSITIONATTRIBDATA
62 | {
63 | WINDOWCOMPOSITIONATTRIB Attribute;
64 | ACCENT_POLICY *Data;
65 | SIZE_T SizeOfData;
66 | };
67 |
68 | static void setAreoEffect(const HWND hwnd);
69 |
70 | static BOOL(WINAPI *SetWindowCompositionAttributePtr)(HWND, WINDOWCOMPOSITIONATTRIBDATA *);
71 | };
72 |
73 | #endif // COMPOSITIONWINDOWEFFECT_H
74 |
--------------------------------------------------------------------------------
/circleprogress.cpp:
--------------------------------------------------------------------------------
1 | #include "circleprogress.h"
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | CircleProgress::CircleProgress(QWidget *parent)
8 | : QWidget{parent}
9 | {
10 | // 初始化值
11 | m_value = 0;
12 | m_currProgress = 0;
13 | m_preText = "";
14 | m_postText = "";
15 |
16 | // 动画的初始化
17 | m_animation = new QPropertyAnimation(this);
18 | m_animation->setTargetObject(this);
19 | m_animation->setEasingCurve(QEasingCurve::OutCubic);
20 | m_animation->setDirection(QVariantAnimation::Forward);
21 | m_animation->setDuration(1000);
22 |
23 | // 数值改变触发绘制函数
24 | connect(m_animation, &QPropertyAnimation::valueChanged, this, [&](const QVariant& value){
25 | m_currProgress = value.toInt();
26 | // 越界
27 | if (m_currProgress < 0) m_currProgress = 0;
28 | if (m_currProgress > 100) m_currProgress = 100;
29 | update();
30 | });
31 | }
32 |
33 | CircleProgress::CircleProgress(QString preText, QString postText, QWidget *parent)
34 | : CircleProgress(parent)
35 | {
36 | m_preText = preText;
37 | m_postText = postText;
38 | }
39 |
40 | void CircleProgress::setValue(int value)
41 | {
42 | // 越界
43 | if (value < 0) value = 0;
44 | if (value > 100) value = 100;
45 |
46 | m_value = value;
47 | // 中止当前动画
48 | m_animation->stop();
49 | // 开始新的动画
50 | m_animation->setStartValue(m_currProgress);
51 | m_animation->setEndValue(value);
52 | m_animation->start();
53 | }
54 |
55 | void CircleProgress::paintEvent(QPaintEvent *event)
56 | {
57 | Q_UNUSED(event);
58 |
59 | QPainter painter(this);
60 | painter.setRenderHint(QPainter::Antialiasing); // 抗锯齿
61 |
62 | // 绘制各个部分
63 | paintGray(painter);
64 | paintProgress(painter);
65 | paintText(painter);
66 | }
67 |
68 | void CircleProgress::paintGray(QPainter &painter)
69 | {
70 | painter.save();
71 | painter.setPen(QPen(QBrush(Qt::gray), 20, Qt::SolidLine, Qt::RoundCap));
72 | QRect rectangle = rect();
73 | rectangle.adjust(10, 10, -10, -10);
74 | painter.drawArc(rectangle, -210 * 16, -300 * 16);
75 | painter.restore();
76 | }
77 |
78 | void CircleProgress::paintProgress(QPainter &painter)
79 | {
80 | painter.save();
81 | painter.setPen(QPen(QBrush(m_currProgress > 80 ? Qt::red : Qt::green), 10, Qt::SolidLine, Qt::RoundCap));
82 | QRect rectangle = rect();
83 | rectangle.adjust(10, 10, -10, -10);
84 | painter.drawArc(rectangle, -210 * 16, m_currProgress * -16 * 3);
85 | painter.restore();
86 | }
87 |
88 | void CircleProgress::paintText(QPainter &painter)
89 | {
90 | painter.save();
91 | painter.setPen(Qt::green);
92 | painter.setFont(QFont("华文彩云", 20));
93 | painter.drawText(rect(), Qt::AlignVCenter, QString("%1%2%3").arg(m_preText).arg(m_currProgress).arg(m_postText));
94 | painter.restore();
95 | }
96 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 |
3 | project(QT_UI_Simplify VERSION 0.1 LANGUAGES CXX)
4 |
5 | set(CMAKE_AUTOUIC ON)
6 | set(CMAKE_AUTOMOC ON)
7 | set(CMAKE_AUTORCC ON)
8 |
9 | set(CMAKE_CXX_STANDARD 17)
10 | set(CMAKE_CXX_STANDARD_REQUIRED ON)
11 |
12 | find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
13 | find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
14 |
15 | set(PROJECT_SOURCES
16 | main.cpp
17 | # 窗口和页面
18 | framelesswindow.h framelesswindow.cpp framelesswindow.ui
19 | skinpage.h skinpage.cpp
20 | buttonspage.h buttonspage.cpp
21 | progresspage.h progresspage.cpp
22 | tablepage.h tablepage.cpp
23 |
24 | circleprogress.h circleprogress.cpp
25 | tabel.h tabel.cpp
26 | util/compositionwindoweffect.h util/compositionwindoweffect.cpp
27 | )
28 |
29 | INCLUDE_DIRECTORIES(
30 | ${PROJECT_SOURCE_DIR}
31 | )
32 |
33 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
34 | qt_add_executable(QT_UI_Simplify
35 | MANUAL_FINALIZATION
36 | ${PROJECT_SOURCES}
37 | res.qrc
38 | qss.qrc
39 | README.md
40 | )
41 | # Define target properties for Android with Qt 6 as:
42 | # set_property(TARGET QT_UI_Simplify APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
43 | # ${CMAKE_CURRENT_SOURCE_DIR}/android)
44 | # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
45 | else()
46 | if(ANDROID)
47 | add_library(QT_UI_Simplify SHARED
48 | ${PROJECT_SOURCES}
49 | )
50 | # Define properties for Android with Qt 5 after find_package() calls as:
51 | # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
52 | else()
53 | add_executable(QT_UI_Simplify
54 | ${PROJECT_SOURCES}
55 | )
56 | endif()
57 | endif()
58 |
59 | target_link_libraries(QT_UI_Simplify PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
60 | user32 dwmapi # win api实现模糊效果
61 | )
62 |
63 | # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
64 | # If you are developing for iOS or macOS you should consider setting an
65 | # explicit, fixed bundle identifier manually though.
66 | if(${QT_VERSION} VERSION_LESS 6.1.0)
67 | set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.QT_UI_Simplify)
68 | endif()
69 | set_target_properties(QT_UI_Simplify PROPERTIES
70 | ${BUNDLE_ID_OPTION}
71 | MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
72 | MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
73 | MACOSX_BUNDLE TRUE
74 | WIN32_EXECUTABLE TRUE
75 | )
76 |
77 | include(GNUInstallDirs)
78 | install(TARGETS QT_UI_Simplify
79 | BUNDLE DESTINATION .
80 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
81 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
82 | )
83 |
84 | if(QT_VERSION_MAJOR EQUAL 6)
85 | qt_finalize_executable(QT_UI_Simplify)
86 | endif()
87 |
--------------------------------------------------------------------------------
/framelesswindow.cpp:
--------------------------------------------------------------------------------
1 | #include "framelesswindow.h"
2 | #include "./ui_framelesswindow.h"
3 | #include "util/compositionwindoweffect.h"
4 |
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | FramelessWindow::FramelessWindow(QWidget *parent)
17 | : QMainWindow(parent)
18 | , ui(new Ui::FramelessWindow)
19 | {
20 | ui->setupUi(this);
21 | // 数据初始化
22 | m_resizePadding = 5;
23 | m_pageIndex = PagesIndex::ButtonsPage;
24 | m_isOnTop = false;
25 |
26 | // 窗口设置
27 | setWindowFlags(Qt::FramelessWindowHint); // 无边框窗口
28 | setAttribute(Qt::WA_TranslucentBackground); // 透明窗口
29 | setWindowIcon(QIcon(":/res/Qt.png")); // 标题图标
30 |
31 | uiStyleInit(); // 初始化ui界面样式
32 | uiConnectInit(); // ui各控件槽函数连接
33 | trayIconInit(); // 托盘图标初始化
34 |
35 | // 设置属性产生win窗体效果 移动到边缘半屏或者最大化
36 | HWND hwnd = (HWND)this->winId();
37 | DWORD style = ::GetWindowLong(hwnd, GWL_STYLE);
38 | ::SetWindowLong(hwnd, GWL_STYLE, style | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CAPTION);
39 |
40 | // 毛玻璃效果
41 | CompositionWindowEffect::setAreoEffect((HWND)(hwnd));
42 | }
43 |
44 | FramelessWindow::~FramelessWindow()
45 | {
46 | delete ui;
47 | }
48 |
49 | void FramelessWindow::setBackgroundColor(QString topColor, QString bottomColor)
50 | {
51 | QFile qss(":/qss/setTheme.qss");
52 | qss.open(QFile::ReadOnly);
53 | QString styleSheet = QString(qss.readAll()).arg(topColor, bottomColor);
54 | qss.close();
55 | ui->centralwidget->setStyleSheet(styleSheet);
56 | }
57 |
58 | void FramelessWindow::setPageIndex(int index)
59 | {
60 | if (index == PagesIndex::SkinPage)
61 | {
62 | if (ui->body->currentIndex() == PagesIndex::SkinPage) setPageIndex(m_pageIndex); // 恢复页面
63 | else ui->body->setCurrentIndex(index); // 打开主题页面
64 | }
65 | else
66 | {
67 | ui->body->setCurrentIndex(index);
68 | m_pageIndex = index;
69 | }
70 | }
71 |
72 | void FramelessWindow::setOnTop()
73 | {
74 | if (m_isOnTop) // 设置为不置顶
75 | {
76 | ui->onTopBtn->setStyleSheet("QPushButton#onTopBtn{border-image: url(:/res/onTopOff.png);}");
77 | ::SetWindowPos(HWND(this->winId()),HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
78 | }
79 | else // 设置为置顶
80 | {
81 | ui->onTopBtn->setStyleSheet("QPushButton#onTopBtn{border-image: url(:/res/onTopOn.png);}");
82 | ::SetWindowPos(HWND(this->winId()),HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
83 | }
84 |
85 | m_isOnTop = !m_isOnTop;
86 | }
87 |
88 | void FramelessWindow::uiStyleInit()
89 | {
90 | // 窗口初始化
91 | ui->body->setCurrentIndex(PagesIndex::ButtonsPage);
92 | ui->titleImage->setPixmap(QPixmap(":/res/title.png").scaled(200, 50, Qt::KeepAspectRatio, Qt::SmoothTransformation));
93 | setBackgroundColor("#c0444444", "#c0444444");
94 |
95 | // 控件资源初始化
96 | QFile qss(":/qss/windowControl.qss");
97 | qss.open(QFile::ReadOnly);
98 | QString styleSheet = qss.readAll();
99 | qss.close();
100 | setStyleSheet(styleSheet);
101 |
102 | // 窗口置顶按钮
103 | ui->onTopBtn->setStyleSheet("QPushButton#onTopBtn{border-image: url(:/res/onTopOff.png);}");
104 | }
105 |
106 | void FramelessWindow::uiConnectInit()
107 | {
108 | // 主题
109 | connect(ui->skinPage, &SkinPage::selectSkin, this, &FramelessWindow::setBackgroundColor);
110 | // 标题栏
111 | connect(ui->minBtn, &QPushButton::clicked, this, &FramelessWindow::showMinimized);
112 | // connect(ui->closeBtn, &QPushButton::clicked, this, &FramelessWindow::close);
113 | connect(ui->closeBtn, &QPushButton::clicked, this, [&](){
114 | QMessageBox quitBox;
115 | quitBox.setWindowTitle("退出");
116 | quitBox.setText("最小化到系统托盘或退出程序");
117 | quitBox.addButton("最小化", QMessageBox::ActionRole);
118 | quitBox.addButton("关闭", QMessageBox::ActionRole);
119 | quitBox.setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
120 |
121 | quitBox.setStyleSheet("QMessageBox,QPushButton{"
122 | "color: white;"
123 | "background-color: #c0444444;"
124 | "border: 1px solid white;"
125 | "border-color: white;"
126 | "}"
127 | "QLabel{"
128 | "color: white;"
129 | "}");
130 |
131 | int ret = quitBox.exec();
132 | if (ret == 0) hide();
133 | else close();
134 | });
135 | // 侧边栏
136 | connect(ui->bilibiliBtn, &QPushButton::clicked, this, [&](){QDesktopServices::openUrl(QUrl("https://space.bilibili.com/387426555"));});
137 | connect(ui->buttonsPageBtn, &QPushButton::clicked, this, [&](){this->setPageIndex(PagesIndex::ButtonsPage);});
138 | connect(ui->progressPageBtn, &QPushButton::clicked, this, [&](){this->setPageIndex(PagesIndex::ProgressPage);});
139 | connect(ui->tablePageBtn, &QPushButton::clicked, this, [&](){this->setPageIndex(PagesIndex::TablePage);});
140 | connect(ui->skinBtn, &QPushButton::clicked, this, [&](){this->setPageIndex(PagesIndex::SkinPage);});
141 | connect(ui->onTopBtn, &QPushButton::clicked, this, &FramelessWindow::setOnTop);
142 | }
143 |
144 | void FramelessWindow::trayIconInit()
145 | {
146 | // 显示
147 | QAction* showAction = new QAction(QStringLiteral("显示"));
148 | connect(showAction, &QAction::triggered, this, &FramelessWindow::show);
149 | // 退出
150 | QAction* exitAction = new QAction(QStringLiteral("退出"));
151 | connect(exitAction , &QAction::triggered, this, &QApplication::exit);
152 |
153 | // 初始化菜单并添加项
154 | QMenu* trayMenu = new QMenu(this);
155 | trayMenu->addAction(showAction);
156 | trayMenu->addAction(exitAction );
157 |
158 | //创建一个系统托盘
159 | m_trayIcon = new QSystemTrayIcon(this);
160 | m_trayIcon->setIcon(QIcon(":/res/Qt.png"));
161 | m_trayIcon->setContextMenu(trayMenu);
162 | m_trayIcon->show();
163 | }
164 |
165 | bool FramelessWindow::nativeEvent(const QByteArray &eventType, void *message, qintptr *result)
166 | {
167 | if (eventType != "windows_generic_MSG") return QWidget::nativeEvent(eventType, message, result);
168 |
169 | MSG *msg = static_cast(message);
170 |
171 | switch (msg->message)
172 | {
173 | case WM_NCCALCSIZE: // 去掉win窗体效果的标题栏
174 | {
175 | *result = 0;
176 | return true;
177 | }
178 |
179 | case WM_NCHITTEST: // 缩放和移动
180 | {
181 | QPoint pos = mapFromGlobal(QCursor().pos()); // 计算鼠标在窗口中的坐标
182 |
183 | //判断当前鼠标位置在哪个区域
184 | bool left = pos.x() < m_resizePadding;
185 | bool right = pos.x() > width() - m_resizePadding;
186 | bool top = pos.y() < m_resizePadding;
187 | bool bottom = pos.y() > height() - m_resizePadding;
188 |
189 | //鼠标移动到四个角,这个消息是当鼠标移动或者有鼠标键按下时候发出的
190 | *result = 0;
191 |
192 | if (left) *result = HTLEFT;
193 | else if (right) *result = HTRIGHT;
194 | else if (top) *result = HTTOP;
195 | else if (bottom) *result = HTBOTTOM;
196 |
197 | if (0 != *result) // 处理拉伸
198 | {
199 | return true;
200 | }
201 |
202 | if (ui->titleImage->geometry().contains(pos)) // 鼠标在标题栏处时拖动产生半屏全屏效果
203 | // if (ui->TitleImage->rect().contains(pos))
204 | {
205 | *result = HTCAPTION;
206 | return true;
207 | }
208 | }
209 |
210 | default:
211 | break;
212 | }
213 |
214 | return QWidget::nativeEvent(eventType, message, result);
215 | }
216 |
--------------------------------------------------------------------------------
/framelesswindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | FramelessWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 650
11 |
12 |
13 |
14 | FramelessWindow
15 |
16 |
17 |
18 |
19 |
20 |
21 | -
22 |
23 |
-
24 |
25 |
26 |
27 | 50
28 | 50
29 |
30 |
31 |
32 |
33 | 50
34 | 50
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | -
46 |
47 |
48 | true
49 |
50 |
51 |
52 | 200
53 | 50
54 |
55 |
56 |
57 |
58 | 16777215
59 | 50
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
70 |
71 |
72 |
73 | -
74 |
75 |
76 |
77 | 50
78 | 50
79 |
80 |
81 |
82 |
83 | 50
84 | 50
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | -
93 |
94 |
95 |
96 | 50
97 | 50
98 |
99 |
100 |
101 |
102 | 50
103 | 50
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 | -
115 |
116 |
117 |
118 | 50
119 | 50
120 |
121 |
122 |
123 |
124 | 50
125 | 50
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | -
139 |
140 |
-
141 |
142 |
-
143 |
144 |
145 |
146 | 50
147 | 50
148 |
149 |
150 |
151 |
152 | 50
153 | 50
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 | -
165 |
166 |
167 |
168 | 50
169 | 50
170 |
171 |
172 |
173 |
174 | 50
175 | 50
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 | -
187 |
188 |
189 |
190 | 50
191 | 50
192 |
193 |
194 |
195 |
196 | 50
197 | 50
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 | -
206 |
207 |
208 | Qt::Vertical
209 |
210 |
211 |
212 | 20
213 | 40
214 |
215 |
216 |
217 |
218 | -
219 |
220 |
221 |
222 | 50
223 | 50
224 |
225 |
226 |
227 |
228 | 50
229 | 50
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 | -
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 | SkinPage
258 | QWidget
259 |
260 | 1
261 |
262 |
263 | ButtonsPage
264 | QWidget
265 |
266 | 1
267 |
268 |
269 | ProgressPage
270 | QWidget
271 |
272 | 1
273 |
274 |
275 | TablePage
276 | QWidget
277 |
278 | 1
279 |
280 |
281 |
282 |
283 |
284 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------