Changeset 70706 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jan 23, 2018 1:24:34 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r70581 r70706 551 551 src/globals/UIThreadPool.cpp \ 552 552 src/logviewer/UIVMLogViewerFilterPanel.cpp \ 553 src/logviewer/UIVMLogViewerSearchPanel.cpp \ 553 554 src/logviewer/UIVMLogViewerTextEdit.cpp \ 554 555 src/medium/UIMediumEnumerator.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp
r70664 r70706 22 22 /* Qt includes: */ 23 23 # include <QComboBox> 24 # include <QFrame> 24 25 # include <QHBoxLayout> 25 26 # if defined(RT_OS_SOLARIS) … … 31 32 # include "QIToolButton.h" 32 33 # include "UIIconPool.h" 33 # include "UISpecialControls.h"34 34 # include "UIVMLogViewerBookmarksPanel.h" 35 35 # include "UIVMLogViewerWidget.h" … … 45 45 , m_pDeleteAllButton(0) 46 46 , m_pDeleteCurrentButton(0) 47 , m_pNextPrevButtons(0) 47 , m_pNextButton(0) 48 , m_pPreviousButton(0) 49 , m_pNextPreviousButtonContainer(0) 48 50 { 49 51 prepare(); … … 109 111 } 110 112 113 111 114 m_pGotoSelectedBookmark = new QIToolButton(this); 112 115 if (m_pGotoSelectedBookmark) … … 116 119 } 117 120 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 } 131 147 } 132 148 … … 153 169 154 170 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); 156 173 157 174 connect(m_pDeleteAllButton, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks); … … 171 188 } 172 189 173 if (m_pNext PrevButtons)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")); 178 195 179 196 if (m_pGotoSelectedBookmark) … … 201 218 } 202 219 203 void UIVMLogViewerBookmarksPanel::sltGotoNextPreviousBookmark(int buttonIndex) 220 221 void 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 231 void 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 240 void UIVMLogViewerBookmarksPanel::sltGotoSelectedBookmark() 204 241 { 205 242 if (!m_pBookmarksComboBox || m_pBookmarksComboBox->count() <= 1) 206 243 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 else214 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 else222 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;230 244 emit sigBookmarkSelected(m_pBookmarksComboBox->currentIndex() - 1); 231 245 } -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h
r70617 r70706 24 24 /* Forward declarations: */ 25 25 class QComboBox; 26 class QFrame; 26 27 class QIToolButton; 27 28 class UIRoundRectSegmentedButton; … … 65 66 void sltDeleteCurrentBookmark(); 66 67 void sltBookmarkSelected(int index); 67 void sltGotoNextPreviousBookmark(int buttonIndex); 68 void sltGotoNextBookmark(); 69 void sltGotoPreviousBookmark(); 68 70 void sltGotoSelectedBookmark(); 69 71 … … 78 80 QIToolButton *m_pDeleteAllButton; 79 81 QIToolButton *m_pDeleteCurrentButton; 80 UIRoundRectSegmentedButton *m_pNextPrevButtons; 82 QIToolButton *m_pNextButton; 83 QIToolButton *m_pPreviousButton; 84 QFrame *m_pNextPreviousButtonContainer; 81 85 }; 82 86 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r70676 r70706 39 39 # include "QIToolButton.h" 40 40 # include "UIIconPool.h" 41 # include "UISpecialControls.h"42 41 # include "UIVMLogPage.h" 43 42 # include "UIVMLogViewerFilterPanel.h" -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
r70676 r70706 29 29 30 30 /* GUI includes: */ 31 # include "QIToolButton.h" 31 32 # include "UIIconPool.h" 32 # include "UISpecialControls.h"33 33 # include "UIVMLogPage.h" 34 34 # include "UIVMLogViewerPanel.h" … … 79 79 m_pMainLayout->setSpacing(2); 80 80 } 81 m_pCloseButton = new UIMiniCancelButton;81 m_pCloseButton = new QIToolButton; 82 82 if (m_pCloseButton) 83 83 { 84 m_pCloseButton->setIcon(m_pCloseButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 84 85 m_pMainLayout->addWidget(m_pCloseButton, 0, Qt::AlignLeft); 85 86 } … … 89 90 { 90 91 if (m_pCloseButton) 91 connect(m_pCloseButton, &UIMiniCancelButton::clicked, this, &UIVMLogViewerPanel::hide); 92 92 connect(m_pCloseButton, &QIToolButton::clicked, this, &QIToolButton::hide); 93 93 } 94 95 94 96 95 void UIVMLogViewerPanel::retranslateUi() -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h
r70645 r70706 29 29 class QPlainTextEdit; 30 30 class QTextDocument; 31 class UIMiniCancelButton;31 class QIToolButton; 32 32 class UIVMLogViewerWidget; 33 33 … … 75 75 QHBoxLayout *m_pMainLayout; 76 76 /** Holds the instance of close-button we create. */ 77 UIMiniCancelButton*m_pCloseButton;77 QIToolButton *m_pCloseButton; 78 78 }; 79 79 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp
r70699 r70706 29 29 # include <QHBoxLayout> 30 30 # include <QLabel> 31 # include <QLineEdit> 31 32 # include <QPlainTextEdit> 32 33 # include <QTextBlock> … … 43 44 44 45 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 46 47 class UIVMLogViewerSearchField: public QLineEdit 48 { 49 Q_OBJECT; 50 51 public: 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 75 private: 76 /* Private member vars */ 77 QBrush m_baseBrush; 78 }; 45 79 46 80 UIVMLogViewerSearchPanel::UIVMLogViewerSearchPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer) … … 182 216 if (!mainLayout()) 183 217 return; 184 218 185 219 /* Create search-editor: */ 186 m_pSearchEditor = new UI SearchField(0 /* parent */);220 m_pSearchEditor = new UIVMLogViewerSearchField(0 /* parent */); 187 221 if (m_pSearchEditor) 188 222 { … … 192 226 mainLayout()->addWidget(m_pSearchEditor); 193 227 } 194 228 195 229 /* Create search-label: */ 196 230 m_pSearchLabel = new QLabel; … … 299 333 void UIVMLogViewerSearchPanel::prepareConnections() 300 334 { 301 connect(m_pSearchEditor, &UI SearchField::textChanged, this, &UIVMLogViewerSearchPanel::sltSearchTextChanged);335 connect(m_pSearchEditor, &UIVMLogViewerSearchField::textChanged, this, &UIVMLogViewerSearchPanel::sltSearchTextChanged); 302 336 connect(m_pNextPrevButtons, &UIRoundRectSegmentedButton::clicked, this, &UIVMLogViewerSearchPanel::find); 303 337 connect(m_pHighlightAllCheckBox, &QCheckBox::stateChanged, … … 322 356 m_pNextPrevButtons->setToolTip(1, UIVMLogViewerWidget::tr("Search for the next occurrence of the string")); 323 357 } 324 358 325 359 if (m_pCaseSensitiveCheckBox) 326 360 { … … 328 362 m_pCaseSensitiveCheckBox->setToolTip(UIVMLogViewerWidget::tr("Perform case sensitive search (when checked)")); 329 363 } 330 364 331 365 if (m_pMatchWholeWordCheckBox) 332 366 { … … 334 368 m_pMatchWholeWordCheckBox->setToolTip(UIVMLogViewerWidget::tr("Search matches only complete words when checked")); 335 369 } 336 370 337 371 if (m_pHighlightAllCheckBox) 338 372 { … … 340 374 m_pHighlightAllCheckBox->setToolTip(UIVMLogViewerWidget::tr("All occurence of the search text are highlighted")); 341 375 } 342 376 343 377 if (m_iMatchCount == 0) 344 378 m_pInfoLabel->setText(UIVMLogViewerWidget::tr("String not found")); … … 458 492 if(!m_pSearchEditor) 459 493 return; 460 494 461 495 const QString &searchString = m_pSearchEditor->text(); 462 496 if (searchString.isEmpty()) … … 580 614 if (!m_pSearchEditor || !m_pWarningIcon || !m_pInfoLabel) 581 615 return; 582 616 583 617 /* If no match has been found, mark the search editor: */ 584 618 if (m_iMatchCount == 0) … … 615 649 return findFlags; 616 650 } 651 652 #include "UIVMLogViewerSearchPanel.moc" -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h
r70699 r70706 31 31 class UIRoundRectSegmentedButton; 32 32 class UISearchField; 33 class UIVMLogViewerSearchField; 33 34 class UIVMLogViewerWidget; 34 35 … … 104 105 QLabel *m_pSearchLabel; 105 106 /** Holds the instance of search-editor we create. */ 106 UI SearchField *m_pSearchEditor;107 UIVMLogViewerSearchField *m_pSearchEditor; 107 108 /** Holds the instance of next/back button-box we create. */ 108 109 UIRoundRectSegmentedButton *m_pNextPrevButtons;
Note:
See TracChangeset
for help on using the changeset viewer.