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

Function main

App/ServiceConfigure/main.cpp:48–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46Q_LOGGING_CATEGORY(App, "App")
47
48int main(int argc, char *argv[])
49{
50 int nRet = 0;
51 QApplication::setApplicationVersion(RabbitRemoteControl_VERSION);
52 QApplication::setApplicationName("RabbitRemoteControlService");
53#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
54 QApplication::setDesktopFileName(QLatin1String("RabbitRemoteControlServiceConfigure.desktop"));
55#endif
56
57 QApplication a(argc, argv);
58
59 RabbitCommon::CTools::Instance()->Init();
60 // Install translator
61 QTranslator tApp;
62 QString szFile = RabbitCommon::CDir::Instance()->GetDirTranslations()
63 + QDir::separator() + "RabbitRemoteControlServiceConfigure_"
64 + QLocale::system().name() + ".qm";
65 tApp.load(szFile);
66 if(a.installTranslator(&tApp))
67 qInfo(App) << "Language:" << QLocale::system() << "File:" << szFile;
68 else
69 qCritical(App) << "Language:" << QLocale::system() << "File:" << szFile;
70
71 a.setApplicationDisplayName(QObject::tr("Rabbit remote control service configure"));
72 a.setOrganizationName(QObject::tr("Kang Lin studio"));
73
74 CMainWindow* w = new CMainWindow();
75 w->setWindowTitle(a.applicationDisplayName());
76 try {
77 //w->setWindowIcon(QIcon::fromTheme("app"));
78 //w->setWindowTitle(a.applicationDisplayName());
79
80#ifdef BUILD_QUIWidget
81 QSharedPointer<QUIWidget> quiwidget(new QUIWidget(nullptr, true));
82 bool check = quiwidget->connect(w, SIGNAL(sigFullScreen()),
83 SLOT(showFullScreen()));
84 Q_ASSERT(check);
85 check = quiwidget->connect(w, SIGNAL(sigShowNormal()),
86 SLOT(showNormal()));
87 Q_ASSERT(check);
88 //quiwidget.setPixmap(QUIWidget::Lab_Ico, ":/image/App");
89 //quiwidget.setTitle(a.applicationDisplayName());
90 quiwidget->setMainWidget(w);
91 quiwidget->show();
92#else
93 w->show();
94#endif
95
96 nRet = a.exec();
97 } catch (std::exception &e) {
98 qCritical(App) << "exception:" << e.what();
99 } catch(...) {
100 qCritical(App) << "exception";
101 }
102
103#ifndef BUILD_QUIWidget
104 delete w;
105#endif

Callers

nothing calls this directly

Calls 2

InitMethod · 0.45
CleanMethod · 0.45

Tested by

no test coverage detected