-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpdialog.cpp
233 lines (172 loc) · 7.7 KB
/
helpdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#include "helpdialog.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QTextEdit>
HelpDialog::HelpDialog(QWidget *parent) : QDialog(parent) {
this->setWindowTitle("Help");
this->setModal(true);
this->setFixedSize(400,400);
//Viewstack controls the content view
m_viewStack = new QStackedWidget();
createLayout();
createWelcome();
createHowTo();
createMain();
createArtist();
createAlbum();
createGenre();
m_viewStack->addWidget(m_welcomeWidget);
m_viewStack->addWidget(m_howToWidget);
m_viewStack->addWidget(m_mainViewWidget);
m_viewStack->addWidget(m_artistViewWidget);
m_viewStack->addWidget(m_albumViewWidget);
m_viewStack->addWidget(m_genreViewWidget);
connect(m_helpList, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(onItemClick(QListWidgetItem*)));
}
void HelpDialog::createLayout() {
QHBoxLayout *mainLayout = new QHBoxLayout(this);
QVBoxLayout *helpIndexLayout = new QVBoxLayout(this);
QWidget *helpIndex = new QWidget();
QLabel *helpIndexLabel = new QLabel("Help Index");
helpIndexLabel->setStyleSheet("font-size: 30px;");
m_helpList = new QListWidget(this);
m_welcomeItem = new QListWidgetItem("Welcome", m_helpList);
m_howToItem = new QListWidgetItem("How to use", m_helpList);
m_mainViewItem = new QListWidgetItem("Home view", m_helpList);
m_artistViewItem = new QListWidgetItem("Artist view", m_helpList);
m_albumViewItem = new QListWidgetItem("Album view", m_helpList);
m_genreViewItem = new QListWidgetItem("Genre view", m_helpList);
m_helpList->addItem(m_welcomeItem);
m_helpList->addItem(m_howToItem);
m_helpList->addItem(m_mainViewItem);
m_helpList->addItem(m_artistViewItem);
m_helpList->addItem(m_albumViewItem);
m_helpList->addItem(m_genreViewItem);
helpIndexLayout->addWidget(helpIndexLabel);
helpIndexLayout->addWidget(m_helpList);
helpIndex->setLayout(helpIndexLayout);
QVBoxLayout *contentLayout = new QVBoxLayout(this);
QWidget *contentWidget = new QWidget(this);
contentLayout->addWidget(m_viewStack);
contentWidget->setLayout(contentLayout);
mainLayout->addWidget(helpIndex);
mainLayout->addWidget(contentWidget);
this->setLayout(mainLayout);
}
void HelpDialog::createWelcome() {
m_welcomeWidget = new QWidget(this);
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("Welcome");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit(this);
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText(
"Welcome to Tunes music player\n"
"From left sidebar select your desired category. \n "
"Close this help view by closing this with the windows close button.");
vBox->addWidget(title);
vBox->addWidget(content);
m_welcomeWidget->setLayout(vBox);
}
void HelpDialog::createHowTo()
{
m_howToWidget = new QWidget();
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("How to use");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit();
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText("Tunes is very simple to use.\n\n"
"On album you want to play press the 'Play' -button "
"to add that album to your playlist. \n"
"You can see your playlist on the Now Playing dock which shows "
"your currently playing track with other information to it. \n"
"And then the play queue with upcoming tracks. "
"And lastly you can control playback with media buttons at the bottom. \n\n "
"Now PLaying dock position can also be changed. Just left click and drag "
"Now Playing from its titlebar to left side or right side. Transparent rectangle will be shown. "
"Then release left mouse button to set dock position. \n\n"
"Main menu bar can also dragged in the same way, just click and hold on four vertical dots on the left side of the menubar.");
vBox->addWidget(title);
vBox->addWidget(content);
m_howToWidget->setLayout(vBox);
}
void HelpDialog::createMain()
{
m_mainViewWidget = new QWidget();
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("Main View");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit();
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText("Home view shows all of your new additions to your library. \n"
"In the future you can add more sub views to your Home view.");
vBox->addWidget(title);
vBox->addWidget(content);
m_mainViewWidget->setLayout(vBox);
}
void HelpDialog::createArtist()
{
m_artistViewWidget = new QWidget();
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("Artist View");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit();
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText("Artist view lists all of your librarys artist in list on the left side.\n"
"Just click on the artists whos albums you want to view and then on the right press Play on the desired album");
vBox->addWidget(title);
vBox->addWidget(content);
m_artistViewWidget->setLayout(vBox);
}
void HelpDialog::createAlbum()
{
m_albumViewWidget = new QWidget();
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("Album View");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit();
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText("Album view lists all of your librarys albums on cover mode.\n"
"Just press Play on the desired album to play that particular album. \n"
"You can also sort albums in different ways, press Sort to see how.");
vBox->addWidget(title);
vBox->addWidget(content);
m_albumViewWidget->setLayout(vBox);
}
void HelpDialog::createGenre()
{
m_genreViewWidget = new QWidget();
QVBoxLayout *vBox = new QVBoxLayout(this);
QLabel *title = new QLabel("Genre View");
title->setStyleSheet("font-size: 20px;");
QTextEdit *content = new QTextEdit();
content->setStyleSheet("background-color: transparent; border: 0px;");
content->setReadOnly(true);
content->setText("Genre view lists all of your librarys genres in list on the left side.\n"
"Just click on the genre which albums you want to view and then on the right press Play on the desired album \n "
"You can also sort albums in different ways, press Sort to see how.");
vBox->addWidget(title);
vBox->addWidget(content);
m_genreViewWidget->setLayout(vBox);
}
void HelpDialog::onItemClick(QListWidgetItem * item)
{
if (item == m_welcomeItem)
m_viewStack->setCurrentWidget(m_welcomeWidget);
if (item == m_howToItem)
m_viewStack->setCurrentWidget(m_howToWidget);
if (item == m_mainViewItem)
m_viewStack->setCurrentWidget(m_mainViewWidget);
if (item == m_artistViewItem)
m_viewStack->setCurrentWidget(m_artistViewWidget);
if (item == m_albumViewItem)
m_viewStack->setCurrentWidget(m_albumViewWidget);
if (item == m_genreViewItem)
m_viewStack->setCurrentWidget(m_genreViewWidget);
}