Make message boxes more platform independent with a wrapper

Instead  of  using the  Qt  QMessageBox  class  directly a  new  class
MessageBox  (MessageBox.hpp)  has been  added  to  deal with  platform
independence issues like the title not being shown on Mac OS X.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6861 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville
2016-07-03 20:31:19 +00:00
parent 61f38c0286
commit 06925b6876
17 changed files with 393 additions and 218 deletions
+15 -14
View File
@@ -14,7 +14,6 @@
#include <QMenu>
#include <QAction>
#include <QActionGroup>
#include <QMessageBox>
#include <QDialog>
#include <QLineEdit>
#include <QRegularExpression>
@@ -30,6 +29,8 @@
#include "SettingsGroup.hpp"
#include "qt_helpers.hpp"
#include "SettingsGroup.hpp"
#include "MessageBox.hpp"
#include "pimpl_impl.hpp"
@@ -551,11 +552,11 @@ void MultiSettings::impl::clone_into_configuration (QMainWindow * main_window)
if (sources.size () && (1 == sources.size () || QDialog::Accepted == dialog.exec ()))
{
QString source_name {1 == sources.size () ? sources.at (0) : dialog.name ()};
if (QMessageBox::Yes == QMessageBox::question (main_window,
tr ("Clone Into Configuration"),
tr ("Confirm overwrite of all values for configuration \"%1\" with values from \"%2\"?")
.arg (target_name)
.arg (source_name)))
if (MessageBox::Yes == MessageBox::query_message (main_window,
tr ("Clone Into Configuration"),
tr ("Confirm overwrite of all values for configuration \"%1\" with values from \"%2\"?")
.arg (target_name)
.arg (source_name)))
{
// grab the data to clone from
if (source_name == current_group_name)
@@ -597,10 +598,10 @@ void MultiSettings::impl::reset_configuration (QMainWindow * main_window)
{
auto const& target_name = active_sub_menu_->title ();
if (QMessageBox::Yes != QMessageBox::question (main_window,
tr ("Reset Configuration"),
tr ("Confirm reset to default values for configuration \"%1\"?")
.arg (target_name)))
if (MessageBox::Yes != MessageBox::query_message (main_window,
tr ("Reset Configuration"),
tr ("Confirm reset to default values for configuration \"%1\"?")
.arg (target_name)))
{
return;
}
@@ -680,10 +681,10 @@ void MultiSettings::impl::delete_configuration (QMainWindow * main_window)
}
else
{
if (QMessageBox::Yes != QMessageBox::question (main_window,
tr ("Delete Configuration"),
tr ("Confirm deletion of configuration \"%1\"?")
.arg (target_name)))
if (MessageBox::Yes != MessageBox::query_message (main_window,
tr ("Delete Configuration"),
tr ("Confirm deletion of configuration \"%1\"?")
.arg (target_name)))
{
return;
}