2025-06-17 11:48:13 +08:00
|
|
|
#include <QApplication>
|
2025-06-20 10:33:03 +08:00
|
|
|
#include <QDir>
|
2025-06-15 14:31:54 +08:00
|
|
|
#include <QFile>
|
2025-06-21 12:08:01 +08:00
|
|
|
#include <SingleApplication>
|
2025-06-15 14:31:54 +08:00
|
|
|
|
|
|
|
|
#include "frelayGUI.h"
|
|
|
|
|
|
2025-06-20 16:20:34 +08:00
|
|
|
#ifndef COMPILER_USE_MINGW
|
2025-06-20 10:33:03 +08:00
|
|
|
#include <crashelper.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
int main(int argc, char* argv[])
|
|
|
|
|
{
|
2025-06-20 16:20:34 +08:00
|
|
|
|
|
|
|
|
#ifndef COMPILER_USE_MINGW
|
2025-06-20 10:33:03 +08:00
|
|
|
auto configDir = Util::GetCurConfigPath("frelay");
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
backward::SetDumpFileSavePath(configDir + "/dumpfile");
|
|
|
|
|
backward::SetDumpLogSavePath(configDir + "/dumplog");
|
|
|
|
|
#else
|
|
|
|
|
backward::SetDumpLogSavePath(configDir + QDir::separator() + "dumplog");
|
2025-06-20 16:20:34 +08:00
|
|
|
#endif
|
2025-06-25 10:54:04 +08:00
|
|
|
CRASHELPER_MARK_ENTRY();
|
2025-06-20 10:33:03 +08:00
|
|
|
#endif
|
|
|
|
|
|
2025-06-25 23:49:40 +08:00
|
|
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-07-04 21:44:52 +08:00
|
|
|
SingleApplication a(argc, argv);
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
QFont font("Microsoft YaHei", 9);
|
|
|
|
|
a.setFont(font);
|
2025-06-29 11:09:27 +08:00
|
|
|
//a.setStyle("fusion");
|
2025-06-21 12:08:01 +08:00
|
|
|
a.setStyle("windows");
|
2025-06-15 14:31:54 +08:00
|
|
|
#endif
|
|
|
|
|
|
2025-06-21 12:08:01 +08:00
|
|
|
qInstallMessageHandler(frelayGUI::ControlMsgHander);
|
|
|
|
|
qRegisterMetaType<QSharedPointer<FrameBuffer>>("QSharedPointer<FrameBuffer>");
|
|
|
|
|
qRegisterMetaType<InfoClientVec>("InfoClientVec");
|
|
|
|
|
qRegisterMetaType<DirFileInfoVec>("DirFileInfoVec");
|
2025-06-25 16:07:18 +08:00
|
|
|
qRegisterMetaType<TransTask>("TransTask");
|
2025-06-21 12:08:01 +08:00
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
frelayGUI w;
|
2025-06-21 12:08:01 +08:00
|
|
|
|
|
|
|
|
QObject::connect(&a, &SingleApplication::instanceStarted, &w, [&w]() {
|
|
|
|
|
w.showNormal();
|
|
|
|
|
w.raise();
|
|
|
|
|
w.activateWindow();
|
|
|
|
|
});
|
|
|
|
|
|
2025-06-15 14:31:54 +08:00
|
|
|
w.show();
|
|
|
|
|
return a.exec();
|
|
|
|
|
}
|