Skip to content

Commit

Permalink
App: add log
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Feb 22, 2025
1 parent f0201f9 commit 69521e7
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions App/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ int main(int argc, char *argv[])
QtAndroid::hideSplashScreen();
#endif

QApplication a(argc, argv);
a.setApplicationVersion(Calendar_VERSION);
a.setApplicationName("Calendar");
QApplication app(argc, argv);
app.setApplicationVersion(Calendar_VERSION);
app.setApplicationName("Calendar");

RabbitCommon::CTools::Instance()->Init();

Expand All @@ -47,33 +47,42 @@ int main(int argc, char *argv[])

CTasksTools::Instance()->InitResource();

a.setApplicationDisplayName(QObject::tr("Calendar"));
app.setApplicationDisplayName(QObject::tr("Calendar"));

qInfo(log) << QObject::tr("Calendar version: ") + Calendar_VERSION
#ifdef Calendar_REVISION
+ " (Revision: [" + Calendar_REVISION
+ "](https://github.com/KangLin/"
+ a.applicationName() +"/tree/"
+ app.applicationName() +"/tree/"
+ Calendar_REVISION + "))"
#endif
+ "; " + QObject::tr("LunarCalendar: ") + CLunarCalendar::Version()
+ "; " + QObject::tr("Rabbit Common: ") + RabbitCommon::CTools::Version();
;

CFrmUpdater *pUpdate = new CFrmUpdater();
QIcon icon = QIcon::fromTheme("calendar");
if(!icon.isNull()) {
auto sizeList = icon.availableSizes();
if(!sizeList.isEmpty()) {
QPixmap p = icon.pixmap(*sizeList.begin());
pUpdate->SetTitle(p.toImage());
if(pUpdate) {
QIcon icon = QIcon::fromTheme("calendar");
if(!icon.isNull()) {
auto sizeList = icon.availableSizes();
if(!sizeList.isEmpty()) {
QPixmap p = icon.pixmap(*sizeList.begin());
pUpdate->SetTitle(p.toImage());
}
}
pUpdate->SetInstallAutoStartup();
if(app.arguments().length() > 1) {
try{
pUpdate->GenerateUpdateJson();
pUpdate->GenerateUpdateXml();
} catch(...) {
qCritical(log) << "Generate update fail";
}

qInfo(log) << app.applicationName() + " " + app.applicationVersion()
+ " " + QObject::tr("Generate update json file End");
return 0;
}
}
pUpdate->SetInstallAutoStartup();
if(a.arguments().length() > 1) {
pUpdate->GenerateUpdateJson();
pUpdate->GenerateUpdateXml();
return 0;
}

CMainWindow win;
Expand All @@ -87,7 +96,7 @@ int main(int argc, char *argv[])
win.show();
#endif

int nRet = a.exec();
int nRet = app.exec();

RabbitCommon::CTools::Instance()->Clean();

Expand Down

0 comments on commit 69521e7

Please sign in to comment.