Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
wh201906 committed Aug 23, 2022
2 parents 69f6b57 + eb6ac98 commit e622609
Show file tree
Hide file tree
Showing 15 changed files with 314 additions and 190 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

[中文](doc/CHANGELOG/CHANGELOG_zh_CN.md)

## V0.2.1
+ Add command line option to set config file path
+ Fix some bugs in file transceiver
+ Add touch screen gesture support for some scrollable widgets

## V0.2
+ Supports TCP client/server, UDP, Bluetooth SPP client/server and Bluetooth BLE
+ All servers support 1:N connections. Sent to/Receive from/Disconnect any client as you want
Expand Down
5 changes: 5 additions & 0 deletions doc/CHANGELOG/CHANGELOG_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

[English](../../CHANGELOG.md)

## V0.2.1
+ 支持通过命令行参数指定配置文件路径
+ 修复文件收发功能的一些小BUG
+ 对一些可以滚动的组件添加触摸屏手势支持

## V0.2
+ 支持TCP客户端/服务器,UDP,蓝牙SPP客户端/服务器和蓝牙BLE
+ TCP服务器和蓝牙SPP服务器支持一对多连接,可以任意指定收发对象,断开指定连接
Expand Down
2 changes: 1 addition & 1 deletion src/SerialTest.pro
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# Remember to change version in AndroidManifest.xml
VERSION = 0.2.0
VERSION = 0.2.1
QMAKE_TARGET_PRODUCT = "SerialTest"
QMAKE_TARGET_DESCRIPTION = "SerialTest"
QMAKE_TARGET_COMPANY = "wh201906"
Expand Down
2 changes: 1 addition & 1 deletion src/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="priv.wh201906.serialtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="V0.2" android:versionCode="20" android:installLocation="auto">
<manifest package="priv.wh201906.serialtest" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="V0.2.1" android:versionCode="21" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
Expand Down
2 changes: 2 additions & 0 deletions src/ctrltab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <QMessageBox>
#include <QJsonDocument>
#include <QJsonArray>
#include <QScroller>

CtrlTab::CtrlTab(QWidget *parent) :
QWidget(parent),
Expand All @@ -29,6 +30,7 @@ CtrlTab::CtrlTab(QWidget *parent) :
commentRegExp->optimize();

ui->ctrl_dataEdit->hide();
QScroller::grabGesture(ui->ctrl_itemArea);
}

CtrlTab::~CtrlTab()
Expand Down
9 changes: 9 additions & 0 deletions src/devicetab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QBluetoothLocalDevice>
#include <QNetworkInterface>
#include <QTreeWidgetItem>
#include <QScroller>
#ifdef Q_OS_ANDROID
#include <QtAndroid>
#include <QAndroidJniEnvironment>
Expand Down Expand Up @@ -276,6 +277,14 @@ void DeviceTab::initUI()
ui->Net_localPortEdit->setValidator(m_netPortValidator);
ui->Net_remotePortEdit->setValidator(m_netPortValidator);

QScroller::grabGesture(ui->BLEC_argsScrollArea);
QScroller::grabGesture(ui->Net_argsScrollArea);
QScroller::grabGesture(ui->SP_portList);
QScroller::grabGesture(ui->BTServer_deviceList);
QScroller::grabGesture(ui->BTClient_deviceList);
QScroller::grabGesture(ui->BLEC_deviceList);
QScroller::grabGesture(ui->BLEC_UUIDList);
QScroller::grabGesture(ui->Net_addrPortList);
}

void DeviceTab::getAvailableTypes(bool useFirstValid)
Expand Down
29 changes: 24 additions & 5 deletions src/filetab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,13 @@ void FileTab::onDataTransmitted(qsizetype num)
void FileTab::onDataReceived(qsizetype num)
{
m_handledSize += num;
ui->sizeLabel->setText(QLocale(QLocale::English).toString(m_handledSize) + " Bytes");
if(currentProtocol() == FileXceiver::RawProtocol && ui->RawRx_autostopByteButton->isChecked())
{
ui->progressBar->setValue((double)m_handledSize / m_fileSize * 100.0);
ui->sizeLabel->setText(QLocale(QLocale::English).toString(m_handledSize) + "/" + QLocale(QLocale::English).toString(m_fileSize) + " Bytes");
}
else
ui->sizeLabel->setText(QLocale(QLocale::English).toString(m_handledSize) + " Bytes");
}

bool FileTab::receiving()
Expand All @@ -309,7 +315,7 @@ void FileTab::onStartResultArrived(bool result)
m_working = result;
if(result)
{
if(ui->receiveModeButton->isChecked() && currentProtocol() == FileXceiver::RawProtocol)
if(ui->receiveModeButton->isChecked() && currentProtocol() == FileXceiver::RawProtocol && ui->RawRx_autostopNoneButton->isChecked())
ui->progressBar->setMaximum(0);
setParameterWidgetEnabled(false);
ui->startStopButton->setText(tr("Stop"));
Expand All @@ -333,13 +339,26 @@ void FileTab::stop()

void FileTab::updateFileSize()
{
if(ui->receiveModeButton->isChecked() && currentProtocol() == FileXceiver::RawProtocol)
ui->sizeLabel->setText("");
m_fileSize = -1;
if(ui->receiveModeButton->isChecked())
{
if(currentProtocol() == FileXceiver::RawProtocol)
{
if(ui->RawRx_autostopByteButton->isChecked())
m_fileSize = ui->RawRx_autostopByteBox->currentText().toLongLong();
else
m_fileSize = -1;
}
}
else
{
m_fileSize = QFileInfo(ui->filePathEdit->text()).size();
ui->sizeLabel->setText(QLocale(QLocale::English).toString(m_fileSize) + " Bytes");
}

if(m_fileSize == -1)
ui->sizeLabel->setText("");
else
ui->sizeLabel->setText(QLocale(QLocale::English).toString(m_handledSize) + "/" + QLocale(QLocale::English).toString(m_fileSize) + " Bytes");
}

void FileTab::setParameterWidgetEnabled(bool state)
Expand Down
10 changes: 5 additions & 5 deletions src/filexceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
FileXceiver::FileXceiver(QObject *parent)
: QObject{parent}
{
qRegisterMetaType<qsizetype>();
qRegisterMetaType<qsizetype>("qsizetype"); // qsizetype is an alias, so the typeName is compulsory
qRegisterMetaType<FileXceiver::Protocol>();
qRegisterMetaType<FileXceiver::ThrottleArgument>();
m_file.setParent(this); // for moveToThread()
Expand Down Expand Up @@ -89,19 +89,19 @@ void FileXceiver::newData(const QByteArray &data)
if(m_protocol == RawProtocol)
{
qsizetype num;
qsizetype limit = -1;
qsizetype limit = -1, currNum = -1;
if(m_expectedNum != -1)
{
limit = m_expectedNum - m_handledNum;
limit = limit < data.size() ? limit : data.size();
num = m_file.write(data.constData(), limit);
currNum = limit < data.size() ? limit : data.size();
num = m_file.write(data.constData(), currNum);
}
else
num = m_file.write(data);
m_file.flush();
m_handledNum += num;
emit dataReceived(num);
if(m_expectedNum != -1 && limit != data.size())
if(m_expectedNum != -1 && currNum == limit)
emit finished();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/filexceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public slots:
};

Q_DECLARE_METATYPE(qsizetype)
Q_DECLARE_METATYPE(FileXceiver::Protocol)
Q_DECLARE_METATYPE(FileXceiver::ThrottleArgument)

#endif // FILEXCEIVER_H
Binary file modified src/i18n/SerialTest_zh_CN.qm
Binary file not shown.
Loading

0 comments on commit e622609

Please sign in to comment.