2025-06-17 12:00:46 +08:00
|
|
|
#include <QCoreApplication>
|
2025-06-20 10:33:03 +08:00
|
|
|
#include <Util.h>
|
2025-10-20 15:22:38 +08:00
|
|
|
#include <fversion.h>
|
2025-10-23 11:43:49 +08:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <memory>
|
2025-06-17 12:00:46 +08:00
|
|
|
|
2025-11-09 15:31:59 +08:00
|
|
|
#if defined(_WIN32)
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-06-17 12:00:46 +08:00
|
|
|
#include "Console.h"
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
|
{
|
2025-11-11 13:47:36 +08:00
|
|
|
qRegisterMetaType<QSharedPointer<FrameBuffer>>("QSharedPointer<FrameBuffer>");
|
|
|
|
|
qRegisterMetaType<InfoClientVec>("InfoClientVec");
|
|
|
|
|
qRegisterMetaType<DirFileInfoVec>("DirFileInfoVec");
|
|
|
|
|
qRegisterMetaType<TransTask>("TransTask");
|
|
|
|
|
qRegisterMetaType<QVector<QString>>("QVector<QString>");
|
2025-11-09 15:31:59 +08:00
|
|
|
|
|
|
|
|
#if defined(_WIN32)
|
|
|
|
|
SetConsoleOutputCP(CP_UTF8);
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-10-23 09:46:54 +08:00
|
|
|
auto ver = Util::GetVersion();
|
|
|
|
|
std::cout << "==============> " << ver.toStdString() << std::endl;
|
2025-10-20 15:22:38 +08:00
|
|
|
|
2025-06-20 17:21:58 +08:00
|
|
|
if (argc < 3) {
|
2025-10-23 09:46:54 +08:00
|
|
|
std::cerr << "==============> Usage arg is ip port." << std::endl;
|
2025-06-20 17:21:58 +08:00
|
|
|
return 0;
|
|
|
|
|
}
|
2025-06-20 16:20:34 +08:00
|
|
|
|
2025-06-17 12:00:46 +08:00
|
|
|
QCoreApplication app(argc, argv);
|
|
|
|
|
|
|
|
|
|
Util::InitLogger("frelayConsole.log", "frelayConsole");
|
|
|
|
|
qInstallMessageHandler(Util::ConsoleMsgHander);
|
|
|
|
|
|
2025-10-23 11:43:49 +08:00
|
|
|
auto core = std::make_shared<ClientCore>();
|
|
|
|
|
auto helper = std::make_shared<ConsoleHelper>();
|
2025-06-20 17:21:58 +08:00
|
|
|
|
|
|
|
|
helper->SetIpPort(argv[1], QString("%1").arg(argv[2]).toInt());
|
2025-10-23 11:43:49 +08:00
|
|
|
helper->RunWorker(core.get());
|
2025-06-20 17:21:58 +08:00
|
|
|
helper->Connect();
|
|
|
|
|
|
2025-11-15 12:47:56 +08:00
|
|
|
QObject::connect(core.get(), &ClientCore::sigDisconnect, [&app](){
|
|
|
|
|
qWarning() << "Abnormal state, quit...";
|
|
|
|
|
app.exit();
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-17 12:00:46 +08:00
|
|
|
return app.exec();
|
2025-06-21 12:08:01 +08:00
|
|
|
}
|