diff --git a/app/util/qopenhd.cpp b/app/util/qopenhd.cpp
index 3b8b76da5..1d4a635bf 100644
--- a/app/util/qopenhd.cpp
+++ b/app/util/qopenhd.cpp
@@ -363,6 +363,11 @@ void QOpenHD::show_toast(QString message,bool long_toast)
emit signal_toast_add(message,long_toast);
}
+void QOpenHD::show_error_message(QString message)
+{
+
+}
+
void QOpenHD::set_busy_for_milliseconds(int milliseconds,QString reason)
{
set_is_busy(true);
diff --git a/app/util/qopenhd.h b/app/util/qopenhd.h
index 46f91202f..ad4c0901b 100644
--- a/app/util/qopenhd.h
+++ b/app/util/qopenhd.h
@@ -70,6 +70,11 @@ class QOpenHD : public QObject
//
Q_INVOKABLE void show_toast(QString message,bool long_toast=false);
L_RO_PROP(QString,version_string,set_version_string,"2.5.4-evo-alpha");
+ //
+ // Shows a message popup to the user that needs to be clicked away - use sparingly
+ //
+ Q_INVOKABLE void show_error_message(QString message);
+ L_RO_PROP(QString,error_message_text,set_error_message_text,"");
// Notify that something is going on for a specified amount of time
public:
Q_INVOKABLE void set_busy_for_milliseconds(int milliseconds,QString reason);
diff --git a/qml/main.qml b/qml/main.qml
index c0510eee3..abb2f9795 100755
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -126,7 +126,9 @@ ApplicationWindow {
WorkaroundMessageBox{
id: workaroundmessagebox
}
-
+ ErrorMessageBox{
+ id: errorMessageBox
+ }
CardToast{
id: card_toast
m_text: _qopenhd.toast_text
diff --git a/qml/qml.qrc b/qml/qml.qrc
index 9f0d80a71..1a14f0176 100644
--- a/qml/qml.qrc
+++ b/qml/qml.qrc
@@ -305,5 +305,6 @@
ui/elements/NewSpinBox.qml
ui/elements/NewSlider.qml
ui/sidebar/InfoElement2.qml
+ ui/elements/ErrorMessageBox.qml
diff --git a/qml/ui/elements/ErrorMessageBox.qml b/qml/ui/elements/ErrorMessageBox.qml
new file mode 100644
index 000000000..ab9d4d380
--- /dev/null
+++ b/qml/ui/elements/ErrorMessageBox.qml
@@ -0,0 +1,63 @@
+import QtQuick 2.12
+import QtQuick.Controls 2.12
+
+import QtQuick.Controls.Material 2.12
+import QtQuick.Layouts 1.0
+
+import Qt.labs.settings 1.0
+
+import OpenHD 1.0
+
+// We need this one to display popup messages to the user on platforms that don't support
+// QMessageBox (e.g. eglfs) since QMessageBox wants to open a new window
+// TODO make me less dirty / hacky
+// See the corrseponding .cpp class for more info
+Card {
+ id: errorMessageBox
+ width: 360
+ height: 340
+ z: 20.0
+ anchors.centerIn: parent
+ cardName: qsTr("ERROR")
+ cardNameColor: "red"
+ visible: _qopenhd.error_message_text!==""
+ cardBody: ScrollView {
+ contentHeight: errorMessageBox_text.height
+ contentWidth: errorMessageBox_text.width
+ ScrollBar.vertical.interactive: true
+ height: 200
+ width: 350
+ clip:true
+ anchors.centerIn: parent.Center
+ Text {
+ id: errorMessageBox_text
+ width: 320
+ text: _qopenhd.error_message_text
+ leftPadding: 12
+ rightPadding: 12
+ font.pixelSize: 14
+ wrapMode: Text.WordWrap
+ }
+ }
+ hasFooter: true
+ cardFooter: Item {
+ anchors.fill: parent
+ Button {
+ width: 140
+ height: 48
+ anchors.right: parent.right
+ anchors.rightMargin: 12
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 6
+ font.pixelSize: 14
+ font.capitalization: Font.MixedCase
+ Material.accent: Material.Green
+ highlighted: true
+ text: qsTr("Okay")
+ onPressed: {
+ _qopenhd.show_error_message("")
+ hudOverlayGrid.regain_focus()
+ }
+ }
+ }
+}