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 (QT_VERSION > QT_VERSION_CHECK(5,6,0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
42 QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
44#if defined(Q_OS_ANDROID) && (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
45 QtAndroid::hideSplashScreen();
52 QApplication::setApplicationVersion(RabbitRemoteControl_VERSION);
53 QApplication::setApplicationName(
"RabbitRemoteControl");
54#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
55 QApplication::setDesktopFileName(QLatin1String(
"RabbitRemoteControl.desktop"));
58 QApplication a(argc, argv);
60 RabbitCommon::CTools::Instance()->Init();
62 qInfo(log) << a.applicationName() +
" " + a.applicationVersion() +
" " + QObject::tr(
"Start");
64 QSharedPointer<QTranslator> tApp =
65 RabbitCommon::CTools::Instance()->InstallTranslator(
"RabbitRemoteControlApp");
67 a.setApplicationDisplayName(QObject::tr(
"Rabbit Remote Control"));
68 a.setOrganizationName(QObject::tr(
"Kang Lin Studio"));
72 QSharedPointer<CFrmUpdater> pUpdate(
new CFrmUpdater());
73 QIcon icon = QIcon::fromTheme(
"app");
76 auto sizeList = icon.availableSizes();
77 if(!sizeList.isEmpty()){
78 QPixmap p = icon.pixmap(*sizeList.begin());
79 pUpdate->SetTitle(p.toImage());
82 if(a.arguments().length() > 1) {
83 pUpdate->GenerateUpdateJson();
84 pUpdate->GenerateUpdateXml();
95 QSharedPointer<QUIWidget> quiwidget(
new QUIWidget(
nullptr,
true));
96 bool check = quiwidget->connect(w, SIGNAL(sigFullScreen()),
97 SLOT(showFullScreen()));
99 check = quiwidget->connect(w, SIGNAL(sigShowNormal()),
104 quiwidget->setMainWidget(w);
111 }
catch (std::exception &e) {
112 qCritical(log) <<
"exception:" << e.what();
114 qCritical(log) <<
"exception:";
117#ifndef BUILD_QUIWidget
121 RabbitCommon::CTools::Instance()->Clean();
123 RabbitCommon::CTools::Instance()->RemoveTranslator(tApp);
128 qInfo(log) << a.applicationName() +
" " + a.applicationVersion() +
" " + QObject::tr(
"End");