Changeset 9260 in vbox for trunk/src/VBox
- Timestamp:
- May 30, 2008 4:17:27 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsSF.h
r9253 r9260 27 27 #include "QIWithRetranslateUI.h" 28 28 29 /* Qt includes */30 29 #include <QDialog> 30 31 class VBoxVMSettingsDlg; 32 class SFTreeViewItem; 33 class QIDialogButtonBox; 31 34 32 35 class QLineEdit; 33 36 class QPushButton; 34 37 class QCheckBox; 35 class SFTreeViewItem;36 37 class QIDialogButtonBox;38 38 39 39 enum SFDialogType … … 54 54 public: 55 55 56 VBoxVMSettingsSF (QWidget *aParent = 0, int aType = WrongType); 57 56 58 static void getFromMachineEx (const CMachine &aMachine, 57 QWidget *aParent); 59 QWidget *aParent, 60 VBoxVMSettingsDlg *aDlg); 58 61 static void putBackToMachineEx(); 59 60 VBoxVMSettingsSF (QWidget *aParent = 0, int aType = WrongType);61 62 62 63 int dialogType() { return mDialogType; } … … 76 77 private slots: 77 78 78 void tbAddPressed();79 void tbEditPressed();80 void tbRemovePressed();79 void addTriggered(); 80 void edtTriggered(); 81 void delTriggered(); 81 82 82 83 void processCurrentChanged (QTreeWidgetItem *aCurrentItem, 83 84 QTreeWidgetItem *aPreviousItem = 0); 84 85 void processDoubleClick (QTreeWidgetItem *aItem, int aColumn); 86 void showContextMenu (const QPoint &aPos); 85 87 86 88 void adjustList(); … … 107 109 static VBoxVMSettingsSF *mSettings; 108 110 109 int mDialogType; 110 bool mIsListViewChanged; 111 CMachine mMachine; 112 CConsole mConsole; 113 QString mTrFull; 114 QString mTrReadOnly; 111 int mDialogType; 112 QMenu *mMenu; 113 QAction *mNewAction; 114 QAction *mEdtAction; 115 QAction *mDelAction; 116 bool mIsListViewChanged; 117 CMachine mMachine; 118 CConsole mConsole; 119 QString mTrFull; 120 QString mTrReadOnly; 115 121 }; 116 122 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsSF.cpp
r9253 r9260 22 22 23 23 #include "VBoxVMSettingsSF.h" 24 #include "VBoxVMSettingsDlg.h" 24 25 #include "VBoxGlobal.h" 25 26 #include "VBoxProblemReporter.h" 26 27 #include "VBoxUtils.h" 27 28 #include "QIDialogButtonBox.h" 28 29 /* Qt includes */ 29 #include "VBoxToolBar.h" 30 30 31 #include <QLineEdit> 32 #include <QToolButton> 31 33 #include <QPushButton> 32 34 #include <QDir> … … 181 183 Ui::VBoxVMSettingsSF::setupUi (this); 182 184 185 /* Prepare actions */ 186 mNewAction = new QAction (mTreeView); 187 mEdtAction = new QAction (mTreeView); 188 mDelAction = new QAction (mTreeView); 189 190 mNewAction->setText (tr ("&Add New Shared Folder")); 191 mEdtAction->setText (tr ("&Edit Selected Shared Folder")); 192 mDelAction->setText (tr ("&Remove Selected Shared Folder")); 193 194 mNewAction->setShortcut (QKeySequence ("Ins")); 195 mEdtAction->setShortcut (QKeySequence ("Ctrl+Space")); 196 mDelAction->setShortcut (QKeySequence ("Del")); 197 198 mNewAction->setToolTip (mNewAction->text().remove ('&') + 199 QString (" (%1)").arg (mNewAction->shortcut().toString())); 200 mEdtAction->setToolTip (mEdtAction->text().remove ('&') + 201 QString (" (%1)").arg (mEdtAction->shortcut().toString())); 202 mDelAction->setToolTip (mDelAction->text().remove ('&') + 203 QString (" (%1)").arg (mDelAction->shortcut().toString())); 204 205 mNewAction->setWhatsThis (tr ("Adds a new shared folder definition.")); 206 mEdtAction->setWhatsThis (tr ("Edits the selected shared folder definition.")); 207 mDelAction->setWhatsThis (tr ("Removes the selected shared folder definition.")); 208 209 mNewAction->setIcon (VBoxGlobal::iconSet (":/add_shared_folder_16px.png", 210 ":/add_shared_folder_disabled_16px.png")); 211 mEdtAction->setIcon (VBoxGlobal::iconSet (":/edit_shared_folder_16px.png", 212 ":/edit_shared_folder_disabled_16px.png")); 213 mDelAction->setIcon (VBoxGlobal::iconSet (":/revome_shared_folder_16px.png", 214 ":/revome_shared_folder_disabled_16px.png")); 215 216 /* Prepare menu and toolbar */ 217 mMenu = new QMenu (mTreeView); 218 mMenu->addAction (mNewAction); 219 mMenu->addAction (mEdtAction); 220 mMenu->addSeparator(); 221 mMenu->addAction (mDelAction); 222 223 /* Prepare toolbar */ 224 VBoxToolBar *toolBar = new VBoxToolBar (mGbSharedFolders); 225 toolBar->setUsesTextLabel (false); 226 toolBar->setUsesBigPixmaps (false); 227 toolBar->setOrientation (Qt::Vertical); 228 toolBar->addAction (mNewAction); 229 toolBar->addAction (mEdtAction); 230 toolBar->addAction (mDelAction); 231 mGbSharedFolders->layout()->addWidget (toolBar); 232 233 /* Setup connections */ 183 234 mTreeView->header()->setMovable (false); 184 mTbAdd->setIcon (VBoxGlobal::iconSet (":/add_shared_folder_16px.png", 185 ":/add_shared_folder_disabled_16px.png")); 186 mTbEdit->setIcon (VBoxGlobal::iconSet (":/edit_shared_folder_16px.png", 187 ":/edit_shared_folder_disabled_16px.png")); 188 mTbRemove->setIcon (VBoxGlobal::iconSet (":/revome_shared_folder_16px.png", 189 ":/revome_shared_folder_disabled_16px.png")); 190 connect (mTbAdd, SIGNAL (clicked()), this, SLOT (tbAddPressed())); 191 connect (mTbEdit, SIGNAL (clicked()), this, SLOT (tbEditPressed())); 192 connect (mTbRemove, SIGNAL (clicked()), this, SLOT (tbRemovePressed())); 235 connect (mNewAction, SIGNAL (triggered (bool)), this, SLOT (addTriggered())); 236 connect (mEdtAction, SIGNAL (triggered (bool)), this, SLOT (edtTriggered())); 237 connect (mDelAction, SIGNAL (triggered (bool)), this, SLOT (delTriggered())); 193 238 connect (mTreeView, SIGNAL (currentItemChanged (QTreeWidgetItem*, QTreeWidgetItem*)), 194 239 this, SLOT (processCurrentChanged (QTreeWidgetItem*, QTreeWidgetItem*))); 195 240 connect (mTreeView, SIGNAL (itemDoubleClicked (QTreeWidgetItem*, int)), 196 241 this, SLOT (processDoubleClick (QTreeWidgetItem*, int))); 242 connect (mTreeView, SIGNAL (customContextMenuRequested (const QPoint &)), 243 this, SLOT (showContextMenu (const QPoint &))); 197 244 connect (mTreeView->header(), SIGNAL (sectionResized (int, int, int)), 198 245 this, SLOT (adjustFields())); … … 230 277 231 278 void VBoxVMSettingsSF::getFromMachineEx (const CMachine &aMachine, 232 QWidget *aPage) 279 QWidget *aPage, 280 VBoxVMSettingsDlg *aDlg) 233 281 { 234 282 mSettings = new VBoxVMSettingsSF (aPage, MachineType); … … 237 285 layout->addWidget (mSettings); 238 286 mSettings->getFromMachine (aMachine); 287 288 /* Fixing Tab Order */ 289 setTabOrder (aDlg->mTwSelector, mSettings->mTreeView); 239 290 } 240 291 … … 323 374 } 324 375 325 void VBoxVMSettingsSF:: tbAddPressed()376 void VBoxVMSettingsSF::addTriggered() 326 377 { 327 378 /* Invoke Add-Box Dialog */ … … 356 407 } 357 408 358 void VBoxVMSettingsSF:: tbEditPressed()409 void VBoxVMSettingsSF::edtTriggered() 359 410 { 360 411 /* Check selected item */ … … 408 459 } 409 460 410 void VBoxVMSettingsSF:: tbRemovePressed()461 void VBoxVMSettingsSF::delTriggered() 411 462 { 412 463 QTreeWidgetItem *selectedItem = mTreeView->selectedItems().size() == 1 ? … … 429 480 bool addEnabled = aCurrentItem && isEditable (key); 430 481 bool removeEnabled = addEnabled && aCurrentItem->parent(); 431 m TbAdd->setEnabled (addEnabled);432 m TbEdit->setEnabled (removeEnabled);433 m TbRemove->setEnabled (removeEnabled);482 mNewAction->setEnabled (addEnabled); 483 mEdtAction->setEnabled (removeEnabled); 484 mDelAction->setEnabled (removeEnabled); 434 485 } 435 486 … … 440 491 isEditable (aItem->parent()->text (1)); 441 492 if (editEnabled) 442 tbEditPressed(); 493 edtTriggered(); 494 } 495 496 void VBoxVMSettingsSF::showContextMenu (const QPoint &aPos) 497 { 498 mMenu->exec (mTreeView->mapToGlobal (aPos)); 443 499 } 444 500 … … 727 783 728 784 /* Setup Button layout */ 729 mButtonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);785 mButtonBox = new QIDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 730 786 mButtonBox->setCenterButtons (true); 731 787 connect (mButtonBox, SIGNAL (accepted()), this, SLOT (accept())); -
trunk/src/VBox/Frontends/VirtualBox4/ui/VBoxVMSettingsSF.ui
r9253 r9260 57 57 <item> 58 58 <widget class="QTreeWidget" name="mTreeView" > 59 <property name="contextMenuPolicy" > 60 <enum>Qt::CustomContextMenu</enum> 61 </property> 59 62 <property name="whatsThis" > 60 63 <string><qt>Lists all shared folders accessible to this machine. Use <tt>net use x: \\vboxsvr\share</tt> to access a shared folder named <i>share</i> from a DOS-like OS, or <tt>mount -t vboxsf share mount_point</tt> to access it from a Linux OS. This feature requires Guest Additions.</qt></string> … … 83 86 </widget> 84 87 </item> 85 <item>86 <layout class="QVBoxLayout" >87 <property name="spacing" >88 <number>0</number>89 </property>90 <item>91 <widget class="QToolButton" name="mTbAdd" >92 <property name="focusPolicy" >93 <enum>Qt::TabFocus</enum>94 </property>95 <property name="toolTip" >96 <string>Add a new shared folder (Ins)</string>97 </property>98 <property name="whatsThis" >99 <string>Adds a new shared folder definition.</string>100 </property>101 <property name="text" >102 <string/>103 </property>104 <property name="shortcut" >105 <string>Ins</string>106 </property>107 <property name="autoRaise" >108 <bool>true</bool>109 </property>110 </widget>111 </item>112 <item>113 <widget class="QToolButton" name="mTbEdit" >114 <property name="focusPolicy" >115 <enum>Qt::TabFocus</enum>116 </property>117 <property name="toolTip" >118 <string>Edit the selected shared folder (Ctrl+Space)</string>119 </property>120 <property name="whatsThis" >121 <string>Edits the selected shared folder definition.</string>122 </property>123 <property name="text" >124 <string/>125 </property>126 <property name="shortcut" >127 <string>Ctrl+Space</string>128 </property>129 <property name="autoRaise" >130 <bool>true</bool>131 </property>132 </widget>133 </item>134 <item>135 <widget class="QToolButton" name="mTbRemove" >136 <property name="focusPolicy" >137 <enum>Qt::TabFocus</enum>138 </property>139 <property name="toolTip" >140 <string>Remove the selected shared folder (Del)</string>141 </property>142 <property name="whatsThis" >143 <string>Removes the selected shared folder definition.</string>144 </property>145 <property name="text" >146 <string/>147 </property>148 <property name="shortcut" >149 <string>Del</string>150 </property>151 <property name="autoRaise" >152 <bool>true</bool>153 </property>154 </widget>155 </item>156 <item>157 <spacer>158 <property name="orientation" >159 <enum>Qt::Vertical</enum>160 </property>161 <property name="sizeType" >162 <enum>QSizePolicy::Expanding</enum>163 </property>164 <property name="sizeHint" >165 <size>166 <width>21</width>167 <height>101</height>168 </size>169 </property>170 </spacer>171 </item>172 </layout>173 </item>174 88 </layout> 175 89 </widget>
Note:
See TracChangeset
for help on using the changeset viewer.