VirtualBox

Ignore:
Timestamp:
Jul 17, 2017 11:10:18 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116995
Message:

FE/Qt: bugref:8400: Virtual Media Manager: Details widget: A bit of reordering.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/medium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp

    r67985 r67986  
    5555    , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0)
    5656    , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0)
     57    , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0)
    5758    , m_pLabelSize(0), m_pEditorSize(0), m_pErrorPaneSize(0)
    58     , m_pLabelDescription(0), m_pEditorDescription(0), m_pErrorPaneDescription(0)
    5959    , m_pButtonBox(0)
    6060    , m_pLayoutDetails(0)
     
    9494    m_pLabelType->setText(tr("&Type:"));
    9595    m_pLabelLocation->setText(tr("&Location:"));
     96    m_pLabelDescription->setText(tr("&Description:"));
    9697    m_pLabelSize->setText(tr("&Size:"));
    97     m_pLabelDescription->setText(tr("&Description:"));
    9898
    9999    /* Translate fields: */
     
    102102        m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>()));
    103103    m_pSelectorLocation->setToolTip(tr("Holds the location of this medium."));
     104    m_pEditorDescription->setToolTip(tr("Holds the description of this medium."));
    104105    m_pEditorSize->setToolTip(tr("Holds the size of this medium."));
    105     m_pEditorDescription->setToolTip(tr("Holds the description of this medium."));
    106106
    107107    /* Translate button-box: */
     
    140140}
    141141
     142void UIMediumDetailsWidget::sltDescriptionTextChanged()
     143{
     144    m_newData.m_options.m_strDescription = m_pEditorDescription->toPlainText();
     145    revalidate(m_pErrorPaneDescription);
     146    updateButtonStates();
     147}
     148
    142149void UIMediumDetailsWidget::sltSizeValueChanged(qulonglong uSize)
    143150{
    144151    m_newData.m_options.m_uLogicalSize = uSize;
    145152    revalidate(m_pErrorPaneSize);
    146     updateButtonStates();
    147 }
    148 
    149 void UIMediumDetailsWidget::sltDescriptionTextChanged()
    150 {
    151     m_newData.m_options.m_strDescription = m_pEditorDescription->toPlainText();
    152     revalidate(m_pErrorPaneDescription);
    153153    updateButtonStates();
    154154}
     
    334334            }
    335335
    336             /* Create size label: */
    337             m_pLabelSize = new QLabel;
    338             AssertPtrReturnVoid(m_pLabelSize);
    339             {
    340                 /* Configure label: */
    341                 m_pLabelSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    342 
    343                 /* Add into layout: */
    344                 pLayoutOptions->addWidget(m_pLabelSize, 2, 0);
    345             }
    346 
    347             /* Create size layout: */
    348             QGridLayout *pLayoutSize = new QGridLayout;
    349             AssertPtrReturnVoid(pLayoutSize);
    350             {
    351                 /* Configure layout: */
    352                 pLayoutSize->setContentsMargins(0, 0, 0, 0);
    353 
    354                 /* Create size editor: */
    355                 m_pEditorSize = new UIMediumSizeEditor;
    356                 AssertPtrReturnVoid(m_pEditorSize);
    357                 {
    358                     /* Configure editor: */
    359                     m_pLabelSize->setBuddy(m_pEditorSize);
    360                     m_pEditorSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    361                     connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged,
    362                             this, &UIMediumDetailsWidget::sltSizeValueChanged);
    363 
    364                     /* Add into layout: */
    365                     pLayoutSize->addWidget(m_pEditorSize, 0, 0, 2, 1);
    366                 }
    367 
    368                 /* Create size error pane: */
    369                 m_pErrorPaneSize = new QLabel;
    370                 AssertPtrReturnVoid(m_pErrorPaneSize);
    371                 {
    372                     /* Configure label: */
    373                     m_pErrorPaneSize->setAlignment(Qt::AlignCenter);
    374                     m_pErrorPaneSize->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    375                     m_pErrorPaneSize->setPixmap(UIIconPool::iconSet(":/status_error_16px.png")
    376                                                 .pixmap(QSize(iIconMetric, iIconMetric)));
    377 
    378                     /* Add into layout: */
    379                     pLayoutSize->addWidget(m_pErrorPaneSize, 0, 1, Qt::AlignCenter);
    380                 }
    381 
    382                 /* Add into layout: */
    383                 pLayoutOptions->addLayout(pLayoutSize, 2, 1, 2, 1);
    384             }
    385 
    386336            /* Create description label: */
    387337            m_pLabelDescription = new QLabel;
     
    392342
    393343                /* Add into layout: */
    394                 pLayoutOptions->addWidget(m_pLabelDescription, 4, 0);
     344                pLayoutOptions->addWidget(m_pLabelDescription, 2, 0);
    395345            }
    396346
     
    436386
    437387                /* Add into layout: */
    438                 pLayoutOptions->addLayout(pLayoutDescription, 4, 1, 2, 1);
     388                pLayoutOptions->addLayout(pLayoutDescription, 2, 1, 2, 1);
     389            }
     390
     391            /* Create size label: */
     392            m_pLabelSize = new QLabel;
     393            AssertPtrReturnVoid(m_pLabelSize);
     394            {
     395                /* Configure label: */
     396                m_pLabelSize->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     397
     398                /* Add into layout: */
     399                pLayoutOptions->addWidget(m_pLabelSize, 4, 0);
     400            }
     401
     402            /* Create size layout: */
     403            QGridLayout *pLayoutSize = new QGridLayout;
     404            AssertPtrReturnVoid(pLayoutSize);
     405            {
     406                /* Configure layout: */
     407                pLayoutSize->setContentsMargins(0, 0, 0, 0);
     408
     409                /* Create size editor: */
     410                m_pEditorSize = new UIMediumSizeEditor;
     411                AssertPtrReturnVoid(m_pEditorSize);
     412                {
     413                    /* Configure editor: */
     414                    m_pLabelSize->setBuddy(m_pEditorSize);
     415                    m_pEditorSize->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     416                    connect(m_pEditorSize, &UIMediumSizeEditor::sigSizeChanged,
     417                            this, &UIMediumDetailsWidget::sltSizeValueChanged);
     418
     419                    /* Add into layout: */
     420                    pLayoutSize->addWidget(m_pEditorSize, 0, 0, 2, 1);
     421                }
     422
     423                /* Create size error pane: */
     424                m_pErrorPaneSize = new QLabel;
     425                AssertPtrReturnVoid(m_pErrorPaneSize);
     426                {
     427                    /* Configure label: */
     428                    m_pErrorPaneSize->setAlignment(Qt::AlignCenter);
     429                    m_pErrorPaneSize->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     430                    m_pErrorPaneSize->setPixmap(UIIconPool::iconSet(":/status_error_16px.png")
     431                                                .pixmap(QSize(iIconMetric, iIconMetric)));
     432
     433                    /* Add into layout: */
     434                    pLayoutSize->addWidget(m_pErrorPaneSize, 0, 1, Qt::AlignCenter);
     435                }
     436
     437                /* Add into layout: */
     438                pLayoutOptions->addLayout(pLayoutSize, 4, 1, 2, 1);
    439439            }
    440440
     
    590590    sltLocationPathChanged(m_pSelectorLocation->path());
    591591
     592    /* Load description: */
     593    m_pLabelDescription->setEnabled(m_newData.m_fValid);
     594    m_pEditorDescription->setEnabled(m_newData.m_fValid);
     595    m_pEditorDescription->setPlainText(m_newData.m_options.m_strDescription);
     596
    592597    /* Load size: */
    593598    const bool fEnableResize =    m_newData.m_fValid
     
    598603    m_pEditorSize->setMediumSize(m_newData.m_options.m_uLogicalSize);
    599604    sltSizeValueChanged(m_pEditorSize->mediumSize());
    600 
    601     /* Load description: */
    602     m_pLabelDescription->setEnabled(m_newData.m_fValid);
    603     m_pEditorDescription->setEnabled(m_newData.m_fValid);
    604     m_pEditorDescription->setPlainText(m_newData.m_options.m_strDescription);
    605605}
    606606
     
    637637        m_pErrorPaneLocation->setVisible(fError);
    638638    }
     639    if (!pWidget || pWidget == m_pErrorPaneDescription)
     640    {
     641        /* Always valid for now: */
     642        const bool fError = false;
     643        m_pErrorPaneDescription->setVisible(fError);
     644    }
    639645    if (!pWidget || pWidget == m_pErrorPaneSize)
    640646    {
     
    642648        const bool fError = false;
    643649        m_pErrorPaneSize->setVisible(fError);
    644     }
    645     if (!pWidget || pWidget == m_pErrorPaneDescription)
    646     {
    647         /* Always valid for now: */
    648         const bool fError = false;
    649         m_pErrorPaneDescription->setVisible(fError);
    650650    }
    651651
     
    663663//        m_pErrorPaneLocation->setToolTip(tr("Cannot change medium location from <b>%1</b> to <b>%2</b>.")
    664664//                                         .arg(m_oldData.m_options.m_strLocation).arg(m_newData.m_options.m_strLocation));
     665//    if (!pWidget || pWidget == m_pErrorPaneDescription)
     666//        m_pErrorPaneDescription->setToolTip(tr("Cannot change medium description from <b>%1</b> to <b>%2</b>.")
     667//                                               .arg(m_oldData.m_options.m_strDescription).arg(m_newData.m_options.m_strDescription));
    665668//    if (!pWidget || pWidget == m_pErrorPaneSize)
    666669//        m_pErrorPaneSize->setToolTip(tr("Cannot change medium size from <b>%1</b> to <b>%2</b>.")
    667670//                                         .arg(m_oldData.m_options.m_uLogicalSize).arg(m_newData.m_options.m_uLogicalSize));
    668 //    if (!pWidget || pWidget == m_pErrorPaneDescription)
    669 //        m_pErrorPaneDescription->setToolTip(tr("Cannot change medium description from <b>%1</b> to <b>%2</b>.")
    670 //                                               .arg(m_oldData.m_options.m_strDescription).arg(m_newData.m_options.m_strDescription));
    671671}
    672672
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h

    r67969 r67986  
    5050        : m_enmType(KMediumType_Normal)
    5151        , m_strLocation(QString())
     52        , m_strDescription(QString())
    5253        , m_uLogicalSize(0)
    53         , m_strDescription(QString())
    5454    {}
    5555
     
    6060               && (m_enmType == other.m_enmType)
    6161               && (m_strLocation == other.m_strLocation)
     62               && (m_strDescription == other.m_strDescription)
    6263               && (m_uLogicalSize == other.m_uLogicalSize)
    63                && (m_strDescription == other.m_strDescription)
    6464               ;
    6565    }
     
    7474    /** Holds the location. */
    7575    QString m_strLocation;
     76    /** Holds the description. */
     77    QString m_strDescription;
    7678    /** Holds the logical size. */
    7779    qulonglong m_uLogicalSize;
    78     /** Holds the description. */
    79     QString m_strDescription;
    8080};
    8181
     
    205205        /** Handles location change. */
    206206        void sltLocationPathChanged(const QString &strPath);
     207        /** Handles description text change. */
     208        void sltDescriptionTextChanged();
    207209        /** Handles size editor change. */
    208210        void sltSizeValueChanged(qulonglong uSize);
    209         /** Handles description text change. */
    210         void sltDescriptionTextChanged();
    211211
    212212        /** Handles button-box button click. */
     
    290290        QLabel             *m_pErrorPaneLocation;
    291291
     292        /** Holds the description label. */
     293        QLabel    *m_pLabelDescription;
     294        /** Holds the description editor. */
     295        QTextEdit *m_pEditorDescription;
     296        /** Holds the description error pane. */
     297        QLabel    *m_pErrorPaneDescription;
     298
    292299        /** Holds the size label. */
    293300        QLabel             *m_pLabelSize;
     
    297304        QLabel             *m_pErrorPaneSize;
    298305
    299         /** Holds the description label. */
    300         QLabel    *m_pLabelDescription;
    301         /** Holds the description editor. */
    302         QTextEdit *m_pEditorDescription;
    303         /** Holds the description error pane. */
    304         QLabel    *m_pErrorPaneDescription;
    305 
    306306        /** Holds the button-box instance. */
    307307        QIDialogButtonBox *m_pButtonBox;
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