Changeset 67863 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jul 7, 2017 5:40:58 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 116819
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 7 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2.qrc
r67815 r67863 50 50 <file alias="progress_media_create_90px.png">images/progress_media_create_90px.png</file> 51 51 <file alias="progress_media_delete_90px.png">images/progress_media_delete_90px.png</file> 52 <file alias="progress_media_move_90px.png">images/progress_media_move_90px.png</file> 52 53 <file alias="progress_network_interface_90px.png">images/progress_network_interface_90px.png</file> 53 54 <file alias="progress_poweroff_90px.png">images/progress_poweroff_90px.png</file> -
trunk/src/VBox/Frontends/VirtualBox/VirtualBox2_hidpi.qrc
r67815 r67863 59 59 <file alias="progress_media_create_90px_hidpi.png">images/hidpi/progress_media_create_90px_hidpi.png</file> 60 60 <file alias="progress_media_delete_90px_hidpi.png">images/hidpi/progress_media_delete_90px_hidpi.png</file> 61 <file alias="progress_media_move_90px_hidpi.png">images/hidpi/progress_media_move_90px_hidpi.png</file> 61 62 <file alias="progress_network_interface_90px_hidpi.png">images/hidpi/progress_network_interface_90px_hidpi.png</file> 62 63 <file alias="progress_poweroff_90px_hidpi.png">images/hidpi/progress_poweroff_90px_hidpi.png</file> -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r67471 r67863 1325 1325 .arg(strLocation), 1326 1326 formatErrorInfo(progress)); 1327 } 1328 1329 void UIMessageCenter::cannotMoveHardDiskStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const 1330 { 1331 error(pParent, MessageType_Error, 1332 tr("Failed to move the storage unit of the hard disk <b>%1</b> to <b>%2</b>.") 1333 .arg(strLocationOld, strLocationNew), 1334 formatErrorInfo(comMedium)); 1335 } 1336 1337 void UIMessageCenter::cannotMoveHardDiskStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const 1338 { 1339 error(pParent, MessageType_Error, 1340 tr("Failed to move the storage unit of the hard disk <b>%1</b> to <b>%2</b>.") 1341 .arg(strLocationOld, strLocationNew), 1342 formatErrorInfo(comProgress)); 1327 1343 } 1328 1344 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r67471 r67863 250 250 void cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0) const; 251 251 void cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0) const; 252 void cannotMoveHardDiskStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const; 253 void cannotMoveHardDiskStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent = 0) const; 252 254 void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0) const; 253 255 bool cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0) const; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.cpp
r67810 r67863 32 32 # include "QITabWidget.h" 33 33 # include "UIConverter.h" 34 # include "UIFilePathSelector.h" 34 35 # include "UIIconPool.h" 35 36 # include "UIMediumDetailsWidget.h" … … 44 45 , m_newData(UIDataMedium()) 45 46 , m_pTabWidget(0) 46 , m_pLabelType(0) 47 , m_pComboBoxType(0) 48 , m_pErrorPaneType(0) 47 , m_pLabelType(0), m_pComboBoxType(0), m_pErrorPaneType(0) 48 , m_pLabelLocation(0), m_pSelectorLocation(0), m_pErrorPaneLocation(0) 49 49 , m_pButtonBox(0) 50 50 , m_pLayoutDetails(0) … … 81 81 /* Translate 'Options' tab content. */ 82 82 83 /* Translate type label: */ 84 m_pLabelType->setText(tr("&Type")); 85 86 /* Translate type field: */ 83 /* Translate labels: */ 84 m_pLabelType->setText(tr("&Type:")); 85 m_pLabelLocation->setText(tr("&Location:")); 86 87 /* Translate fields: */ 87 88 m_pComboBoxType->setToolTip(tr("Holds the type of this medium.")); 88 89 for (int i = 0; i < m_pComboBoxType->count(); ++i) 89 90 m_pComboBoxType->setItemText(i, gpConverter->toString(m_pComboBoxType->itemData(i).value<KMediumType>())); 91 m_pSelectorLocation->setToolTip(tr("Holds the location of this medium.")); 90 92 91 93 /* Translate button-box: */ … … 114 116 m_newData.m_options.m_enmType = m_pComboBoxType->itemData(iIndex).value<KMediumType>(); 115 117 revalidate(m_pErrorPaneType); 118 updateButtonStates(); 119 } 120 121 void UIMediumDetailsWidget::sltLocationPathChanged(const QString &strPath) 122 { 123 m_newData.m_options.m_strLocation = strPath; 124 revalidate(m_pErrorPaneLocation); 116 125 updateButtonStates(); 117 126 } … … 238 247 } 239 248 249 /* Create location label: */ 250 m_pLabelLocation = new QLabel; 251 AssertPtrReturnVoid(m_pLabelLocation); 252 { 253 /* Configure label: */ 254 m_pLabelLocation->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); 255 /* Add into layout: */ 256 pLayoutOptions->addWidget(m_pLabelLocation, 1, 0); 257 } 258 /* Create location layout: */ 259 QHBoxLayout *pLayoutLocation = new QHBoxLayout; 260 AssertPtrReturnVoid(pLayoutLocation); 261 { 262 /* Configure layout: */ 263 pLayoutLocation->setContentsMargins(0, 0, 0, 0); 264 /* Create location editor: */ 265 m_pSelectorLocation = new UIFilePathSelector; 266 AssertPtrReturnVoid(m_pSelectorLocation); 267 { 268 /* Configure editor: */ 269 m_pLabelLocation->setBuddy(m_pSelectorLocation); 270 m_pSelectorLocation->setResetEnabled(false); 271 m_pSelectorLocation->setMode(UIFilePathSelector::Mode_File_Save); 272 m_pSelectorLocation->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); 273 connect(m_pSelectorLocation, &UIFilePathSelector::pathChanged, 274 this, &UIMediumDetailsWidget::sltLocationPathChanged); 275 276 /* Add into layout: */ 277 pLayoutLocation->addWidget(m_pSelectorLocation); 278 } 279 /* Create location error pane: */ 280 m_pErrorPaneLocation = new QLabel; 281 AssertPtrReturnVoid(m_pErrorPaneLocation); 282 { 283 /* Configure label: */ 284 m_pErrorPaneLocation->setAlignment(Qt::AlignCenter); 285 m_pErrorPaneLocation->setPixmap(UIIconPool::iconSet(":/status_error_16px.png") 286 .pixmap(QSize(iIconMetric, iIconMetric))); 287 /* Add into layout: */ 288 pLayoutLocation->addWidget(m_pErrorPaneLocation); 289 } 290 /* Add into layout: */ 291 pLayoutOptions->addLayout(pLayoutLocation, 1, 1); 292 } 293 240 294 /* Create stretch: */ 241 295 QSpacerItem *pSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); … … 243 297 { 244 298 /* Add into layout: */ 245 pLayoutOptions->addItem(pSpacer2, 1, 0, 1, 2);299 pLayoutOptions->addItem(pSpacer2, 2, 0, 1, 2); 246 300 } 247 301 … … 380 434 m_pComboBoxType->setCurrentIndex(i); 381 435 sltTypeIndexChanged(m_pComboBoxType->currentIndex()); 436 437 /* Load location: */ 438 m_pSelectorLocation->setPath(m_newData.m_options.m_strLocation); 439 sltLocationPathChanged(m_pSelectorLocation->path()); 382 440 } 383 441 … … 408 466 m_pErrorPaneType->setVisible(fError); 409 467 } 468 if (!pWidget || pWidget == m_pErrorPaneLocation) 469 { 470 /* Always valid for now: */ 471 const bool fError = false; 472 m_pErrorPaneLocation->setVisible(fError); 473 } 410 474 411 475 /* Retranslate validation: */ … … 417 481 /* Translate 'Interface' tab content: */ 418 482 // if (!pWidget || pWidget == m_pErrorPaneType) 419 // m_pErrorPaneType->setToolTip(tr("Cannot directly change from type <b>%1</b> to type <b>%2</b>.") 420 // .arg(m_oldData.m_enmType).arg(m_newData.m_enmType)); 483 // m_pErrorPaneType->setToolTip(tr("Cannot change from type <b>%1</b> to <b>%2</b>.") 484 // .arg(m_oldData.m_options.m_enmType).arg(m_newData.m_options.m_enmType)); 485 // if (!pWidget || pWidget == m_pErrorPaneLocation) 486 // m_pErrorPaneLocation->setToolTip(tr("Cannot change medium location from <b>%1</b> to <b>%2</b>.") 487 // .arg(m_oldData.m_options.m_strLocation).arg(m_newData.m_options.m_strLocation)); 421 488 } 422 489 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumDetailsWidget.h
r67810 r67863 38 38 class QILabel; 39 39 class QITabWidget; 40 class UIFilePathSelector; 40 41 41 42 … … 46 47 UIDataMediumOptions() 47 48 : m_enmType(KMediumType_Normal) 49 , m_strLocation(QString()) 48 50 {} 49 51 … … 53 55 return true 54 56 && (m_enmType == other.m_enmType) 57 && (m_strLocation == other.m_strLocation) 55 58 ; 56 59 } … … 63 66 /** Holds the type. */ 64 67 KMediumType m_enmType; 68 /** Holds the location. */ 69 QString m_strLocation; 65 70 }; 66 71 … … 183 188 /** Handles type change. */ 184 189 void sltTypeIndexChanged(int iIndex); 190 /** Handles location change. */ 191 void sltLocationPathChanged(const QString &strPath); 185 192 186 193 /** Handles button-box button click. */ … … 254 261 /** Holds the type combo-box. */ 255 262 QComboBox *m_pComboBoxType; 256 /** Holds the automatic interface configurationerror pane. */263 /** Holds the type error pane. */ 257 264 QLabel *m_pErrorPaneType; 265 266 /** Holds the location label. */ 267 QLabel *m_pLabelLocation; 268 /** Holds the location selector. */ 269 UIFilePathSelector *m_pSelectorLocation; 270 /** Holds the location error pane. */ 271 QLabel *m_pErrorPaneLocation; 258 272 259 273 /** Holds the button-box instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r67854 r67863 385 385 /* Gather medium options data: */ 386 386 m_options.m_enmType = m_guiMedium.mediumType(); 387 m_options.m_strLocation = m_guiMedium.location(); 387 388 /* Gather medium details data: */ 388 389 m_details.m_aFields.clear(); … … 921 922 922 923 /* Try to assign new medium type: */ 923 if (newData.m_options.m_enmType != oldData.m_options.m_enmType) 924 if ( comMedium.isOk() 925 && newData.m_options.m_enmType != oldData.m_options.m_enmType) 926 { 924 927 comMedium.SetType(newData.m_options.m_enmType); 925 928 926 /* Show error message if necessary: */ 927 if (!comMedium.isOk()) 928 msgCenter().cannotChangeMediumType(comMedium, oldData.m_options.m_enmType, newData.m_options.m_enmType, this); 929 /* Show error message if necessary: */ 930 if (!comMedium.isOk()) 931 msgCenter().cannotChangeMediumType(comMedium, oldData.m_options.m_enmType, newData.m_options.m_enmType, this); 932 } 933 934 /* Try to assign new medium location: */ 935 if ( comMedium.isOk() 936 && newData.m_options.m_strLocation != oldData.m_options.m_strLocation) 937 { 938 /* Prepare move storage progress: */ 939 CProgress comProgress = comMedium.SetLocation(newData.m_options.m_strLocation); 940 941 /* Show error message if necessary: */ 942 if (!comMedium.isOk()) 943 msgCenter().cannotMoveHardDiskStorage(comMedium, 944 oldData.m_options.m_strLocation, 945 newData.m_options.m_strLocation, 946 this); 947 else 948 { 949 /* Show move storage progress: */ 950 msgCenter().showModalProgressDialog(comProgress, UIMediumManager::tr("Moving medium..."), 951 ":/progress_media_move_90px.png", this); 952 953 /* Show error message if necessary: */ 954 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 955 msgCenter().cannotMoveHardDiskStorage(comProgress, 956 oldData.m_options.m_strLocation, 957 newData.m_options.m_strLocation, 958 this); 959 } 960 } 929 961 930 962 /* Recache current item: */
Note:
See TracChangeset
for help on using the changeset viewer.