forked from ghostfox/qyouradio
Restructure project
This commit is contained in:
82
qyouradio/QYRComponents/.gitignore
vendored
Executable file
82
qyouradio/QYRComponents/.gitignore
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
# This file is used to ignore files which are generated
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.a
|
||||
*.core
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
*.qbs.user*
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
*.dll
|
||||
*.exe
|
||||
|
||||
# Directories with generated files
|
||||
.moc/
|
||||
.obj/
|
||||
.pch/
|
||||
.rcc/
|
||||
.uic/
|
||||
/build*/
|
||||
10
qyouradio/QYRComponents/ApplicationWindow.qml
Normal file
10
qyouradio/QYRComponents/ApplicationWindow.qml
Normal file
@@ -0,0 +1,10 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
|
||||
QC.ApplicationWindow {
|
||||
visible: true
|
||||
|
||||
background: Rectangle {
|
||||
color: Colors.background
|
||||
}
|
||||
}
|
||||
20
qyouradio/QYRComponents/Button.qml
Executable file
20
qyouradio/QYRComponents/Button.qml
Executable file
@@ -0,0 +1,20 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
|
||||
QC.Button {
|
||||
// highlighted: true
|
||||
background: Rectangle {
|
||||
color: hovered ? Colors.primaryAlt : Colors.primary
|
||||
radius: 5
|
||||
}
|
||||
|
||||
// width: player.playing ? 60 : 56
|
||||
implicitHeight: 36
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
contentItem.color = Colors.text;
|
||||
font.family = Colors.fontFamily;
|
||||
font.pointSize = Colors.fontSize.base;
|
||||
}
|
||||
}
|
||||
37
qyouradio/QYRComponents/CMakeLists.txt
Executable file
37
qyouradio/QYRComponents/CMakeLists.txt
Executable file
@@ -0,0 +1,37 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(QYRComponents VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
|
||||
|
||||
set_source_files_properties(Colors.qml
|
||||
PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
|
||||
|
||||
qt_add_library(QYRComponents STATIC)
|
||||
qt_add_qml_module(QYRComponents
|
||||
URI QYRComponents
|
||||
VERSION 1.0
|
||||
RESOURCE_PREFIX /qt/qml
|
||||
QML_FILES Button.qml
|
||||
QML_FILES Colors.qml
|
||||
QML_FILES ApplicationWindow.qml
|
||||
QML_FILES CheckBox.qml
|
||||
QML_FILES Slider.qml
|
||||
# SOURCES qyrcomponents.cpp qyrcomponents.h
|
||||
)
|
||||
|
||||
set_target_properties(QYRComponents PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
target_compile_definitions(QYRComponents
|
||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||
target_link_libraries(QYRComponents
|
||||
PRIVATE Qt6::Quick)
|
||||
|
||||
target_include_directories(QYRComponents PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
13
qyouradio/QYRComponents/CheckBox.qml
Normal file
13
qyouradio/QYRComponents/CheckBox.qml
Normal file
@@ -0,0 +1,13 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
|
||||
QC.CheckBox {
|
||||
contentItem: Rectangle {
|
||||
radius: 2
|
||||
color: parent.checked ? (parent.hovered ? Colors.primaryAlt : Colors.primary) : "#fff"
|
||||
border.color: parent.checked ? (parent.hovered ? Colors.primaryAlt : Colors.primary) : "#fff"
|
||||
border.width: 1
|
||||
implicitWidth: 14
|
||||
implicitHeight: 14
|
||||
}
|
||||
}
|
||||
44
qyouradio/QYRComponents/Colors.qml
Normal file
44
qyouradio/QYRComponents/Colors.qml
Normal file
@@ -0,0 +1,44 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick 6.8
|
||||
|
||||
Item {
|
||||
QtObject {
|
||||
id: themes
|
||||
|
||||
readonly property var light: {
|
||||
text: "#1f1f1f"
|
||||
primary: "#007bff"
|
||||
primaryAlt: "#0056b3"
|
||||
background: "#f4f4f4"
|
||||
}
|
||||
|
||||
readonly property var dark: {
|
||||
text: "#f4f4f4"
|
||||
primary: "#007bff"
|
||||
primaryAlt: "#0056b3"
|
||||
background: "#1f1f1f"
|
||||
}
|
||||
}
|
||||
|
||||
readonly property string fontFamily: "Arial"
|
||||
readonly property var fontSize: {
|
||||
h1: 32
|
||||
h2: 24
|
||||
h3: 18
|
||||
h4: 16
|
||||
h5: 13
|
||||
h6: 10
|
||||
p: 12
|
||||
base: 12
|
||||
}
|
||||
|
||||
property var currentTheme: themes.dark
|
||||
//property alias themes: themes
|
||||
|
||||
readonly property string text: currentTheme.text
|
||||
readonly property string primary: currentTheme.primary
|
||||
readonly property string primaryAlt: currentTheme.primaryAlt
|
||||
readonly property string background: currentTheme.background
|
||||
|
||||
}
|
||||
38
qyouradio/QYRComponents/Slider.qml
Normal file
38
qyouradio/QYRComponents/Slider.qml
Normal file
@@ -0,0 +1,38 @@
|
||||
import QtQuick 6.8
|
||||
import QtQuick.Controls 6.8 as QC
|
||||
|
||||
QC.Slider {
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
implicitWidth: 130
|
||||
implicitHeight: 20
|
||||
|
||||
OpacityAnimator on opacity{
|
||||
from: 0.7
|
||||
to: 1
|
||||
duration: 200
|
||||
target: parent
|
||||
running: this.hovered
|
||||
}
|
||||
OpacityAnimator on opacity{
|
||||
from: 1
|
||||
to: 0.7
|
||||
duration: 200
|
||||
target: parent
|
||||
running: !this.hovered
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "#555"
|
||||
radius: 5
|
||||
}
|
||||
|
||||
handle: Rectangle {
|
||||
x: this.leftPadding + this.visualPosition * (this.availableWidth - width)
|
||||
y: this.topPadding + this.availableHeight / 2 - height / 2
|
||||
width: 20
|
||||
height: 20
|
||||
radius: 10
|
||||
color: Colors.primary
|
||||
}
|
||||
}
|
||||
4
qyouradio/QYRComponents/qmldir
Executable file
4
qyouradio/QYRComponents/qmldir
Executable file
@@ -0,0 +1,4 @@
|
||||
module QYRComponents
|
||||
|
||||
Button 1.0 Button.qml
|
||||
singleton Colors 1.0 Colors.qml
|
||||
27
qyouradio/QYRComponents/qyrcomponents.cpp
Executable file
27
qyouradio/QYRComponents/qyrcomponents.cpp
Executable file
@@ -0,0 +1,27 @@
|
||||
#include "qyrcomponents.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
QYRComponents::QYRComponents(QQuickItem *parent)
|
||||
: QQuickPaintedItem(parent)
|
||||
{
|
||||
// By default, QQuickItem does not draw anything. If you subclass
|
||||
// QQuickItem to create a visual item, you will need to uncomment the
|
||||
// following line and re-implement updatePaintNode()
|
||||
|
||||
// setFlag(ItemHasContents, true);
|
||||
}
|
||||
|
||||
void QYRComponents::paint(QPainter *painter)
|
||||
{
|
||||
QPen pen(QColorConstants::Red, 2);
|
||||
QBrush brush(QColorConstants::Red);
|
||||
|
||||
painter->setPen(pen);
|
||||
painter->setBrush(brush);
|
||||
painter->drawRect(0, 0, 100, 100);
|
||||
}
|
||||
|
||||
QYRComponents::~QYRComponents()
|
||||
{
|
||||
}
|
||||
17
qyouradio/QYRComponents/qyrcomponents.h
Executable file
17
qyouradio/QYRComponents/qyrcomponents.h
Executable file
@@ -0,0 +1,17 @@
|
||||
#ifndef QYRCOMPONENTS_H
|
||||
#define QYRCOMPONENTS_H
|
||||
|
||||
#include <QtQuick/QQuickPaintedItem>
|
||||
|
||||
class QYRComponents : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_DISABLE_COPY(QYRComponents)
|
||||
public:
|
||||
explicit QYRComponents(QQuickItem *parent = nullptr);
|
||||
void paint(QPainter *painter) override;
|
||||
~QYRComponents() override;
|
||||
};
|
||||
|
||||
#endif // QYRCOMPONENTS_H
|
||||
Reference in New Issue
Block a user