Skip to content

Commit

Permalink
chore: add webp to default image queue filter list
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Feb 25, 2021
1 parent 6316431 commit 9c460f2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ int main(int argc, char *argv[])

parser.process(a);

QStringList urlStrList = parser.positionalArguments();
QList<QUrl> && urlList = PlaylistManager::convertToUrlList(urlStrList);

MainWindow w;
w.show();

QStringList urlStrList = parser.positionalArguments();
QList<QUrl> && urlList = PlaylistManager::convertToUrlList(urlStrList);

if (!urlList.isEmpty()) {
w.showUrls(urlList);
w.adjustWindowSizeBySceneRect();
Expand Down
2 changes: 2 additions & 0 deletions app/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ MainWindow::MainWindow(QWidget *parent)
this->setWindowIcon(QIcon(":/icons/app-icon.svg"));
this->setMouseTracking(true);

m_pm->setAutoLoadFilterSuffix({"*.jpg", "*.jpeg", "*.jfif", "*.png", "*.gif", "*.svg", "*.bmp", "*.webp"});

m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity");
m_fadeOutAnimation->setDuration(300);
m_fadeOutAnimation->setStartValue(1);
Expand Down
15 changes: 13 additions & 2 deletions app/playlistmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ PlaylistManager::PlaylistType PlaylistManager::playlistType() const
return m_type;
}

QStringList PlaylistManager::autoLoadFilterSuffix() const
{
return m_autoLoadSuffix;
}

void PlaylistManager::setAutoLoadFilterSuffix(const QStringList & nameFilters)
{
m_autoLoadSuffix = nameFilters;
}

void PlaylistManager::clear()
{
m_currentIndex = -1;
Expand All @@ -50,8 +60,9 @@ void PlaylistManager::setCurrentFile(const QString & filePath)
int index = indexOf(filePath);
m_currentIndex = index == -1 ? appendFile(filePath) : index;
} else {
QStringList entryList = dir.entryList({"*.jpg", "*.jpeg", "*.jfif", "*.png", "*.gif", "*.svg", "*.bmp"},
QDir::Files | QDir::NoSymLinks, QDir::NoSort);
QStringList entryList = dir.entryList(
m_autoLoadSuffix,
QDir::Files | QDir::NoSymLinks, QDir::NoSort);

QCollator collator;
collator.setNumericMode(true);
Expand Down
4 changes: 4 additions & 0 deletions app/playlistmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class PlaylistManager : public QObject
void setPlaylistType(PlaylistType type);
PlaylistType playlistType() const;

QStringList autoLoadFilterSuffix() const;
void setAutoLoadFilterSuffix(const QStringList &nameFilters);

void clear();

void setPlaylist(const QList<QUrl> & urls);
Expand All @@ -40,5 +43,6 @@ class PlaylistManager : public QObject
PlaylistType m_type;
QString m_currentDir;
int m_currentIndex = -1;
QStringList m_autoLoadSuffix = {};
};

0 comments on commit 9c460f2

Please sign in to comment.