- Timestamp:
- Apr 19, 2008 11:23:26 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxHardDiskSettings.ui
r8155 r8181 123 123 key on the highlighted item to activate the 124 124 drop-down list and choose the desired value. 125 Use buttons to the right to add or remove hard 126 disk attachments.</qt> 125 Use the context menu or buttons to the right 126 to add or remove hard disk 127 attachments.</qt> 127 128 </string> 128 129 </property> … … 130 131 <widget class="QLayoutWidget"> 131 132 <property name="name"> 132 <cstring> layout1</cstring>133 <cstring>mToolBarLayout</cstring> 133 134 </property> 134 135 <vbox> … … 139 140 <number>0</number> 140 141 </property> 141 <widget class="QToolButton">142 <property name="name">143 <cstring>mBtnAdd</cstring>144 </property>145 <property name="focusPolicy">146 <enum>TabFocus</enum>147 </property>148 <property name="text">149 <string></string>150 </property>151 <property name="accel">152 <string>Ins</string>153 </property>154 <property name="autoRaise">155 <bool>true</bool>156 </property>157 <property name="toolTip" stdset="0">158 <string>Add (Ins)</string>159 </property>160 <property name="whatsThis" stdset="0">161 <string>162 <qt> Adds a new hard disk163 attachment.</qt>164 </string>165 </property>166 </widget>167 <widget class="QToolButton">168 <property name="name">169 <cstring>mBtnDel</cstring>170 </property>171 <property name="focusPolicy">172 <enum>TabFocus</enum>173 </property>174 <property name="text">175 <string></string>176 </property>177 <property name="accel">178 <string>Del</string>179 </property>180 <property name="autoRaise">181 <bool>true</bool>182 </property>183 <property name="toolTip" stdset="0">184 <string>Remove (Del)</string>185 </property>186 <property name="whatsThis" stdset="0">187 <string>188 <qt>Removes the highlighted hard189 disk attachment.</qt>190 </string>191 </property>192 </widget>193 <widget class="QToolButton">194 <property name="name">195 <cstring>mBtnOpn</cstring>196 </property>197 <property name="focusPolicy">198 <enum>TabFocus</enum>199 </property>200 <property name="text">201 <string></string>202 </property>203 <property name="accel">204 <string>Ctrl+Space</string>205 </property>206 <property name="autoRaise">207 <bool>true</bool>208 </property>209 <property name="toolTip" stdset="0">210 <string>Select (Ctrl+Space)</string>211 </property>212 <property name="whatsThis" stdset="0">213 <string>214 <qt> Invokes the Virtual Disk215 Manager to select a hard disk to216 attach to the currently highlighted217 slot.</qt>218 </string>219 </property>220 </widget>221 142 <spacer> 222 143 <property name="name"> … … 244 165 </vbox> 245 166 </widget> 167 <toolbars> 168 </toolbars> 169 <actions> 170 <action> 171 <property name="name"> 172 <cstring>mAddAttachmentAct</cstring> 173 </property> 174 <property name="text"> 175 <string>Add Attachment</string> 176 </property> 177 <property name="menuText"> 178 <string>&Add Attachment</string> 179 </property> 180 <property name="accel"> 181 <string>Ins</string> 182 </property> 183 <property name="whatsThis" stdset="0"> 184 <string> 185 <qt> Adds a new hard disk attachment.</qt> 186 </string> 187 </property> 188 </action> 189 <action> 190 <property name="name"> 191 <cstring>mRemoveAttachmentAct</cstring> 192 </property> 193 <property name="text"> 194 <string>Remove Attachment</string> 195 </property> 196 <property name="menuText"> 197 <string>&Remove Attachment</string> 198 </property> 199 <property name="accel"> 200 <string>Delete</string> 201 </property> 202 <property name="whatsThis" stdset="0"> 203 <string> 204 <qt>Removes the highlighted hard disk attachment.</qt> 205 </string> 206 </property> 207 </action> 208 <action> 209 <property name="name"> 210 <cstring>mSelectHardDiskAct</cstring> 211 </property> 212 <property name="text"> 213 <string>Select Hard Disk</string> 214 </property> 215 <property name="menuText"> 216 <string>&Select Hard Disk</string> 217 </property> 218 <property name="accel"> 219 <string>Ctrl+Space</string> 220 </property> 221 <property name="whatsThis" stdset="0"> 222 <string> 223 <qt> Invokes the Virtual Disk Manager to select a hard disk 224 to attach to the currently highlighted slot.</qt> 225 </string> 226 </property> 227 </action> 228 </actions> 229 <connections> 230 <connection> 231 <sender>mAddAttachmentAct</sender> 232 <signal>activated()</signal> 233 <receiver>VBoxHardDiskSettings</receiver> 234 <slot>addHDItem()</slot> 235 </connection> 236 <connection> 237 <sender>mRemoveAttachmentAct</sender> 238 <signal>activated()</signal> 239 <receiver>VBoxHardDiskSettings</receiver> 240 <slot>delHDItem()</slot> 241 </connection> 242 <connection> 243 <sender>mSelectHardDiskAct</sender> 244 <signal>activated()</signal> 245 <receiver>VBoxHardDiskSettings</receiver> 246 <slot>showVDM()</slot> 247 </connection> 248 </connections> 246 249 <includes> 247 <include location="local" impldecl="in declaration">COMDefs.h</include> 250 <include location="global" impldecl="in declaration">qaction.h</include> 251 <include location="global" impldecl="in declaration">qpopupmenu.h</include> 248 252 <include location="global" impldecl="in implementation">qptrvector.h</include> 249 253 <include location="global" impldecl="in implementation">qcombobox.h</include> … … 252 256 <include location="global" impldecl="in implementation">qaction.h</include> 253 257 <include location="global" impldecl="in implementation">qpopupmenu.h</include> 258 <include location="local" impldecl="in declaration">COMDefs.h</include> 259 <include location="local" impldecl="in implementation">VBoxToolBar.h</include> 254 260 <include location="local" impldecl="in implementation">VBoxGlobal.h</include> 255 261 <include location="local" impldecl="in implementation">VBoxProblemReporter.h</include> … … 266 272 <variable access="private">HDSlotUniquizer *mSlotUniquizer;</variable> 267 273 <variable access="private">CMachine mMachine;</variable> 274 <variable access="private">QPopupMenu *mContextMenu;</variable> 268 275 </variables> 269 276 <signals> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxHardDiskSettings.ui.h
r8155 r8181 516 516 mPrevItem = 0; 517 517 518 mBtnAdd->setIconSet (VBoxGlobal::iconSet ("vdm_add_16px.png", 519 "vdm_add_disabled_16px.png")); 520 mBtnDel->setIconSet (VBoxGlobal::iconSet ("vdm_remove_16px.png", 521 "vdm_remove_disabled_16px.png")); 522 mBtnOpn->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", 523 "select_file_dis_16px.png")); 524 525 mSlotUniquizer = new HDSlotUniquizer (this); 526 518 /* toolbar */ 519 520 VBoxToolBar *toolBar = new VBoxToolBar (0, mGbHDList, "snapshotToolBar"); 521 522 mAddAttachmentAct->addTo (toolBar); 523 mRemoveAttachmentAct->addTo (toolBar); 524 mSelectHardDiskAct->addTo (toolBar); 525 526 toolBar->setUsesTextLabel (false); 527 toolBar->setUsesBigPixmaps (false); 528 toolBar->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed); 529 toolBar->setOrientation (Qt::Vertical); 530 #ifdef Q_WS_MAC 531 toolBar->setMacStyle(); 532 #endif 533 mToolBarLayout->insertWidget (0, toolBar); 534 535 /* context menu */ 536 mContextMenu = new QPopupMenu (this); 537 mAddAttachmentAct->addTo (mContextMenu); 538 mRemoveAttachmentAct->addTo (mContextMenu); 539 mSelectHardDiskAct->addTo (mContextMenu); 540 541 /* icons */ 542 mAddAttachmentAct->setIconSet 543 (VBoxGlobal::iconSet ("vdm_add_16px.png", "vdm_add_disabled_16px.png")); 544 mRemoveAttachmentAct->setIconSet 545 (VBoxGlobal::iconSet ("vdm_remove_16px.png", "vdm_remove_disabled_16px.png")); 546 mSelectHardDiskAct->setIconSet 547 (VBoxGlobal::iconSet ("select_file_16px.png", "select_file_dis_16px.png")); 548 549 /* connections */ 527 550 connect (mCbSATA, SIGNAL (toggled (bool)), 528 551 this, SLOT (onToggleSATAController (bool))); 529 connect (mBtnAdd, SIGNAL (clicked()), this, SLOT (addHDItem()));530 connect (mBtnDel, SIGNAL (clicked()), this, SLOT (delHDItem()));531 connect (mBtnOpn, SIGNAL (clicked()), this, SLOT (showVDM()));532 552 connect (mLvHD, SIGNAL (pressed (QListViewItem*, const QPoint&, int)), 533 553 this, SLOT (moveFocus (QListViewItem*, const QPoint&, int))); … … 536 556 connect (mLvHD, SIGNAL (contextMenuRequested (QListViewItem*, const QPoint&, int)), 537 557 this, SLOT (onContextMenuRequested (QListViewItem*, const QPoint&, int))); 558 559 /* rest */ 560 561 mSlotUniquizer = new HDSlotUniquizer (this); 538 562 539 563 qApp->installEventFilter (this); … … 754 778 { 755 779 /* Process postponed onCurrentChanged event */ 756 m BtnAdd->setEnabled (mLvHD->childCount() < mSlotUniquizer->totalCount());757 m BtnDel->setEnabled (aItem);758 m BtnOpn->setEnabled (aItem);780 mAddAttachmentAct->setEnabled (mLvHD->childCount() < mSlotUniquizer->totalCount()); 781 mRemoveAttachmentAct->setEnabled (aItem != NULL); 782 mSelectHardDiskAct->setEnabled (aItem != NULL); 759 783 760 784 if (aItem == mPrevItem) … … 776 800 } 777 801 778 void VBoxHardDiskSettings::onContextMenuRequested (QListViewItem *,802 void VBoxHardDiskSettings::onContextMenuRequested (QListViewItem *aItem, 779 803 const QPoint &aPoint, int) 780 804 { 781 QAction opnAction (tr ("Open Virtual Disk Manager"), QKeySequence (tr ("Ctrl+Space")), this); 782 QAction delAction (tr ("Delete Attachment"), QKeySequence (tr ("Delete")), this); 783 delAction.setIconSet (VBoxGlobal::iconSet ("vdm_remove_16px.png", 784 "vdm_remove_disabled_16px.png")); 785 opnAction.setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", 786 "select_file_dis_16px.png")); 787 QPopupMenu menu (this); 788 opnAction.addTo (&menu); 789 delAction.addTo (&menu); 790 int id = menu.exec (aPoint); 791 int index = id == -1 ? id : menu.indexOf (id); 792 if (index == 0) 793 showVDM(); 794 else if (index == 1) 795 delHDItem(); 805 mContextMenu->exec (aPoint); 796 806 } 797 807
Note:
See TracChangeset
for help on using the changeset viewer.