MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / main

Function main

App/Client/main.cpp:73–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73int main(int argc, char *argv[])
74{
75 int nRet = 0;
76
77// #if HAVE_VirtualKeyboard && defined(Q_OS_ANDROID)
78// InitAndroidVirtualKeyboard();
79// #endif
80
81 // 检查环境变量是否设置成功
82 QByteArray imModule = qgetenv("QT_IM_MODULE");
83 qDebug(log) << "QT_IM_MODULE set to:" << imModule;
84
85 QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
86
87 /* 移到 snapcraft.yaml 和 io.github.KangLin.RabbitRemoteControl.yml
88 // 修复 qtwebengine 沙箱权限问题
89 if(!qEnvironmentVariable("SNAP").isEmpty()) {
90 qputenv("QTWEBENGINE_DISABLE_SANDBOX", "1");
91 }//*/
92
93 //qputenv("QT_MEDIA_BACKEND", "ffmpeg");
94
95#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) \
96 && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
97 /* 修复使用 Qt6 时,最大化时,工具栏位置错误。
98 现在很多 linux 用 wayland 或 wayland-egl 作为桌面显示,这样会出现一个问题,
99 由于没有坐标系统,导致无边框窗体无法拖动和定位(即 QWidge::move 失效)。
100 (Qt6 开始强制默认优先用 wayland ,Qt5 默认有 xcb 则优先用 xcb),
101 所以需要在 main 函数最前面加一行 `qputenv("QT_QPA_PLATFORM", "xcb")`;
102 */
103 QString szPlatform = qEnvironmentVariable("QT_QPA_PLATFORM");
104 if(szPlatform.isEmpty()
105 || -1 != szPlatform.indexOf(QRegularExpression("wayland.*")))
106 qputenv("QT_QPA_PLATFORM", "xcb");
107 qInfo(log) << "QT_QPA_PLATFORM:" << szPlatform << "\nCurrent Qt Platform is:"
108 << qEnvironmentVariable("QT_QPA_PLATFORM")
109 << "; This can be modified with the environment variables QT_QPA_PLATFORM:\n"
110 << "export QT_QPA_PLATFORM=xcb\n Optional: xcb; vnc";
111#endif
112#if (QT_VERSION > QT_VERSION_CHECK(5,6,0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
113 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
114#endif
115#if defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
116 QtAndroid::hideSplashScreen();
117#endif
118
119//#if defined (_DEBUG) || !defined(BUILD_SHARED_LIBS)
120// Q_INIT_RESOURCE(translations_RabbitRemoteControlApp);
121//#endif
122
123 QApplication::setApplicationVersion(RabbitRemoteControl_VERSION);
124 QApplication::setApplicationName("RabbitRemoteControl");
125#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
126 QApplication::setDesktopFileName(QLatin1String("io.github.KangLin.RabbitRemoteControl.desktop"));
127#endif
128
129 QApplication app(argc, argv);
130

Callers

nothing calls this directly

Calls 5

isEmptyMethod · 0.45
InitMethod · 0.45
InitialMethod · 0.45
StopMethod · 0.45
CleanMethod · 0.45

Tested by

no test coverage detected