百人一首かるた自動読み上げソフト
Révision | 45b29a9648190cea28a7fde757a372ddf02ce039 (tree) |
---|---|
l'heure | 2011-12-26 19:40:33 |
Auteur | arakaki <alucky4416@user...> |
Commiter | arakaki |
ADD: TestPlay on OptDialog.
@@ -303,7 +303,7 @@ void MainWindow::on_actionOption_triggered() | ||
303 | 303 | { |
304 | 304 | if (flag_playseqstate) return; // disable when Playing |
305 | 305 | |
306 | - OptionDialog *dlg = new OptionDialog(this, SelectVoice, EnableOptMusic); | |
306 | + OptionDialog *dlg = new OptionDialog(this, SelectVoice, EnableOptMusic, PlaySeqTh); | |
307 | 307 | |
308 | 308 | // dlg->Set_Opt_voice_select(SelectVoice); |
309 | 309 |
@@ -1,6 +1,8 @@ | ||
1 | 1 | #include "optiondialog.h" |
2 | 2 | #include "ui_optiondialog.h" |
3 | 3 | |
4 | +#include <QDebug> | |
5 | + | |
4 | 6 | //void OptionDialog::Set_Opt_voice_select(int select) |
5 | 7 | //{ |
6 | 8 | // opt_voice_select = select; |
@@ -11,11 +13,24 @@ int OptionDialog::Get_Opt_voice_select() | ||
11 | 13 | return opt_voice_select; |
12 | 14 | } |
13 | 15 | |
14 | -OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) : | |
16 | +void OptionDialog::TimeoutDone() | |
17 | +{ | |
18 | + if (PlaySeqTh) { | |
19 | + if (PlaySeqTh->GetPlayStatus() == 0) { | |
20 | + ui->Btn_TestPlay->setEnabled(true); | |
21 | + interval_timer->stop(); // TimerStop | |
22 | +// qDebug() << "TestPlay Ended."; | |
23 | + } | |
24 | + } | |
25 | +} | |
26 | + | |
27 | +OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic, PlaySequenceThread *pTh) : | |
15 | 28 | QDialog(parent), |
16 | 29 | ui(new Ui::OptionDialog) |
17 | 30 | { |
18 | 31 | ui->setupUi(this); |
32 | + interval_timer = new QTimer(this); | |
33 | + connect(interval_timer, SIGNAL(timeout()), this, SLOT(TimeoutDone())); | |
19 | 34 | |
20 | 35 | if (enableOptMusic) { |
21 | 36 | ui->radioButton_2->setEnabled(true); |
@@ -23,6 +38,14 @@ OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) : | ||
23 | 38 | ui->radioButton_2->setEnabled(false); |
24 | 39 | } |
25 | 40 | |
41 | + if (pTh) { | |
42 | + PlaySeqTh = pTh; | |
43 | + ui->Btn_TestPlay->setEnabled(true); | |
44 | + } else { | |
45 | + PlaySeqTh = NULL; | |
46 | + ui->Btn_TestPlay->setEnabled(false); | |
47 | + } | |
48 | + | |
26 | 49 | opt_voice_select = select; |
27 | 50 | if (opt_voice_select == 0) { |
28 | 51 | ui->radioButton_1->setChecked(true); |
@@ -35,6 +58,13 @@ OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) : | ||
35 | 58 | |
36 | 59 | OptionDialog::~OptionDialog() |
37 | 60 | { |
61 | + if (PlaySeqTh) { | |
62 | + PlaySeqTh->Abort(); | |
63 | + } | |
64 | + | |
65 | + interval_timer->stop(); | |
66 | + delete interval_timer; | |
67 | + | |
38 | 68 | delete ui; |
39 | 69 | } |
40 | 70 |
@@ -54,6 +84,26 @@ void OptionDialog::on_buttonBox_rejected() | ||
54 | 84 | |
55 | 85 | void OptionDialog::on_Btn_TestPlay_clicked() |
56 | 86 | { |
57 | - // select Voice Test Playing | |
58 | - ; | |
87 | + // Test Playing | |
88 | + QList<int> *PlayFudaList; | |
89 | + PlayFudaList = new QList<int>; | |
90 | + PlayFudaList->clear(); | |
91 | + PlayFudaList->insert(0, 0); // fudaN=0 insert to top | |
92 | + | |
93 | + int select = 0; | |
94 | + if (ui->radioButton_1->isChecked()) { | |
95 | + select = 0; | |
96 | + } else { | |
97 | + select = 1; | |
98 | + } | |
99 | + // Set Play Setting | |
100 | + PlaySeqTh->SetPlaySetting(select, 1, 1); | |
101 | + | |
102 | + // Set Play list | |
103 | + PlaySeqTh->SetPlayNumList(PlayFudaList); | |
104 | + | |
105 | + ui->Btn_TestPlay->setEnabled(false); | |
106 | + interval_timer->setInterval(1000); | |
107 | + interval_timer->start(); // TimerStart | |
108 | + PlaySeqTh->Start(); | |
59 | 109 | } |
@@ -2,6 +2,9 @@ | ||
2 | 2 | #define OPTIONDIALOG_H |
3 | 3 | |
4 | 4 | #include <QDialog> |
5 | +#include <QTimer> | |
6 | + | |
7 | +#include "PlaySequenceThread.h" | |
5 | 8 | |
6 | 9 | namespace Ui { |
7 | 10 | class OptionDialog; |
@@ -12,7 +15,7 @@ class OptionDialog : public QDialog | ||
12 | 15 | Q_OBJECT |
13 | 16 | |
14 | 17 | public: |
15 | - explicit OptionDialog(QWidget *parent = 0, int select = 0, bool enableOptMusic = false); | |
18 | + explicit OptionDialog(QWidget *parent = 0, int select = 0, bool enableOptMusic = false, PlaySequenceThread *PlaySeqTh = 0); | |
16 | 19 | ~OptionDialog(); |
17 | 20 | |
18 | 21 | // void Set_Opt_voice_select(int select); |
@@ -24,9 +27,14 @@ private slots: | ||
24 | 27 | |
25 | 28 | void on_Btn_TestPlay_clicked(); |
26 | 29 | |
30 | + void TimeoutDone(); | |
31 | + | |
27 | 32 | private: |
28 | 33 | Ui::OptionDialog *ui; |
29 | 34 | |
35 | + QTimer *interval_timer; | |
36 | + PlaySequenceThread *PlaySeqTh; // PlaySeqThread for TestPlay | |
37 | + | |
30 | 38 | int opt_voice_select; // select Music Files Group, 0 or 1 |
31 | 39 | }; |
32 | 40 |