VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h@ 953

Last change on this file since 953 was 815, checked in by vboxsync, 18 years ago

Main:

  • Return E_NOTIMPL for global USB filters and all other stuff when no VBOX_WITH_USB is defined (as in OSE).
  • Moved the USB Proxy Service check to Host to make it reusable both for global-related USB methods and for VM-related methods.

FE/Qt:

  • Don't show Global USB UI when USB is not available.
  • Show the "USB Proxy Service is unavailable" message box when opening both global and VM settings.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.1 KB
Line 
1/**
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * "Global settings" dialog UI include (Qt Designer)
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung GmbH
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23/****************************************************************************
24** ui.h extension file, included from the uic-generated form implementation.
25**
26** If you wish to add, delete or rename functions or slots use
27** Qt Designer which will update this file, preserving your code. Create an
28** init() function in place of a constructor, and a destroy() function in
29** place of a destructor.
30*****************************************************************************/
31
32
33/**
34 * Returns the path to the item in the form of 'grandparent > parent > item'
35 * using the text of the first column of every item.
36 */
37static QString path (QListViewItem *li)
38{
39 static QString sep = ": ";
40 QString p;
41 QListViewItem *cur = li;
42 while (cur)
43 {
44 if (!p.isNull())
45 p = sep + p;
46 p = cur->text (0).simplifyWhiteSpace() + p;
47 cur = cur->parent();
48 }
49 return p;
50}
51
52
53enum
54{
55 // listView column numbers
56 listView_Category = 0,
57 listView_Id = 1,
58 listView_Link = 2,
59};
60
61
62class USBListItem : public QCheckListItem
63{
64public:
65
66 USBListItem (QListView *aParent, QListViewItem *aAfter)
67 : QCheckListItem (aParent, aAfter, QString::null, CheckBox)
68 , mId (-1) {}
69
70 int mId;
71};
72enum { lvUSBFilters_Name = 0 };
73
74
75void VBoxGlobalSettingsDlg::init()
76{
77 polished = false;
78
79 setCaption (tr ("VirtualBox Global Settings"));
80 setIcon (QPixmap::fromMimeSource ("global_settings_16px.png"));
81
82 /* all pages are initially valid */
83 valid = true;
84 buttonOk->setEnabled (true);
85 warningSpacer->changeSize (0, 0, QSizePolicy::Expanding);
86 warningLabel->setHidden (true);
87 warningPixmap->setHidden (true);
88
89 /* disable unselecting items by clicking in the unused area of the list */
90 new QIListViewSelectionPreserver (this, listView);
91 /* hide the header and internal columns */
92 listView->header()->hide();
93 listView->setColumnWidthMode (listView_Id, QListView::Manual);
94 listView->setColumnWidthMode (listView_Link, QListView::Manual);
95 listView->hideColumn (listView_Id);
96 listView->hideColumn (listView_Link);
97 /* sort by the id column (to have pages in the desired order) */
98 listView->setSorting (listView_Id);
99 listView->sort();
100 /* disable further sorting (important for network adapters) */
101 listView->setSorting (-1);
102 /* set the first item selected */
103 listView->setSelected (listView->firstChild(), true);
104 listView_currentChanged (listView->firstChild());
105
106 warningPixmap->setMaximumSize( 16, 16 );
107 warningPixmap->setPixmap( QMessageBox::standardIcon( QMessageBox::Warning ) );
108
109 /* page title font is derived from the system font */
110 QFont f = font();
111 f.setBold( true );
112 f.setPointSize( f.pointSize() + 2 );
113 titleLabel->setFont( f );
114
115 /* setup the what's this label */
116 QApplication::setGlobalMouseTracking (true);
117 qApp->installEventFilter (this);
118 whatsThisTimer = new QTimer (this);
119 connect (whatsThisTimer, SIGNAL (timeout()), this, SLOT (updateWhatsThis()));
120 whatsThisCandidate = NULL;
121 whatsThisLabel->setTextFormat (Qt::RichText);
122 whatsThisLabel->setMinimumHeight (whatsThisLabel->frameWidth() * 2 +
123 6 /* seems that RichText adds some margin */ +
124 whatsThisLabel->fontMetrics().lineSpacing() * 3);
125 whatsThisLabel->setMinimumWidth (whatsThisLabel->frameWidth() * 2 +
126 6 /* seems that RichText adds some margin */ +
127 whatsThisLabel->fontMetrics().width ('m') * 40);
128
129 /*
130 * create and layout non-standard widgets
131 * ----------------------------------------------------------------------
132 */
133
134 hkeHostKey = new QIHotKeyEdit (grbKeyboard, "hkeHostKey");
135 hkeHostKey->setSizePolicy (QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Fixed));
136 QWhatsThis::add (hkeHostKey,
137 tr ("Displays the key used as a Host Key in the VM window. Activate the "
138 "entry field and press a new Host Key. Note that alphanumeric, "
139 "cursor movement and editing keys cannot be used as a Host Key."));
140 layoutHostKey->addWidget (hkeHostKey);
141 txHostKey->setBuddy (hkeHostKey);
142 setTabOrder (listView, hkeHostKey);
143
144 /*
145 * setup connections and set validation for pages
146 * ----------------------------------------------------------------------
147 */
148
149 /* General page */
150
151/// @todo (dmik) remove
152// leVDIFolder->setValidator (new QRegExpValidator (QRegExp (".+"), this));
153// leMachineFolder->setValidator (new QRegExpValidator (QRegExp (".+"), this));
154
155 wvalGeneral = new QIWidgetValidator (pageGeneral, this);
156 connect (wvalGeneral, SIGNAL (validityChanged (const QIWidgetValidator *)),
157 this, SLOT (enableOk( const QIWidgetValidator *)));
158
159 /* Keyboard page */
160
161 wvalKeyboard = new QIWidgetValidator( pageKeyboard, this );
162 connect (wvalKeyboard, SIGNAL (validityChanged (const QIWidgetValidator *)),
163 this, SLOT (enableOk( const QIWidgetValidator *)));
164
165 /* USB page */
166
167 lvUSBFilters->header()->hide();
168 /* disable sorting */
169 lvUSBFilters->setSorting (-1);
170 /* disable unselecting items by clicking in the unused area of the list */
171 new QIListViewSelectionPreserver (this, lvUSBFilters);
172 wstUSBFilters = new QWidgetStack (grbUSBFilters, "wstUSBFilters");
173 grbUSBFiltersLayout->addWidget (wstUSBFilters);
174 /* create a default (disabled) filter settings widget at index 0 */
175 VBoxUSBFilterSettings *settings = new VBoxUSBFilterSettings (wstUSBFilters);
176 settings->setup (VBoxUSBFilterSettings::HostType);
177 wstUSBFilters->addWidget (settings, 0);
178 lvUSBFilters_currentChanged (NULL);
179 /* setup toolbutton icons */
180 tbAddUSBFilter->setIconSet (VBoxGlobal::iconSet ("usb_new_16px.png",
181 "usb_new_disabled_16px.png"));
182 tbAddUSBFilterFrom->setIconSet (VBoxGlobal::iconSet ("usb_add_16px.png",
183 "usb_add_disabled_16px.png"));
184 tbRemoveUSBFilter->setIconSet (VBoxGlobal::iconSet ("usb_remove_16px.png",
185 "usb_remove_disabled_16px.png"));
186 tbUSBFilterUp->setIconSet (VBoxGlobal::iconSet ("usb_moveup_16px.png",
187 "usb_moveup_disabled_16px.png"));
188 tbUSBFilterDown->setIconSet (VBoxGlobal::iconSet ("usb_movedown_16px.png",
189 "usb_movedown_disabled_16px.png"));
190 /* create menu of existing usb-devices */
191 usbDevicesMenu = new VBoxUSBMenu (this);
192 connect (usbDevicesMenu, SIGNAL(activated(int)), this, SLOT(menuAddUSBFilterFrom_activated(int)));
193 mLastUSBFilterNum = 0;
194 mUSBFilterListModified = false;
195
196 /*
197 * set initial values
198 * ----------------------------------------------------------------------
199 */
200
201 /* General page */
202
203 /* keyboard page */
204
205 /*
206 * update the Ok button state for pages with validation
207 * (validityChanged() connected to enableNext() will do the job)
208 */
209 wvalGeneral->revalidate();
210 wvalKeyboard->revalidate();
211}
212
213bool VBoxGlobalSettingsDlg::eventFilter (QObject *object, QEvent *event)
214{
215 if (!object->isWidgetType())
216 return QDialog::eventFilter (object, event);
217
218 QWidget *widget = static_cast <QWidget *> (object);
219 if (widget->topLevelWidget() != this)
220 return QDialog::eventFilter (object, event);
221
222 switch (event->type())
223 {
224 case QEvent::Enter:
225 case QEvent::Leave:
226 {
227 if (event->type() == QEvent::Enter)
228 whatsThisCandidate = widget;
229 else
230 whatsThisCandidate = NULL;
231 whatsThisTimer->start (100, true /* sshot */);
232 break;
233 }
234 case QEvent::FocusIn:
235 {
236 updateWhatsThis (true /* gotFocus */);
237 break;
238 }
239 default:
240 break;
241 }
242
243 return QDialog::eventFilter (object, event);
244}
245
246void VBoxGlobalSettingsDlg::showEvent (QShowEvent *e)
247{
248 QDialog::showEvent (e);
249
250 /* one may think that QWidget::polish() is the right place to do things
251 * below, but apparently, by the time when QWidget::polish() is called,
252 * the widget style & layout are not fully done, at least the minimum
253 * size hint is not properly calculated. Since this is sometimes necessary,
254 * we provide our own "polish" implementation. */
255
256 if (polished)
257 return;
258
259 polished = true;
260
261 /* resize to the miminum possible size */
262 resize (minimumSize());
263
264 VBoxGlobal::centerWidget (this, parentWidget());
265}
266
267void VBoxGlobalSettingsDlg::listView_currentChanged (QListViewItem *item)
268{
269 Assert (item);
270 int id = item->text (1).toInt();
271 Assert (id >= 0);
272 titleLabel->setText (::path (item));
273 widgetStack->raiseWidget (id);
274}
275
276void VBoxGlobalSettingsDlg::enableOk (const QIWidgetValidator *wval)
277{
278 Q_UNUSED (wval);
279
280 /* detect the overall validity */
281 bool newValid = true;
282 {
283 QObjectList *l = this->queryList ("QIWidgetValidator");
284 QObjectListIt it (*l);
285 QObject *obj;
286 while ((obj = it.current()) != 0)
287 {
288 newValid &= ((QIWidgetValidator *) obj)->isValid();
289 ++it;
290 }
291 delete l;
292 }
293
294 if (valid != newValid)
295 {
296 valid = newValid;
297 buttonOk->setEnabled (valid);
298 if (valid)
299 warningSpacer->changeSize (0, 0, QSizePolicy::Expanding);
300 else
301 warningSpacer->changeSize (0, 0);
302 warningLabel->setHidden (valid);
303 warningPixmap->setHidden (valid);
304 }
305}
306
307void VBoxGlobalSettingsDlg::revalidate (QIWidgetValidator * /*wval*/)
308{
309 /* do individual validations for pages */
310
311 /* currently nothing */
312}
313
314/**
315 * Reads global settings from the given VMGlobalSettings instance
316 * and from the given CSystemProperties object.
317 */
318void VBoxGlobalSettingsDlg::getFrom (const CSystemProperties &props,
319 const VMGlobalSettings &gs)
320{
321 /* default folders */
322
323 leVDIFolder->setText (props.GetDefaultVDIFolder());
324 leMachineFolder->setText (props.GetDefaultMachineFolder());
325
326 /* proprietary GUI settings */
327
328 hkeHostKey->setKey (gs.hostKey() );
329 chbAutoCapture->setChecked (gs.autoCapture());
330
331 /* usb filters page */
332
333 CHost host = vboxGlobal().virtualBox().GetHost();
334 CHostUSBDeviceFilterCollection coll = host.GetUSBDeviceFilters();
335 if (coll.isNull())
336 {
337 /* disable the USB host filters category if the USB is
338 * not available (i.e. in VirtualBox OSE) */
339
340 QListViewItem *usbItem = listView->findItem ("#usb", listView_Link);
341 Assert (usbItem);
342 usbItem->setVisible (false);
343
344 /* disable validators if any */
345 pageUSB->setEnabled (false);
346
347 /* Show an error message (if there is any).
348 * This message box may be suppressed if the user wishes so. */
349 vboxProblem().cannotAccessUSB (host);
350 }
351 else
352 {
353 CHostUSBDeviceFilterEnumerator en = coll.Enumerate();
354 while (en.HasMore())
355 {
356 CHostUSBDeviceFilter hostFilter = en.GetNext();
357 CUSBDeviceFilter filter = CUnknown (hostFilter);
358 addUSBFilter (filter, false);
359 }
360 lvUSBFilters->setCurrentItem (lvUSBFilters->firstChild());
361 lvUSBFilters_currentChanged (lvUSBFilters->firstChild());
362 }
363}
364
365/**
366 * Writes global settings to the given VMGlobalSettings instance
367 * and to the given CSystemProperties object.
368 */
369void VBoxGlobalSettingsDlg::putBackTo (CSystemProperties &props,
370 VMGlobalSettings &gs)
371{
372 /* default folders */
373
374 if (leVDIFolder->isModified())
375 props.SetDefaultVDIFolder (leVDIFolder->text());
376 if (props.isOk() && leMachineFolder->isModified())
377 props.SetDefaultMachineFolder (leMachineFolder->text());
378
379 if (!props.isOk())
380 return;
381
382 /* proprietary GUI settings */
383
384 gs.setHostKey (hkeHostKey->key());
385 gs.setAutoCapture (chbAutoCapture->isChecked());
386
387 /* usb filter page */
388
389 /*
390 * first, remove all old filters (only if the list is changed,
391 * not only individual properties of filters)
392 */
393 CHost host = vboxGlobal().virtualBox().GetHost();
394 CHostUSBDeviceFilter removedFilter;
395 if (mUSBFilterListModified)
396 for (ulong count = host.GetUSBDeviceFilters().GetCount(); count; -- count)
397 host.RemoveUSBDeviceFilter (0, removedFilter);
398
399 /* then add all new filters */
400 for (QListViewItem *item = lvUSBFilters->firstChild(); item;
401 item = item->nextSibling())
402 {
403 USBListItem *uli = static_cast <USBListItem *> (item);
404 VBoxUSBFilterSettings *settings =
405 static_cast <VBoxUSBFilterSettings *>
406 (wstUSBFilters->widget (uli->mId));
407 Assert (settings);
408
409 COMResult res = settings->putBackToFilter();
410 if (!res.isOk())
411 return;
412
413 CUSBDeviceFilter filter = settings->filter();
414 filter.SetActive (uli->isOn());
415
416 CHostUSBDeviceFilter insertedFilter = CUnknown (filter);
417 if (mUSBFilterListModified)
418 host.InsertUSBDeviceFilter (host.GetUSBDeviceFilters().GetCount(),
419 insertedFilter);
420 }
421 mUSBFilterListModified = false;
422}
423
424void VBoxGlobalSettingsDlg::updateWhatsThis (bool gotFocus /* = false */)
425{
426 QString text;
427
428 QWidget *widget = NULL;
429 if (!gotFocus)
430 {
431 if (whatsThisCandidate != NULL && whatsThisCandidate != this)
432 widget = whatsThisCandidate;
433 }
434 else
435 {
436 widget = focusData()->focusWidget();
437 }
438 /* if the given widget lacks the whats'this text, look at its parent */
439 while (widget && widget != this)
440 {
441 text = QWhatsThis::textFor (widget);
442 if (!text.isEmpty())
443 break;
444 widget = widget->parentWidget();
445 }
446
447 if (text.isEmpty() && !warningString.isEmpty())
448 text = warningString;
449 if (text.isEmpty())
450 text = QWhatsThis::textFor (this);
451
452 whatsThisLabel->setText (text);
453}
454
455void VBoxGlobalSettingsDlg::setWarning (const QString &warning)
456{
457 warningString = warning;
458 if (!warning.isEmpty())
459 warningString = QString ("<font color=red>%1</font>").arg (warning);
460
461 if (!warningString.isEmpty())
462 whatsThisLabel->setText (warningString);
463 else
464 updateWhatsThis (true);
465}
466
467void VBoxGlobalSettingsDlg::tbResetFolder_clicked()
468{
469 QToolButton *tb = ::qt_cast <QToolButton *> (sender());
470 Assert (tb);
471
472 QLineEdit *le = 0;
473 if (tb == tbResetVDIFolder) le = leVDIFolder;
474 else if (tb == tbResetMachineFolder) le = leMachineFolder;
475 Assert (le);
476
477 /*
478 * do this instead of le->setText (QString::null) to cause
479 * isModified() return true
480 */
481 le->selectAll();
482 le->del();
483}
484
485void VBoxGlobalSettingsDlg::tbSelectFolder_clicked()
486{
487 QToolButton *tb = ::qt_cast <QToolButton *> (sender());
488 Assert (tb);
489
490 QLineEdit *le = 0;
491 if (tb == tbSelectVDIFolder) le = leVDIFolder;
492 else if (tb == tbSelectMachineFolder) le = leMachineFolder;
493 Assert (le);
494
495 QString homeFolder = vboxGlobal().virtualBox().GetHomeFolder();
496
497 QFileDialog dlg (homeFolder, QString::null, this);
498 dlg.setMode (QFileDialog::DirectoryOnly);
499
500 if (!le->text().isEmpty())
501 {
502 /* set the first parent directory that exists as the current */
503#if 0 /** @todo fix this linux bustage properly */
504 QFileInfo fld (QDir (homeFolder), le->text());
505#else
506 const QDir _dir (homeFolder);
507 QFileInfo fld (_dir, le->text());
508#endif
509 do
510 {
511 QString dp = fld.dirPath (false);
512 fld = QFileInfo (dp);
513 }
514 while (!fld.exists() && !QDir (fld.absFilePath()).isRoot());
515
516 if (fld.exists())
517 dlg.setDir (fld.absFilePath());
518 }
519
520 if (dlg.exec() == QDialog::Accepted)
521 {
522 QString folder = QDir::convertSeparators (dlg.selectedFile());
523 /* remove trailing slash */
524 folder.truncate (folder.length() - 1);
525
526 /*
527 * do this instead of le->setText (folder) to cause
528 * isModified() return true
529 */
530 le->selectAll();
531 le->insert (folder);
532 }
533}
534
535// USB Filter stuff
536////////////////////////////////////////////////////////////////////////////////
537
538void VBoxGlobalSettingsDlg::addUSBFilter (const CUSBDeviceFilter &aFilter,
539 bool aIsNew)
540{
541 QListViewItem *currentItem = aIsNew
542 ? lvUSBFilters->currentItem()
543 : lvUSBFilters->lastItem();
544
545 VBoxUSBFilterSettings *settings = new VBoxUSBFilterSettings (wstUSBFilters);
546 settings->setup (VBoxUSBFilterSettings::HostType);
547 settings->getFromFilter (aFilter);
548
549 USBListItem *item = new USBListItem (lvUSBFilters, currentItem);
550 item->setOn (aFilter.GetActive());
551 item->setText (lvUSBFilters_Name, aFilter.GetName());
552
553 item->mId = wstUSBFilters->addWidget (settings);
554
555 /* fix the tab order so that main dialog's buttons are always the last */
556 setTabOrder (settings->focusProxy(), buttonHelp);
557 setTabOrder (buttonHelp, buttonOk);
558 setTabOrder (buttonOk, buttonCancel);
559
560 if (aIsNew)
561 {
562 lvUSBFilters->setSelected (item, true);
563 lvUSBFilters_currentChanged (item);
564 settings->leUSBFilterName->setFocus();
565 }
566
567 connect (settings->leUSBFilterName, SIGNAL (textChanged (const QString &)),
568 this, SLOT (lvUSBFilters_setCurrentText (const QString &)));
569
570 /* setup validation */
571
572 QIWidgetValidator *wval = new QIWidgetValidator (settings, settings);
573 connect (wval, SIGNAL (validityChanged (const QIWidgetValidator *)),
574 this, SLOT (enableOk (const QIWidgetValidator *)));
575
576 wval->revalidate();
577}
578
579void VBoxGlobalSettingsDlg::lvUSBFilters_currentChanged (QListViewItem *item)
580{
581 if (item && lvUSBFilters->selectedItem() != item)
582 lvUSBFilters->setSelected (item, true);
583
584 tbRemoveUSBFilter->setEnabled (!!item);
585
586 tbUSBFilterUp->setEnabled (!!item && item->itemAbove());
587 tbUSBFilterDown->setEnabled (!!item && item->itemBelow());
588
589 if (item)
590 {
591 USBListItem *uli = static_cast <USBListItem *> (item);
592 wstUSBFilters->raiseWidget (uli->mId);
593 }
594 else
595 {
596 /* raise the disabled widget */
597 wstUSBFilters->raiseWidget (0);
598 }
599}
600
601void VBoxGlobalSettingsDlg::lvUSBFilters_setCurrentText (const QString &aText)
602{
603 QListViewItem *item = lvUSBFilters->currentItem();
604 Assert (item);
605
606 item->setText (lvUSBFilters_Name, aText);
607}
608
609void VBoxGlobalSettingsDlg::tbAddUSBFilter_clicked()
610{
611 CHost host = vboxGlobal().virtualBox().GetHost();
612 CHostUSBDeviceFilter hostFilter;
613 host.CreateUSBDeviceFilter (tr ("New Filter %1", "usb")
614 .arg (++ mLastUSBFilterNum), hostFilter);
615 hostFilter.SetAction (CEnums::USBDeviceFilterHold);
616
617 CUSBDeviceFilter filter = CUnknown (hostFilter);
618 filter.SetActive (true);
619 addUSBFilter (filter, true);
620
621 mUSBFilterListModified = true;
622}
623
624void VBoxGlobalSettingsDlg::tbAddUSBFilterFrom_clicked()
625{
626 usbDevicesMenu->exec (QCursor::pos());
627}
628
629void VBoxGlobalSettingsDlg::menuAddUSBFilterFrom_activated (int aIndex)
630{
631 CUSBDevice usb = usbDevicesMenu->getUSB (aIndex);
632
633 // if null then some other item but a USB device is selected
634 if (usb.isNull())
635 return;
636
637 CHost host = vboxGlobal().virtualBox().GetHost();
638 CHostUSBDeviceFilter hostFilter;
639 host.CreateUSBDeviceFilter (vboxGlobal().details (usb), hostFilter);
640 hostFilter.SetAction (CEnums::USBDeviceFilterHold);
641
642 CUSBDeviceFilter filter = CUnknown (hostFilter);
643 filter.SetVendorId (QString().sprintf ("%04hX", usb.GetVendorId()));
644 filter.SetProductId (QString().sprintf ("%04hX", usb.GetProductId()));
645 filter.SetRevision (QString().sprintf ("%04hX", usb.GetRevision()));
646 filter.SetPort (QString().sprintf ("%04hX", usb.GetPort()));
647 filter.SetManufacturer (usb.GetManufacturer());
648 filter.SetProduct (usb.GetProduct());
649 filter.SetSerialNumber (usb.GetSerialNumber());
650 filter.SetRemote (usb.GetRemote() ? "yes" : "no");
651 filter.SetActive (true);
652 addUSBFilter (filter, true);
653
654 mUSBFilterListModified = true;
655}
656
657void VBoxGlobalSettingsDlg::tbRemoveUSBFilter_clicked()
658{
659 QListViewItem *item = lvUSBFilters->currentItem();
660 Assert (item);
661
662 USBListItem *uli = static_cast <USBListItem *> (item);
663 QWidget *settings = wstUSBFilters->widget (uli->mId);
664 Assert (settings);
665 wstUSBFilters->removeWidget (settings);
666 delete settings;
667
668 delete item;
669
670 lvUSBFilters->setSelected (lvUSBFilters->currentItem(), true);
671 mUSBFilterListModified = true;
672}
673
674void VBoxGlobalSettingsDlg::tbUSBFilterUp_clicked()
675{
676 QListViewItem *item = lvUSBFilters->currentItem();
677 Assert (item);
678
679 QListViewItem *itemAbove = item->itemAbove();
680 Assert (itemAbove);
681 itemAbove = itemAbove->itemAbove();
682
683 if (!itemAbove)
684 item->itemAbove()->moveItem (item);
685 else
686 item->moveItem (itemAbove);
687
688 lvUSBFilters_currentChanged (item);
689 mUSBFilterListModified = true;
690}
691
692void VBoxGlobalSettingsDlg::tbUSBFilterDown_clicked()
693{
694 QListViewItem *item = lvUSBFilters->currentItem();
695 Assert (item);
696
697 QListViewItem *itemBelow = item->itemBelow();
698 Assert (itemBelow);
699
700 item->moveItem (itemBelow);
701
702 lvUSBFilters_currentChanged (item);
703 mUSBFilterListModified = true;
704}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette