Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added setting to control whether to show hidden files #670

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -196,6 +196,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, {}});
}
Loading