548 lines · 22.1 KB · C++
RawDownload
void WindowScriptingInterface::updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton) {    auto messageBox = _messageBoxes.value(id);    if (messageBox) {        if (QThread::currentThread() != thread()) {            QMetaObject::invokeMethod(this, "updateMessageBox",                Q_ARG(int, id),                Q_ARG(QString, title),                Q_ARG(QString, text),                Q_ARG(int, buttons),                Q_ARG(int, defaultButton));            return;        }         messageBox->setProperty("title", title);        messageBox->setProperty("text", text);        messageBox->setProperty("buttons", buttons);        messageBox->setProperty("defaultButton", defaultButton);    }} void WindowScriptingInterface::closeMessageBox(int id) {    auto messageBox = _messageBoxes.value(id);    if (messageBox) {        if (QThread::currentThread() != thread()) {            QMetaObject::invokeMethod(this, "closeMessageBox",                Q_ARG(int, id));            return;        }         disconnect(messageBox);        messageBox->setVisible(false);        messageBox->deleteLater();        _messageBoxes.remove(id);    }} void WindowScriptingInterface::onMessageBoxSelected(int button) {    auto messageBox = qobject_cast<QQuickItem*>(sender());    auto keys = _messageBoxes.keys(messageBox);    if (keys.length() > 0) {        auto id = keys[0];  // Should be just one message box.        emit messageBoxClosed(id, button);        disconnect(messageBox);        messageBox->setVisible(false);        messageBox->deleteLater();        _messageBoxes.remove(id);    }}

Lines 501–548 of 548. Previous lines