Changeset 38800 in vbox
- Timestamp:
- Sep 20, 2011 11:51:31 AM (13 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/selector
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.cpp
r38487 r38800 46 46 m_Shortcuts[ShowVMInFileManagerShortcut] = UIKeySequence("ShowVMInFileManager"); 47 47 m_Shortcuts[CreateVMAliasShortcut] = UIKeySequence("CreateVMAlias"); 48 m_Shortcuts[ResortVMList] = UIKeySequence("ResortVMList"); 48 49 m_Shortcuts[HelpShortcut] = UIKeySequence("Help", QKeySequence::HelpContents); 49 50 m_Shortcuts[WebShortcut] = UIKeySequence("Web"); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorShortcuts.h
r38487 r38800 48 48 ShowVMInFileManagerShortcut, 49 49 CreateVMAliasShortcut, 50 ResortVMList, 50 51 HelpShortcut, 51 52 WebShortcut, -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.cpp
r38311 r38800 149 149 } 150 150 151 void UIVMItemModel::sortByIdList(const QStringList &list )151 void UIVMItemModel::sortByIdList(const QStringList &list, Qt::SortOrder order /* = Qt::AscendingOrder */) 152 152 { 153 153 emit layoutAboutToBeChanged(); … … 175 175 if (tmpVMItemList.count() > 0) 176 176 { 177 qSort(tmpVMItemList.begin(), tmpVMItemList.end(), UIVMItemNameCompareLessThan);177 qSort(tmpVMItemList.begin(), tmpVMItemList.end(), order == Qt::AscendingOrder ? UIVMItemNameCompareLessThan : UIVMItemNameCompareMoreThan); 178 178 QListIterator<UIVMItem*> it(tmpVMItemList); 179 179 while (it.hasNext()) … … 291 291 Assert(aItem2); 292 292 return aItem1->name().toLower() < aItem2->name().toLower(); 293 } 294 295 bool UIVMItemModel::UIVMItemNameCompareMoreThan(UIVMItem* aItem1, UIVMItem* aItem2) 296 { 297 Assert(aItem1); 298 Assert(aItem2); 299 return aItem1->name().toLower() > aItem2->name().toLower(); 293 300 } 294 301 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMListView.h
r34096 r38800 63 63 64 64 QStringList idList() const; 65 void sortByIdList(const QStringList &list );65 void sortByIdList(const QStringList &list, Qt::SortOrder order = Qt::AscendingOrder); 66 66 67 67 int rowCount(const QModelIndex &aParent = QModelIndex()) const; … … 82 82 private: 83 83 static bool UIVMItemNameCompareLessThan(UIVMItem* aItem1, UIVMItem* aItem2); 84 static bool UIVMItemNameCompareMoreThan(UIVMItem* aItem1, UIVMItem* aItem2); 84 85 85 86 /* Private member vars */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
r38487 r38800 191 191 mVmOpenInFileManagerAction->setIcon(UIIconPool::iconSet( 192 192 ":/vm_open_filemanager_16px.png", ":/vm_open_filemanager_disabled_16px.png")); 193 mVmCreateShortcut = new QAction(this);194 mVmCreateShortcut ->setIcon(UIIconPool::iconSet(193 mVmCreateShortcutAction = new QAction(this); 194 mVmCreateShortcutAction->setIcon(UIIconPool::iconSet( 195 195 ":/vm_create_shortcut_16px.png", ":/vm_create_shortcut_disabled_16px.png")); 196 mVmResortAction = new QAction(this); 196 197 197 198 /* VM list toolbar */ … … 320 321 mVMMenu->addSeparator(); 321 322 mVMMenu->addAction(mVmOpenInFileManagerAction); 322 mVMMenu->addAction(mVmCreateShortcut); 323 mVMMenu->addAction(mVmCreateShortcutAction); 324 mVMMenu->addSeparator(); 325 mVMMenu->addAction(mVmResortAction); 323 326 324 327 #ifdef Q_WS_MAC … … 341 344 mVMCtxtMenu->addSeparator(); 342 345 mVMCtxtMenu->addAction(mVmOpenInFileManagerAction); 343 mVMCtxtMenu->addAction(mVmCreateShortcut); 346 mVMCtxtMenu->addAction(mVmCreateShortcutAction); 347 mVMCtxtMenu->addSeparator(); 348 mVMCtxtMenu->addAction(mVmResortAction); 344 349 345 350 /* Make sure every status bar hint from the context menu is cleared when … … 473 478 connect(mVmShowLogsAction, SIGNAL(triggered()), this, SLOT(vmShowLogs())); 474 479 connect(mVmOpenInFileManagerAction, SIGNAL(triggered()), this, SLOT(vmOpenInFileManager())); 475 connect(mVmCreateShortcut, SIGNAL(triggered()), this, SLOT(vmCreateShortcut())); 480 connect(mVmCreateShortcutAction, SIGNAL(triggered()), this, SLOT(vmCreateShortcut())); 481 connect(mVmResortAction, SIGNAL(triggered()), this, SLOT(vmResort())); 476 482 477 483 connect(mVMCloseMenu, SIGNAL(aboutToShow()), this, SLOT(sltCloseMenuAboutToShow())); … … 1037 1043 CMachine machine = item->machine(); 1038 1044 UIDesktopServices::createMachineShortcut(machine.GetSettingsFilePath(), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), machine.GetName(), machine.GetId()); 1045 } 1046 1047 void VBoxSelectorWnd::vmResort(const QString &aUuid /* = QString::null */) 1048 { 1049 UIVMItem *item = aUuid.isNull() ? mVMListView->selectedItem() : 1050 mVMModel->itemById(aUuid); 1051 const QString oldId = item->id(); 1052 1053 AssertMsgReturnVoid(item, ("Item must be always selected here")); 1054 1055 mVMModel->sortByIdList(QStringList(), 1056 qApp->keyboardModifiers() == Qt::ShiftModifier ? Qt::DescendingOrder : Qt::AscendingOrder); 1057 /* Select the VM which was selected before */ 1058 mVMListView->selectItemById(oldId); 1039 1059 } 1040 1060 … … 1410 1430 mVmOpenInFileManagerAction->setText(tr("Show in Finder")); 1411 1431 mVmOpenInFileManagerAction->setStatusTip(tr("Show the VirtualBox Machine Definition file in Finder.")); 1412 mVmCreateShortcut ->setText(tr("Create Alias on Desktop"));1413 mVmCreateShortcut ->setStatusTip(tr("Creates an Alias file to the VirtualBox Machine Definition file on your Desktop."));1432 mVmCreateShortcutAction->setText(tr("Create Alias on Desktop")); 1433 mVmCreateShortcutAction->setStatusTip(tr("Creates an Alias file to the VirtualBox Machine Definition file on your Desktop.")); 1414 1434 #elif defined(Q_WS_WIN) 1415 1435 mVmOpenInFileManagerAction->setText(tr("Show in Explorer")); 1416 1436 mVmOpenInFileManagerAction->setStatusTip(tr("Show the VirtualBox Machine Definition file in Explorer.")); 1417 mVmCreateShortcut ->setText(tr("Create Shortcut on Desktop"));1418 mVmCreateShortcut ->setStatusTip(tr("Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop."));1437 mVmCreateShortcutAction->setText(tr("Create Shortcut on Desktop")); 1438 mVmCreateShortcutAction->setStatusTip(tr("Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop.")); 1419 1439 #else 1420 1440 mVmOpenInFileManagerAction->setText(tr("Show in File Manager")); 1421 1441 mVmOpenInFileManagerAction->setStatusTip(tr("Show the VirtualBox Machine Definition file in the File Manager")); 1422 mVmCreateShortcut ->setText(tr("Create Shortcut on Desktop"));1423 mVmCreateShortcut ->setStatusTip(tr("Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop."));1442 mVmCreateShortcutAction->setText(tr("Create Shortcut on Desktop")); 1443 mVmCreateShortcutAction->setStatusTip(tr("Creates an Shortcut file to the VirtualBox Machine Definition file on your Desktop.")); 1424 1444 #endif 1425 1445 mVmOpenInFileManagerAction->setShortcut(gSS->keySequence(UISelectorShortcuts::ShowVMInFileManagerShortcut)); 1426 mVmCreateShortcut->setShortcut(gSS->keySequence(UISelectorShortcuts::CreateVMAliasShortcut)); 1446 mVmCreateShortcutAction->setShortcut(gSS->keySequence(UISelectorShortcuts::CreateVMAliasShortcut)); 1447 mVmResortAction->setShortcut(gSS->keySequence(UISelectorShortcuts::ResortVMList)); 1448 mVmResortAction->setText(tr("Sort List")); 1449 mVmResortAction->setStatusTip(tr("Sort the VM list alphabetically (Shift for descending order)")); 1427 1450 1428 1451 #ifdef Q_WS_MAC … … 1573 1596 * legacy xml files. On the other OS's some kind of start up script is 1574 1597 * used. */ 1575 mVmCreateShortcut ->setEnabled(item->settingsFile().endsWith(".vbox", Qt::CaseInsensitive));1598 mVmCreateShortcutAction->setEnabled(item->settingsFile().endsWith(".vbox", Qt::CaseInsensitive)); 1576 1599 #else /* Q_WS_MAC */ 1577 mVmCreateShortcut ->setEnabled(true);1600 mVmCreateShortcutAction->setEnabled(true); 1578 1601 #endif /* Q_WS_MAC */ 1602 mVmResortAction->setEnabled(true); 1579 1603 } 1580 1604 else … … 1637 1661 /* Disable the shell interaction features. */ 1638 1662 mVmOpenInFileManagerAction->setEnabled(false); 1639 mVmCreateShortcut->setEnabled(false); 1663 mVmCreateShortcutAction->setEnabled(false); 1664 /* Disable sorting if there is nothing to sort. */ 1665 mVmResortAction->setEnabled(false); 1640 1666 } 1641 1667 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h
r38487 r38800 82 82 void vmOpenInFileManager(const QString &aUuid = QString::null); 83 83 void vmCreateShortcut(const QString &aUuid = QString::null); 84 void vmResort(const QString &aUuid = QString::null); 84 85 void sltCloseMenuAboutToShow(); 85 86 … … 186 187 QAction *mVmShowLogsAction; 187 188 QAction *mVmOpenInFileManagerAction; 188 QAction *mVmCreateShortcut; 189 QAction *mVmCreateShortcutAction; 190 QAction *mVmResortAction; 189 191 190 192 #ifdef VBOX_GUI_WITH_SYSTRAY
Note:
See TracChangeset
for help on using the changeset viewer.