• 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

Revisão12f3ed27131e15a73619f9d527f91cb6806fda0a (tree)
Hora2011-12-26 16:52:02
Autorarakaki <alucky4416@user...>
Commiterarakaki

Mensagem de Log

ADD: Add OptionDialog(SelectMusicFiles), Change .pro(replace abs path to 5040PWD)

Mudança Sumário

Diff

--- a/PlaySequenceThread.cpp
+++ b/PlaySequenceThread.cpp
@@ -10,10 +10,16 @@ PlaySequenceThread::PlaySequenceThread(WId winId)
1010 {
1111 // Init my task
1212 stopped = false;
13-// fnamefmt = "inaba_%03d_%1d.ogg";
14-// fnamefmt = "yamajun_%03d_%1d.ogg";
15- fnamefmt = "yamajun_%03d_%1d.ogg";
16- MusicFileDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + tr("Music");
13+
14+ // const setting
15+ SelectVoice = 0;
16+ MusicFolderName1 = tr("Music");
17+ MusicFolderName2 = tr("Music2");
18+ fnamefmt1 = "yamajun_%03d_%1d.ogg";
19+ fnamefmt2 = "inaba_%03d_%1d.ogg";
20+
21+ fnamefmt = fnamefmt1; // set default
22+ MusicFileDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + MusicFolderName1; // set default
1723 Wait1_sec = 1;
1824 Wait2_sec = 3;
1925 PlayNumList = NULL;
@@ -95,10 +101,11 @@ void PlaySequenceThread::SetMusicDir(const QString &dirpath)
95101 MusicFileDirPath = dirpath;
96102 }
97103
98-void PlaySequenceThread::SetPlaySetting(int Wait1Time_sec, int Wait2Time_sec)
104+void PlaySequenceThread::SetPlaySetting(int slctvoice, int Wait1Time_sec, int Wait2Time_sec)
99105 {
100106 if (state != IDLE) return;
101107
108+ SelectVoice = slctvoice;
102109 Wait1_sec = Wait1Time_sec;
103110 Wait2_sec = Wait2Time_sec;
104111 }
@@ -138,6 +145,17 @@ QString PlaySequenceThread::GetMusicFilePath(int FudaN, int KamiShimo)
138145 {
139146 QString filepath;
140147 QString dmy;
148+// MusicFolderName1 = tr("Music");
149+// MusicFolderName2 = tr("Music2");
150+// fnamefmt1 = "yamajun_%03d_%1d.ogg";
151+// fnamefmt2 = "yamajun_%03d_%1d.ogg";
152+ if (0 == SelectVoice) {
153+ fnamefmt = fnamefmt1;
154+ MusicFileDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + MusicFolderName1;
155+ } else {
156+ fnamefmt = fnamefmt2;
157+ MusicFileDirPath = QCoreApplication::applicationDirPath() + QDir::separator() + MusicFolderName2;
158+ }
141159 filepath = MusicFileDirPath + QDir::separator() + dmy.sprintf(fnamefmt.toLocal8Bit(), FudaN, KamiShimo);
142160 return filepath;
143161 }
--- a/PlaySequenceThread.h
+++ b/PlaySequenceThread.h
@@ -20,7 +20,7 @@ public:
2020
2121 void SetPlayNumList(QList<int> *);
2222 void SetMusicDir(const QString &dirpath);
23- void SetPlaySetting(int Wait1Time_sec, int Wait2Time_sec);
23+ void SetPlaySetting(int slctvoice, int Wait1Time_sec, int Wait2Time_sec);
2424 int GetPlayStatus();
2525 int GetPlayFudaNum();
2626 void Start();
@@ -67,9 +67,13 @@ private:
6767
6868 QQueue<int> *EvtQue; // EventQue
6969
70+ int SelectVoice; // SelectVoice, 0 or 1
71+ QString MusicFolderName1; // "Music"
72+ QString MusicFolderName2; // "Music2"
73+ QString fnamefmt1; // filename format, "yamajun_%03d_%1d.ogg"
74+ QString fnamefmt2; // filename format, "inaba_%03d_%1d.ogg"
7075 QString MusicFileDirPath;
71- // QString fnamefmt = "yamajun_%03d_%1d.ogg";
72- QString fnamefmt; // filename format, "yamajun_%03d_%1d.ogg"
76+ QString fnamefmt; // filename format
7377 int ListIndex;
7478 int PlayListCount;
7579 QList<int> *PlayNumList;
--- a/QtKarutaEishow.pro
+++ b/QtKarutaEishow.pro
@@ -14,20 +14,25 @@ SOURCES += main.cpp \
1414 mainwindow.cpp \
1515 PlayMusicThread.cpp \
1616 PlaySequenceThread.cpp \
17- fudaselectdlg.cpp
17+ fudaselectdlg.cpp \
18+ optiondialog.cpp
1819
1920 HEADERS += mainwindow.h \
2021 PlayMusicThread.h \
2122 PlaySequenceThread.h \
2223 fudaselectdlg.h \
23- textrsc.h
24+ textrsc.h \
25+ optiondialog.h
2426
2527 FORMS += mainwindow.ui \
26- fudaselectdlg.ui
28+ fudaselectdlg.ui \
29+ optiondialog.ui
2730
28-win32:INCLUDEPATH += d:/SugarSync/QtWork/QtKarutaEishow/libbass/
31+#win32:INCLUDEPATH += d:/SugarSync/QtWork/QtKarutaEishow/libbass/
32+win32:INCLUDEPATH += $$PWD/libbass/
2933
30-win32:LIBS += d:/SugarSync/QtWork/QtKarutaEishow/libbass/libbass.dll.a
34+#win32:LIBS += d:/SugarSync/QtWork/QtKarutaEishow/libbass/libbass.dll.a
35+win32:LIBS += $$PWD/libbass/libbass.dll.a
3136 unix:LIBS += -lbass
3237
3338 RESOURCES += \
--- a/fudaselectdlg.ui
+++ b/fudaselectdlg.ui
@@ -2,6 +2,9 @@
22 <ui version="4.0">
33 <class>FudaSelectDlg</class>
44 <widget class="QDialog" name="FudaSelectDlg">
5+ <property name="windowModality">
6+ <enum>Qt::ApplicationModal</enum>
7+ </property>
58 <property name="geometry">
69 <rect>
710 <x>0</x>
@@ -11,7 +14,7 @@
1114 </rect>
1215 </property>
1316 <property name="windowTitle">
14- <string>札選択</string>
17+ <string>Fuda</string>
1518 </property>
1619 <widget class="QDialogButtonBox" name="buttonBox">
1720 <property name="geometry">
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -4,6 +4,7 @@
44 #include "mainwindow.h"
55 #include "ui_mainwindow.h"
66 #include "fudaselectdlg.h"
7+#include "optiondialog.h"
78
89 #include "textrsc.h" // kamiku text resource
910
@@ -40,7 +41,7 @@ MainWindow::MainWindow(QWidget *parent) :
4041 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); // source codec is UTF-8
4142
4243 QCoreApplication::setApplicationName("QtKarutaEishow");
43- QCoreApplication::setApplicationVersion("1.0 beta7");
44+ QCoreApplication::setApplicationVersion("1.0 beta8");
4445 this->setWindowTitle(QCoreApplication::applicationName());
4546 IniFilePath = QCoreApplication::applicationDirPath() + QDir::separator() + QCoreApplication::applicationName() + ".ini";
4647
@@ -54,21 +55,32 @@ MainWindow::MainWindow(QWidget *parent) :
5455
5556 // Load Setting
5657 LoadSaveSetting(IniFilePath, false);
57-
58- // Initialize PlayFudaList
59- PlayFudaList = new QList<int>();
60- PlayFudaList->clear();
61-
62- flag_playseqstate = false;
63- flag_pause = false;
64-
6558 // Play setting
59+ EnableOptMusic = true;
60+ if(SelectVoice != 0) {
61+ // Check MusicFiles, != 0 is Optional Musicfiles is "Music2", "inaba_%03d_%d.ogg"
62+ QString CheckFilepath = QCoreApplication::applicationDirPath() + QDir::separator() + tr("Music2") + QDir::separator() + tr("inaba_000_2.ogg");
63+ QFileInfo CheckFile(CheckFilepath);
64+// if (QDir::exists(CheckFilepath)) {
65+ if (CheckFile.exists()) {
66+ ;
67+ } else { // file Not Exist
68+ EnableOptMusic = false;
69+ SelectVoice = 0;
70+ }
71+ }
6672 // chk_joka = true;
6773 // Wait1Time = 10;
6874 // Wait2Time = 3;
6975 ui->checkBox->setChecked(chk_joka);
7076 ui->spinBox_1->setValue(Wait1Time);
7177 ui->spinBox_2->setValue(Wait2Time);
78+
79+ // Initialize PlayFudaList
80+ PlayFudaList = new QList<int>();
81+ PlayFudaList->clear();
82+ flag_playseqstate = false;
83+ flag_pause = false;
7284 PlayCounter = 0;
7385 PlayListCount = 0;
7486 // statusBar
@@ -170,7 +182,7 @@ void MainWindow::on_Btn_Start_clicked()
170182 PlayFudaList->insert(0, 0); // fudaN=0 insert to top
171183 }
172184 // Set Play Setting
173- PlaySeqTh->SetPlaySetting(Wait1Time, Wait2Time);
185+ PlaySeqTh->SetPlaySetting(SelectVoice, Wait1Time, Wait2Time);
174186 // Set Play Music Folder
175187 ;
176188 // Set Play list
@@ -241,7 +253,7 @@ void MainWindow::Music2Starteded(int fudaNum)
241253 // SLOT
242254 void MainWindow::Music2Ended()
243255 {
244- ui->statusBar->clearMessage();
256+// ui->statusBar->clearMessage();
245257
246258 // qDebug() << "Music2Ended";
247259 }
@@ -286,6 +298,29 @@ void MainWindow::on_actionFuda_triggered()
286298 on_Btn_FudaSelect_clicked();
287299 }
288300
301+
302+void MainWindow::on_actionOption_triggered()
303+{
304+ if (flag_playseqstate) return; // disable when Playing
305+
306+ OptionDialog *dlg = new OptionDialog(this, SelectVoice, EnableOptMusic);
307+
308+// dlg->Set_Opt_voice_select(SelectVoice);
309+
310+ int i = dlg->exec();
311+ if (i == QDialog::Accepted) {
312+ // qDebug() << "Ok";
313+ SelectVoice = dlg->Get_Opt_voice_select();
314+ qDebug() << QString("Select %1").arg(SelectVoice);
315+ } else if (i == QDialog::Rejected) {
316+// qDebug() << "Cancel";
317+ } else {
318+// qDebug() << "Unkown";
319+ }
320+
321+ delete dlg;
322+}
323+
289324 QString FudaList_ToCSVString(QList<int> *list)
290325 {
291326 QString csvstr;
@@ -310,13 +345,15 @@ void MainWindow::LoadSaveSetting(QString filepath, bool store = false)
310345 settings.setValue("SETTING/chk_joka", chk_joka);
311346 settings.setValue("SETTING/Wait1Time", Wait1Time);
312347 settings.setValue("SETTING/Wait2Time", Wait2Time);
348+ settings.setValue("SETTING/SelectVoice", SelectVoice);
313349 settings.setValue("SETTING/FudaList", FudaListStr);
314350
315351 } else {
316352 // Load
317- chk_joka = settings.value("SETTING/chk_joka", true).toBool();
318- Wait1Time = settings.value("SETTING/Wait1Time", 10).toInt();
319- Wait2Time = settings.value("SETTING/Wait2Time", 3).toInt();
353+ chk_joka = settings.value("SETTING/chk_joka", true).toBool();
354+ Wait1Time = settings.value("SETTING/Wait1Time", 10).toInt();
355+ Wait2Time = settings.value("SETTING/Wait2Time", 3).toInt();
356+ SelectVoice = settings.value("SETTING/SelectVoice", 0).toInt();
320357
321358 QString FudaListStr(settings.value("SETTING/FudaList", QString("")).toString());
322359 // qDebug() << "FudaListStr is " << FudaListStr;
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -45,6 +45,8 @@ private slots:
4545 void Music2Ended();
4646 void SequenceEnded(int status); // status 0 is success, !0 is Fail
4747
48+ void on_actionOption_triggered();
49+
4850 private:
4951 Ui::MainWindow *ui;
5052
@@ -61,6 +63,8 @@ private:
6163 bool chk_joka; // joka yomiage
6264 int Wait1Time; // Interval kami-shimo
6365 int Wait2Time; // Interval next
66+ int SelectVoice; // select MusicFiles 0 = "Music" or 1 = "Music2"
67+ bool EnableOptMusic; // OptDialog, Enable Select Music2
6468
6569 int PlayCounter;
6670 int PlayListCount;
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -344,6 +344,7 @@
344344 <property name="title">
345345 <string>Edit</string>
346346 </property>
347+ <addaction name="actionOption"/>
347348 <addaction name="actionFuda"/>
348349 </widget>
349350 <addaction name="menuFile"/>
@@ -382,6 +383,11 @@
382383 <string>Fuda</string>
383384 </property>
384385 </action>
386+ <action name="actionOption">
387+ <property name="text">
388+ <string>Option</string>
389+ </property>
390+ </action>
385391 </widget>
386392 <layoutdefault spacing="6" margin="11"/>
387393 <resources>
--- /dev/null
+++ b/optiondialog.cpp
@@ -0,0 +1,59 @@
1+#include "optiondialog.h"
2+#include "ui_optiondialog.h"
3+
4+//void OptionDialog::Set_Opt_voice_select(int select)
5+//{
6+// opt_voice_select = select;
7+//}
8+
9+int OptionDialog::Get_Opt_voice_select()
10+{
11+ return opt_voice_select;
12+}
13+
14+OptionDialog::OptionDialog(QWidget *parent, int select, bool enableOptMusic) :
15+ QDialog(parent),
16+ ui(new Ui::OptionDialog)
17+{
18+ ui->setupUi(this);
19+
20+ if (enableOptMusic) {
21+ ui->radioButton_2->setEnabled(true);
22+ } else {
23+ ui->radioButton_2->setEnabled(false);
24+ }
25+
26+ opt_voice_select = select;
27+ if (opt_voice_select == 0) {
28+ ui->radioButton_1->setChecked(true);
29+ ui->radioButton_2->setChecked(false);
30+ } else {
31+ ui->radioButton_1->setChecked(false);
32+ ui->radioButton_2->setChecked(true);
33+ }
34+}
35+
36+OptionDialog::~OptionDialog()
37+{
38+ delete ui;
39+}
40+
41+void OptionDialog::on_buttonBox_accepted()
42+{
43+ if (ui->radioButton_1->isChecked()) {
44+ opt_voice_select = 0;
45+ } else {
46+ opt_voice_select = 1;
47+ }
48+}
49+
50+void OptionDialog::on_buttonBox_rejected()
51+{
52+ ;
53+}
54+
55+void OptionDialog::on_Btn_TestPlay_clicked()
56+{
57+ // select Voice Test Playing
58+ ;
59+}
--- /dev/null
+++ b/optiondialog.h
@@ -0,0 +1,33 @@
1+#ifndef OPTIONDIALOG_H
2+#define OPTIONDIALOG_H
3+
4+#include <QDialog>
5+
6+namespace Ui {
7+ class OptionDialog;
8+}
9+
10+class OptionDialog : public QDialog
11+{
12+ Q_OBJECT
13+
14+public:
15+ explicit OptionDialog(QWidget *parent = 0, int select = 0, bool enableOptMusic = false);
16+ ~OptionDialog();
17+
18+// void Set_Opt_voice_select(int select);
19+ int Get_Opt_voice_select();
20+
21+private slots:
22+ void on_buttonBox_accepted();
23+ void on_buttonBox_rejected();
24+
25+ void on_Btn_TestPlay_clicked();
26+
27+private:
28+ Ui::OptionDialog *ui;
29+
30+ int opt_voice_select; // select Music Files Group, 0 or 1
31+};
32+
33+#endif // OPTIONDIALOG_H
--- /dev/null
+++ b/optiondialog.ui
@@ -0,0 +1,151 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<ui version="4.0">
3+ <class>OptionDialog</class>
4+ <widget class="QDialog" name="OptionDialog">
5+ <property name="windowModality">
6+ <enum>Qt::ApplicationModal</enum>
7+ </property>
8+ <property name="geometry">
9+ <rect>
10+ <x>0</x>
11+ <y>0</y>
12+ <width>353</width>
13+ <height>178</height>
14+ </rect>
15+ </property>
16+ <property name="minimumSize">
17+ <size>
18+ <width>353</width>
19+ <height>178</height>
20+ </size>
21+ </property>
22+ <property name="maximumSize">
23+ <size>
24+ <width>353</width>
25+ <height>178</height>
26+ </size>
27+ </property>
28+ <property name="windowTitle">
29+ <string>Option</string>
30+ </property>
31+ <widget class="QDialogButtonBox" name="buttonBox">
32+ <property name="geometry">
33+ <rect>
34+ <x>160</x>
35+ <y>130</y>
36+ <width>161</width>
37+ <height>32</height>
38+ </rect>
39+ </property>
40+ <property name="orientation">
41+ <enum>Qt::Horizontal</enum>
42+ </property>
43+ <property name="standardButtons">
44+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
45+ </property>
46+ </widget>
47+ <widget class="QRadioButton" name="radioButton_1">
48+ <property name="geometry">
49+ <rect>
50+ <x>60</x>
51+ <y>60</y>
52+ <width>111</width>
53+ <height>20</height>
54+ </rect>
55+ </property>
56+ <property name="text">
57+ <string>音声1 (女性)</string>
58+ </property>
59+ <attribute name="buttonGroup">
60+ <string>buttonGroup_voice</string>
61+ </attribute>
62+ </widget>
63+ <widget class="QRadioButton" name="radioButton_2">
64+ <property name="geometry">
65+ <rect>
66+ <x>60</x>
67+ <y>90</y>
68+ <width>111</width>
69+ <height>16</height>
70+ </rect>
71+ </property>
72+ <property name="text">
73+ <string>音声2 (男性)</string>
74+ </property>
75+ <attribute name="buttonGroup">
76+ <string>buttonGroup_voice</string>
77+ </attribute>
78+ </widget>
79+ <widget class="QLabel" name="label">
80+ <property name="geometry">
81+ <rect>
82+ <x>40</x>
83+ <y>20</y>
84+ <width>111</width>
85+ <height>16</height>
86+ </rect>
87+ </property>
88+ <property name="text">
89+ <string>詠唱する音声の選択</string>
90+ </property>
91+ </widget>
92+ <widget class="QPushButton" name="Btn_TestPlay">
93+ <property name="enabled">
94+ <bool>false</bool>
95+ </property>
96+ <property name="geometry">
97+ <rect>
98+ <x>180</x>
99+ <y>70</y>
100+ <width>75</width>
101+ <height>23</height>
102+ </rect>
103+ </property>
104+ <property name="text">
105+ <string>Test</string>
106+ </property>
107+ </widget>
108+ </widget>
109+ <resources/>
110+ <connections>
111+ <connection>
112+ <sender>buttonBox</sender>
113+ <signal>accepted()</signal>
114+ <receiver>OptionDialog</receiver>
115+ <slot>accept()</slot>
116+ <hints>
117+ <hint type="sourcelabel">
118+ <x>248</x>
119+ <y>254</y>
120+ </hint>
121+ <hint type="destinationlabel">
122+ <x>157</x>
123+ <y>274</y>
124+ </hint>
125+ </hints>
126+ </connection>
127+ <connection>
128+ <sender>buttonBox</sender>
129+ <signal>rejected()</signal>
130+ <receiver>OptionDialog</receiver>
131+ <slot>reject()</slot>
132+ <hints>
133+ <hint type="sourcelabel">
134+ <x>316</x>
135+ <y>260</y>
136+ </hint>
137+ <hint type="destinationlabel">
138+ <x>286</x>
139+ <y>274</y>
140+ </hint>
141+ </hints>
142+ </connection>
143+ </connections>
144+ <buttongroups>
145+ <buttongroup name="buttonGroup_voice">
146+ <property name="exclusive">
147+ <bool>true</bool>
148+ </property>
149+ </buttongroup>
150+ </buttongroups>
151+</ui>