MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow),options(new channelOptions(this)),modOptions(new moduleDialog(this)),serialPortOpt(new serialPortOptions(this)),thePlaylist(new playlist(this))//thePlayer(new QMediaPlayer), { thePlayer = NULL; ui->setupUi(this); playbackRate=1; serialPortName="COM3"; //serialPortName="/dev/ttyUSB0"; //thePort.setPortName("/dev/ttyACM0"); thePort.setPortName(serialPortName); thePort.setBaudRate(QSerialPort::Baud9600); serialOutputOn=0; connect(ui->label_2,SIGNAL(playScroll(int)),ui->horizontalScrollBar,SLOT(setValue(int))); connect(ui->label_2,SIGNAL(trackSelected(uint,QColor)),this,SLOT(channelSelected(uint,QColor))); connect(ui->label_2,SIGNAL(updatePicture(binaryTrack)),ui->label,SLOT(whatToLightUp(binaryTrack))); connect(ui->label_2,SIGNAL(updatePicture(binaryTrack)),this,SLOT(writeToSerialPort(binaryTrack))); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(options,SIGNAL(removeChannel(int)),this,SLOT(removeChannel(int))); connect(options,SIGNAL(theColorChanged(uint,QColor)),this,SLOT(channelColorHasChanged(uint,QColor))); connect(options,SIGNAL(changeEditMode(bool)),ui->label,SLOT(changeEditMode(bool))); connect(options,SIGNAL(channelEnableButtonPushed(int,bool)),this,SLOT(channelEnabledButtonPushed(int,bool))); connect(serialPortOpt,SIGNAL(setNewSerialPort(QString)),this,SLOT(serialPortNameChanged(QString))); connect(thePlaylist,SIGNAL(changeSong(QString)),this,SLOT(playlistChangeSong(QString))); tempTrackCount=0; }
Player::Player(PlayerMode mode, VKApi *_vk) { vk = _vk; player = new QMediaPlayer(); songs = new QList<jSong>(); // for online if (mode == Online) { // session for playlist session = new jSession(vk->GetUserId()); session->load(); } // signals from player connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(changeSong(QMediaPlayer::MediaStatus))); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(emitPlayerStateChanged(QMediaPlayer::State))); connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(emitPositionChanged(qint64))); connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(emitDurationChanged(qint64))); }