2017-11-29 20:59:54 +03:00
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
2017-11-29 21:36:29 +03:00
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include <QMessageBox>
|
2017-11-29 20:59:54 +03:00
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
QMainWindow(parent),
|
|
|
|
|
ui(new Ui::MainWindow)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
2017-11-29 21:36:29 +03:00
|
|
|
|
source = new syncLib::Sync();
|
|
|
|
|
ui->horizontalSlider_Value->setMaximum(100);
|
2017-11-29 20:59:54 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
2017-11-29 21:36:29 +03:00
|
|
|
|
delete source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_Play_clicked()
|
|
|
|
|
{
|
|
|
|
|
QString song_path = QFileDialog::getOpenFileName(this);
|
|
|
|
|
|
|
|
|
|
if(!song_path.isEmpty() && !source->play(song_path)){
|
|
|
|
|
QMessageBox::critical(this,tr("Error"),tr("Сould not play the file you selected."));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_Pause_clicked()
|
|
|
|
|
{
|
2017-12-03 17:22:59 +03:00
|
|
|
|
source->pause(true);
|
2017-11-29 21:36:29 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_Stop_clicked()
|
|
|
|
|
{
|
|
|
|
|
source->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_Search_clicked()
|
|
|
|
|
{
|
|
|
|
|
if(source->getServersList().isEmpty())
|
|
|
|
|
source->scan();
|
|
|
|
|
else{
|
|
|
|
|
ETcpSocket * server = source->getServersList().front();
|
|
|
|
|
if(!source->listen(server)){
|
|
|
|
|
QMessageBox::critical(this,tr("Error"),tr("Сould not listen the finded server - %0").arg(server->name()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_horizontalSlider_Value_valueChanged(int value)
|
|
|
|
|
{
|
|
|
|
|
// source->set>setMaximum(100);
|
2017-11-29 20:59:54 +03:00
|
|
|
|
}
|