VirtualBox

Changeset 30356 in vbox


Ignore:
Timestamp:
Jun 22, 2010 8:42:22 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
62937
Message:

FE/Qt4: added a new segmented button type; code cleanup

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
10 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r30258 r30356  
    306306        src/wizards/exportappliance/UIExportApplianceWzd.h \
    307307        src/wizards/importappliance/UIImportApplianceWzd.h \
    308         src/widgets/VBoxApplianceEditorWgt.h \
    309         src/widgets/VBoxBootTable.h \
    310308        src/widgets/UIDownloader.h \
    311309        src/widgets/UIDownloaderAdditions.h \
    312310        src/widgets/UIDownloaderUserManual.h \
     311        src/widgets/UISpacerWidgets.h \
     312        src/widgets/UISpecialControls.h \
     313        src/widgets/VBoxApplianceEditorWgt.h \
     314        src/widgets/VBoxBootTable.h \
    313315        src/widgets/VBoxExportApplianceWgt.h \
    314316        src/widgets/VBoxFilePathSelectorWidget.h \
     
    320322        src/widgets/VBoxOSTypeSelectorWidget.h \
    321323        src/widgets/VBoxProgressDialog.h \
    322         src/widgets/VBoxSpecialControls.h \
    323324        src/widgets/VBoxWarningPane.h \
    324         src/widgets/UISpacerWidgets.h \
    325325        src/runtime/UISession.h \
    326326        src/runtime/UIActionsPool.h \
     
    439439        src/wizards/exportappliance/UIExportApplianceWzd.cpp \
    440440        src/wizards/importappliance/UIImportApplianceWzd.cpp \
    441         src/widgets/VBoxApplianceEditorWgt.cpp \
    442         src/widgets/VBoxBootTable.cpp \
    443441        src/widgets/UIDownloader.cpp \
    444442        src/widgets/UIDownloaderAdditions.cpp \
    445443        src/widgets/UIDownloaderUserManual.cpp \
     444        src/widgets/UISpecialControls.cpp \
     445        src/widgets/VBoxApplianceEditorWgt.cpp \
     446        src/widgets/VBoxBootTable.cpp \
    446447        src/widgets/VBoxExportApplianceWgt.cpp \
    447448        src/widgets/VBoxFilePathSelectorWidget.cpp \
     
    454455        src/widgets/VBoxOSTypeSelectorWidget.cpp \
    455456        src/widgets/VBoxProgressDialog.cpp \
    456         src/widgets/VBoxSpecialControls.cpp \
    457457        src/widgets/VBoxWarningPane.cpp \
    458458        src/runtime/UISession.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.cpp

    r30196 r30356  
    2323#include "QITabWidget.h"
    2424#include "UIIconPool.h"
     25#include "UISpecialControls.h"
    2526#include "VBoxGlobal.h"
    2627#include "VBoxProblemReporter.h"
    27 #include "VBoxSpecialControls.h"
    2828#include "VBoxUtils.h"
    2929#include "VBoxVMLogViewer.h"
     
    348348    , mWarningSpacer (0), mWarningIcon (0), mWarningString (0)
    349349{
    350     mButtonClose = new VBoxMiniCancelButton (this);
     350    mButtonClose = new UIMiniCancelButton (this);
    351351    connect (mButtonClose, SIGNAL (clicked()), this, SLOT (hide()));
    352352
    353353    mSearchName = new QLabel (this);
    354     mSearchString = new VBoxSearchField (this);
     354    mSearchString = new UISearchField (this);
    355355    mSearchString->setSizePolicy (QSizePolicy::Preferred,
    356356                                  QSizePolicy::Fixed);
     
    358358             this, SLOT (findCurrent (const QString &)));
    359359
    360     mButtonsNextPrev = new VBoxSegmentedButton (2, this);
     360    mButtonsNextPrev = new UIRoundRectSegmentedButton(2, this);
    361361    mButtonsNextPrev->setEnabled (0, false);
    362362    mButtonsNextPrev->setEnabled (1, false);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMLogViewer.h

    r29972 r30356  
    2020#define __VBoxVMLogViewer_h__
    2121
     22/* Local includes */
    2223#include "VBoxVMLogViewer.gen.h"
    2324#include "QIMainDialog.h"
     
    2526#include "QIWithRetranslateUI.h"
    2627
     28/* Local forward declarations */
     29class QITabWidget;
     30class QIToolButton;
     31class UIMiniCancelButton;
     32class UIRoundRectSegmentedButton;
     33class UISearchField;
    2734class VBoxLogSearchPanel;
    28 class QITabWidget;
     35
     36/* Global forward declarations */
     37class QCheckBox;
     38class QLabel;
    2939class QTextEdit;
    30 class VBoxSearchField;
    31 class QLabel;
    32 class QIToolButton;
    33 class VBoxMiniCancelButton;
    34 class VBoxSegmentedButton;
    35 class QCheckBox;
    3640
    3741class VBoxVMLogViewer : public QIWithRetranslateUI2<QIMainDialog>,
     
    118122    void toggleWarning (bool aHide);
    119123
    120     VBoxVMLogViewer      *mViewer;
    121     VBoxMiniCancelButton *mButtonClose;
    122     QLabel               *mSearchName;
    123     VBoxSearchField      *mSearchString;
    124     VBoxSegmentedButton *mButtonsNextPrev;
    125     QCheckBox            *mCaseSensitive;
    126     QSpacerItem          *mWarningSpacer;
    127     QLabel               *mWarningIcon;
    128     QLabel               *mWarningString;
     124    VBoxVMLogViewer            *mViewer;
     125    UIMiniCancelButton        *mButtonClose;
     126    QLabel                     *mSearchName;
     127    UISearchField              *mSearchString;
     128    UIRoundRectSegmentedButton *mButtonsNextPrev;
     129    QCheckBox                  *mCaseSensitive;
     130    QSpacerItem                *mWarningSpacer;
     131    QLabel                     *mWarningIcon;
     132    QLabel                     *mWarningString;
    129133};
    130134
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.cpp

    r28800 r30356  
    1919
    2020#include "QIDialogButtonBox.h"
    21 #include "VBoxSpecialControls.h"
     21#include "UISpecialControls.h"
    2222
    2323#include <iprt/assert.h>
     
    111111        /* Use our very own help button if the user requested for one. */
    112112        if (!mHelpButton)
    113             mHelpButton = new VBoxHelpButton;
     113            mHelpButton = new UIHelpButton;
    114114        mHelpButton->initFrom (btn);
    115115        removeButton (btn);
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIDialogButtonBox.h

    r28800 r30356  
    2828class QBoxLayout;
    2929
    30 class VBoxHelpButton;
     30class UIHelpButton;
    3131
    3232class QIDialogButtonBox: public QIWithRetranslateUI<QDialogButtonBox>
     
    5656private:
    5757
    58     QPointer<VBoxHelpButton> mHelpButton;
     58    QPointer<UIHelpButton> mHelpButton;
    5959};
    6060
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsInput.ui

    r28800 r30356  
    124124   <class>UIResetButton</class>
    125125   <extends>QAbstractButton</extends>
    126    <header>VBoxSpecialControls.h</header>
     126   <header>UISpecialControls.h</header>
    127127  </customwidget>
    128128 </customwidgets>
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIDownloader.cpp

    r28800 r30356  
    2323#include "VBoxGlobal.h"
    2424#include "VBoxProblemReporter.h"
    25 #include "VBoxSpecialControls.h"
     25#include "UISpecialControls.h"
    2626
    2727/* Global includes */
     
    3232    : QWidget(pParent)
    3333    , m_pProgressBar(new QProgressBar(this))
    34     , m_pCancelButton(new VBoxMiniCancelButton(this))
     34    , m_pCancelButton(new UIMiniCancelButton(this))
    3535{
    3636    /* Progress Bar setup */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIDownloader.h

    r28800 r30356  
    2626/* Local forward declarations */
    2727class QIHttp;
    28 class VBoxMiniCancelButton;
     28class UIMiniCancelButton;
    2929
    3030/* Global forward declarations */
     
    6464    /* Private member vars */
    6565    QProgressBar *m_pProgressBar;
    66     VBoxMiniCancelButton *m_pCancelButton;
     66    UIMiniCancelButton *m_pCancelButton;
    6767
    6868    QString m_strSource;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.cpp

    r30352 r30356  
    77
    88/*
    9  * Copyright (C) 2009 Oracle Corporation
     9 * Copyright (C) 2009-2010 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020/* VBox includes */
    2121#include "UIIconPool.h"
    22 #include "VBoxSpecialControls.h"
     22#include "UISpecialControls.h"
    2323
    2424/* Global includes */
     
    3232 *
    3333 ********************************************************************************/
    34 VBoxMiniCancelButton::VBoxMiniCancelButton (QWidget *aParent /* = 0 */)
    35   : QAbstractButton (aParent)
    36 {
    37     setShortcut (QKeySequence (Qt::Key_Escape));
    38     mButton = new UICocoaButton (UICocoaButton::CancelButton, this);
    39     connect (mButton, SIGNAL (clicked()),
    40              this, SIGNAL (clicked()));
    41     setFixedSize (mButton->size());
    42 }
    43 
    44 void VBoxMiniCancelButton::resizeEvent(QResizeEvent * /* pEvent */)
    45 {
    46     mButton->resize(size());
     34UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
     35  : QAbstractButton(pParent)
     36{
     37    setShortcut(QKeySequence(Qt::Key_Escape));
     38    m_pButton = new UICocoaButton(UICocoaButton::CancelButton, this);
     39    connect(m_pButton, SIGNAL(clicked()),
     40            this, SIGNAL(clicked()));
     41    setFixedSize(m_pButton->size());
     42}
     43
     44void UIMiniCancelButton::resizeEvent(QResizeEvent * /* pEvent */)
     45{
     46    m_pButton->resize(size());
    4747}
    4848
     
    7171 *
    7272 ********************************************************************************/
    73 VBoxHelpButton::VBoxHelpButton (QWidget *aParent /* = 0 */)
    74   : QPushButton (aParent)
    75 {
    76     setShortcut (QKeySequence (QKeySequence::HelpContents));
    77     mButton = new UICocoaButton (UICocoaButton::HelpButton, this);
    78     connect (mButton, SIGNAL (clicked()),
    79              this, SIGNAL (clicked()));
    80     setFixedSize (mButton->size());
     73UIHelpButton::UIHelpButton(QWidget *pParent /* = 0 */)
     74  : QPushButton(pParent)
     75{
     76    setShortcut(QKeySequence(QKeySequence::HelpContents));
     77    m_pButton = new UICocoaButton(UICocoaButton::HelpButton, this);
     78    connect(m_pButton, SIGNAL(clicked()),
     79            this, SIGNAL(clicked()));
     80    setFixedSize(m_pButton->size());
    8181}
    8282
     
    8686 *
    8787 ********************************************************************************/
    88 VBoxSegmentedButton::VBoxSegmentedButton (int aCount, QWidget *aParent /* = 0 */)
    89   : UICocoaSegmentedButton (aCount, UICocoaSegmentedButton::RoundRectSegment, aParent)
    90 {
    91 }
     88UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(int cCount, QWidget *pParent /* = 0 */)
     89  : UICocoaSegmentedButton(cCount, UICocoaSegmentedButton::RoundRectSegment, pParent)
     90{
     91}
     92
     93UITexturedSegmentedButton::UITexturedSegmentedButton(int cCount, QWidget *pParent /* = 0 */)
     94  : UICocoaSegmentedButton(cCount, UICocoaSegmentedButton::TexturedRoundedSegment, pParent)
     95{
     96}
     97
    9298/********************************************************************************
    9399 *
     
    95101 *
    96102 ********************************************************************************/
    97 VBoxSearchField::VBoxSearchField (QWidget *aParent /* = 0 */)
    98   : UICocoaSearchField (aParent)
     103UISearchField::UISearchField(QWidget *pParent /* = 0 */)
     104  : UICocoaSearchField(pParent)
    99105{
    100106}
     
    113119 *
    114120 ********************************************************************************/
    115 VBoxMiniCancelButton::VBoxMiniCancelButton (QWidget *aParent /* = 0 */)
    116   : QIWithRetranslateUI<QIToolButton> (aParent)
    117 {
    118     setAutoRaise (true);
    119     setFocusPolicy (Qt::TabFocus);
    120     setShortcut (QKeySequence (Qt::Key_Escape));
     121UIMiniCancelButton::UIMiniCancelButton(QWidget *pParent /* = 0 */)
     122  : QIWithRetranslateUI<QIToolButton>(pParent)
     123{
     124    setAutoRaise(true);
     125    setFocusPolicy(Qt::TabFocus);
     126    setShortcut(QKeySequence(Qt::Key_Escape));
    121127    setIcon(UIIconPool::defaultIcon(UIIconPool::DialogCancelIcon));
    122128}
    123129
    124 void VBoxMiniCancelButton::removeBorder()
     130void UIMiniCancelButton::removeBorder()
    125131{
    126132    setStyleSheet("QToolButton { border: 0px }");
     
    138144static const int PushButtonBottomOffset = 4;
    139145
    140 VBoxHelpButton::VBoxHelpButton (QWidget *aParent /* = 0 */)
    141     : QIWithRetranslateUI<QPushButton> (aParent)
     146UIHelpButton::UIHelpButton(QWidget *pParent /* = 0 */)
     147    : QIWithRetranslateUI<QPushButton>(pParent)
    142148{
    143149#ifdef Q_WS_MAC
    144     mButtonPressed = false;
    145     mNormalPixmap = new QPixmap (":/help_button_normal_mac_22px.png");
    146     mPressedPixmap = new QPixmap (":/help_button_pressed_mac_22px.png");
    147     mSize = mNormalPixmap->size();
    148     mMask = new QImage (mNormalPixmap->mask().toImage());
    149     mBRect = QRect (PushButtonLeftOffset,
     150    m_pButtonPressed = false;
     151    m_pNormalPixmap = new QPixmap(":/help_button_normal_mac_22px.png");
     152    m_pPressedPixmap = new QPixmap(":/help_button_pressed_mac_22px.png");
     153    m_size = m_pNormalPixmap->size();
     154    m_pMask = new QImage(m_pNormalPixmap->mask().toImage());
     155    m_BRect = QRect(PushButtonLeftOffset,
    150156                    PushButtonTopOffset,
    151                     mSize.width(),
    152                     mSize.height());
     157                    m_size.width(),
     158                    m_size.height());
    153159#endif /* Q_WS_MAC */
    154160    /* Applying language settings */
     
    156162}
    157163
    158 void VBoxHelpButton::initFrom (QPushButton *aOther)
    159 {
    160     setIcon (aOther->icon());
    161     setText (aOther->text());
    162     setShortcut (aOther->shortcut());
    163     setFlat (aOther->isFlat());
    164     setAutoDefault (aOther->autoDefault());
    165     setDefault (aOther->isDefault());
     164void UIHelpButton::initFrom(QPushButton *pOther)
     165{
     166    setIcon(pOther->icon());
     167    setText(pOther->text());
     168    setShortcut(pOther->shortcut());
     169    setFlat(pOther->isFlat());
     170    setAutoDefault(pOther->autoDefault());
     171    setDefault(pOther->isDefault());
    166172    /* Applying language settings */
    167173    retranslateUi();
    168174}
    169175
    170 void VBoxHelpButton::retranslateUi()
    171 {
    172     QPushButton::setText (tr ("&Help"));
     176void UIHelpButton::retranslateUi()
     177{
     178    QPushButton::setText(tr("&Help"));
    173179    if (QPushButton::shortcut().isEmpty())
    174         QPushButton::setShortcut (QKeySequence::HelpContents);
     180        QPushButton::setShortcut(QKeySequence::HelpContents);
    175181}
    176182
    177183#ifdef Q_WS_MAC
    178 VBoxHelpButton::~VBoxHelpButton()
    179 {
    180     delete mNormalPixmap;
    181     delete mPressedPixmap;
    182     delete mMask;
    183 }
    184 
    185 QSize VBoxHelpButton::sizeHint() const
    186 {
    187     return QSize (mSize.width() + PushButtonLeftOffset + PushButtonRightOffset,
    188                   mSize.height() + PushButtonTopOffset + PushButtonBottomOffset);
    189 }
    190 
    191 void VBoxHelpButton::paintEvent (QPaintEvent * /* aEvent */)
    192 {
    193     QPainter painter (this);
    194     painter.drawPixmap (PushButtonLeftOffset, PushButtonTopOffset, mButtonPressed ? *mPressedPixmap: *mNormalPixmap);
    195 }
    196 
    197 bool VBoxHelpButton::hitButton (const QPoint &pos) const
    198 {
    199     if (mBRect.contains (pos))
    200         return  mMask->pixel (pos.x() - PushButtonLeftOffset,
     184UIHelpButton::~UIHelpButton()
     185{
     186    delete m_pNormalPixmap;
     187    delete m_pPressedPixmap;
     188    delete m_pMask;
     189}
     190
     191QSize UIHelpButton::sizeHint() const
     192{
     193    return QSize(m_size.width() + PushButtonLeftOffset + PushButtonRightOffset,
     194                 m_size.height() + PushButtonTopOffset + PushButtonBottomOffset);
     195}
     196
     197void UIHelpButton::paintEvent(QPaintEvent * /* pEvent */)
     198{
     199    QPainter painter(this);
     200    painter.drawPixmap(PushButtonLeftOffset, PushButtonTopOffset, m_pButtonPressed ? *m_pPressedPixmap: *m_pNormalPixmap);
     201}
     202
     203bool UIHelpButton::hitButton(const QPoint &pos) const
     204{
     205    if (m_BRect.contains(pos))
     206        return m_pMask->pixel(pos.x() - PushButtonLeftOffset,
    201207                              pos.y() - PushButtonTopOffset) == 0xff000000;
    202208    else
     
    204210}
    205211
    206 void VBoxHelpButton::mousePressEvent (QMouseEvent *aEvent)
    207 {
    208     if (hitButton (aEvent->pos()))
    209         mButtonPressed = true;
    210     QPushButton::mousePressEvent (aEvent);
     212void UIHelpButton::mousePressEvent(QMouseEvent *pEvent)
     213{
     214    if (hitButton(pEvent->pos()))
     215        m_pButtonPressed = true;
     216    QPushButton::mousePressEvent(pEvent);
    211217    update();
    212218}
    213219
    214 void VBoxHelpButton::mouseReleaseEvent (QMouseEvent *aEvent)
    215 {
    216     QPushButton::mouseReleaseEvent (aEvent);
    217     mButtonPressed = false;
     220void UIHelpButton::mouseReleaseEvent(QMouseEvent *pEvent)
     221{
     222    QPushButton::mouseReleaseEvent(pEvent);
     223    m_pButtonPressed = false;
    218224    update();
    219225}
    220226
    221 void VBoxHelpButton::leaveEvent (QEvent * aEvent)
    222 {
    223     QPushButton::leaveEvent (aEvent);
    224     mButtonPressed = false;
     227void UIHelpButton::leaveEvent(QEvent * pEvent)
     228{
     229    QPushButton::leaveEvent(pEvent);
     230    m_pButtonPressed = false;
    225231    update();
    226232}
     
    232238 *
    233239 ********************************************************************************/
    234 VBoxSegmentedButton::VBoxSegmentedButton (int aCount, QWidget *aParent /* = 0 */)
    235   : QWidget (aParent)
    236 {
    237     mSignalMapper = new QSignalMapper (this);
    238 
    239     QHBoxLayout *layout = new QHBoxLayout (this);
     240UIRoundRectSegmentedButton::UIRoundRectSegmentedButton(int aCount, QWidget *pParent /* = 0 */)
     241  : QWidget(pParent)
     242{
     243    m_pSignalMapper = new QSignalMapper(this);
     244
     245    QHBoxLayout *layout = new QHBoxLayout(this);
    240246    for (int i=0; i < aCount; ++i)
    241247    {
    242         QIToolButton *button = new QIToolButton (this);
    243         button->setAutoRaise (true);
    244         button->setFocusPolicy (Qt::TabFocus);
    245         button->setToolButtonStyle (Qt::ToolButtonTextBesideIcon);
    246         mButtons.append (button);
    247         layout->addWidget (button);
    248         connect (button, SIGNAL(clicked()),
    249                  mSignalMapper, SLOT(map()));
    250         mSignalMapper->setMapping (button, i);
     248        QIToolButton *button = new QIToolButton(this);
     249        button->setAutoRaise(true);
     250        button->setFocusPolicy(Qt::TabFocus);
     251        button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
     252        m_pButtons.append(button);
     253        layout->addWidget(button);
     254        connect(button, SIGNAL(clicked()),
     255                m_pSignalMapper, SLOT(map()));
     256        m_pSignalMapper->setMapping(button, i);
    251257    }
    252     connect (mSignalMapper, SIGNAL(mapped(int)),
    253              this, SIGNAL(clicked(int)));
    254 
    255 }
    256 
    257 VBoxSegmentedButton::~VBoxSegmentedButton()
    258 {
    259     delete mSignalMapper;
    260     qDeleteAll (mButtons);
    261 }
    262 
    263 void VBoxSegmentedButton::setTitle (int aSegment, const QString &aTitle)
    264 {
    265     mButtons.at (aSegment)->setText (aTitle);
    266 }
    267 
    268 void VBoxSegmentedButton::setToolTip (int aSegment, const QString &aTip)
    269 {
    270     mButtons.at (aSegment)->setToolTip (aTip);
    271 }
    272 
    273 void VBoxSegmentedButton::setIcon (int aSegment, const QIcon &aIcon)
    274 {
    275     mButtons.at (aSegment)->setIcon (aIcon);
    276 }
    277 
    278 void VBoxSegmentedButton::setEnabled (int aSegment, bool fEnabled)
    279 {
    280     mButtons.at (aSegment)->setEnabled (fEnabled);
    281 }
    282 
    283 void VBoxSegmentedButton::animateClick (int aSegment)
    284 {
    285     mButtons.at (aSegment)->animateClick();
     258    connect(m_pSignalMapper, SIGNAL(mapped(int)),
     259            this, SIGNAL(clicked(int)));
     260
     261}
     262
     263UIRoundRectSegmentedButton::~UIRoundRectSegmentedButton()
     264{
     265    delete m_pSignalMapper;
     266    qDeleteAll(m_pButtons);
     267}
     268
     269void UIRoundRectSegmentedButton::setTitle(int iSegment, const QString &aTitle)
     270{
     271    m_pButtons.at(iSegment)->setText(aTitle);
     272}
     273
     274void UIRoundRectSegmentedButton::setToolTip(int iSegment, const QString &strTip)
     275{
     276    m_pButtons.at(iSegment)->setToolTip(strTip);
     277}
     278
     279void UIRoundRectSegmentedButton::setIcon(int iSegment, const QIcon &icon)
     280{
     281    m_pButtons.at(iSegment)->setIcon(icon);
     282}
     283
     284void UIRoundRectSegmentedButton::setEnabled(int iSegment, bool fEnabled)
     285{
     286    m_pButtons.at(iSegment)->setEnabled(fEnabled);
     287}
     288
     289void UIRoundRectSegmentedButton::animateClick(int iSegment)
     290{
     291    m_pButtons.at(iSegment)->animateClick();
    286292}
    287293
     
    291297 *
    292298 ********************************************************************************/
    293 VBoxSearchField::VBoxSearchField (QWidget *aParent /* = 0 */)
    294   : QLineEdit (aParent)
    295 {
    296     mBaseBrush = palette().base();
    297 }
    298 
    299 void VBoxSearchField::markError()
     299UISearchField::UISearchField(QWidget *pParent /* = 0 */)
     300  : QLineEdit(pParent)
     301{
     302    m_baseBrush = palette().base();
     303}
     304
     305void UISearchField::markError()
    300306{
    301307    QPalette pal = palette();
    302     QColor c (Qt::red);
    303     c.setAlphaF (0.3);
    304     pal.setBrush (QPalette::Base, c);
    305     setPalette (pal);
    306 }
    307 
    308 void VBoxSearchField::unmarkError()
     308    QColor c(Qt::red);
     309    c.setAlphaF(0.3);
     310    pal.setBrush(QPalette::Base, c);
     311    setPalette(pal);
     312}
     313
     314void UISearchField::unmarkError()
    309315{
    310316    QPalette pal = palette();
    311     pal.setBrush (QPalette::Base, mBaseBrush);
    312     setPalette (pal);
     317    pal.setBrush(QPalette::Base, m_baseBrush);
     318    setPalette(pal);
    313319}
    314320
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UISpecialControls.h

    r30352 r30356  
    66
    77/*
    8  * Copyright (C) 2009 Oracle Corporation
     8 * Copyright (C) 2009-2010 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    3636 *
    3737 ********************************************************************************/
    38 class VBoxMiniCancelButton: public QAbstractButton
    39 {
    40     Q_OBJECT;
    41 
    42 public:
    43     VBoxMiniCancelButton (QWidget *aParent = 0);
    44 
    45     void setText (const QString &aText) { mButton->setText (aText); }
    46     void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
    47     void removeBorder() {}
    48 
    49 protected:
    50     void paintEvent (QPaintEvent * /* aEvent */) {}
    51     void resizeEvent(QResizeEvent *pEvent);
    52 
    53 private:
    54     UICocoaButton *mButton;
    55 };
    56 
    57 /********************************************************************************
    58  *
    59  * A reset button in the native Cocoa version.
    60  *
    61  ********************************************************************************/
    62 class UIResetButton: public QAbstractButton
    63 {
    64     Q_OBJECT;
    65 
    66 public:
    67     UIResetButton(QWidget *pParent = 0);
     38class UIMiniCancelButton: public QAbstractButton
     39{
     40    Q_OBJECT;
     41
     42public:
     43    UIMiniCancelButton(QWidget *pParent = 0);
    6844
    6945    void setText(const QString &strText) { m_pButton->setText(strText); }
     
    8157/********************************************************************************
    8258 *
     59 * A reset button in the native Cocoa version.
     60 *
     61 ********************************************************************************/
     62class UIResetButton: public QAbstractButton
     63{
     64    Q_OBJECT;
     65
     66public:
     67    UIResetButton(QWidget *pParent = 0);
     68
     69    void setText(const QString &strText) { m_pButton->setText(strText); }
     70    void setToolTip(const QString &strTip) { m_pButton->setToolTip(strTip); }
     71    void removeBorder() {}
     72
     73protected:
     74    void paintEvent(QPaintEvent * /* pEvent */) {}
     75    void resizeEvent(QResizeEvent *pEvent);
     76
     77private:
     78    UICocoaButton *m_pButton;
     79};
     80
     81/********************************************************************************
     82 *
    8383 * A help button in the native Cocoa version.
    8484 *
    8585 ********************************************************************************/
    86 class VBoxHelpButton: public QPushButton
    87 {
    88     Q_OBJECT;
    89 
    90 public:
    91     VBoxHelpButton (QWidget *aParent = 0);
    92 
    93     void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
    94 
    95     void initFrom (QPushButton * /* aOther */) {}
    96 
    97 protected:
    98     void paintEvent (QPaintEvent * /* aEvent */) {}
    99 
    100 private:
    101     UICocoaButton *mButton;
     86class UIHelpButton: public QPushButton
     87{
     88    Q_OBJECT;
     89
     90public:
     91    UIHelpButton(QWidget *pParent = 0);
     92
     93    void setToolTip(const QString &strTip) { m_pButton->setToolTip(strTip); }
     94
     95    void initFrom(QPushButton * /* pOther */) {}
     96
     97protected:
     98    void paintEvent(QPaintEvent * /* pEvent */) {}
     99
     100private:
     101    UICocoaButton *m_pButton;
    102102};
    103103
     
    107107 *
    108108 ********************************************************************************/
    109 class VBoxSegmentedButton: public UICocoaSegmentedButton
    110 {
    111     Q_OBJECT;
    112 
    113 public:
    114     VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
     109class UIRoundRectSegmentedButton: public UICocoaSegmentedButton
     110{
     111    Q_OBJECT;
     112
     113public:
     114    UIRoundRectSegmentedButton(int cCount, QWidget *pParent = 0);
     115};
     116
     117class UITexturedSegmentedButton: public UICocoaSegmentedButton
     118{
     119    Q_OBJECT;
     120
     121public:
     122    UITexturedSegmentedButton(int cCount, QWidget *pParent = 0);
    115123};
    116124
     
    120128 *
    121129 ********************************************************************************/
    122 class VBoxSearchField: public UICocoaSearchField
    123 {
    124     Q_OBJECT;
    125 
    126 public:
    127     VBoxSearchField (QWidget *aParent = 0);
     130class UISearchField: public UICocoaSearchField
     131{
     132    Q_OBJECT;
     133
     134public:
     135    UISearchField(QWidget *pParent = 0);
    128136};
    129137
     
    144152 *
    145153 ********************************************************************************/
    146 class VBoxMiniCancelButton: public QIWithRetranslateUI<QIToolButton>
    147 {
    148     Q_OBJECT;
    149 
    150 public:
    151     VBoxMiniCancelButton (QWidget *aParent = 0);
     154class UIMiniCancelButton: public QIWithRetranslateUI<QIToolButton>
     155{
     156    Q_OBJECT;
     157
     158public:
     159    UIMiniCancelButton(QWidget *pParent = 0);
    152160    void removeBorder();
    153161
     
    161169 *
    162170 ********************************************************************************/
    163 class UIResetButton: public VBoxMiniCancelButton
     171class UIResetButton: public UIMiniCancelButton
    164172{
    165173    Q_OBJECT;
     
    167175public:
    168176    UIResetButton(QWidget *pParent = 0)
    169       : VBoxMiniCancelButton(pParent) {}
     177      : UIMiniCancelButton(pParent) {}
    170178};
    171179
     
    175183 *
    176184 ********************************************************************************/
    177 class VBoxHelpButton: public QIWithRetranslateUI<QPushButton>
    178 {
    179     Q_OBJECT;
    180 
    181 public:
    182     VBoxHelpButton (QWidget *aParent = 0);
     185class UIHelpButton: public QIWithRetranslateUI<QPushButton>
     186{
     187    Q_OBJECT;
     188
     189public:
     190    UIHelpButton(QWidget *pParent = 0);
    183191#ifdef Q_WS_MAC
    184     ~VBoxHelpButton();
     192    ~UIHelpButton();
    185193    QSize sizeHint() const;
    186194#endif /* Q_WS_MAC */
    187195
    188     void initFrom (QPushButton *aOther);
     196    void initFrom(QPushButton *pOther);
    189197
    190198protected:
     
    192200
    193201#ifdef Q_WS_MAC
    194     void paintEvent (QPaintEvent *aEvent);
    195 
    196     bool hitButton (const QPoint &pos) const;
    197 
    198     void mousePressEvent (QMouseEvent *aEvent);
    199     void mouseReleaseEvent (QMouseEvent *aEvent);
    200     void leaveEvent (QEvent *aEvent);
     202    void paintEvent(QPaintEvent *pEvent);
     203
     204    bool hitButton(const QPoint &pos) const;
     205
     206    void mousePressEvent(QMouseEvent *pEvent);
     207    void mouseReleaseEvent(QMouseEvent *pEvent);
     208    void leaveEvent(QEvent *pEvent);
    201209
    202210private:
    203211    /* Private member vars */
    204     bool mButtonPressed;
    205 
    206     QSize mSize;
    207     QPixmap *mNormalPixmap;
    208     QPixmap *mPressedPixmap;
    209     QImage *mMask;
    210     QRect mBRect;
     212    bool m_pButtonPressed;
     213
     214    QSize m_size;
     215    QPixmap *m_pNormalPixmap;
     216    QPixmap *m_pPressedPixmap;
     217    QImage *m_pMask;
     218    QRect m_BRect;
    211219#endif /* Q_WS_MAC */
    212220};
     
    217225 *
    218226 ********************************************************************************/
    219 class VBoxSegmentedButton: public QWidget
    220 {
    221     Q_OBJECT;
    222 
    223 public:
    224     VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
    225     ~VBoxSegmentedButton();
    226 
    227     void setTitle (int aSegment, const QString &aTitle);
    228     void setToolTip (int aSegment, const QString &aTip);
    229     void setIcon (int aSegment, const QIcon &aIcon);
    230     void setEnabled (int aSegment, bool fEnabled);
    231 
    232     void animateClick (int aSegment);
     227class UIRoundRectSegmentedButton: public QWidget
     228{
     229    Q_OBJECT;
     230
     231public:
     232    UIRoundRectSegmentedButton(int aCount, QWidget *pParent = 0);
     233    ~UIRoundRectSegmentedButton();
     234
     235    void setTitle(int iSegment, const QString &aTitle);
     236    void setToolTip(int iSegment, const QString &strTip);
     237    void setIcon(int iSegment, const QIcon &icon);
     238    void setEnabled(int iSegment, bool fEnabled);
     239
     240    void animateClick(int iSegment);
    233241
    234242signals:
    235     void clicked (int aSegment);
     243    void clicked(int iSegment);
    236244
    237245private:
    238246    /* Private member vars */
    239     QList<QIToolButton*> mButtons;
    240     QSignalMapper *mSignalMapper;
     247    QList<QIToolButton*> m_pButtons;
     248    QSignalMapper *m_pSignalMapper;
     249};
     250
     251class UITexturedSegmentedButton: public UIRoundRectSegmentedButton
     252{
     253    Q_OBJECT;
     254
     255public:
     256    UITexturedSegmentedButton(int cCount, QWidget *pParent = 0)
     257      : UIRoundRectSegmentedButton(cCount, pParent) {}
    241258};
    242259
     
    246263 *
    247264 ********************************************************************************/
    248 class VBoxSearchField: public QLineEdit
    249 {
    250     Q_OBJECT;
    251 
    252 public:
    253     VBoxSearchField (QWidget *aParent = 0);
     265class UISearchField: public QLineEdit
     266{
     267    Q_OBJECT;
     268
     269public:
     270    UISearchField(QWidget *pParent = 0);
    254271
    255272    void markError();
     
    258275private:
    259276    /* Private member vars */
    260     QBrush mBaseBrush;
     277    QBrush m_baseBrush;
    261278};
    262279
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxProgressDialog.cpp

    r28800 r30356  
    2424#include "VBoxGlobal.h"
    2525#include "VBoxProgressDialog.h"
    26 #include "VBoxSpecialControls.h"
     26#include "UISpecialControls.h"
    2727#ifdef Q_WS_MAC
    2828# include "VBoxUtils-darwin.h"
     
    9090    if (mCancelEnabled)
    9191    {
    92         mCancelBtn = new VBoxMiniCancelButton (this);
     92        mCancelBtn = new UIMiniCancelButton (this);
    9393        mCancelBtn->setFocusPolicy (Qt::ClickFocus);
    9494        pLayout2->addWidget (mCancelBtn, 0, Qt::AlignVCenter);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxProgressDialog.h

    r28800 r30356  
    2626class CProgress;
    2727class QILabel;
    28 class VBoxMiniCancelButton;
     28class UIMiniCancelButton;
    2929
    3030/* Qt forward declarations */
     
    7474    QString mCancelText;
    7575    QProgressBar *mProgressBar;
    76     VBoxMiniCancelButton *mCancelBtn;
     76    UIMiniCancelButton *mCancelBtn;
    7777    bool mCancelEnabled;
    7878    const ulong mOpCount;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette