14#include "mainwindow.h"
16#include <QApplication>
20#include <QSharedPointer>
21#if defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
25#include "RabbitCommonTools.h"
28#include "FrmUpdater.h"
31 #include "QUIWidget/QUIWidget.h"
34#include <QLoggingCategory>
36static Q_LOGGING_CATEGORY(log,
"App.Main")
38int main(
int argc,
char *argv[])
41#if (defined(Q_OS_LINUX) && !defined(Q_OA_ANDROID) \
42 && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
49 qputenv(
"QT_QPA_PLATFORM",
"xcb");
51#if (QT_VERSION > QT_VERSION_CHECK(5,6,0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
52 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
54#if defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
55 QtAndroid::hideSplashScreen();
62 QApplication::setApplicationVersion(RabbitRemoteControl_VERSION);
63 QApplication::setApplicationName(
"RabbitRemoteControl");
64#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
65 QApplication::setDesktopFileName(QLatin1String(
"RabbitRemoteControl.desktop"));
68 QApplication a(argc, argv);
70 RabbitCommon::CTools::Instance()->Init();
72 qInfo(log) << a.applicationName() +
" " + a.applicationVersion() +
" " + QObject::tr(
"Start");
74 QSharedPointer<QTranslator> tApp =
75 RabbitCommon::CTools::Instance()->InstallTranslator(
"RabbitRemoteControlApp");
77 a.setApplicationDisplayName(QObject::tr(
"Rabbit Remote Control"));
78 a.setOrganizationName(QObject::tr(
"Kang Lin Studio"));
82 QSharedPointer<CFrmUpdater> pUpdate(
new CFrmUpdater());
83 QIcon icon = QIcon::fromTheme(
"app");
86 auto sizeList = icon.availableSizes();
87 if(!sizeList.isEmpty()){
88 QPixmap p = icon.pixmap(*sizeList.begin());
89 pUpdate->SetTitle(p.toImage());
92 if(a.arguments().length() > 1) {
93 pUpdate->GenerateUpdateJson();
94 pUpdate->GenerateUpdateXml();
104#ifdef BUILD_QUIWidget
105 QSharedPointer<QUIWidget> quiwidget(
new QUIWidget(
nullptr,
true));
106 bool check = quiwidget->connect(w, SIGNAL(sigFullScreen()),
107 SLOT(showFullScreen()));
109 check = quiwidget->connect(w, SIGNAL(sigShowNormal()),
114 quiwidget->setMainWidget(w);
121 }
catch (std::exception &e) {
122 qCritical(log) <<
"exception:" << e.what();
124 qCritical(log) <<
"exception:";
127#ifndef BUILD_QUIWidget
131 RabbitCommon::CTools::Instance()->Clean();
133 RabbitCommon::CTools::Instance()->RemoveTranslator(tApp);
138 qInfo(log) << a.applicationName() +
" " + a.applicationVersion() +
" " + QObject::tr(
"End");