mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 13:50:03 +00:00 
			
		
		
		
	applets/swkbd: Add callback support
This commit is contained in:
		
							parent
							
								
									2ff7ed4200
								
							
						
					
					
						commit
						8078256a88
					
				
					 6 changed files with 154 additions and 64 deletions
				
			
		|  | @ -109,14 +109,20 @@ void QtKeyboardDialog::HandleValidationError(Frontend::ValidationError error) { | |||
| 
 | ||||
| QtKeyboard::QtKeyboard(QWidget& parent_) : parent(parent_) {} | ||||
| 
 | ||||
| void QtKeyboard::Setup(const Frontend::KeyboardConfig& config) { | ||||
|     SoftwareKeyboard::Setup(config); | ||||
| void QtKeyboard::Execute(const Frontend::KeyboardConfig& config) { | ||||
|     SoftwareKeyboard::Execute(config); | ||||
|     if (this->config.button_config != Frontend::ButtonConfig::None) { | ||||
|         ok_id = static_cast<u8>(this->config.button_config); | ||||
|     } | ||||
|     QMetaObject::invokeMethod(this, "OpenInputDialog", Qt::BlockingQueuedConnection); | ||||
| } | ||||
| 
 | ||||
| void QtKeyboard::ShowError(const std::string& error) { | ||||
|     QString message = QString::fromStdString(error); | ||||
|     QMetaObject::invokeMethod(this, "ShowErrorDialog", Qt::BlockingQueuedConnection, | ||||
|                               Q_ARG(QString, message)); | ||||
| } | ||||
| 
 | ||||
| void QtKeyboard::OpenInputDialog() { | ||||
|     QtKeyboardDialog dialog(&parent, this); | ||||
|     dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | ||||
|  | @ -127,3 +133,7 @@ void QtKeyboard::OpenInputDialog() { | |||
|              dialog.button); | ||||
|     Finalize(dialog.text.toStdString(), dialog.button); | ||||
| } | ||||
| 
 | ||||
| void QtKeyboard::ShowErrorDialog(QString message) { | ||||
|     QMessageBox::critical(&parent, tr("Software Keyboard"), message); | ||||
| } | ||||
|  |  | |||
|  | @ -48,10 +48,12 @@ class QtKeyboard final : public QObject, public Frontend::SoftwareKeyboard { | |||
| 
 | ||||
| public: | ||||
|     explicit QtKeyboard(QWidget& parent); | ||||
|     void Setup(const Frontend::KeyboardConfig& config) override; | ||||
|     void Execute(const Frontend::KeyboardConfig& config) override; | ||||
|     void ShowError(const std::string& error) override; | ||||
| 
 | ||||
| private: | ||||
|     Q_INVOKABLE void OpenInputDialog(); | ||||
|     Q_INVOKABLE void ShowErrorDialog(QString message); | ||||
| 
 | ||||
|     /// Index of the buttons
 | ||||
|     u8 ok_id; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue