Changeset 57551 in vbox
- Timestamp:
- Aug 26, 2015 4:04:27 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.cpp
r57511 r57551 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Global includes*/22 /* Qt includes: */ 23 23 # include <QDir> 24 24 # include <QEvent> 25 # include <QLabel> 25 26 # include <QPainter> 26 # include <QLabel> 27 28 /* GUI includes: */ 29 # include "UIConverter.h" 30 # include "UIExtraDataManager.h" 31 # include "UIIconPool.h" 32 # include "VBoxAboutDlg.h" 33 # include "VBoxGlobal.h" 34 35 /* Other VBox includes: */ 27 36 # include <iprt/path.h> 28 37 # include <VBox/version.h> /* VBOX_VENDOR */ 29 38 30 /* Local includes */31 # include "VBoxAboutDlg.h"32 # include "VBoxGlobal.h"33 # include "UIConverter.h"34 # include "UIExtraDataManager.h"35 # include "UIIconPool.h"36 37 39 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 38 39 40 40 41 VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion) … … 42 43 , m_strVersion(strVersion) 43 44 { 44 /* Delete dialog on close: */ 45 setAttribute(Qt::WA_DeleteOnClose); 46 47 /* Choose default image: */ 48 QString strPath(":/about.png"); 49 50 /* Branding: Use a custom about splash picture if set: */ 51 QString strSplash = vboxGlobal().brandingGetKey("UI/AboutSplash"); 52 if (vboxGlobal().brandingIsActive() && !strSplash.isEmpty()) 53 { 54 char szExecPath[1024]; 55 RTPathExecDir(szExecPath, 1024); 56 QString strTmpPath = QString("%1/%2").arg(szExecPath).arg(strSplash); 57 if (QFile::exists(strTmpPath)) 58 strPath = strTmpPath; 59 } 60 61 /* Load image: */ 62 QIcon icon = UIIconPool::iconSet(strPath); 63 m_size = icon.availableSizes().first(); 64 m_pixmap = icon.pixmap(m_size); 65 66 /* Create main layout: */ 67 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 68 69 /* Create label for version text: */ 70 m_pLabel = new QLabel(); 71 pMainLayout->addWidget(m_pLabel); 72 73 QPalette palette; 74 /* Branding: Set a different text color (because splash also could be white), 75 * otherwise use white as default color: */ 76 QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor"); 77 if (!strColor.isEmpty()) 78 palette.setColor(QPalette::WindowText, QColor(strColor).name()); 79 else 80 palette.setColor(QPalette::WindowText, Qt::black); 81 m_pLabel->setPalette(palette); 82 m_pLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); 83 m_pLabel->setFont(font()); 84 85 pMainLayout->setAlignment(m_pLabel, Qt::AlignRight | Qt::AlignBottom); 86 87 /* Translate: */ 88 retranslateUi(); 45 /* Prepare: */ 46 prepare(); 89 47 } 90 48 … … 121 79 } 122 80 81 void VBoxAboutDlg::prepare() 82 { 83 /* Delete dialog on close: */ 84 setAttribute(Qt::WA_DeleteOnClose); 85 86 /* Choose default image: */ 87 QString strPath(":/about.png"); 88 89 /* Branding: Use a custom about splash picture if set: */ 90 QString strSplash = vboxGlobal().brandingGetKey("UI/AboutSplash"); 91 if (vboxGlobal().brandingIsActive() && !strSplash.isEmpty()) 92 { 93 char szExecPath[1024]; 94 RTPathExecDir(szExecPath, 1024); 95 QString strTmpPath = QString("%1/%2").arg(szExecPath).arg(strSplash); 96 if (QFile::exists(strTmpPath)) 97 strPath = strTmpPath; 98 } 99 100 /* Load image: */ 101 QIcon icon = UIIconPool::iconSet(strPath); 102 m_size = icon.availableSizes().first(); 103 m_pixmap = icon.pixmap(m_size); 104 105 /* Prepare main-layout: */ 106 prepareMainLayout(); 107 108 /* Translate: */ 109 retranslateUi(); 110 } 111 112 void VBoxAboutDlg::prepareMainLayout() 113 { 114 /* Create main-layout: */ 115 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 116 AssertPtrReturnVoid(pMainLayout); 117 { 118 /* Create label for version text: */ 119 m_pLabel = new QLabel; 120 AssertPtrReturnVoid(m_pLabel); 121 { 122 /* Prepare label for version text: */ 123 124 QPalette palette; 125 /* Branding: Set a different text color (because splash also could be white), 126 * otherwise use white as default color: */ 127 QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor"); 128 if (!strColor.isEmpty()) 129 palette.setColor(QPalette::WindowText, QColor(strColor).name()); 130 else 131 palette.setColor(QPalette::WindowText, Qt::black); 132 m_pLabel->setPalette(palette); 133 m_pLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); 134 m_pLabel->setFont(font()); 135 136 /* Add label to the main-layout: */ 137 pMainLayout->addWidget(m_pLabel); 138 pMainLayout->setAlignment(m_pLabel, Qt::AlignRight | Qt::AlignBottom); 139 } 140 } 141 } 142 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxAboutDlg.h
r57511 r57551 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ VBoxAboutDlg_h__19 #define __ VBoxAboutDlg_h__18 #ifndef ___VBoxAboutDlg_h___ 19 #define ___VBoxAboutDlg_h___ 20 20 21 /* Global includes*/21 /* Qt includes: */ 22 22 #include <QPixmap> 23 23 24 /* Local includes */ 24 /* GUI includes: */ 25 #include "QIDialog.h" 25 26 #include "QIWithRetranslateUI.h" 26 #include "QIDialog.h"27 27 28 /* Forward declarations */28 /* Forward declarations: */ 29 29 class QEvent; 30 30 class QLabel; 31 31 32 /* VBox about dialog */ 33 class VBoxAboutDlg: public QIWithRetranslateUI2<QIDialog> 32 /** QIDialog extension 33 * used to show the About-VirtualBox dialog. */ 34 class VBoxAboutDlg : public QIWithRetranslateUI2<QIDialog> 34 35 { 35 36 Q_OBJECT; … … 37 38 public: 38 39 39 /* Constructor: */ 40 /** Constructs dialog passing @a pParent to the QWidget base-class constructor. 41 * @param strVersion is used to specify the version number of VirtualBox. */ 40 42 VBoxAboutDlg(QWidget* pParent, const QString &strVersion); 41 43 42 44 protected: 43 45 44 /* Event handlers:*/46 /** Handles Qt polish event. */ 45 47 bool event(QEvent *pEvent); 48 49 /** Handles Qt paint-event to draw About-VirtualBox image. */ 46 50 void paintEvent(QPaintEvent *pEvent); 47 51 48 /* Language stuff:*/52 /** Handles translation event. */ 49 53 void retranslateUi(); 50 54 51 55 private: 52 56 53 /* Variables: */ 57 /** Prepare About-VirtualBox dialog. */ 58 void prepare(); 59 60 /** Prepare main-layout routine. */ 61 void prepareMainLayout(); 62 63 /** Holds the About-VirtualBox text. */ 54 64 QString m_strAboutText; 65 66 /** Holds the VirtualBox version number. */ 55 67 QString m_strVersion; 68 69 /** Holds the About-VirtualBox image. */ 56 70 QPixmap m_pixmap; 71 72 /** Holds the About-VirtualBox dialog size. */ 57 73 QSize m_size; 74 75 /** Holds the instance of label we create for About-VirtualBox text. */ 58 76 QLabel *m_pLabel; 59 77 }; 60 78 61 #endif /* __VBoxAboutDlg_h__ */79 #endif /* !___VBoxAboutDlg_h___ */ 62 80
Note:
See TracChangeset
for help on using the changeset viewer.