语言:全部使用简体中文。
This commit is contained in:
@@ -42,10 +42,10 @@ bool ClientCore::Connect(const QString& ip, quint16 port)
|
||||
}
|
||||
socket_->connectToHost(ip, port);
|
||||
if (!socket_->waitForConnected(3000)) {
|
||||
qCritical() << QString(tr("%1:%2 connect failed...")).arg(ip).arg(port);
|
||||
qCritical() << QString(tr("%1:%2 连接失败。")).arg(ip).arg(port);
|
||||
return false;
|
||||
}
|
||||
qInfo() << QString(tr("%1:%2 connected success.")).arg(ip).arg(port);
|
||||
qInfo() << QString(tr("%1:%2 连接成功。")).arg(ip).arg(port);
|
||||
connected_ = true;
|
||||
return true;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
case FrameBufferType::FBT_SER_MSG_YOURID: {
|
||||
ownID_ = frame->data;
|
||||
GlobalData::Ins()->SetLocalID(ownID_);
|
||||
qInfo() << QString(tr("own id: %1")).arg(ownID_);
|
||||
qInfo() << QString(tr("本机ID: %1")).arg(ownID_);
|
||||
emit sigYourId(frame);
|
||||
break;
|
||||
}
|
||||
@@ -106,11 +106,11 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
DirFileInfoVec vec;
|
||||
InfoMsg info = infoUnpack<InfoMsg>(frame->data);
|
||||
if (!localFile_.GetDirFile(info.msg, vec)) {
|
||||
qWarning() << QString(tr("get dir file failed use %1")).arg(info.msg);
|
||||
qWarning() << QString(tr("访问文件失败: %1")).arg(info.msg);
|
||||
return;
|
||||
}
|
||||
if (!Send<DirFileInfoVec>(vec, FBT_CLI_ANS_DIRFILE, frame->fid)) {
|
||||
qCritical() << QString(tr("send dir file result failed."));
|
||||
qCritical() << QString(tr("发送文件列表结果失败。"));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -182,7 +182,7 @@ void ClientCore::UseFrame(QSharedPointer<FrameBuffer> frame)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
qCritical() << QString("unknown frame type: %1").arg(frame->type);
|
||||
qCritical() << QString("未知的帧类型: %1").arg(frame->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ bool ClientCore::Send(QSharedPointer<FrameBuffer> frame)
|
||||
bool ClientCore::Send(const char* data, qint64 len)
|
||||
{
|
||||
if (socket_->state() != QAbstractSocket::ConnectedState) {
|
||||
qCritical() << QString("client %1 not connected...").arg(remoteID_);
|
||||
qCritical() << QString("客户端 %1 未连接...").arg(remoteID_);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ bool ClientCore::Send(const char* data, qint64 len)
|
||||
bytesWritten = socket_->write(data, len);
|
||||
}
|
||||
if (bytesWritten == -1 || !socket_->waitForBytesWritten(5000)) {
|
||||
qCritical() << QString("Send data to server failed. %1").arg(socket_->errorString());
|
||||
qCritical() << QString("向服务器发送数据失败: %1").arg(socket_->errorString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -356,7 +356,7 @@ void SendThread::run()
|
||||
|
||||
auto br = task_->file.read(frame->data.data(), CHUNK_BUF_SIZE);
|
||||
if (br == -1) {
|
||||
qCritical() << QString(tr("read file failed: %1")).arg(task_->file.errorString());
|
||||
qCritical() << QString(tr("读取失败: %1")).arg(task_->file.errorString());
|
||||
isSuccess_ = false;
|
||||
break;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ void SendThread::run()
|
||||
invokeSuccess = QMetaObject::invokeMethod(cliCore_, "SendFrame", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, isSuccess_), Q_ARG(QSharedPointer<FrameBuffer>, frame));
|
||||
if (!invokeSuccess || !isSuccess_) {
|
||||
qCritical() << QString(tr("send to %1 file failed.")).arg(task_->task.remoteId);
|
||||
qCritical() << QString(tr("向 %1 发送失败.")).arg(task_->task.remoteId);
|
||||
break;
|
||||
}
|
||||
task_->tranSize += frame->data.size();
|
||||
|
||||
@@ -22,7 +22,7 @@ Compare::~Compare()
|
||||
void Compare::InitMenu()
|
||||
{
|
||||
menu_ = new QMenu(ui->tableWidget);
|
||||
menu_->addAction(tr("Try2Local"), this, [this]() {
|
||||
menu_->addAction(tr("尝试访问本地路径"), this, [this]() {
|
||||
auto selected = ui->tableWidget->selectedItems();
|
||||
if (selected.size() != 3) {
|
||||
return;
|
||||
@@ -31,7 +31,7 @@ void Compare::InitMenu()
|
||||
auto path = item->text();
|
||||
emit sigTryVisit(true, path);
|
||||
});
|
||||
menu_->addAction(tr("Try2Remote"), this, [this]() {
|
||||
menu_->addAction(tr("尝试访问远程路径"), this, [this]() {
|
||||
auto selected = ui->tableWidget->selectedItems();
|
||||
if (selected.size() != 3) {
|
||||
return;
|
||||
@@ -70,7 +70,7 @@ void Compare::InitControl()
|
||||
void Compare::InitTabWidget()
|
||||
{
|
||||
QStringList headers;
|
||||
headers << tr("FileName") << tr("LocalDir") << tr("RemoteDir");
|
||||
headers << tr("文件") << tr("本地目录") << tr("远端目录");
|
||||
ui->tableWidget->setColumnCount(headers.size());
|
||||
ui->tableWidget->setHorizontalHeaderLabels(headers);
|
||||
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
@@ -101,13 +101,13 @@ void Compare::Save()
|
||||
{
|
||||
auto titleKey = ui->comboBox->currentText().trimmed();
|
||||
if (titleKey.isEmpty()) {
|
||||
FTCommon::msg(this, tr("Please select or input a title."));
|
||||
FTCommon::msg(this, tr("请输入标题"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file("CompareData.xml");
|
||||
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
|
||||
FTCommon::msg(this, tr("Failed to open data file."));
|
||||
FTCommon::msg(this, tr("打开数据文件失败。"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -179,20 +179,20 @@ void Compare::Save()
|
||||
ui->comboBox->addItem(titleKey);
|
||||
}
|
||||
|
||||
FTCommon::msg(this, tr("Data saved successfully."));
|
||||
FTCommon::msg(this, tr("数据保存成功。"));
|
||||
}
|
||||
|
||||
void Compare::Load()
|
||||
{
|
||||
auto titleKey = ui->comboBox->currentText().trimmed();
|
||||
if (titleKey.isEmpty()) {
|
||||
FTCommon::msg(this, tr("Please select or input a title."));
|
||||
FTCommon::msg(this, tr("请选择或输入标题。"));
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file("CompareData.xml");
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
FTCommon::msg(this, tr("Failed to open data file."));
|
||||
FTCommon::msg(this, tr("打开数据文件失败。"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void Compare::Load()
|
||||
|
||||
file.close();
|
||||
if (!found) {
|
||||
FTCommon::msg(this, tr("No data found for the selected title."));
|
||||
FTCommon::msg(this, tr("没有找到标题对应的数据。"));
|
||||
} else {
|
||||
// FTCommon::msg(this, tr("Data loaded successfully."));
|
||||
}
|
||||
@@ -319,7 +319,7 @@ void Compare::TransToRight()
|
||||
|
||||
void Compare::deleteSelectedRows()
|
||||
{
|
||||
auto r = FTCommon::affirm(this, tr("confirm"), tr("delete selected rows?"));
|
||||
auto r = FTCommon::affirm(this, tr("确认"), tr("删除选中的行?"));
|
||||
if (!r) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnLoad">
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
<string>加载</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -55,7 +55,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnReplace">
|
||||
<property name="text">
|
||||
<string>Replace</string>
|
||||
<string>替换</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -69,7 +69,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnLeft">
|
||||
<property name="text">
|
||||
<string>ToLeft</string>
|
||||
<string>下载</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -92,14 +92,14 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Search</string>
|
||||
<string>搜索</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
<string>重置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -119,7 +119,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRight">
|
||||
<property name="text">
|
||||
<string>ToRight</string>
|
||||
<string>上传</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -106,7 +106,7 @@ void Connecter::Connect()
|
||||
QString ip;
|
||||
QString port;
|
||||
if (!parseIpPort(ui->comboBox->currentText(), ip, port)) {
|
||||
FTCommon::msg(this, QString(tr("IP or port is invalid.")));
|
||||
FTCommon::msg(this, QString(tr("IP或者端口不合法。")));
|
||||
return;
|
||||
}
|
||||
emit sigDoConnect(ip, port.toInt());
|
||||
@@ -137,7 +137,7 @@ void Connecter::setState(ConnectState cs)
|
||||
|
||||
void Connecter::Disconnect()
|
||||
{
|
||||
qWarning() << QString(tr("Disconnected..."));
|
||||
qWarning() << QString(tr("断开连接。"));
|
||||
emit sigDisConnect();
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void Connecter::RefreshClient()
|
||||
frame->type = FBT_SER_MSG_ASKCLIENTS;
|
||||
auto sendRet = ClientCore::syncInvoke(clientCore_, frame);
|
||||
if (!sendRet) {
|
||||
qCritical() << QString(tr("send ask client list failed."));
|
||||
qCritical() << QString(tr("请求查询客户端列表失败。"));
|
||||
return;
|
||||
}
|
||||
qInfo() << QString(tr("ask client list..."));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="lbIP">
|
||||
<property name="text">
|
||||
<string>Server:</string>
|
||||
<string>服务器:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -67,7 +67,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>OwnID:</string>
|
||||
<string>本机ID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -84,7 +84,7 @@
|
||||
<enum>Qt::FocusPolicy::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disconnect</string>
|
||||
<string>断开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -104,7 +104,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRefresh">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
<string>刷新</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -124,7 +124,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnConnect">
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
<string>连接</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -60,7 +60,7 @@ void FileManager::SetModeStr(const QString& modeStr, int type, ClientCore* clien
|
||||
void FileManager::InitControl()
|
||||
{
|
||||
QStringList headers;
|
||||
headers << tr("") << tr("FileName") << tr("ModifyTime") << tr("Type") << tr("Size");
|
||||
headers << tr("") << tr("文件名称") << tr("最后修改时间") << tr("类型") << tr("大小");
|
||||
ui->tableWidget->setColumnCount(headers.size());
|
||||
ui->tableWidget->setHorizontalHeaderLabels(headers);
|
||||
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
@@ -457,7 +457,7 @@ void FileManager::evtHome()
|
||||
auto r = fileHelper_->GetHome();
|
||||
auto curPath = ui->comboBox->currentText();
|
||||
SetRoot(curPath);
|
||||
qDebug() << QString(tr("%1 get home ret:%2").arg(__FUNCTION__).arg(r));
|
||||
qDebug() << QString(tr("%1 获取家目录结果:%2").arg(__FUNCTION__).arg(r));
|
||||
}
|
||||
|
||||
void FileManager::evtFile()
|
||||
@@ -465,7 +465,7 @@ void FileManager::evtFile()
|
||||
auto curPath = ui->comboBox->currentText();
|
||||
auto r = fileHelper_->GetDirFile(curPath);
|
||||
SetRoot(curPath);
|
||||
qDebug() << QString(tr("%1 get files ret:%2").arg(__FUNCTION__).arg(r));
|
||||
qDebug() << QString(tr("%1 获取文件结果:%2").arg(__FUNCTION__).arg(r));
|
||||
}
|
||||
|
||||
void FileManager::evtUp()
|
||||
|
||||
@@ -36,21 +36,21 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnVisit">
|
||||
<property name="text">
|
||||
<string>Go</string>
|
||||
<string>访问</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnHome">
|
||||
<property name="text">
|
||||
<string>Home</string>
|
||||
<string>家目录</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnUp">
|
||||
<property name="text">
|
||||
<string>Up</string>
|
||||
<string>上一级</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From:</string>
|
||||
<string>从:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -49,7 +49,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
<string>到:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -90,7 +90,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Task:</string>
|
||||
<string>任务详情:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -113,7 +113,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
<string>取消退出</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -60,8 +60,8 @@ void frelayGUI::InitControl()
|
||||
localFile_ = new FileManager(this);
|
||||
remoteFile_ = new FileManager(this);
|
||||
|
||||
localFile_->SetModeStr(tr("Local:"), 0, clientCore_);
|
||||
remoteFile_->SetModeStr(tr("Remote:"), 1, clientCore_);
|
||||
localFile_->SetModeStr(tr("本地:"), 0, clientCore_);
|
||||
remoteFile_->SetModeStr(tr("远端:"), 1, clientCore_);
|
||||
|
||||
tabWidget_ = new QTabWidget(this);
|
||||
|
||||
@@ -98,8 +98,8 @@ void frelayGUI::ControlLayout()
|
||||
|
||||
sTop->addWidget(tabWidget_);
|
||||
sTop->addWidget(connecter_);
|
||||
tabWidget_->addTab(logPrint, tr("Log"));
|
||||
tabWidget_->addTab(compare_, tr("Compare"));
|
||||
tabWidget_->addTab(logPrint, tr("日志"));
|
||||
tabWidget_->addTab(compare_, tr("文件对照"));
|
||||
|
||||
sFile->addWidget(localFile_);
|
||||
sFile->addWidget(remoteFile_);
|
||||
@@ -138,7 +138,7 @@ void frelayGUI::ControlMsgHander(QtMsgType type, const QMessageLogContext& conte
|
||||
void frelayGUI::HandleTask(const QVector<TransTask>& tasks)
|
||||
{
|
||||
if (!clientCore_->IsConnect()) {
|
||||
qCritical() << QString(tr("Not connect to server."));
|
||||
qCritical() << QString(tr("未连接到服务器。。。"));
|
||||
return;
|
||||
}
|
||||
transform_->SetTasks(tasks);
|
||||
|
||||
15
README.md
15
README.md
@@ -1,13 +1,14 @@
|
||||
# frelay
|
||||
|
||||
A tool that uses a relay server to upload and download files from remote clients.
|
||||
一个通过中继服务器在多个客户端之间相互传输文件的工具。
|
||||
|
||||
## Features
|
||||
## 功能特点
|
||||
|
||||
1. Minimal configuration—simply start a server, connect to it, and begin transferring files.
|
||||
2. If you frequently transfer the same files repeatedly, frelay offers a local-remote file mapping feature for one-click transfers.
|
||||
1. 极简配置——只需启动服务器,连接至服务器,即可开始传输文件。
|
||||
2. 若需频繁传输相同文件,frelay 提供本地-远程文件映射功能,支持一键传输。
|
||||
|
||||
## Disclaimer And Warning
|
||||
This tool is solely designed for simple file transmission between clients via a relay server. It does not include any security validation logic to prevent data attacks or similar threats. It is primarily intended for temporary, non-sensitive file transfers. Please close the software or disconnect from the relay server when not in use.
|
||||
## 免责声明与警告
|
||||
|
||||
The software may contain unexpected bugs that could corrupt or lose your files. Please ensure proper backups or use it only for non-critical file transfers.
|
||||
本工具仅设计用于通过中继服务器在客户端之间进行简单的文件传输,未包含任何可防范数据攻击或类似威胁的安全验证逻辑,主要适用于临时性、非敏感的文件传输场景。请在不使用时及时关闭软件或断开与中继服务器的连接。
|
||||
|
||||
本软件可能存在意外错误,可能导致文件损坏或丢失。请务必做好文件备份,或仅将其用于非关键文件的传输。
|
||||
|
||||
Reference in New Issue
Block a user