File indexing completed on 2025-02-16 03:33:31
0001 /* 0002 SPDX-FileCopyrightText: 2003-2006 Cies Breijs <cies AT kde DOT nl> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 0008 #ifndef _ECHOER_H_ 0009 #define _ECHOER_H_ 0010 0011 0012 #include "executer.h" 0013 0014 #include <QDebug> 0015 0016 0017 /** 0018 * @short Echoes signals to a QTextStream 0019 * 0020 * Just echos the signals it gets. 0021 * Useful for creating UnitTests. 0022 * 0023 * @author Cies Breijs 0024 */ 0025 class Echoer : public QObject 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 /** 0031 * Default Constructor 0032 */ 0033 explicit Echoer(QObject* parent = nullptr) { setParent(parent); } 0034 0035 /** 0036 * Default Destructor 0037 */ 0038 ~Echoer() override {} 0039 0040 /** 0041 * Connects all its slots to the signals of the Executer 0042 */ 0043 void connectAllSlots(Executer* executer) { 0044 // these connect calls connect all the Executers signals to this class' slots 0045 0046 //BEGIN GENERATED echoer_connect_h CODE 0047 0048 /* The code between the line that start with "//BEGIN GENERATED" and "//END GENERATED" 0049 * is generated by "generate.rb" according to the definitions specified in 0050 * "definitions.rb". Please make all changes in the "definitions.rb" file, since all 0051 * all change you make here will be overwritten the next time "generate.rb" is run. 0052 * Thanks for looking at the code! 0053 */ 0054 0055 connect(executer, &Executer::reset, 0056 this, &Echoer::reset); 0057 connect(executer, &Executer::clear, 0058 this, &Echoer::clear); 0059 connect(executer, &Executer::center, 0060 this, &Echoer::center); 0061 connect(executer, &Executer::go, 0062 this, &Echoer::go); 0063 connect(executer, &Executer::goX, 0064 this, &Echoer::goX); 0065 connect(executer, &Executer::goY, 0066 this, &Echoer::goY); 0067 connect(executer, &Executer::forward, 0068 this, &Echoer::forward); 0069 connect(executer, &Executer::backward, 0070 this, &Echoer::backward); 0071 connect(executer, &Executer::direction, 0072 this, &Echoer::direction); 0073 connect(executer, &Executer::turnLeft, 0074 this, &Echoer::turnLeft); 0075 connect(executer, &Executer::turnRight, 0076 this, &Echoer::turnRight); 0077 connect(executer, &Executer::penWidth, 0078 this, &Echoer::penWidth); 0079 connect(executer, &Executer::penUp, 0080 this, &Echoer::penUp); 0081 connect(executer, &Executer::penDown, 0082 this, &Echoer::penDown); 0083 connect(executer, &Executer::penColor, 0084 this, &Echoer::penColor); 0085 connect(executer, &Executer::canvasColor, 0086 this, &Echoer::canvasColor); 0087 connect(executer, &Executer::canvasSize, 0088 this, &Echoer::canvasSize); 0089 connect(executer, &Executer::spriteShow, 0090 this, &Echoer::spriteShow); 0091 connect(executer, &Executer::spriteHide, 0092 this, &Echoer::spriteHide); 0093 connect(executer, &Executer::print, 0094 this, &Echoer::print); 0095 connect(executer, &Executer::fontSize, 0096 this, &Echoer::fontSize); 0097 0098 //END GENERATED echoer_connect_h CODE 0099 } 0100 0101 0102 public Q_SLOTS: 0103 // the generated code is a set of slots that are covering all the Executers signals... 0104 0105 //BEGIN GENERATED echoer_slots_h CODE 0106 0107 /* The code between the line that start with "//BEGIN GENERATED" and "//END GENERATED" 0108 * is generated by "generate.rb" according to the definitions specified in 0109 * "definitions.rb". Please make all changes in the "definitions.rb" file, since all 0110 * all change you make here will be overwritten the next time "generate.rb" is run. 0111 * Thanks for looking at the code! 0112 */ 0113 0114 void reset() { qDebug() << "SIG> " << "reset" << "(" << ")"; } 0115 void clear() { qDebug() << "SIG> " << "clear" << "(" << ")"; } 0116 void center() { qDebug() << "SIG> " << "center" << "(" << ")"; } 0117 void go(double arg0, double arg1) { qDebug() << "SIG> " << "go" << "(" << arg0 << "," << arg1 << ")"; } 0118 void goX(double arg0) { qDebug() << "SIG> " << "goX" << "(" << arg0 << ")"; } 0119 void goY(double arg0) { qDebug() << "SIG> " << "goY" << "(" << arg0 << ")"; } 0120 void forward(double arg0) { qDebug() << "SIG> " << "forward" << "(" << arg0 << ")"; } 0121 void backward(double arg0) { qDebug() << "SIG> " << "backward" << "(" << arg0 << ")"; } 0122 void direction(double arg0) { qDebug() << "SIG> " << "direction" << "(" << arg0 << ")"; } 0123 void turnLeft(double arg0) { qDebug() << "SIG> " << "turnLeft" << "(" << arg0 << ")"; } 0124 void turnRight(double arg0) { qDebug() << "SIG> " << "turnRight" << "(" << arg0 << ")"; } 0125 void penWidth(double arg0) { qDebug() << "SIG> " << "penWidth" << "(" << arg0 << ")"; } 0126 void penUp() { qDebug() << "SIG> " << "penUp" << "(" << ")"; } 0127 void penDown() { qDebug() << "SIG> " << "penDown" << "(" << ")"; } 0128 void penColor(double arg0, double arg1, double arg2) { qDebug() << "SIG> " << "penColor" << "(" << arg0 << "," << arg1 << "," << arg2 << ")"; } 0129 void canvasColor(double arg0, double arg1, double arg2) { qDebug() << "SIG> " << "canvasColor" << "(" << arg0 << "," << arg1 << "," << arg2 << ")"; } 0130 void canvasSize(double arg0, double arg1) { qDebug() << "SIG> " << "canvasSize" << "(" << arg0 << "," << arg1 << ")"; } 0131 void spriteShow() { qDebug() << "SIG> " << "spriteShow" << "(" << ")"; } 0132 void spriteHide() { qDebug() << "SIG> " << "spriteHide" << "(" << ")"; } 0133 void print(const QString& arg0) { qDebug() << "SIG> " << "print" << "(" << qPrintable(arg0) << ")"; } 0134 void fontSize(double arg0) { qDebug() << "SIG> " << "fontSize" << "(" << arg0 << ")"; } 0135 0136 //END GENERATED echoer_slots_h CODE 0137 0138 }; 0139 0140 #endif // _ECHOER_H_ 0141 0142