summaryrefslogtreecommitdiffstats
path: root/logic/screenshots/ScreenshotList.h
blob: dc26a69801026c9fff15025915908a2f885b717d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once

#include <QAbstractListModel>
#include "logic/BaseInstance.h"
#include "logic/tasks/Task.h"

#include "Screenshot.h"

class ScreenshotList : public QAbstractListModel
{
	Q_OBJECT
public:
	ScreenshotList(InstancePtr instance, QObject *parent = 0);

	QVariant data(const QModelIndex &index, int role) const;
	QVariant headerData(int section, Qt::Orientation orientation, int role) const;

	int rowCount(const QModelIndex &parent) const;

	Qt::ItemFlags flags(const QModelIndex &index) const;

	Task *load();

	void loadShots(QList<ScreenshotPtr> shots)
	{
		m_screenshots = shots;
	}

	QList<ScreenshotPtr> screenshots() const
	{
		return m_screenshots;
	}

	InstancePtr instance() const
	{
		return m_instance;
	}

	void deleteSelected(class ScreenshotDialog *dialog);

signals:

public
slots:

private:
	QList<ScreenshotPtr> m_screenshots;
	InstancePtr m_instance;
};

class ScreenshotLoadTask : public Task
{
	Q_OBJECT

public:
	explicit ScreenshotLoadTask(ScreenshotList *list);
	~ScreenshotLoadTask();

	QList<ScreenshotPtr> screenShots() const
	{
		return m_results;
	}

protected:
	virtual void executeTask();

private:
	ScreenshotList *m_list;
	QList<ScreenshotPtr> m_results;
};