Scribus
Open source desktop publishing at your fingertips
scmessagebox.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  begin : Oct 2005
9  copyright : (C) 2005 by Craig Bradney
10  email : cbradney@zip.com.au
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 #ifndef SCMESSAGEBOX_H
22 #define SCMESSAGEBOX_H
23 
24 #include <QMessageBox>
25 
26 #include "scribusapi.h"
27 
41 class SCRIBUS_API ScMessageBox : public QMessageBox
42 {
43  Q_OBJECT
44 
45 public:
46  // Property-based API
47  ScMessageBox(QWidget *parent = 0);
48  ScMessageBox(QMessageBox::Icon icon, const QString &title, const QString &text,
49  QMessageBox::StandardButtons buttons = QMessageBox::NoButton, QWidget *parent = 0,
50  Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
51  int exec();
52  QAbstractButton *clickedButton() const;
53  void setDefaultBatchButton(QPushButton *button);
54  void setDefaultBatchButton(StandardButton button);
55 
56  // Static function API
57  static QMessageBox::StandardButton information(QWidget *parent, const QString &title, const QString &text,
58  StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton);
59 
60  static QMessageBox::StandardButton question(QWidget *parent, const QString &title, const QString &text,
61  StandardButtons buttons = StandardButtons(Yes | No), StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton);
62 
63  static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text,
64  StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton);
65 
66  static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, const QString &text,
67  StandardButtons buttons = Ok, StandardButton defaultButton = NoButton, StandardButton defaultBatchButton = NoButton);
68 
69  static void about(QWidget *parent, const QString &title, const QString &text);
70  static void aboutQt(QWidget *parent, const QString &title = QString());
71 
72 private:
73  // Saved fields for the property-based API
74  QString messageTitle;
75  QPushButton *defaultBatchPushButton;
76  StandardButton defaultBatchStandardButton;
77 
78  // Initialize private variables
79  void initScMessageBox(void);
80 
81  // Find the appropriate default button
82  static QMessageBox::StandardButton findDefaultButton(QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton, StandardButton defaultBatchButton);
83 };
84 
85 #endif
This class provides alternate versions of QMessageBox functions that write to log files when Scribus ...
Definition: scmessagebox.h:41