Changeset 10475 in vbox
- Timestamp:
- Jul 10, 2008 3:51:22 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsSelector.h
r10474 r10475 70 70 }; 71 71 72 class VBoxSettingsTree Selector: public VBoxSettingsSelector72 class VBoxSettingsTreeViewSelector: public VBoxSettingsSelector 73 73 { 74 74 Q_OBJECT; … … 76 76 public: 77 77 78 VBoxSettingsTree Selector (QWidget *aParent = NULL);78 VBoxSettingsTreeViewSelector (QWidget *aParent = NULL); 79 79 80 80 virtual QWidget *widget() const; … … 138 138 private: 139 139 140 int findId (int aIndex) const;141 int findIndex (int aId) const;142 int findLink (const QString &aLink) const;143 140 SelectorAction* findAction (int aId) const; 144 141 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialog.cpp
r10474 r10475 78 78 #else 79 79 /* Create the classical tree view selector */ 80 mSelector = new VBoxSettingsTree Selector (mAllWidget);80 mSelector = new VBoxSettingsTreeViewSelector (this); 81 81 mainLayout->addWidget (mSelector->widget(), 0, 0, 3, 1); 82 82 mSelector->widget()->setFocus(); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsDialogSpecific.cpp
r10474 r10475 226 226 227 227 attachPage (new VBoxVMSettingsVRDP()); 228 229 /* Applying language settings */ 230 retranslateUi(); 228 231 229 232 /* Setup Settings Dialog */ … … 257 260 } 258 261 } 259 /* Applying language settings */260 retranslateUi();261 262 } 262 263 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSettingsSelector.cpp
r10474 r10475 39 39 } 40 40 41 /* VBoxSettingsTree Selector */41 /* VBoxSettingsTreeViewSelector */ 42 42 43 43 /* Returns the path to the item in the form of 'grandparent > parent > item' … … 58 58 } 59 59 60 VBoxSettingsTree Selector::VBoxSettingsTreeSelector (QWidget *aParent /* = NULL */)60 VBoxSettingsTreeViewSelector::VBoxSettingsTreeViewSelector (QWidget *aParent /* = NULL */) 61 61 :VBoxSettingsSelector (aParent) 62 62 { … … 85 85 } 86 86 87 QWidget *VBoxSettingsTree Selector::widget() const87 QWidget *VBoxSettingsTreeViewSelector::widget() const 88 88 { 89 89 return mTwSelector; 90 90 } 91 91 92 void VBoxSettingsTree Selector::addItem (const QIcon &aIcon,92 void VBoxSettingsTreeViewSelector::addItem (const QIcon &aIcon, 93 93 const QString &aText, 94 94 int aId, … … 101 101 } 102 102 103 QString VBoxSettingsTree Selector::itemText (int aId) const103 QString VBoxSettingsTreeViewSelector::itemText (int aId) const 104 104 { 105 105 return pagePath (idToString (aId)); 106 106 } 107 107 108 int VBoxSettingsTree Selector::currentId () const108 int VBoxSettingsTreeViewSelector::currentId () const 109 109 { 110 110 int id = -1; … … 115 115 } 116 116 117 int VBoxSettingsTree Selector::idToIndex (int aId) const117 int VBoxSettingsTreeViewSelector::idToIndex (int aId) const 118 118 { 119 119 int index = -1; … … 124 124 } 125 125 126 int VBoxSettingsTree Selector::indexToId (int aIndex) const126 int VBoxSettingsTreeViewSelector::indexToId (int aIndex) const 127 127 { 128 128 int id = -1; … … 133 133 } 134 134 135 int VBoxSettingsTree Selector::linkToId (const QString &aLink) const135 int VBoxSettingsTreeViewSelector::linkToId (const QString &aLink) const 136 136 { 137 137 int id = -1; … … 143 143 144 144 145 void VBoxSettingsTree Selector::selectById (int aId)145 void VBoxSettingsTreeViewSelector::selectById (int aId) 146 146 { 147 147 QTreeWidgetItem *item = findItem (mTwSelector, idToString (aId), treeWidget_Id); … … 150 150 } 151 151 152 void VBoxSettingsTree Selector::setVisibleById (int aId, bool aShow)152 void VBoxSettingsTreeViewSelector::setVisibleById (int aId, bool aShow) 153 153 { 154 154 QTreeWidgetItem *item = findItem (mTwSelector, idToString (aId), treeWidget_Category); … … 157 157 } 158 158 159 void VBoxSettingsTree Selector::clear()159 void VBoxSettingsTreeViewSelector::clear() 160 160 { 161 161 mTwSelector->clear(); 162 162 } 163 163 164 void VBoxSettingsTree Selector::polish()164 void VBoxSettingsTreeViewSelector::polish() 165 165 { 166 166 mTwSelector->setFixedWidth (static_cast<QAbstractItemView*> (mTwSelector) … … 175 175 } 176 176 177 void VBoxSettingsTree Selector::settingsGroupChanged (QTreeWidgetItem *aItem,177 void VBoxSettingsTreeViewSelector::settingsGroupChanged (QTreeWidgetItem *aItem, 178 178 QTreeWidgetItem * /* aPrevItem */) 179 179 { … … 190 190 * details. 191 191 */ 192 QString VBoxSettingsTree Selector::pagePath (const QString &aMatch) const192 QString VBoxSettingsTreeViewSelector::pagePath (const QString &aMatch) const 193 193 { 194 194 QTreeWidgetItem *li = … … 201 201 /* Returns first item of 'aView' matching required 'aMatch' value 202 202 * searching the 'aColumn' column. */ 203 QTreeWidgetItem* VBoxSettingsTree Selector::findItem (QTreeWidget *aView,203 QTreeWidgetItem* VBoxSettingsTreeViewSelector::findItem (QTreeWidget *aView, 204 204 const QString &aMatch, 205 205 int aColumn) const … … 211 211 } 212 212 213 QString VBoxSettingsTree Selector::idToString (int aId) const213 QString VBoxSettingsTreeViewSelector::idToString (int aId) const 214 214 { 215 215 return QString ("%1").arg (aId, 2, 10, QLatin1Char ('0')); … … 287 287 int VBoxSettingsToolBarSelector::idToIndex (int aId) const 288 288 { 289 return findIndex (aId);290 }291 292 int VBoxSettingsToolBarSelector::indexToId (int aIndex) const293 {294 return findId (aIndex);295 }296 297 int VBoxSettingsToolBarSelector::linkToId (const QString &aLink) const298 {299 return findLink (aLink);300 }301 302 303 void VBoxSettingsToolBarSelector::selectById (int aId)304 {305 SelectorAction *action = findAction (aId);306 307 if (action)308 action->trigger();309 }310 311 void VBoxSettingsToolBarSelector::setVisibleById (int aId, bool aShow)312 {313 SelectorAction *action = findAction (aId);314 315 if (action)316 action->setVisible (aShow);317 }318 319 void VBoxSettingsToolBarSelector::clear()320 {321 QList<QAction*> list = mActionGroup->actions();322 foreach (QAction *action, list)323 delete action;324 }325 326 int VBoxSettingsToolBarSelector::minWidth() const327 {328 return mTbSelector->sizeHint().width() + 2 * 10;329 }330 331 void VBoxSettingsToolBarSelector::settingsGroupChanged (QAction *aAction)332 {333 SelectorAction *action = static_cast<SelectorAction*> (aAction);334 if (action)335 emit categoryChanged (action->id());336 }337 338 int VBoxSettingsToolBarSelector::findId (int aIndex) const339 {340 int id = -1;341 QList<QAction*> list = mActionGroup->actions();342 if (aIndex > -1 &&343 aIndex < list.count())344 {345 SelectorAction *sa = static_cast<SelectorAction*> (list.at (aIndex));346 if (sa)347 id = sa->id();348 }349 return id;350 }351 352 int VBoxSettingsToolBarSelector::findIndex (int aId) const353 {354 289 int index = -1; 355 290 QList<QAction*> list = mActionGroup->actions(); … … 367 302 } 368 303 369 int VBoxSettingsToolBarSelector::findLink (const QString &aLink) const 304 int VBoxSettingsToolBarSelector::indexToId (int aIndex) const 305 { 306 int id = -1; 307 QList<QAction*> list = mActionGroup->actions(); 308 if (aIndex > -1 && 309 aIndex < list.count()) 310 { 311 SelectorAction *sa = static_cast<SelectorAction*> (list.at (aIndex)); 312 if (sa) 313 id = sa->id(); 314 } 315 return id; 316 } 317 318 int VBoxSettingsToolBarSelector::linkToId (const QString &aLink) const 370 319 { 371 320 int id = -1; … … 384 333 } 385 334 335 336 void VBoxSettingsToolBarSelector::selectById (int aId) 337 { 338 SelectorAction *action = findAction (aId); 339 340 if (action) 341 action->trigger(); 342 } 343 344 void VBoxSettingsToolBarSelector::setVisibleById (int aId, bool aShow) 345 { 346 SelectorAction *action = findAction (aId); 347 348 if (action) 349 action->setVisible (aShow); 350 } 351 352 void VBoxSettingsToolBarSelector::clear() 353 { 354 QList<QAction*> list = mActionGroup->actions(); 355 foreach (QAction *action, list) 356 delete action; 357 } 358 359 int VBoxSettingsToolBarSelector::minWidth() const 360 { 361 return mTbSelector->sizeHint().width() + 2 * 10; 362 } 363 364 void VBoxSettingsToolBarSelector::settingsGroupChanged (QAction *aAction) 365 { 366 SelectorAction *action = static_cast<SelectorAction*> (aAction); 367 if (action) 368 emit categoryChanged (action->id()); 369 } 370 386 371 SelectorAction* VBoxSettingsToolBarSelector::findAction (int aId) const 387 372 { 388 int index = findIndex (aId);373 int index = idToIndex (aId); 389 374 SelectorAction *sa = NULL; 390 375 QList<QAction*> list = mActionGroup->actions();
Note:
See TracChangeset
for help on using the changeset viewer.