mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 02:53:43 +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 "MainWindow.h"
|
||||
#include "Menu.h"
|
||||
#include "OffscreenUi.h"
|
||||
#include "ui/ModelsBrowser.h"
|
||||
|
||||
#include "WindowScriptingInterface.h"
|
||||
|
@ -153,12 +154,11 @@ QScriptValue WindowScriptingInterface::peekNonBlockingFormResult(QScriptValue fo
|
|||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/// Display an alert box
|
||||
/// \param const QString& message message to display
|
||||
/// \return QScriptValue::UndefinedValue
|
||||
QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
||||
QMessageBox::warning(qApp->getWindow(), "", message);
|
||||
OffscreenUi::warning("", message);
|
||||
return QScriptValue::UndefinedValue;
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,16 @@ QScriptValue WindowScriptingInterface::showAlert(const QString& message) {
|
|||
/// \param const QString& message message to display
|
||||
/// \return QScriptValue `true` if 'Yes' was clicked, `false` otherwise
|
||||
QScriptValue WindowScriptingInterface::showConfirm(const QString& message) {
|
||||
QMessageBox::StandardButton response = QMessageBox::question(qApp->getWindow(), "", message);
|
||||
return QScriptValue(response == QMessageBox::Yes);
|
||||
bool confirm = false;
|
||||
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() {
|
||||
|
@ -597,7 +605,6 @@ QScriptValue WindowScriptingInterface::showPrompt(const QString& message, const
|
|||
if (promptDialog.exec() == QDialog::Accepted) {
|
||||
return QScriptValue(promptDialog.textValue());
|
||||
}
|
||||
|
||||
return QScriptValue::NullValue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue