VirtualBox

Changeset 72775 in vbox


Ignore:
Timestamp:
Jun 29, 2018 2:50:07 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9072: A bit of layout and nls fixes for log-viewer panes to make them look more suitable on various platforms.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp

    r72719 r72775  
    2222/* Qt includes: */
    2323# include <QComboBox>
    24 # include <QFrame>
    2524# include <QHBoxLayout>
    2625# include <QLabel>
     
    4847    , m_pNextButton(0)
    4948    , m_pPreviousButton(0)
    50     , m_pNextPreviousButtonContainer(0)
    5149{
    5250    prepare();
     
    9088    m_pNextButton->setEnabled(flag);
    9189    m_pPreviousButton->setEnabled(flag);
    92     m_pNextPreviousButtonContainer->setEnabled(flag);
    9390}
    9491
     
    103100        return;
    104101    }
    105     /* index+1 since we always have a 0th item in our combo box. */
     102    /* index+1 since we always have a 0th item in our combo-box. */
    106103    m_pBookmarksComboBox->setCurrentIndex(index+1);
    107104}
     
    112109        return;
    113110
    114     m_pBookmarksComboBox = new QComboBox;
    115     QFontMetrics fontMetrics = m_pBookmarksComboBox->fontMetrics();
    116     if (m_pBookmarksComboBox)
     111    /* Create bookmark combo/button layout: */
     112    QHBoxLayout *pComboButtonLayout = new QHBoxLayout;
     113    if (pComboButtonLayout)
    117114    {
    118         m_pBookmarksComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
    119         m_pBookmarksComboBox->setMaximumWidth(fontMetrics.width('a') * (m_iMaxBookmarkTextLength + 2));
    120         /* Make sure we have 0th item in our combo box. */
    121         m_pBookmarksComboBox->insertItem(0, "");
    122         mainLayout()->addWidget(m_pBookmarksComboBox, 2);
     115        pComboButtonLayout->setContentsMargins(0, 0, 0, 0);
     116#ifdef VBOX_WS_MAC
     117        pComboButtonLayout->setSpacing(5);
     118#else
     119        pComboButtonLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     120#endif
     121
     122        /* Create bookmark combo-box: */
     123        m_pBookmarksComboBox = new QComboBox;
     124        if (m_pBookmarksComboBox)
     125        {
     126            m_pBookmarksComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
     127            /* Make sure we have 0th item in our combo-box. */
     128            m_pBookmarksComboBox->insertItem(0, "");
     129            pComboButtonLayout->addWidget(m_pBookmarksComboBox);
     130        }
     131
     132        /* Create bookmark button layout 1: */
     133        QHBoxLayout *pButtonLayout1 = new QHBoxLayout;
     134        if (pButtonLayout1)
     135        {
     136            pButtonLayout1->setContentsMargins(0, 0, 0, 0);
     137            pButtonLayout1->setSpacing(0);
     138
     139            /* Create goto selected bookmark button: */
     140            m_pGotoSelectedBookmark = new QIToolButton;
     141            if (m_pGotoSelectedBookmark)
     142            {
     143                m_pGotoSelectedBookmark->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png"));
     144                pButtonLayout1->addWidget(m_pGotoSelectedBookmark);
     145            }
     146
     147            /* Create goto previous bookmark button: */
     148            m_pPreviousButton = new QIToolButton;
     149            if (m_pPreviousButton)
     150            {
     151                m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_previous_bookmark_16px.png"));
     152                pButtonLayout1->addWidget(m_pPreviousButton);
     153            }
     154
     155            /* Create goto next bookmark button: */
     156            m_pNextButton = new QIToolButton;
     157            if (m_pNextButton)
     158            {
     159                m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_next_bookmark_16px.png"));
     160                pButtonLayout1->addWidget(m_pNextButton);
     161            }
     162
     163            pComboButtonLayout->addLayout(pButtonLayout1);
     164        }
     165
     166        /* Create bookmark button layout 2: */
     167        QHBoxLayout *pButtonLayout2 = new QHBoxLayout;
     168        if (pButtonLayout2)
     169        {
     170            pButtonLayout2->setContentsMargins(0, 0, 0, 0);
     171            pButtonLayout2->setSpacing(0);
     172
     173            /* Create delete current bookmark button: */
     174            m_pDeleteCurrentButton = new QIToolButton;
     175            if (m_pDeleteCurrentButton)
     176            {
     177                m_pDeleteCurrentButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_current_bookmark_16px.png"));
     178                pButtonLayout2->addWidget(m_pDeleteCurrentButton);
     179            }
     180
     181            /* Create delete all bookmarks button: */
     182            m_pDeleteAllButton = new QIToolButton;
     183            if (m_pDeleteAllButton)
     184            {
     185                m_pDeleteAllButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_all_bookmarks_16px.png"));
     186                pButtonLayout2->addWidget(m_pDeleteAllButton);
     187            }
     188
     189            pComboButtonLayout->addLayout(pButtonLayout2);
     190        }
     191
     192        mainLayout()->addLayout(pComboButtonLayout);
    123193    }
    124 
    125     m_pGotoSelectedBookmark = new QIToolButton;
    126     if (m_pGotoSelectedBookmark)
    127     {
    128         mainLayout()->addWidget(m_pGotoSelectedBookmark, 0);
    129         m_pGotoSelectedBookmark->setIcon(UIIconPool::iconSet(":/log_viewer_goto_selected_bookmark_16px.png"));
    130     }
    131 
    132     m_pNextPreviousButtonContainer = new QFrame;
    133     if (m_pNextPreviousButtonContainer)
    134     {
    135         mainLayout()->addWidget(m_pNextPreviousButtonContainer);
    136         QHBoxLayout *pContainerLayout = new QHBoxLayout(m_pNextPreviousButtonContainer);
    137         /* Configure layout: */
    138 #ifdef VBOX_WS_MAC
    139             pContainerLayout->setContentsMargins(5, 0, 5, 0);
    140             pContainerLayout->setSpacing(5);
    141 #else
    142             pContainerLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2, 0,
    143                                                  qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2, 0);
    144             pContainerLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
    145 #endif
    146 
    147     m_pPreviousButton = new QIToolButton;
    148     if (m_pPreviousButton)
    149     {
    150         pContainerLayout->addWidget(m_pPreviousButton);
    151         m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_previous_bookmark_16px.png"));
    152     }
    153 
    154     m_pNextButton = new QIToolButton;
    155     if (m_pNextButton){
    156         pContainerLayout->addWidget(m_pNextButton);
    157         m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_goto_next_bookmark_16px.png"));
    158     }
    159     }
    160 
    161     m_pDeleteCurrentButton = new QIToolButton;
    162     if (m_pDeleteCurrentButton)
    163     {
    164         mainLayout()->addWidget(m_pDeleteCurrentButton, 0);
    165         m_pDeleteCurrentButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_current_bookmark_16px.png"));
    166     }
    167 
    168     m_pDeleteAllButton = new QIToolButton;
    169     if (m_pDeleteAllButton)
    170     {
    171         mainLayout()->addWidget(m_pDeleteAllButton, 2);
    172         m_pDeleteAllButton->setIcon(UIIconPool::iconSet(":/log_viewer_delete_all_bookmarks_16px.png"));
    173     }
    174 
    175     mainLayout()->addStretch(3);
    176194}
    177195
     
    192210void UIVMLogViewerBookmarksPanel::retranslateUi()
    193211{
    194     if (m_pDeleteCurrentButton)
    195         m_pDeleteCurrentButton->setToolTip(UIVMLogViewerWidget::tr("Delete the current bookmark."));
    196 
    197     if (m_pDeleteAllButton)
    198     {
    199         m_pDeleteAllButton->setToolTip(UIVMLogViewerWidget::tr("Delete all bookmarks."));
    200         m_pDeleteAllButton->setText(UIVMLogViewerWidget::tr("Delete all"));
    201     }
    202 
    203     if (m_pNextButton)
    204         m_pNextButton->setToolTip(UIVMLogViewerWidget::tr("Goto the next bookmark"));
    205 
    206     if (m_pPreviousButton)
    207         m_pPreviousButton->setToolTip(UIVMLogViewerWidget::tr("Goto the previous bookmark"));
    208 
    209     if (m_pGotoSelectedBookmark)
    210         m_pGotoSelectedBookmark->setToolTip(UIVMLogViewerWidget::tr("Goto selected bookmark."));
    211 
    212212    UIVMLogViewerPanel::retranslateUi();
     213
     214    m_pDeleteCurrentButton->setToolTip(UIVMLogViewerWidget::tr("Delete the current bookmark"));
     215    m_pDeleteAllButton->setToolTip(UIVMLogViewerWidget::tr("Delete all bookmarks"));
     216    m_pNextButton->setToolTip(UIVMLogViewerWidget::tr("Goto the next bookmark"));
     217    m_pPreviousButton->setToolTip(UIVMLogViewerWidget::tr("Goto the previous bookmark"));
     218    m_pGotoSelectedBookmark->setToolTip(UIVMLogViewerWidget::tr("Goto selected bookmark"));
    213219}
    214220
     
    225231void UIVMLogViewerBookmarksPanel::sltBookmarkSelected(int index)
    226232{
    227     /* Do nothing if the index is 0, that is combo box title item: */
     233    /* Do nothing if the index is 0, that is combo-box title item: */
    228234    if (index <= 0)
    229235        return;
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h

    r72030 r72775  
    2424/* Forward declarations: */
    2525class QComboBox;
    26 class QFrame;
     26class QWidget;
    2727class QIToolButton;
    2828
     
    8383    QIToolButton *m_pNextButton;
    8484    QIToolButton *m_pPreviousButton;
    85     QFrame       *m_pNextPreviousButtonContainer;
    8685};
    8786
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp

    r72759 r72775  
    146146void UIVMFilterLineEdit::paintEvent(QPaintEvent *event)
    147147{
     148    /* Call to base-class: */
    148149    QLineEdit::paintEvent(event);
    149 
    150150
    151151    if (!m_pClearAllButton || !m_pRemoveTermButton)
     
    154154
    155155    int deltaHeight = 0.5 * (height() - m_pClearAllButton->height());
     156#ifdef VBOX_WS_MAC
     157    m_pClearAllButton->setGeometry(width() - clearButtonSize - 1, deltaHeight, clearButtonSize, clearButtonSize);
     158#else
    156159    m_pClearAllButton->setGeometry(width() - clearButtonSize, deltaHeight, clearButtonSize, clearButtonSize);
    157 
    158 
     160#endif
    159161
    160162    /* If we have a selected term move the m_pRemoveTermButton to the end of the
     
    166168        int buttonSize = m_iRemoveTermButtonSize;
    167169        int charWidth = fontMetrics().width('x');
     170#ifdef VBOX_WS_MAC
     171        int buttonLeft = cursorRect().left() + 1;
     172#else
    168173        int buttonLeft = cursorRect().right() - 0.5 * charWidth;
     174#endif
    169175        /* If buttonLeft is in far right of the line edit, move the
    170176           button to left side of the selected word: */
     
    416422    prepareRadioButtonGroup();
    417423
    418     m_pFilterComboBox = new QComboBox;
    419     if (m_pFilterComboBox)
    420     {
    421         m_pFilterComboBox->setEditable(true);
    422         QStringList strFilterPresets;
    423         strFilterPresets << "" << "GUI" << "NAT" << "AHCI" << "VD" << "Audio" << "VUSB" << "SUP" << "PGM" << "HDA"
    424                          << "HM" << "VMM" << "GIM" << "CPUM";
    425         strFilterPresets.sort();
    426         m_pFilterComboBox->addItems(strFilterPresets);
    427         mainLayout()->addWidget(m_pFilterComboBox,1);
    428     }
    429 
    430     m_pAddFilterTermButton = new QIToolButton;
    431     if (m_pAddFilterTermButton)
    432     {
    433         m_pAddFilterTermButton->setIcon(UIIconPool::iconSet(":/log_viewer_filter_add_16px.png"));
    434         mainLayout()->addWidget(m_pAddFilterTermButton,0);
    435     }
    436 
     424    /* Create combo/button layout: */
     425    QHBoxLayout *pComboButtonLayout = new QHBoxLayout;
     426    if (pComboButtonLayout)
     427    {
     428        pComboButtonLayout->setContentsMargins(0, 0, 0, 0);
     429#ifdef VBOX_WS_MAC
     430        pComboButtonLayout->setSpacing(5);
     431#else
     432        pComboButtonLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     433#endif
     434
     435        /* Create filter combo-box: */
     436        m_pFilterComboBox = new QComboBox;
     437        if (m_pFilterComboBox)
     438        {
     439            m_pFilterComboBox->setEditable(true);
     440            QStringList strFilterPresets;
     441            strFilterPresets << "" << "GUI" << "NAT" << "AHCI" << "VD"
     442                             << "Audio" << "VUSB" << "SUP" << "PGM" << "HDA"
     443                             << "HM" << "VMM" << "GIM" << "CPUM";
     444            strFilterPresets.sort();
     445            m_pFilterComboBox->addItems(strFilterPresets);
     446            pComboButtonLayout->addWidget(m_pFilterComboBox);
     447        }
     448
     449        /* Create add filter-term button: */
     450        m_pAddFilterTermButton = new QIToolButton;
     451        if (m_pAddFilterTermButton)
     452        {
     453            m_pAddFilterTermButton->setIcon(UIIconPool::iconSet(":/log_viewer_filter_add_16px.png"));
     454            pComboButtonLayout->addWidget(m_pAddFilterTermButton);
     455        }
     456
     457        mainLayout()->addLayout(pComboButtonLayout, 1);
     458    }
     459
     460    /* Create filter-term line-edit: */
    437461    m_pFilterTermsLineEdit = new UIVMFilterLineEdit;
    438462    if (m_pFilterTermsLineEdit)
    439463    {
    440         mainLayout()->addWidget(m_pFilterTermsLineEdit, 4);
    441         m_pFilterTermsLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum /*vertical */);
    442     }
    443 
     464        m_pFilterTermsLineEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     465        mainLayout()->addWidget(m_pFilterTermsLineEdit, 3);
     466    }
     467
     468    /* Create result label: */
    444469    m_pResultLabel = new QLabel;
    445470    if (m_pResultLabel)
    446471    {
    447         mainLayout()->addWidget(m_pResultLabel,0);
     472        m_pResultLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
     473        mainLayout()->addWidget(m_pResultLabel, 0);
    448474    }
    449475}
     
    456482    {
    457483        /* Configure container: */
     484        m_pRadioButtonContainer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    458485        m_pRadioButtonContainer->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
    459486
     
    464491            /* Configure layout: */
    465492#ifdef VBOX_WS_MAC
    466             pContainerLayout->setContentsMargins(5, 0, 0, 5);
     493            pContainerLayout->setContentsMargins(5, 0, 0, 7);
    467494            pContainerLayout->setSpacing(5);
    468495#else
     
    528555{
    529556    UIVMLogViewerPanel::retranslateUi();
    530     m_pFilterComboBox->setToolTip(UIVMLogViewerWidget::tr("Select or enter a term which will be used in filtering the log text."));
    531     m_pAddFilterTermButton->setToolTip(UIVMLogViewerWidget::tr("Add the filter term to the set of filter terms."));
     557
     558    m_pFilterComboBox->setToolTip(UIVMLogViewerWidget::tr("Select or enter a term which will be used in filtering the log text"));
     559    m_pAddFilterTermButton->setToolTip(UIVMLogViewerWidget::tr("Add the filter term to the set of filter terms"));
    532560    m_pResultLabel->setText(UIVMLogViewerWidget::tr("Showing %1/%2").arg(m_iFilteredLineCount).arg(m_iUnfilteredLineCount));
    533     m_pFilterTermsLineEdit->setToolTip(UIVMLogViewerWidget::tr("The filter terms list. Select one to remove or click the button on the right side to remove them all."));
    534     m_pRadioButtonContainer->setToolTip(UIVMLogViewerWidget::tr("The type of boolean operator for filter operation."));
     561    m_pFilterTermsLineEdit->setToolTip(UIVMLogViewerWidget::tr("The filter terms list, select one to remove or click "
     562                                                               "the button on the right side to remove them all"));
     563    m_pRadioButtonContainer->setToolTip(UIVMLogViewerWidget::tr("The type of boolean operator for filter operation"));
    535564}
    536565
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp

    r72720 r72775  
    8484    {
    8585#ifdef VBOX_WS_MAC
    86         m_pMainLayout->setContentsMargins(5, 0, 5, 0);
     86        m_pMainLayout->setContentsMargins(5 /* since there is always a button */, 0, 10 /* standard */, 0);
    8787        m_pMainLayout->setSpacing(10);
    8888#else
    8989        m_pMainLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2, 0,
    90                                              qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2, 0);
    91         m_pMainLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     90                                          qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2,
     91                                          qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) / 2);
     92        m_pMainLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
    9293#endif
    9394    }
     
    109110{
    110111    if (m_pCloseButton)
    111         m_pCloseButton->setToolTip(UIVMLogViewerWidget::tr("Close the search panel."));
     112        m_pCloseButton->setToolTip(UIVMLogViewerWidget::tr("Close the pane"));
    112113}
    113114
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp

    r72720 r72775  
    8080UIVMLogViewerSearchPanel::UIVMLogViewerSearchPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
    8181    : UIVMLogViewerPanel(pParent, pViewer)
    82     , m_pSearchLabel(0)
    8382    , m_pSearchEditor(0)
    8483    , m_pNextButton(0)
    8584    , m_pPreviousButton(0)
    86     , m_pNextPreviousButtonContainer(0)
    8785    , m_pCaseSensitiveCheckBox(0)
    8886    , m_pMatchWholeWordCheckBox(0)
     
    185183    {
    186184        /* we need this check not to remove the 'not found' label
    187            when the user toggles with this checkbox: */
     185           when the user toggles with this check-box: */
    188186        if (m_iMatchCount != 0)
    189187            clearHighlighting(-1);
     
    210208        return;
    211209
    212     /* Create search-editor: */
    213     m_pSearchEditor = new UIVMLogViewerSearchField(0 /* parent */);
    214     if (m_pSearchEditor)
    215     {
    216         /* Configure search-editor: */
    217         m_pSearchEditor->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    218         /* Add search-editor to main-layout: */
    219         mainLayout()->addWidget(m_pSearchEditor);
    220     }
    221 
    222     /* Create search-label: */
    223     m_pSearchLabel = new QLabel;
    224     if (m_pSearchLabel)
    225     {
    226         /* Configure search-label: */
    227         m_pSearchLabel->setBuddy(m_pSearchEditor);
    228         /* Prepare font: */
    229 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
    230         QFont font = m_pSearchLabel->font();
    231         font.setPointSize(::darwinSmallFontSize());
    232         m_pSearchLabel->setFont(font);
    233 #endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
    234         /* Add search-label to main-layout: */
    235         mainLayout()->addWidget(m_pSearchLabel);
    236     }
    237 
    238     /* Create Next/Previous buttons: */
    239     m_pNextPreviousButtonContainer = new QFrame;
    240     if (m_pNextPreviousButtonContainer)
    241     {
    242         mainLayout()->addWidget(m_pNextPreviousButtonContainer);
    243         QHBoxLayout *pContainerLayout = new QHBoxLayout(m_pNextPreviousButtonContainer);
    244         /* Configure layout: */
     210    /* Create search field layout: */
     211    QHBoxLayout *pSearchFieldLayout = new QHBoxLayout;
     212    if (pSearchFieldLayout)
     213    {
     214        pSearchFieldLayout->setContentsMargins(0, 0, 0, 0);
    245215#ifdef VBOX_WS_MAC
    246             pContainerLayout->setContentsMargins(5, 0, 5, 0);
    247             pContainerLayout->setSpacing(5);
     216        pSearchFieldLayout->setSpacing(5);
    248217#else
    249             pContainerLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2, 0,
    250                                                  qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2, 0);
    251             pContainerLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     218        pSearchFieldLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
    252219#endif
    253        m_pPreviousButton = new QIToolButton;
    254        if (m_pPreviousButton)
    255        {
    256            pContainerLayout->addWidget(m_pPreviousButton);
    257            m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_backward_16px.png"));
    258        }
    259 
    260        m_pNextButton = new QIToolButton;
    261        if (m_pNextButton){
    262            pContainerLayout->addWidget(m_pNextButton);
    263            m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_forward_16px.png"));
    264        }
    265     }
    266 
    267     /* Create case-sensitive checkbox: */
     220
     221        /* Create search-editor: */
     222        m_pSearchEditor = new UIVMLogViewerSearchField(0 /* parent */);
     223        if (m_pSearchEditor)
     224        {
     225            m_pSearchEditor->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
     226            pSearchFieldLayout->addWidget(m_pSearchEditor);
     227        }
     228
     229        /* Create search button layout: */
     230        QHBoxLayout *pSearchButtonsLayout = new QHBoxLayout;
     231        if (pSearchButtonsLayout)
     232        {
     233            pSearchButtonsLayout->setContentsMargins(0, 0, 0, 0);
     234            pSearchButtonsLayout->setSpacing(0);
     235
     236            /* Create Previous button: */
     237            m_pPreviousButton = new QIToolButton;
     238            if (m_pPreviousButton)
     239            {
     240                m_pPreviousButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_backward_16px.png"));
     241                pSearchButtonsLayout->addWidget(m_pPreviousButton);
     242            }
     243
     244            /* Create Next button: */
     245            m_pNextButton = new QIToolButton;
     246            if (m_pNextButton)
     247            {
     248                m_pNextButton->setIcon(UIIconPool::iconSet(":/log_viewer_search_forward_16px.png"));
     249                pSearchButtonsLayout->addWidget(m_pNextButton);
     250            }
     251
     252            pSearchFieldLayout->addLayout(pSearchButtonsLayout);
     253        }
     254
     255        mainLayout()->addLayout(pSearchFieldLayout);
     256    }
     257
     258    /* Create case-sensitive check-box: */
    268259    m_pCaseSensitiveCheckBox = new QCheckBox;
    269260    if (m_pCaseSensitiveCheckBox)
    270261    {
    271         /* Configure font: */
    272 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
    273         QFont font = m_pCaseSensitiveCheckBox->font();
    274         font.setPointSize(::darwinSmallFontSize());
    275         m_pCaseSensitiveCheckBox->setFont(font);
    276 #endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
    277         /* Add case-sensitive checkbox to main-layout: */
    278262        mainLayout()->addWidget(m_pCaseSensitiveCheckBox);
    279263    }
    280264
     265    /* Create whole-word check-box: */
    281266    m_pMatchWholeWordCheckBox = new QCheckBox;
    282267    if (m_pMatchWholeWordCheckBox)
    283268    {
    284         /* Configure focus for case-sensitive checkbox: */
    285269        setFocusProxy(m_pMatchWholeWordCheckBox);
    286         /* Configure font: */
    287 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
    288         QFont font = m_pMatchWholeWordCheckBox->font();
    289         font.setPointSize(::darwinSmallFontSize());
    290         m_pMatchWholeWordCheckBox->setFont(font);
    291 #endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
    292270        mainLayout()->addWidget(m_pMatchWholeWordCheckBox);
    293271    }
    294272
     273    /* Create highlight-all check-box: */
    295274    m_pHighlightAllCheckBox = new QCheckBox;
    296275    if (m_pHighlightAllCheckBox)
    297276    {
    298         /* Configure font: */
    299 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
    300         QFont font = m_pHighlightAllCheckBox->font();
    301         font.setPointSize(::darwinSmallFontSize());
    302         m_pHighlightAllCheckBox->setFont(font);
    303 #endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
    304         /* Add case-sensitive checkbox to main-layout: */
    305277        mainLayout()->addWidget(m_pHighlightAllCheckBox);
    306278    }
    307279
    308     /* Create warning-icon: */
    309     m_pWarningIcon = new QLabel;
    310     if (m_pWarningIcon)
    311     {
    312         /* Confifure warning-icon: */
    313         m_pWarningIcon->hide();
    314         QIcon icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning, this);
    315         if (!icon.isNull())
    316             m_pWarningIcon->setPixmap(icon.pixmap(16, 16));
    317         /* Add warning-icon to main-layout: */
    318         mainLayout()->addWidget(m_pWarningIcon);
    319     }
    320 
    321     /* Create warning-label: */
    322     m_pInfoLabel = new QLabel;
    323     if (m_pInfoLabel)
    324     {
    325         /* Configure warning-label: */
    326         m_pInfoLabel->hide();
    327         /* Prepare font: */
    328 #ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
    329         QFont font = m_pInfoLabel->font();
    330         font.setPointSize(::darwinSmallFontSize());
    331         m_pInfoLabel->setFont(font);
    332 #endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
    333         /* Add warning-label to main-layout: */
    334         mainLayout()->addWidget(m_pInfoLabel);
    335     }
    336     mainLayout()->addStretch(2);
     280    /* Create search field layout: */
     281    QHBoxLayout *pSearchErrorLayout = new QHBoxLayout;
     282    if (pSearchErrorLayout)
     283    {
     284        pSearchErrorLayout->setContentsMargins(0, 0, 0, 0);
     285#ifdef VBOX_WS_MAC
     286        pSearchErrorLayout->setSpacing(5);
     287#else
     288        pSearchErrorLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     289#endif
     290
     291        /* Create warning-icon: */
     292        m_pWarningIcon = new QLabel;
     293        if (m_pWarningIcon)
     294        {
     295            m_pWarningIcon->hide();
     296            QIcon icon = UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_MessageBoxWarning, this);
     297            if (!icon.isNull())
     298                m_pWarningIcon->setPixmap(icon.pixmap(16, 16));
     299            pSearchErrorLayout->addWidget(m_pWarningIcon);
     300        }
     301
     302        /* Create warning-label: */
     303        m_pInfoLabel = new QLabel;
     304        if (m_pInfoLabel)
     305        {
     306            m_pInfoLabel->hide();
     307            pSearchErrorLayout->addWidget(m_pInfoLabel);
     308        }
     309
     310        mainLayout()->addLayout(pSearchErrorLayout);
     311    }
    337312}
    338313
     
    353328void UIVMLogViewerSearchPanel::retranslateUi()
    354329{
    355     if (m_pSearchLabel)
    356         m_pSearchLabel->setText(QString("%1 ").arg(UIVMLogViewerWidget::tr("&Find")));
    357 
    358     if (m_pSearchEditor)
    359         m_pSearchEditor->setToolTip(UIVMLogViewerWidget::tr("Enter a search string here"));
    360 
    361     if (m_pNextButton)
    362         m_pNextButton->setToolTip(UIVMLogViewerWidget::tr("Search for the next occurrence of the string (F3)"));
    363 
    364     if (m_pPreviousButton)
    365         m_pPreviousButton->setToolTip(UIVMLogViewerWidget::tr("Search for the previous occurrence of the string (Shift+F3)"));
    366 
    367 
    368     if (m_pCaseSensitiveCheckBox)
    369     {
    370         m_pCaseSensitiveCheckBox->setText(UIVMLogViewerWidget::tr("C&ase Sensitive"));
    371         m_pCaseSensitiveCheckBox->setToolTip(UIVMLogViewerWidget::tr("Perform case sensitive search (when checked)"));
    372     }
    373 
    374     if (m_pMatchWholeWordCheckBox)
    375     {
    376         m_pMatchWholeWordCheckBox->setText(UIVMLogViewerWidget::tr("Ma&tch Whole Word"));
    377         m_pMatchWholeWordCheckBox->setToolTip(UIVMLogViewerWidget::tr("Search matches only complete words when checked"));
    378     }
    379 
    380     if (m_pHighlightAllCheckBox)
    381     {
    382         m_pHighlightAllCheckBox->setText(UIVMLogViewerWidget::tr("&Highlight All"));
    383         m_pHighlightAllCheckBox->setToolTip(UIVMLogViewerWidget::tr("All occurence of the search text are highlighted"));
    384     }
     330    UIVMLogViewerPanel::retranslateUi();
     331
     332    m_pSearchEditor->setToolTip(UIVMLogViewerWidget::tr("Enter a search string here"));
     333    m_pNextButton->setToolTip(UIVMLogViewerWidget::tr("Search for the next occurrence of the string (F3)"));
     334    m_pPreviousButton->setToolTip(UIVMLogViewerWidget::tr("Search for the previous occurrence of the string (Shift+F3)"));
     335
     336    m_pCaseSensitiveCheckBox->setText(UIVMLogViewerWidget::tr("C&ase Sensitive"));
     337    m_pCaseSensitiveCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, perform case sensitive search"));
     338
     339    m_pMatchWholeWordCheckBox->setText(UIVMLogViewerWidget::tr("Ma&tch Whole Word"));
     340    m_pMatchWholeWordCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, search matches only complete words"));
     341
     342    m_pHighlightAllCheckBox->setText(UIVMLogViewerWidget::tr("&Highlight All"));
     343    m_pHighlightAllCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, all occurence of the search text are highlighted"));
    385344
    386345    if (m_iMatchCount == 0)
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h

    r71638 r72775  
    2727/* Forward declarations: */
    2828class QCheckBox;
    29 class QFrame;
    3029class QHBoxLayout;
    3130class QLabel;
     31class QWidget;
    3232class QIToolButton;
    3333class UIVMLogViewerSearchField;
     
    9999    QTextDocument::FindFlags constructFindFlags(SearchDirection eDirection);
    100100
    101     /** Holds the instance of search-label we create. */
    102     QLabel *m_pSearchLabel;
    103101    /** Holds the instance of search-editor we create. */
    104102    UIVMLogViewerSearchField *m_pSearchEditor;
     
    106104    QIToolButton *m_pNextButton;
    107105    QIToolButton *m_pPreviousButton;
    108     QFrame       *m_pNextPreviousButtonContainer;
    109106    /** Holds the instance of case-sensitive checkbox we create. */
    110107    QCheckBox    *m_pCaseSensitiveCheckBox;
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSettingsPanel.cpp

    r72724 r72775  
    8383        return;
    8484
     85    /* Create line-number check-box: */
    8586    m_pLineNumberCheckBox = new QCheckBox;
    8687    if (m_pLineNumberCheckBox)
     
    9091    }
    9192
     93    /* Create wrap-lines check-box: */
    9294    m_pWrapLinesCheckBox = new QCheckBox;
    9395    if (m_pWrapLinesCheckBox)
     
    9799    }
    98100
     101    /* Create font-size spin-box: */
    99102    m_pFontSizeSpinBox = new QSpinBox;
    100103    if (m_pFontSizeSpinBox)
     
    106109    }
    107110
     111    /* Create font-size label: */
    108112    m_pFontSizeLabel = new QLabel;
    109113    if (m_pFontSizeLabel)
     
    112116    }
    113117
    114     m_pOpenFontDialogButton = new QIToolButton;
    115     if (m_pOpenFontDialogButton)
     118    /* Create combo/button layout: */
     119    QHBoxLayout *pButtonLayout = new QHBoxLayout;
     120    if (pButtonLayout)
    116121    {
    117         mainLayout()->addWidget(m_pOpenFontDialogButton, 0);
    118         m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));
     122        pButtonLayout->setContentsMargins(0, 0, 0, 0);
     123        pButtonLayout->setSpacing(0);
     124
     125        /* Create open font dialog button: */
     126        m_pOpenFontDialogButton = new QIToolButton;
     127        if (m_pOpenFontDialogButton)
     128        {
     129            pButtonLayout->addWidget(m_pOpenFontDialogButton, 0);
     130            m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));
     131        }
     132
     133        /* Create reset font to default button: */
     134        m_pResetToDefaultsButton = new QIToolButton;
     135        if (m_pResetToDefaultsButton)
     136        {
     137            pButtonLayout->addWidget(m_pResetToDefaultsButton, 0);
     138            m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));
     139        }
     140
     141        mainLayout()->addLayout(pButtonLayout);
    119142    }
    120143
    121     m_pResetToDefaultsButton = new QIToolButton;
    122     if (m_pResetToDefaultsButton)
    123     {
    124         mainLayout()->addWidget(m_pResetToDefaultsButton, 0);
    125         m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));
    126     }
    127144    mainLayout()->addStretch(2);
    128145}
     
    146163{
    147164    UIVMLogViewerPanel::retranslateUi();
    148     if (m_pLineNumberCheckBox)
    149     {
    150         m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));
    151         m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("Show Line Numbers"));
    152     }
    153165
    154     if (m_pWrapLinesCheckBox)
    155     {
    156         m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));
    157         m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("Wrap Lines"));
    158     }
     166    m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));
     167    m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers"));
    159168
    160     if (m_pFontSizeLabel)
    161     {
    162         m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));
    163         m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log Viewer Font Size"));
    164     }
     169    m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));
     170    m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines"));
    165171
    166     if (m_pOpenFontDialogButton)
    167         m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
     172    m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));
     173    m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size"));
    168174
    169     if (m_pResetToDefaultsButton)
    170         m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
     175    m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
     176    m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
    171177}
    172178
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