gui: Move action functions to function pointer map.

This allows the functions to be more readable and make
doActions readable.

Patch set 5: gui: remove threading in GUIAction

Multiple actions were started in another thread that was joined
immediately after starting it, so the input thread was blocked anyway.

Selected single actions were started in their own thread, but this
caused bugs like being able to install the same package twice in
parallel by quickly swiping the slider twice.

Change-Id: I28adadaedd032efc7bff3aaa48e659627aa3a3b3
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 310ba4e..3f12ea7 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -264,7 +264,8 @@
 	virtual int NotifyTouch(TOUCH_STATE state, int x, int y);
 	virtual int NotifyKey(int key, bool down);
 	virtual int NotifyVarChange(const std::string& varName, const std::string& value);
-	virtual int doActions();
+
+	int doActions();
 
 protected:
 	class Action
@@ -279,14 +280,76 @@
 
 protected:
 	int getKeyByName(std::string key);
-	virtual int doAction(Action action, int isThreaded = 0);
-	static void* thread_start(void *cookie);
+	int doAction(Action action);
 	void simulate_progress_bar(void);
-	int flash_zip(std::string filename, std::string pageName, const int simulate, int* wipe_cache);
+	int flash_zip(std::string filename, std::string pageName, int* wipe_cache);
 	void operation_start(const string operation_name);
-	void operation_end(const int operation_status, const int simulate);
+	void operation_end(const int operation_status);
 	static void* command_thread(void *cookie);
 	time_t Start;
+
+	// map action name to function pointer
+	typedef int (GUIAction::*execFunction)(std::string);
+	typedef std::map<std::string, execFunction> mapFunc;
+	static mapFunc mf;
+
+	// GUI actions
+	int reboot(std::string arg);
+	int home(std::string arg);
+	int key(std::string arg);
+	int page(std::string arg);
+	int reload(std::string arg);
+	int readBackup(std::string arg);
+	int set(std::string arg);
+	int clear(std::string arg);
+	int mount(std::string arg);
+	int unmount(std::string arg);
+	int restoredefaultsettings(std::string arg);
+	int copylog(std::string arg);
+	int compute(std::string arg);
+	int setguitimezone(std::string arg);
+	int overlay(std::string arg);
+	int queuezip(std::string arg);
+	int cancelzip(std::string arg);
+	int queueclear(std::string arg);
+	int sleep(std::string arg);
+	int appenddatetobackupname(std::string arg);
+	int generatebackupname(std::string arg);
+	int checkpartitionlist(std::string arg);
+	int getpartitiondetails(std::string arg);
+	int screenshot(std::string arg);
+	int setbrightness(std::string arg);
+
+	// threaded actions
+	int fileexists(std::string arg);
+	int flash(std::string arg);
+	int wipe(std::string arg);
+	int refreshsizes(std::string arg);
+	int nandroid(std::string arg);
+	int fixpermissions(std::string arg);
+	int dd(std::string arg);
+	int partitionsd(std::string arg);
+	int installhtcdumlock(std::string arg);
+	int htcdumlockrestoreboot(std::string arg);
+	int htcdumlockreflashrecovery(std::string arg);
+	int cmd(std::string arg);
+	int terminalcommand(std::string arg);
+	int killterminal(std::string arg);
+	int reinjecttwrp(std::string arg);
+	int checkbackupname(std::string arg);
+	int decrypt(std::string arg);
+	int adbsideload(std::string arg);
+	int adbsideloadcancel(std::string arg);
+	int openrecoveryscript(std::string arg);
+	int installsu(std::string arg);
+	int fixsu(std::string arg);
+	int decrypt_backup(std::string arg);
+	int repair(std::string arg);
+	int changefilesystem(std::string arg);
+	int startmtp(std::string arg);
+	int stopmtp(std::string arg);
+
+	int simulate;
 };
 
 class GUIConsole : public GUIObject, public RenderObject, public ActionObject