aboutsummaryrefslogtreecommitdiff
path: root/src/main_qmladaptor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main_qmladaptor.h')
-rw-r--r--src/main_qmladaptor.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main_qmladaptor.h b/src/main_qmladaptor.h
new file mode 100644
index 0000000..30aae97
--- /dev/null
+++ b/src/main_qmladaptor.h
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <QObject>
+#include <QQmlApplicationEngine>
+#include <QQuickItem>
+#include <QMessageBox>
+#include <QApplication>
+#include <QClipboard>
+
+//#include "session.cpp"
+
+class MainQMLAdaptor : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool showMessageDialog READ getShowMessageDialog NOTIFY showMessageDialogChanged) // this makes showMessageDialog available as a QML property
+ Q_PROPERTY(QString _messageDialogTitle READ getMessageDialogTitle NOTIFY messageDialogTitleChanged) // this makes showMessageDialogTitle available as a QML property
+ Q_PROPERTY(QString _messageDialogText READ getMessageDialogText NOTIFY messageDialogTextChanged) // this makes showMessageDialogText available as a QML property
+ Q_PROPERTY(QMessageBox::Icon _messageDialogIcon READ getMessageDialogIcon NOTIFY messageDialogIconChanged) // this makes showMessageDialogIcon available as a QML property
+public:
+ explicit MainQMLAdaptor(QObject *parent, QQmlApplicationEngine *engine = nullptr);
+
+// void setSession(Session session);
+
+ bool setConnectButtonEnabled(bool enabled);
+ bool setConnectButtonChecked(bool checked);
+
+ bool setStatusIndicator(bool active, QColor color = QColor(255,255,255));
+ bool setStatus(QString status);
+
+ bool openMessageDialog(QString title, QString text, QMessageBox::Icon);
+ QString getMessageDialogTitle();
+ QString getMessageDialogText();
+ QMessageBox::Icon getMessageDialogIcon();
+ bool getShowMessageDialog();
+signals:
+ void showMessageDialogChanged(bool show);
+ void messageDialogTextChanged(QString text);
+ void messageDialogTitleChanged(QString title);
+ void messageDialogIconChanged(int iconindex);
+
+// static void onCloseSignal();
+
+//protected:
+// Session _session;
+private:
+ QQmlApplicationEngine* _engine;
+
+ bool _showMessageDialog;
+ QString _messageDialogTitle;
+ QString _messageDialogText;
+ QMessageBox::Icon _messageDialogIcon;
+
+public slots:
+ void handleCopyToClipboardButtonClick(QString copy_data);
+// static void onCloseHandler();
+};