diff options
| author | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2018-12-19 23:01:50 +0100 |
| commit | 5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch) | |
| tree | 410fa358a5f73260a579b4d669730f319a4d2609 /MessageBox.cpp | |
| parent | 6c82050de806dcdafaed0077400a6c3396a4a159 (diff) | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack'
with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'MessageBox.cpp')
| -rw-r--r-- | MessageBox.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/MessageBox.cpp b/MessageBox.cpp deleted file mode 100644 index 0f8b3972..00000000 --- a/MessageBox.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "MessageBox.hpp" - -#include <QDialogButtonBox> -#include <QPushButton> - -#include "revision_utils.hpp" - -MessageBox::MessageBox (QWidget * parent) - : QMessageBox {parent} -{ - setWindowTitle (program_title ()); -} - -MessageBox::MessageBox (Icon icon, QString const& text, StandardButtons buttons - , QWidget * parent, Qt::WindowFlags flags) - : QMessageBox {icon, program_title (), text, buttons, parent, flags} -{ -} - -void MessageBox::about_message (QWidget * parent, QString const& text) -{ - QMessageBox::about (parent, program_title (), text); -} - -void MessageBox::about_Qt_message (QWidget * parent) -{ - QMessageBox::aboutQt (parent, program_title ()); -} - -namespace -{ - QMessageBox::StandardButton show_it (QWidget * parent, MessageBox::Icon icon - , QString const& text - , QString const& informative - , QString const& detail - , MessageBox::StandardButtons buttons - , MessageBox::StandardButton default_button) - { - MessageBox mb {icon, text, MessageBox::NoButton, parent}; - QDialogButtonBox * button_box = mb.findChild<QDialogButtonBox *> (); - Q_ASSERT (button_box); - - uint mask = MessageBox::FirstButton; - while (mask <= MessageBox::LastButton) { - uint sb = buttons & mask; - mask <<= 1; - if (!sb) - continue; - QPushButton * button = mb.addButton (static_cast<MessageBox::StandardButton> (sb)); - // Choose the first accept role as the default - if (mb.defaultButton ()) - continue; - if ((default_button == MessageBox::NoButton - && button_box->buttonRole (button) == QDialogButtonBox::AcceptRole) - || (default_button != MessageBox::NoButton - && sb == static_cast<uint> (default_button))) - mb.setDefaultButton (button); - } - mb.setInformativeText (informative); - mb.setDetailedText (detail); - if (mb.exec() == -1) - return MessageBox::Cancel; - return mb.standardButton (mb.clickedButton ()); - } -} - -auto MessageBox::information_message (QWidget * parent, QString const& text - , QString const& informative - , QString const& detail - , StandardButtons buttons - , StandardButton default_button) -> StandardButton -{ - return show_it (parent, Information, text, informative, detail, buttons, default_button); -} - -auto MessageBox::query_message (QWidget * parent, QString const& text - , QString const& informative - , QString const& detail - , StandardButtons buttons - , StandardButton default_button) -> StandardButton -{ - return show_it (parent, Question, text, informative, detail, buttons, default_button); -} - -auto MessageBox::warning_message (QWidget * parent, QString const& text - , QString const& informative - , QString const& detail - , StandardButtons buttons - , StandardButton default_button) -> StandardButton -{ - return show_it (parent, Warning, text, informative, detail, buttons, default_button); -} - -auto MessageBox::critical_message (QWidget * parent, QString const& text - , QString const& informative - , QString const& detail - , StandardButtons buttons - , StandardButton default_button) -> StandardButton -{ - return show_it (parent, Critical, text, informative, detail, buttons, default_button); -} |
