Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/slidemodel.cpp
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 David Redondo <kde@david-redondo.de> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
1 | #include "slidemodel.h" | 19 | #include "slidemodel.h" | ||
2 | 20 | | |||
3 | void SlideModel::reload(const QStringList &selected) | 21 | void SlideModel::reload(const QStringList &selected) | ||
4 | { | 22 | { | ||
5 | if (!m_packages.isEmpty()) { | 23 | if (!m_packages.isEmpty()) { | ||
6 | beginRemoveRows(QModelIndex(), 0, m_packages.count() - 1); | 24 | beginRemoveRows(QModelIndex(), 0, m_packages.count() - 1); | ||
7 | m_packages.clear(); | 25 | m_packages.clear(); | ||
8 | endRemoveRows(); | 26 | endRemoveRows(); | ||
Show All 12 Lines | |||||
21 | } | 39 | } | ||
22 | 40 | | |||
23 | void SlideModel::backgroundsFound(const QStringList& paths, const QString& token) | 41 | void SlideModel::backgroundsFound(const QStringList& paths, const QString& token) | ||
24 | { | 42 | { | ||
25 | if (token != m_findToken) { | 43 | if (token != m_findToken) { | ||
26 | return; | 44 | return; | ||
27 | } | 45 | } | ||
28 | processPaths(paths); | 46 | processPaths(paths); | ||
47 | emit done(); | ||||
29 | } | 48 | } | ||
30 | 49 | | |||
31 | 50 | | |||
32 | void SlideModel::removeDir(const QString &path) | 51 | void SlideModel::removeDir(const QString &path) | ||
33 | { | 52 | { | ||
34 | BackgroundFinder *finder = new BackgroundFinder(m_wallpaper.data(), QStringList{path}); | 53 | BackgroundFinder *finder = new BackgroundFinder(m_wallpaper.data(), QStringList{path}); | ||
35 | connect(finder, &BackgroundFinder::backgroundsFound, this, &SlideModel::removeBackgrounds); | 54 | connect(finder, &BackgroundFinder::backgroundsFound, this, &SlideModel::removeBackgrounds); | ||
36 | finder->start(); | 55 | finder->start(); | ||
Show All 23 Lines |