Skip to content

Commit

Permalink
Merge pull request #670 from edwardkarak/skip-hidden-files
Browse files Browse the repository at this point in the history
Added setting to control whether to show hidden files
  • Loading branch information
jurplel authored May 6, 2024
2 parents c768a3f + 27b061c commit 2aff9b3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ CMakeLists.txt.user*

bin/*
build/*

*.qm
.qm
9 changes: 8 additions & 1 deletion src/qvimagecore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,14 @@ QList<QVImageCore::CompatibleFile> QVImageCore::getCompatibleFiles(const QString

QMimeDatabase::MatchMode mimeMatchMode = allowMimeContentDetection ? QMimeDatabase::MatchDefault : QMimeDatabase::MatchExtension;

const QFileInfoList currentFolder = QDir(dirPath).entryInfoList(QDir::Files | QDir::Hidden, QDir::Unsorted);
// skip hidden files if user wants to
QDir::Filters filters = QDir::Files;

auto &settingsManager = qvApp->getSettingsManager();
if (!settingsManager.getBoolean("skiphidden"))
filters |= QDir::Hidden;

const QFileInfoList currentFolder = QDir(dirPath).entryInfoList(filters, QDir::Unsorted);
for (const QFileInfo &fileInfo : currentFolder)
{
bool matched = false;
Expand Down
2 changes: 2 additions & 0 deletions src/qvoptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ void QVOptionsDialog::syncSettings(bool defaults, bool makeConnections)
syncCheckbox(ui->saveRecentsCheckbox, "saverecents", defaults, makeConnections);
// updatenotifications
syncCheckbox(ui->updateCheckbox, "updatenotifications", defaults, makeConnections);
// skiphidden
syncCheckbox(ui->skipHiddenCheckbox, "skiphidden", defaults, makeConnections);
}

void QVOptionsDialog::syncCheckbox(QCheckBox *checkbox, const QString &key, bool defaults, bool makeConnection)
Expand Down
14 changes: 12 additions & 2 deletions src/qvoptionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>558</height>
<width>447</width>
<height>562</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -721,6 +721,16 @@
</property>
</widget>
</item>
<item row="17" column="1">
<widget class="QCheckBox" name="skipHiddenCheckbox">
<property name="toolTip">
<string>Skip hidden files when browsing to the next/previous file</string>
</property>
<property name="text">
<string extracomment="Don't view files with 'hidden' attribute">Skip hidden files</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QComboBox" name="afterDeletionComboBox">
<property name="currentIndex">
Expand Down
1 change: 1 addition & 0 deletions src/settingsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,5 @@ void SettingsManager::initializeSettingsLibrary()
settingsLibrary.insert("allowmimecontentdetection", {false, {}});
settingsLibrary.insert("saverecents", {true, {}});
settingsLibrary.insert("updatenotifications", {false, {}});
settingsLibrary.insert("skiphidden", {true, {}});
}

0 comments on commit 2aff9b3

Please sign in to comment.