VirtualBox

Ignore:
Timestamp:
Dec 1, 2009 6:36:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55525
Message:

FE/Qt4: Divide few settings-related classes declared in VBoxSettingsUtils.h into separate files.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxBootTable.h

    r25125 r25136  
    22 *
    33 * VBox frontends: Qt4 GUI ("VirtualBox"):
    4  * VBoxSettingsUtils class declaration
     4 * VBoxBootTable class declaration
    55 */
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121 */
    2222
    23 #ifndef __VBoxSettingsUtils_h__
    24 #define __VBoxSettingsUtils_h__
     23#ifndef __VBoxBootTable_h__
     24#define __VBoxBootTable_h__
    2525
    26 #include <VBoxGlobal.h>
    27 
    28 /* Qt includes */
    29 #ifdef Q_WS_WIN
    30 #include <QDialog>
    31 #include <QLineEdit>
    32 #include <QPushButton>
    33 #endif
    34 #include <QHBoxLayout>
    35 #include <QLabel>
     26/* Global includes */
    3627#include <QTreeWidget>
    37 #include <QHeaderView>
    38 #include <QKeyEvent>
    39 #include <QTableView>
    40 
    41 enum
    42 {
    43     /* mTwUSBFilters column numbers */
    44     twUSBFilters_Name = 0,
    45 };
    4628
    4729/**
     
    5234 *  Emits itemToggled() signal when the item changed.
    5335 */
    54 class BootItemsTable : public QTreeWidget
     36class VBoxBootTable : public QTreeWidget
    5537{
    5638    Q_OBJECT;
     
    5840public:
    5941
    60     BootItemsTable (QWidget *aParent) : QTreeWidget (aParent)
    61     {
    62         header()->hide();
    63         connect (this, SIGNAL (itemChanged (QTreeWidgetItem *, int)),
    64                  this, SLOT (onItemChanged()));
    65     }
    66 
    67    ~BootItemsTable() {}
     42    VBoxBootTable(QWidget *pParent);
    6843
    6944signals:
     
    7348    void itemToggled();
    7449
     50protected:
     51
     52    void keyPressEvent(QKeyEvent *pEvent);
     53
    7554private slots:
    7655
    77     void onItemChanged()
    78     {
    79         emit itemToggled();
    80     }
    81 
    82     void keyPressEvent (QKeyEvent *aEvent)
    83     {
    84         if (aEvent->QInputEvent::modifiers () == Qt::ControlModifier)
    85         {
    86             switch (aEvent->key())
    87             {
    88                 case Qt::Key_Up:
    89                     emit moveItemUp();
    90                     return;
    91                 case Qt::Key_Down:
    92                     emit moveItemDown();
    93                     return;
    94                 default:
    95                     break;
    96             }
    97         }
    98         QTreeWidget::keyPressEvent (aEvent);
    99     }
     56    void onItemChanged();
    10057};
    10158
    102 class USBListItem : public QTreeWidgetItem
    103 {
    104 public:
     59#endif // __VBoxBootTable_h__
    10560
    106     enum { USBListItemType = 1002 };
    107 
    108     USBListItem (QTreeWidget *aParent)
    109         : QTreeWidgetItem (aParent, QStringList (QString::null), USBListItemType)
    110         , mId (-1) {}
    111 
    112     USBListItem (QTreeWidget *aParent, QTreeWidgetItem *aPreceding)
    113         : QTreeWidgetItem (aParent, aPreceding, USBListItemType)
    114         , mId (-1) {}
    115 
    116     int mId;
    117 };
    118 
    119 /**
    120  *  Table-View class reimplementation to extend standard QTableView.
    121  */
    122 class QITableView : public QTableView
    123 {
    124     Q_OBJECT;
    125 
    126 public:
    127 
    128     QITableView (QWidget *aParent) : QTableView (aParent) {}
    129 
    130 signals:
    131 
    132     void currentChanged (const QModelIndex &aCurrent);
    133 
    134 protected:
    135 
    136     void currentChanged (const QModelIndex &aCurrent,
    137                          const QModelIndex &aPrevious)
    138     {
    139         QTableView::currentChanged (aCurrent, aPrevious);
    140         emit currentChanged (aCurrent);
    141     }
    142 
    143     void focusInEvent (QFocusEvent *aEvent)
    144     {
    145         /* Restore edit-mode on focus in. */
    146         QTableView::focusInEvent (aEvent);
    147         if (model()->flags (currentIndex()) & Qt::ItemIsEditable)
    148             edit (currentIndex());
    149     }
    150 };
    151 
    152 class VBoxWarnIconLabel: public QWidget
    153 {
    154     Q_OBJECT;
    155 
    156 public:
    157 
    158     VBoxWarnIconLabel (QWidget *aParent = NULL)
    159         : QWidget (aParent)
    160     {
    161         QHBoxLayout *layout = new QHBoxLayout (this);
    162         VBoxGlobal::setLayoutMargin (layout, 0);
    163         layout->addWidget (&mIcon);
    164         layout->addWidget (&mLabel);
    165         setVisible (false);
    166     }
    167 
    168     void setWarningPixmap (const QPixmap& aPixmap) { mIcon.setPixmap (aPixmap); }
    169     void setWarningText (const QString& aText) { mLabel.setText (aText); }
    170 
    171 private:
    172 
    173     QLabel mIcon;
    174     QLabel mLabel;
    175 };
    176 
    177 #endif // __VBoxSettingsUtils_h__
    178 
Note: See TracChangeset for help on using the changeset viewer.

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