Add loaded state
This commit is contained in:
parent
e260011665
commit
e6c8ffe793
|
@ -57,6 +57,7 @@ ApplicationWindow {
|
||||||
MainForm {
|
MainForm {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
openButton.onClicked: fileDialog.open()
|
openButton.onClicked: fileDialog.open()
|
||||||
|
openButton.text: oboy.loaded ? "Loaded" : "Open ROM"
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
|
|
|
@ -62,7 +62,13 @@ bool OBoy::load(const QString &path)
|
||||||
|
|
||||||
ocaml_path = caml_copy_string_of_os(ba.data());
|
ocaml_path = caml_copy_string_of_os(ba.data());
|
||||||
|
|
||||||
const bool success = Bool_val(caml_callback(*closure_f, ocaml_path));
|
_loaded = Bool_val(caml_callback(*closure_f, ocaml_path));
|
||||||
|
this->loadedChanged(_loaded);
|
||||||
CAMLdrop;
|
CAMLdrop;
|
||||||
return success;
|
return _loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OBoy::loaded() const
|
||||||
|
{
|
||||||
|
return _loaded;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,18 @@ class OBoy : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString name READ name CONSTANT)
|
Q_PROPERTY(QString name READ name CONSTANT)
|
||||||
Q_PROPERTY(QString version READ version CONSTANT)
|
Q_PROPERTY(QString version READ version CONSTANT)
|
||||||
|
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
|
||||||
public:
|
public:
|
||||||
explicit OBoy(QObject *parent = nullptr);
|
explicit OBoy(QObject *parent = nullptr);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString version() const;
|
QString version() const;
|
||||||
|
bool loaded() const;
|
||||||
Q_INVOKABLE bool load(const QString &path);
|
Q_INVOKABLE bool load(const QString &path);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void loadedChanged(bool loaded);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _loaded = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue