summaryrefslogtreecommitdiffstats
path: root/application/UpdateController.h
blob: 2b2587018822c6d910baece2e077ae0223ecd3be (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
#pragma once

#include <QString>
#include <QList>
#include <updater/GoUpdate.h>

class QWidget;

class UpdateController
{
public:
	UpdateController(QWidget * parent, const QString &root, const QString updateFilesDir, GoUpdate::OperationList operations);
	void installUpdates();

private:
	void fail();
	bool rollback();

private:
	QString m_root;
	QString m_updateFilesDir;
	GoUpdate::OperationList m_operations;
	QWidget * m_parent;

	struct BackupEntry
	{
		// path where we got the new file from
		QString update;
		// path of what is being actually updated
		QString original;
		// path where the backup of the updated file was placed
		QString backup;
	};
	QList <BackupEntry> m_replace_backups;
	QList <BackupEntry> m_delete_backups;
	enum Failure
	{
		Replace,
		Delete,
		Start,
		Nothing
	} m_failedOperationType = Nothing;
	QString m_failedFile;
};