mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 18:21:16 +02:00
move alert and confirm to use offscreen ui
This commit is contained in:
parent
26f0030ca0
commit
2b5956af99
1 changed files with 12 additions and 5 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include "DomainHandler.h"
|
#include "DomainHandler.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
#include "OffscreenUi.h"
|
||||||
#include "ui/ModelsBrowser.h"
|
#include "ui/ModelsBrowser.h"
|
||||||
|
|
||||||
#include "WindowScriptingInterface.h"
|
#include "WindowScriptingInterface.h"
|
||||||
|
@ -153,12 +154,11 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Display an alert box
|
/// Display an alert box
|
||||||
/// \param const QString& message message to display
|
/// \param const QString& message message to display
|
||||||
/// \return QScriptValue::UndefinedValue
|
/// \return QScriptValue::UndefinedValue
|
||||||
QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
||||||
QMessageBox::warning(qApp->getWindow(), "", message);
|
OffscreenUi::warning("", message);
|
||||||
return QScriptValue::UndefinedValue;
|
return QScriptValue::UndefinedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,8 +166,16 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
||||||
/// \param const QString& message message to display
|
/// \param const QString& message message to display
|
||||||
/// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise
|
/// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise
|
||||||
QScriptValue WindowScriptingInterface::showConfirm(const QString& message) {
|
QScriptValue WindowScriptingInterface::showConfirm(const QString& message) {
|
||||||
QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message);
|
bool confirm = false;
|
||||||
return QScriptValue(response == QMessageBox::Yes);
|
bool waiting = true;
|
||||||
|
OffscreenUi::question("", message, [&](QMessageBox::StandardButton response){
|
||||||
|
confirm = (response == QMessageBox::Yes);
|
||||||
|
waiting = false;
|
||||||
|
});
|
||||||
|
while (waiting) {
|
||||||
|
QCoreApplication::processEvents();
|
||||||
|
}
|
||||||
|
return QScriptValue(confirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowScriptingInterface::chooseDirectory() {
|
void WindowScriptingInterface::chooseDirectory() {
|
||||||
|
@ -597,7 +605,6 @@ QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const
|
||||||
if (promptDialog.exec() == QDialog::Accepted) {
|
if (promptDialog.exec() == QDialog::Accepted) {
|
||||||
return QScriptValue(promptDialog.textValue());
|
return QScriptValue(promptDialog.textValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return QScriptValue::NullValue;
|
return QScriptValue::NullValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue