20
20
#ifdef VBOX_WITH_PRECOMPILED_HEADERS
21
21
# include "precomp.h"
22
22
#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
23
#include "VBoxAboutDlg.h"
24
#include "VBoxGlobal.h"
26
#include <iprt/path.h>
27
#include <VBox/version.h> /* VBOX_VENDOR */
27
# include <iprt/path.h>
28
# include <VBox/version.h> /* VBOX_VENDOR */
31
# include "VBoxAboutDlg.h"
32
# include "VBoxGlobal.h"
33
33
#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
35
VBoxAboutDlg::VBoxAboutDlg (QWidget* aParent, const QString &aVersion)
36
: QIWithRetranslateUI2 <QIDialog> (aParent, Qt::CustomizeWindowHint |
37
Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
35
VBoxAboutDlg::VBoxAboutDlg(QWidget *pParent, const QString &strVersion)
36
: QIWithRetranslateUI2<QIDialog>(pParent, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
37
, m_strVersion(strVersion)
42
QString sPath (":/about.png");
43
/* Branding: Use a custom about splash picture if set */
44
QString sSplash = vboxGlobal().brandingGetKey ("UI/AboutSplash");
45
if (vboxGlobal().brandingIsActive() && !sSplash.isEmpty())
39
/* Delete dialog on close: */
40
setAttribute(Qt::WA_DeleteOnClose);
42
/* Choose default image: */
43
QString strPath(":/about.png");
45
/* Branding: Use a custom about splash picture if set: */
46
QString strSplash = vboxGlobal().brandingGetKey("UI/AboutSplash");
47
if (vboxGlobal().brandingIsActive() && !strSplash.isEmpty())
47
49
char szExecPath[1024];
48
RTPathExecDir (szExecPath, 1024);
49
QString tmpPath = QString ("%1/%2").arg (szExecPath).arg (sSplash);
50
if (QFile::exists (tmpPath))
50
RTPathExecDir(szExecPath, 1024);
51
QString strTmpPath = QString("%1/%2").arg(szExecPath).arg(strSplash);
52
if (QFile::exists(strTmpPath))
54
mBgImage.load (sPath);
57
bool VBoxAboutDlg::event (QEvent *aEvent)
59
if (aEvent->type() == QEvent::Polish)
60
setFixedSize (mBgImage.size());
61
return QIDialog::event (aEvent);
57
m_bgImage.load(strPath);
63
bool VBoxAboutDlg::event(QEvent *pEvent)
65
if (pEvent->type() == QEvent::Polish)
66
setFixedSize(m_bgImage.size());
67
if (pEvent->type() == QEvent::WindowDeactivate)
69
return QIDialog::event(pEvent);
72
void VBoxAboutDlg::paintEvent(QPaintEvent* /* pEvent */)
74
QPainter painter(this);
75
painter.drawPixmap(0, 0, m_bgImage);
76
painter.setFont(font());
78
/* Branding: Set a different text color (because splash also could be white),
79
otherwise use white as default color: */
80
QString strColor = vboxGlobal().brandingGetKey("UI/AboutTextColor");
81
if (!strColor.isEmpty())
82
painter.setPen(QColor(strColor).name());
84
painter.setPen(Qt::black);
86
painter.drawText(QRect(0, 400, 600, 32),
87
Qt::AlignCenter | Qt::AlignVCenter | Qt::TextWordWrap,
90
painter.drawText(QRect(271, 370, 360, 72),
91
Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap,
96
void VBoxAboutDlg::mouseReleaseEvent(QMouseEvent* /* pEvent */)
98
/* Close the dialog on mouse button release: */
64
102
void VBoxAboutDlg::retranslateUi()
66
setWindowTitle (tr ("VirtualBox - About"));
67
QString aboutText = tr ("VirtualBox Graphical User Interface");
104
setWindowTitle(tr("VirtualBox - About"));
105
QString strAboutText = tr("VirtualBox Graphical User Interface");
68
106
#ifdef VBOX_BLEEDING_EDGE
69
QString versionText = "EXPERIMENTAL build %1 - " + QString(VBOX_BLEEDING_EDGE);
107
QString strVersionText = "EXPERIMENTAL build %1 - " + QString(VBOX_BLEEDING_EDGE);
71
QString versionText = tr ("Version %1");
109
QString strVersionText = tr("Version %1");
74
mAboutText = aboutText + " " + versionText.arg (mVersion) + "\n" +
75
QString ("%1 2004-" VBOX_C_YEAR " " VBOX_VENDOR).arg (QChar (0xa9));
77
mAboutText = aboutText + "\n" +
78
versionText.arg (mVersion);
82
void VBoxAboutDlg::paintEvent (QPaintEvent * /* aEvent */)
84
QPainter painter (this);
85
painter.drawPixmap (0, 0, mBgImage);
86
painter.setFont (font());
88
/* Branding: Set a different text color (because splash also could be white),
89
otherwise use white as default color */
90
QString sColor = vboxGlobal().brandingGetKey("UI/AboutTextColor");
91
if (!sColor.isEmpty())
92
painter.setPen (QColor(sColor).name());
94
painter.setPen (Qt::black);
96
painter.drawText (QRect (0, 400, 600, 32),
97
Qt::AlignCenter | Qt::AlignVCenter | Qt::TextWordWrap,
100
painter.drawText (QRect (271, 370, 360, 72),
101
Qt::AlignLeft | Qt::AlignBottom | Qt::TextWordWrap,
103
#endif /* VBOX_OSE */
106
void VBoxAboutDlg::mouseReleaseEvent (QMouseEvent * /* aEvent */)
108
/* close the dialog on mouse button release */
112
m_strAboutText = strAboutText + " " + strVersionText.arg(m_strVersion) + "\n" +
113
QString("%1 2004-" VBOX_C_YEAR " " VBOX_VENDOR).arg(QChar(0xa9));
115
m_strAboutText = strAboutText + "\n" + strVersionText.arg(m_strVersion);
116
#endif /* VBOX_OSE */