Skip to content

Commit aca1b4d

Browse files
committed
Завершена работа с функцией "Релаксация" и "О приложении".
1 parent dab984c commit aca1b4d

File tree

12 files changed

+222
-31
lines changed

12 files changed

+222
-31
lines changed

qml-other/funcionality/FuncDisplay.qml

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,6 @@ Rectangle {
66
color: colorTh.base
77
property int num_menu: 0
88

9-
Image {
10-
id: backBut
11-
source: "qrc:/resources/" + colorTh.icon_dir + "/arrow-menu.png"
12-
width: parent.width * 0.14
13-
height: width
14-
anchors.left: parent.left
15-
anchors.top: parent.top
16-
anchors.topMargin: width * 0.3
17-
fillMode: Image.PreserveAspectFit
18-
19-
MouseArea {
20-
anchors.fill: parent
21-
onClicked: {
22-
hideMenu()
23-
}
24-
}
25-
}
26-
27-
Text {
28-
id: titleText
29-
text: getTitle(num_menu)
30-
font.family: "Segoe UI Semibold"
31-
verticalAlignment: Text.AlignVCenter
32-
horizontalAlignment: Text.AlignHCenter
33-
font.pixelSize: parent.width * 0.07
34-
color: colorTh.contr
35-
anchors.horizontalCenter: parent.horizontalCenter
36-
anchors.verticalCenter: backBut.verticalCenter
37-
}
38-
399
states: [
4010
State {
4111
name: "closing"
@@ -109,7 +79,25 @@ Rectangle {
10979
anchors.horizontalCenter: parent.horizontalCenter
11080
width: parent.width
11181
height: parent.height - (titleText.y + titleText.height)
112-
visible: num_menu != 0
82+
visible: num_menu > -4 && num_menu != 0 && num_menu < 5
83+
}
84+
85+
MusicPlayer {
86+
id: funcMusic
87+
anchors.top: backBut.bottom
88+
anchors.horizontalCenter: parent.horizontalCenter
89+
width: parent.width
90+
height: parent.height - (titleText.y + titleText.height)
91+
visible: num_menu == -4
92+
}
93+
94+
AboutApp {
95+
id: funcAbout
96+
anchors.top: backBut.bottom
97+
anchors.horizontalCenter: parent.horizontalCenter
98+
width: parent.width
99+
height: parent.height - (titleText.y + titleText.height)
100+
visible: num_menu == 5
113101
}
114102

115103

@@ -127,6 +115,36 @@ Rectangle {
127115
}
128116
}
129117

118+
Image {
119+
id: backBut
120+
source: "qrc:/resources/" + colorTh.icon_dir + "/arrow-menu.png"
121+
width: parent.width * 0.14
122+
height: width
123+
anchors.left: parent.left
124+
anchors.top: parent.top
125+
anchors.topMargin: width * 0.3
126+
fillMode: Image.PreserveAspectFit
127+
128+
MouseArea {
129+
anchors.fill: parent
130+
onClicked: {
131+
hideMenu()
132+
}
133+
}
134+
}
135+
136+
Text {
137+
id: titleText
138+
text: getTitle(num_menu)
139+
font.family: "Segoe UI Semibold"
140+
verticalAlignment: Text.AlignVCenter
141+
horizontalAlignment: Text.AlignHCenter
142+
font.pixelSize: parent.width * 0.07
143+
color: colorTh.contr
144+
anchors.horizontalCenter: parent.horizontalCenter
145+
anchors.verticalCenter: backBut.verticalCenter
146+
}
147+
130148
Component.onCompleted: {
131149
personPanel.clicked.connect(showMenu)
132150
toDoPanel.clicked.connect(showMenu)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import QtQuick 2.0
2+
3+
Item {
4+
5+
Image {
6+
id: avatar
7+
source: "qrc:/resources/whiteTh/avatar.png"
8+
width: parent.width * 0.25
9+
anchors.horizontalCenter: parent.horizontalCenter
10+
anchors.top: parent.top
11+
anchors.topMargin: height * 0.2
12+
height: width
13+
fillMode: Image.PreserveAspectFit
14+
}
15+
16+
Text {
17+
id: sorryText
18+
text: qsTr("Приложение \"Антидепрессия\"\nversion: 0.1\nРазработано в рамках уч. практики\nРазработчик:\nВоронцов Сергей")
19+
font.family: "Segoe UI Semibold"
20+
verticalAlignment: Text.AlignVCenter
21+
horizontalAlignment: Text.AlignHCenter
22+
font.pixelSize: parent.width * 0.05
23+
color: colorTh.contr
24+
anchors.horizontalCenter: parent.horizontalCenter
25+
anchors.top: avatar.bottom
26+
anchors.bottomMargin: height * 0.2
27+
}
28+
29+
Image {
30+
id: git
31+
source: "qrc:/resources/" + colorTh.icon_dir + "/git.png"
32+
width: parent.width * 0.15
33+
anchors.horizontalCenter: parent.horizontalCenter
34+
anchors.top: sorryText.bottom
35+
anchors.topMargin: height * 0.2
36+
height: width
37+
fillMode: Image.PreserveAspectFit
38+
39+
MouseArea {
40+
anchors.fill: parent
41+
onClicked: Qt.openUrlExternally("https://github.com/Algorithm0/Lab")
42+
}
43+
}
44+
45+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,119 @@
11
import QtQuick 2.0
2+
import QtMultimedia 5.12
23

34
Item {
45

6+
Text {
7+
id: sorryText
8+
text: qsTr("Постарайтесь расслабиться.\nПо возможности используйте\nнаушники и\nзакройте глаза")
9+
font.family: "Segoe UI Semibold"
10+
verticalAlignment: Text.AlignVCenter
11+
horizontalAlignment: Text.AlignHCenter
12+
font.pixelSize: parent.width * 0.05
13+
color: colorTh.contr
14+
anchors.horizontalCenter: parent.horizontalCenter
15+
anchors.top: parent.top
16+
anchors.topMargin: height/5
17+
}
18+
19+
Audio {
20+
id: playMusic
21+
onPlaying: {
22+
playBut.visible = false
23+
stopBut.visible = true
24+
animation.paused = false
25+
}
26+
onStopped: {
27+
if (userStoped) {
28+
playBut.visible = true
29+
stopBut.visible = false
30+
}
31+
else {
32+
source = randMusic()
33+
play()
34+
}
35+
animation.paused = true
36+
}
37+
}
38+
39+
property bool userStoped: true
40+
41+
Image {
42+
id: playBut
43+
source: "qrc:/resources/" + colorTh.icon_dir + "/play.png"
44+
width: parent.width * 0.14
45+
height: width
46+
anchors.centerIn: parent
47+
fillMode: Image.PreserveAspectFit
48+
49+
MouseArea {
50+
anchors.fill: parent
51+
onClicked: {
52+
userStoped = false
53+
playMusic.source = randMusic()
54+
playMusic.play()
55+
}
56+
}
57+
}
58+
59+
Image {
60+
id: stopBut
61+
source: "qrc:/resources/" + colorTh.icon_dir + "/stop.png"
62+
width: parent.width * 0.14
63+
height: width
64+
anchors.centerIn: parent
65+
fillMode: Image.PreserveAspectFit
66+
visible: false
67+
68+
MouseArea {
69+
anchors.fill: parent
70+
onClicked: {
71+
userStoped = true
72+
playMusic.stop()
73+
}
74+
}
75+
}
76+
77+
78+
AnimatedImage {
79+
id: animation
80+
source: "qrc:/resources/music.gif"
81+
anchors.bottom: parent.bottom
82+
anchors.horizontalCenter: parent.horizontalCenter
83+
width: parent.width
84+
fillMode: Image.PreserveAspectFit
85+
paused: true
86+
}
87+
88+
Rectangle {
89+
color: colorTh.shadow
90+
anchors.fill: animation
91+
visible: colorTh.state == "black"
92+
}
93+
94+
Rectangle {
95+
id: baseToDo
96+
color: colorTh.base
97+
width: parent.width
98+
height: animation.height * 0.4
99+
anchors.verticalCenter: animation.top
100+
anchors.horizontalCenter: parent.horizontalCenter
101+
radius: 50
102+
visible: colorTh.state == "black"
103+
}
104+
105+
function randMusic () {
106+
var rd = Math.random()
107+
if (rd < 0.2)
108+
return "qrc:/resources/RelaxMusic/Enigma - Sadeness.mp3"
109+
else if (rd < 0.4)
110+
return "qrc:/resources/RelaxMusic/Ennio Morricone - Chi Mai.mp3"
111+
else if (rd < 0.6)
112+
return "qrc:/resources/RelaxMusic/James Last - The Lonely Shepherd.mp3"
113+
else if (rd < 0.8)
114+
return "qrc:/resources/RelaxMusic/Weathertunes - Sunny Day (Lemongrass Lazy Afternoon).mp3"
115+
else
116+
return "qrc:/resources/RelaxMusic/Weber - In This Dream.mp3"
117+
}
118+
5119
}

qml.qrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,19 @@
2323
<file>qml-other/funcionality/funcs/NoReady.qml</file>
2424
<file>resources/coffe.png</file>
2525
<file>resources/WhatIsDepress.mp4</file>
26+
<file>resources/RelaxMusic/Enigma - Sadeness.mp3</file>
27+
<file>resources/RelaxMusic/Ennio Morricone - Chi Mai.mp3</file>
28+
<file>resources/RelaxMusic/James Last - The Lonely Shepherd.mp3</file>
29+
<file>resources/RelaxMusic/Weathertunes - Sunny Day (Lemongrass Lazy Afternoon).mp3</file>
30+
<file>resources/RelaxMusic/Weber - In This Dream.mp3</file>
31+
<file>resources/blackTh/play.png</file>
32+
<file>resources/blackTh/stop.png</file>
33+
<file>resources/blackTh/update.png</file>
34+
<file>resources/whiteTh/play.png</file>
35+
<file>resources/whiteTh/stop.png</file>
36+
<file>resources/whiteTh/update.png</file>
37+
<file>qml-other/funcionality/funcs/AboutApp.qml</file>
38+
<file>resources/blackTh/git.png</file>
39+
<file>resources/whiteTh/git.png</file>
2640
</qresource>
2741
</RCC>

resources/blackTh/git.png

15.8 KB
Loading

resources/blackTh/play.png

1.12 KB
Loading

resources/blackTh/stop.png

378 Bytes
Loading

resources/blackTh/update.png

15.9 KB
Loading

resources/whiteTh/git.png

8.44 KB
Loading

resources/whiteTh/play.png

1.04 KB
Loading

resources/whiteTh/stop.png

370 Bytes
Loading

resources/whiteTh/update.png

16.8 KB
Loading

0 commit comments

Comments
 (0)