83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
|
|
#include "app/Application.h"
|
|
|
|
#include "common/SpdLogger.h"
|
|
#include "common/RecourceHelper.h"
|
|
#include "common/CrashHandler.h"
|
|
|
|
#include "ui/MainFrame.h"
|
|
#include "ui/MainWindow.h"
|
|
#include "viewer/OsgWidget.h"
|
|
|
|
#include <QTimer>
|
|
#include <QApplication>
|
|
#include <QGridLayout>
|
|
#include <QSplashScreen>
|
|
#include <QPixmap>
|
|
#include <QLockFile>
|
|
#include <QStandardPaths>
|
|
|
|
#include <osgViewer/CompositeViewer>
|
|
#include <osgViewer/ViewerEventHandlers>
|
|
|
|
#include <osgGA/MultiTouchTrackballManipulator>
|
|
|
|
#include <osgDB/ReadFile>
|
|
#include <osgEarth/MapNode>
|
|
#include <osgEarthUtil/ExampleResources>
|
|
#include <osgGA/StateSetManipulator>
|
|
|
|
#include "osgqt/GraphicsWindowQt.h"
|
|
#include "scene/ui/CompositeWidgetManager.h"
|
|
#include "scene/ui/QueryElevationWidget.h"
|
|
|
|
#ifndef LC
|
|
#define LC "DYT"
|
|
#endif
|
|
|
|
int main(int argc, char* argv[]) {
|
|
SpdLogger logger("logs/log.txt", 5);
|
|
|
|
Application::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
Application app(argc, argv);
|
|
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
|
InstallCrashHandler();
|
|
|
|
// Single-instance guard to avoid multiple launches from repeated clicks
|
|
const QString lockPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/Dyt_app.lock";
|
|
QLockFile lock(lockPath);
|
|
lock.setStaleLockTime(0);
|
|
if (!lock.tryLock(1)) {
|
|
// Another instance is starting or running; exit quietly
|
|
return 0;
|
|
}
|
|
|
|
// Show splash screen immediately to improve perceived startup speed
|
|
QString splashPath = RecourceHelper::Get().GetBasePath() + "/resources/splash.png";
|
|
QPixmap splashPixmap = QPixmap(splashPath).scaled(640, 480, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
QSplashScreen splash(splashPixmap);
|
|
splash.showMessage(("正在启动..."), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
|
|
splash.show();
|
|
app.processEvents();
|
|
|
|
RecourceHelper::ChangeSkin("default");
|
|
splash.showMessage(("正在加载界面皮肤..."), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
|
|
app.processEvents();
|
|
|
|
splash.showMessage(("正在加载数据..."), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
|
|
app.processEvents();
|
|
|
|
|
|
MainFrame mainWindow;
|
|
splash.showMessage(("正在创建主窗口..."), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
|
|
mainWindow.showMaximized();
|
|
splash.finish(&mainWindow);
|
|
|
|
int ret = app.exec();
|
|
// app.Uninit();
|
|
Sleep(200);
|
|
return ret;
|
|
|
|
}
|