- Timestamp:
- Aug 2, 2017 10:23:07 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
r68200 r68235 186 186 <file alias="statusbar_settings_16px.png">images/statusbar_settings_16px.png</file> 187 187 <file alias="statusbar_settings_disabled_16px.png">images/statusbar_settings_disabled_16px.png</file> 188 <file alias="tools_200px.png">images/tools_200px.png</file> 188 189 <file alias="tools_global_32px.png">images/tools_global_32px.png</file> 189 190 <file alias="tools_machine_32px.png">images/tools_machine_32px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
r68200 r68235 195 195 <file alias="statusbar_settings_16px_hidpi.png">images/hidpi/statusbar_settings_16px_hidpi.png</file> 196 196 <file alias="statusbar_settings_disabled_16px_hidpi.png">images/hidpi/statusbar_settings_disabled_16px_hidpi.png</file> 197 <file alias="tools_200px_hidpi.png">images/hidpi/tools_200px_hidpi.png</file> 197 198 <file alias="tools_global_32px_hidpi.png">images/hidpi/tools_global_32px_hidpi.png</file> 198 199 <file alias="tools_machine_32px_hidpi.png">images/hidpi/tools_machine_32px_hidpi.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIDesktopPane.cpp
r68195 r68235 5 5 6 6 /* 7 * Copyright (C) 2010-201 6Oracle Corporation7 * Copyright (C) 2010-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 /* Qt includes: */ 23 23 # include <QAction> 24 # include <QGridLayout> 25 # include <QHBoxLayout> 24 26 # include <QLabel> 27 # include <QPainter> 25 28 # include <QStackedWidget> 29 # include <QStyle> 26 30 # include <QToolButton> 31 # include <QUuid> 27 32 # include <QVBoxLayout> 28 33 29 34 /* GUI includes */ 35 # include "QILabel.h" 30 36 # include "QIWithRetranslateUI.h" 31 37 # include "UIDesktopPane.h" 38 # include "UIIconPool.h" 32 39 # include "VBoxUtils.h" 33 40 … … 35 42 # include <iprt/assert.h> 36 43 44 /* Forward declarations: */ 45 class QEvent; 46 class QGridLayout; 47 class QHBoxLayout; 48 class QIcon; 49 class QLabel; 50 class QPaintEvent; 51 class QResizeEvent; 52 class QString; 53 class QUuid; 54 class QVBoxLayout; 55 class QWidget; 56 37 57 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 58 59 60 /** Our own skinnable implementation of tool widget header for UIDesktopPane. */ 61 class UIToolWidgetHeader : public QLabel 62 { 63 Q_OBJECT; 64 65 public: 66 67 /** Constructs tool widget header passing @a pParent to the base-class. */ 68 UIToolWidgetHeader(QWidget *pParent = 0); 69 70 protected: 71 72 /** Handles resuze @a pEvent. */ 73 virtual void resizeEvent(QResizeEvent *pEvent) /* override */; 74 75 /** Handles paint @a pEvent. */ 76 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 77 }; 78 79 80 /** Our own skinnable implementation of tool widget for UIDesktopPane. */ 81 class UIToolWidget : public QWidget 82 { 83 Q_OBJECT; 84 85 public: 86 87 /** Constructs tool widget on the basis of passed @a pAction and @a strDescription. */ 88 UIToolWidget(QAction *pAction, const QString &strDescription); 89 90 protected: 91 92 /** Handles any Qt @a pEvent. */ 93 virtual bool event(QEvent *pEvent) /* override */; 94 95 /** Handles paint @a pEvent. */ 96 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 97 98 private: 99 100 /** Prepares all. */ 101 void prepare(); 102 103 /** Holds the action reference. */ 104 QAction *m_pAction; 105 /** Holds the widget description. */ 106 QString m_strDescription; 107 108 /** Holds whether the widget is hovered. */ 109 bool m_fHovered; 110 111 /** Holds the main layout instance. */ 112 QGridLayout *m_pLayout; 113 /** Holds the icon label instance. */ 114 QLabel *m_pLabelIcon; 115 /** Holds the name label instance. */ 116 QLabel *m_pLabelName; 117 /** Holds the description label instance. */ 118 QILabel *m_pLabelDescription; 119 }; 38 120 39 121 … … 57 139 void setError(const QString &strError); 58 140 141 /** Defines a tools pane welcome @a strText. */ 142 void setToolsPaneText(const QString &strText); 143 /** Add a tool element. 144 * @param pAction Brings tool action reference. 145 * @param strDescription Brings the tool description. */ 146 void addToolDescription(QAction *pAction, const QString &strDescription); 147 /** Removes all tool elements. */ 148 void removeToolDescriptions(); 149 59 150 protected: 60 151 … … 66 157 /** Prepares error pane. */ 67 158 void prepareErrorPane(); 159 160 /** Prepares tools pane. */ 161 void prepareToolsPane(); 68 162 69 163 private: … … 82 176 /** Holds the VM refresh action reference. */ 83 177 QAction *m_pRefreshAction; 178 179 /** Holds the tools pane instance. */ 180 QWidget *m_pToolsPane; 181 /** Holds the tools pane widget layout instance. */ 182 QVBoxLayout *m_pLayoutWidget; 183 /** Holds the tools pane text label instance. */ 184 QILabel *m_pLabelToolsPaneText; 84 185 }; 186 187 188 /********************************************************************************************************************************* 189 * Class UIToolWidgetHeader implementation. * 190 *********************************************************************************************************************************/ 191 192 UIToolWidgetHeader::UIToolWidgetHeader(QWidget *pParent /* = 0 */) 193 : QLabel(pParent) 194 { 195 } 196 197 void UIToolWidgetHeader::resizeEvent(QResizeEvent *pEvent) 198 { 199 /* Call to base-class: */ 200 QLabel::resizeEvent(pEvent); 201 202 #if 0 203 /* Get basic palette: */ 204 QPalette pal = qApp->palette(); 205 206 /* Prepare new foreground: */ 207 const QColor color0 = pal.color(QPalette::Active, QPalette::HighlightedText); 208 const QColor color1 = pal.color(QPalette::Active, QPalette::WindowText); 209 QLinearGradient grad(QPointF(0, 0), QPointF(width(), height())); 210 { 211 grad.setColorAt(0, color0); 212 grad.setColorAt(1, color1); 213 } 214 215 /* Apply palette changes: */ 216 pal.setBrush(QPalette::Active, QPalette::WindowText, grad); 217 setPalette(pal); 218 #endif 219 } 220 221 void UIToolWidgetHeader::paintEvent(QPaintEvent *pEvent) 222 { 223 /* Prepare painter: */ 224 QPainter painter(this); 225 226 /* Prepare palette colors: */ 227 const QPalette pal = palette(); 228 const QColor color0 = pal.color(QPalette::Highlight).lighter(130); 229 QColor color1 = color0; 230 color1.setAlpha(0); 231 232 /* Prepare background: */ 233 QLinearGradient grad(QPointF(0, 0), QPointF(width(), height())); 234 { 235 grad.setColorAt(0, color1); 236 grad.setColorAt(0.2, color0); 237 grad.setColorAt(1, color1); 238 } 239 240 /* Paint background: */ 241 painter.fillRect(QRect(0, 0, width(), height()), grad); 242 243 /* Call to base-class: */ 244 QLabel::paintEvent(pEvent); 245 } 246 247 248 /********************************************************************************************************************************* 249 * Class UIToolWidget implementation. * 250 *********************************************************************************************************************************/ 251 252 UIToolWidget::UIToolWidget(QAction *pAction, const QString &strDescription) 253 : m_pAction(pAction) 254 , m_strDescription(strDescription) 255 , m_fHovered(false) 256 , m_pLayout(0) 257 , m_pLabelIcon(0) 258 , m_pLabelName(0) 259 , m_pLabelDescription(0) 260 { 261 /* Prepare: */ 262 prepare(); 263 } 264 265 bool UIToolWidget::event(QEvent *pEvent) 266 { 267 /* Handle known event types: */ 268 switch (pEvent->type()) 269 { 270 /* Update the hovered state on/off: */ 271 case QEvent::Enter: 272 { 273 m_fHovered = true; 274 update(); 275 break; 276 } 277 case QEvent::Leave: 278 { 279 m_fHovered = false; 280 update(); 281 break; 282 } 283 284 /* Notify listeners about the item was clicked: */ 285 case QEvent::MouseButtonRelease: 286 { 287 m_pAction->trigger(); 288 break; 289 } 290 291 default: 292 break; 293 } 294 /* Call to base-class: */ 295 return QWidget::event(pEvent); 296 } 297 298 void UIToolWidget::paintEvent(QPaintEvent * /* pEvent */) 299 { 300 /* Prepare painter: */ 301 QPainter painter(this); 302 303 /* Prepare palette colors: */ 304 const QPalette pal = palette(); 305 const QColor color0 = m_fHovered 306 ? pal.color(QPalette::Highlight).lighter(160) 307 : pal.color(QPalette::Base); 308 const QColor color1 = color0.lighter(120); 309 QColor color2 = pal.color(QPalette::Window).lighter(110); 310 color2.setAlpha(0); 311 QColor color3 = pal.color(QPalette::Window).darker(200); 312 313 /* Invent pixel metric: */ 314 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 315 316 /* Background gradient: */ 317 QLinearGradient grad(QPointF(0, height()), QPointF(0, 0)); 318 { 319 grad.setColorAt(0, color0); 320 grad.setColorAt(1, color1); 321 } 322 323 /* Top-left corner: */ 324 QRadialGradient grad1(QPointF(iMetric, iMetric), iMetric); 325 { 326 grad1.setColorAt(0, color3); 327 grad1.setColorAt(1, color2); 328 } 329 /* Top-right corner: */ 330 QRadialGradient grad2(QPointF(width() - iMetric, iMetric), iMetric); 331 { 332 grad2.setColorAt(0, color3); 333 grad2.setColorAt(1, color2); 334 } 335 /* Bottom-left corner: */ 336 QRadialGradient grad3(QPointF(iMetric, height() - iMetric), iMetric); 337 { 338 grad3.setColorAt(0, color3); 339 grad3.setColorAt(1, color2); 340 } 341 /* Botom-right corner: */ 342 QRadialGradient grad4(QPointF(width() - iMetric, height() - iMetric), iMetric); 343 { 344 grad4.setColorAt(0, color3); 345 grad4.setColorAt(1, color2); 346 } 347 348 /* Top line: */ 349 QLinearGradient grad5(QPointF(iMetric, 0), QPointF(iMetric, iMetric)); 350 { 351 grad5.setColorAt(0, color2); 352 grad5.setColorAt(1, color3); 353 } 354 /* Bottom line: */ 355 QLinearGradient grad6(QPointF(iMetric, height()), QPointF(iMetric, height() - iMetric)); 356 { 357 grad6.setColorAt(0, color2); 358 grad6.setColorAt(1, color3); 359 } 360 /* Left line: */ 361 QLinearGradient grad7(QPointF(0, height() - iMetric), QPointF(iMetric, height() - iMetric)); 362 { 363 grad7.setColorAt(0, color2); 364 grad7.setColorAt(1, color3); 365 } 366 /* Right line: */ 367 QLinearGradient grad8(QPointF(width(), height() - iMetric), QPointF(width() - iMetric, height() - iMetric)); 368 { 369 grad8.setColorAt(0, color2); 370 grad8.setColorAt(1, color3); 371 } 372 373 /* Paint shape/shadow: */ 374 painter.fillRect(QRect(iMetric, iMetric, width() - iMetric * 2, height() - iMetric * 2), grad); 375 painter.fillRect(QRect(0, 0, iMetric, iMetric), grad1); 376 painter.fillRect(QRect(width() - iMetric, 0, iMetric, iMetric), grad2); 377 painter.fillRect(QRect(0, height() - iMetric, iMetric, iMetric), grad3); 378 painter.fillRect(QRect(width() - iMetric, height() - iMetric, iMetric, iMetric), grad4); 379 painter.fillRect(QRect(iMetric, 0, width() - iMetric * 2, iMetric), grad5); 380 painter.fillRect(QRect(iMetric, height() - iMetric, width() - iMetric * 2, iMetric), grad6); 381 painter.fillRect(QRect(0, iMetric, iMetric, height() - iMetric * 2), grad7); 382 painter.fillRect(QRect(width() - iMetric, iMetric, iMetric, height() - iMetric * 2), grad8); 383 } 384 385 void UIToolWidget::prepare() 386 { 387 /* Configure self: */ 388 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 389 390 /* Create main layout: */ 391 m_pLayout = new QGridLayout(this); 392 AssertPtrReturnVoid(m_pLayout); 393 { 394 /* Invent pixel metric: */ 395 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) * 1.375; 396 const int iMargin = iMetric / 2; 397 const int iSpacing = iMargin / 2; 398 399 /* Configure layout: */ 400 m_pLayout->setContentsMargins(iMargin + iSpacing, iMargin, iMargin, iMargin); 401 m_pLayout->setSpacing(iSpacing); 402 403 /* Create name label: */ 404 m_pLabelName = new UIToolWidgetHeader; 405 AssertPtrReturnVoid(m_pLabelName); 406 { 407 /* Configure label: */ 408 QFont fontLabel = m_pLabelName->font(); 409 fontLabel.setBold(true); 410 m_pLabelName->setFont(fontLabel); 411 m_pLabelName->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 412 m_pLabelName->setText(QString("%1 ").arg(m_pAction->text().remove('&'))); 413 414 /* Add into layout: */ 415 m_pLayout->addWidget(m_pLabelName, 0, 0); 416 } 417 418 /* Create description label: */ 419 m_pLabelDescription = new QILabel; 420 AssertPtrReturnVoid(m_pLabelDescription); 421 { 422 /* Configure label: */ 423 m_pLabelDescription->setAttribute(Qt::WA_TransparentForMouseEvents); 424 m_pLabelDescription->setWordWrap(true); 425 m_pLabelDescription->useSizeHintForWidth(400); 426 m_pLabelDescription->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); 427 m_pLabelDescription->setText(m_strDescription); 428 429 /* Add into layout: */ 430 m_pLayout->addWidget(m_pLabelDescription, 1, 0); 431 } 432 433 /* Create icon label: */ 434 m_pLabelIcon = new QLabel; 435 AssertPtrReturnVoid(m_pLabelIcon); 436 { 437 /* Configure label: */ 438 m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 439 m_pLabelIcon->setPixmap(m_pAction->icon().pixmap(iMetric)); 440 441 /* Add into layout: */ 442 m_pLayout->addWidget(m_pLabelIcon, 0, 1, 2, 1); 443 m_pLayout->setAlignment(m_pLabelIcon, Qt::AlignHCenter | Qt::AlignTop); 444 } 445 } 446 } 85 447 86 448 … … 94 456 , m_pErrBox(0), m_pErrLabel(0), m_pErrText(0) 95 457 , m_pRefreshButton(0), m_pRefreshAction(pRefreshAction) 458 , m_pToolsPane(0), m_pLayoutWidget(0), m_pLabelToolsPaneText(0) 96 459 { 97 460 /* Translate finally: */ … … 121 484 /* Raise corresponding widget: */ 122 485 setCurrentIndex(indexOf(m_pErrBox)); 486 } 487 488 void UIDesktopPanePrivate::setToolsPaneText(const QString &strText) 489 { 490 /* Prepare tools pane if necessary: */ 491 prepareToolsPane(); 492 493 /* Assign corresponding text: */ 494 m_pLabelToolsPaneText->setText(strText); 495 496 /* Raise corresponding widget: */ 497 setCurrentWidget(m_pToolsPane); 498 } 499 500 void UIDesktopPanePrivate::addToolDescription(QAction *pAction, const QString &strDescription) 501 { 502 /* Prepare tools pane if necessary: */ 503 prepareToolsPane(); 504 505 /* Add tool widget on the basis of passed description: */ 506 UIToolWidget *pWidget = new UIToolWidget(pAction, strDescription); 507 AssertPtrReturnVoid(pWidget); 508 { 509 /* Add into layout: */ 510 m_pLayoutWidget->addWidget(pWidget); 511 } 512 513 /* Raise corresponding widget: */ 514 setCurrentWidget(m_pToolsPane); 515 } 516 517 void UIDesktopPanePrivate::removeToolDescriptions() 518 { 519 /* Clear the layout: */ 520 QLayoutItem *pChild = 0; 521 while ((pChild = m_pLayoutWidget->takeAt(0)) != 0) 522 delete pChild; 123 523 } 124 524 … … 219 619 } 220 620 621 void UIDesktopPanePrivate::prepareToolsPane() 622 { 623 /* Do nothing if already exists: */ 624 if (m_pToolsPane) 625 return; 626 627 /* Create tool pane: */ 628 m_pToolsPane = new QWidget; 629 AssertPtrReturnVoid(m_pToolsPane); 630 { 631 /* Create main layout: */ 632 QVBoxLayout *pMainLayout = new QVBoxLayout(m_pToolsPane); 633 AssertPtrReturnVoid(pMainLayout); 634 { 635 /* Create welcome layout: */ 636 QHBoxLayout *pLayoutWelcome = new QHBoxLayout; 637 AssertPtrReturnVoid(pLayoutWelcome); 638 { 639 /* Invent pixel metric: */ 640 const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4; 641 642 /* Configure layout: */ 643 pLayoutWelcome->setContentsMargins(iMetric, 0, 0, 0); 644 pLayoutWelcome->setSpacing(10); 645 646 /* Create welcome text label: */ 647 m_pLabelToolsPaneText = new QILabel; 648 AssertPtrReturnVoid(m_pLabelToolsPaneText); 649 { 650 /* Configure label: */ 651 m_pLabelToolsPaneText->setWordWrap(true); 652 m_pLabelToolsPaneText->useSizeHintForWidth(200); 653 m_pLabelToolsPaneText->setAlignment(Qt::AlignLeading | Qt::AlignTop); 654 m_pLabelToolsPaneText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 655 656 /* Add into layout: */ 657 pLayoutWelcome->addWidget(m_pLabelToolsPaneText); 658 } 659 660 /* Create picture label: */ 661 QLabel *pLabelPicture = new QLabel; 662 AssertPtrReturnVoid(pLabelPicture); 663 { 664 /* Configure label: */ 665 const QIcon icon = UIIconPool::iconSet(":/tools_200px.png"); 666 pLabelPicture->setPixmap(icon.pixmap(QSize(200, 200))); 667 pLabelPicture->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 668 669 /* Add into layout: */ 670 pLayoutWelcome->addWidget(pLabelPicture); 671 pLayoutWelcome->setAlignment(pLabelPicture, Qt::AlignHCenter | Qt::AlignTop); 672 } 673 674 /* Add into layout: */ 675 pMainLayout->addLayout(pLayoutWelcome); 676 } 677 678 /* Create widget layout: */ 679 m_pLayoutWidget = new QVBoxLayout(m_pToolsPane); 680 AssertPtrReturnVoid(m_pLayoutWidget); 681 { 682 /* Add into layout: */ 683 pMainLayout->addLayout(m_pLayoutWidget); 684 } 685 686 /* Add stretch: */ 687 pMainLayout->addStretch(); 688 } 689 690 /* Add into the stack: */ 691 addWidget(m_pToolsPane); 692 } 693 } 694 221 695 222 696 /********************************************************************************************************************************* … … 248 722 } 249 723 724 void UIDesktopPane::setToolsPaneText(const QString &strText) 725 { 726 m_pDesktopPrivate->setToolsPaneText(strText); 727 } 728 729 void UIDesktopPane::addToolDescription(QAction *pAction, const QString &strDescription) 730 { 731 m_pDesktopPrivate->addToolDescription(pAction, strDescription); 732 } 733 734 void UIDesktopPane::removeToolDescriptions() 735 { 736 m_pDesktopPrivate->removeToolDescriptions(); 737 } 738 250 739 #include "UIDesktopPane.moc" 251 740 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIDesktopPane.h
r68195 r68235 5 5 6 6 /* 7 * Copyright (C) 2010-201 6Oracle Corporation7 * Copyright (C) 2010-2017 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 23 23 24 24 /* Forward declarations: */ 25 class QAction; 25 26 class UIDesktopPanePrivate; 26 27 … … 45 46 void updateDetailsError(const QString &strError); 46 47 48 /** Defines a tools pane welcome @a strText. */ 49 void setToolsPaneText(const QString &strText); 50 /** Add a tool element. 51 * @param pAction Brings tool action reference. 52 * @param strDescription Brings the tool description. */ 53 void addToolDescription(QAction *pAction, const QString &strDescription); 54 /** Removes all tool elements. */ 55 void removeToolDescriptions(); 56 47 57 private: 48 58 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68230 r68235 1159 1159 setWindowTitle(strTitle); 1160 1160 1161 /* Translate Machine Tools welcome screen: */1162 m_pPaneToolsMachine->setDetailsText(1163 tr("<h3>Welcome to VirtualBox!</h3>"1164 "<p>The left part of this window is a list of all virtual machines "1165 "and virtual machine groups on your computer. "1166 "<img src=:/welcome.png align=right/></p>"1167 "<p>The right part of this window represents a set of tools "1168 "you have opened for the currently chosen machine. "1169 "For more tools check the corresponding menu at the right side "1170 "of the main tool bar located at the top of the window.</p>"1171 "<p>You can press the <b>%1</b> key to get instant help, "1172 "or visit "1173 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "1174 "for the latest information and news.</p>")1175 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));1176 1177 /* Translate Global Tools welcome screen: */1178 m_pPaneToolsGlobal->setDetailsText(1179 tr("<h3>Welcome to VirtualBox!</h3>"1180 "<p>This window represents a set of global tools "1181 "you have opened. They are not related to any particular machine "1182 "but to whole VirtualBox instead. This list will be extended with "1183 "new tools in the future releases. "1184 "<img src=:/welcome.png align=right/></p>"1185 "For more tools check the corresponding menu at the right side "1186 "of the main tool bar located at the top of the window.</p>"1187 "<p>You can press the <b>%1</b> key to get instant help, "1188 "or visit "1189 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "1190 "for the latest information and news.</p>")1191 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));1192 1193 1161 /* Make sure details and snapshot panes are updated: */ 1194 1162 sltHandleChooserPaneIndexChange(false /* update details? */, false /* update snapshots? */); … … 1940 1908 #endif 1941 1909 1942 /* Prepare Chooser-pane: */1910 /* Create Chooser-pane: */ 1943 1911 m_pPaneChooser = new UIGChooser(this); 1944 1912 AssertPtrReturnVoid(m_pPaneChooser); … … 1948 1916 } 1949 1917 1950 /* Prepare Machine Tools-pane: */1918 /* Create Machine Tools-pane: */ 1951 1919 m_pPaneToolsMachine = new UIToolsPaneMachine(actionPool()); 1952 1920 AssertPtrReturnVoid(m_pPaneToolsMachine); … … 1964 1932 } 1965 1933 1966 /* Prepare Global Tools-pane: */1934 /* Create Global Tools-pane: */ 1967 1935 m_pPaneToolsGlobal = new UIToolsPaneGlobal(actionPool()); 1968 1936 AssertPtrReturnVoid(m_pPaneToolsGlobal); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.cpp
r68221 r68235 22 22 /* Qt includes: */ 23 23 # include <QStackedLayout> 24 # include <QUuid> 24 25 25 26 /* GUI includes */ … … 37 38 38 39 UIToolsPaneGlobal::UIToolsPaneGlobal(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 39 : Q Widget(pParent)40 : QIWithRetranslateUI<QWidget>(pParent) 40 41 , m_pActionPool(pActionPool) 41 42 , m_pLayout(0) … … 169 170 /* Update desktop pane: */ 170 171 AssertPtrReturnVoid(m_pPaneDesktop); 171 m_pPaneDesktop-> updateDetailsText(strText);172 m_pPaneDesktop->setToolsPaneText(strText); 172 173 } 173 174 … … 179 180 } 180 181 182 void UIToolsPaneGlobal::retranslateUi() 183 { 184 /* Translate Global Tools welcome screen: */ 185 setDetailsText( 186 tr("<h3>Welcome to VirtualBox!</h3>" 187 "<p>This window represents a set of global tools " 188 "which are currently opened (or can be opened). " 189 "They are not related to any particular machine but " 190 "to whole VirtualBox instead. For list of currently " 191 "available tools check the corresponding menu at the right " 192 "side of the main tool bar located at the top of the window. " 193 "This list will be extended with new tools in the future releases.</p>" 194 "<p>You can press the <b>%1</b> key to get instant help, or visit " 195 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> " 196 "for the latest information and news.</p>") 197 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 198 199 /* Wipe out the tool descriptions: */ 200 m_pPaneDesktop->removeToolDescriptions(); 201 202 /* Add tool descriptions: */ 203 QAction *pAction1 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager); 204 m_pPaneDesktop->addToolDescription(pAction1, 205 tr("Tool to observe virtual storage media. " 206 "Reflects all the chains of <u>virtual disks</u> you have registered " 207 "(per each storage type) within your virtual machines and allows for media " 208 "manipulations like possibility to <u>copy</u>, <u>remove</u>, <u>release</u> " 209 "(detach from VMs it currently attached to) and observe their properties. " 210 "Allows to <u>edit</u> medium attributes like <u>type</u>, " 211 "<u>location/name</u>, <u>description</u> and <u>size</u> (for dynamical storages " 212 "only).")); 213 QAction *pAction2 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager); 214 m_pPaneDesktop->addToolDescription(pAction2, 215 tr("Tool to control host-only network interfaces. " 216 "Reflects <u>host-only networks</u>, their DHCP servers and allows " 217 "for network manipulations like possibility to <u>create</u>, <u>remove</u> " 218 "and observe their properties. Allows to <u>edit</u> various " 219 "<u>attributes</u> for host-only interface and corresponding DHCP server.")); 220 } 221 181 222 void UIToolsPaneGlobal::prepare() 182 223 { … … 192 233 /* Create desktop pane: */ 193 234 openTool(ToolTypeGlobal_Desktop); 235 236 /* Apply language settings: */ 237 retranslateUi(); 194 238 } 195 239 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.h
r68221 r68235 21 21 /* Qt includes: */ 22 22 #include <QWidget> 23 24 /* GUI includes: */ 25 #include "QIWithRetranslateUI.h" 23 26 24 27 /* Forward declarations: */ … … 48 51 49 52 /** QWidget subclass representing container for tool panes. */ 50 class UIToolsPaneGlobal : public Q Widget53 class UIToolsPaneGlobal : public QIWithRetranslateUI<QWidget> 51 54 { 52 55 Q_OBJECT; … … 72 75 /** Defines @a strError and switches to error details pane. */ 73 76 void setDetailsError(const QString &strError); 77 78 protected: 79 80 /** Handles translation event. */ 81 virtual void retranslateUi() /* override */; 74 82 75 83 private: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.cpp
r68221 r68235 22 22 /* Qt includes: */ 23 23 # include <QStackedLayout> 24 # include <QUuid> 24 25 25 26 /* GUI includes */ … … 37 38 38 39 UIToolsPaneMachine::UIToolsPaneMachine(UIActionPool *pActionPool, QWidget *pParent /* = 0 */) 39 : Q Widget(pParent)40 : QIWithRetranslateUI<QWidget>(pParent) 40 41 , m_pActionPool(pActionPool) 41 42 , m_pLayout(0) … … 173 174 /* Update desktop pane: */ 174 175 AssertPtrReturnVoid(m_pPaneDesktop); 175 m_pPaneDesktop-> updateDetailsText(strText);176 m_pPaneDesktop->setToolsPaneText(strText); 176 177 } 177 178 … … 197 198 } 198 199 200 void UIToolsPaneMachine::retranslateUi() 201 { 202 /* Translate Machine Tools welcome screen: */ 203 setDetailsText( 204 tr("<h3>Welcome to VirtualBox!</h3>" 205 "<p>The left part of this window is a list of all virtual " 206 "machines and virtual machine groups on your computer.</p>" 207 "<p>The right part of this window represents a set of " 208 "tools which are currently opened (or can be opened) for " 209 "the currently chosen machine. For list of currently " 210 "available tools check the corresponding menu at the right " 211 "side of the main tool bar located at the top of the window. " 212 "This list will be extended with new tools in the future releases.</p>" 213 "<p>You can press the <b>%1</b> key to get instant help, or visit " 214 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> " 215 "for the latest information and news.</p>") 216 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 217 218 /* Wipe out the tool descriptions: */ 219 m_pPaneDesktop->removeToolDescriptions(); 220 221 /* Add tool descriptions: */ 222 QAction *pAction1 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine_Details); 223 m_pPaneDesktop->addToolDescription(pAction1, 224 tr("Tool to observe virtual machine (VM) details. " 225 "Reflects groups of <u>properties</u> for the currently chosen VM and allows " 226 "for basic manipulations on few of them (like the machine storage devices).")); 227 QAction *pAction2 = m_pActionPool->action(UIActionIndexST_M_Tools_M_Machine_Snapshots); 228 m_pPaneDesktop->addToolDescription(pAction2, 229 tr("Tool to control virtual machine (VM) snapshots. " 230 "Reflects <u>snapshots</u> created for the currently chosen VM and allows " 231 "for snapshot manipulations like possibility to <u>create</u>, <u>remove</u>, " 232 "<u>restore</u> (make current) and observe their properties. Allows to " 233 "<u>edit</u> snapshot attributes like <u>name</u> and <u>description</u>.")); 234 } 235 199 236 void UIToolsPaneMachine::prepare() 200 237 { … … 210 247 /* Create desktop pane: */ 211 248 openTool(ToolTypeMachine_Desktop); 249 250 /* Apply language settings: */ 251 retranslateUi(); 212 252 } 213 253 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.h
r68221 r68235 21 21 /* Qt includes: */ 22 22 #include <QWidget> 23 24 /* GUI includes: */ 25 #include "QIWithRetranslateUI.h" 23 26 24 27 /* Forward declarations: */ … … 48 51 49 52 /** QWidget subclass representing container for tool panes. */ 50 class UIToolsPaneMachine : public Q Widget53 class UIToolsPaneMachine : public QIWithRetranslateUI<QWidget> 51 54 { 52 55 Q_OBJECT; … … 90 93 void setMachine(const CMachine &comMachine); 91 94 95 protected: 96 97 /** Handles translation event. */ 98 virtual void retranslateUi() /* override */; 99 92 100 private: 93 101
Note:
See TracChangeset
for help on using the changeset viewer.