Use WindowModality for dialogs

This commit is contained in:
tobtoht 2021-10-22 19:19:56 +02:00
parent 484f61759e
commit 5f4dc89085
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
58 changed files with 105 additions and 56 deletions

View file

@ -113,4 +113,10 @@ ClickableLabel::~ClickableLabel() = default;
void ClickableLabel::mousePressEvent(QMouseEvent* event) {
emit clicked();
}
WindowModalDialog::WindowModalDialog(QWidget *parent)
: QDialog(parent)
{
this->setWindowModality(Qt::WindowModal);
}

View file

@ -121,4 +121,11 @@ protected:
};
class WindowModalDialog : public QDialog {
Q_OBJECT
public:
explicit WindowModalDialog(QWidget *parent);
};
#endif //FEATHER_COMPONENTS_H

View file

@ -8,7 +8,7 @@
#include "utils/Utils.h"
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::AboutDialog)
{
ui->setupUi(this);

View file

@ -7,11 +7,13 @@
#include <QDialog>
#include <QStringListModel>
#include "components.h"
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
class AboutDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -11,7 +11,7 @@
#include "utils/Icons.h"
AccountSwitcherDialog::AccountSwitcherDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::AccountSwitcherDialog)
, m_ctx(std::move(ctx))
, m_model(m_ctx->wallet->subaddressAccountModel())
@ -25,6 +25,8 @@ AccountSwitcherDialog::AccountSwitcherDialog(QSharedPointer<AppContext> ctx, QWi
ui->label_totalBalance->setFont(ModelUtils::getMonospaceFont());
ui->label_totalBalance->setText(WalletManager::displayAmount(m_ctx->wallet->balanceAll()));
this->setWindowModality(Qt::WindowModal);
ui->accounts->setModel(m_proxyModel);
ui->accounts->setContextMenuPolicy(Qt::CustomContextMenu);
ui->accounts->setSelectionMode(QAbstractItemView::SingleSelection);

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "model/SubaddressAccountModel.h"
namespace Ui {
class AccountSwitcherDialog;
}
class AccountSwitcherDialog : public QDialog
class AccountSwitcherDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@
#include "model/ModelUtils.h"
BalanceDialog::BalanceDialog(QWidget *parent, Wallet *wallet)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::BalanceDialog)
{
ui->setupUi(this);

View file

@ -6,13 +6,14 @@
#include <QDialog>
#include "components.h"
#include "libwalletqt/Wallet.h"
namespace Ui {
class BalanceDialog;
}
class BalanceDialog : public QDialog
class BalanceDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@
#include "utils/config.h"
CalcConfigDialog::CalcConfigDialog(QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::CalcConfigDialog)
{
ui->setupUi(this);

View file

@ -7,11 +7,13 @@
#include <QDialog>
#include <QListWidget>
#include "components.h"
namespace Ui {
class CalcConfigDialog;
}
class CalcConfigDialog : public QDialog
class CalcConfigDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -5,7 +5,7 @@
#include "ContactsDialog.h"
ContactsDialog::ContactsDialog(QWidget *parent, const QString &address, const QString &name)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::ContactsDialog)
{
ui->setupUi(this);

View file

@ -6,11 +6,13 @@
#include <QDialog>
#include "components.h"
namespace Ui {
class ContactsDialog;
}
class ContactsDialog : public QDialog
class ContactsDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -11,7 +11,7 @@
#include "utils/WebsocketNotifier.h"
DebugInfoDialog::DebugInfoDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::DebugInfoDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "libwalletqt/Wallet.h"
namespace Ui {
class DebugInfoDialog;
}
class DebugInfoDialog : public QDialog
class DebugInfoDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -5,7 +5,7 @@
#include "ui_InfoDialog.h"
InfoDialog::InfoDialog(QWidget *parent, const QString &title, const QString &infoData)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::InfoDialog)
{
ui->setupUi(this);

View file

@ -6,11 +6,13 @@
#include <QDialog>
#include "components.h"
namespace Ui {
class InfoDialog;
}
class InfoDialog : public QDialog
class InfoDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -5,7 +5,7 @@
#include "ui_KeysDialog.h"
KeysDialog::KeysDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::KeysDialog)
{
ui->setupUi(this);

View file

@ -7,12 +7,13 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
namespace Ui {
class KeysDialog;
}
class KeysDialog : public QDialog
class KeysDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@
#include "utils/Utils.h"
LocalMoneroInfoDialog::LocalMoneroInfoDialog(QWidget *parent, LocalMoneroModel *model, int row)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::LocalMoneroInfoDialog)
, m_model(model)
, m_row(row)

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include <QLabel>
#include "components.h"
#include "model/LocalMoneroModel.h"
namespace Ui {
class LocalMoneroInfoDialog;
}
class LocalMoneroInfoDialog : public QDialog
class LocalMoneroInfoDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@
#include "utils/Utils.h"
OutputInfoDialog::OutputInfoDialog(CoinsInfo *cInfo, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::OutputInfoDialog)
{
ui->setupUi(this);

View file

@ -6,6 +6,7 @@
#include <QDialog>
#include "components.h"
#include "libwalletqt/Coins.h"
#include "libwalletqt/CoinsInfo.h"
@ -13,7 +14,7 @@ namespace Ui {
class OutputInfoDialog;
}
class OutputInfoDialog : public QDialog
class OutputInfoDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include "libwalletqt/WalletManager.h"
OutputSweepDialog::OutputSweepDialog(QWidget *parent, quint64 amount)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::OutputSweepDialog)
, m_amount(amount)
{

View file

@ -6,13 +6,14 @@
#include <QDialog>
#include "components.h"
#include "libwalletqt/CoinsInfo.h"
namespace Ui {
class OutputSweepDialog;
}
class OutputSweepDialog : public QDialog
class OutputSweepDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include <QMessageBox>
PasswordChangeDialog::PasswordChangeDialog(QWidget *parent, Wallet *wallet)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::PasswordChangeDialog)
, m_wallet(wallet)
{

View file

@ -6,13 +6,14 @@
#include <QDialog>
#include "components.h"
#include "libwalletqt/Wallet.h"
namespace Ui {
class PasswordChangeDialog;
}
class PasswordChangeDialog : public QDialog
class PasswordChangeDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include "utils/Icons.h"
PasswordDialog::PasswordDialog(const QString &walletName, bool incorrectPassword, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::PasswordDialog)
{
ui->setupUi(this);

View file

@ -6,11 +6,13 @@
#include <QDialog>
#include "components.h"
namespace Ui {
class PasswordDialog;
}
class PasswordDialog : public QDialog
class PasswordDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -12,7 +12,7 @@
#include "WalletManager.h"
PaymentRequestDialog::PaymentRequestDialog(QWidget *parent, QSharedPointer<AppContext> ctx, QString address)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::PaymentRequestDialog)
, m_ctx(std::move(ctx))
, m_address(std::move(address))

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "qrcode/QrCode.h"
namespace Ui {
class PaymentRequestDialog;
}
class PaymentRequestDialog : public QDialog
class PaymentRequestDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include <QMessageBox>
QrCodeDialog::QrCodeDialog(QWidget *parent, QrCode *qrCode, const QString &title)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::QrCodeDialog)
{
ui->setupUi(this);

View file

@ -6,6 +6,7 @@
#include <QDialog>
#include "components.h"
#include "qrcode/QrCode.h"
#include "widgets/QrCodeWidget.h"
@ -13,7 +14,7 @@ namespace Ui {
class QrCodeDialog;
}
class QrCodeDialog : public QDialog
class QrCodeDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -8,7 +8,7 @@
#include <QDialogButtonBox>
RestoreHeightDialog::RestoreHeightDialog(QWidget *parent, quint64 currentRestoreHeight)
: QDialog(parent)
: WindowModalDialog(parent)
, m_restoreHeightWidget(new RestoreHeightWidget(this))
{
auto *layout = new QVBoxLayout(this);

View file

@ -6,9 +6,10 @@
#include <QDialog>
#include "components.h"
#include "widgets/RestoreHeightWidget.h"
class RestoreHeightDialog : public QDialog
class RestoreHeightDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include "constants.h"
SeedDialog::SeedDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::SeedDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,12 +7,13 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
namespace Ui {
class SeedDialog;
}
class SeedDialog : public QDialog
class SeedDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include "utils/Utils.h"
SignVerifyDialog::SignVerifyDialog(Wallet *wallet, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::SignVerifyDialog)
, m_wallet(wallet)
{

View file

@ -6,13 +6,14 @@
#include <QDialog>
#include "components.h"
#include "libwalletqt/Wallet.h"
namespace Ui {
class SignVerifyDialog;
}
class SignVerifyDialog : public QDialog
class SignVerifyDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include "utils/Icons.h"
SplashDialog::SplashDialog(QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::SplashDialog)
{
ui->setupUi(this);

View file

@ -6,11 +6,13 @@
#include <QDialog>
#include "components.h"
namespace Ui {
class SplashDialog;
}
class SplashDialog : public QDialog
class SplashDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include "utils/NetworkManager.h"
TxBroadcastDialog::TxBroadcastDialog(QWidget *parent, QSharedPointer<AppContext> ctx, const QString &transactionHex)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::TxBroadcastDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "utils/daemonrpc.h"
namespace Ui {
class TxBroadcastDialog;
}
class TxBroadcastDialog : public QDialog
class TxBroadcastDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -14,7 +14,7 @@
#include "qrcode/QrCode.h"
TxConfAdvDialog::TxConfAdvDialog(QSharedPointer<AppContext> ctx, const QString &description, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::TxConfAdvDialog)
, m_ctx(std::move(ctx))
, m_exportUnsignedMenu(new QMenu(this))

View file

@ -10,13 +10,14 @@
#include <QTextCharFormat>
#include "appcontext.h"
#include "components.h"
#include "libwalletqt/PendingTransaction.h"
namespace Ui {
class TxConfAdvDialog;
}
class TxConfAdvDialog : public QDialog
class TxConfAdvDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -13,7 +13,7 @@
#include "utils/ColorScheme.h"
TxConfDialog::TxConfDialog(QSharedPointer<AppContext> ctx, PendingTransaction *tx, const QString &address, const QString &description, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::TxConfDialog)
, m_ctx(std::move(ctx))
, m_tx(tx)

View file

@ -7,6 +7,7 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "libwalletqt/PendingTransaction.h"
#include "libwalletqt/WalletManager.h"
@ -14,7 +15,7 @@ namespace Ui {
class TxConfDialog;
}
class TxConfDialog : public QDialog
class TxConfDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include "utils/NetworkManager.h"
TxImportDialog::TxImportDialog(QWidget *parent, QSharedPointer<AppContext> ctx)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::TxImportDialog)
, m_ctx(std::move(ctx))
, m_loadTimer(new QTimer(this))

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "utils/daemonrpc.h"
namespace Ui {
class TxImportDialog;
}
class TxImportDialog : public QDialog
class TxImportDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -11,7 +11,7 @@
#include "utils/Utils.h"
TxProofDialog::TxProofDialog(QWidget *parent, QSharedPointer<AppContext> ctx, TransactionInfo *txInfo)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::TxProofDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
#include "libwalletqt/TransactionInfo.h"
namespace Ui {
class TxProofDialog;
}
class TxProofDialog : public QDialog
class TxProofDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -11,7 +11,7 @@
#include "utils/Utils.h"
VerifyProofDialog::VerifyProofDialog(Wallet *wallet, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::VerifyProofDialog)
, m_wallet(wallet)
{

View file

@ -7,13 +7,14 @@
#include <QDialog>
#include <QIcon>
#include "components.h"
#include "libwalletqt/Wallet.h"
namespace Ui {
class VerifyProofDialog;
}
class VerifyProofDialog : public QDialog
class VerifyProofDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include <QMessageBox>
ViewOnlyDialog::ViewOnlyDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::ViewOnlyDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,12 +7,13 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
namespace Ui {
class ViewOnlyDialog;
}
class ViewOnlyDialog : public QDialog
class ViewOnlyDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -9,7 +9,7 @@
#include "model/ModelUtils.h"
WalletCacheDebugDialog::WalletCacheDebugDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::WalletCacheDebugDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,12 +7,13 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
namespace Ui {
class WalletCacheDebugDialog;
}
class WalletCacheDebugDialog : public QDialog
class WalletCacheDebugDialog : public WindowModalDialog
{
Q_OBJECT

View file

@ -7,7 +7,7 @@
#include <QDesktopServices>
WalletInfoDialog::WalletInfoDialog(QSharedPointer<AppContext> ctx, QWidget *parent)
: QDialog(parent)
: WindowModalDialog(parent)
, ui(new Ui::WalletInfoDialog)
, m_ctx(std::move(ctx))
{

View file

@ -7,12 +7,13 @@
#include <QDialog>
#include "appcontext.h"
#include "components.h"
namespace Ui {
class WalletInfoDialog;
}
class WalletInfoDialog : public QDialog
class WalletInfoDialog : public WindowModalDialog
{
Q_OBJECT