mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 23:09:52 +02:00
Remove Window.customPrompt() from JavaScript API
This commit is contained in:
parent
c8bb26ae74
commit
d842e532ee
5 changed files with 0 additions and 62 deletions
|
@ -5857,7 +5857,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
|
||||||
DependencyManager::get<TabletScriptingInterface>().data()->setToolbarScriptingInterface(toolbarScriptingInterface);
|
DependencyManager::get<TabletScriptingInterface>().data()->setToolbarScriptingInterface(toolbarScriptingInterface);
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
scriptEngine->registerGlobalObject("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
||||||
qScriptRegisterMetaType(scriptEngine.data(), CustomPromptResultToScriptValue, CustomPromptResultFromScriptValue);
|
|
||||||
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
|
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
|
||||||
LocationScriptingInterface::locationSetter, "Window");
|
LocationScriptingInterface::locationSetter, "Window");
|
||||||
// register `location` on the global object.
|
// register `location` on the global object.
|
||||||
|
|
|
@ -32,20 +32,6 @@ static const QString LAST_BROWSE_LOCATION_SETTING = "LastBrowseLocation";
|
||||||
static const QString LAST_BROWSE_ASSETS_LOCATION_SETTING = "LastBrowseAssetsLocation";
|
static const QString LAST_BROWSE_ASSETS_LOCATION_SETTING = "LastBrowseAssetsLocation";
|
||||||
|
|
||||||
|
|
||||||
QScriptValue CustomPromptResultToScriptValue(QScriptEngine* engine, const CustomPromptResult& result) {
|
|
||||||
if (!result.value.isValid()) {
|
|
||||||
return QScriptValue::UndefinedValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_ASSERT(result.value.userType() == qMetaTypeId<QVariantMap>());
|
|
||||||
return engine->toScriptValue(result.value.toMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomPromptResultFromScriptValue(const QScriptValue& object, CustomPromptResult& result) {
|
|
||||||
result.value = object.toVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WindowScriptingInterface::WindowScriptingInterface() {
|
WindowScriptingInterface::WindowScriptingInterface() {
|
||||||
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
const DomainHandler& domainHandler = DependencyManager::get<NodeList>()->getDomainHandler();
|
||||||
connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged);
|
connect(&domainHandler, &DomainHandler::connectedToDomain, this, &WindowScriptingInterface::domainChanged);
|
||||||
|
@ -140,14 +126,6 @@ void WindowScriptingInterface::disconnectedFromDomain() {
|
||||||
emit domainChanged("");
|
emit domainChanged("");
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomPromptResult WindowScriptingInterface::customPrompt(const QVariant& config) {
|
|
||||||
CustomPromptResult result;
|
|
||||||
bool ok = false;
|
|
||||||
auto configMap = config.toMap();
|
|
||||||
result.value = OffscreenUi::getCustomInfo(OffscreenUi::ICON_NONE, "", configMap, &ok);
|
|
||||||
return ok ? result : CustomPromptResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString fixupPathForMac(const QString& directory) {
|
QString fixupPathForMac(const QString& directory) {
|
||||||
// On OS X `directory` does not work as expected unless a file is included in the path, so we append a bogus
|
// On OS X `directory` does not work as expected unless a file is included in the path, so we append a bogus
|
||||||
// filename if the directory is valid.
|
// filename if the directory is valid.
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
|
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
class CustomPromptResult {
|
|
||||||
public:
|
|
||||||
QVariant value;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(CustomPromptResult);
|
|
||||||
|
|
||||||
QScriptValue CustomPromptResultToScriptValue(QScriptEngine* engine, const CustomPromptResult& result);
|
|
||||||
void CustomPromptResultFromScriptValue(const QScriptValue& object, CustomPromptResult& result);
|
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* The Window API provides various facilities not covered elsewhere: window dimensions, window focus, normal or entity camera
|
* The Window API provides various facilities not covered elsewhere: window dimensions, window focus, normal or entity camera
|
||||||
* view, clipboard, announcements, user connections, common dialog boxes, snapshots, file import, domain changes, domain
|
* view, clipboard, announcements, user connections, common dialog boxes, snapshots, file import, domain changes, domain
|
||||||
|
@ -142,15 +131,6 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void promptAsync(const QString& message = "", const QString& defaultText = "");
|
void promptAsync(const QString& message = "", const QString& defaultText = "");
|
||||||
|
|
||||||
/**jsdoc
|
|
||||||
* Prompt the user for input in a custom, modal dialog.
|
|
||||||
* @deprecated This function is deprecated and will soon be removed.
|
|
||||||
* @function Window.customPrompt
|
|
||||||
* @param {object} config - Configures the modal dialog.
|
|
||||||
* @returns {object} The user's response.
|
|
||||||
*/
|
|
||||||
CustomPromptResult customPrompt(const QVariant& config);
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prompt the user to choose a directory. Displays a modal dialog that navigates the directory tree.
|
* Prompt the user to choose a directory. Displays a modal dialog that navigates the directory tree.
|
||||||
* @function Window.browseDir
|
* @function Window.browseDir
|
||||||
|
|
|
@ -384,19 +384,6 @@ QString OffscreenUi::getItem(const Icon icon, const QString& title, const QStrin
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant OffscreenUi::getCustomInfo(const Icon icon, const QString& title, const QVariantMap& config, bool* ok) {
|
|
||||||
if (ok) {
|
|
||||||
*ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant result = DependencyManager::get<OffscreenUi>()->customInputDialog(icon, title, config);
|
|
||||||
if (ok && result.isValid()) {
|
|
||||||
*ok = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
ModalDialogListener* OffscreenUi::getTextAsync(const Icon icon, const QString& title, const QString& label, const QString& text) {
|
ModalDialogListener* OffscreenUi::getTextAsync(const Icon icon, const QString& title, const QString& label, const QString& text) {
|
||||||
return DependencyManager::get<OffscreenUi>()->inputDialogAsync(icon, title, label, text);
|
return DependencyManager::get<OffscreenUi>()->inputDialogAsync(icon, title, label, text);
|
||||||
}
|
}
|
||||||
|
@ -418,10 +405,6 @@ ModalDialogListener* OffscreenUi::getItemAsync(const Icon icon, const QString& t
|
||||||
return inputDialogListener;
|
return inputDialogListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalDialogListener* OffscreenUi::getCustomInfoAsync(const Icon icon, const QString& title, const QVariantMap& config) {
|
|
||||||
return DependencyManager::get<OffscreenUi>()->customInputDialogAsync(icon, title, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant OffscreenUi::inputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current) {
|
QVariant OffscreenUi::inputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QVariant result;
|
QVariant result;
|
||||||
|
|
|
@ -231,10 +231,8 @@ public:
|
||||||
|
|
||||||
static QString getText(const Icon icon, const QString & title, const QString & label, const QString & text = QString(), bool * ok = 0);
|
static QString getText(const Icon icon, const QString & title, const QString & label, const QString & text = QString(), bool * ok = 0);
|
||||||
static QString getItem(const Icon icon, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0);
|
static QString getItem(const Icon icon, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true, bool * ok = 0);
|
||||||
static QVariant getCustomInfo(const Icon icon, const QString& title, const QVariantMap& config, bool* ok = 0);
|
|
||||||
static ModalDialogListener* getTextAsync(const Icon icon, const QString & title, const QString & label, const QString & text = QString());
|
static ModalDialogListener* getTextAsync(const Icon icon, const QString & title, const QString & label, const QString & text = QString());
|
||||||
static ModalDialogListener* getItemAsync(const Icon icon, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true);
|
static ModalDialogListener* getItemAsync(const Icon icon, const QString & title, const QString & label, const QStringList & items, int current = 0, bool editable = true);
|
||||||
static ModalDialogListener* getCustomInfoAsync(const Icon icon, const QString& title, const QVariantMap& config);
|
|
||||||
|
|
||||||
unsigned int getMenuUserDataId() const;
|
unsigned int getMenuUserDataId() const;
|
||||||
QList<QObject *> &getModalDialogListeners();
|
QList<QObject *> &getModalDialogListeners();
|
||||||
|
|
Loading…
Reference in a new issue