diff options
Diffstat (limited to 'lumina-fm')
-rw-r--r-- | lumina-fm/MainUI.cpp | 64 | ||||
-rw-r--r-- | lumina-fm/MainUI.h | 4 | ||||
-rw-r--r-- | lumina-fm/MainUI.ui | 14 | ||||
-rw-r--r-- | lumina-fm/MimeIconProvider.h | 6 |
4 files changed, 83 insertions, 5 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 72176e55..298c3ee6 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -283,9 +283,11 @@ void MainUI::loadSettings(){ //Note: make sure this is run after all the UI elements are created and connected to slots // but before the first directory gets loaded ui->actionView_Hidden_Files->setChecked( settings->value("showhidden", false).toBool() ); - on_actionView_Hidden_Files_triggered(); //make sure to update the models too + on_actionView_Hidden_Files_triggered(); //make sure to update the models too ui->actionShow_Action_Buttons->setChecked(settings->value("showactions", true).toBool() ); - on_actionShow_Action_Buttons_triggered(); //make sure to update the UI + on_actionShow_Action_Buttons_triggered(); //make sure to update the UI + ui->actionShow_Thumbnails->setChecked( settings->value("showthumbnails", true).toBool() ); + iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked(); QString view = settings->value("viewmode","details").toString(); if(view=="icons"){ radio_view_icons->setChecked(true); } else if(view=="list"){ radio_view_list->setChecked(true); } @@ -418,6 +420,7 @@ void MainUI::setCurrentDir(QString dir){ //Update the directory viewer and update the line edit keepFocus = !currentDir->hasFocus(); currentDir->setWhatsThis(dir); //save the full path internally + fsmod->setRootPath(rawdir); if(radio_view_details->isChecked()){ ui->tree_dir_view->setRootIndex(fsmod->index(dir)); ui->tree_dir_view->selectionModel()->clearSelection(); @@ -471,6 +474,40 @@ QFileInfoList MainUI::getSelectedItems(){ return out; } +/*QModelIndexList MainUI::getVisibleItems(){ + QModelIndexList out; + if(radio_view_details->isChecked()){ + QModelIndex index = ui->tree_dir_view->indexAt(QPoint(0,0)); + while( index.isValid()){ + if(index.column()!=0){ + //move on - multiple index's per row when we only need one + }else if(ui->tree_dir_view->viewport()->rect().contains( ui->tree_dir_view->visualRect(index) ) ){ + //index within the viewport - add it to the list + out << index; + }else{ + break; //index not in the viewport + } + index = ui->tree_dir_view->indexBelow(index); //go to the next + if(out.contains(index)){ break; } //end of the list + } + + }else{ + QModelIndex index = ui->list_dir_view->indexAt(QPoint(0,0)); + while( index.isValid()){ + if(ui->list_dir_view->viewport()->rect().contains( ui->list_dir_view->visualRect(index) ) ){ + //index within the viewport - add it to the list + out << index; + }else{ + break; //index not in the viewport + } + index = ui->list_dir_view->indexBelow(index); //go to the next + if(out.contains(index)){ break; } //end of the list + } + + } + return out; +}*/ + //============== // PRIVATE SLOTS //============== @@ -648,6 +685,18 @@ void MainUI::on_actionShow_Action_Buttons_triggered(){ ui->group_actions->setVisible(ui->actionShow_Action_Buttons->isChecked()); settings->setValue("showactions", ui->actionShow_Action_Buttons->isChecked()); } + +void MainUI::on_actionShow_Thumbnails_triggered(){ + //Now save this setting for later + settings->setValue("showthumbnails", ui->actionShow_Thumbnails->isChecked()); + //Set the value in the icon provider + iconProv->showthumbnails = ui->actionShow_Thumbnails->isChecked(); + //Now make sure the filesystem model knows to re-load the image data + fsmod->revert(); + //Re-load the view widget + setCurrentDir(getCurrentDir()); +} + void MainUI::goToBookmark(QAction *act){ if(act==ui->actionManage_Bookmarks){ BMMDialog dlg(this); @@ -761,6 +810,17 @@ void MainUI::reloadDirectory(){ setCurrentDir( getCurrentDir() ); } +/*void MainUI::viewportChanged(){ + if( !ui->actionsShow_Thumbnails->isChecked()){ return; } + QModelIndexList list = getVisibleItems(); + for(int i=0; i<list.length(); i++){ + if( !ui->actionsShow_Thumbnails->isChecked()){ return; } //break out as necessary + if( imgFilter.contains("*."+fsmod->filePath(list[i]).section("/",-1).section(".",-1).toLower()){ + fmod-> + } + } +}*/ + void MainUI::currentDirectoryLoaded(){ //The directory was just loaded: refresh the action buttons as neccesary ui->tool_goToPlayer->setVisible(false); diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h index ba390cb0..9b93b1d7 100644 --- a/lumina-fm/MainUI.h +++ b/lumina-fm/MainUI.h @@ -115,7 +115,8 @@ private: QString getCurrentDir(); void setCurrentDir(QString); QFileInfoList getSelectedItems(); - + //QModelIndexList getVisibleItems(); + private slots: void slotSingleInstance(QStringList in){ this->show(); @@ -141,6 +142,7 @@ private slots: void on_actionClose_triggered(); void on_actionView_Hidden_Files_triggered(); void on_actionShow_Action_Buttons_triggered(); + void on_actionShow_Thumbnails_triggered(); void goToBookmark(QAction*); void goToDevice(QAction*); void viewModeChanged(bool); diff --git a/lumina-fm/MainUI.ui b/lumina-fm/MainUI.ui index 5cdb35e8..8c954061 100644 --- a/lumina-fm/MainUI.ui +++ b/lumina-fm/MainUI.ui @@ -1105,7 +1105,7 @@ <x>0</x> <y>0</y> <width>567</width> - <height>18</height> + <height>19</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -1120,6 +1120,7 @@ <property name="title"> <string>View</string> </property> + <addaction name="actionShow_Thumbnails"/> <addaction name="actionView_Hidden_Files"/> <addaction name="actionShow_Action_Buttons"/> <addaction name="separator"/> @@ -1285,6 +1286,17 @@ <string>Show Action Buttons</string> </property> </action> + <action name="actionShow_Thumbnails"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="text"> + <string>Load Thumbnails</string> + </property> + </action> </widget> <resources/> <connections/> diff --git a/lumina-fm/MimeIconProvider.h b/lumina-fm/MimeIconProvider.h index 044ff7eb..344d6801 100644 --- a/lumina-fm/MimeIconProvider.h +++ b/lumina-fm/MimeIconProvider.h @@ -19,15 +19,19 @@ class MimeIconProvider : public QFileIconProvider{ public: + bool showthumbnails; MimeIconProvider() : QFileIconProvider(){ + showthumbnails = false; } ~MimeIconProvider(){} + + QIcon icon(const QFileInfo &info) const{ if(info.isDir()){ return LXDG::findIcon("folder",""); }else if(info.isFile()){ - if(info.suffix().toLower()=="png" || info.suffix().toLower()=="jpg"){ + if(showthumbnails && (info.suffix().toLower()=="png" || info.suffix().toLower()=="jpg") ){ //make sure to only load small versions of the files into memory: could have hundreds of them... return QIcon( QPixmap(info.absoluteFilePath()).scaledToHeight(64) ); }else{ |