Add loaded state
This commit is contained in:
		
							parent
							
								
									e260011665
								
							
						
					
					
						commit
						e6c8ffe793
					
				
					 3 changed files with 17 additions and 2 deletions
				
			
		|  | @ -57,6 +57,7 @@ ApplicationWindow { | |||
|     MainForm { | ||||
|         anchors.fill: parent | ||||
|         openButton.onClicked: fileDialog.open() | ||||
|         openButton.text: oboy.loaded ? "Loaded" : "Open ROM" | ||||
|     } | ||||
| 
 | ||||
|     MessageDialog { | ||||
|  |  | |||
|  | @ -62,7 +62,13 @@ bool OBoy::load(const QString &path) | |||
| 
 | ||||
|     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; | ||||
|     return success; | ||||
|     return _loaded; | ||||
| } | ||||
| 
 | ||||
| bool OBoy::loaded() const | ||||
| { | ||||
|     return _loaded; | ||||
| } | ||||
|  |  | |||
|  | @ -7,10 +7,18 @@ class OBoy : public QObject | |||
|     Q_OBJECT | ||||
|     Q_PROPERTY(QString name READ name CONSTANT) | ||||
|     Q_PROPERTY(QString version READ version CONSTANT) | ||||
|     Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged) | ||||
| public: | ||||
|     explicit OBoy(QObject *parent = nullptr); | ||||
| 
 | ||||
|     QString name() const; | ||||
|     QString version() const; | ||||
|     bool loaded() const; | ||||
|     Q_INVOKABLE bool load(const QString &path); | ||||
| 
 | ||||
| signals: | ||||
|     void loadedChanged(bool loaded); | ||||
| 
 | ||||
| private: | ||||
|     bool _loaded = false; | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue