~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
 *
 
3
 * VBox frontends: Qt GUI ("VirtualBox"):
 
4
 * VirtualBox Qt extensions: QIMessageBox class declaration
 
5
 */
 
6
 
 
7
/*
 
8
 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
 
9
 *
 
10
 * This file is part of VirtualBox Open Source Edition (OSE), as
 
11
 * available from http://www.virtualbox.org. This file is free software;
 
12
 * you can redistribute it and/or modify it under the terms of the GNU
 
13
 * General Public License (GPL) as published by the Free Software
 
14
 * Foundation, in version 2 as it comes in the "COPYING" file of the
 
15
 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 
16
 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
 
17
 *
 
18
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
 
19
 * Clara, CA 95054 USA or visit http://www.sun.com if you need
 
20
 * additional information or have any questions.
 
21
 */
 
22
 
 
23
#ifndef __QIMessageBox_h__
 
24
#define __QIMessageBox_h__
 
25
 
 
26
/* VBox includes */
 
27
#include "QIDialog.h"
 
28
#include "QIArrowSplitter.h"
 
29
 
 
30
/* Qt includes */
 
31
#include <QCheckBox>
 
32
#include <QMessageBox>
 
33
#include <QTextEdit>
 
34
 
 
35
/* VBox forwards */
 
36
class QIArrowSplitter;
 
37
class QIDialogButtonBox;
 
38
class QILabel;
 
39
 
 
40
/* Qt forwards */
 
41
class QCloseEvent;
 
42
class QLabel;
 
43
class QPushButton;
 
44
class QSpacerItem;
 
45
 
 
46
/** @class QIMessageBox
 
47
 *
 
48
 *  The QIMessageBox class is a message box similar to QMessageBox.
 
49
 *  It partly implements the QMessageBox interface and adds some enhanced
 
50
 *  functionality.
 
51
 */
 
52
class QIMessageBox : public QIDialog
 
53
{
 
54
    Q_OBJECT;
 
55
 
 
56
public:
 
57
 
 
58
    // for compatibility with QMessageBox
 
59
    enum Icon
 
60
    {
 
61
        NoIcon = QMessageBox::NoIcon,
 
62
        Information = QMessageBox::Information,
 
63
        Warning = QMessageBox::Warning,
 
64
        Critical = QMessageBox::Critical,
 
65
        Question = QMessageBox::Question,
 
66
        GuruMeditation,
 
67
    };
 
68
 
 
69
    enum
 
70
    {
 
71
        NoButton = 0, Ok = 1, Cancel = 2, Yes = 3, No = 4, Abort = 5,
 
72
        Retry = 6, Ignore = 7, YesAll = 8, NoAll = 9,
 
73
        ButtonMask = 0xFF,
 
74
 
 
75
        Default = 0x100, Escape = 0x200,
 
76
        FlagMask = 0x300
 
77
    };
 
78
 
 
79
    QIMessageBox (const QString &aCaption, const QString &aText,
 
80
                  Icon aIcon, int aButton0, int aButton1 = 0, int aButton2 = 0,
 
81
                  QWidget *aParent = 0, const char *aName = 0, bool aModal = TRUE);
 
82
 
 
83
    QString buttonText (int aButton) const;
 
84
    void setButtonText (int aButton, const QString &aText);
 
85
 
 
86
    QString flagText() const { return mFlagCB->isVisible() ? mFlagCB->text() : QString::null; }
 
87
    void setFlagText (const QString &aText);
 
88
 
 
89
    bool isFlagChecked() const { return mFlagCB->isChecked(); }
 
90
    void setFlagChecked (bool aChecked) { mFlagCB->setChecked (aChecked); }
 
91
 
 
92
    QString detailsText () const { return mDetailsText->toHtml(); }
 
93
    void setDetailsText (const QString &aText);
 
94
 
 
95
    QPixmap standardPixmap (QIMessageBox::Icon aIcon);
 
96
 
 
97
private:
 
98
 
 
99
    QPushButton *createButton (int aButton);
 
100
 
 
101
    void closeEvent (QCloseEvent *e);
 
102
    void showEvent (QShowEvent *e);
 
103
 
 
104
    void refreshDetails();
 
105
    void setDetailsShown (bool aShown);
 
106
 
 
107
private slots:
 
108
 
 
109
    void detailsBack();
 
110
    void detailsNext();
 
111
 
 
112
    void done0() { mWasDone = true; done (mButton0 & ButtonMask); }
 
113
    void done1() { mWasDone = true; done (mButton1 & ButtonMask); }
 
114
    void done2() { mWasDone = true; done (mButton2 & ButtonMask); }
 
115
 
 
116
    void reject();
 
117
 
 
118
private:
 
119
 
 
120
    int mButton0, mButton1, mButton2, mButtonEsc;
 
121
    QLabel *mIconLabel;
 
122
    QILabel *mTextLabel;
 
123
    QPushButton *mButton0PB, *mButton1PB, *mButton2PB;
 
124
    QCheckBox *mFlagCB, *mFlagCB_Main, *mFlagCB_Details;
 
125
    QWidget *mDetailsVBox;
 
126
    QIArrowSplitter *mDetailsSplitter;
 
127
    QTextEdit *mDetailsText;
 
128
    QSpacerItem *mSpacer;
 
129
    QIDialogButtonBox *mButtonBox;
 
130
    QString mText;
 
131
    QList < QPair <QString, QString> > mDetailsList;
 
132
    int mDetailsIndex;
 
133
    bool mWasDone : 1;
 
134
    bool mWasPolished : 1;
 
135
};
 
136
 
 
137
#endif
 
138