• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision1c28ea63bc3a5bd76d38f8f0f141df7cd6d7beaf (tree)
Time2013-05-25 16:19:25
Authoralucky4416 <alucky4416@user...>
Commiteralucky4416

Log Message

feature: add Init Button, add SIG/SLOT DIO&LCD ready -> enable Buttons.

Change Summary

Incremental Difference

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -10,7 +10,11 @@ MainWindow::MainWindow(QWidget *parent) :
1010 ui->setupUi(this);
1111
1212 ThLCDOut = new ThLCDOutput(this);
13+ connect(ThLCDOut, SIGNAL(notify_dio_ready(int)),
14+ this, SLOT(slot_dio_ready(int)));
1315 ThLCDOut->start();
16+
17+ ui->statusBar->showMessage("DIO & LCD initialize...");
1418 }
1519
1620 MainWindow::~MainWindow()
@@ -22,6 +26,25 @@ MainWindow::~MainWindow()
2226 delete ui;
2327 }
2428
29+void MainWindow::slot_dio_ready(int status)
30+{
31+ qDebug() << "DIO Ready.";
32+ ui->statusBar->showMessage("Idle...");
33+ ui->pushButton_Init->setEnabled(true);
34+ ui->pushButton_Clear->setEnabled(true);
35+ ui->pushButton_Enter->setEnabled(true);
36+}
37+
38+void MainWindow::on_pushButton_Init_clicked()
39+{
40+ ThLCDOut->sendEvent_Init();
41+}
42+
43+void MainWindow::on_pushButton_Clear_clicked()
44+{
45+ ThLCDOut->sendEvent_Clear();
46+}
47+
2548 void MainWindow::on_pushButton_Enter_clicked()
2649 {
2750 if (ui->lineEdit_LCDOutputText->text().isEmpty()) {
@@ -33,7 +56,3 @@ void MainWindow::on_pushButton_Enter_clicked()
3356 }
3457 }
3558
36-void MainWindow::on_pushButton_Clear_clicked()
37-{
38- ThLCDOut->sendEvent_Clear();
39-}
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -18,9 +18,11 @@ public:
1818 ~MainWindow();
1919
2020 private slots:
21- void on_pushButton_Enter_clicked();
21+ void slot_dio_ready(int status);
2222
23+ void on_pushButton_Init_clicked();
2324 void on_pushButton_Clear_clicked();
25+ void on_pushButton_Enter_clicked();
2426
2527 private:
2628 Ui::MainWindow *ui;
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -6,8 +6,8 @@
66 <rect>
77 <x>0</x>
88 <y>0</y>
9- <width>354</width>
10- <height>151</height>
9+ <width>364</width>
10+ <height>182</height>
1111 </rect>
1212 </property>
1313 <property name="windowTitle">
@@ -31,6 +31,9 @@
3131 </property>
3232 </widget>
3333 <widget class="QPushButton" name="pushButton_Enter">
34+ <property name="enabled">
35+ <bool>false</bool>
36+ </property>
3437 <property name="geometry">
3538 <rect>
3639 <x>250</x>
@@ -57,9 +60,12 @@
5760 </property>
5861 </widget>
5962 <widget class="QPushButton" name="pushButton_Clear">
63+ <property name="enabled">
64+ <bool>false</bool>
65+ </property>
6066 <property name="geometry">
6167 <rect>
62- <x>70</x>
68+ <x>100</x>
6369 <y>60</y>
6470 <width>80</width>
6571 <height>25</height>
@@ -69,13 +75,29 @@
6975 <string>Clear</string>
7076 </property>
7177 </widget>
78+ <widget class="QPushButton" name="pushButton_Init">
79+ <property name="enabled">
80+ <bool>false</bool>
81+ </property>
82+ <property name="geometry">
83+ <rect>
84+ <x>20</x>
85+ <y>60</y>
86+ <width>80</width>
87+ <height>25</height>
88+ </rect>
89+ </property>
90+ <property name="text">
91+ <string>Init</string>
92+ </property>
93+ </widget>
7294 </widget>
7395 <widget class="QMenuBar" name="menuBar">
7496 <property name="geometry">
7597 <rect>
7698 <x>0</x>
7799 <y>0</y>
78- <width>354</width>
100+ <width>364</width>
79101 <height>26</height>
80102 </rect>
81103 </property>
--- a/thlcdoutput.cpp
+++ b/thlcdoutput.cpp
@@ -30,7 +30,7 @@ int ThLCDOutput::dio_init()
3030 #endif
3131
3232 #if DAQDRIVER_INSTALLED
33- return 0;
33+ return error;
3434 Error:
3535 if (DAQmxFailed (error)) {
3636 DAQmxBaseGetExtendedErrorInfo (errBuff, 2048);
@@ -44,6 +44,7 @@ Error:
4444 // printf ("DAQmxBase Error %ld: %s\n", error, errBuff);
4545 qDebug() << "DAQmxBase Error : " << errBuff;
4646 }
47+ ret = error;
4748 #endif
4849
4950 return ret;
@@ -261,8 +262,10 @@ void ThLCDOutput::run()
261262 EventData event;
262263 int event_id;
263264 char text[128];
265+ int err;
264266
265- dio_init();
267+ err = dio_init();
268+ emit notify_dio_ready(err);
266269
267270 lcd_init();
268271
@@ -273,6 +276,9 @@ void ThLCDOutput::run()
273276 event = EvtQue->dequeue();
274277 event_id = event.id;
275278 switch(event_id) {
279+ case Ev_Init:
280+ lcd_init();
281+ break;
276282 case Ev_Clear:
277283 lcd_clear();
278284 break;
@@ -292,15 +298,14 @@ void ThLCDOutput::run()
292298
293299 dio_final();
294300 }
295-
296-void ThLCDOutput::sendEvent_OutputText(QString text)
301+void ThLCDOutput::sendEvent_Init()
297302 {
298303 EventData evt;
299304
300- evt.id = Ev_OutputString;
301- evt.param = text;
305+ evt.id = Ev_Init;
302306 EvtQue->enqueue(evt);
303307 }
308+
304309 void ThLCDOutput::sendEvent_Clear()
305310 {
306311 EventData evt;
@@ -308,3 +313,12 @@ void ThLCDOutput::sendEvent_Clear()
308313 evt.id = Ev_Clear;
309314 EvtQue->enqueue(evt);
310315 }
316+
317+void ThLCDOutput::sendEvent_OutputText(QString text)
318+{
319+ EventData evt;
320+
321+ evt.id = Ev_OutputString;
322+ evt.param = text;
323+ EvtQue->enqueue(evt);
324+}
--- a/thlcdoutput.h
+++ b/thlcdoutput.h
@@ -23,11 +23,13 @@ public:
2323 ~ThLCDOutput();
2424 void stop();
2525
26- void sendEvent_OutputText(QString text);
26+ void sendEvent_Init();
2727 void sendEvent_Clear();
28+ void sendEvent_OutputText(QString text);
2829
2930 signals:
30-
31+ void notify_dio_ready(int status); // dio ready signal.
32+
3133 public slots:
3234
3335 protected:
@@ -39,6 +41,7 @@ private:
3941 // Event ID
4042 enum {
4143 Ev_Nop = 0,
44+ Ev_Init,
4245 Ev_Clear,
4346 Ev_OutputString
4447 };