Changeset 55279 in vbox for trunk/src/VBox
- Timestamp:
- Apr 15, 2015 11:34:52 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99597
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r52727 r55279 78 78 Q_OBJECT; 79 79 80 signals: 81 82 /** Notifies listeners about particular operation progress change. 83 * @param iOperations holds the number of operations CProgress have, 84 * @param strOperation holds the description of the current CProgress operation, 85 * @param iOperation holds the index of the current CProgress operation, 86 * @param iPercent holds the percentage of the current CProgress operation. */ 87 void sigOperationProgressChange(ulong iOperations, QString strOperation, 88 ulong iOperation, ulong iPercent); 89 80 90 public: 81 91 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
r55276 r55279 29 29 # include "UISettingsPage.h" 30 30 # include "UIIconPool.h" 31 # include "QILabel.h" 31 32 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 32 33 … … 144 145 m_iIdOfHighPriorityPage = -1; 145 146 /* Process this page if its enabled: */ 147 connect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)), 148 this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong))); 146 149 if (pPage->isEnabled()) 147 150 { … … 152 155 } 153 156 /* Remember what page was processed: */ 157 disconnect(pPage, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)), 158 this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong))); 154 159 pPage->setProcessed(true); 155 160 /* Remove processed page from our map: */ … … 174 179 } 175 180 181 QString UISettingsSerializerProgress::m_strProgressDescriptionTemplate = QString("<compact elipsis=\"middle\">%1 (%2/%3)</compact>"); 182 176 183 UISettingsSerializerProgress::UISettingsSerializerProgress(QWidget *pParent, UISettingsSerializer::SerializationDirection direction, 177 184 const QVariant &data, const UISettingsPageList &pages) … … 183 190 , m_pLabelOperationProgress(0) 184 191 , m_pBarOperationProgress(0) 192 , m_pLabelSubOperationProgress(0) 193 , m_pBarSubOperationProgress(0) 185 194 { 186 195 /* Prepare: */ … … 222 231 connect(m_pSerializer, SIGNAL(sigNotifyAboutPagesPostprocessed()), 223 232 this, SLOT(sltAdvanceProgressValue())); 233 connect(m_pSerializer, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)), 234 this, SLOT(sltHandleOperationProgressChange(ulong, QString, ulong, ulong))); 224 235 } 225 236 … … 276 287 pLayoutProgress->addWidget(m_pBarOperationProgress); 277 288 } 289 /* Create sub-operation progress label: */ 290 m_pLabelSubOperationProgress = new QILabel; 291 AssertPtrReturnVoid(m_pLabelSubOperationProgress); 292 { 293 /* Configure label: */ 294 m_pLabelSubOperationProgress->hide(); 295 m_pLabelSubOperationProgress->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed)); 296 /* Add label into layout: */ 297 pLayoutProgress->addWidget(m_pLabelSubOperationProgress); 298 } 299 /* Create sub-operation progress bar: */ 300 m_pBarSubOperationProgress = new QProgressBar; 301 AssertPtrReturnVoid(m_pBarSubOperationProgress); 302 { 303 /* Configure progress bar: */ 304 m_pBarSubOperationProgress->hide(); 305 m_pBarSubOperationProgress->setMinimumWidth(300); 306 m_pBarSubOperationProgress->setMaximum(100); 307 m_pBarSubOperationProgress->setMinimum(0); 308 m_pBarSubOperationProgress->setValue(0); 309 /* Add bar into layout: */ 310 pLayoutProgress->addWidget(m_pBarSubOperationProgress); 311 } 278 312 /* Add stretch: */ 279 313 pLayoutProgress->addStretch(); … … 317 351 void UISettingsSerializerProgress::sltAdvanceProgressValue() 318 352 { 319 /* Advance the serializeprogress bar: */353 /* Advance the operation progress bar: */ 320 354 AssertPtrReturnVoid(m_pBarOperationProgress); 321 355 m_pBarOperationProgress->setValue(m_pBarOperationProgress->value() + 1); … … 324 358 void UISettingsSerializerProgress::sltProgressValueChanged(int iValue) 325 359 { 360 /* Hide the progress-dialog upon reaching the 100% progress: */ 326 361 AssertPtrReturnVoid(m_pBarOperationProgress); 327 362 if (iValue == m_pBarOperationProgress->maximum()) … … 329 364 } 330 365 366 void UISettingsSerializerProgress::sltHandleOperationProgressChange(ulong iOperations, QString strOperation, 367 ulong iOperation, ulong iPercent) 368 { 369 /* Update the sub-operation progress label and bar: */ 370 AssertPtrReturnVoid(m_pLabelSubOperationProgress); 371 AssertPtrReturnVoid(m_pBarSubOperationProgress); 372 m_pLabelSubOperationProgress->show(); 373 m_pBarSubOperationProgress->show(); 374 m_pLabelSubOperationProgress->setText(m_strProgressDescriptionTemplate.arg(strOperation).arg(iOperation).arg(iOperations)); 375 m_pBarSubOperationProgress->setValue(iPercent); 376 } 377 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
r55276 r55279 33 33 class UISettingsPage; 34 34 class QProgressBar; 35 class QILabel; 35 36 class QLabel; 36 37 … … 62 63 /** Notifies listeners about process has been finished. */ 63 64 void sigNotifyAboutProcessFinished(); 65 66 /** Notifies listeners about particular operation progress change. 67 * @param iOperations holds the number of operations CProgress have, 68 * @param strOperation holds the description of the current CProgress operation, 69 * @param iOperation holds the index of the current CProgress operation, 70 * @param iPercent holds the percentage of the current CProgress operation. */ 71 void sigOperationProgressChange(ulong iOperations, QString strOperation, 72 ulong iOperation, ulong iPercent); 64 73 65 74 public: … … 179 188 void sltProgressValueChanged(int iValue); 180 189 190 /** Handles particular operation progress change. 191 * @param iOperations holds the number of operations CProgress have, 192 * @param strOperation holds the description of the current CProgress operation, 193 * @param iOperation holds the index of the current CProgress operation, 194 * @param iPercent holds the percentage of the current CProgress operation. */ 195 void sltHandleOperationProgressChange(ulong iOperations, QString strOperation, 196 ulong iOperation, ulong iPercent); 197 181 198 private: 182 199 … … 196 213 /** Holds the operation progress bar. */ 197 214 QProgressBar *m_pBarOperationProgress; 215 216 /** Holds the sub-operation progress label. */ 217 QILabel *m_pLabelSubOperationProgress; 218 /** Holds the sub-operation progress bar. */ 219 QProgressBar *m_pBarSubOperationProgress; 220 221 /** Holds the template for the sub-operation progress label. */ 222 static QString m_strProgressDescriptionTemplate; 198 223 }; 199 224 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r55092 r55279 25 25 # include "QIWidgetValidator.h" 26 26 # include "UIMachineSettingsGeneral.h" 27 #include "UIModalWindowManager.h" 27 # include "UIModalWindowManager.h" 28 # include "UIProgressDialog.h" 28 29 # include "UIMessageCenter.h" 29 30 # include "UIConverter.h" … … 336 337 337 338 /* Update encryption: */ 338 CProgress progress = medium.ChangeEncryption(strOldPassword,339 strNewCipher,340 strNewPassword,341 strNewPasswordId);339 CProgress cprogress = medium.ChangeEncryption(strOldPassword, 340 strNewCipher, 341 strNewPassword, 342 strNewPasswordId); 342 343 // if (!medium.isOk()) 343 344 // printf(" Medium API Error, rc = %s\n", msgCenter().formatRC(medium.lastRC()).toAscii().constData()); 344 progress.WaitForCompletion(-1); 345 UIProgress uiprogress(cprogress); 346 connect(&uiprogress, SIGNAL(sigProgressChange(ulong, QString, ulong, ulong)), 347 this, SIGNAL(sigOperationProgressChange(ulong, QString, ulong, ulong)), 348 Qt::QueuedConnection); 349 uiprogress.run(350); 345 350 // if (!progress.isOk()) 346 351 // printf(" Progress API Error, rc = %s\n", msgCenter().formatRC(progress.lastRC()).toAscii().constData());
Note:
See TracChangeset
for help on using the changeset viewer.