Changeset 37106 in vbox
- Timestamp:
- May 16, 2011 2:50:12 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r36589 r37106 19 19 20 20 /* Global includes */ 21 #include <QProgressBar> 21 22 #include <QPushButton> 22 23 #include <QStackedWidget> … … 51 52 , m_dialogType(settingsDialogType) 52 53 , m_fPolished(false) 53 /* Loading stuff: */54 /* Loading/saving stuff: */ 54 55 , m_fProcessed(false) 56 /* Status bar stuff: */ 57 , m_pStatusBar(new QStackedWidget(this)) 58 /* Process bar stuff: */ 59 , m_pProcessBar(new QProgressBar(this)) 55 60 /* Error/Warning stuff: */ 56 61 , m_fValid(true) … … 104 109 pStackLayout->addWidget(m_pStack); 105 110 111 /* Status bar: */ 112 m_pStatusBar->addWidget(new QWidget); 113 m_pButtonBox->addExtraWidget(m_pStatusBar); 114 115 /* Setup process bar stuff: */ 116 m_pStatusBar->addWidget(m_pProcessBar); 117 106 118 /* Setup error & warning stuff: */ 107 m_p ButtonBox->addExtraWidget(m_pWarningPane);119 m_pStatusBar->addWidget(m_pWarningPane); 108 120 m_errorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this).pixmap(16, 16); 109 121 m_warningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this).pixmap(16, 16); … … 197 209 } 198 210 211 void UISettingsDialog::sltHandleProcessStarted() 212 { 213 m_pProcessBar->setValue(0); 214 m_pStatusBar->setCurrentWidget(m_pProcessBar); 215 } 216 217 void UISettingsDialog::sltHandlePageProcessed() 218 { 219 m_pProcessBar->setValue(m_pProcessBar->value() + 1); 220 if (m_pProcessBar->value() == m_pProcessBar->maximum()) 221 { 222 if (!m_fValid || !m_fSilent) 223 m_pStatusBar->setCurrentWidget(m_pWarningPane); 224 else 225 m_pStatusBar->setCurrentIndex(0); 226 } 227 } 228 199 229 void UISettingsDialog::retranslateUi() 200 230 { … … 245 275 if (m_fPolished) 246 276 { 247 if (!m_strErrorString.isEmpty() )277 if (!m_strErrorString.isEmpty() && m_pStatusBar->currentWidget() == m_pWarningPane) 248 278 m_pLbWhatsThis->setText(m_strErrorString); 249 279 else … … 261 291 if (m_fPolished) 262 292 { 263 if (!m_strWarningString.isEmpty() )293 if (!m_strWarningString.isEmpty() && m_pStatusBar->currentWidget() == m_pWarningPane) 264 294 m_pLbWhatsThis->setText(m_strWarningString); 265 295 else … … 295 325 m_pages[cId] = m_pStack->addWidget(pPage); 296 326 #endif /* !Q_WS_MAC */ 327 /* Update process bar: */ 328 m_pProcessBar->setMinimum(0); 329 m_pProcessBar->setMaximum(m_pStack->count()); 297 330 } 298 331 if (pSettingsPage) … … 334 367 335 368 m_fValid = fNewValid; 369 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid); 336 370 m_pWarningPane->setWarningPixmap(m_errorIcon); 337 371 m_pWarningPane->setWarningText(m_strErrorHint); … … 339 373 m_pWarningPane->setToolTip(m_strErrorString); 340 374 #endif /* Q_WS_MAC */ 341 m_pWarningPane->setVisible(!m_fValid); 342 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(m_fValid); 375 if (m_fValid && m_pStatusBar->currentWidget() == m_pWarningPane) 376 m_pStatusBar->setCurrentIndex(0); 377 else if (!m_fValid && m_pStatusBar->currentIndex() == 0) 378 m_pStatusBar->setCurrentWidget(m_pWarningPane); 343 379 344 380 if (!m_fValid) … … 375 411 m_pWarningPane->setToolTip(m_strWarningString); 376 412 #endif /* Q_WS_MAC */ 377 m_pWarningPane->setVisible(!m_fSilent); 413 if (m_fSilent && m_pStatusBar->currentWidget() == m_pWarningPane) 414 m_pStatusBar->setCurrentIndex(0); 415 else if (!m_fSilent && m_pStatusBar->currentIndex() == 0) 416 m_pStatusBar->setCurrentWidget(m_pWarningPane); 378 417 } 379 418 } … … 408 447 409 448 #ifndef Q_WS_MAC 410 if (strWhatsThisText.isEmpty() && !m_strErrorString.isEmpty()) 411 strWhatsThisText = m_strErrorString; 412 else if (strWhatsThisText.isEmpty() && !m_strWarningString.isEmpty()) 413 strWhatsThisText = m_strWarningString; 449 if (m_pStatusBar->currentWidget() == m_pWarningPane) 450 { 451 if (strWhatsThisText.isEmpty() && !m_strErrorString.isEmpty()) 452 strWhatsThisText = m_strErrorString; 453 else if (strWhatsThisText.isEmpty() && !m_strWarningString.isEmpty()) 454 strWhatsThisText = m_strWarningString; 455 } 414 456 if (strWhatsThisText.isEmpty()) 415 457 strWhatsThisText = whatsThis(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r36592 r37106 28 28 /* Forward declarations: */ 29 29 class QIWidgetValidator; 30 class QProgressBar; 30 31 class QStackedWidget; 31 32 class QTimer; … … 62 63 /* Mark dialog as processed: */ 63 64 virtual void sltMarkProcessed(); 65 66 /* Handlers for process bar: */ 67 void sltHandleProcessStarted(); 68 void sltHandlePageProcessed(); 64 69 65 70 protected: … … 116 121 bool m_fPolished; 117 122 123 /* Loading/saving stuff: */ 124 bool m_fProcessed; 125 126 /* Status bar widget: */ 127 QStackedWidget *m_pStatusBar; 128 129 /* Process bar widget: */ 130 QProgressBar *m_pProcessBar; 131 118 132 /* Error & Warning stuff: */ 119 bool m_fProcessed;120 133 bool m_fValid; 121 134 bool m_fSilent; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r37036 r37106 86 86 , m_iIdOfHighPriorityPage(-1) 87 87 { 88 /* Connecting th readsignals: */88 /* Connecting this signals: */ 89 89 connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection); 90 90 connect(this, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltHandleProcessedPages()), Qt::QueuedConnection); 91 91 connect(this, SIGNAL(finished()), this, SLOT(sltDestroySerializer()), Qt::QueuedConnection); 92 /* Connecting parent signals: */ 93 connect(this, SIGNAL(sigNotifyAboutProcessStarted()), parent(), SLOT(sltHandleProcessStarted()), Qt::QueuedConnection); 94 connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), parent(), SLOT(sltHandlePageProcessed()), Qt::QueuedConnection); 92 95 93 96 /* Set instance: */ … … 153 156 signals: 154 157 158 /* Signal to notify main GUI thread about process has been started: */ 159 void sigNotifyAboutProcessStarted(); 160 155 161 /* Signal to notify main GUI thread about some page was processed: */ 156 162 void sigNotifyAboutPageProcessed(int iPageId); … … 163 169 void start(Priority priority = InheritPriority) 164 170 { 171 /* Notify listeners a bout we are starting: */ 172 emit sigNotifyAboutProcessStarted(); 165 173 /* If serializer saves settings: */ 166 174 if (m_direction == UISettingsSerializeDirection_Save) -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxWarningPane.cpp
r28800 r37106 7 7 8 8 /* 9 * Copyright (C) 2009 Oracle Corporation9 * Copyright (C) 2009-2011 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 32 pLayout->addWidget(&m_icon); 33 33 pLayout->addWidget(&m_label); 34 setVisible(false);35 34 } 36 35 37 36 void VBoxWarningPane::setWarningPixmap(const QPixmap &imgPixmap) 38 37 { 39 m_icon.setPixmap 38 m_icon.setPixmap(imgPixmap); 40 39 } 41 40 42 41 void VBoxWarningPane::setWarningText(const QString &strText) 43 42 { 44 m_label.setText 43 m_label.setText(strText); 45 44 } 46 45
Note:
See TracChangeset
for help on using the changeset viewer.