diff options
author | Sean Long <me@seanlong.org> | 2016-02-01 23:14:01 -0800 |
---|---|---|
committer | Sean Long <me@seanlong.org> | 2016-02-01 23:14:01 -0800 |
commit | 3f2eab3ccc20c8b154043be437e45992b0fec100 (patch) | |
tree | 6639fb8c0b24d905bf72faf920c87f729b7d9b07 | |
parent | Generally in GUI's menu items that popup a window show '...' at the end (diff) | |
download | lumina-3f2eab3ccc20c8b154043be437e45992b0fec100.tar.gz lumina-3f2eab3ccc20c8b154043be437e45992b0fec100.tar.bz2 lumina-3f2eab3ccc20c8b154043be437e45992b0fec100.zip |
Added menu items for various functionality that was already available
just not from the main application menu. When adding the shortcuts I
used the defacto standards that are used in many *nix applications.
-rw-r--r-- | lumina-fm/MainUI.cpp | 114 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 21 | ||||
-rw-r--r-- | lumina-fm/MainUI.ui | 112 | ||||
-rw-r--r-- | lumina-fm/widgets/DirWidget.cpp | 4 | ||||
-rw-r--r-- | lumina-fm/widgets/DirWidget.h | 1 |
5 files changed, 186 insertions, 66 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index e65a3f74..a9dda19e 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -89,12 +89,6 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; } nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this); nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this); - closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this); - refreshShort = new QShortcut( QKeySequence(tr("F5")), this); - copyFilesShort = new QShortcut( QKeySequence(tr("Ctrl+C")), this); - pasteFilesShort = new QShortcut( QKeySequence(tr("Ctrl+V")), this); - cutFilesShort = new QShortcut( QKeySequence(tr("Ctrl+X")), this); - deleteFilesShort = new QShortcut( QKeySequence(tr("Delete")), this); //Finish loading the interface workThread->start(); @@ -204,19 +198,33 @@ void MainUI::setupIcons(){ this->setWindowIcon( LXDG::findIcon("Insight-FileManager","") ); //Setup all the icons using libLumina - ui->actionClose->setIcon( LXDG::findIcon("application-exit","") ); - ui->actionNew_Tab->setIcon( LXDG::findIcon("tab-new","") );\ + // File menu ui->actionNew_Window->setIcon( LXDG::findIcon("window-new","") ); - ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") ); - ui->actionAdd_Bookmark->setIcon( LXDG::findIcon("bookmark-new","") ); - ui->actionScan->setIcon( LXDG::findIcon("system-search","") ); + ui->actionNew_Tab->setIcon( LXDG::findIcon("tab-new","") ); ui->actionSearch->setIcon( LXDG::findIcon("edit-find","") ); - ui->actionLarger_Icons->setIcon( LXDG::findIcon("zoom-in","") ); - ui->actionSmaller_Icons->setIcon( LXDG::findIcon("zoom-out", "") ); - //Menu Icons + ui->actionClose_Browser->setIcon( LXDG::findIcon("tab-close","") ); + ui->actionClose->setIcon( LXDG::findIcon("application-exit","") ); + + // Edit menu + ui->actionRename->setIcon( LXDG::findIcon("edit-rename","") ); + ui->actionCut_Selection->setIcon( LXDG::findIcon("edit-cut","") ); + ui->actionCopy_Selection->setIcon( LXDG::findIcon("edit-copy","") ); + ui->actionPaste->setIcon( LXDG::findIcon("edit-paste","") ); + ui->actionDelete_Selection->setIcon( LXDG::findIcon("edit-delete","") ); + + // View menu + ui->actionRefresh->setIcon( LXDG::findIcon("view-refresh","") ); ui->menuView_Mode->setIcon( LXDG::findIcon("view-choose","") ); ui->menuGroup_Mode->setIcon( LXDG::findIcon("tab-duplicate","") ); - + ui->actionLarger_Icons->setIcon( LXDG::findIcon("zoom-in","") ); + ui->actionSmaller_Icons->setIcon( LXDG::findIcon("zoom-out", "") ); + + // Bookmarks menu + ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") ); + ui->actionAdd_Bookmark->setIcon( LXDG::findIcon("bookmark-new","") ); + + // External Devices menu + ui->actionScan->setIcon( LXDG::findIcon("system-search","") ); } //========== @@ -237,13 +245,6 @@ void MainUI::setupConnections(){ //Special Keyboard Shortcuts connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) ); connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) ); - connect(closeTabShort, SIGNAL(activated()), this, SLOT( tabClosed() ) ); - connect(refreshShort , SIGNAL(activated()), this, SLOT( refreshTabs() ) ); - connect(copyFilesShort, SIGNAL(activated()), this, SLOT( CopyFilesTriggered() ) ); - connect(cutFilesShort, SIGNAL(activated()), this, SLOT( CutFilesTriggered() ) ); - connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( PasteFilesTriggered() ) ); - connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( DeleteFilesTriggered() ) ); - } void MainUI::loadSettings(){ @@ -389,6 +390,10 @@ void MainUI::on_actionSearch_triggered(){ QProcess::startDetached("lumina-search -dir \""+dir->currentDir()+"\""); } +void MainUI::on_actionClose_Browser_triggered(){ + tabClosed(); +} + void MainUI::on_actionClose_triggered(){ if(tabBar->count() > 1){ if(QMessageBox::Yes != QMessageBox::question(this, tr("Verify Quit"), tr("You have multiple tabs open. Are you sure you want to quit?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes ) ){ @@ -399,6 +404,41 @@ void MainUI::on_actionClose_triggered(){ this->close(); } +void MainUI::on_actionRename_triggered(){ + DirWidget *dir = FindActiveBrowser(); + if(DEBUG){ qDebug() << "Rename Shortcut Pressed:" << dir << dir->currentDir(); } + if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryRenameSelection()) ); } +} + +void MainUI::on_actionCut_Selection_triggered(){ + DirWidget *dir = FindActiveBrowser(); + if(DEBUG){ qDebug() << "Cut Shortcut Pressed:" << dir << dir->currentDir(); } + if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryCutSelection()) ); } +} + +void MainUI::on_actionCopy_Selection_triggered(){ + DirWidget *dir = FindActiveBrowser(); + if(DEBUG){ qDebug() << "Copy Shortcut Pressed:" << dir << dir->currentDir(); } + if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryCopySelection()) ); } +} + +void MainUI::on_actionPaste_triggered(){ + DirWidget *dir = FindActiveBrowser(); + if(DEBUG){ qDebug() << "Paste Shortcut Pressed:" << dir << dir->currentDir(); } + if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryPasteSelection()) ); } +} + +void MainUI::on_actionDelete_Selection_triggered(){ + DirWidget *dir = FindActiveBrowser(); + if(DEBUG){ qDebug() << "Delete Shortcut Pressed:" << dir << dir->currentDir(); } + if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryDeleteSelection()) ); } +} + +void MainUI::on_actionRefresh_triggered(){ + DirWidget *cur = FindActiveBrowser(); + if(cur!=0){ cur->refresh(); } +} + void MainUI::on_actionView_Hidden_Files_triggered(){ worker->showHidden = ui->actionView_Hidden_Files->isChecked(); //Now save this setting for later @@ -605,36 +645,6 @@ void MainUI::nextTab(){ else{ tabBar->setCurrentIndex( cur+1 ); } } -void MainUI::refreshTabs(){ - DirWidget *cur = FindActiveBrowser(); - if(cur!=0){ cur->refresh(); } -} - -//Special Keyboard shortcut interactions -void MainUI::CopyFilesTriggered(){ - DirWidget *dir = FindActiveBrowser(); - if(DEBUG){ qDebug() << "Copy Shortcut Pressed:" << dir << dir->currentDir(); } - if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryCopySelection()) ); } -} - -void MainUI::CutFilesTriggered(){ - DirWidget *dir = FindActiveBrowser(); - if(DEBUG){ qDebug() << "Cut Shortcut Pressed:" << dir << dir->currentDir(); } - if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryCutSelection()) ); } -} - -void MainUI::PasteFilesTriggered(){ - DirWidget *dir = FindActiveBrowser(); - if(DEBUG){ qDebug() << "Paste Shortcut Pressed:" << dir << dir->currentDir(); } - if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryPasteSelection()) ); } -} - -void MainUI::DeleteFilesTriggered(){ - DirWidget *dir = FindActiveBrowser(); - if(DEBUG){ qDebug() << "Delete Shortcut Pressed:" << dir << dir->currentDir(); } - if(dir!=0){ QTimer::singleShot(0, dir, SLOT(TryDeleteSelection()) ); } -} - void MainUI::DirDataAvailable(QString id, QString dir, LFileInfoList list){ for(int i=0; i<DWLIST.length(); i++){ if(id == DWLIST[i]->id()){ diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index e139d341..92d1457b 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -87,9 +87,8 @@ private: MultimediaWidget *MW; SlideshowWidget *SW; - QSettings *settings; - QShortcut *nextTabLShort, *nextTabRShort, *closeTabShort, *refreshShort; - QShortcut *copyFilesShort, *cutFilesShort, *pasteFilesShort, *deleteFilesShort; + QSettings *settings; + QShortcut *nextTabLShort, *nextTabRShort; QCompleter *dirCompleter; //Simplification Functions @@ -115,7 +114,14 @@ private slots: void on_actionNew_Window_triggered(); void on_actionNew_Tab_triggered(); void on_actionSearch_triggered(); + void on_actionClose_Browser_triggered(); void on_actionClose_triggered(); + void on_actionRename_triggered(); + void on_actionCut_Selection_triggered(); + void on_actionCopy_Selection_triggered(); + void on_actionPaste_triggered(); + void on_actionDelete_Selection_triggered(); + void on_actionRefresh_triggered(); void on_actionView_Hidden_Files_triggered(); void on_actionShow_Action_Buttons_triggered(); void on_actionShow_Thumbnails_triggered(); @@ -128,17 +134,10 @@ private slots: void CreateBookMark(); //Tab interactions - void tabChanged(int tab = -1); + void tabChanged(int tab = -1); void tabClosed(int tab = -1); void nextTab(); //For keyboard shortcuts void prevTab(); //For keyboard shortcuts - void refreshTabs(); //For keyboard shortcut - - //Special Keyboard shortcut interactions - void CopyFilesTriggered(); - void CutFilesTriggered(); - void PasteFilesTriggered(); - void DeleteFilesTriggered(); //Backend Info passing void DirDataAvailable(QString, QString, LFileInfoList); diff --git a/lumina-fm/MainUI.ui b/lumina-fm/MainUI.ui index 15476b75..8078b804 100644 --- a/lumina-fm/MainUI.ui +++ b/lumina-fm/MainUI.ui @@ -69,7 +69,7 @@ <x>0</x> <y>0</y> <width>567</width> - <height>373</height> + <height>371</height> </rect> </property> <layout class="QHBoxLayout" name="BrowserLayout"> @@ -106,7 +106,7 @@ <x>0</x> <y>0</y> <width>567</width> - <height>20</height> + <height>22</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -117,6 +117,8 @@ <addaction name="actionNew_Tab"/> <addaction name="actionSearch"/> <addaction name="separator"/> + <addaction name="actionClose_Browser"/> + <addaction name="separator"/> <addaction name="actionClose"/> </widget> <widget class="QMenu" name="menuView"> @@ -135,6 +137,8 @@ </property> <addaction name="actionTabs_2"/> </widget> + <addaction name="actionRefresh"/> + <addaction name="separator"/> <addaction name="actionShow_Thumbnails"/> <addaction name="actionView_Hidden_Files"/> <addaction name="actionShow_Action_Buttons"/> @@ -160,7 +164,20 @@ <addaction name="actionScan"/> <addaction name="separator"/> </widget> + <widget class="QMenu" name="menuEdit"> + <property name="title"> + <string>Edit</string> + </property> + <addaction name="actionRename"/> + <addaction name="separator"/> + <addaction name="actionCut_Selection"/> + <addaction name="actionCopy_Selection"/> + <addaction name="actionPaste"/> + <addaction name="separator"/> + <addaction name="actionDelete_Selection"/> + </widget> <addaction name="menuFile"/> + <addaction name="menuEdit"/> <addaction name="menuView"/> <addaction name="menuBookmarks"/> <addaction name="menuExternal_Devices"/> @@ -247,7 +264,7 @@ </action> <action name="actionSearch"> <property name="text"> - <string>Search Directory</string> + <string>Search Directory...</string> </property> <property name="shortcut"> <string>Ctrl+F</string> @@ -292,11 +309,23 @@ <property name="text"> <string>Larger Icons</string> </property> + <property name="shortcut"> + <string>Ctrl++</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> </action> <action name="actionSmaller_Icons"> <property name="text"> <string>Smaller Icons</string> </property> + <property name="shortcut"> + <string>Ctrl+-</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> </action> <action name="actionNew_Window"> <property name="text"> @@ -320,6 +349,83 @@ <enum>Qt::ApplicationShortcut</enum> </property> </action> + <action name="actionRename"> + <property name="text"> + <string>Rename...</string> + </property> + <property name="shortcut"> + <string>F2</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionCut_Selection"> + <property name="text"> + <string>Cut Selection</string> + </property> + <property name="shortcut"> + <string>Ctrl+X</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionCopy_Selection"> + <property name="text"> + <string>Copy Selection</string> + </property> + <property name="shortcut"> + <string>Ctrl+C</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionPaste"> + <property name="text"> + <string>Paste</string> + </property> + <property name="shortcut"> + <string>Ctrl+V</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionDelete_Selection"> + <property name="text"> + <string>Delete Selection</string> + </property> + <property name="shortcut"> + <string>Del</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionRefresh"> + <property name="text"> + <string>Refresh</string> + </property> + <property name="shortcut"> + <string>F5</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> + <action name="actionClose_Browser"> + <property name="text"> + <string>Close Browser</string> + </property> + <property name="shortcut"> + <string>Ctrl+W</string> + </property> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> + </property> + </action> </widget> <resources/> <connections/> diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp index 1cf5eb41..f7ade48c 100644 --- a/lumina-fm/widgets/DirWidget.cpp +++ b/lumina-fm/widgets/DirWidget.cpp @@ -557,6 +557,10 @@ void DirWidget::UpdateButtons(){ } //Keyboard Shortcuts triggered +void DirWidget::TryRenameSelection(){ + on_tool_act_rename_clicked(); +} + void DirWidget::TryCutSelection(){ on_tool_act_cut_clicked(); } diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h index 70936b97..75003681 100644 --- a/lumina-fm/widgets/DirWidget.h +++ b/lumina-fm/widgets/DirWidget.h @@ -72,6 +72,7 @@ public slots: void UpdateButtons(); //Keyboard Shortcuts triggered + void TryRenameSelection(); void TryCutSelection(); void TryCopySelection(); void TryPasteSelection(); |