Summary:
This shows all the pictures inside the folders added to the Folders list. I also tried to make single pictures excludable via a checkbox on the thumbnail. This is the first time for me programming with QT/QML/Singals-Slots and I tried to use as much existing code as possible. The thumbnail view is the same as for single images and I simply subclassed the listmodel. However even if I tried to do everything like the code for slidePaths it doesn't work correctly. The checking/unchecking of images only applies on restart of plasmashell. Maybe it's a single mistake that is easily spotted by a more experienced programmer otherwise if the thumbnail view is accepted I can also revert all the checkbox stuff.
FEATURE: 403703
FIXED-IN: 5.16.0
{F6595564}
Reviewers: #vdg, ngraham, davidedmundson
Reviewed By: #vdg, ngraham, davidedmundson
Subscribers: filipf, mart, alexde, davidedmundson, ngraham, plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D18809
wilder-5.19
parent
19144ab096
commit
2003b267d4
8 changed files with 188 additions and 42 deletions
@ -0,0 +1,44 @@ |
||||
#include "slidemodel.h" |
||||
|
||||
void SlideModel::reload(const QStringList &selected) |
||||
{ |
||||
if (!m_packages.isEmpty()) { |
||||
beginRemoveRows(QModelIndex(), 0, m_packages.count() - 1); |
||||
m_packages.clear(); |
||||
endRemoveRows(); |
||||
emit countChanged(); |
||||
} |
||||
addDirs(selected); |
||||
} |
||||
|
||||
|
||||
void SlideModel::addDirs(const QStringList &selected) |
||||
{ |
||||
BackgroundFinder *finder = new BackgroundFinder(m_wallpaper.data(), selected); |
||||
connect(finder, &BackgroundFinder::backgroundsFound, this, &SlideModel::backgroundsFound); |
||||
m_findToken = finder->token(); |
||||
finder->start();
|
||||
} |
||||
|
||||
void SlideModel::backgroundsFound(const QStringList& paths, const QString& token) |
||||
{ |
||||
if (token != m_findToken) { |
||||
return; |
||||
} |
||||
processPaths(paths); |
||||
} |
||||
|
||||
|
||||
void SlideModel::removeDir(const QString &path) |
||||
{ |
||||
BackgroundFinder *finder = new BackgroundFinder(m_wallpaper.data(), QStringList{path}); |
||||
connect(finder, &BackgroundFinder::backgroundsFound, this, &SlideModel::removeBackgrounds); |
||||
finder->start(); |
||||
} |
||||
|
||||
void SlideModel::removeBackgrounds(const QStringList &paths, const QString &token) |
||||
{ |
||||
Q_FOREACH (const QString &file, paths) { |
||||
removeBackground(file); |
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@ |
||||
#ifndef SLIDEMODEL_H |
||||
#define SLIDEMODEL_H |
||||
|
||||
#include "backgroundlistmodel.h" |
||||
|
||||
class SlideModel : public BackgroundListModel |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
using BackgroundListModel::BackgroundListModel; |
||||
void reload(const QStringList &selected); |
||||
void addDirs(const QStringList &selected); |
||||
void removeDir(const QString &selected); |
||||
private Q_SLOTS: |
||||
void removeBackgrounds(const QStringList &paths, const QString &token); |
||||
void backgroundsFound(const QStringList &paths, const QString &token); |
||||
}; |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue