1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +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) :
QDialog(parent),
ui(new Ui::ConfigDialog)
ui(new Ui::ConfigDialog),
m_accepted(false)
{
ui->setupUi(this);
_init();
@ -191,6 +192,7 @@ ConfigDialog::~ConfigDialog()
void ConfigDialog::accept()
{
m_accepted = true;
const int currentWindowedResolution = ui->windowedResolutionComboBox->currentIndex();
config.video.windowedWidth = WindowedModes[currentWindowedResolution].width;
config.video.windowedHeight = WindowedModes[currentWindowedResolution].height;

View File

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

View File

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

View File

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