Changeset 103061 in vbox
- Timestamp:
- Jan 25, 2024 1:22:51 PM (12 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.cpp
r101560 r103061 31 31 #include <QStyle> 32 32 #include <QVBoxLayout> 33 #include <QWindow>34 33 35 34 /* GUI includes */ 36 35 #include "QIWithRetranslateUI.h" 37 36 #include "UICommon.h" 37 #include "UIDesktopWidgetWatchdog.h" 38 38 #include "UIIconPool.h" 39 39 #include "UIWelcomePane.h" 40 41 /* Forward declarations: */42 class QEvent;43 class QHBoxLayout;44 class QString;45 class QResizeEvent;46 class QVBoxLayout;47 40 48 41 … … 134 127 UIWelcomePane::UIWelcomePane(QWidget *pParent /* = 0 */) 135 128 : QIWithRetranslateUI<QWidget>(pParent) 136 , m_pLabel Text(0)129 , m_pLabelGreetings(0) 137 130 , m_pLabelIcon(0) 138 131 { 139 /* Prepare: */140 132 prepare(); 141 133 } … … 163 155 void UIWelcomePane::retranslateUi() 164 156 { 165 /* Translate welcometext: */166 m_pLabel Text->setText(tr("<h3>Welcome to VirtualBox!</h3>"167 "<p>The left part of application window contains global tools and "168 "lists all virtual machines and virtual machine groups on your computer. "169 "You can import, add and create new VMs using corresponding toolbar buttons. "170 "You can popup a tools of currently selected element using corresponding element button.</p>"171 "<p>You can press the <b>%1</b> key to get instant help, or visit "172 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> "173 "for more information and latest news.</p>")174 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText)));157 /* Translate greetings text: */ 158 m_pLabelGreetings->setText(tr("<h3>Welcome to VirtualBox!</h3>" 159 "<p>The left part of application window contains global tools and " 160 "lists all virtual machines and virtual machine groups on your computer. " 161 "You can import, add and create new VMs using corresponding toolbar buttons. " 162 "You can popup a tools of currently selected element using corresponding element button.</p>" 163 "<p>You can press the <b>%1</b> key to get instant help, or visit " 164 "<a href=https://www.virtualbox.org>www.virtualbox.org</a> " 165 "for more information and latest news.</p>") 166 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 175 167 } 176 168 … … 185 177 m_icon = UIIconPool::iconSet(":/tools_banner_global_200px.png"); 186 178 187 /* Create main layout: */179 /* Prepare main layout: */ 188 180 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 189 181 if (pMainLayout) 190 182 { 191 /* Create welcome layout: */183 /* Prepare welcome layout: */ 192 184 QHBoxLayout *pLayoutWelcome = new QHBoxLayout; 193 185 if (pLayoutWelcome) 194 186 { 195 /* Configure layout: */196 187 const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2; 197 188 pLayoutWelcome->setContentsMargins(iL, 0, 0, 0); 198 189 199 /* Create welcome textlabel: */200 m_pLabel Text = new UIWrappableLabel;201 if (m_pLabel Text)190 /* Prepare greetings label: */ 191 m_pLabelGreetings = new UIWrappableLabel(this); 192 if (m_pLabelGreetings) 202 193 { 203 /* Configure label: */ 204 m_pLabelText->setWordWrap(true); 205 m_pLabelText->setMinimumWidth(160); /// @todo make dynamic 206 m_pLabelText->setAlignment(Qt::AlignLeading | Qt::AlignTop); 207 m_pLabelText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 208 connect(m_pLabelText, &QLabel::linkActivated, this, &UIWelcomePane::sltHandleLinkActivated); 194 m_pLabelGreetings->setWordWrap(true); 195 m_pLabelGreetings->setMinimumWidth(160); /// @todo make dynamic 196 m_pLabelGreetings->setAlignment(Qt::AlignLeading | Qt::AlignTop); 197 m_pLabelGreetings->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 198 connect(m_pLabelGreetings, &QLabel::linkActivated, this, &UIWelcomePane::sltHandleLinkActivated); 209 199 210 200 /* Add into layout: */ 211 pLayoutWelcome->addWidget(m_pLabel Text);201 pLayoutWelcome->addWidget(m_pLabelGreetings); 212 202 } 213 203 214 /* Create welcome picturelabel: */215 m_pLabelIcon = new QLabel ;204 /* Prepare icon label: */ 205 m_pLabelIcon = new QLabel(this); 216 206 if (m_pLabelIcon) 217 207 { 218 /* Configure label: */219 208 m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 220 209 … … 232 221 } 233 222 223 /* Assign Help keyword: */ 234 224 uiCommon().setHelpKeyword(this, "intro-starting"); 235 225 … … 245 235 if (!m_icon.isNull()) 246 236 { 237 /* Check which size goes as the default one: */ 247 238 const QList<QSize> sizes = m_icon.availableSizes(); 248 const QSize firstOne = sizes.isEmpty() ? QSize(200, 200) : sizes.first(); 249 const qreal fDevicePixelRatio = window() && window()->windowHandle() ? window()->windowHandle()->devicePixelRatio() : 1; 250 m_pLabelIcon->setPixmap(m_icon.pixmap(QSize(firstOne.width(), firstOne.height()), fDevicePixelRatio)); 239 const QSize defaultSize = sizes.isEmpty() ? QSize(200, 200) : sizes.first(); 240 /* Acquire device-pixel ratio: */ 241 const qreal fDevicePixelRatio = gpDesktop->devicePixelRatio(this); 242 m_pLabelIcon->setPixmap(m_icon.pixmap(defaultSize, fDevicePixelRatio)); 251 243 } 252 244 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.h
r98103 r103061 76 76 QIcon m_icon; 77 77 78 /** Holds the textlabel instance. */79 QLabel *m_pLabel Text;78 /** Holds the greetings label instance. */ 79 QLabel *m_pLabelGreetings; 80 80 /** Holds the icon label instance. */ 81 81 QLabel *m_pLabelIcon;
Note:
See TracChangeset
for help on using the changeset viewer.