-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwindowapi.cpp
47 lines (37 loc) · 967 Bytes
/
windowapi.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "windowapi.hpp"
#include <QDebug>
#include <QMessageBox>
#include <QInputDialog>
#include <QVariant>
#include "history.hpp"
WindowAPI::WindowAPI(QObject *parent) : QObject(parent)
{
}
void WindowAPI::setHistory(History *history)
{
m_history = history;
connect(history, &History::updated, [=](const QString &url) {
m_location = url;
});
}
void WindowAPI::back()
{
m_history->back();
}
void WindowAPI::forward()
{
m_history->back();
}
void WindowAPI::alert(const QString &message)
{
QMessageBox::warning((QWidget *)parent(), "Warning", message);
}
QVariant WindowAPI::prompt(const QString &title, const QVariant &defaultValue)
{
QVariant value = QInputDialog::getText((QWidget *)parent(), m_title, title, QLineEdit::Normal, defaultValue.toString());
return value;
}
bool WindowAPI::confirm(const QString &message)
{
return QMessageBox::question((QWidget *)parent(), m_title, message) == QMessageBox::Yes;
}