VirtualBox

Ignore:
Timestamp:
Jan 23, 2018 1:24:34 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt bugref:9072 Logviewer MacOS fix part-2. Remove Cocoa native widgets.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r70581 r70706  
    551551        src/globals/UIThreadPool.cpp \
    552552        src/logviewer/UIVMLogViewerFilterPanel.cpp \
     553        src/logviewer/UIVMLogViewerSearchPanel.cpp \
    553554        src/logviewer/UIVMLogViewerTextEdit.cpp \
    554555        src/medium/UIMediumEnumerator.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp

    r70664 r70706  
    2222/* Qt includes: */
    2323# include <QComboBox>
     24# include <QFrame>
    2425# include <QHBoxLayout>
    2526# if defined(RT_OS_SOLARIS)
     
    3132# include "QIToolButton.h"
    3233# include "UIIconPool.h"
    33 # include "UISpecialControls.h"
    3434# include "UIVMLogViewerBookmarksPanel.h"
    3535# include "UIVMLogViewerWidget.h"
     
    4545    , m_pDeleteAllButton(0)
    4646    , m_pDeleteCurrentButton(0)
    47     , m_pNextPrevButtons(0)
     47    , m_pNextButton(0)
     48    , m_pPreviousButton(0)
     49    , m_pNextPreviousButtonContainer(0)
    4850{
    4951    prepare();
     
    109111    }
    110112
     113
    111114    m_pGotoSelectedBookmark = new QIToolButton(this);
    112115    if (m_pGotoSelectedBookmark)
     
    116119    }
    117120
    118     m_pNextPrevButtons = new UIRoundRectSegmentedButton(this, 2);
    119     if (m_pNextPrevButtons)
    120     {
    121         m_pNextPrevButtons->setEnabled(0, false);
    122         m_pNextPrevButtons->setEnabled(1, false);
    123 #ifndef VBOX_WS_MAC
    124         /* No icons on the Mac: */
    125         m_pNextPrevButtons->setIcon(0, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack, this));
    126         m_pNextPrevButtons->setIcon(1, UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this));
    127 #endif /* !VBOX_WS_MAC */
    128         mainLayout()->addWidget(m_pNextPrevButtons);
    129         m_pNextPrevButtons->setEnabled(0, true);
    130         m_pNextPrevButtons->setEnabled(1, true);
     121    m_pNextPreviousButtonContainer = new QFrame;
     122    if (m_pNextPreviousButtonContainer)
     123    {
     124        mainLayout()->addWidget(m_pNextPreviousButtonContainer);
     125        QHBoxLayout *pContainerLayout = new QHBoxLayout(m_pNextPreviousButtonContainer);
     126        /* Configure layout: */
     127#ifdef VBOX_WS_MAC
     128            pContainerLayout->setContentsMargins(5, 0, 0, 5);
     129            pContainerLayout->setSpacing(5);
     130#else
     131            pContainerLayout->setContentsMargins(qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2, 0,
     132                                                 qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2, 0);
     133            pContainerLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
     134#endif
     135       m_pPreviousButton = new QIToolButton;
     136       if(m_pPreviousButton)
     137       {
     138           pContainerLayout->addWidget(m_pPreviousButton);
     139           m_pPreviousButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowBack, this));
     140       }
     141
     142       m_pNextButton = new QIToolButton;
     143       if(m_pNextButton){
     144           pContainerLayout->addWidget(m_pNextButton);
     145           m_pNextButton->setIcon(UIIconPool::defaultIcon(UIIconPool::UIDefaultIconType_ArrowForward, this));
     146       }
    131147    }
    132148
     
    153169
    154170    connect(m_pGotoSelectedBookmark, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sltGotoSelectedBookmark);
    155     connect(m_pNextPrevButtons, &UIRoundRectSegmentedButton::clicked, this, &UIVMLogViewerBookmarksPanel::sltGotoNextPreviousBookmark);
     171    connect(m_pNextButton, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sltGotoNextBookmark);
     172    connect(m_pPreviousButton, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sltGotoPreviousBookmark);
    156173
    157174    connect(m_pDeleteAllButton, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks);
     
    171188    }
    172189
    173     if (m_pNextPrevButtons)
    174     {
    175         m_pNextPrevButtons->setToolTip(0, UIVMLogViewerWidget::tr("Goto the previous bookmark"));
    176         m_pNextPrevButtons->setToolTip(1, UIVMLogViewerWidget::tr("Goto the next bookmark"));
    177     }
     190    if (m_pNextButton)
     191        m_pNextButton->setToolTip(UIVMLogViewerWidget::tr("Goto the next bookmark"));
     192
     193    if (m_pPreviousButton)
     194        m_pPreviousButton->setToolTip(UIVMLogViewerWidget::tr("Goto the previous bookmark"));
    178195
    179196    if (m_pGotoSelectedBookmark)
     
    201218}
    202219
    203 void UIVMLogViewerBookmarksPanel::sltGotoNextPreviousBookmark(int buttonIndex)
     220
     221void UIVMLogViewerBookmarksPanel::sltGotoNextBookmark()
     222{
     223    /* go to next bookmark or wrap around to the beginning of the list: */
     224    if (m_pBookmarksComboBox->currentIndex() == m_pBookmarksComboBox->count()-1)
     225        m_pBookmarksComboBox->setCurrentIndex(1);
     226    else
     227        m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->currentIndex() + 1);
     228}
     229
     230
     231void UIVMLogViewerBookmarksPanel::sltGotoPreviousBookmark()
     232{
     233    /* go to previous bookmark or wrap around to the end of the list: */
     234    if (m_pBookmarksComboBox->currentIndex() <= 1)
     235        m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->count() - 1);
     236    else
     237        m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->currentIndex() - 1);
     238}
     239
     240void UIVMLogViewerBookmarksPanel::sltGotoSelectedBookmark()
    204241{
    205242    if (!m_pBookmarksComboBox || m_pBookmarksComboBox->count() <= 1)
    206243        return;
    207 
    208     /* go to previous bookmark or wrap around to the end of the list: */
    209     if (buttonIndex == 0)
    210     {
    211         if (m_pBookmarksComboBox->currentIndex() <= 1)
    212             m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->count() - 1);
    213         else
    214             m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->currentIndex() - 1);
    215     }
    216     /* go to next bookmark or wrap around to the beginning of the list: */
    217     else if (buttonIndex == 1)
    218     {
    219         if (m_pBookmarksComboBox->currentIndex() == m_pBookmarksComboBox->count()-1)
    220             m_pBookmarksComboBox->setCurrentIndex(1);
    221         else
    222             m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->currentIndex() + 1);
    223     }
    224 }
    225 
    226 void UIVMLogViewerBookmarksPanel::sltGotoSelectedBookmark()
    227 {
    228     if (!m_pBookmarksComboBox || m_pBookmarksComboBox->count() <= 1)
    229         return;
    230244    emit sigBookmarkSelected(m_pBookmarksComboBox->currentIndex() - 1);
    231245}
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h

    r70617 r70706  
    2424/* Forward declarations: */
    2525class QComboBox;
     26class QFrame;
    2627class QIToolButton;
    2728class UIRoundRectSegmentedButton;
     
    6566    void sltDeleteCurrentBookmark();
    6667    void sltBookmarkSelected(int index);
    67     void sltGotoNextPreviousBookmark(int buttonIndex);
     68    void sltGotoNextBookmark();
     69    void sltGotoPreviousBookmark();
    6870    void sltGotoSelectedBookmark();
    6971
     
    7880    QIToolButton *m_pDeleteAllButton;
    7981    QIToolButton *m_pDeleteCurrentButton;
    80     UIRoundRectSegmentedButton *m_pNextPrevButtons;
     82    QIToolButton *m_pNextButton;
     83    QIToolButton *m_pPreviousButton;
     84    QFrame       *m_pNextPreviousButtonContainer;
    8185};
    8286
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp

    r70676 r70706  
    3939# include "QIToolButton.h"
    4040# include "UIIconPool.h"
    41 # include "UISpecialControls.h"
    4241# include "UIVMLogPage.h"
    4342# include "UIVMLogViewerFilterPanel.h"
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp

    r70676 r70706  
    2929
    3030/* GUI includes: */
     31# include "QIToolButton.h"
    3132# include "UIIconPool.h"
    32 # include "UISpecialControls.h"
    3333# include "UIVMLogPage.h"
    3434# include "UIVMLogViewerPanel.h"
     
    7979        m_pMainLayout->setSpacing(2);
    8080    }
    81     m_pCloseButton = new UIMiniCancelButton;
     81    m_pCloseButton = new QIToolButton;
    8282    if (m_pCloseButton)
    8383    {
     84        m_pCloseButton->setIcon(m_pCloseButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
    8485        m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft);
    8586    }
     
    8990{
    9091    if (m_pCloseButton)
    91         connect(m_pCloseButton, &UIMiniCancelButton::clicked, this, &UIVMLogViewerPanel::hide);
    92 
     92        connect(m_pCloseButton, &QIToolButton::clicked, this, &QIToolButton::hide);
    9393}
    94 
    9594
    9695void UIVMLogViewerPanel::retranslateUi()
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h

    r70645 r70706  
    2929class QPlainTextEdit;
    3030class QTextDocument;
    31 class UIMiniCancelButton;
     31class QIToolButton;
    3232class UIVMLogViewerWidget;
    3333
     
    7575    QHBoxLayout         *m_pMainLayout;
    7676    /** Holds the instance of close-button we create. */
    77     UIMiniCancelButton  *m_pCloseButton;
     77    QIToolButton        *m_pCloseButton;
    7878};
    7979
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp

    r70699 r70706  
    2929# include <QHBoxLayout>
    3030# include <QLabel>
     31# include <QLineEdit>
    3132# include <QPlainTextEdit>
    3233# include <QTextBlock>
     
    4344
    4445#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     46
     47class UIVMLogViewerSearchField: public QLineEdit
     48{
     49    Q_OBJECT;
     50
     51public:
     52
     53    UIVMLogViewerSearchField(QWidget *pParent)
     54        : QLineEdit(pParent)
     55    {
     56        m_baseBrush = palette().base();
     57    }
     58
     59    void markError()
     60    {
     61        QPalette pal = palette();
     62        QColor c(Qt::red);
     63        c.setAlphaF(0.3);
     64        pal.setBrush(QPalette::Base, c);
     65        setPalette(pal);
     66    }
     67
     68    void unmarkError()
     69    {
     70        QPalette pal = palette();
     71        pal.setBrush(QPalette::Base, m_baseBrush);
     72        setPalette(pal);
     73    }
     74
     75private:
     76    /* Private member vars */
     77    QBrush m_baseBrush;
     78};
    4579
    4680UIVMLogViewerSearchPanel::UIVMLogViewerSearchPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
     
    182216    if (!mainLayout())
    183217        return;
    184    
     218
    185219    /* Create search-editor: */
    186     m_pSearchEditor = new UISearchField(0 /* parent */);
     220    m_pSearchEditor = new UIVMLogViewerSearchField(0 /* parent */);
    187221    if (m_pSearchEditor)
    188222    {
     
    192226        mainLayout()->addWidget(m_pSearchEditor);
    193227    }
    194    
     228
    195229    /* Create search-label: */
    196230    m_pSearchLabel = new QLabel;
     
    299333void UIVMLogViewerSearchPanel::prepareConnections()
    300334{
    301     connect(m_pSearchEditor, &UISearchField::textChanged, this, &UIVMLogViewerSearchPanel::sltSearchTextChanged);
     335    connect(m_pSearchEditor, &UIVMLogViewerSearchField::textChanged, this, &UIVMLogViewerSearchPanel::sltSearchTextChanged);
    302336    connect(m_pNextPrevButtons, &UIRoundRectSegmentedButton::clicked, this, &UIVMLogViewerSearchPanel::find);
    303337    connect(m_pHighlightAllCheckBox, &QCheckBox::stateChanged,
     
    322356        m_pNextPrevButtons->setToolTip(1, UIVMLogViewerWidget::tr("Search for the next occurrence of the string"));
    323357    }
    324    
     358
    325359    if (m_pCaseSensitiveCheckBox)
    326360    {
     
    328362        m_pCaseSensitiveCheckBox->setToolTip(UIVMLogViewerWidget::tr("Perform case sensitive search (when checked)"));
    329363    }
    330    
     364
    331365    if (m_pMatchWholeWordCheckBox)
    332366    {
     
    334368        m_pMatchWholeWordCheckBox->setToolTip(UIVMLogViewerWidget::tr("Search matches only complete words when checked"));
    335369    }
    336    
     370
    337371    if (m_pHighlightAllCheckBox)
    338372    {
     
    340374        m_pHighlightAllCheckBox->setToolTip(UIVMLogViewerWidget::tr("All occurence of the search text are highlighted"));
    341375    }
    342    
     376
    343377    if (m_iMatchCount == 0)
    344378        m_pInfoLabel->setText(UIVMLogViewerWidget::tr("String not found"));
     
    458492    if(!m_pSearchEditor)
    459493        return;
    460    
     494
    461495    const QString &searchString = m_pSearchEditor->text();
    462496    if (searchString.isEmpty())
     
    580614    if (!m_pSearchEditor || !m_pWarningIcon || !m_pInfoLabel)
    581615        return;
    582    
     616
    583617    /* If no match has been found, mark the search editor: */
    584618    if (m_iMatchCount == 0)
     
    615649   return findFlags;
    616650}
     651
     652#include "UIVMLogViewerSearchPanel.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h

    r70699 r70706  
    3131class UIRoundRectSegmentedButton;
    3232class UISearchField;
     33class UIVMLogViewerSearchField;
    3334class UIVMLogViewerWidget;
    3435
     
    104105    QLabel *m_pSearchLabel;
    105106    /** Holds the instance of search-editor we create. */
    106     UISearchField *m_pSearchEditor;
     107    UIVMLogViewerSearchField *m_pSearchEditor;
    107108    /** Holds the instance of next/back button-box we create. */
    108109    UIRoundRectSegmentedButton *m_pNextPrevButtons;
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