~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to src/gui/dialogs/messagedialog.h

  • Committer: Package Import Robot
  • Author(s): Ana Beatriz Guerrero Lopez, Patrick Matthäi, Ana Beatriz Guerrero Lopez
  • Date: 2011-11-13 16:34:13 UTC
  • mfrom: (1.1.13) (2.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111113163413-5y0anlc4dqf511uh
Tags: 2.0.1-1
* New upstream release.

[ Patrick Matthäi ]
* Adjust build system.
* Add build dependency xsltproc.

[ Ana Beatriz Guerrero Lopez ]
* Some more adjustments to the build system taken from upstream's deb/
* directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file messagedialog.h
 
3
 * Message dialog.
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 18 Aug 2011
 
8
 *
 
9
 * Copyright (C) 2011  Urs Fleisch
 
10
 *
 
11
 * This file is part of Kid3.
 
12
 *
 
13
 * Kid3 is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License as published by
 
15
 * the Free Software Foundation; either version 2 of the License, or
 
16
 * (at your option) any later version.
 
17
 *
 
18
 * Kid3 is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 */
 
26
 
 
27
#ifndef MESSAGEDIALOG_H
 
28
#define MESSAGEDIALOG_H
 
29
 
 
30
#include <QDialog>
 
31
#include "config.h"
 
32
#ifndef CONFIG_USE_KDE
 
33
 
 
34
#include <QMessageBox>
 
35
 
 
36
class QLabel;
 
37
class QTextEdit;
 
38
class QDialogButtonBox;
 
39
 
 
40
/**
 
41
 * Message dialog.
 
42
 * Drop-in replacement for QMessageBox, but suitable for large texts.
 
43
 */
 
44
class MessageDialog : public QDialog {
 
45
  Q_OBJECT
 
46
public:
 
47
  /**
 
48
   * Constructor.
 
49
   *
 
50
   * @param parent parent widget
 
51
   */
 
52
  explicit MessageDialog(QWidget* parent = 0);
 
53
 
 
54
  /**
 
55
   * Destructor.
 
56
   */
 
57
  virtual ~MessageDialog();
 
58
 
 
59
  /**
 
60
   * Set the text to be displayed.
 
61
   *
 
62
   * @param text message text.
 
63
   */
 
64
  void setText(const QString& text);
 
65
 
 
66
  /**
 
67
   * Set the informative text.
 
68
   * This text can be large and is displayed in a text edit.
 
69
   *
 
70
   * @param text message text.
 
71
   */
 
72
  void setInformativeText(const QString& text);
 
73
 
 
74
  /**
 
75
   * Set the message box's icon.
 
76
   *
 
77
   * @param icon icon to be displayed
 
78
   */
 
79
  void setIcon(QMessageBox::Icon icon);
 
80
 
 
81
  /**
 
82
   * Set buttons to be displayed.
 
83
   *
 
84
   * @param buttons buttons to be displayed
 
85
   */
 
86
  void setStandardButtons(QMessageBox::StandardButtons buttons);
 
87
 
 
88
  /**
 
89
   * Set default button.
 
90
   *
 
91
   * @param button button which gets default focus
 
92
   */
 
93
  void setDefaultButton(QMessageBox::StandardButton button);
 
94
 
 
95
  /**
 
96
   * Display a modal dialog with a list of items.
 
97
   *
 
98
   * @param parent parent widget
 
99
   * @param title dialog title
 
100
   * @param text dialog text
 
101
   * @param list list of items
 
102
   * @param buttons buttons shown
 
103
   *
 
104
   * @return QMessageBox::Ok or QMessageBox::Cancel.
 
105
   */
 
106
  static int warningList(QWidget* parent, const QString& title,
 
107
                         const QString& text, const QStringList& list,
 
108
                         QMessageBox::StandardButtons buttons =
 
109
                         QMessageBox::Ok | QMessageBox::Cancel);
 
110
 
 
111
private slots:
 
112
  /**
 
113
   * Called when a button is clicked.
 
114
   *
 
115
   * @param button button which was clicked
 
116
   */
 
117
  void buttonClicked(QAbstractButton* button);
 
118
 
 
119
private:
 
120
  QLabel* m_iconLabel;
 
121
  QLabel* m_textLabel;
 
122
  QTextEdit* m_textEdit;
 
123
  QDialogButtonBox* m_buttonBox;
 
124
};
 
125
#else // !CONFIG_USE_KDE
 
126
 
 
127
// Just to suppress moc "No relevant classes found" warning.
 
128
class MessageDialog : public QDialog {
 
129
Q_OBJECT
 
130
};
 
131
 
 
132
#endif // !CONFIG_USE_KDE
 
133
 
 
134
#endif // MESSAGEDIALOG_H