File indexing completed on 2024-06-16 08:27:30

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef PROCESSCHAIN_H
0012 #define PROCESSCHAIN_H
0013 
0014 #include "language.h"
0015 #include <QList>
0016 #include <QObject>
0017 
0018 class FlowCode;
0019 class Gpasm;
0020 class Gpdasm;
0021 class Gplib;
0022 class Gplink;
0023 class KTechlab;
0024 class Microbe;
0025 class PicProgrammer;
0026 class ProcesOptions;
0027 class SDCC;
0028 
0029 typedef QList<ProcessOptions> ProcessOptionsList;
0030 
0031 /**
0032 @author Daniel Clarke
0033 @author David Saxton
0034 */
0035 class ProcessChain : public QObject
0036 {
0037     Q_OBJECT
0038 public:
0039     ProcessChain(ProcessOptions options);
0040     ~ProcessChain() override;
0041 
0042     void setProcessOptions(ProcessOptions options)
0043     {
0044         m_processOptions = options;
0045     }
0046 
0047 public slots:
0048     /**
0049      * Adds the output file to project if requested in the options, and opens
0050      * the file in a code editor. Called to signal that a language in the last
0051      * step of a compile has finished its compiling successfully.
0052      */
0053     void slotFinishedCompile(Language *language);
0054     /**
0055      * Call to compile a file of one type all the way to another type. This
0056      * uses the ProcessOptions given in the constructor of this function, or
0057      * later in setProcessOptions.
0058      */
0059     void compile();
0060 
0061 signals:
0062     /**
0063      * Emitted when compiling has successfully gone all the way through to the
0064      * specified 'typeTo'
0065      * @param options The ProcessOptions holding the output filename
0066      * @see compile
0067      */
0068     void successful(ProcessOptions options);
0069     /**
0070      * Convenience signal
0071      */
0072     void successful();
0073     /**
0074      * Emitted if not successful
0075      */
0076     void failed();
0077 
0078 protected:
0079     FlowCode *flowCode();
0080     Gpasm *gpasm();
0081     Gpdasm *gpdasm();
0082     Gplib *gplib();
0083     Gplink *gplink();
0084     Microbe *microbe();
0085     PicProgrammer *picProgrammer();
0086     SDCC *sdcc();
0087 
0088     int m_errorCount;
0089     ProcessOptions m_processOptions;
0090 
0091 private:
0092     FlowCode *m_pFlowCode;
0093     Microbe *m_pMicrobe;
0094     Gpasm *m_pGpasm;
0095     Gpdasm *m_pGpdasm;
0096     Gplib *m_pGplib;
0097     Gplink *m_pGplink;
0098     PicProgrammer *m_pPicProgrammer;
0099     SDCC *m_pSDCC;
0100 };
0101 
0102 class ProcessListChain : public QObject
0103 {
0104     Q_OBJECT
0105 
0106 public:
0107     ProcessListChain(ProcessOptionsList pol);
0108 
0109 signals:
0110     /**
0111      * Emitted if successful
0112      */
0113     void successful();
0114     /**
0115      * Emitted if not successful
0116      */
0117     void failed();
0118 
0119 protected slots:
0120     void slotProcessChainSuccessful();
0121     void slotProcessChainFailed();
0122 
0123 protected:
0124     ProcessOptionsList m_processOptionsList;
0125 };
0126 
0127 #endif