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.
57 lines
1.2 KiB
57 lines
1.2 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
|
|
||
4 years ago
|
#include "keyboard.h"
|
||
4 years ago
|
|
||
4 years ago
|
class InputDialog : public QDialog {
|
||
4 years ago
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
4 years ago
|
explicit InputDialog(const QString &prompt_text, QWidget* parent = 0);
|
||
|
static QString getText(const QString &prompt, int minLength = -1);
|
||
4 years ago
|
QString text();
|
||
4 years ago
|
void setMessage(const QString &message, bool clearInputField = true);
|
||
4 years ago
|
void setMinLength(int length);
|
||
4 years ago
|
void show();
|
||
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:
|
||
4 years ago
|
void handleInput(const QString &s);
|
||
4 years ago
|
|
||
|
signals:
|
||
|
void cancel();
|
||
4 years ago
|
void emitText(const QString &text);
|
||
4 years ago
|
};
|
||
4 years ago
|
|
||
|
class ConfirmationDialog : public QDialog {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
4 years ago
|
explicit ConfirmationDialog(const QString &prompt_text, const QString &confirm_text = "Ok",
|
||
|
const QString &cancel_text = "Cancel", QWidget* parent = 0);
|
||
4 years ago
|
static bool alert(const QString &prompt_text, QWidget *parent = 0);
|
||
|
static bool confirm(const QString &prompt_text, QWidget *parent = 0);
|
||
4 years ago
|
|
||
|
private:
|
||
|
QLabel *prompt;
|
||
|
QVBoxLayout *layout;
|
||
|
|
||
|
public slots:
|
||
|
int exec() override;
|
||
|
};
|