forked from github_mirror/framelesshelper
Minor tweaks of the example project.
Mainly add a build script. Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
cd8e855484
commit
3a9dddb9c8
|
@ -37,9 +37,15 @@ else()
|
||||||
list(APPEND source_files ${qml_files})
|
list(APPEND source_files ${qml_files})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(QQPlayer ${source_files})
|
if(WIN32)
|
||||||
|
# Without WIN32, a console window will show.
|
||||||
|
add_executable(QQPlayer WIN32 ${source_files})
|
||||||
|
else()
|
||||||
|
add_executable(QQPlayer ${source_files})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
# Silence a compiler warning caused by the Chinese comments in the source file.
|
||||||
target_compile_options(QQPlayer PRIVATE -utf-8)
|
target_compile_options(QQPlayer PRIVATE -utf-8)
|
||||||
endif()
|
endif()
|
||||||
target_compile_definitions(QQPlayer PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
target_compile_definitions(QQPlayer PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
@echo off
|
||||||
|
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||||
|
call "%SystemDrive%\Qt\5.15.0\msvc2019_64\bin\qtenv2.bat"
|
||||||
|
cd /d "%~dp0"
|
||||||
|
if exist build rd /s /q build
|
||||||
|
md build
|
||||||
|
cd build
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin -GNinja ..
|
||||||
|
cmake --build .
|
||||||
|
windeployqt --force --no-translations --no-system-d3d-compiler --no-virtualkeyboard --no-compiler-runtime --no-angle --no-opengl-sw --dir "%~dp0build\bin\qml" --libdir "%~dp0build\bin" --plugindir "%~dp0build\bin\plugins" --qmldir "%~dp0resources\qml" "%~dp0build\bin\QQPlayer.exe"
|
||||||
|
cd /d "%~dp0"
|
||||||
|
exit /b
|
|
@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
qmlRegisterType<FramelessQuickHelper>("wangwenx190.Utils", 1, 0,
|
qmlRegisterType<FramelessQuickHelper>("wangwenx190.Utils", 1, 0,
|
||||||
"FramelessHelper");
|
"FramelessHelper");
|
||||||
const QUrl mainQmlUrl(QString::fromUtf8("qrc:///qml/main.qml"));
|
const QUrl mainQmlUrl(QString::fromUtf8("qrc:/qml/main.qml"));
|
||||||
const QMetaObject::Connection connection = QObject::connect(
|
const QMetaObject::Connection connection = QObject::connect(
|
||||||
&engine, &QQmlApplicationEngine::objectCreated, &application,
|
&engine, &QQmlApplicationEngine::objectCreated, &application,
|
||||||
[&mainQmlUrl, &connection](QObject *object, const QUrl &url) {
|
[&mainQmlUrl, &connection](QObject *object, const QUrl &url) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 45
|
implicitWidth: 45
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
@ -12,12 +12,12 @@ Button {
|
||||||
ToolTip.text: qsTr("Close")
|
ToolTip.text: qsTr("Close")
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: "qrc:/images/button_close_white.svg"
|
source: "qrc:/images/button_close_white.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
visible: button.down || button.hovered
|
visible: control.down || control.hovered
|
||||||
color: button.down ? "#8c0a15" : (button.hovered ? "#e81123" : "transparent")
|
color: control.down ? "#8c0a15" : (control.hovered ? "#e81123" : "transparent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 75
|
implicitWidth: 75
|
||||||
implicitHeight: 15
|
implicitHeight: 15
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/main_menu_blue.png" : "qrc:/images/main_menu_white.png"
|
|| control.hovered ? "qrc:/images/main_menu_blue.png" : "qrc:/images/main_menu_white.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 45
|
implicitWidth: 45
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
@ -14,12 +14,12 @@ Button {
|
||||||
ToolTip.text: maximized ? qsTr("Restore") : qsTr("Maximize")
|
ToolTip.text: maximized ? qsTr("Restore") : qsTr("Maximize")
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: maximized ? "qrc:/images/button_restore_white.svg" : "qrc:/images/button_maximize_white.svg"
|
source: maximized ? "qrc:/images/button_restore_white.svg" : "qrc:/images/button_maximize_white.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
visible: button.down || button.hovered
|
visible: control.down || control.hovered
|
||||||
color: button.down ? "#808080" : (button.hovered ? "#c7c7c7" : "transparent")
|
color: control.down ? "#808080" : (control.hovered ? "#c7c7c7" : "transparent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 45
|
implicitWidth: 45
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
|
@ -12,12 +12,12 @@ Button {
|
||||||
ToolTip.text: qsTr("Minimize")
|
ToolTip.text: qsTr("Minimize")
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: "qrc:/images/button_minimize_white.svg"
|
source: "qrc:/images/button_minimize_white.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
visible: button.down || button.hovered
|
visible: control.down || control.hovered
|
||||||
color: button.down ? "#808080" : (button.hovered ? "#c7c7c7" : "transparent")
|
color: control.down ? "#808080" : (control.hovered ? "#c7c7c7" : "transparent")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 16
|
implicitWidth: 16
|
||||||
implicitHeight: 14
|
implicitHeight: 14
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/next_blue_light.png" : "qrc:/images/next_blue.png"
|
|| control.hovered ? "qrc:/images/next_blue_light.png" : "qrc:/images/next_blue.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 187
|
implicitWidth: 187
|
||||||
implicitHeight: 50
|
implicitHeight: 50
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/open_file_blue.png" : "qrc:/images/open_file_white.png"
|
|| control.hovered ? "qrc:/images/open_file_blue.png" : "qrc:/images/open_file_white.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 45
|
implicitWidth: 45
|
||||||
implicitHeight: 45
|
implicitHeight: 45
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/play_blue_light.png" : "qrc:/images/play_blue.png"
|
|| control.hovered ? "qrc:/images/play_blue_light.png" : "qrc:/images/play_blue.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 16
|
implicitWidth: 16
|
||||||
implicitHeight: 14
|
implicitHeight: 14
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/previous_blue_light.png" : "qrc:/images/previous_blue.png"
|
|| control.hovered ? "qrc:/images/previous_blue_light.png" : "qrc:/images/previous_blue.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -18,6 +18,7 @@ Slider {
|
||||||
property int handleWidth: 14
|
property int handleWidth: 14
|
||||||
property int handleBorderWidth: 0
|
property int handleBorderWidth: 0
|
||||||
property color handleBorderColor: "transparent"
|
property color handleBorderColor: "transparent"
|
||||||
|
property bool handleVisibility: true
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
x: 0
|
x: 0
|
||||||
|
@ -48,6 +49,7 @@ Slider {
|
||||||
}
|
}
|
||||||
|
|
||||||
handle: Rectangle {
|
handle: Rectangle {
|
||||||
|
visible: control.handleVisibility
|
||||||
x: control.visualPosition * (control.availableWidth - width)
|
x: control.visualPosition * (control.availableWidth - width)
|
||||||
y: control.availableHeight / 2 - height / 2
|
y: control.availableHeight / 2 - height / 2
|
||||||
implicitWidth: control.handleWidth
|
implicitWidth: control.handleWidth
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 14
|
implicitWidth: 14
|
||||||
implicitHeight: 14
|
implicitHeight: 14
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/stop_blue_light.png" : "qrc:/images/stop_blue.png"
|
|| control.hovered ? "qrc:/images/stop_blue_light.png" : "qrc:/images/stop_blue.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: control
|
||||||
|
|
||||||
implicitWidth: 18
|
implicitWidth: 18
|
||||||
implicitHeight: 14
|
implicitHeight: 14
|
||||||
|
|
||||||
contentItem: Image {
|
contentItem: Image {
|
||||||
anchors.fill: parent
|
anchors.fill: control
|
||||||
source: button.down
|
source: control.down
|
||||||
|| button.hovered ? "qrc:/images/volume_blue_light.png" : "qrc:/images/volume_blue.png"
|
|| control.hovered ? "qrc:/images/volume_blue_light.png" : "qrc:/images/volume_blue.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
|
|
|
@ -9,6 +9,8 @@ Window {
|
||||||
height: 540
|
height: 540
|
||||||
title: qsTr("QQ Player")
|
title: qsTr("QQ Player")
|
||||||
|
|
||||||
|
property color themeColor: "#111111"
|
||||||
|
|
||||||
FramelessHelper {
|
FramelessHelper {
|
||||||
id: framelessHelper
|
id: framelessHelper
|
||||||
}
|
}
|
||||||
|
@ -16,7 +18,7 @@ Window {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: titleBar
|
id: titleBar
|
||||||
height: framelessHelper.titleBarHeight
|
height: framelessHelper.titleBarHeight
|
||||||
color: "#111111"
|
color: window.themeColor
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -94,7 +96,7 @@ Window {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
color: "#111111"
|
color: window.themeColor
|
||||||
|
|
||||||
ProgressSlider {
|
ProgressSlider {
|
||||||
id: progressSlider
|
id: progressSlider
|
||||||
|
|
Loading…
Reference in New Issue