From ea6292168a6acd4c263913f0ccd7dd64daf4f5cf Mon Sep 17 00:00:00 2001 From: Sandro Jäckel Date: Fri, 23 Feb 2018 01:45:58 +0100 Subject: Revert "Applied clang-format on source" This reverts commit 5e5c9c07291f6b09623d31c92b1fb61c4ede576e. --- src/lockeddialogbase.cpp | 65 +++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 25 deletions(-) (limited to 'src/lockeddialogbase.cpp') diff --git a/src/lockeddialogbase.cpp b/src/lockeddialogbase.cpp index 4cf158ea..b18f7429 100644 --- a/src/lockeddialogbase.cpp +++ b/src/lockeddialogbase.cpp @@ -22,37 +22,52 @@ along with Mod Organizer. If not, see . #include #include #include -#include // for Qt::FramelessWindowHint, etc - -LockedDialogBase::LockedDialogBase(QWidget* parent, bool allowClose) - : QDialog(parent), m_Unlocked(false), m_Canceled(false), m_allowClose(allowClose) { - if (parent != nullptr) { - QPoint position = parent->mapToGlobal(QPoint(parent->width() / 2, parent->height() / 2)); - position.rx() -= this->width() / 2; - position.ry() -= this->height() / 2; - move(position); - } +#include // for Qt::FramelessWindowHint, etc + +LockedDialogBase::LockedDialogBase(QWidget *parent, bool allowClose) + : QDialog(parent) + , m_Unlocked(false) + , m_Canceled(false) + , m_allowClose(allowClose) +{ + if (parent != nullptr) { + QPoint position = parent->mapToGlobal(QPoint(parent->width() / 2, parent->height() / 2)); + position.rx() -= this->width() / 2; + position.ry() -= this->height() / 2; + move(position); + } +} + +void LockedDialogBase::resizeEvent(QResizeEvent *event) +{ + QWidget *par = parentWidget(); + if (par != nullptr) { + QPoint position = par->mapToGlobal(QPoint(par->width() / 2, par->height() / 2)); + position.rx() -= event->size().width() / 2; + position.ry() -= event->size().height() / 2; + move(position); + } } -void LockedDialogBase::resizeEvent(QResizeEvent* event) { - QWidget* par = parentWidget(); - if (par != nullptr) { - QPoint position = par->mapToGlobal(QPoint(par->width() / 2, par->height() / 2)); - position.rx() -= event->size().width() / 2; - position.ry() -= event->size().height() / 2; - move(position); - } +void LockedDialogBase::reject() +{ + if (m_allowClose) + unlock(); } -void LockedDialogBase::reject() { - if (m_allowClose) - unlock(); +bool LockedDialogBase::unlockForced() const { + return m_Unlocked; } -bool LockedDialogBase::unlockForced() const { return m_Unlocked; } +bool LockedDialogBase::canceled() const { + return m_Canceled; +} -bool LockedDialogBase::canceled() const { return m_Canceled; } +void LockedDialogBase::unlock() { + m_Unlocked = true; +} -void LockedDialogBase::unlock() { m_Unlocked = true; } +void LockedDialogBase::cancel() { + m_Canceled = true; +} -void LockedDialogBase::cancel() { m_Canceled = true; } -- cgit v1.3.1