VirtualBox

Changeset 2392 in vbox for trunk


Ignore:
Timestamp:
Apr 27, 2007 11:19:45 AM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Naming/placing corrections.

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

Legend:

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

    r2357 r2392  
    3636#include <qpopupmenu.h>
    3737#include <qtooltip.h>
    38 #include <qtextedit.h>
    3938
    4039#include <qptrvector.h>
     
    134133    const QUuid machineId;
    135134    const QUuid snapshotId;
    136 };
    137 
    138 class VBoxTextView : public QTextEdit
    139 {
    140 Q_OBJECT
    141 
    142 public:
    143 
    144     VBoxTextView (QWidget*);
    145 
    146     QSize sizeHint() const;
    147     QSize minimumSizeHint() const;
    148 
    149 public slots:
    150 
    151     void setText (const QString &);
    152135};
    153136
     
    406389    /* public static stuff */
    407390
    408     static void fillPixmapBackGrd (QLabel *);
     391    static void adoptLabelPixmap (QLabel *);
    409392
    410393    static QString languageId();
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils.h

    r2185 r2392  
    2727#include <qevent.h>
    2828#include <qlistview.h>
     29#include <qtextedit.h>
    2930
    3031/**
     
    167168};
    168169
     170
     171/**
     172 *  Simple QTextEdit subclass to return its minimumSizeHint() as sizeHint()
     173 *  for getting more compact layout.
     174 */
     175class QITextEdit : public QTextEdit
     176{
     177public:
     178
     179    QITextEdit (QWidget *aParent)
     180        : QTextEdit (aParent) {}
     181
     182    QSize sizeHint() const
     183    {
     184        return minimumSizeHint();
     185    }
     186
     187    QSize minimumSizeHint() const
     188    {
     189        /// @todo (r=dmik) this looks a bit meanignless. any comment?
     190        int w = 0;
     191        int h = heightForWidth (w);
     192        return QSize (w, h);
     193    }
     194};
     195
    169196#endif // __VBoxUtils_h__
    170197
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r2357 r2392  
    472472
    473473#endif /* Q_WS_WIN */
    474 
    475 VBoxTextView::VBoxTextView (QWidget *aParent)
    476     : QTextEdit (aParent)
    477 {
    478 }
    479 
    480 QSize VBoxTextView::sizeHint() const
    481 {
    482     return minimumSizeHint();
    483 }
    484 
    485 QSize VBoxTextView::minimumSizeHint() const
    486 {
    487     int wid = 0;
    488     int hei = heightForWidth (wid);
    489     return QSize (wid, hei);
    490 }
    491 
    492 void VBoxTextView::setText (const QString &aText)
    493 {
    494     QTextEdit::setText (aText);
    495 }
    496474
    497475// VBoxGlobal
     
    18481826////////////////////////////////////////////////////////////////////////////////
    18491827
     1828/**
     1829 *  Sets the QLabel background and frame colors according tho the pixmap
     1830 *  contents. The bottom right pixel of the label pixmap defines the
     1831 *  background color of the label, the top right pixel defines the color of
     1832 *  the one-pixel frame around it. This function also sets the alignment of
     1833 *  the pixmap to AlignVTop (to correspond to the color choosing logic).
     1834 *
     1835 *  This method is useful to provide nice scaling of pixmal labels without
     1836 *  scaling pixmaps themselves. To see th eeffect, the size policy of the
     1837 *  label in the corresponding direction (vertical, for now) should be set to
     1838 *  something like MinimumExpanding.
     1839 *
     1840 *  @todo Parametrize corners to select pixels from and set the alignment
     1841 *  accordingly.
     1842 */
     1843/* static */
     1844void VBoxGlobal::adoptLabelPixmap (QLabel *aLabel)
     1845{
     1846    AssertReturnVoid (aLabel);
     1847
     1848    QPixmap *pix = aLabel->pixmap();
     1849    QImage img = pix->convertToImage();
     1850    QRgb rgbBack = img.pixel (img.width() - 1, img.height() - 1);
     1851    QRgb rgbFrame = img.pixel (img.width() - 1, 0);
     1852
     1853    aLabel->setAlignment (AlignTop);
     1854
     1855    aLabel->setPaletteBackgroundColor (QColor (rgbBack));
     1856    aLabel->setFrameShadow (QFrame::Plain);
     1857    aLabel->setFrameShape (QFrame::Box);
     1858    aLabel->setPaletteForegroundColor (QColor (rgbFrame));
     1859}
     1860
    18501861extern const char *gVBoxLangSubDir = "/nls";
    18511862extern const char *gVBoxLangFileBase = "VirtualBox_";
     
    18741885    QByteArray mData;
    18751886};
    1876 
    1877 /**
    1878  *  Fills the QLabel picture background with the color of last
    1879  *  pixel in the pixmap.
    1880  */
    1881 /* static */
    1882 void VBoxGlobal::fillPixmapBackGrd (QLabel *aLabel)
    1883 {
    1884     QPixmap *pix = aLabel->pixmap();
    1885     QImage img = pix->convertToImage();
    1886     QRgb rgbPixel = img.pixel (img.width() - 1, img.height() - 1);
    1887     int cRed = qRed (rgbPixel);
    1888     int cGreen = qGreen (rgbPixel);
    1889     int cBlue = qBlue (rgbPixel);
    1890     aLabel->setBackgroundColor (QColor (cRed, cGreen, cBlue));
    1891     aLabel->setFrameShadow (QFrame::Plain);
    1892     aLabel->setFrameShape (QFrame::Box);
    1893     aLabel->setPaletteForegroundColor (QColor (89,121,150));
    1894 }
    18951887
    18961888static VBoxTranslator *sTranslator = 0;
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui

    r2357 r2392  
    716716</includes>
    717717<forwards>
    718     <forward>class VBoxTextView</forward>
     718    <forward>class QITextEdit</forward>
    719719</forwards>
    720720<variables>
     
    724724    <variable access="private">Q_UINT64 maxVDISize;</variable>
    725725    <variable access="private">Q_UINT64 currentSize;</variable>
    726     <variable access="private">VBoxTextView *teSummary;</variable>
     726    <variable access="private">QITextEdit *teSummary;</variable>
    727727</variables>
    728728<slots>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewHDWzd.ui.h

    r2357 r2392  
    169169     * ---------------------------------------------------------------------- */
    170170
    171     /* setup the pictures background color */
    172     VBoxGlobal::fillPixmapBackGrd (pmWelcome);
    173     VBoxGlobal::fillPixmapBackGrd (pmType);
    174     VBoxGlobal::fillPixmapBackGrd (pmNameAndSize);
    175     VBoxGlobal::fillPixmapBackGrd (pmSummary);
     171    /* setup the label clolors for nice scaling */
     172    VBoxGlobal::adoptLabelPixmap (pmWelcome);
     173    VBoxGlobal::adoptLabelPixmap (pmType);
     174    VBoxGlobal::adoptLabelPixmap (pmNameAndSize);
     175    VBoxGlobal::adoptLabelPixmap (pmSummary);
    176176
    177177    /* Image type page */
     
    216216    /* Summary page */
    217217
    218     teSummary = new VBoxTextView (pageSummary);
     218    teSummary = new QITextEdit (pageSummary);
    219219    teSummary->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
    220220    teSummary->setFrameShape (QTextEdit::NoFrame);
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui

    r2357 r2392  
    10461046<forwards>
    10471047    <forward>class VBoxMediaComboBox</forward>
    1048     <forward>class VBoxTextView</forward>
     1048    <forward>class QITextEdit</forward>
    10491049</forwards>
    10501050<variables>
     
    10561056    <variable access="private">CMachine cmachine;</variable>
    10571057    <variable access="private">VBoxMediaComboBox *mediaCombo;</variable>
    1058     <variable access="private">VBoxTextView *teSummary;</variable>
     1058    <variable access="private">QITextEdit *teSummary;</variable>
    10591059</variables>
    10601060<slots>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h

    r2357 r2392  
    7171     */
    7272
    73     /* setup the pictures colors */
    74     VBoxGlobal::fillPixmapBackGrd (pmWelcome);
    75     VBoxGlobal::fillPixmapBackGrd (pmNameAndOS);
    76     VBoxGlobal::fillPixmapBackGrd (pmMemory);
    77     VBoxGlobal::fillPixmapBackGrd (pmHDD);
    78     VBoxGlobal::fillPixmapBackGrd (pmSummary);
     73    /* setup the label colors for nice scaling */
     74    VBoxGlobal::adoptLabelPixmap (pmWelcome);
     75    VBoxGlobal::adoptLabelPixmap (pmNameAndOS);
     76    VBoxGlobal::adoptLabelPixmap (pmMemory);
     77    VBoxGlobal::adoptLabelPixmap (pmHDD);
     78    VBoxGlobal::adoptLabelPixmap (pmSummary);
    7979
    8080    /* Name and OS page */
     
    122122    /* Summary page */
    123123
    124     teSummary = new VBoxTextView (pageSummary);
     124    teSummary = new QITextEdit (pageSummary);
    125125    teSummary->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Minimum);
    126126    teSummary->setFrameShape (QTextEdit::NoFrame);
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