fun:对照添加打开本地文件夹功能。

This commit is contained in:
2025-11-05 09:35:36 +08:00
parent 23e12d1bda
commit 28206e8586
5 changed files with 24 additions and 8 deletions

View File

@@ -33,7 +33,7 @@ void ConsoleHelper::SetIpPort(const QString& ip, quint16 port)
{ {
ip_ = ip; ip_ = ip;
port_ = port; port_ = port;
qDebug() << "SetIpPort:" << ip_ << port_; qInfo() << "SetIpPort:" << ip_ << port_;
} }
void ConsoleHelper::Connect() void ConsoleHelper::Connect()

View File

@@ -1,5 +1,7 @@
#include "CompareControl.h" #include "CompareControl.h"
#include <QDesktopServices>
#include <QDir>
#include <QFile> #include <QFile>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@@ -51,6 +53,20 @@ void Compare::InitMenu()
ui->tableWidget->setItem(cnt, 2, item3); ui->tableWidget->setItem(cnt, 2, item3);
}); });
menu_->addAction(tr("删除"), this, [this]() { deleteSelectedRows(); }); menu_->addAction(tr("删除"), this, [this]() { deleteSelectedRows(); });
menu_->addAction(tr("尝试打开本地路径"), this, [this]() {
auto selected = ui->tableWidget->selectedItems();
if (selected.size() != 3) {
return;
}
auto item = selected[1];
auto path = item->text();
QDir dir(path);
if (!dir.exists()) {
FTCommon::msg(this, tr("本地路径不存在。"));
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});
menu_->addSeparator(); menu_->addSeparator();
connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this,
[this](const QPoint& pos) { menu_->exec(QCursor::pos()); }); [this](const QPoint& pos) { menu_->exec(QCursor::pos()); });

View File

@@ -8,7 +8,7 @@
| 序号 | 类型 | 内容 | 说明 | 基于版本 | 完成版本 | | 序号 | 类型 | 内容 | 说明 | 基于版本 | 完成版本 |
| :--: | :--: | ------------------------------------------------------------ | :--: | :------: | :------: | | :--: | :--: | ------------------------------------------------------------ | :--: | :------: | :------: |
| 28 | 变更 | 语言简体中文。 | | 0.2.2 | | | 28 | 变更 | 语言简体中文。 | | 0.2.2 | 0.2.3 |
| 27 | 功能 | 传输前检查对方或者自己是否已存在某些文件,提示是否覆盖。 | | 0.2.2 | | | 27 | 功能 | 传输前检查对方或者自己是否已存在某些文件,提示是否覆盖。 | | 0.2.2 | |
| 26 | 功能 | 最好能保存关闭界面时Splitter和UI的尺寸。 | | 0.2.2 | | | 26 | 功能 | 最好能保存关闭界面时Splitter和UI的尺寸。 | | 0.2.2 | |
| 25 | 功能 | 手动输入的文件夹访问路径保存历史记录,以便后续可能再次使用(10条)。 | | 0.2.2 | | | 25 | 功能 | 手动输入的文件夹访问路径保存历史记录,以便后续可能再次使用(10条)。 | | 0.2.2 | |

View File

@@ -29,7 +29,7 @@ bool Server::startServer(quint16 port)
return false; return false;
} }
qDebug() << "Server started on port" << serverPort(); qInfo() << "Server started on port" << serverPort();
monitorTimer_->start(MONITOR_HEART_SPED); monitorTimer_->start(MONITOR_HEART_SPED);
id_ = QString("0.0.0.0:%1").arg(serverPort()); id_ = QString("0.0.0.0:%1").arg(serverPort());
return true; return true;
@@ -78,7 +78,7 @@ void Server::onNewConnection()
clients_.insert(clientId, client); clients_.insert(clientId, client);
} }
qDebug() << "Client connected:" << clientId; qInfo() << "Client connected:" << clientId;
auto frame = QSharedPointer<FrameBuffer>::create(); auto frame = QSharedPointer<FrameBuffer>::create();
frame->type = FBT_SER_MSG_YOURID; frame->type = FBT_SER_MSG_YOURID;
frame->fid = id_; frame->fid = id_;
@@ -227,7 +227,7 @@ void Server::onClientDisconnected()
} }
} }
qDebug() << "Client disconnected:" << __LINE__ << clientId; qInfo() << "Client disconnected:" << __LINE__ << clientId;
socket->deleteLater(); socket->deleteLater();
} }
@@ -245,7 +245,7 @@ void Server::monitorClients()
} }
} }
for (const auto& s : prepareRemove) { for (const auto& s : prepareRemove) {
qDebug() << "Removing inactive client:" << s->property("clientId").toString(); qInfo() << "Removing inactive client:" << s->property("clientId").toString();
s->disconnectFromHost(); s->disconnectFromHost();
} }
} }

View File

@@ -13,7 +13,7 @@ int main(int argc, char* argv[])
int port = 9009; int port = 9009;
if (argc < 2) { if (argc < 2) {
qDebug() << "==============> Usage: frelayServer port."; qInfo() << "==============> Usage: frelayServer port.";
} else { } else {
port = atoi(argv[1]); port = atoi(argv[1]);
} }
@@ -28,7 +28,7 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
qDebug() << "TCP server is running. Press Ctrl+C to exit..."; qInfo() << "TCP server is running. Press Ctrl+C to exit...";
return app.exec(); return app.exec();
} }