summaryrefslogtreecommitdiffstats
path: root/src/languages/processchain.h
blob: 90b871e3e5c93223d5b9863dbad499f8c8867988 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
 *   Copyright (C) 2005 by David Saxton                                    *
 *   david@bluehaze.org                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef PROCESSCHAIN_H
#define PROCESSCHAIN_H

#include "language.h"
#include <qobject.h>
#include <qvaluelist.h>

class FlowCode;
class Gpasm;
class Gpdasm;
class Gplib;
class Gplink;
class KTechlab;
class Microbe;
class PicProgrammer;
class ProcesOptions;
class SDCC;

typedef QValueList<ProcessOptions> ProcessOptionsList;

/**
@author Daniel Clarke
@author David Saxton
*/
class ProcessChain : public QObject
{
	Q_OBJECT
	public:
		ProcessChain( ProcessOptions options, KTechlab *parent, const char *name = 0l );
		~ProcessChain();
		
		void setProcessOptions( ProcessOptions options ) { m_processOptions = options; }
	
	public slots:
		/**
		 * Adds the output file to project if requested in the options, and opens
		 * the file in a code editor. Called to signal that a language in the last
		 * step of a compile has finished its compiling successfully.
		 */
		void slotFinishedCompile( Language * language );
		/**
		 * Call to compile a file of one type all the way to another type. This
		 * uses the ProcessOptions given in the constructor of this function, or
		 * later in setProcessOptions.
		 */
		void compile();
		
	signals:
		/**
		 * Emitted when compiling has successfully gone all the way through to the
		 * specified 'typeTo'
		 * @param options The ProcessOptions holding the output filename
		 * @see compile
		 */
		void successful(ProcessOptions options);
		/**
		 * Convenience signal
		 */
		void successful();
		/**
		 * Emitted if not successful
		 */
		void failed();

	protected:
		FlowCode * flowCode();
		Gpasm * gpasm();
		Gpdasm * gpdasm();
		Gplib * gplib();
		Gplink * gplink();
		Microbe * microbe();
		PicProgrammer * picProgrammer();
		SDCC * sdcc();
		
		int m_errorCount;
		ProcessOptions m_processOptions;
		KTechlab * m_pKTechlab;
	
	private:
		FlowCode * m_pFlowCode;
		Microbe * m_pMicrobe;
		Gpasm * m_pGpasm;
		Gpdasm * m_pGpdasm;
		Gplib * m_pGplib;
		Gplink * m_pGplink;
		PicProgrammer * m_pPicProgrammer;
		SDCC * m_pSDCC;
};


class ProcessListChain : public QObject
{
	Q_OBJECT
			
	public:
		ProcessListChain( ProcessOptionsList pol, KTechlab *parent, const char *name = 0l );
		
	signals:
		/**
		 * Emitted if successful
		 */
		void successful();
		/**
		 * Emitted if not successful
		 */
		void failed();
		
	protected slots:
		void slotProcessChainSuccessful();
		void slotProcessChainFailed();
		
	protected:
		ProcessOptionsList m_processOptionsList;
		KTechlab * m_pKTechlab;
};

#endif