VirtualBox

Changeset 103339 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 13, 2024 4:49:47 PM (12 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161648
Message:

FE/Qt: Medium related stuff: Moving StorageSlot from UIDefs to UIMediumDefs to avoid unwanted dependencies; This allows UIMachineDefs as well to detach from using UIDefs.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r103321 r103339  
    126126
    127127
    128 /** Storage-slot struct. */
    129 struct StorageSlot
    130 {
    131     StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
    132     StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
    133     StorageSlot(KStorageBus otherBus, LONG iPort, LONG iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
    134     StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
    135     bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
    136     bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
    137     bool operator<(const StorageSlot &other) const { return (bus <  other.bus) ||
    138                                                             (bus == other.bus && port <  other.port) ||
    139                                                             (bus == other.bus && port == other.port && device < other.device); }
    140     bool operator>(const StorageSlot &other) const { return (bus >  other.bus) ||
    141                                                             (bus == other.bus && port >  other.port) ||
    142                                                             (bus == other.bus && port == other.port && device > other.device); }
    143     bool isNull() const { return bus == KStorageBus_Null; }
    144     KStorageBus bus; LONG port; LONG device;
    145 };
    146 Q_DECLARE_METATYPE(StorageSlot);
    147 
    148 
    149 /** Storage-slot struct extension with exact controller name. */
    150 struct ExactStorageSlot : public StorageSlot
    151 {
    152     ExactStorageSlot(const QString &strController,
    153                      KStorageBus enmBus, LONG iPort, LONG iDevice)
    154         : StorageSlot(enmBus, iPort, iDevice)
    155         , controller(strController)
    156     {}
    157     QString controller;
    158 };
    159 
    160 
    161128#endif /* !FEQT_INCLUDED_SRC_globals_UIDefs_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDefs.h

    r103338 r103339  
    3333
    3434/* Qt includes: */
     35#include <QtGlobal>
    3536#include <QString>
    3637
     
    4041/* COM includes: */
    4142#include "COMEnums.h"
    42 
    43 /* Other VBox includes: */
    44 #include <VBox/com/defs.h>
    4543
    4644/* Forward declarations: */
     
    106104
    107105    /** Medium-target constructor. */
    108     UIMediumTarget(const QString &strName = QString(), LONG iPort = 0, LONG iDevice = 0,
     106    UIMediumTarget(const QString &strName = QString(), qint32 iPort = 0, qint32 iDevice = 0,
    109107                   UIMediumDeviceType aMediumType = UIMediumDeviceType_Invalid,
    110108                   UIMediumTargetType aType = UIMediumTargetType_WithID, const QString &strData = QString())
     
    117115    QString name;
    118116    /** Determines controller port. */
    119     LONG port;
     117    qint32 port;
    120118    /** Determines controller device. */
    121     LONG device;
     119    qint32 device;
    122120
    123121    /** Determines medium-target medium-type. */
     
    130128};
    131129
     130/** Storage-slot struct. */
     131struct StorageSlot
     132{
     133    StorageSlot() : bus(KStorageBus_Null), port(0), device(0) {}
     134    StorageSlot(const StorageSlot &other) : bus(other.bus), port(other.port), device(other.device) {}
     135    StorageSlot(KStorageBus otherBus, qint32 iPort, qint32 iDevice) : bus(otherBus), port(iPort), device(iDevice) {}
     136    StorageSlot& operator=(const StorageSlot &other) { bus = other.bus; port = other.port; device = other.device; return *this; }
     137    bool operator==(const StorageSlot &other) const { return bus == other.bus && port == other.port && device == other.device; }
     138    bool operator!=(const StorageSlot &other) const { return bus != other.bus || port != other.port || device != other.device; }
     139    bool operator<(const StorageSlot &other) const { return (bus <  other.bus) ||
     140                                                            (bus == other.bus && port <  other.port) ||
     141                                                            (bus == other.bus && port == other.port && device < other.device); }
     142    bool operator>(const StorageSlot &other) const { return (bus >  other.bus) ||
     143                                                            (bus == other.bus && port >  other.port) ||
     144                                                            (bus == other.bus && port == other.port && device > other.device); }
     145    bool isNull() const { return bus == KStorageBus_Null; }
     146    KStorageBus bus; qint32 port; qint32 device;
     147};
     148
     149/** Storage-slot struct extension with exact controller name. */
     150struct ExactStorageSlot : public StorageSlot
     151{
     152    ExactStorageSlot(const QString &strController,
     153                     KStorageBus enmBus, qint32 iPort, qint32 iDevice)
     154        : StorageSlot(enmBus, iPort, iDevice)
     155        , controller(strController)
     156    {}
     157    QString controller;
     158};
     159
    132160/* Let QMetaType know about our types: */
    133161Q_DECLARE_METATYPE(UIMediumDeviceType);
    134162Q_DECLARE_METATYPE(UIMediumTarget);
     163Q_DECLARE_METATYPE(StorageSlot);
    135164
    136165#endif /* !FEQT_INCLUDED_SRC_medium_UIMediumDefs_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h

    r99098 r103339  
    3838
    3939/* GUI includes: */
    40 #include "UIDefs.h"
     40#include "UIMediumDefs.h" // for StorageSlot
    4141
    4242/* Other VBox includes: */
    43 #include <iprt/cdefs.h>
     43#include <iprt/cdefs.h> // for RT_BIT stuff
    4444
    4545/** Machine window visual element types. */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIStorageSettingsEditor.h

    r103338 r103339  
    105105    KDeviceType  m_enmDeviceType;
    106106    /** Holds the port. */
    107     LONG         m_iPort;
     107    qint32       m_iPort;
    108108    /** Holds the device. */
    109     LONG         m_iDevice;
     109    qint32       m_iDevice;
    110110    /** Holds the medium ID. */
    111111    QUuid        m_uMediumId;
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