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