This repository was archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddcddialog.cpp
More file actions
115 lines (91 loc) · 2.46 KB
/
Copy pathaddcddialog.cpp
File metadata and controls
115 lines (91 loc) · 2.46 KB
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
#include "addcddialog.h"
addCdDialog::addCdDialog(QWidget *parent) : QDialog(parent)
{
imageLocation.clear();
somethingIsEmpty = true;
setupUi(this);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
QString addCdDialog::getCDName() const
{
return dialogCdName->text();
}
QString addCdDialog::getAutor() const
{
return dialogAutor->text();
}
int addCdDialog::getYear() const
{
return dialogYear->text().toInt();
}
QString addCdDialog::getGener() const
{
return dialogGenre->text();
}
QString addCdDialog::getSong(int id) const
{
return songs.at(id);
}
int addCdDialog::getSongCount() const
{
return songs.count();
}
QString addCdDialog::getImage() const
{
return imageLocation;
}
void addCdDialog::passData(QString CDName, QString Autor, QString Year, QString Genre, QString Picture, QList<QString> outSongs)
{
thumb = Picture;
imageLocation = Picture;
songs = outSongs;
songsForShow.clear();
for(int i = 0; i < songs.count(); i++){
if(i % 5 == 0) songsForShow.append("\n");
else songsForShow.append(" ");
songsForShow.append(songs.at(i));
}
songListLabel->setText(songsForShow);
dialogCdName->setText(CDName);
dialogAutor->setText(Autor);
dialogGenre->setText(Genre);
dialogYear->setText(Year);
thumbImage->setPixmap(thumb);
}
void addCdDialog::on_addLineButton_clicked()
{
songs.append(dialogAddSong->text());
songsForShow.clear();
for(int i = 0; i < songs.count(); i++){
if(i % 5 == 0) songsForShow.append("\n");
else songsForShow.append(" ");
songsForShow.append(songs.at(i));
}
songListLabel->setText(songsForShow);
}
void addCdDialog::on_removeLineButton_clicked()
{
songsForShow.clear();
songs.clear();
songListLabel->setText("");
}
void addCdDialog::on_changeImageButton_clicked()
{
QString newName;
QString oldName;
imageLocation = QFileDialog::getOpenFileName(this,tr("Chose picture"),"",tr("Images (*.png *.bmp *.jpg *.jpeg)"));
if (!imageLocation.isEmpty()){
oldName = imageLocation;
while(imageLocation.contains("/"))
{
imageLocation.remove(0,1);
}
newName.append("thumbs/");
newName.append(imageLocation);
QFile::copy(oldName,newName);
thumb.load(newName);
thumbImage->setPixmap(thumb);
imageLocation = newName;
}
}