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})
|
||||
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)
|
||||
# Silence a compiler warning caused by the Chinese comments in the source file.
|
||||
target_compile_options(QQPlayer PRIVATE -utf-8)
|
||||
endif()
|
||||
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;
|
||||
qmlRegisterType<FramelessQuickHelper>("wangwenx190.Utils", 1, 0,
|
||||
"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(
|
||||
&engine, &QQmlApplicationEngine::objectCreated, &application,
|
||||
[&mainQmlUrl, &connection](QObject *object, const QUrl &url) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 45
|
||||
implicitHeight: 30
|
||||
|
@ -12,12 +12,12 @@ Button {
|
|||
ToolTip.text: qsTr("Close")
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
anchors.fill: control
|
||||
source: "qrc:/images/button_close_white.svg"
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
visible: button.down || button.hovered
|
||||
color: button.down ? "#8c0a15" : (button.hovered ? "#e81123" : "transparent")
|
||||
visible: control.down || control.hovered
|
||||
color: control.down ? "#8c0a15" : (control.hovered ? "#e81123" : "transparent")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 75
|
||||
implicitHeight: 15
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/main_menu_blue.png" : "qrc:/images/main_menu_white.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/main_menu_blue.png" : "qrc:/images/main_menu_white.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 45
|
||||
implicitHeight: 30
|
||||
|
@ -14,12 +14,12 @@ Button {
|
|||
ToolTip.text: maximized ? qsTr("Restore") : qsTr("Maximize")
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
anchors.fill: control
|
||||
source: maximized ? "qrc:/images/button_restore_white.svg" : "qrc:/images/button_maximize_white.svg"
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
visible: button.down || button.hovered
|
||||
color: button.down ? "#808080" : (button.hovered ? "#c7c7c7" : "transparent")
|
||||
visible: control.down || control.hovered
|
||||
color: control.down ? "#808080" : (control.hovered ? "#c7c7c7" : "transparent")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 45
|
||||
implicitHeight: 30
|
||||
|
@ -12,12 +12,12 @@ Button {
|
|||
ToolTip.text: qsTr("Minimize")
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
anchors.fill: control
|
||||
source: "qrc:/images/button_minimize_white.svg"
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
visible: button.down || button.hovered
|
||||
color: button.down ? "#808080" : (button.hovered ? "#c7c7c7" : "transparent")
|
||||
visible: control.down || control.hovered
|
||||
color: control.down ? "#808080" : (control.hovered ? "#c7c7c7" : "transparent")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 16
|
||||
implicitHeight: 14
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/next_blue_light.png" : "qrc:/images/next_blue.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/next_blue_light.png" : "qrc:/images/next_blue.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 187
|
||||
implicitHeight: 50
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/open_file_blue.png" : "qrc:/images/open_file_white.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/open_file_blue.png" : "qrc:/images/open_file_white.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 45
|
||||
implicitHeight: 45
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/play_blue_light.png" : "qrc:/images/play_blue.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/play_blue_light.png" : "qrc:/images/play_blue.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 16
|
||||
implicitHeight: 14
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/previous_blue_light.png" : "qrc:/images/previous_blue.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/previous_blue_light.png" : "qrc:/images/previous_blue.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -18,6 +18,7 @@ Slider {
|
|||
property int handleWidth: 14
|
||||
property int handleBorderWidth: 0
|
||||
property color handleBorderColor: "transparent"
|
||||
property bool handleVisibility: true
|
||||
|
||||
background: Rectangle {
|
||||
x: 0
|
||||
|
@ -48,6 +49,7 @@ Slider {
|
|||
}
|
||||
|
||||
handle: Rectangle {
|
||||
visible: control.handleVisibility
|
||||
x: control.visualPosition * (control.availableWidth - width)
|
||||
y: control.availableHeight / 2 - height / 2
|
||||
implicitWidth: control.handleWidth
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 14
|
||||
implicitHeight: 14
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/stop_blue_light.png" : "qrc:/images/stop_blue.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/stop_blue_light.png" : "qrc:/images/stop_blue.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -2,15 +2,15 @@ import QtQuick 2.15
|
|||
import QtQuick.Controls 2.15
|
||||
|
||||
Button {
|
||||
id: button
|
||||
id: control
|
||||
|
||||
implicitWidth: 18
|
||||
implicitHeight: 14
|
||||
|
||||
contentItem: Image {
|
||||
anchors.fill: parent
|
||||
source: button.down
|
||||
|| button.hovered ? "qrc:/images/volume_blue_light.png" : "qrc:/images/volume_blue.png"
|
||||
anchors.fill: control
|
||||
source: control.down
|
||||
|| control.hovered ? "qrc:/images/volume_blue_light.png" : "qrc:/images/volume_blue.png"
|
||||
}
|
||||
|
||||
background: Item {}
|
||||
|
|
|
@ -9,6 +9,8 @@ Window {
|
|||
height: 540
|
||||
title: qsTr("QQ Player")
|
||||
|
||||
property color themeColor: "#111111"
|
||||
|
||||
FramelessHelper {
|
||||
id: framelessHelper
|
||||
}
|
||||
|
@ -16,7 +18,7 @@ Window {
|
|||
Rectangle {
|
||||
id: titleBar
|
||||
height: framelessHelper.titleBarHeight
|
||||
color: "#111111"
|
||||
color: window.themeColor
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
@ -94,7 +96,7 @@ Window {
|
|||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
color: "#111111"
|
||||
color: window.themeColor
|
||||
|
||||
ProgressSlider {
|
||||
id: progressSlider
|
||||
|
|
Loading…
Reference in New Issue