00001 /* 00002 Copyright (C) 2000,2001 Stefan Duffner 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License 00006 as published by the Free Software Foundation; either version 2 00007 of the License, or any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef SIMULATORDLGIMPL_H 00020 #define SIMULATORDLGIMPL_H 00021 00022 #include <qpushbutton.h> 00023 #include <qlabel.h> 00024 #include <qlineedit.h> 00025 #include <qradiobutton.h> 00026 #include "SimulatorDlg.h" 00027 #include "WSpinBox.h" 00028 00029 class MainWindow; 00030 00031 00036 class SimulatorDlgImpl : public SimulatorDlg 00037 { 00038 Q_OBJECT 00039 00040 public: 00042 enum simstate {Off, Busy, Finished}; 00043 00044 SimulatorDlgImpl( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 00045 ~SimulatorDlgImpl(); 00046 00048 void enable0(bool e) { pb_bin0->setEnabled(e); }; 00050 void enable1(bool e) { pb_bin1->setEnabled(e); }; 00052 void enable2(bool e) { pb_bin2->setEnabled(e); }; 00054 void enable3(bool e) { pb_bin3->setEnabled(e); }; 00056 void enable4(bool e) { pb_bin4->setEnabled(e); }; 00058 void enable5(bool e) { pb_bin5->setEnabled(e); }; 00060 void enable6(bool e) { pb_bin6->setEnabled(e); }; 00062 void enable7(bool e) { pb_bin7->setEnabled(e); }; 00064 void enable8(bool e) { pb_bin8->setEnabled(e); }; 00066 void enable9(bool e) { pb_bin9->setEnabled(e); }; 00068 void enable10(bool e) { pb_bin10->setEnabled(e); }; 00070 void enable11(bool e) { pb_bin11->setEnabled(e); }; 00072 void enable12(bool e) { pb_bin12->setEnabled(e); }; 00074 void enable13(bool e) { pb_bin13->setEnabled(e); }; 00076 void enable14(bool e) { pb_bin14->setEnabled(e); }; 00078 void enable15(bool e) { pb_bin15->setEnabled(e); }; 00080 void enableFrequency(bool e) { frequency->setEnabled(e); 00081 lb_frequency->setEnabled(e);}; 00083 void enableSend(bool e) { pb_send->setEnabled(e); }; 00085 QString getInputs() { return le_inputs->text(); }; 00087 void setInputs(QString s) { le_inputs->setText(s); }; 00089 void setStateName(QString n) { lb_sname->setText(n); }; 00091 void setStateCode(QString c) { lb_scode->setText(c); }; 00093 void setOutputs(QString o) { lb_outputs->setText(o); }; 00094 00096 bool isIBinChecked() { return rb_ibin->isChecked(); }; 00098 bool isIHexChecked() { return rb_ihex->isChecked(); }; 00100 bool isIASCIIChecked() { return rb_iascii->isChecked(); }; 00102 bool isOBinChecked() { return rb_obin->isChecked(); }; 00104 bool isOHexChecked() { return rb_ohex->isChecked(); }; 00106 bool isOASCIIChecked() { return rb_oascii->isChecked(); }; 00108 bool isClockOn() { return pb_clock->isOn(); }; 00109 void setState(int); 00110 00111 void resetButtons(); 00112 void stopTimer(); 00113 void init(); 00114 00115 signals: 00117 void inputSent(); 00119 void closing(); 00121 void resetPressed(); 00122 00123 public slots: 00124 void closeSim(); 00125 void send(); 00126 void reset(); 00127 void inputsChanged(const QString& ); 00128 void button0Pressed(); 00129 void button1Pressed(); 00130 void button2Pressed(); 00131 void button3Pressed(); 00132 void button4Pressed(); 00133 void button5Pressed(); 00134 void button6Pressed(); 00135 void button7Pressed(); 00136 void button8Pressed(); 00137 void button9Pressed(); 00138 void button10Pressed(); 00139 void button11Pressed(); 00140 void button12Pressed(); 00141 void button13Pressed(); 00142 void button14Pressed(); 00143 void button15Pressed(); 00144 void iBinPressed(); 00145 void iHexPressed(); 00146 void iASCIIPressed(); 00147 void oBinPressed(); 00148 void oHexPressed(); 00149 void oASCIIPressed(); 00150 00151 void clockPressed(); 00152 void selectFirst(); 00153 00154 void returnPressedInputs(); 00155 00156 private: 00158 MainWindow* main; 00160 QTimer* timer; 00162 QPixmap* redlight; 00164 QPixmap* greenlight; 00166 QPixmap* greylight; 00167 00168 void closeEvent(QCloseEvent* ); 00169 void updateInputsStr(); 00170 00171 }; 00172 00173 #endif // SIMULATORDLGIMPL_H