diff options
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 107 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.h | 12 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.ui | 15 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 6 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h | 2 |
5 files changed, 133 insertions, 9 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index b2f976d2..22f4f934 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -84,6 +84,32 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); ui->menuView_Mode->addAction(listWA); //ui->menuGroup_Mode->addAction(tabsWA); //ui->menuGroup_Mode->addAction(colsWA); + if(DEBUG){ qDebug() << " - sort Menu"; } + menuSort_Mode = new QMenu(this); + radio_sort_name = new QRadioButton(tr("Sort by Name"), this); + radio_sort_size = new QRadioButton(tr("Sort by Size"), this); + radio_sort_type = new QRadioButton(tr("Sort by Type"), this); + radio_sort_datemod = new QRadioButton(tr("Sort by Date Modified"), this); + radio_sort_datecre = new QRadioButton(tr("Sort by Date Created"), this); + ui->menuSort_Mode->clear(); + sortnameA = new QWidgetAction(this); + sortnameA->setDefaultWidget(radio_sort_name); + sortsizeA = new QWidgetAction(this); + sortsizeA->setDefaultWidget(radio_sort_size); + sorttypeA = new QWidgetAction(this); + sorttypeA->setDefaultWidget(radio_sort_type); + sortdateMA = new QWidgetAction(this); + sortdateMA->setDefaultWidget(radio_sort_datemod); + sortdateCA = new QWidgetAction(this); + sortdateCA->setDefaultWidget(radio_sort_datecre); + + + ui->menuSort_Mode->addAction(sortnameA); + ui->menuSort_Mode->addAction(sortsizeA); + ui->menuSort_Mode->addAction(sorttypeA); + ui->menuSort_Mode->addAction(sortdateMA); + ui->menuSort_Mode->addAction(sortdateCA); + //Setup the pages //ui->BrowserLayout->clear(); ui->page_player->setLayout(new QVBoxLayout()); @@ -187,12 +213,13 @@ void MainUI::OpenDirs(QStringList dirs){ //Initialize the widget with the proper settings if(DEBUG){ qDebug() << "Setup Dir Widget"; } - DW->setShowDetails(radio_view_details->isChecked()); - DW->setThumbnailSize(settings->value("iconsize", 32).toInt()); + DW->setShowDetails(radio_view_details->isChecked() ); + DW->setThumbnailSize(settings->value("iconsize", 32).toInt() ); DW->showHidden( ui->actionView_Hidden_Files->isChecked() ); DW->showThumbnails( ui->actionShow_Thumbnails->isChecked() ); //DW->showDirTreePane( ui->actionView_showDirTreePane->isChecked() ); DW->adjustTreeWidget( settings->value("dirTree_width", 25.0).toFloat() ); + DW->setTreeSortMode( settings->value("sortmode","num").toInt() ); //Now load the directory if(DEBUG){ qDebug() << "Load Directory"; } DW->ChangeDir(dirs[i]); //kick off loading the directory info @@ -262,6 +289,14 @@ void MainUI::setupConnections(){ //connect(radio_view_tabs, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) ); //connect(radio_view_cols, SIGNAL(toggled(bool)), this, SLOT(groupModeChanged(bool)) ); + // Sort Buttons + connect(radio_sort_name, SIGNAL(toggled(bool)), this, SLOT(sortModeName(bool)) ); + connect(radio_sort_size, SIGNAL(toggled(bool)), this, SLOT(sortModeSize(bool)) ); + connect(radio_sort_type, SIGNAL(toggled(bool)), this, SLOT(sortModeType(bool)) ); + connect(radio_sort_datemod, SIGNAL(toggled(bool)), this, SLOT(sortModeDateM(bool)) ); + connect(radio_sort_datecre, SIGNAL(toggled(bool)), this, SLOT(sortModeDateC(bool)) ); + + //Special Keyboard Shortcuts connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) ); connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) ); @@ -315,7 +350,21 @@ void MainUI::loadSettings(){ //bool usetabs = (settings->value("groupmode","tabs").toString()=="tabs"); //if(usetabs){ radio_view_tabs->setChecked(true); } // else{ radio_view_cols->setChecked(true); } - + //Sort Mode + int sortMode = (settings->value("sortmode","num").toInt() ); + switch(sortMode){ + case 0: // Name + radio_sort_name->setChecked(true); break; + case 1: // Size + radio_sort_size->setChecked(true); break; + case 2: // Type + radio_sort_type->setChecked(true); break; + case 3: // Date Modified + radio_sort_datemod->setChecked(true); break; + case 4: // Date Created + radio_sort_datecre->setChecked(true); break; + + } // end sortMode Switch } void MainUI::RebuildBookmarksMenu(){ @@ -556,6 +605,58 @@ void MainUI::viewModeChanged(bool active){ } + +void MainUI::sortModeName(bool active){ + if(!active){ return; } + bool sortbyName = radio_sort_name->isChecked(); + settings->setValue("sortmode","0"); + for(int i=0; i<DWLIST.length(); i++){ + DWLIST[i]->setTreeSortMode(0); + qDebug() << "sortModeName"; + qDebug() << "bool" << active; + +} +} + +void MainUI::sortModeSize(bool active){ + if(!active){ return; } + bool sortbySize = radio_sort_size->isChecked(); + settings->setValue("sortmode","1"); + for(int i=0; i<DWLIST.length(); i++){ + DWLIST[i]->setTreeSortMode(1); + qDebug() << "sortModeSize"; + qDebug() << "bool" << active; +} +} + +void MainUI::sortModeType(bool active){ + if(!active){ return; } + bool sortbyType = radio_sort_type->isChecked(); + settings->setValue("sortmode","2"); + for(int i=0; i<DWLIST.length(); i++){ + DWLIST[i]->setTreeSortMode(2); +} +} + +void MainUI::sortModeDateM(bool active){ + if(!active){ return; } + bool sortbyDateM = radio_sort_datemod->isChecked(); + settings->setValue("sortmode","3"); + for(int i=0; i<DWLIST.length(); i++){ + DWLIST[i]->setTreeSortMode(3); +} +} + +void MainUI::sortModeDateC(bool active){ + if(!active){ return; } + bool sortbyDateC = radio_sort_datecre->isChecked(); + settings->setValue("sortmode","4"); + for(int i=0; i<DWLIST.length(); i++){ + DWLIST[i]->setTreeSortMode(4); +} +} + + /*void MainUI::groupModeChanged(bool active){ if(!active){ return; } //on every change, all radio buttons will call this function - only run this once though //bool usetabs = radio_view_tabs->isChecked(); diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h index 9eed250d..3aa0db78 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h @@ -81,9 +81,9 @@ private: //Internal non-ui widgets QTabBar *tabBar; //QFileSystemModel *fsmod; - QMenu *contextMenu; - QRadioButton *radio_view_details, *radio_view_list;//, *radio_view_tabs, *radio_view_cols; - QWidgetAction *detWA, *listWA;//, *tabsWA, *colsWA; + QMenu *contextMenu, * menuSort_Mode; + QRadioButton *radio_view_details, *radio_view_list, *radio_sort_name, *radio_sort_size, *radio_sort_type, *radio_sort_datemod, *radio_sort_datecre;//, *radio_view_tabs, *radio_view_cols; + QWidgetAction *detWA, *listWA, *sortnameA, *sortsizeA, *sorttypeA, *sortdateMA, *sortdateCA; //, *tabsWA, *colsWA; //UI Widgets QList<DirWidget*> DWLIST; @@ -137,6 +137,12 @@ private slots: void goToBookmark(QAction*); void goToDevice(QAction*); void viewModeChanged(bool); + void sortModeName(bool); + void sortModeSize(bool); + void sortModeType(bool); + void sortModeDateM(bool); + void sortModeDateC(bool); + //void groupModeChanged(bool); void on_actionLarger_Icons_triggered(); void on_actionSmaller_Icons_triggered(); diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.ui b/src-qt5/desktop-utils/lumina-fm/MainUI.ui index e80fd7fc..c2e2b091 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.ui @@ -69,7 +69,7 @@ <x>0</x> <y>0</y> <width>567</width> - <height>137</height> + <height>163</height> </rect> </property> <layout class="QHBoxLayout" name="BrowserLayout"> @@ -116,7 +116,7 @@ <x>0</x> <y>0</y> <width>567</width> - <height>38</height> + <height>28</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -143,6 +143,11 @@ </property> <addaction name="actionTabs"/> </widget> + <widget class="QMenu" name="menuSort_Mode"> + <property name="title"> + <string>Sort Mode</string> + </property> + </widget> <addaction name="actionRefresh"/> <addaction name="separator"/> <addaction name="actionShow_Thumbnails"/> @@ -150,6 +155,7 @@ <addaction name="actionVerify_File_Delete"/> <addaction name="separator"/> <addaction name="menuView_Mode"/> + <addaction name="menuSort_Mode"/> </widget> <widget class="QMenu" name="menuBookmarks"> <property name="title"> @@ -463,6 +469,11 @@ <string>Verify File Delete</string> </property> </action> + <action name="actionSortTabs"> + <property name="text"> + <string>Sort by Name</string> + </property> + </action> </widget> <resources/> <connections/> diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index ce5dfd81..9471e297 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -156,6 +156,12 @@ void DirWidget::setThumbnailSize(int px){ ui->tool_zoom_out->setEnabled(px >16); //lower limit on image sizes } +void DirWidget::setTreeSortMode(int num){ + bool now = true; + BW->setTreeWidgetSortColumn(num, now); + if(RCBW!=0){ RCBW->setTreeWidgetSortColumn(num, now ); } +} + //==================== // Folder Pane //==================== diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index 65f4b971..253ce2dd 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -54,7 +54,7 @@ public: void setThumbnailSize(int px); void setFocusLineDir(); void adjustTreeWidget(float percent); //percent between 0-100 - + void setTreeSortMode(int num); //0-4 public slots: |