You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					56 lines
				
				1.0 KiB
			
		
		
			
		
	
	
					56 lines
				
				1.0 KiB
			| 
								 
											5 years ago
										 
									 | 
							
								#pragma once
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QLabel>
							 | 
						||
| 
								 | 
							
								#include <QString>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QWidget>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QDialog>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QLineEdit>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QVBoxLayout>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "keyboard.hpp"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								class InputDialog : public QDialog {
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  explicit InputDialog(QString prompt_text, QWidget* parent = 0);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  static QString getText(QString prompt, int minLength = -1);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QString text();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void setMessage(QString message, bool clearInputField=true);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void setMinLength(int length);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								private:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  int minLength;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QLineEdit *line;
							 | 
						||
| 
								 | 
							
								  Keyboard *k;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QLabel *label;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QVBoxLayout *layout;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								public slots:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  int exec() override;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								private slots:
							 | 
						||
| 
								 | 
							
								  void handleInput(QString s);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								signals:
							 | 
						||
| 
								 | 
							
								  void cancel();
							 | 
						||
| 
								 | 
							
								  void emitText(QString text);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class ConfirmationDialog : public QDialog {
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  explicit ConfirmationDialog(QString prompt_text, QString confirm_text = "Ok",
							 | 
						||
| 
								 | 
							
								                              QString cancel_text = "Cancel", QWidget* parent = 0);
							 | 
						||
| 
								 | 
							
								  static bool confirm(QString prompt_text);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								private:
							 | 
						||
| 
								 | 
							
								  QLabel *prompt;
							 | 
						||
| 
								 | 
							
								  QVBoxLayout *layout;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public slots:
							 | 
						||
| 
								 | 
							
								  int exec() override;
							 | 
						||
| 
								 | 
							
								};
							 |