mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
update project example logic
This commit is contained in:
parent
2c9acc046a
commit
5f48e6a6ef
11
QQt.pro
11
QQt.pro
@ -23,9 +23,11 @@ SUBDIRS = src/qqt.pro
|
||||
#SUBDIRS += examples/tabwidgetexamples
|
||||
#SUBDIRS += examples/qrcodeexample
|
||||
#SUBDIRS += examples/qqtnetworkexample
|
||||
#udp 嵌入式linux,Qt编译了udp后支持
|
||||
#
|
||||
greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += examples/qqtudpexample
|
||||
#SUBDIRS += test/voicetest
|
||||
mac:lessThan(QT_MAJOR_VERSION , 5):SUBDIRS -= test/voicetest
|
||||
#udp 嵌入式linux,Qt编译了udp支持,默认是支持的
|
||||
#SUBDIRS += examples/qqtudpexample
|
||||
lessThan(QT_VERSION , 5.8.0):SUBDIRS -= examples/qqtudpexample
|
||||
#SUBDIRS += examples/qqtchartexample
|
||||
#
|
||||
#
|
||||
@ -48,8 +50,7 @@ greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += examples/qqtudpexample
|
||||
#SUBDIRS += test/qqtdicttest
|
||||
#SUBDIRS += test/qqtdicttest2
|
||||
#SUBDIRS += test/consoletest
|
||||
#
|
||||
greaterThan(QT_MAJOR_VERSION , 4):SUBDIRS += test/voicetest
|
||||
#greaterThan(QT_VERSION , 4.6.0):SUBDIRS += test/voicetest
|
||||
|
||||
#!contains(QKIT_PRIVATE, iOS|iOSSimulator){
|
||||
# SUBDIRS += test/cmdwidget
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef QQTAUDIOEFFECT_H
|
||||
#ifndef QQTAUDIOEFFECT_H
|
||||
#define QQTAUDIOEFFECT_H
|
||||
|
||||
#include <qqtaudiomanager.h>
|
||||
@ -106,6 +106,7 @@ public:
|
||||
manager.outputAudioFormat() = mFormat;
|
||||
manager.startDefaultOutput();
|
||||
|
||||
/*
|
||||
QTimer* timer = new QTimer ( this );
|
||||
connect ( timer, &QTimer::timeout, [&]() {
|
||||
static int i = 52;
|
||||
@ -121,6 +122,7 @@ public:
|
||||
pline() << i;
|
||||
} );
|
||||
timer->start();
|
||||
*/
|
||||
}
|
||||
|
||||
//需要用户设置输出设备
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "qqtsocketudpclient.h"
|
||||
#include "qqtsocketudpclient.h"
|
||||
|
||||
QQtSocketUdpClient::QQtSocketUdpClient ( QObject* parent ) : QUdpSocket ( parent )
|
||||
{
|
||||
@ -151,7 +151,7 @@ void QQtSocketUdpClient::readyReadData()
|
||||
QHostAddress host;
|
||||
quint16 port;
|
||||
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION > QT_VERSION_DATAGRAM
|
||||
/*能够一次收够一条报文?测试的能。*/
|
||||
QNetworkDatagram datagram = receiveDatagram();
|
||||
/*由于添加了兼容Qt4的代码,以上注释起来。*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef QQTUDPPROTOCOL_H
|
||||
#ifndef QQTUDPPROTOCOL_H
|
||||
#define QQTUDPPROTOCOL_H
|
||||
|
||||
#include <QObject>
|
||||
@ -6,7 +6,9 @@
|
||||
#include "qqtmessage.h"
|
||||
#include "qqtcore.h"
|
||||
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5,0,0)
|
||||
#define QT_VERSION_DATAGRAM QT_VERSION_CHECK(5,8,0)
|
||||
|
||||
#if QT_VERSION > QT_VERSION_DATAGRAM
|
||||
#include <QNetworkDatagram>
|
||||
#endif
|
||||
|
||||
@ -21,7 +23,7 @@ public:
|
||||
}
|
||||
virtual ~QQtUdpProtocol() {}
|
||||
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION > QT_VERSION_DATAGRAM
|
||||
qint64 writeDatagram ( const QNetworkDatagram& datagram ) {
|
||||
//emit writeDatagram();
|
||||
}
|
||||
@ -47,7 +49,7 @@ protected:
|
||||
/*
|
||||
* 这两个dispatcher,任选其一重写。
|
||||
*/
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION > QT_VERSION_DATAGRAM
|
||||
inline virtual bool dispatcher ( const QNetworkDatagram& ) { return 0; }
|
||||
#endif
|
||||
|
||||
@ -62,7 +64,7 @@ public:
|
||||
const QHostAddress& host, quint16 port ) {
|
||||
dispatcher ( datagram, host, port );
|
||||
}
|
||||
#if QT_VERSION > QT_VERSION_CHECK(5,0,0)
|
||||
#if QT_VERSION > QT_VERSION_DATAGRAM
|
||||
void translator ( const QNetworkDatagram& datagram ) {
|
||||
dispatcher ( datagram );
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "mainwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <qqtaudiomanager.h>
|
||||
#include <qqtcore.h>
|
||||
@ -381,11 +381,12 @@ void MainWindow::on_inHS_valueChanged ( int value )
|
||||
if ( !manager.inputDevice() )
|
||||
return;
|
||||
|
||||
qreal linearVolume = QAudio::convertVolume ( value / qreal ( 100.0 ),
|
||||
QAudio::LogarithmicVolumeScale,
|
||||
QAudio::LinearVolumeScale );
|
||||
qreal linearVolume;
|
||||
// qreal linearVolume = QAudio::convertVolume ( value / qreal ( 100.0 ),
|
||||
// QAudio::LogarithmicVolumeScale,
|
||||
// QAudio::LinearVolumeScale );
|
||||
|
||||
pline() << "输入音量" << value << linearVolume << qRound ( linearVolume * 100 ) ;
|
||||
// pline() << "输入音量" << value << linearVolume << qRound ( linearVolume * 100 ) ;
|
||||
manager.inputManager()->setVolume ( qRound ( linearVolume * 100 ) );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user