first commit
This commit is contained in:
199
project/fm_viewer/main.cpp
Normal file
199
project/fm_viewer/main.cpp
Normal file
@@ -0,0 +1,199 @@
|
||||
#if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
#include "ui/window_main.h"
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QFontDatabase>
|
||||
#include "rm_app.h"
|
||||
#include "rm_application.h"
|
||||
#include "tester/rm_tester.h"
|
||||
|
||||
#include "rm_include.h"
|
||||
|
||||
#if (FE_LOG_VERSION)
|
||||
#include "tester/fe_log.h"
|
||||
#endif
|
||||
|
||||
#if (RM_MODEL == RM_MODEL_TYPE_XLDR_88)
|
||||
#include "ui/rm_popup_pw.h"
|
||||
#endif
|
||||
|
||||
#if (RM_TESTING)
|
||||
#include "tester/rm_testing.h"
|
||||
#include "tester/rm_test_dialog.h"
|
||||
#endif
|
||||
|
||||
#if (TUNE_360)
|
||||
#include "tester/rm_tune360_dialog.h"
|
||||
#endif
|
||||
|
||||
#if (SETUP_ONLY_BUILD)
|
||||
#include "cfg/window_settings.h"
|
||||
#endif
|
||||
|
||||
#if (DESIGN_LAYOUT_MODE)
|
||||
#include "tester/rm_design_dialog.h"
|
||||
#endif
|
||||
|
||||
#if (REPORT_CRASH_LOG)
|
||||
#include <Windows.h>
|
||||
#include <QDir>
|
||||
#include "tester/StackWalker.h"
|
||||
class MyStackWalker : public StackWalker
|
||||
{
|
||||
FILE *_file;
|
||||
public:
|
||||
MyStackWalker() : StackWalker()
|
||||
{
|
||||
QDateTime date = QDateTime::currentDateTime();
|
||||
QString path = QDir::cleanPath(RMApp::appPath(RMApp::CAPTURE) + QDir::separator() + date.toString("yyyyMMdd_HHmmss") + "_crash.log");
|
||||
//qInfo() << path << __FUNCTION__;
|
||||
_file = fopen(path.toLocal8Bit(), "w");
|
||||
}
|
||||
MyStackWalker(DWORD dwProcessId, HANDLE hProcess) : StackWalker(dwProcessId, hProcess)
|
||||
{
|
||||
}
|
||||
~MyStackWalker() {
|
||||
fclose(_file);
|
||||
}
|
||||
virtual void OnOutput(LPCSTR szText)
|
||||
{
|
||||
fprintf(_file, "%s\n",szText);
|
||||
//
|
||||
//qInfo() << szText;// << __FUNCTION__;
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
};
|
||||
LONG Win32FaultHandler(struct _EXCEPTION_POINTERS * ExInfo)
|
||||
{
|
||||
MyStackWalker sw;
|
||||
sw.ShowCallstack(GetCurrentThread(), ExInfo->ContextRecord);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
#endif // #if (REPORT_CRASH_LOG)
|
||||
|
||||
//#if (DETECT_SETTING_USB_EJECT)
|
||||
//#include "core/rm_usb.h"
|
||||
//#endif
|
||||
#include <QMessageBox>
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_UNUSED(argc)
|
||||
Q_UNUSED(argv)
|
||||
|
||||
#if (REPORT_CRASH_LOG)
|
||||
// Exception 처리
|
||||
::SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER) Win32FaultHandler);
|
||||
#endif //
|
||||
|
||||
#if (FE_LOG_VERSION)
|
||||
qInstallMessageHandler(FELogHandler::messageOutput); // Install the handler
|
||||
#endif
|
||||
|
||||
|
||||
LOG_INFO << "START APPLICATION";
|
||||
|
||||
#if (TEST_GRAPHIC_ACCEL)
|
||||
QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
||||
#else
|
||||
// qInfo() << "1";
|
||||
// 화면 Twisted 되는 인텔 그래픽 카드용
|
||||
// XP 에서 Angel 지원 되지 않음???
|
||||
if(RMApp::checkGPU() || RMSettings::instance()->HWAccelOff()) // || QSysInfo().windowsVersion() == QSysInfo::WV_XP
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||
}
|
||||
else
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
QGuiApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (OPEN_WITH_FILE_EXT)
|
||||
if(argc > 1) {
|
||||
|
||||
// argc,a.arguments().at(1)
|
||||
//QString logc = QString().sprintf("ARGC %d %d",argc, QFile(a.arguments().at(1)).exists());
|
||||
//QMessageBox::information(NULL,"TEST",QString::fromLocal8Bit(argv[1]));
|
||||
}
|
||||
//RMApp::currentRoot = "D:\\Video\\2023_11\\16\\03\\20231116-030146_REC0_0008.tb4";
|
||||
// 테스트용 임시
|
||||
if(argc > 1 && QFile(QString::fromLocal8Bit(argv[1])).exists()) {
|
||||
RMApp::currentRoot = QString::fromLocal8Bit(argv[1]);
|
||||
}
|
||||
#endif // OPEN_WITH_FILE_EXT
|
||||
|
||||
int argcF = 3;
|
||||
char*argvF[] = {(char*)"Appname", (char*)"--platform", (char*)"windows:dpiawareness=0"};
|
||||
|
||||
RMApplication a(argcF, argvF);
|
||||
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||
if(a.lock() == false)
|
||||
{
|
||||
a.foregroundApplication();
|
||||
// 상황에 따른 메시지 표시하고 종료
|
||||
//rm_wmi::fail_to_start_application(bUnInstall);
|
||||
return -42;
|
||||
}
|
||||
|
||||
|
||||
RMApp::instance()->initialize(a);
|
||||
#if (SETUP_ONLY_BUILD)
|
||||
static WindowSettings* w = new WindowSettings();
|
||||
#else
|
||||
WindowMain* w = WindowMain::instance();
|
||||
|
||||
#if (RM_TESTING)
|
||||
// a.installEventFilter(RMTesting::instance());
|
||||
RMDialogTest::instance(w)->show();
|
||||
#endif
|
||||
#if (TUNE_360)
|
||||
//RMTune360Dialog::instance(w)->show();
|
||||
#endif
|
||||
|
||||
#if (DESIGN_LAYOUT_MODE)
|
||||
FMDesignDialog::instance(w)->show();
|
||||
#endif
|
||||
|
||||
#undef FAST_DEVP_MODE
|
||||
|
||||
#if (USE_PASSWORD_POPUP && START_WITH_PASSWORD && !FAST_DEVP_MODE)
|
||||
bool changeMode = false;
|
||||
while(true) {
|
||||
RMPopupPW* pw = new RMPopupPW(changeMode ? RMPopupPW::PW_CHANGE : RMPopupPW::PW_CHECK);
|
||||
|
||||
// 취소
|
||||
if(pw->exec() == 0) {
|
||||
|
||||
delete pw;
|
||||
// 변경 취소는 다시 입력
|
||||
if(changeMode) {
|
||||
changeMode = false;
|
||||
continue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(pw->currentMode == RMPopupPW::PW_CHANGE) {
|
||||
|
||||
delete pw;
|
||||
changeMode = true;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
delete pw;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // SETUP_ONLY_BUILD
|
||||
w->show();
|
||||
return a.exec();
|
||||
}
|
||||
#endif // #if !(PLAYER_ONLY_LIBRARY_MODE)
|
||||
Reference in New Issue
Block a user