print:version format.

This commit is contained in:
2025-10-23 09:46:54 +08:00
parent f4c4185999
commit 42a7d89221
9 changed files with 27 additions and 9 deletions

View File

@@ -138,7 +138,12 @@
"valarray": "cpp", "valarray": "cpp",
"filesystem": "cpp", "filesystem": "cpp",
"qmainwindow": "cpp", "qmainwindow": "cpp",
"qlabel": "cpp" "qlabel": "cpp",
"*.in": "cpp",
"fstream": "cpp",
"xmemory0": "cpp",
"xstddef": "cpp",
"xtree": "cpp"
}, },
"editor.tokenColorCustomizations": { "editor.tokenColorCustomizations": {
"textMateRules": [ "textMateRules": [

View File

@@ -5,6 +5,8 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_URL "https://github.com/taynpg/frelay") set(PROJECT_URL "https://github.com/taynpg/frelay")
set(DEVELOP_MARK "dev")
#set(DEVELOP_MARK "release")
if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION) if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 6) set(QT_DEFAULT_MAJOR_VERSION 6)

View File

@@ -7,11 +7,11 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
auto ver = QString("%1 %2 on %3").arg(VERSION_NUM, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH); auto ver = Util::GetVersion();
std::cout << ver.toStdString() << std::endl; std::cout << "==============> " << ver.toStdString() << std::endl;
if (argc < 3) { if (argc < 3) {
std::cerr << "Usage arg is ip port." << std::endl; std::cerr << "==============> Usage arg is ip port." << std::endl;
return 0; return 0;
} }

View File

@@ -29,7 +29,7 @@ frelayGUI::frelayGUI(QWidget* parent) : QDialog(parent), ui(new Ui::frelayGUI)
int height = static_cast<int>(availableGeometry.height() * 0.6); int height = static_cast<int>(availableGeometry.height() * 0.6);
resize(width, height); resize(width, height);
setWindowTitle(QString(tr("frelay %1")).arg(VERSION_NUM)); setWindowTitle(Util::GetVersion());
setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint); setWindowFlags(windowFlags() | Qt::WindowMinimizeButtonHint);
// QLabel* permanent = new QLabel(this); // QLabel* permanent = new QLabel(this);

View File

@@ -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 | | | 23 | 问题 | 作为接收端如果对方断联要处理这个情况。 | | 0.2.2 | |
| 22 | 功能 | 配置可以切组。 | | 0.2.2 | | | 22 | 功能 | 配置可以切组。 | | 0.2.2 | |
| 21 | 功能 | 可以传输文件夹。 | | 0.2.2 | | | 21 | 功能 | 可以传输文件夹。 | | 0.2.2 | |

View File

@@ -8,12 +8,12 @@
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
auto ver = QString("%1 %2 on %3").arg(VERSION_NUM, VERSION_GIT_COMMIT, VERSION_GIT_BRANCH); auto ver = Util::GetVersion();
std::cout << ver.toStdString() << std::endl; std::cout << "==============> " << ver.toStdString() << std::endl;
int port = 9009; int port = 9009;
if (argc < 2) { if (argc < 2) {
qDebug() << "Usage: frelayServer port."; qDebug() << "==============> Usage: frelayServer port.";
} else { } else {
port = atoi(argv[1]); port = atoi(argv[1]);
} }

View File

@@ -6,6 +6,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QMutex> #include <QMutex>
#include <QStandardPaths> #include <QStandardPaths>
#include <fversion.h>
#include <iostream> #include <iostream>
#include <spdlog/fmt/bundled/color.h> #include <spdlog/fmt/bundled/color.h>
#include <spdlog/fmt/fmt.h> #include <spdlog/fmt/fmt.h>
@@ -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 QString DirFileHelper::GetErr() const
{ {
return QString(); return QString();

View File

@@ -48,6 +48,7 @@ public:
static QString Join(const QString& path, const QString& name); static QString Join(const QString& path, const QString& name);
static QString GetCurConfigPath(const QString& sub); static QString GetCurConfigPath(const QString& sub);
static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg); static void ConsoleMsgHander(QtMsgType type, const QMessageLogContext& context, const QString& msg);
static QString GetVersion();
}; };
class DirFileHelper : public QObject class DirFileHelper : public QObject

View File

@@ -5,5 +5,6 @@
#define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@" #define VERSION_GIT_BRANCH "@VERSION_GIT_BRANCH@"
#define VERSION_NUM "@PROJECT_VERSION@" #define VERSION_NUM "@PROJECT_VERSION@"
#define VERSION_URL "@PROJECT_URL@" #define VERSION_URL "@PROJECT_URL@"
#define VERSION_DEV "@DEVELOP_MARK@"
#endif #endif