1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include "mainwindow.h"
- #include "ui_mainwindow.h"
- #include <yaml-cpp/yaml.h>
-
- MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)//, buf(&tmp)
- {
- ui->setupUi(this);
-
- currentRadio = 0;
- nrj = new NRJ(this);
- connect(nrj, SIGNAL(setupFinished()), this, SLOT(setupFinished()));
- nrj->setupPlayer();
-
- }
-
- MainWindow::~MainWindow()
- {
- delete ui;
- }
-
- void MainWindow::setupFinished()
- {
- int i = 0;
- foreach(Radio* r, nrj->getRadios())
- {
- RadioWidget* w = new RadioWidget();
- ui->layRadios->addWidget(w, i / 2, i % 2);
- connect(w, SIGNAL(clicked(Radio*)), this, SLOT(radioChanged(Radio*)));
- w->setRadio(r);
- ++i;
- }
- nrj->getAllCur();
- }
-
- void MainWindow::radioChanged(Radio *r)
- {
- if(currentRadio != 0)
- {
- currentRadio->stopStream();
- currentRadio->disconnect(this);
- }
- currentRadio = r;
- if(currentRadio != 0)
- {
- currentRadio->startStream();
- }
- }
|