Changeset 76768 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 11, 2019 10:54:58 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r76739 r76768 2654 2654 QStringList files = pVisoCreator->entryList(); 2655 2655 QString strVisoName = pVisoCreator->visoName(); 2656 2656 2657 if (files.empty() || files[0].isEmpty()) 2657 2658 return QUuid(); … … 2688 2689 break; 2689 2690 } 2691 /* Append custom options if any to the file: */ 2692 const QStringList &customOptions = pVisoCreator->customOptions(); 2693 foreach (QString strLine, customOptions) 2694 RTStrmPrintf(pStrmViso, "%s\n", strLine.toUtf8().constData()); 2690 2695 2691 2696 RTStrmFlush(pStrmViso); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoConfigurationDialog.cpp
r76747 r76768 19 19 #include <QCheckBox> 20 20 #include <QGridLayout> 21 #include <QTextEdit> 21 22 #include <QPushButton> 22 23 #include <QSplitter> 23 24 #include <QStyle> 25 #include <QTextBlock> 24 26 25 27 /* GUI includes: */ … … 35 37 , m_pMainLayout(0) 36 38 , m_pButtonBox(0) 39 , m_pVisoNameLineEdit(0) 40 , m_pCustomOptionsTextEdit(0) 37 41 , m_visoOptions(visoOptions) 38 42 { … … 50 54 } 51 55 52 void UIVisoConfigurationDialog:: sltHandleVisoNameChange(const QString &strText)56 void UIVisoConfigurationDialog::accept() 53 57 { 54 m_visoOptions.m_strVisoName = strText; 58 if (m_pVisoNameLineEdit) 59 m_visoOptions.m_strVisoName = m_pVisoNameLineEdit->text(); 60 61 if (m_pCustomOptionsTextEdit) 62 { 63 QTextDocument *pDocument = m_pCustomOptionsTextEdit->document(); 64 if (pDocument) 65 { 66 for(QTextBlock block = pDocument->begin(); block != pDocument->end()/*.isValid()*/; block = block.next()) 67 m_visoOptions.m_customOptions << block.text(); 68 } 69 } 70 71 QIDialog::accept(); 55 72 } 56 73 … … 62 79 return; 63 80 81 /* Name edit and and label: */ 82 QILabel *pVisoNameLabel = new QILabel(UIVisoCreator::tr("VISO Name:")); 83 m_pVisoNameLineEdit = new QILineEdit; 84 if (pVisoNameLabel && m_pVisoNameLineEdit) 85 { 86 m_pVisoNameLineEdit->setText(m_visoOptions.m_strVisoName); 87 pVisoNameLabel->setBuddy(m_pVisoNameLineEdit); 88 m_pMainLayout->addWidget(pVisoNameLabel, 0, 0, 1, 1); 89 m_pMainLayout->addWidget(m_pVisoNameLineEdit, 0, 1, 1, 1); 90 } 64 91 65 QILineEdit *pVisoNameLineEdit = new QILineEdit; 66 connect(pVisoNameLineEdit, &QILineEdit::textChanged, 67 this, &UIVisoConfigurationDialog::sltHandleVisoNameChange); 68 pVisoNameLineEdit->setText(m_visoOptions.m_strVisoName); 69 QILabel *pVisoNameLabel = new QILabel(UIVisoCreator::tr("VISO Name:")); 70 pVisoNameLabel->setBuddy(pVisoNameLineEdit); 71 72 m_pMainLayout->addWidget(pVisoNameLabel, 0, 0, 1, 1); 73 m_pMainLayout->addWidget(pVisoNameLineEdit, 0, 1, 1, 1); 92 /* Cutom Viso options stuff: */ 93 QILabel *pCustomOptionsLabel = new QILabel(UIVisoCreator::tr("Custom VISO options:")); 94 m_pCustomOptionsTextEdit = new QTextEdit; 95 if (pCustomOptionsLabel && m_pCustomOptionsTextEdit) 96 { 97 m_pCustomOptionsTextEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 98 pCustomOptionsLabel->setBuddy(m_pCustomOptionsTextEdit); 99 m_pMainLayout->addWidget(pCustomOptionsLabel, 1, 0, 1, 1, Qt::AlignTop); 100 m_pMainLayout->addWidget(m_pCustomOptionsTextEdit, 1, 1, 1, 1); 101 foreach (const QString &strLine, m_visoOptions.m_customOptions) 102 m_pCustomOptionsTextEdit->append(strLine); 103 } 74 104 75 105 m_pButtonBox = new QIDialogButtonBox; … … 78 108 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok); 79 109 m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape); 80 m_pMainLayout->addWidget(m_pButtonBox, 1, 0, 1, 2);110 m_pMainLayout->addWidget(m_pButtonBox, 2, 0, 1, 2); 81 111 } 82 112 setLayout(m_pMainLayout); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoConfigurationDialog.h
r76747 r76768 28 28 29 29 /* Forward declarations: */ 30 class QGridLayout; 31 class QTextEdit; 32 class QIDialogButtonBox; 33 class QILineEdit; 30 34 class QITabWidget; 31 class QGridLayout;32 class QIDialogButtonBox;33 35 34 36 class SHARED_LIBRARY_STUFF UIVisoConfigurationDialog : public QIDialog … … 37 39 38 40 public: 39 40 41 UIVisoConfigurationDialog(const VisoOptions &visoOptions, 41 42 QWidget *pParent = 0); … … 43 44 const VisoOptions &visoOptions() const; 44 45 45 p rivateslots:46 public slots: 46 47 47 void sltHandleVisoNameChange(const QString &strText); 48 void accept() /* override */; 49 48 50 49 51 private: … … 54 56 QGridLayout *m_pMainLayout; 55 57 QIDialogButtonBox *m_pButtonBox; 58 QILineEdit *m_pVisoNameLineEdit; 59 QTextEdit *m_pCustomOptionsTextEdit; 56 60 VisoOptions m_visoOptions; 61 57 62 friend class UIVisoCreator; 58 63 }; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.cpp
r76762 r76768 256 256 m_pRenameAction->setToolTip(QApplication::translate("UIVisoCreator", "Rename the selected object")); 257 257 258 259 258 UICustomFileSystemItem *pRootItem = rootItem(); 260 259 if (pRootItem) … … 338 337 if (!pItem) 339 338 continue; 339 QString strIsoPath = pItem->data(UICustomFileSystemModelColumn_Path).toString(); 340 if (strIsoPath.isEmpty()) 341 continue; 342 340 343 bool bFoundInMap = false; 341 344 for (QMap<QString, QString>::iterator iterator = m_entryMap.begin(); iterator != m_entryMap.end(); ) 342 345 { 343 QString strIsoPath = pItem->data(UICustomFileSystemModelColumn_Path).toString();344 if (strIsoPath.isEmpty())345 continue;346 346 if (iterator.key().startsWith(strIsoPath)) 347 347 { … … 465 465 if (m_pRenameAction) 466 466 { 467 m_pVerticalToolBar->addAction(m_pRenameAction); 467 /** @todo Handle rename correctly in the m_entryMap as well and then enable this rename action. */ 468 /* m_pVerticalToolBar->addAction(m_pRenameAction); */ 468 469 m_pRenameAction->setIcon(UIIconPool::iconSet(":/file_manager_rename_16px.png", ":/file_manager_rename_disabled_16px.png")); 469 470 m_pRenameAction->setEnabled(false); … … 507 508 connect(m_pResetAction, &QAction::triggered, 508 509 this, &UIVisoContentBrowser::sltHandleResetAction); 509 510 if (m_pRenameAction) 511 connect(m_pRenameAction, &QAction::triggered, 512 this,&UIVisoContentBrowser::sltHandleItemRenameAction); 510 513 if (m_pTableView->selectionModel()) 511 514 connect(m_pTableView->selectionModel(), &QItemSelectionModel::selectionChanged, … … 721 724 } 722 725 726 void UIVisoContentBrowser::sltHandleItemRenameAction() 727 { 728 QList<UICustomFileSystemItem*> selectedItems = tableSelectedItems(); 729 if (selectedItems.empty()) 730 return; 731 /* This is not complete. we have to modify the entries in the m_entryMap as well: */ 732 renameFileObject(selectedItems.at(0)); 733 } 734 723 735 void UIVisoContentBrowser::sltHandleItemRenameAttempt(UICustomFileSystemItem *pItem, QString strOldName, QString strNewName) 724 736 { … … 740 752 741 753 pItem->setData(UIPathOperations::mergePaths(pItem->parentItem()->path(), pItem->name()), UICustomFileSystemModelColumn_Path); 742 743 754 if (m_pTableProxyModel) 744 755 m_pTableProxyModel->invalidate(); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoContentBrowser.h
r76762 r76768 76 76 77 77 void sltHandleCreateNewDirectory(); 78 /** Handles the signal we get from the model during setData call. Restores the old name of the file object 79 * to @p strOldName if need be. */ 78 80 void sltHandleItemRenameAttempt(UICustomFileSystemItem *pItem, QString strOldName, QString strNewName); 81 void sltHandleItemRenameAction(); 79 82 void sltHandleRemoveItems(); 80 83 void sltHandleTableSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp
r76747 r76768 66 66 } 67 67 68 const QStringList &UIVisoCreator::customOptions() const 69 { 70 return m_visoOptions.m_customOptions; 71 } 72 68 73 void UIVisoCreator::retranslateUi() 69 74 { … … 228 233 } 229 234 m_visoOptions = visoOptions; 230 231 } 235 } -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.h
r76747 r76768 55 55 QStringList entryList() const; 56 56 const QString &visoName() const; 57 const QStringList &customOptions() const; 57 58 58 59 #ifdef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreatorDefs.h
r76675 r76768 29 29 bool operator==(const VisoOptions &otherOptions) const 30 30 { 31 return m_strVisoName == otherOptions.m_strVisoName; 31 return (m_strVisoName == otherOptions.m_strVisoName) && 32 (m_customOptions == otherOptions.m_customOptions); 32 33 } 33 34 QString m_strVisoName; 35 /** Additions viso options to be inserted to the viso file as separate lines. */ 36 QStringList m_customOptions; 34 37 }; 35 38
Note:
See TracChangeset
for help on using the changeset viewer.