summaryrefslogtreecommitdiffstats
path: root/logic/lists/ScreenshotList.h
blob: 8e512ace12229b6e2458ea66096ee55a4454ccce (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
71
72
73
74
75
76
77
#pragma once

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

class ScreenShot
{
public:
	QDateTime timestamp;
	QString file;
	QString url;
	QString imgurId;
};

class ScreenshotList : public QAbstractListModel
{
	Q_OBJECT
public:
	ScreenshotList(BaseInstance *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<ScreenShot *> shots)
	{
		m_screenshots = shots;
	}

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

	BaseInstance *instance() const
	{
		return m_instance;
	}

	void deleteSelected(class ScreenshotDialog *dialog);

signals:

public
slots:

private:
	QList<ScreenShot *> m_screenshots;
	BaseInstance *m_instance;
};

class ScreenshotLoadTask : public Task
{
	Q_OBJECT

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

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

protected:
	virtual void executeTask();

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