VirtualBox

Changeset 2023 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 11, 2007 7:32:00 AM (18 years ago)
Author:
vboxsync
Message:

1908: UI for language selection:
Virtual Disk Manager updated according new Language Change Feature.

Non-modal VDM is now capable for run-time update with new language settings. Language change will be applied into VDM just after the Global Settings Dialog with new language selected will be closed.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui

    r1790 r2023  
    525525    <forward>class VBoxToolBar</forward>
    526526    <forward>class QSizeGrip</forward>
    527     <forward>class QIRichLabel</forward>
     527    <forward>class InfoPaneLabel</forward>
    528528    <forward>class QProgressBar</forward>
    529529</forwards>
     
    551551    <variable access="private">QAction *imReleaseAction;</variable>
    552552    <variable access="private">QAction *imRefreshAction;</variable>
    553     <variable access="private">QIRichLabel *hdsPane1;</variable>
    554     <variable access="private">QIRichLabel *hdsPane2;</variable>
    555     <variable access="private">QIRichLabel *hdsPane3;</variable>
    556     <variable access="private">QIRichLabel *hdsPane4;</variable>
    557     <variable access="private">QIRichLabel *hdsPane5;</variable>
    558     <variable access="private">QIRichLabel *hdsPane6;</variable>
    559     <variable access="private">QIRichLabel *hdsPane7;</variable>
    560     <variable access="private">QIRichLabel *cdsPane1;</variable>
    561     <variable access="private">QIRichLabel *cdsPane2;</variable>
    562     <variable access="private">QIRichLabel *fdsPane1;</variable>
    563     <variable access="private">QIRichLabel *fdsPane2;</variable>
     553    <variable access="private">InfoPaneLabel *hdsPane1;</variable>
     554    <variable access="private">InfoPaneLabel *hdsPane2;</variable>
     555    <variable access="private">InfoPaneLabel *hdsPane3;</variable>
     556    <variable access="private">InfoPaneLabel *hdsPane4;</variable>
     557    <variable access="private">InfoPaneLabel *hdsPane5;</variable>
     558    <variable access="private">InfoPaneLabel *hdsPane6;</variable>
     559    <variable access="private">InfoPaneLabel *hdsPane7;</variable>
     560    <variable access="private">InfoPaneLabel *cdsPane1;</variable>
     561    <variable access="private">InfoPaneLabel *cdsPane2;</variable>
     562    <variable access="private">InfoPaneLabel *fdsPane1;</variable>
     563    <variable access="private">InfoPaneLabel *fdsPane2;</variable>
    564564    <variable>QSizeGrip *sizeGrip;</variable>
    565565    <variable>QPushButton *defaultButton;</variable>
     
    620620    <function access="private" returnType="DiskImageItem*">createCdItem( QListView*, const VBoxMedia &amp; )</function>
    621621    <function access="private" returnType="DiskImageItem*">createFdItem( QListView*, const VBoxMedia &amp; )</function>
     622    <function access="protected" returnType="bool">event( QEvent* )</function>
    622623    <function access="protected">showEvent( QShowEvent * )</function>
    623624    <function access="protected">resizeEvent( QResizeEvent* )</function>
    624625    <function access="protected">keyPressEvent( QKeyEvent* )</function>
    625626    <function access="protected">closeEvent( QCloseEvent* )</function>
    626     <function access="protected" returnType="QIRichLabel*">createInfoString( const QString &amp;, QWidget*, int, int )</function>
     627    <function access="protected">createInfoString( InfoPaneLabel *&amp;, QWidget*, int, int )</function>
    627628    <function access="protected" returnType="QPushButton*">searchDefaultButton()</function>
    628629    <function access="protected">setCurrentItem( QListView*, QListViewItem* )</function>
     
    634635    <function access="protected">prepareToRefresh( int aTotal = 0 )</function>
    635636    <function access="protected">makeWarningMark( DiskImageItem*, VBoxMedia::Status, VBoxDefs::DiskType )</function>
     637    <function access="pritave">languageChangeImp()</function>
    636638</functions>
    637639<layoutdefaults spacing="10" margin="10"/>
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxDiskImageManagerDlg.ui.h

    r1804 r2023  
    173173
    174174
     175class InfoPaneLabel : public QIRichLabel
     176{
     177public:
     178
     179    InfoPaneLabel (QWidget *aParent, QLabel *aLabel = 0)
     180        : QIRichLabel (aParent, "infoLabel"), mLabel (aLabel) {}
     181
     182    QLabel* label() { return mLabel; }
     183
     184private:
     185
     186    QLabel *mLabel;
     187};
     188
     189
    175190VBoxDiskImageManagerDlg *VBoxDiskImageManagerDlg::mModelessDialog = 0;
    176191
     
    295310    connect (imRefreshAction, SIGNAL (activated()),
    296311             this, SLOT (refreshAll()));
    297 
    298     imNewAction->setMenuText (tr ("&New..."));
    299     imAddAction->setMenuText (tr ("&Add..."));
    300     // imEditAction->setMenuText (tr ("&Edit..."));
    301     imRemoveAction->setMenuText (tr ("R&emove"));
    302     imReleaseAction->setMenuText (tr ("Re&lease"));
    303     imRefreshAction->setMenuText (tr ("Re&fresh"));
    304 
    305     imNewAction->setText (tr ("New"));
    306     imAddAction->setText (tr ("Add"));
    307     // imEditAction->setText (tr ("Edit"));
    308     imRemoveAction->setText (tr ("Remove"));
    309     imReleaseAction->setText (tr ("Release"));
    310     imRefreshAction->setText (tr ("Refresh"));
    311 
    312     imNewAction->setAccel (tr ("Ctrl+N"));
    313     imAddAction->setAccel (tr ("Ctrl+A"));
    314     // imEditAction->setAccel (tr ("Ctrl+E"));
    315     imRemoveAction->setAccel (tr ("Ctrl+D"));
    316     imReleaseAction->setAccel (tr ("Ctrl+L"));
    317     imRefreshAction->setAccel (tr ("Ctrl+R"));
    318 
    319     imNewAction->setStatusTip (tr ("Create new VDI file and attach it to media list"));
    320     imAddAction->setStatusTip (tr ("Add existing media image file to media list"));
    321     // imEditAction->setStatusTip (tr ("Edit properties of selected media image file"));
    322     imRemoveAction->setStatusTip (tr ("Remove selected media image file from media list"));
    323     imReleaseAction->setStatusTip (tr ("Release selected media image file from being using in some VM"));
    324     imRefreshAction->setStatusTip (tr ("Refresh media image list"));
    325312
    326313    imNewAction->setIconSet (VBoxGlobal::iconSetEx (
     
    374361    actionMenu->insertSeparator();
    375362    imRefreshAction->addTo (actionMenu);
    376     menuBar()->insertItem (QString (tr ("&Actions")), actionMenu, 1);
     363    menuBar()->insertItem (QString::null, actionMenu, 1);
    377364
    378365
     
    393380    fdsContainerLayout->setMargin (10);
    394381    /* create info-pane for hd list-view */
    395     hdsPane1 = createInfoString (tr ("Location"), hdsContainer, 0, -1);
    396     hdsPane2 = createInfoString (tr ("Disk Type"), hdsContainer, 1, 0);
    397     hdsPane3 = createInfoString (tr ("Storage Type"), hdsContainer, 1, 1);
    398     hdsPane4 = createInfoString (tr ("Attached to"), hdsContainer, 2, 0);
    399     hdsPane5 = createInfoString (tr ("Snapshot"), hdsContainer, 2, 1);
     382    createInfoString (hdsPane1, hdsContainer, 0, -1);
     383    createInfoString (hdsPane2, hdsContainer, 1, 0);
     384    createInfoString (hdsPane3, hdsContainer, 1, 1);
     385    createInfoString (hdsPane4, hdsContainer, 2, 0);
     386    createInfoString (hdsPane5, hdsContainer, 2, 1);
    400387    /* create info-pane for cd list-view */
    401     cdsPane1 = createInfoString (tr ("Location"), cdsContainer, 0, -1);
    402     cdsPane2 = createInfoString (tr ("Attached to"), cdsContainer, 1, -1);
     388    createInfoString (cdsPane1, cdsContainer, 0, -1);
     389    createInfoString (cdsPane2, cdsContainer, 1, -1);
    403390    /* create info-pane for fd list-view */
    404     fdsPane1 = createInfoString (tr ("Location"), fdsContainer, 0, -1);
    405     fdsPane2 = createInfoString (tr ("Attached to"), fdsContainer, 1, -1);
     391    createInfoString (fdsPane1, fdsContainer, 0, -1);
     392    createInfoString (fdsPane2, fdsContainer, 1, -1);
    406393
    407394
    408395    /* enumeration progressbar creation */
    409     mProgressText = new QLabel (tr ("Checking accessibility"), centralWidget());
     396    mProgressText = new QLabel (centralWidget());
    410397    mProgressText->setHidden (true);
    411398    buttonLayout->insertWidget (2, mProgressText);
     
    417404    mProgressBar->setMaximumWidth (100);
    418405    buttonLayout->insertWidget (3, mProgressBar);
    419 }
    420 
    421 
    422 QIRichLabel *VBoxDiskImageManagerDlg::createInfoString (const QString &name, QWidget *root, int row, int column)
    423 {
    424     QLabel *nameLabel = new QLabel (name, root, "nameLabel");
    425     QIRichLabel *infoLabel = new QIRichLabel (root, "infoPane");
     406
     407
     408    /* applying language settings */
     409    languageChangeImp();
     410}
     411
     412
     413void VBoxDiskImageManagerDlg::languageChangeImp()
     414{
     415    imNewAction->setMenuText (tr ("&New..."));
     416    imAddAction->setMenuText (tr ("&Add..."));
     417    // imEditAction->setMenuText (tr ("&Edit..."));
     418    imRemoveAction->setMenuText (tr ("R&emove"));
     419    imReleaseAction->setMenuText (tr ("Re&lease"));
     420    imRefreshAction->setMenuText (tr ("Re&fresh"));
     421
     422    imNewAction->setText (tr ("New"));
     423    imAddAction->setText (tr ("Add"));
     424    // imEditAction->setText (tr ("Edit"));
     425    imRemoveAction->setText (tr ("Remove"));
     426    imReleaseAction->setText (tr ("Release"));
     427    imRefreshAction->setText (tr ("Refresh"));
     428
     429    imNewAction->setAccel (tr ("Ctrl+N"));
     430    imAddAction->setAccel (tr ("Ctrl+A"));
     431    // imEditAction->setAccel (tr ("Ctrl+E"));
     432    imRemoveAction->setAccel (tr ("Ctrl+D"));
     433    imReleaseAction->setAccel (tr ("Ctrl+L"));
     434    imRefreshAction->setAccel (tr ("Ctrl+R"));
     435
     436    imNewAction->setStatusTip (tr ("Create new VDI file and attach it to media list"));
     437    imAddAction->setStatusTip (tr ("Add existing media image file to media list"));
     438    // imEditAction->setStatusTip (tr ("Edit properties of selected media image file"));
     439    imRemoveAction->setStatusTip (tr ("Remove selected media image file from media list"));
     440    imReleaseAction->setStatusTip (tr ("Release selected media image file from being using in some VM"));
     441    imRefreshAction->setStatusTip (tr ("Refresh media image list"));
     442
     443    if (menuBar()->findItem(1))
     444        menuBar()->findItem(1)->setText (tr ("&Actions"));
     445
     446    hdsPane1->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Location")));
     447    hdsPane2->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Disk Type")));
     448    hdsPane3->label()->setText (QString ("<nobr>&nbsp;&nbsp;%1:</nobr>").arg (tr ("Storage Type")));
     449    hdsPane4->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Attached to")));
     450    hdsPane5->label()->setText (QString ("<nobr>&nbsp;&nbsp;%1:</nobr>").arg (tr ("Snapshot")));
     451    cdsPane1->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Location")));
     452    cdsPane2->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Attached to")));
     453    fdsPane1->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Location")));
     454    fdsPane2->label()->setText (QString ("<nobr>%1:</nobr>").arg (tr ("Attached to")));
     455
     456    mProgressText->setText (tr ("Checking accessibility"));
     457
     458    if (hdsView->childCount() || cdsView->childCount() || fdsView->childCount())
     459        refreshAll();
     460}
     461
     462
     463void VBoxDiskImageManagerDlg::createInfoString (InfoPaneLabel *&aInfo,
     464                                                QWidget *aRoot,
     465                                                int aRow, int aColumn)
     466{
     467    QLabel *nameLabel = new QLabel (aRoot);
     468    aInfo = new InfoPaneLabel (aRoot, nameLabel);
    426469
    427470    /* Setup focus policy <strong> default for info pane */
    428     infoLabel->setFocusPolicy (QWidget::StrongFocus);
     471    aInfo->setFocusPolicy (QWidget::StrongFocus);
    429472
    430473    /* prevent the name columns from being expanded */
    431474    nameLabel->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
    432475
    433     if (column == -1)
    434     {
    435         /* add qt-html tags to prevent wrapping and to have the same initial
    436          * height of nameLabel and infoLabel (plain text gets a height smaller
    437          * than rich text */
    438         nameLabel->setText (QString ("<nobr>%1:</nobr>").arg (name));
    439 
    440         ((QGridLayout *) root->layout())->addWidget (nameLabel, row, 0);
    441         ((QGridLayout *) root->layout())->
    442             addMultiCellWidget (infoLabel, row, row,
    443                                 1, ((QGridLayout *) root->layout())->numCols() - 1);
     476    if (aColumn == -1)
     477    {
     478        ((QGridLayout *) aRoot->layout())->addWidget (nameLabel, aRow, 0);
     479        ((QGridLayout *) aRoot->layout())->
     480            addMultiCellWidget (aInfo, aRow, aRow,
     481                                1, ((QGridLayout *) aRoot->layout())->numCols() - 1);
    444482    }
    445483    else
    446484    {
    447         /* add some spacing to the left of the name field for all columns but
    448          * the first one, to separate it from the value field (note that adding
    449          * spacing to the right is not necessary since Qt does it anyway for
    450          * rich text for whatever stupid reason). */
    451         if (column == 0)
    452             nameLabel->setText (QString ("<nobr>%1:</nobr>").arg (name));
    453         else
    454             nameLabel->setText (QString ("<nobr>&nbsp;&nbsp;%1:</nobr>").arg (name));
    455 
    456         ((QGridLayout *) root->layout())->addWidget (nameLabel, row, column * 2);
    457         ((QGridLayout *) root->layout())->addWidget (infoLabel, row, column * 2 + 1);
    458     }
    459 
    460     return infoLabel;
     485        ((QGridLayout *) aRoot->layout())->addWidget (nameLabel, aRow, aColumn * 2);
     486        ((QGridLayout *) aRoot->layout())->addWidget (aInfo, aRow, aColumn * 2 + 1);
     487    }
    461488}
    462489
     
    677704    }
    678705    return QMainWindow::eventFilter (aObject, aEvent);
     706}
     707
     708
     709bool VBoxDiskImageManagerDlg::event (QEvent *aEvent)
     710{
     711    bool result = QMainWindow::event (aEvent);
     712    switch (aEvent->type())
     713    {
     714        case QEvent::LanguageChange:
     715        {
     716            languageChangeImp();
     717            break;
     718        }
     719        default:
     720            break;
     721    }
     722    return result;
    679723}
    680724
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