CMakelists.txt adjustement
[musik.git] / musikedit.cpp
blob07ca63083dd2c07ad380ba3cf880cd6407dcd9f0
1 // andrea diamantini - adjam7@gmail.com
2 // musik - simplest KDE4 audio player
3 // file musikedit.cpp
5 #include "musikedit.h"
8 MusikEdit::MusikEdit(Phonon::MediaObject & mo)
10 setupUi();
11 setSongInfo(mo);
13 connect( okButton , SIGNAL( clicked() ), this , SLOT( ok() ) );
14 connect( clearButton , SIGNAL( clicked() ), this , SLOT( clear() ) );
15 connect( cancelButton , SIGNAL( clicked() ), this , SLOT( cancel() ) );
20 MusikEdit::~MusikEdit()
21 {};
24 void MusikEdit::setupUi()
26 QLabel *artistLabel = new QLabel( tr("artist") );
27 QLabel *albumLabel = new QLabel( tr("album") );
28 QLabel *titleLabel = new QLabel( tr("title") );
29 QLabel *dateLabel = new QLabel( tr("date") );
30 QLabel *genreLabel = new QLabel( tr("genre") );
31 QLabel *trackNumberLabel = new QLabel( tr("track number") );
32 QLabel *descLabel = new QLabel( tr("description") );
34 QVBoxLayout *labelLayout = new QVBoxLayout;
35 labelLayout->addWidget(artistLabel);
36 labelLayout->addWidget(albumLabel);
37 labelLayout->addWidget(titleLabel);
38 labelLayout->addWidget(dateLabel);
39 labelLayout->addWidget(genreLabel);
40 labelLayout->addWidget(trackNumberLabel);
41 labelLayout->addWidget(descLabel);
43 artistLine = new QLineEdit();
44 albumLine = new QLineEdit();
45 titleLine = new QLineEdit();
46 dateLine = new QLineEdit();
47 genreLine = new QLineEdit();
48 trackNumberLine = new QLineEdit();
49 descLine = new QLineEdit();
51 QVBoxLayout *lineLayout = new QVBoxLayout;
52 lineLayout->addWidget(artistLine);
53 lineLayout->addWidget(albumLine);
54 lineLayout->addWidget(titleLine);
55 lineLayout->addWidget(dateLine);
56 lineLayout->addWidget(genreLine);
57 lineLayout->addWidget(trackNumberLine);
58 lineLayout->addWidget(descLine);
61 okButton = new QPushButton( tr("ok") );
62 clearButton = new QPushButton( tr("clear") );
63 cancelButton = new QPushButton( tr("cancel") );
64 QHBoxLayout *buttonLayout = new QHBoxLayout;
65 buttonLayout->addWidget(okButton);
66 buttonLayout->addWidget(clearButton);
67 buttonLayout->addWidget(cancelButton);
69 QHBoxLayout *infoLayout = new QHBoxLayout;
70 infoLayout->addLayout(labelLayout);
71 infoLayout->addLayout(lineLayout);
73 QVBoxLayout *mainLayout = new QVBoxLayout;
74 mainLayout->addLayout(infoLayout);
75 mainLayout->addLayout(buttonLayout);
77 setLayout(mainLayout);
78 setWindowTitle("Musik Tag Editor");
82 void MusikEdit::setSongInfo(Phonon::MediaObject & mo)
84 artistLine->setText( mo.metaData(Phonon::ArtistMetaData).at(0) );
85 albumLine->setText( mo.metaData(Phonon::AlbumMetaData).at(0) );
86 titleLine->setText( mo.metaData(Phonon::TitleMetaData).at(0) );
87 dateLine->setText( mo.metaData(Phonon::DateMetaData).at(0) );
88 // genreLine->setText( mo.metaData(Phonon::GenreMetaData).at(0) ); // FIXME phonon problem: to investigate..
89 trackNumberLine->setText( mo.metaData(Phonon::TracknumberMetaData).at(0) );
90 descLine->setText( mo.metaData(Phonon::DescriptionMetaData).at(0) );
94 void MusikEdit::ok()
96 // FIXME!!
100 void MusikEdit::clear()
102 artistLine->clear();
103 albumLine->clear();
104 titleLine->clear();
105 dateLine->clear();
106 genreLine->clear();
107 trackNumberLine->clear();
108 descLine->clear();
112 void MusikEdit::cancel()
114 this->close();