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)
|
if (config.generalEmulation.enableCustomSettings != 0 && _romName != nullptr && strlen(_romName) != 0)
|
||||||
loadCustomRomSettings(strIniFileName, _romName);
|
loadCustomRomSettings(strIniFileName, _romName);
|
||||||
|
|
||||||
#ifndef M64P_GLIDENUI
|
std::unique_ptr<QApplication> pQApp;
|
||||||
int argc = 0;
|
QCoreApplication* pApp = QCoreApplication::instance();
|
||||||
char * argv = 0;
|
|
||||||
QApplication a(argc, &argv);
|
if (pApp == nullptr) {
|
||||||
|
int argc = 0;
|
||||||
|
char * argv = 0;
|
||||||
|
pQApp.reset(new QApplication(argc, &argv));
|
||||||
|
pApp = pQApp.get();
|
||||||
|
}
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
if (translator.load(getTranslationFile(), strIniFileName))
|
if (translator.load(getTranslationFile(), strIniFileName))
|
||||||
a.installTranslator(&translator);
|
pApp->installTranslator(&translator);
|
||||||
#endif // M64P_GLIDENUI
|
|
||||||
|
|
||||||
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
ConfigDialog w(Q_NULLPTR, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
|
||||||
|
|
||||||
w.setIniPath(strIniFileName);
|
w.setIniPath(strIniFileName);
|
||||||
w.setRomName(_romName);
|
w.setRomName(_romName);
|
||||||
w.setTitle();
|
w.setTitle();
|
||||||
#ifndef M64P_GLIDENUI
|
|
||||||
w.show();
|
w.show();
|
||||||
const int res = a.exec();
|
|
||||||
#else
|
int res = pQApp ? pQApp->exec() : w.exec();
|
||||||
const int res = w.exec();
|
|
||||||
#endif // M64P_GLIDENUI
|
|
||||||
_accepted = w.isAccepted();
|
_accepted = w.isAccepted();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user