From 42a7d8922155d56412634977739a657842253df1 Mon Sep 17 00:00:00 2001 From: taynpg Date: Thu, 23 Oct 2025 09:46:54 +0800 Subject: [PATCH] =?UTF-8?q?print=EF=BC=9Aversion=20format.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 7 ++++++- CMakeLists.txt | 2 ++ Console/main.cpp | 6 +++--- Gui/frelayGUI.cpp | 2 +- Note/version.md | 4 +++- Server/main.cpp | 6 +++--- Util/Util.cpp | 7 +++++++ Util/Util.h | 1 + version.h.in | 1 + 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8096df0..e700a27 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -138,7 +138,12 @@ "valarray": "cpp", "filesystem": "cpp", "qmainwindow": "cpp", - "qlabel": "cpp" + "qlabel": "cpp", + "*.in": "cpp", + "fstream": "cpp", + "xmemory0": "cpp", + "xstddef": "cpp", + "xtree": "cpp" }, "editor.tokenColorCustomizations": { "textMateRules": [ diff --git a/CMakeLists.txt b/CMakeLists.txt index f53c24b..b880aec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(PROJECT_URL "https://github.com/taynpg/frelay") +set(DEVELOP_MARK "dev") +#set(DEVELOP_MARK "release") if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION) set(QT_DEFAULT_MAJOR_VERSION 6) diff --git a/Console/main.cpp b/Console/main.cpp index fedfc05..9842eaf 100644 --- a/Console/main.cpp +++ b/Console/main.cpp @@ -7,11 +7,11 @@ int main(int argc, char* argv[]) { - auto ver = QString("%1 %2 on %3").arg(VERSION_NUM, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH); - std::cout << ver.toStdString() << std::endl; + auto ver = Util::GetVersion(); + std::cout << "==============> " << ver.toStdString() << std::endl; if (argc < 3) { - std::cerr << "Usage arg is ip port." << std::endl; + std::cerr << "==============> Usage arg is ip port." << std::endl; return 0; } diff --git a/Gui/frelayGUI.cpp b/Gui/frelayGUI.cpp index 3edc4e8..b977e4f 100644 --- a/Gui/frelayGUI.cpp +++ b/Gui/frelayGUI.cpp @@ -29,7 +29,7 @@ frelayGUI::frelayGUI(QWidget* parent) : QDialog(parent), ui(new Ui::frelayGUI) int height = static_cast(availableGeometry.height() * 0.6); resize(width, height); - setWindowTitle(QString(tr("frelay %1")).arg(VERSION_NUM)); + setWindowTitle(Util::GetVersion()); setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint); // QLabel* permanent = new QLabel(this); diff --git a/Note/version.md b/Note/version.md index 08cb601..58d6dca 100644 --- a/Note/version.md +++ b/Note/version.md @@ -8,7 +8,9 @@ | 序号 | 类型 | 内容 | 说明 | 基于版本 | 完成版本 | | :--: | :--: | ------------------------------------------------------------ | :--: | :------: | :------: | -| 24 | 问题 | 发送端如果发送的数据比较大,会卡住(功能是正常的)。 | | 0.2.2 | | +| 26 | 功能 | 最好能保存关闭界面时Splitter和UI的尺寸。 | | 0.2.2 | | +| 25 | 功能 | 手动输入的文件夹访问路径保存历史记录,以便后续可能再次使用(10条)。 | | 0.2.2 | | +| 24 | 问题 | 发送端如果发送的数据比较大,UI会卡住(功能是正常的)。 | | 0.2.2 | | | 23 | 问题 | 作为接收端如果对方断联要处理这个情况。 | | 0.2.2 | | | 22 | 功能 | 配置可以切组。 | | 0.2.2 | | | 21 | 功能 | 可以传输文件夹。 | | 0.2.2 | | diff --git a/Server/main.cpp b/Server/main.cpp index 27fca37..af22fda 100644 --- a/Server/main.cpp +++ b/Server/main.cpp @@ -8,12 +8,12 @@ int main(int argc, char* argv[]) { - auto ver = QString("%1 %2 on %3").arg(VERSION_NUM, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH); - std::cout << ver.toStdString() << std::endl; + auto ver = Util::GetVersion(); + std::cout << "==============> " << ver.toStdString() << std::endl; int port = 9009; if (argc < 2) { - qDebug() << "Usage: frelayServer port."; + qDebug() << "==============> Usage: frelayServer port."; } else { port = atoi(argv[1]); } diff --git a/Util/Util.cpp b/Util/Util.cpp index 062cca2..9539769 100644 --- a/Util/Util.cpp +++ b/Util/Util.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -118,6 +119,12 @@ void Util::ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, c } } +QString Util::GetVersion() +{ + auto ver = QString("frelay %1 %2").arg(VERSION_NUM, VERSION_DEV); + return ver; +} + QString DirFileHelper::GetErr() const { return QString(); diff --git a/Util/Util.h b/Util/Util.h index 6979d55..95cb3b1 100644 --- a/Util/Util.h +++ b/Util/Util.h @@ -48,6 +48,7 @@ public: static QString Join(const QString& path, const QString& name); static QString GetCurConfigPath(const QString& sub); static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg); + static QString GetVersion(); }; class DirFileHelper : public QObject diff --git a/version.h.in b/version.h.in index 035fba3..8287d2a 100644 --- a/version.h.in +++ b/version.h.in @@ -5,5 +5,6 @@ #define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@" #define VERSION_NUM "@PROJECT_VERSION@" #define VERSION_URL "@PROJECT_URL@" +#define VERSION_DEV "@DEVELOP_MARK@" #endif \ No newline at end of file