- Timestamp:
- Jan 26, 2024 5:09:05 PM (13 months ago)
- svn:sync-xref-src-repo-rev:
- 161340
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.cpp
r103093 r103094 27 27 28 28 /* Qt includes: */ 29 #include <QButtonGroup> 29 30 #include <QGridLayout> 30 31 #include <QLabel> 32 #include <QPushButton> 31 33 #include <QStyle> 32 34 #include <QUrl> … … 37 39 #include "UICommon.h" 38 40 #include "UIDesktopWidgetWatchdog.h" 41 #include "UIExtraDataManager.h" 39 42 #include "UIIconPool.h" 40 43 #include "UIWelcomePane.h" … … 48 51 : QIWithRetranslateUI<QWidget>(pParent) 49 52 , m_pLabelGreetings(0) 53 , m_pLabelMode(0) 50 54 , m_pLabelIcon(0) 51 55 { … … 88 92 "for more information and latest news.</p>") 89 93 .arg(QKeySequence(QKeySequence::HelpContents).toString(QKeySequence::NativeText))); 94 95 /* Translate experience mode stuff: */ 96 if (m_pLabelMode) 97 m_pLabelMode->setText(tr("<h3>Please choose Experience Mode!</h3>" 98 "By default, the VirtualBox GUI is hiding some options, tools and wizards. " 99 "<p>The <b>Basic Mode</b> is intended for a users who are not interested in advanced " 100 "functionality and prefer a simpler, cleaner interface.</p>" 101 "<p>The <b>Expert Mode</b> is intended for experienced users who wish to utilize all " 102 "VirtualBox functionality.</p>" 103 "<p>You can choose whether you are a beginner or experienced user by selecting required " 104 "option at the right. This choice can always be changed in Global Preferences or Machine " 105 "Settings windows.</p>")); 106 if (m_buttons.contains(false)) 107 m_buttons.value(false)->setText(tr("Basic Mode")); 108 if (m_buttons.contains(true)) 109 m_buttons.value(true)->setText(tr("Expert Mode")); 90 110 } 91 111 … … 93 113 { 94 114 uiCommon().openURL(urlLink.toString()); 115 } 116 117 void UIWelcomePane::sltHandleButtonClicked(QAbstractButton *pButton) 118 { 119 /* Make sure one of buttons was really pressed: */ 120 AssertReturnVoid(m_buttons.contains(pButton)); 121 122 /* Hide everything related to experience mode: */ 123 if (m_pLabelMode) 124 m_pLabelMode->hide(); 125 if (m_buttons.contains(false)) 126 m_buttons.value(false)->hide(); 127 if (m_buttons.contains(true)) 128 m_buttons.value(true)->hide(); 129 130 /* Check which button was pressed actually and save the value: */ 131 const bool fExpertMode = m_buttons.key(pButton, false); 132 gEDataManager->setSettingsInExpertMode(fExpertMode); 95 133 } 96 134 … … 115 153 pMainLayout->setContentsMargins(iL, iT, iR, iB); 116 154 pMainLayout->setSpacing(iSpacing); 117 pMainLayout->setRowStretch( 1, 1);155 pMainLayout->setRowStretch(2, 1); 118 156 119 157 /* Prepare greetings label: */ … … 132 170 m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); 133 171 pMainLayout->addWidget(m_pLabelIcon, 0, 1); 172 } 173 174 /* This block for the case if experienced mode is NOT defined yet: */ 175 if (gEDataManager->extraDataString(UIExtraDataDefs::GUI_Settings_ExpertMode).isNull()) 176 { 177 /* Prepare experience mode label: */ 178 m_pLabelMode = new QIRichTextLabel(this); 179 if (m_pLabelMode) 180 { 181 m_pLabelMode->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); 182 pMainLayout->addWidget(m_pLabelMode, 1, 0); 183 } 184 185 /* Prepare button layout: */ 186 QVBoxLayout *pLayoutButton = new QVBoxLayout; 187 if (pLayoutButton) 188 { 189 pLayoutButton->setSpacing(iSpacing / 2); 190 191 /* Prepare button group: */ 192 QButtonGroup *pButtonGroup = new QButtonGroup(this); 193 if (pButtonGroup) 194 { 195 /* Prepare Basic button ('false' means 'not Expert'): */ 196 m_buttons[false] = new QPushButton(this); 197 QAbstractButton *pButtonBasic = m_buttons.value(false); 198 if (pButtonBasic) 199 { 200 pButtonGroup->addButton(pButtonBasic); 201 pLayoutButton->addWidget(pButtonBasic); 202 } 203 204 /* Prepare Expert button ('true' means 'is Expert'): */ 205 m_buttons[true] = new QPushButton(this); 206 QAbstractButton *pButtonExpert = m_buttons[true]; 207 if (pButtonExpert) 208 { 209 pButtonGroup->addButton(pButtonExpert); 210 pLayoutButton->addWidget(pButtonExpert); 211 } 212 213 connect(pButtonGroup, &QButtonGroup::buttonClicked, 214 this, &UIWelcomePane::sltHandleButtonClicked); 215 } 216 217 pLayoutButton->addStretch(); 218 pMainLayout->addLayout(pLayoutButton, 1, 1); 219 } 134 220 } 135 221 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIWelcomePane.h
r103068 r103094 40 40 41 41 /* Forward declarations: */ 42 class QAbstractButton; 42 43 class QLabel; 43 44 class QIRichTextLabel; … … 66 67 void sltHandleLinkActivated(const QUrl &urlLink); 67 68 69 /** Handles @a pButton click. */ 70 void sltHandleButtonClicked(QAbstractButton *pButton); 71 68 72 private: 69 73 … … 80 84 81 85 /** Holds the greetings label instance. */ 82 QIRichTextLabel *m_pLabelGreetings; 86 QIRichTextLabel *m_pLabelGreetings; 87 /** Holds the mode label instance. */ 88 QIRichTextLabel *m_pLabelMode; 89 /** Holds a list of experience mode button instances. */ 90 QMap<bool, QAbstractButton*> m_buttons; 83 91 /** Holds the icon label instance. */ 84 QLabel *m_pLabelIcon;92 QLabel *m_pLabelIcon; 85 93 }; 86 94
Note:
See TracChangeset
for help on using the changeset viewer.