void NBMenuButton::showMenu() { setStyleSheet( "QToolButton#menuBtn{ background-color: darkgray; border: none; border-radius: 3px; }" ); NBSystemMenu *menu = new NBSystemMenu( this ); QPoint point = mapToGlobal( rect().bottomRight() - QPoint( menu->width(), 0 ) ); connect( menu, SIGNAL( newWindow() ), this, SIGNAL( newWindow() ) ); connect( menu, SIGNAL( zoomIn() ), this, SIGNAL( zoomIn() ) ); connect( menu, SIGNAL( zoomOut() ), this, SIGNAL( zoomOut() ) ); connect( menu, SIGNAL( cut() ), this, SIGNAL( cut() ) ); connect( menu, SIGNAL( copy() ), this, SIGNAL( copy() ) ); connect( menu, SIGNAL( paste() ), this, SIGNAL( paste() ) ); connect( menu, SIGNAL( openVTE() ), this, SIGNAL( openVTE() ) ); connect( menu, SIGNAL( changeViewMode( int ) ), this, SIGNAL( changeViewMode( int ) ) ); connect( menu, SIGNAL( sortByName() ), this, SIGNAL( sortByName() ) ); connect( menu, SIGNAL( sortByType() ), this, SIGNAL( sortByType() ) ); connect( menu, SIGNAL( sortBySize() ), this, SIGNAL( sortBySize() ) ); connect( menu, SIGNAL( sortByDate() ), this, SIGNAL( sortByDate() ) ); connect( menu, SIGNAL( toggleHidden() ), this, SIGNAL( toggleHidden() ) ); connect( menu, SIGNAL( toggleGrouping() ), this, SIGNAL( toggleGrouping() ) ); connect( menu, SIGNAL( showSettings() ), this, SIGNAL( showSettings() ) ); connect( menu, SIGNAL( closeWindow() ), this, SIGNAL( closeWindow() ) ); connect( menu, SIGNAL( quit() ), this, SIGNAL( quit() ) ); menu->exec( point ); setStyleSheet( "QToolButton#menuBtn{ border: none; } QToolButton#menuBtn:hover { border: none; background-color: #A1DFFF; border-radius: 3px; }" ); };
void ChoroidTab::SetSortMenu () { auto sortGroup = new QActionGroup (this); SortMenu_ = new QMenu; auto byName = SortMenu_->addAction (tr ("By name"), this, SLOT (sortByName ())); byName->setCheckable (true); byName->setChecked (true); sortGroup->addAction (byName); auto byDate = SortMenu_->addAction (tr ("By date"), this, SLOT (sortByDate ())); byDate->setCheckable (true); sortGroup->addAction (byDate); auto bySize = SortMenu_->addAction (tr ("By size"), this, SLOT (sortBySize ())); bySize->setCheckable (true); sortGroup->addAction (bySize); auto byNumber = SortMenu_->addAction (tr ("By number"), this, SLOT (sortByNumber ())); byNumber->setCheckable (true); sortGroup->addAction (byNumber); sortByName (); auto sortModeButton = new QToolButton (); sortModeButton->setIcon (Proxy_->GetIcon ("view-sort-ascending")); sortModeButton->setText (tr ("Sort mode")); sortModeButton->setPopupMode (QToolButton::InstantPopup); sortModeButton->setMenu (SortMenu_); Bar_->addWidget (sortModeButton); }
//Sorts tree items according to user input void BC_Bulletin::sortItems(int sortOption) { //Sort tree items in chronoloical order (oldest first) if(sortOption == 0) { //Remove items from both trees removeItems(2); //Sort items in both trees by operator defined in Item.h and FSWItem.h, respectively std::sort(treeItems.begin(), treeItems.end(), sortByTimeCFDP()); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByTimeFSW()); //Replace items in both trees replaceItems(2); } //Sort tree items in chronological order (newest first) else if(sortOption == 1) { removeItems(2); std::sort(treeItems.begin(), treeItems.end(), sortByTimeCFDP2()); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByTimeFSW2()); replaceItems(2); } //Sort tree items by file size (CFDP only) (smallest first) else if(sortOption == 2) { removeItems(0); std::sort(treeItems.begin(), treeItems.end(), sortBySize()); replaceItems(0); } //Sort tree items by file size (CFDP only) (largest first) else if(sortOption == 3) { removeItems(0); std::sort(treeItems.begin(), treeItems.end(), sortBySize2()); replaceItems(0); } //Sort tree items by command (FSW only) (lowest APID first) else if(sortOption == 4) { removeItems(1); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByCommand()); replaceItems(1); } //Sort tree items by command (FSW only) (highest APID first) else if(sortOption == 5) { removeItems(1); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByCommand2()); replaceItems(1); } //Sort tree items by status (Successful, unsuccessful, in progress) else if(sortOption == 6) { removeItems(2); std::sort(treeItems.begin(), treeItems.end(), sortByStatusCFDP()); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByStatusFSW()); replaceItems(2); } //Sort tree items by status (In progress, unsuccessful, successful) else if(sortOption == 7) { removeItems(2); std::sort(treeItems.begin(), treeItems.end(), sortByStatusCFDP2()); std::sort(fswTreeItems.begin(), fswTreeItems.end(), sortByStatusFSW2()); replaceItems(2); } }
void NBFolderView::createAndSetupActions() { connect( IconView, SIGNAL( peek( QModelIndex ) ), this, SLOT( doPeek( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QModelIndex ) ), this, SLOT( doOpen( QModelIndex ) ) ); connect( IconView, SIGNAL( open( QString ) ), this, SLOT( doOpen( QString ) ) ); connect( IconView, SIGNAL( contextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); connect( IconView, SIGNAL( actionsMenuRequested( QPoint ) ), this, SLOT( showActionsMenu( QPoint ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ) ); connect( IconView->selectionModel(), SIGNAL( selectionChanged( const QItemSelection&, const QItemSelection& ) ), this, SLOT( updateActions() ) ); connect( IconView, SIGNAL( link( QStringList, QString ) ), this, SLOT( link( QStringList, QString ) ) ); // DragDrop copy connect( IconView, SIGNAL( copy( QStringList, QString ) ), this, SLOT( copy( QStringList, QString ) ) ); // DragDrop move connect( IconView, SIGNAL( move( QStringList, QString ) ), this, SLOT( move( QStringList, QString ) ) ); // Update actions once the directory is loaded connect( fsModel, SIGNAL( directoryLoaded( QString ) ), this, SLOT( updateActions() ) ); // Peek peekAct = new QAction( QIcon( ":/icons/peek.png" ), "Pee&k", this ); peekAct->setShortcuts( Settings->shortcuts( "Peek" ) ); connect( peekAct, SIGNAL( triggered() ), this, SLOT( doPeek() ) ); addAction( peekAct ); // Home Dir actHomeDir = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actHomeDir->setShortcuts( Settings->shortcuts( "GoHome" ) ); connect( actHomeDir, SIGNAL( triggered() ), this, SLOT( loadHomeDir() ) ); addAction( actHomeDir ); // Home actGoHome = new QAction( QIcon( ":/icons/home.png" ), "&Home", this ); actGoHome->setShortcut( tr( "Alt+Shift+Home" ) ); connect( actGoHome, SIGNAL( triggered() ), this, SLOT( doOpenHome() ) ); addAction( actGoHome ); // Up actParDir = new QAction( QIcon( ":/icons/up.png" ), "&Up", this ); actParDir->setShortcuts( Settings->shortcuts( "GoUp" ) ); connect( actParDir, SIGNAL( triggered() ), fsModel, SLOT( goUp() ) ); addAction( actParDir ); // Back actPrevDir = new QAction( QIcon( ":/icons/prev.png" ), "&Back", this ); actPrevDir->setShortcuts( Settings->shortcuts( "GoLeft" ) ); connect( actPrevDir, SIGNAL( triggered() ), fsModel, SLOT( goBack() ) ); addAction( actPrevDir ); // Forward actNextDir = new QAction( QIcon( ":/icons/next.png" ), "&Forward", this ); actNextDir->setShortcuts( Settings->shortcuts( "GoRight" ) ); connect( actNextDir, SIGNAL( triggered() ), fsModel, SLOT( goForward() ) ); addAction( actNextDir ); // New Folder actNewDir = new QAction( QIcon::fromTheme( "folder-new" ), "New folder", this ); actNewDir->setShortcuts( Settings->shortcuts( "NewFolder" ) ); connect( actNewDir, SIGNAL( triggered() ), this, SLOT( newFolder() ) ); addAction( actNewDir ); // New file actNewFile = new QAction( QIcon::fromTheme( "document-new" ), "New File", this ); actNewFile->setShortcuts( Settings->shortcuts( "NewFile" ) ); connect( actNewFile, SIGNAL( triggered() ), this, SLOT( newFile() ) ); addAction( actNewFile ); // New file actNewEncFS = new QAction( QIcon::fromTheme( "document-new" ), "New Encrypted Directory", this ); actNewEncFS->setShortcuts( Settings->shortcuts( "NewEncFS" ) ); connect( actNewEncFS, SIGNAL( triggered() ), this, SLOT( createEncFS() ) ); addAction( actNewEncFS ); // Copy copyAct = new QAction( QIcon( ":/icons/copy.png" ), "&Copy", this ); copyAct->setShortcuts( Settings->shortcuts( "Copy" ) ); connect( copyAct, SIGNAL( triggered() ), this, SLOT( prepareCopy() ) ); addAction( copyAct ); // Move moveAct = new QAction( QIcon( ":/icons/cut.png" ), "Cu&t", this ); moveAct->setShortcuts( Settings->shortcuts( "Cut" ) ); connect( moveAct, SIGNAL( triggered() ), this, SLOT( prepareMove() ) ); addAction( moveAct ); // Paste pasteAct = new QAction( QIcon( ":/icons/paste.png" ), "&Paste", this ); pasteAct->setShortcuts( Settings->shortcuts( "Paste" ) ); connect( pasteAct, SIGNAL( triggered() ), this, SLOT( prepareIO() ) ); addAction( pasteAct ); // Rename renameAct = new QAction( QIcon( ":/icons/rename.png" ), "&Rename", this ); renameAct->setShortcuts( Settings->shortcuts( "Rename" ) ); connect( renameAct, SIGNAL( triggered() ), this, SLOT( doRename() ) ); addAction( renameAct ); // Reload reloadAct = new QAction( QIcon( ":/icons/reload.png" ), "Re&fresh", this ); reloadAct->setShortcuts( Settings->shortcuts( "Reload" ) ); connect( reloadAct, SIGNAL( triggered() ), this, SLOT( doReload() ) ); addAction( reloadAct ); // showDotFiles showHideDotFiles = new QAction( QIcon( ":/icons/showDotFiles.png" ), "Show &Hidden", this ); showHideDotFiles->setShortcuts( Settings->shortcuts( "ToggleHidden" ) ); connect( showHideDotFiles, SIGNAL( triggered() ), this, SLOT( doToggleHidden() ) ); addAction( showHideDotFiles ); // Trash trashAct = new QAction( QIcon( ":/icons/trash.png" ), "Move to trash", this ); trashAct->setShortcuts( Settings->shortcuts( "Trash" ) ); connect( trashAct, SIGNAL( triggered() ), this, SLOT( doSendToTrash() ) ); addAction( trashAct ); // Delete delAct = new QAction( QIcon( ":/icons/delete.png" ), "Delete", this ); delAct->setShortcuts( Settings->shortcuts( "Delete" ) ); connect( delAct, SIGNAL( triggered() ), this, SLOT( doDelete() ) ); addAction( delAct ); // Properties propertiesAct = new QAction( QIcon( ":/icons/props.png" ), "&Properties", this ); propertiesAct->setShortcuts( Settings->shortcuts( "Properties" ) ); connect( propertiesAct, SIGNAL( triggered() ), this, SIGNAL( showProperties() ) ); addAction( propertiesAct ); // Permissions permissionsAct = new QAction( QIcon::fromTheme( "system-users" ), "P&ermissions", this ); permissionsAct->setShortcuts( Settings->shortcuts( "Permissions" ) ); connect( permissionsAct, SIGNAL( triggered() ), this, SIGNAL( showPermissions() ) ); addAction( permissionsAct ); // Open a virtual terminal emulator openVTE = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE", this ); openVTE->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTE, SIGNAL( triggered() ), this, SLOT( openTerminal() ) ); addAction( openVTE ); // Open a virtual terminal emulator openVTEin = new QAction( QIcon::fromTheme( "utilities-terminal" ), "Open &VTE Here", this ); // openVTEin->setShortcuts( Settings->shortcuts( "Terminal" ) ); connect( openVTEin, SIGNAL( triggered() ), this, SLOT( openTerminalIn() ) ); // Select All QAction *selectAllAct = new QAction( "&Select All", this ); selectAllAct->setShortcuts( Settings->shortcuts( "SelectAll" ) ); connect( selectAllAct, SIGNAL( triggered() ), this, SLOT( selectAll() ) ); addAction( selectAllAct ); // Sorting sortByNameAct = new QAction( QIcon::fromTheme( "format-text-underline" ), "&Name", this ); sortByNameAct->setCheckable( true ); connect( sortByNameAct, SIGNAL( triggered() ), this, SLOT( sortByName() ) ); sortByTypeAct = new QAction( QIcon::fromTheme( "preferences-other" ), "&Type", this ); sortByTypeAct->setCheckable( true ); connect( sortByTypeAct, SIGNAL( triggered() ), this, SLOT( sortByType() ) ); sortBySizeAct = new QAction( QIcon( ":/icons/size.png" ), "&Size", this ); sortBySizeAct->setCheckable( true ); connect( sortBySizeAct, SIGNAL( triggered() ), this, SLOT( sortBySize() ) ); sortByDateAct = new QAction( QIcon::fromTheme( "office-calendar" ), "&Date", this ); sortByDateAct->setCheckable( true ); connect( sortByDateAct, SIGNAL( triggered() ), this, SLOT( sortByDate() ) ); QActionGroup *sortGroup = new QActionGroup( this ); sortGroup->addAction( sortByNameAct ); sortGroup->addAction( sortByTypeAct ); sortGroup->addAction( sortBySizeAct ); sortGroup->addAction( sortByDateAct ); switch( ( int )Settings->value( "SortColumn" ) ) { case 0: { sortByNameAct->setChecked( true ); break; } case 1: { sortBySizeAct->setChecked( true ); break; } case 2: { sortByTypeAct->setChecked( true ); break; } case 4: { sortByDateAct->setChecked( true ); break; } } groupsAct = new QAction( QIcon::fromTheme( "view-group", QIcon( ":/icons/groups.png" ) ), "Show in &Groups", this ); groupsAct->setCheckable( true ); groupsAct->setChecked( Settings->value( "Grouping" ) ); connect( groupsAct, SIGNAL( triggered() ), this, SIGNAL( toggleGroups() ) ); // Add bookmark addBookMarkAct = new QAction( QIcon( ":/icons/bookmark.png" ), "Add &Bookmark", this ); addBookMarkAct->setShortcuts( Settings->shortcuts( "AddBookmark" ) ); connect( addBookMarkAct, SIGNAL( triggered() ), this, SLOT( addBookMark() ) ); addAction( addBookMarkAct ); /* Add to SuperStart */ addToSuperStartAct = new QAction( QIcon( ":/icons/superstart.png" ), "Add to S&uperStart", this ); addToSuperStartAct->setShortcut( tr( "Ctrl+U" ) ); connect( addToSuperStartAct, SIGNAL( triggered() ), this, SLOT( addToSuperStart() ) ); addAction( addToSuperStartAct ); updateActions(); };