• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

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

百人一首かるた自動読み上げソフト


Commit MetaInfo

Révision45b29a9648190cea28a7fde757a372ddf02ce039 (tree)
l'heure2011-12-26 19:40:33
Auteurarakaki <alucky4416@user...>
Commiterarakaki

Message de Log

ADD: TestPlay on OptDialog.

Change Summary

Modification

--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -303,7 +303,7 @@ void MainWindow::on_actionOption_triggered()
303303 {
304304 if (flag_playseqstate) return; // disable when Playing
305305
306- OptionDialog *dlg = new OptionDialog(this, SelectVoice, EnableOptMusic);
306+ OptionDialog *dlg = new OptionDialog(this, SelectVoice, EnableOptMusic, PlaySeqTh);
307307
308308 // dlg->Set_Opt_voice_select(SelectVoice);
309309
--- a/optiondialog.cpp
+++ b/optiondialog.cpp
@@ -1,6 +1,8 @@
11 #include "optiondialog.h"
22 #include "ui_optiondialog.h"
33
4+#include <QDebug>
5+
46 //void OptionDialog::Set_Opt_voice_select(int select)
57 //{
68 // opt_voice_select = select;
@@ -11,11 +13,24 @@ int OptionDialog::Get_Opt_voice_select()
1113 return opt_voice_select;
1214 }
1315
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) :
1528 QDialog(parent),
1629 ui(new Ui::OptionDialog)
1730 {
1831 ui->setupUi(this);
32+ interval_timer = new QTimer(this);
33+ connect(interval_timer, SIGNAL(timeout()), this, SLOT(TimeoutDone()));
1934
2035 if (enableOptMusic) {
2136 ui->radioButton_2->setEnabled(true);
@@ -23,6 +38,14 @@ OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) :
2338 ui->radioButton_2->setEnabled(false);
2439 }
2540
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+
2649 opt_voice_select = select;
2750 if (opt_voice_select == 0) {
2851 ui->radioButton_1->setChecked(true);
@@ -35,6 +58,13 @@ OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) :
3558
3659 OptionDialog::~OptionDialog()
3760 {
61+ if (PlaySeqTh) {
62+ PlaySeqTh->Abort();
63+ }
64+
65+ interval_timer->stop();
66+ delete interval_timer;
67+
3868 delete ui;
3969 }
4070
@@ -54,6 +84,26 @@ void OptionDialog::on_buttonBox_rejected()
5484
5585 void OptionDialog::on_Btn_TestPlay_clicked()
5686 {
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();
59109 }
--- a/optiondialog.h
+++ b/optiondialog.h
@@ -2,6 +2,9 @@
22 #define OPTIONDIALOG_H
33
44 #include <QDialog>
5+#include <QTimer>
6+
7+#include "PlaySequenceThread.h"
58
69 namespace Ui {
710 class OptionDialog;
@@ -12,7 +15,7 @@ class OptionDialog : public QDialog
1215 Q_OBJECT
1316
1417 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);
1619 ~OptionDialog();
1720
1821 // void Set_Opt_voice_select(int select);
@@ -24,9 +27,14 @@ private slots:
2427
2528 void on_Btn_TestPlay_clicked();
2629
30+ void TimeoutDone();
31+
2732 private:
2833 Ui::OptionDialog *ui;
2934
35+ QTimer *interval_timer;
36+ PlaySequenceThread *PlaySeqTh; // PlaySeqThread for TestPlay
37+
3038 int opt_voice_select; // select Music Files Group, 0 or 1
3139 };
3240