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
4 years ago
|
#pragma once
|
||
|
|
||
4 years ago
|
#include <QLabel>
|
||
|
#include <QString>
|
||
4 years ago
|
#include <QWidget>
|
||
4 years ago
|
#include <QDialog>
|
||
4 years ago
|
#include <QLineEdit>
|
||
4 years ago
|
#include <QVBoxLayout>
|
||
4 years ago
|
|
||
|
#include "keyboard.hpp"
|
||
|
|
||
4 years ago
|
class InputDialog : public QDialog {
|
||
4 years ago
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
4 years ago
|
explicit InputDialog(QString prompt_text, QWidget* parent = 0);
|
||
4 years ago
|
static QString getText(QString prompt, int minLength = -1);
|
||
4 years ago
|
QString text();
|
||
4 years ago
|
void setMessage(QString message, bool clearInputField=true);
|
||
4 years ago
|
void setMinLength(int length);
|
||
4 years ago
|
|
||
4 years ago
|
private:
|
||
4 years ago
|
int minLength;
|
||
4 years ago
|
QLineEdit *line;
|
||
|
Keyboard *k;
|
||
4 years ago
|
QLabel *label;
|
||
4 years ago
|
QVBoxLayout *layout;
|
||
4 years ago
|
|
||
|
public slots:
|
||
4 years ago
|
int exec() override;
|
||
4 years ago
|
|
||
4 years ago
|
private slots:
|
||
|
void handleInput(QString s);
|
||
4 years ago
|
|
||
|
signals:
|
||
|
void cancel();
|
||
|
void emitText(QString text);
|
||
4 years ago
|
};
|
||
4 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;
|
||
|
};
|