- Timestamp:
- May 9, 2018 1:45:33 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 122596
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r72173 r72174 1160 1160 QString strHomeFolder = fUseLastFolder && !strLastFolder.isEmpty() ? strLastFolder : 1161 1161 strDefaultFolder.isEmpty() ? vboxGlobal().homeFolder() : strDefaultFolder; 1162 1163 1162 1164 1163 /* Prepare filters and backends: */ … … 4677 4676 return true; 4678 4677 } 4678 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r72173 r72174 32 32 # include <QPlainTextEdit> 33 33 # include <QTextCursor> 34 # include <QToolButton> 34 35 # include <QRadioButton> 35 36 # include <QScrollArea> … … 78 79 virtual void mousePressEvent(QMouseEvent * event) /* override */; 79 80 virtual void mouseReleaseEvent(QMouseEvent *){} 80 virtual void paintEvent(QPaintEvent *event) /* override */;81 virtual void paintEvent(QPaintEvent *event); 81 82 82 83 private slots: … … 89 90 private: 90 91 91 void 92 Q IToolButton *m_pRemoveTermButton;93 Q IToolButton *m_pClearAllButton;94 const int 95 int 92 void createButtons(); 93 QToolButton *m_pRemoveTermButton; 94 QToolButton *m_pClearAllButton; 95 const int m_iRemoveTermButtonSize; 96 int m_iTrailingSpaceCount; 96 97 }; 97 98 … … 196 197 if (!m_pRemoveTermButton) 197 198 { 198 m_pRemoveTermButton = new Q IToolButton(this);199 m_pRemoveTermButton = new QToolButton(this); 199 200 if (m_pRemoveTermButton) 200 201 { 201 202 m_pRemoveTermButton->setIcon(m_pRemoveTermButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton)); 202 203 m_pRemoveTermButton->hide(); 203 connect(m_pRemoveTermButton, &Q IToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm);204 connect(m_pRemoveTermButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltRemoveFilterTerm); 204 205 } 205 206 } … … 207 208 if (!m_pClearAllButton) 208 209 { 209 m_pClearAllButton = new Q IToolButton(this);210 m_pClearAllButton = new QToolButton(this); 210 211 if (m_pClearAllButton) 211 212 { 212 213 m_pClearAllButton->setIcon(m_pClearAllButton->style()->standardIcon(QStyle::SP_LineEditClearButton)); 213 connect(m_pClearAllButton, &Q IToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll);214 connect(m_pClearAllButton, &QToolButton::clicked, this, &UIVMFilterLineEdit::sltClearAll); 214 215 } 215 216 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsGeneral.cpp
r72173 r72174 554 554 { 555 555 /* Configure widget: */ 556 //m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this));556 m_pNameAndSystemEditor->nameEditor()->setValidator(new QRegExpValidator(QRegExp(".+"), this)); 557 557 } 558 558 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r72173 r72174 668 668 UIFilePathSelector *pFileChooser = new UIFilePathSelector(pParent); 669 669 pFileChooser->setMode(UIFilePathSelector::Mode_File_Save); 670 pFileChooser->setResetEnabled( true);670 pFileChooser->setResetEnabled(false); 671 671 pEditor = pFileChooser; 672 672 break; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.cpp
r72173 r72174 31 31 # include "UIFilePathSelector.h" 32 32 # include "UINameAndSystemEditor.h" 33 # include "UIVMNamePathSelector.h"34 33 35 34 /* COM includes: */ … … 51 50 , m_fSupportsHWVirtEx(false) 52 51 , m_fSupportsLongMode(false) 52 , m_pLabelName(0) 53 53 , m_pLabelFamily(0) 54 54 , m_pLabelType(0) 55 55 , m_pIconType(0) 56 , m_p NamePathLabel(0)57 , m_p NamePathSelector(0)56 , m_pEditorName(0) 57 , m_pEditorLocation(0) 58 58 , m_pComboFamily(0) 59 59 , m_pComboType(0) … … 65 65 QString UINameAndSystemEditor::name() const 66 66 { 67 if (!m_pNamePathSelector) 68 return QString(); 69 return m_pNamePathSelector->name(); 70 } 71 72 QString UINameAndSystemEditor::path() const 73 { 74 if (!m_pNamePathSelector) 75 return vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder(); 76 return m_pNamePathSelector->path(); 67 if (!m_fChooseLocation) 68 return m_pEditorName->text(); 69 else 70 return m_pEditorLocation->path(); 77 71 } 78 72 79 73 void UINameAndSystemEditor::setName(const QString &strName) 80 74 { 81 if (!m_pNamePathSelector) 82 return; 83 m_pNamePathSelector->setName(strName); 75 if (!m_fChooseLocation) 76 m_pEditorName->setText(strName); 77 else 78 m_pEditorLocation->setPath(strName); 84 79 } 85 80 … … 117 112 void UINameAndSystemEditor::retranslateUi() 118 113 { 114 m_pLabelName->setText(tr("N&ame:")); 119 115 m_pLabelFamily->setText(tr("&Type:")); 120 116 m_pLabelType->setText(tr("&Version:")); 121 m_pNamePathLabel->setText(tr("Path/Name:")); 122 117 if (!m_fChooseLocation) 118 m_pEditorName->setWhatsThis(tr("Holds the name of the virtual machine.")); 119 else 120 m_pEditorLocation->setWhatsThis(tr("Holds the location of the virtual machine.")); 123 121 m_pComboFamily->setWhatsThis(tr("Selects the operating system family that " 124 122 "you plan to install into this virtual machine.")); … … 229 227 pMainLayout->setContentsMargins(0, 0, 0, 0); 230 228 231 m_pNamePathLabel = new QLabel; 232 if (m_pNamePathLabel) 233 { 234 m_pNamePathLabel->setAlignment(Qt::AlignRight); 235 m_pNamePathLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 236 pMainLayout->addWidget(m_pNamePathLabel, 0, 0, 1, 1); 237 } 238 m_pNamePathSelector = new UIVMNamePathSelector; 239 if (m_pNamePathSelector) 240 { 241 m_pNamePathSelector->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 242 pMainLayout->addWidget(m_pNamePathSelector, 0, 1, 1, 2); 229 /* Create VM name label: */ 230 m_pLabelName = new QLabel; 231 if (m_pLabelName) 232 { 233 /* Configure VM name label: */ 234 m_pLabelName->setAlignment(Qt::AlignRight); 235 m_pLabelName->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); 236 /* Add VM name label into main-layout: */ 237 pMainLayout->addWidget(m_pLabelName, 0, 0); 238 } 239 240 if (!m_fChooseLocation) 241 { 242 /* Create VM name editor: */ 243 m_pEditorName = new QLineEdit; 244 if (m_pEditorName) 245 { 246 /* Configure VM name editor: */ 247 m_pEditorName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 248 m_pLabelName->setBuddy(m_pEditorName); 249 /* Add VM name editor into main-layout: */ 250 pMainLayout->addWidget(m_pEditorName, 0, 1, 1, 2); 251 } 252 } 253 else 254 { 255 /* Create VM location editor: */ 256 m_pEditorLocation = new UIFilePathSelector; 257 if (m_pEditorLocation) 258 { 259 /* Configure advanced VM name editor: */ 260 m_pEditorLocation->setResetEnabled(false); 261 m_pEditorLocation->setMode(UIFilePathSelector::Mode_File_Save); 262 m_pEditorLocation->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 263 m_pEditorLocation->setHomeDir(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder()); 264 m_pLabelName->setBuddy(m_pEditorLocation); 265 /* Add advanced VM name editor into main-layout: */ 266 pMainLayout->addWidget(m_pEditorLocation, 0, 1, 1, 2); 267 } 243 268 } 244 269 … … 300 325 pLayoutIcon->addWidget(m_pIconType); 301 326 } 327 302 328 /* Add stretch to sub-layout: */ 303 329 pLayoutIcon->addStretch(); … … 332 358 { 333 359 /* Prepare connections: */ 334 connect(m_pNamePathSelector, &UIVMNamePathSelector::sigNameChanged, 335 this, &UINameAndSystemEditor::sigNameChanged); 360 if (!m_fChooseLocation) 361 connect(m_pEditorName, &QLineEdit::textChanged, 362 this, &UINameAndSystemEditor::sigNameChanged); 363 else 364 connect(m_pEditorLocation, &UIFilePathSelector::pathChanged, 365 this, &UINameAndSystemEditor::sigNameChanged); 336 366 connect(m_pComboFamily, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 337 367 this, &UINameAndSystemEditor::sltFamilyChanged); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UINameAndSystemEditor.h
r72173 r72174 36 36 class QString; 37 37 class UIFilePathSelector; 38 class UIVMNamePathSelector;39 38 40 39 /** QWidget subclass providing complex editor for basic VM parameters. */ … … 59 58 UINameAndSystemEditor(QWidget *pParent, bool fChooseLocation = false); 60 59 60 /** Returns the VM name editor. */ 61 QLineEdit *nameEditor() const { return m_pEditorName; } 62 /** Returns the VM location editor. */ 63 UIFilePathSelector *locationEditor() const { return m_pEditorLocation; } 64 61 65 /** Returns the VM name. */ 62 66 QString name() const; 63 /** Returns path string selected by the user. */64 QString path() const;65 66 67 /** Defines the VM @a strName. */ 67 68 void setName(const QString &strName); … … 85 86 void sltTypeChanged(int iIndex); 86 87 87 88 private: 88 89 89 90 /** @name Prepare cascade. … … 112 113 bool m_fSupportsLongMode; 113 114 115 /** Holds the VM name label instance. */ 116 QLabel *m_pLabelName; 114 117 /** Holds the VM OS family label instance. */ 115 118 QLabel *m_pLabelFamily; … … 118 121 /** Holds the VM OS type icon instance. */ 119 122 QLabel *m_pIconType; 120 121 QLabel *m_pNamePathLabel; 122 UIVMNamePathSelector *m_pNamePathSelector; 123 /** Holds the VM name editor instance. */ 124 QLineEdit *m_pEditorName; 125 /** Holds the VM location editor instance. */ 126 UIFilePathSelector *m_pEditorLocation; 123 127 /** Holds the VM OS family combo instance. */ 124 128 QComboBox *m_pComboFamily; -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIVMNamePathSelector.cpp
r72173 r72174 25 25 26 26 /* GUI includes: */ 27 # include "QIFileDialog.h"28 27 # include "QILineEdit.h" 29 28 # include "QILabel.h" 30 # include "QIToolButton.h"31 # include "UIIconPool.h"32 29 # include "UIVMNamePathSelector.h" 33 30 # include "VBoxGlobal.h" … … 38 35 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 39 36 37 38 40 39 UIVMNamePathSelector::UIVMNamePathSelector(QWidget *pParent /* = 0 */) 41 40 : QIWithRetranslateUI<QWidget>(pParent) … … 44 43 , m_pName(0) 45 44 , m_pSeparator(0) 46 ,m_pFileDialogButton(0)47 45 { 48 46 prepareWidgets(); 49 retranslateUi();50 47 } 51 48 … … 55 52 CVirtualBox vbox = vboxGlobal().virtualBox(); 56 53 /* Get default machine folder: */ 57 return vbox.GetSystemProperties().GetDefaultMachineFolder();54 /*const QString strDefaultMachineFolder = */return vbox.GetSystemProperties().GetDefaultMachineFolder(); 58 55 59 56 } … … 68 65 m_pMainLayout->setSpacing(0); 69 66 setLayout(m_pMainLayout); 70 71 m_pFileDialogButton = new QIToolButton(this);72 if (m_pFileDialogButton)73 {74 m_pMainLayout->addWidget(m_pFileDialogButton);75 m_pFileDialogButton->setIcon(UIIconPool::iconSet(QString(":/sf_add_16px.png")));76 connect(m_pFileDialogButton, &QIToolButton::clicked, this, &UIVMNamePathSelector::sltOpenPathSelector);77 }78 67 79 68 m_pPath = new QILineEdit; … … 95 84 { 96 85 m_pMainLayout->addWidget(m_pName); 97 connect(m_pName, &QILineEdit::textChanged,98 this, &UIVMNamePathSelector::sigNameChanged);99 100 86 } 101 87 … … 135 121 void UIVMNamePathSelector::retranslateUi() 136 122 { 137 setToolTip(tr("The Virtual Machine files will be saved under ..."));138 123 } 139 140 void UIVMNamePathSelector::sltOpenPathSelector()141 {142 143 QString strSelectedPath = QIFileDialog::getExistingDirectory(m_pPath->text(), this,144 QString("Select a parent folder for new Virtual Machine"));145 if (!strSelectedPath.isEmpty())146 {147 m_pPath->setText(strSelectedPath);148 }149 } -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIVMNamePathSelector.h
r72173 r72174 29 29 class QILabel; 30 30 class QILineEdit; 31 class QIToolButton; 31 32 32 33 33 class SHARED_LIBRARY_STUFF UIVMNamePathSelector : public QIWithRetranslateUI<QWidget> … … 36 36 37 37 signals: 38 39 void sigNameChanged(const QString &strName);40 38 41 39 public: … … 57 55 private slots: 58 56 59 void sltOpenPathSelector();60 57 61 58 private: … … 68 65 QILineEdit *m_pName; 69 66 QILabel *m_pSeparator; 70 QIToolButton *m_pFileDialogButton;71 72 67 }; 73 68 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp
r72173 r72174 25 25 26 26 /* Local includes: */ 27 # include "QIRichTextLabel.h"28 # include "UIEmptyFilePathSelector.h"29 # include "UIFilePathSelector.h"30 27 # include "UIWizardImportAppPageBasic1.h" 31 28 # include "UIWizardImportAppPageBasic2.h" 32 29 # include "UIWizardImportApp.h" 33 30 # include "VBoxGlobal.h" 34 35 /* COM includes: */ 36 # include "CSystemProperties.h" 31 # include "UIEmptyFilePathSelector.h" 32 # include "QIRichTextLabel.h" 37 33 38 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 58 54 pMainLayout->addWidget(m_pLabel); 59 55 pMainLayout->addWidget(m_pFileSelector); 60 61 62 m_pDefaultFolderLabel = new QIRichTextLabel(this);63 if (m_pDefaultFolderLabel)64 {65 pMainLayout->addWidget(m_pDefaultFolderLabel);66 }67 68 m_pDestinationFolderSelector = new UIFilePathSelector(this);69 if (m_pDestinationFolderSelector)70 {71 m_pDestinationFolderSelector->setMode(UIFilePathSelector::Mode_Folder);72 pMainLayout->addWidget(m_pDestinationFolderSelector);73 74 m_pDestinationFolderSelector->setPath(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder());75 m_pDestinationFolderSelector->setResetEnabled(false);76 }77 78 56 pMainLayout->addStretch(); 79 57 } … … 92 70 "saved in the Open Virtualization Format (OVF). " 93 71 "To continue, select the file to import below.</p>")); 94 m_pDefaultFolderLabel->setText(UIWizardImportApp::tr("Select a destionation folder for appliance"));95 72 m_pFileSelector->setChooseButtonToolTip(UIWizardImportApp::tr("Choose a virtual appliance file to import...")); 96 73 m_pFileSelector->setFileDialogTitle(UIWizardImportApp::tr("Please choose a virtual appliance file to import")); … … 130 107 return pImportApplianceWidget->isValid(); 131 108 } 109 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.h
r72173 r72174 24 24 /* Forward declarations: */ 25 25 class UIEmptyFilePathSelector; 26 class UIFilePathSelector;27 26 class QIRichTextLabel; 28 27 … … 37 36 /* Widgets: */ 38 37 UIEmptyFilePathSelector *m_pFileSelector; 39 QIRichTextLabel *m_pDefaultFolderLabel;40 UIFilePathSelector *m_pDestinationFolderSelector;41 38 }; 42 39 … … 68 65 69 66 #endif /* __UIWizardImportAppPageBasic1_h__ */ 67 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.cpp
r72173 r72174 217 217 bool UIWizardNewVMPage1::createMachineFolder() 218 218 { 219 if (!m_pNameAndSystemEditor)220 return false;221 219 /* Cleanup previosly created folder if any: */ 222 220 if (machineFolderCreated() && !cleanupMachineFolder()) … … 229 227 CVirtualBox vbox = vboxGlobal().virtualBox(); 230 228 /* Get default machine folder: */ 231 //const QString strMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 232 229 const QString strDefaultMachineFolder = vbox.GetSystemProperties().GetDefaultMachineFolder(); 233 230 /* Compose machine filename: */ 234 231 const QString strMachineFilePath = vbox.ComposeMachineFilename(m_pNameAndSystemEditor->name(), 235 232 m_strGroup, 236 233 QString(), 237 m_pNameAndSystemEditor->path());234 strDefaultMachineFolder); 238 235 /* Compose machine folder/basename: */ 239 236 const QFileInfo fileInfo(strMachineFilePath); … … 318 315 319 316 /* Translate widgets: */ 320 m_pLabel->setText(UIWizardNewVM::tr("Please choose a descriptive name and destination folderfor the new virtual machine "317 m_pLabel->setText(UIWizardNewVM::tr("Please choose a descriptive name for the new virtual machine " 321 318 "and select the type of operating system you intend to install on it. " 322 319 "The name you choose will be used throughout VirtualBox " … … 343 340 return createMachineFolder(); 344 341 } 342 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic1.h
r72173 r72174 58 58 QString m_strMachineBaseName; 59 59 60 /* * Provides a path selector and a line edit field for path and name entry.*/60 /* Widgets: */ 61 61 UINameAndSystemEditor *m_pNameAndSystemEditor; 62 62 63 /* *Variables: */63 /* Variables: */ 64 64 QString m_strGroup; 65 65 bool m_fSupportsHWVirtEx; … … 107 107 108 108 #endif // __UIWizardNewVMPageBasic1_h__ 109
Note:
See TracChangeset
for help on using the changeset viewer.