main.cpp 785 B

12345678910111213141516171819202122232425262728293031
  1. #include "mainwindow.h"
  2. #include "core/CoreService.h"
  3. #include <QApplication>
  4. #include <QDebug>
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication app(argc, argv);
  8. app.setStyle("Fusion");
  9. app.setWindowIcon(QIcon(":/qrc/icons/ads_icon.svg"));
  10. // 初始化核心服务(在界面创建之前)
  11. CoreService* coreService = CoreService::instance();
  12. if (!coreService->initialize()) {
  13. qCritical() << "Failed to initialize CoreService";
  14. return -1;
  15. }
  16. // 创建并显示主窗口
  17. MainWindow w;
  18. w.show();
  19. // 运行应用
  20. int result = app.exec();
  21. // 应用退出时关闭核心服务
  22. qDebug() << "Application exiting, shutting down core service...";
  23. coreService->shutdown();
  24. return result;
  25. }