File: ButtonsDialog.h

package info (click to toggle)
fotowall 0.9-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,832 kB
  • ctags: 2,804
  • sloc: cpp: 23,275; makefile: 47; sh: 25
file content (86 lines) | stat: -rw-r--r-- 3,254 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************************
 *                                                                         *
 *   This file is part of the Fotowall project,                            *
 *       http://www.enricoros.com/opensource/fotowall                      *
 *                                                                         *
 *   Copyright (C) 2009 by Enrico Ros <enrico.ros@gmail.com>               *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef __ButtonsDialog_h__
#define __ButtonsDialog_h__

#include <QDialog>
#include <QDialogButtonBox>
#include <QIcon>
#include <QList>
#include <QMap>
#include <QStyle>
class QCheckBox;
class QVBoxLayout;
class QLabel;


class ButtonsDialog : public QDialog
{
    Q_OBJECT
    public:
        ButtonsDialog(const QString & dialogId, const QString & title = QString(),
                      const QString & message = QString(), QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::NoButton,
                      bool buttonsCentered = false, bool memorize = false);

        QDialogButtonBox::StandardButton execute();

        void setButtons(QDialogButtonBox::StandardButtons buttons);
        QDialogButtonBox::StandardButtons buttons() const;

        void setButtonText(QDialogButtonBox::StandardButton button, const QString & text);
        QString buttonText(QDialogButtonBox::StandardButton button) const;

        void setDefaultButton(QDialogButtonBox::StandardButton button);
        QDialogButtonBox::StandardButton defaultButton() const;

        void setButtonsCentered(bool centered);
        bool buttonsCentered() const;

        void setMessage(const QString & message);
        QString message() const;

        void setTitle(const QString & title);
        QString title() const;

        void setIcon(const QIcon & icon);
        void setIcon(QStyle::StandardPixmap icon);
        QIcon icon() const;

        void addExtraWidget(QWidget * widget);
        QList<QWidget *> extraWidgets() const;

        void setMemorizeEnabled(bool enabled);
        bool memorizeEnabled() const;

    private:
        QString m_dialogId;
        QIcon m_icon;
        bool m_memorize;
        QLabel * m_iconLabel;
        QLabel * m_messageLabel;
        QCheckBox * m_memorizeCheckbox;
        QVBoxLayout * m_extraLayout;
        QList<QWidget *> m_extraWidgets;
        QDialogButtonBox * m_buttonBox;
        QDialogButtonBox::StandardButton m_defaultButton;
        QDialogButtonBox::StandardButton m_pressedButton;
        QMap<QDialogButtonBox::StandardButton, QString> m_buttonNames;

    private Q_SLOTS:
        void slotButtonClicked(QAbstractButton *);
        void slotExtraWidgetDeleted(QObject * object);
};

#endif