1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

RunConfig() returns true if user pushed OK.

This commit is contained in:
Sergey Lipskiy 2015-02-21 16:43:22 +06:00
parent 2b87c0e131
commit 526dfe0846
4 changed files with 16 additions and 8 deletions

View File

@ -178,7 +178,8 @@ void ConfigDialog::_init()
ConfigDialog::ConfigDialog(QWidget *parent) : ConfigDialog::ConfigDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::ConfigDialog) ui(new Ui::ConfigDialog),
m_accepted(false)
{ {
ui->setupUi(this); ui->setupUi(this);
_init(); _init();
@ -191,6 +192,7 @@ ConfigDialog::~ConfigDialog()
void ConfigDialog::accept() void ConfigDialog::accept()
{ {
m_accepted = true;
const int currentWindowedResolution = ui->windowedResolutionComboBox->currentIndex(); const int currentWindowedResolution = ui->windowedResolutionComboBox->currentIndex();
config.video.windowedWidth = WindowedModes[currentWindowedResolution].width; config.video.windowedWidth = WindowedModes[currentWindowedResolution].width;
config.video.windowedHeight = WindowedModes[currentWindowedResolution].height; config.video.windowedHeight = WindowedModes[currentWindowedResolution].height;

View File

@ -16,6 +16,8 @@ public:
explicit ConfigDialog(QWidget *parent = 0); explicit ConfigDialog(QWidget *parent = 0);
~ConfigDialog(); ~ConfigDialog();
bool isAccepted() const {return m_accepted;}
public Q_SLOTS: public Q_SLOTS:
virtual void accept(); virtual void accept();
@ -34,6 +36,7 @@ private:
Ui::ConfigDialog *ui; Ui::ConfigDialog *ui;
QFont m_font; QFont m_font;
QColor m_color; QColor m_color;
bool m_accepted;
}; };
#endif // CONFIGDIALOG_H #endif // CONFIGDIALOG_H

View File

@ -15,7 +15,7 @@ inline void initMyResource() { Q_INIT_RESOURCE(icon); }
inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); } inline void cleanMyResource() { Q_CLEANUP_RESOURCE(icon); }
static static
int openConfigDialog() int openConfigDialog(bool & _accepted)
{ {
cleanMyResource(); cleanMyResource();
initMyResource(); initMyResource();
@ -27,7 +27,9 @@ int openConfigDialog()
ConfigDialog w; ConfigDialog w;
w.show(); w.show();
return a.exec(); const int res = a.exec();
_accepted = w.isAccepted();
return res;
} }
static static
@ -45,10 +47,11 @@ int openAboutDialog()
return a.exec(); return a.exec();
} }
int runConfigThread() { bool runConfigThread() {
std::thread configThread(openConfigDialog); bool accepted = false;
std::thread configThread(openConfigDialog, std::ref(accepted));
configThread.join(); configThread.join();
return 0; return accepted;
} }
int runAboutThread() { int runAboutThread() {
@ -57,7 +60,7 @@ int runAboutThread() {
return 0; return 0;
} }
EXPORT int CALL RunConfig() EXPORT bool CALL RunConfig()
{ {
return runConfigThread(); return runConfigThread();
} }

View File

@ -13,7 +13,7 @@ extern "C" {
#define CALL _cdecl #define CALL _cdecl
#endif #endif
EXPORT int CALL RunConfig(); EXPORT bool CALL RunConfig();
EXPORT int CALL RunAbout(); EXPORT int CALL RunAbout();
EXPORT void CALL LoadConfig(); EXPORT void CALL LoadConfig();
EXPORT void CALL SaveScreenshot(const char * _folder, const char * _name, int _width, int _height, const unsigned char * _data); EXPORT void CALL SaveScreenshot(const char * _folder, const char * _name, int _width, int _height, const unsigned char * _data);