Skip to content

Commit

Permalink
version check test
Browse files Browse the repository at this point in the history
  • Loading branch information
sonichy committed Jun 9, 2018
1 parent eec7788 commit 4e27efa
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 317 deletions.
6 changes: 2 additions & 4 deletions HTYMP.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ TEMPLATE = app

SOURCES += main.cpp\
mainwindow.cpp \
dialogurl.cpp \
waveform.cpp
dialogurl.cpp

HEADERS += mainwindow.h \
dialogurl.h \
waveform.h
dialogurl.h

FORMS += mainwindow.ui \
dialogurl.ui
Expand Down
30 changes: 13 additions & 17 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ MainWindow::MainWindow(QWidget *parent) :
{
ui->setupUi(this);
move((QApplication::desktop()->width() - width())/2, (QApplication::desktop()->height() - height())/2);
sr = 1;
m_bPressed = false;
version = "1.11";
ui->btnSkipB->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward));
ui->btnSeekB->setIcon(style()->standardIcon(QStyle::SP_MediaSeekBackward));
ui->btnPlay->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
ui->btnSkipF->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward));
ui->btnSeekF->setIcon(style()->standardIcon(QStyle::SP_MediaSeekForward));
ui->btnStop->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
ui->btnMute->setIcon(style()->standardIcon(QStyle::SP_MediaVolume));
sr = 1;

QActionGroup *actionGroupScale = new QActionGroup(this);
actionGroupScale->addAction(ui->action_scale0_5);
actionGroupScale->addAction(ui->action_scale1);
Expand All @@ -49,10 +51,7 @@ MainWindow::MainWindow(QWidget *parent) :
video->setStyleSheet("background:black;");
ui->vbox->addWidget(video);
video->setMouseTracking(true);
video->show();

//waveform = new Waveform;
//ui->vbox->addWidget(waveform);
video->show();

// labelTL = new QLabel(this);
// labelTL->move(50,50);
Expand All @@ -73,10 +72,6 @@ MainWindow::MainWindow(QWidget *parent) :
connect(player,SIGNAL(error(QMediaPlayer::Error)),this,SLOT(errorHandle(QMediaPlayer::Error)));
connect(player,SIGNAL(stateChanged(QMediaPlayer::State)),SLOT(stateChange(QMediaPlayer::State)));

QAudioProbe *audioProbe = new QAudioProbe;
//connect(audioProbe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(audioBufferProbed(QAudioBuffer)));
audioProbe->setSource(player);

connect(new QShortcut(QKeySequence(Qt::Key_O),this), SIGNAL(activated()),this, SLOT(on_action_open_triggered()));
connect(new QShortcut(QKeySequence(Qt::Key_U),this), SIGNAL(activated()),this, SLOT(on_action_openURL_triggered()));
connect(new QShortcut(QKeySequence(Qt::Key_T),this), SIGNAL(activated()),this, SLOT(on_action_liveList_triggered()));
Expand Down Expand Up @@ -129,18 +124,18 @@ MainWindow::MainWindow(QWidget *parent) :
//read the first four bytes (=> Length)
//getwchar: receive char from stdin
//putwchar: write char to stdout
for ( int i = 0; i < 4; i++) {
for (int i = 0; i < 4; i++) {
length += getwchar();
}
//read the json-message
QString url = "";
for ( int i = 0; i < length; i++) {
for (int i = 0; i < length; i++) {
url += getwchar();
}
//浏览器端传来的数据会有一个双引号引在两端
url = url.mid(1, url.length()-2);
qDebug() << url;
if(url!=""){
if(url != ""){
ui->tableWidget->hide();
player->setMedia(QUrl(url));
player->play();
Expand All @@ -162,6 +157,7 @@ MainWindow::MainWindow(QWidget *parent) :
NAM->get(QNetworkRequest(urlAD));
connect(NAM, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyAD(QNetworkReply*)));

checkVersion(version);
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -985,10 +981,10 @@ void MainWindow::sliderProgressReleased()
player->setPosition(ui->sliderProgress->value());
}

void MainWindow::audioBufferProbed(QAudioBuffer buffer)
void MainWindow::checkVersion(QString version)
{
QVector<qreal> levels = Waveform::getBufferLevels(buffer);
for (int i = 0; i < levels.count(); ++i) {
waveform->updateWave(levels.at(i));
}
QNetworkAccessManager *NAM = new QNetworkAccessManager;
QString urlAD = "http://www.bydauto.com.cn/uploads/image/20170906/1504679624393355.jpg";
NAM->get(QNetworkRequest(urlAD));
connect(NAM, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyAD(QNetworkReply*)));
}
6 changes: 2 additions & 4 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "dialogurl.h"
#include "ui_dialogurl.h"
#include "waveform.h"
#include <QMainWindow>
#include <QMediaPlayer>
#include <QMediaPlaylist>
Expand Down Expand Up @@ -32,7 +31,7 @@ class MainWindow : public QMainWindow
void mouseMoveEvent(QMouseEvent*);
void mouseReleaseEvent(QMouseEvent*);
void open(QString path);
QString filename, STimeDuration;
QString filename, STimeDuration, version;
QMediaPlayer *player;
QVideoWidget *video;
QMenu *popmenu;
Expand All @@ -53,7 +52,7 @@ class MainWindow : public QMainWindow
QString SB(qint64 b);
void scale(float s);
void setSTime(qint64);
Waveform *waveform;
void checkVersion(QString version);

private slots:
void on_action_open_triggered();
Expand Down Expand Up @@ -114,7 +113,6 @@ private slots:
//void sliderProgressValueChanged(int);
void sliderProgressMoved(int);
void sliderVolumeMoved(int);
void audioBufferProbed(QAudioBuffer buffer);
};

#endif // MAINWINDOW_H
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.12
227 changes: 0 additions & 227 deletions waveform.cpp

This file was deleted.

Loading

0 comments on commit 4e27efa

Please sign in to comment.