-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
108 lines (76 loc) · 2.64 KB
/
mainwindow.cpp
File metadata and controls
108 lines (76 loc) · 2.64 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <iostream>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include "controller.h"
#include "playercontrols.h"
#include "dock.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Toggle Signal setzen
ui->btnPlay->setCheckable(true);
this->controller = new Controller(this);
PlayerControls *controls = new PlayerControls(this);
ui->verticalLayout->addWidget(controls);
QMediaPlayer* player = this->controller->getPlayer();
connect(controls,SIGNAL(play()),player, SLOT(play()) );
connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), controls,SLOT(setState(QMediaPlayer::State)));
/* QMediaPlaylist *playlist = new QMediaPlaylist;
playlist->addMedia(QUrl::fromLocalFile("D:\\Musik\\2013\\Kollegah - Paranoia.mp3"));
playlist->addMedia(QUrl::fromLocalFile("D:\\Musik\\2013\\Tangerine Kitty - Dumb Ways To Die.mp3"));
playlist->addMedia(QUrl::fromLocalFile("D:\\Musik\\2013\\DCVDNS - Pimp Yannic.mp3"));
playlist->setCurrentIndex(1);
player->setPlaylist(playlist); */
//this->move(100,100);
Dock *dock = new Dock(this);
dock->setMainWidget(this);
this->pw = new playlistWindow(this);
dock->addWidget(this->pw);
pw->show();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_btnPlay_toggled(bool checked)
{
qDebug("btnPlay toggled!");
// if(checked){
// qDebug("checked true");
// QMediaPlayer* player = this->controller->getPlayer();
// //player->State
// qDebug(QString(player->state()).toUtf8().constData());
// QMediaPlayer::State s = player->state();
// if(player->state() == QMediaPlayer::StoppedState){
// qDebug("stoppedState");
// }
// if(player->state() == QMediaPlayer::PausedState){
// qDebug("PausedState");
// }
// player->setMedia(QUrl::fromLocalFile("D:\\Eigene Dateien\\Musik\\2013\\Kollegah - Paranoia.mp3"));
// player->setVolume(50);
// player->play();
// this->ui->btnPlay->setText("Stop");
// } else {
// qDebug("checked false");
// QMediaPlayer* player = this->controller->getPlayer();
// if(player->state() == QMediaPlayer::StoppedState){
// qDebug("stoppedState");
// }
// player->pause();
// this->ui->btnPlay->setText("Play");
// }
qDebug("Player: play");
}
void MainWindow::on_btnPlay_clicked()
{
qDebug("btnPlay click!");
this->pw = new playlistWindow(this);
pw->move(100,100);
pw->resize(200,100);
pw->show();
}