- Timestamp:
- Jul 25, 2007 8:24:03 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMLogViewer.ui.h
r3805 r3818 63 63 this, SLOT (findCurrent (const QString &))); 64 64 65 mButtonNext = new QToolButton (this); 66 mButtonNext->setEnabled (false); 67 mButtonNext->setAutoRaise (true); 68 mButtonNext->setFocusPolicy (QWidget::TabFocus); 69 mButtonNext->setUsesTextLabel (true); 70 mButtonNext->setTextPosition (QToolButton::BesideIcon); 71 connect (mButtonNext, SIGNAL (clicked()), this, SLOT (findNext())); 72 mButtonNext->setIconSet (VBoxGlobal::iconSet ("list_movedown_16px.png", 73 "list_movedown_disabled_16px.png")); 74 65 75 mButtonPrev = new QToolButton (this); 66 76 mButtonPrev->setEnabled (false); … … 72 82 mButtonPrev->setIconSet (VBoxGlobal::iconSet ("list_moveup_16px.png", 73 83 "list_moveup_disabled_16px.png")); 74 75 mButtonNext = new QToolButton (this);76 mButtonNext->setEnabled (false);77 mButtonNext->setAutoRaise (true);78 mButtonNext->setFocusPolicy (QWidget::TabFocus);79 mButtonNext->setUsesTextLabel (true);80 mButtonNext->setTextPosition (QToolButton::BesideIcon);81 connect (mButtonNext, SIGNAL (clicked()), this, SLOT (findNext()));82 mButtonNext->setIconSet (VBoxGlobal::iconSet ("list_movedown_16px.png",83 "list_movedown_disabled_16px.png"));84 84 85 85 mCaseSensitive = new QCheckBox (this); … … 117 117 118 118 setFocusProxy (mCaseSensitive); 119 qApp->installEventFilter (this); 119 120 120 121 languageChange(); … … 140 141 } 141 142 142 void setText (const QString &aText)143 {144 mSearchString->setText (aText);145 }146 147 143 private slots: 148 144 … … 173 169 { 174 170 QTextBrowser *browser = mViewer->currentLogPage(); 171 if (!browser) return; 172 175 173 int startPrg = 0, endPrg = 0; 176 174 int startInd = 0, endInd = 0; … … 196 194 browser->setSelection (paragraph, res, paragraph, 197 195 res + mSearchString->text().length()); 196 /* ensures the selected word visible */ 197 int curPrg = 0, curInd = 0; 198 browser->getCursorPosition (&curPrg, &curInd); 199 QRect rect = browser->paragraphRect (curPrg); 200 QString string = browser->text (curPrg); 201 string.truncate (curInd); 202 int x = rect.x() + browser->fontMetrics().width (string); 203 int y = rect.y() + browser->pointSize() / 2; 204 browser->ensureVisible (x, y, 40, 40); 198 205 break; 199 206 } … … 236 243 else if (e->state() == ControlButton && e->key() == Key_F) 237 244 { 238 mSearchString->setFocus(); 239 return true; 245 if (mViewer->currentLogPage()) 246 { 247 if (isHidden()) show(); 248 mSearchString->setFocus(); 249 return true; 250 } 251 } 252 /* processing the alpha-numeric keys as the shortcuts to the 253 * search panel displaying and search activation */ 254 else if (e->state() == 0 && 255 e->key() >= Qt::Key_Exclam && 256 e->key() <= Qt::Key_AsciiTilde) 257 { 258 if (mViewer->currentLogPage()) 259 { 260 if (isHidden()) show(); 261 mSearchString->setFocus(); 262 mSearchString->insert (e->text()); 263 return true; 264 } 240 265 } 241 266 … … 251 276 { 252 277 QWidget::showEvent (aEvent); 253 qApp->installEventFilter (this);254 278 mSearchString->setFocus(); 255 279 mSearchString->selectAll(); … … 260 284 if (focusData()->focusWidget()->parent() == this) 261 285 focusNextPrevChild (true); 262 qApp->removeEventFilter (this);263 286 QWidget::hideEvent (aEvent); 264 287 } … … 346 369 setTabOrder (mRefreshButton, mCloseButton); 347 370 setTabOrder (mCloseButton, mLogList); 371 372 /* make the [Save] button focused by default */ 373 mSaveButton->setFocus(); 348 374 349 375 /* applying language settings */ … … 478 504 } 479 505 } 480 if (aEvent->key() >= Qt::Key_Exclam &&481 aEvent->key() <= Qt::Key_AsciiTilde &&482 mLogList->isEnabled())483 {484 mSearchPanel->show();485 mSearchPanel->setText (aEvent->text());486 }487 }488 else if (aEvent->state() == Qt::ControlButton &&489 aEvent->key() == Qt::Key_F)490 {491 if (mLogList->isEnabled())492 mSearchPanel->show();493 506 } 494 507 else … … 529 542 /* clearing old data if any */ 530 543 mLogFilesList.clear(); 544 mLogList->setEnabled (true); 531 545 while (mLogList->count()) 532 546 { … … 624 638 QTextBrowser* VBoxVMLogViewer::currentLogPage() 625 639 { 626 return static_cast<QTextBrowser*> (mLogList->currentPage()); 640 return mLogList->isEnabled() ? 641 static_cast<QTextBrowser*> (mLogList->currentPage()) : 0; 627 642 } 628 643
Note:
See TracChangeset
for help on using the changeset viewer.