This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 27354ff754a10cc5fbcf52edcf125605b84bbf37 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 12 20:24:38 2015 +0100 non_modal_messagebox.{h,cpp}: add new Non_Modal_MessageBox::critical() overloaded functions to be able to use informative text and a (forceful, if requested) conversion to rich text. --- debian/changelog | 3 +++ src/non_modal_messagebox.cpp | 25 +++++++++++++++++++++++-- src/non_modal_messagebox.h | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index eb9c295..b7272da 100644 --- a/debian/changelog +++ b/debian/changelog @@ -224,6 +224,9 @@ x2goclient (4.0.4.0-0x2go1) UNRELEASED; urgency=low non-parameter call for the QSingleShotTimer::timeout() signal. - x2goutils.{h,cpp}: split up show_RichText_WarningMsgBox() into the aforementioned function and a new convert_to_rich_text() helper function. + - non_modal_messagebox.{h,cpp}: add new Non_Modal_MessageBox::critical() + overloaded functions to be able to use informative text and a (forceful, + if requested) conversion to rich text. -- X2Go Release Manager <git-admin@x2go.org> Thu, 19 Feb 2015 13:25:28 +0100 diff --git a/src/non_modal_messagebox.cpp b/src/non_modal_messagebox.cpp index 47f66c0..1dd1ef8 100644 --- a/src/non_modal_messagebox.cpp +++ b/src/non_modal_messagebox.cpp @@ -18,10 +18,12 @@ #include <QSpacerItem> #include "non_modal_messagebox.h" +#include "x2goutils.h" // Please look up the documentation in the header file! void Non_Modal_MessageBox::critical (QWidget *parent, const QString &title, - const QString &text, + const QString &text, const QString &informative_text, + bool rich_text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { QMessageBox *msg_box = new QMessageBox (QMessageBox::Critical, title, text, buttons, parent); @@ -29,7 +31,12 @@ void Non_Modal_MessageBox::critical (QWidget *parent, const QString &title, msg_box->setAttribute (Qt::WA_DeleteOnClose); msg_box->setDefaultButton (defaultButton); - // Set to minimum width of 300px. + if (rich_text) { + msg_box->setTextFormat (Qt::RichText); + msg_box->setInformativeText (convert_to_rich_text (informative_text, true)); + } + + // Set to minimum width of 500px. QSpacerItem *horizontal_spacer = new QSpacerItem (500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QGridLayout *grid_layout = (QGridLayout*) (msg_box->layout ()); grid_layout->addItem (horizontal_spacer, grid_layout->rowCount (), 0, 1, grid_layout->columnCount ()); @@ -42,3 +49,17 @@ void Non_Modal_MessageBox::critical (QWidget *parent, const QString &title, msg_box->activateWindow (); } +void Non_Modal_MessageBox::critical (QWidget *parent, const QString &title, + const QString &text, const QString &informative_text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) { + Non_Modal_MessageBox::critical (parent, title, text, informative_text, false, buttons, defaultButton); +} + +void Non_Modal_MessageBox::critical (QWidget *parent, const QString &title, + const QString &text, + QMessageBox::StandardButtons buttons, + QMessageBox::StandardButton defaultButton) { + Non_Modal_MessageBox::critical (parent, title, text, QString (), buttons, defaultButton); +} + diff --git a/src/non_modal_messagebox.h b/src/non_modal_messagebox.h index ab7505e..ca0aa93 100644 --- a/src/non_modal_messagebox.h +++ b/src/non_modal_messagebox.h @@ -21,6 +21,20 @@ class Non_Modal_MessageBox { public: + // Main implementation. + static void critical (QWidget *parent, const QString &title, + const QString &text, const QString &informative_text, + bool rich_text, + QMessageBox::StandardButtons buttons = QMessageBox::Ok, + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); + + // Wrapper. + static void critical (QWidget *parent, const QString &title, + const QString &text, const QString &informative_text, + QMessageBox::StandardButtons buttons = QMessageBox::Ok, + QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); + + // Wrapper for QMessageBox::critical-like usage. // Use this instead QMessageBox::critical for a non-modal variant. // Caveat: this function does return immediately and will NOT return the clicked button. static void critical (QWidget *parent, const QString &title, -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git