mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
GLideNUI: detect application instance dynamically
This commit is contained in:
parent
4f5a763666
commit
00dac336f8
|
@ -29,27 +29,28 @@ int openConfigDialog(const wchar_t * _strFileName, const char * _romName, bool &
|
|||
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
|
||||
loadCustomRomSettings(strIniFileName, _romName);
|
||||
|
||||
#ifndef M64P_GLIDENUI
|
||||
std::unique_ptr<QApplication> pQApp;
|
||||
QCoreApplication* pApp = QCoreApplication::instance();
|
||||
|
||||
if (pApp == nullptr) {
|
||||
int argc = 0;
|
||||
char * argv = 0;
|
||||
QApplication a(argc, &argv);
|
||||
pQApp.reset(new QApplication(argc, &argv));
|
||||
pApp = pQApp.get();
|
||||
}
|
||||
|
||||
QTranslator translator;
|
||||
if (translator.load(getTranslationFile(), strIniFileName))
|
||||
a.installTranslator(&translator);
|
||||
#endif // M64P_GLIDENUI
|
||||
pApp->installTranslator(&translator);
|
||||
|
||||
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
||||
|
||||
w.setIniPath(strIniFileName);
|
||||
w.setRomName(_romName);
|
||||
w.setTitle();
|
||||
#ifndef M64P_GLIDENUI
|
||||
w.show();
|
||||
const int res = a.exec();
|
||||
#else
|
||||
const int res = w.exec();
|
||||
#endif // M64P_GLIDENUI
|
||||
|
||||
int res = pQApp ? pQApp->exec() : w.exec();
|
||||
_accepted = w.isAccepted();
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user