1#include "WaitingDlg.h"
2
3#include <GitQlientStyles.h>
4
5#include <QLabel>
6#include <QHBoxLayout>
7#include <QKeyEvent>
8
9WaitingDlg::WaitingDlg(const QString &labelText)
10 : QDialog()
11{
12 const auto layout = new QHBoxLayout(this);
13 layout->addWidget(new QLabel(labelText));
14
15 setAttribute(Qt::WA_DeleteOnClose);
16 setWindowModality(Qt::ApplicationModal);
17 setWindowFlags(Qt::FramelessWindowHint);
18
19 setStyleSheet(GitQlientStyles::getStyles());
20}
21
22void WaitingDlg::keyPressEvent(QKeyEvent *e)
23{
24 if (e->key() == Qt::Key_Escape)
25 return;
26
27 QDialog::keyPressEvent(e);
28}
29
30void WaitingDlg::closeEvent(QCloseEvent *e)
31{
32 if (!mPrepareToClose)
33 e->ignore();
34 else
35 QDialog::closeEvent(e);
36}
37
38void WaitingDlg::close()
39{
40 mPrepareToClose = true;
41
42 QDialog::close();
43}
44