Changeset 55263 in vbox
- Timestamp:
- Apr 15, 2015 5:41:04 AM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
r54954 r55263 21 21 /* Qt includes: */ 22 22 # include <QTimer> 23 # include <QLabel> 24 # include <QHBoxLayout> 25 # include <QVBoxLayout> 26 # include <QProgressBar> 23 27 /* GUI includes: */ 24 28 # include "UISettingsSerializer.h" 25 29 # include "UISettingsPage.h" 30 # include "UIIconPool.h" 26 31 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 27 32 … … 171 176 UISettingsSerializerProgress::UISettingsSerializerProgress(QWidget *pParent, UISettingsSerializer::SerializationDirection direction, 172 177 const QVariant &data, const UISettingsPageList &pages) 173 : QIWithRetranslateUI<Q ProgressDialog>(pParent)178 : QIWithRetranslateUI<QIDialog>(pParent) 174 179 , m_direction(direction) 175 180 , m_data(data) … … 189 194 190 195 /* Call to base-class: */ 191 return QIWithRetranslateUI<Q ProgressDialog>::exec();196 return QIWithRetranslateUI<QIDialog>::exec(); 192 197 } 193 198 … … 202 207 /* Configure self: */ 203 208 setWindowModality(Qt::WindowModal); 204 setMinimumDuration(0); 205 setCancelButton(0); 209 setWindowTitle(parentWidget()->windowTitle()); 206 210 connect(this, SIGNAL(sigAskForProcessStart()), 207 211 this, SLOT(sltStartProcess()), Qt::QueuedConnection); … … 218 222 } 219 223 220 /* Set maximum/minimum/current values: */ 221 setMaximum(m_pSerializer->pageCount() + 1); 222 setMinimum(0); 223 setValue(0); 224 /* Create layout: */ 225 QVBoxLayout *pLayout = new QVBoxLayout(this); 226 AssertPtrReturnVoid(pLayout); 227 { 228 /* Create top layout: */ 229 QHBoxLayout *pLayoutTop = new QHBoxLayout; 230 AssertPtrReturnVoid(pLayoutTop); 231 { 232 /* Create pixmap label: */ 233 QLabel *pLabelPixmap = new QLabel; 234 AssertPtrReturnVoid(pLabelPixmap); 235 { 236 /* Configure label: */ 237 const QIcon icon = UIIconPool::iconSet(":/progress_refresh_90px.png"); 238 pLabelPixmap->setPixmap(icon.pixmap(icon.availableSizes().first())); 239 /* Add label into layout: */ 240 pLayoutTop->addWidget(pLabelPixmap); 241 } 242 /* Create progress layout: */ 243 QVBoxLayout *pLayoutProgress = new QVBoxLayout(this); 244 AssertPtrReturnVoid(pLayoutProgress); 245 { 246 /* Create progress label: */ 247 m_pLabelProgress = new QLabel; 248 AssertPtrReturnVoid(m_pLabelProgress); 249 { 250 /* Add label into layout: */ 251 pLayoutProgress->addWidget(m_pLabelProgress); 252 } 253 /* Create progress bar: */ 254 m_pBarProgress = new QProgressBar; 255 AssertPtrReturnVoid(m_pBarProgress); 256 { 257 /* Configure progress bar: */ 258 m_pBarProgress->setMinimumWidth(200); 259 m_pBarProgress->setMaximum(m_pSerializer->pageCount() + 1); 260 m_pBarProgress->setMinimum(0); 261 m_pBarProgress->setValue(0); 262 connect(m_pBarProgress, SIGNAL(valueChanged(int)), 263 this, SLOT(sltProgressValueChanged(int))); 264 /* Add bar into layout: */ 265 pLayoutProgress->addWidget(m_pBarProgress); 266 } 267 /* Add stretch: */ 268 pLayoutProgress->addStretch(); 269 /* Add layout into parent: */ 270 pLayoutTop->addLayout(pLayoutProgress); 271 } 272 /* Add layout into parent: */ 273 pLayout->addLayout(pLayoutTop); 274 } 275 } 224 276 } 225 277 226 278 void UISettingsSerializerProgress::retranslateUi() 227 279 { 228 /* Translate title: */ 280 /* Translate progress label: */ 281 AssertPtrReturnVoid(m_pLabelProgress); 229 282 switch (m_pSerializer->direction()) 230 283 { 231 case UISettingsSerializer::Load: setLabelText(tr("Loading Settings...")); break;232 case UISettingsSerializer::Save: setLabelText(tr("Saving Settings...")); break;284 case UISettingsSerializer::Load: m_pLabelProgress->setText(tr("Loading Settings...")); break; 285 case UISettingsSerializer::Save: m_pLabelProgress->setText(tr("Saving Settings...")); break; 233 286 } 234 287 } … … 251 304 } 252 305 306 void UISettingsSerializerProgress::sltAdvanceProgressValue() 307 { 308 /* Advance the serialize progress bar: */ 309 AssertPtrReturnVoid(m_pBarProgress); 310 m_pBarProgress->setValue(m_pBarProgress->value() + 1); 311 } 312 313 void UISettingsSerializerProgress::sltProgressValueChanged(int iValue) 314 { 315 AssertPtrReturnVoid(m_pBarProgress); 316 if (iValue == m_pBarProgress->maximum()) 317 hide(); 318 } 319 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
r54954 r55263 22 22 #include <QVariant> 23 23 #include <QWaitCondition> 24 #include <QProgressDialog>25 24 #include <QMutex> 26 25 #include <QList> … … 29 28 /* GUI includes: */ 30 29 #include "QIWithRetranslateUI.h" 30 #include "QIDialog.h" 31 31 32 32 /* Forward declarations: */ 33 33 class UISettingsPage; 34 class QProgressBar; 35 class QLabel; 34 36 35 37 /* Type definitions: */ … … 125 127 }; 126 128 127 /** Q ProgressDialog reimplementation used to129 /** QIDialog reimplementation used to 128 130 * reflect the settings serialization operation. */ 129 class UISettingsSerializerProgress : public QIWithRetranslateUI<Q ProgressDialog>131 class UISettingsSerializerProgress : public QIWithRetranslateUI<QIDialog> 130 132 { 131 133 Q_OBJECT; … … 172 174 173 175 /** Advances the current progress value. */ 174 void sltAdvanceProgressValue() { setValue(value() + 1); } 176 void sltAdvanceProgressValue(); 177 178 /** Handles the progress value change. */ 179 void sltProgressValueChanged(int iValue); 175 180 176 181 private: … … 186 191 /** Holds the pointer to the thread loading/saving settings in async mode. */ 187 192 UISettingsSerializer *m_pSerializer; 193 194 /** Holds the progress label. */ 195 QLabel *m_pLabelProgress; 196 /** Holds the progress bar. */ 197 QProgressBar *m_pBarProgress; 188 198 }; 189 199
Note:
See TracChangeset
for help on using the changeset viewer.