aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-02-23 13:08:33 -0500
committerKen Moore <ken@pcbsd.org>2015-02-23 13:08:33 -0500
commitc65a4f358f20f3709d1ebc4e9d2f7931252a50e8 (patch)
tree89e92babda9ce245fe8565029b527105704e41eb
parentUpdate the ROADMAP to 1.0.0-Release (diff)
downloadlumina-c65a4f358f20f3709d1ebc4e9d2f7931252a50e8.tar.gz
lumina-c65a4f358f20f3709d1ebc4e9d2f7931252a50e8.tar.bz2
lumina-c65a4f358f20f3709d1ebc4e9d2f7931252a50e8.zip
Add an option in lumina-fm to enable/disable loading file thumbnails.
NOTE: This option does not retroactively remove thumbnails that have already been loaded - it only prevents loading thumbnails in new directories.
-rw-r--r--lumina-fm/MainUI.cpp64
-rw-r--r--lumina-fm/MainUI.h4
-rw-r--r--lumina-fm/MainUI.ui14
-rw-r--r--lumina-fm/MimeIconProvider.h6
4 files changed, 83 insertions, 5 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index 1b01a855..76b0d7d4 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -282,9 +282,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); }
@@ -417,6 +419,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();
@@ -469,6 +472,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
//==============
@@ -646,6 +683,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);
@@ -759,6 +808,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 ccc85f72..d5775220 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 9dae7a56..66685532 100644
--- a/lumina-fm/MainUI.ui
+++ b/lumina-fm/MainUI.ui
@@ -1086,7 +1086,7 @@
<x>0</x>
<y>0</y>
<width>567</width>
- <height>18</height>
+ <height>19</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -1101,6 +1101,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"/>
@@ -1266,6 +1267,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{
bgstack15