-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
76 lines (59 loc) · 2.35 KB
/
main.cpp
File metadata and controls
76 lines (59 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// main.cpp
#include "pch.h"
#include "module/data/data_Booking.h"
#include <QTableView>
#include <qtimezone.h>
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "module/data/data_mail.h"
#include "module/model/BookingDataModel.h"
#include "service/stastic/sharedFunctions.h"
#include "view/bookingService/booking_home.h"
#include "view/bookingService/rent.h"
#include "view/EquipmentClass/equipmentclassblock.h"
#include "view/EquipmentClass/equipmentclassmanagehomepage.h"
#include "view/homepage/teacherhomepage.h"
#include "view/loginPage/loginpage.h"
#include "view/loginPage/registerpage.h"
#include "view/messageCenter/messagewindow.h"
#include "view/equipmentManage/equipment_home.h"
#include "view/RegisterCenter/checknewuser.h"
#include "view/SplashScreen/nativesplash.h"
//#include "view/SplashScreen/splashscreen.h"
#include "module/scanner/DbCaculator.h"
#include "module/scanner/WorkAlert.h"
void setup_tasks() {
// 后台定时每1分钟扫描库存告警
service::taskManager::getTimer().scheduleTask(60000, []() {
bot::InventoryAlert::sendAlert();
bot::WorkAlert::sendAdminCheckNewUserAlert();
bot::DbCaculator::reCaculate();
});
}
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
qInstallMessageHandler(service::customMessageHandler); //拦截部分错误,真的修不好了喵眼不见心不烦
view::SplashScreen::nativeSplash splash;
splash.show();
service::logger::instance().setLogFile(
QString("log/app_%1.log").arg(QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss")).toStdString());
service::logger::instance().setDataLogFile("log/data.log");
service::logger::instance().setLevel(LogLevel::WARN);
service::logger::instance().enableStackTrace(false);
service::log() << "程序启动";
service::initDB();
// QFile styleFile(":/styles/fluent.qss");
// if (styleFile.open(QFile::ReadOnly | QFile::Text)) {
// QString styleSheet = QLatin1String(styleFile.readAll());
// a.setStyleSheet(styleSheet);
// styleFile.close();
// } else {
// log(LogLevel::ERR) << "无法加载样式表文件: " << styleFile.fileName();
// }
view::login::loginPage b;
b.show();
setup_tasks();
service::taskManager::getTimer().startAll();
splash.closeSplash();
return QApplication::exec();
}