リビジョン | 1972 (tree) |
---|---|
日時 | 2012-01-25 03:48:21 |
作者 | ![]() |
[stand2.0/StandConverter] Transcriber実装中.
@@ -19,8 +19,8 @@ | ||
19 | 19 | if(confirm) |
20 | 20 | { |
21 | 21 | int val = QMessageBox::warning(w, |
22 | - "Confirm", | |
23 | - dir.path() + "\ndoes not exist. Do you want to create the directory", | |
22 | + QObject::tr("Confirm"), | |
23 | + dir.path() + QObject::tr("\ndoes not exist. Do you want to create the directory"), | |
24 | 24 | QMessageBox::Yes, QMessageBox::No); |
25 | 25 | if(val == QMessageBox::No) |
26 | 26 | { |
@@ -30,7 +30,7 @@ | ||
30 | 30 | // ディレクトリを作成. |
31 | 31 | if(!dir.mkpath(dir.absolutePath())) |
32 | 32 | { |
33 | - QMessageBox::critical(w, "Error", dir.path() + "\nCould not mkdir."); | |
33 | + QMessageBox::critical(w, QObject::tr("Error"), dir.path() + QObject::tr("\nCould not mkdir.")); | |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | return true; |
@@ -244,7 +244,7 @@ | ||
244 | 244 | // 変換が失敗したと聞いて. |
245 | 245 | if(!f) |
246 | 246 | { |
247 | - _errorMessage("Error occured in converting."); | |
247 | + _errorMessage(QObject::tr("Error occured in converting.")); | |
248 | 248 | } |
249 | 249 | // 処理が終了したので変換器を殺しても大丈夫. |
250 | 250 | delete currentConverter; |
@@ -1,13 +1,33 @@ | ||
1 | 1 | #include "TranscribeWidget.h" |
2 | 2 | #include "ui_TranscribeWidget.h" |
3 | 3 | |
4 | +#include <QStringList> | |
5 | + | |
4 | 6 | using namespace stand::gui; |
5 | 7 | |
6 | -TranscribeWidget::TranscribeWidget(QWidget *parent) : | |
8 | +TranscribeWidget::TranscribeWidget(QWidget *parent, int index) : | |
7 | 9 | QWidget(parent), |
8 | 10 | ui(new Ui::TranscribeWidget) |
9 | 11 | { |
10 | 12 | ui->setupUi(this); |
13 | + | |
14 | + // Set ColorComboBox | |
15 | + QStringList colorNames; | |
16 | + colorNames << tr("red") << tr("green") << tr("blue") << tr("cyan") << tr("magenta") << tr("yellow") << tr("white"); | |
17 | + QPalette pallete = ui->ColorSelector->palette(); | |
18 | + pallete.setColor(QPalette::Highlight, Qt::transparent); | |
19 | + | |
20 | + int size = ui->ColorSelector->style()->pixelMetric(QStyle::PM_SmallIconSize); | |
21 | + QPixmap pixmap(size, size); | |
22 | + | |
23 | + for(unsigned int i = 0; i < colorNames.size(); i++) | |
24 | + { | |
25 | + QString name = colorNames.at(i); | |
26 | + ui->ColorSelector->addItem(name, QColor(i)); | |
27 | + pixmap.fill(QColor(name)); | |
28 | + ui->ColorSelector->setItemData(i, pixmap, Qt::DecorationRole); | |
29 | + } | |
30 | + ui->ColorSelector->setCurrentIndex(index % ui->ColorSelector->count()); | |
11 | 31 | } |
12 | 32 | |
13 | 33 | TranscribeWidget::~TranscribeWidget() |
@@ -17,7 +17,7 @@ | ||
17 | 17 | Q_OBJECT |
18 | 18 | |
19 | 19 | public: |
20 | - explicit TranscribeWidget(QWidget *parent = 0); | |
20 | + explicit TranscribeWidget(QWidget *parent = 0, int index = 0); | |
21 | 21 | ~TranscribeWidget(); |
22 | 22 | |
23 | 23 | QString dir(); |
@@ -10,13 +10,16 @@ | ||
10 | 10 | MappingView::MappingView(QWidget *parent) : |
11 | 11 | QWidget(parent) |
12 | 12 | { |
13 | -/* _map = new *QColor[_MAPPING_SIZE]; | |
14 | - _map[0] = new QColor[_MAPPING_SIZE * _MAPPING_SIZE]; | |
13 | + _map = new _color*[_MAPPING_SIZE]; | |
14 | + _map[0] = new _color[_MAPPING_SIZE * _MAPPING_SIZE]; | |
15 | 15 | for(int i = 1; i < _MAPPING_SIZE; i++) |
16 | 16 | { |
17 | - _map[1] = _map[0] + i * _MAPPING_SIZE; | |
18 | - }*/ | |
19 | - _map = NULL; | |
17 | + _map[i] = _map[0] + i * _MAPPING_SIZE; | |
18 | + } | |
19 | + for(int i = 0; i < _MAPPING_SIZE * _MAPPING_SIZE; i++) | |
20 | + { | |
21 | + _map[0][i].r = _map[0][i].b = _map[0][i].g = 0; | |
22 | + } | |
20 | 23 | } |
21 | 24 | |
22 | 25 | MappingView::~MappingView() |
@@ -45,7 +48,7 @@ | ||
45 | 48 | int y = j / (double)_MAPPING_SIZE * height(); |
46 | 49 | int h = (j + 1) / (double)_MAPPING_SIZE * height() - y; |
47 | 50 | |
48 | - p.fillRect(x, y, w, h, QColor(0, 0, 0)); | |
51 | + p.fillRect(x, y, w, h, QColor(_map[i][j].r, _map[i][j].g, _map[i][j].b)); | |
49 | 52 | p.setPen(QColor(192, 192, 192)); |
50 | 53 | p.drawLine(x, y, x, y + h); |
51 | 54 | p.drawLine(x, y, x + w, y); |
@@ -52,3 +55,16 @@ | ||
52 | 55 | } |
53 | 56 | } |
54 | 57 | } |
58 | + | |
59 | +void MappingView::setMapping(QVector<Map> &mapping) | |
60 | +{ | |
61 | + _data = mapping; | |
62 | + for(unsigned int i = 0; i < mapping.size(); i++) | |
63 | + { | |
64 | + int x = mapping.at(i).note; | |
65 | + int y = 127 - mapping.at(i).brightness; | |
66 | + _map[x][y].r = mapping.at(i).color.red(); | |
67 | + _map[x][y].g = mapping.at(i).color.green(); | |
68 | + _map[x][y].b = mapping.at(i).color.blue(); | |
69 | + } | |
70 | +} |
@@ -1,11 +1,23 @@ | ||
1 | 1 | #include "TranscriberWindow.h" |
2 | 2 | #include "ui_TranscriberWindow.h" |
3 | 3 | |
4 | +#include <QMessageBox> | |
5 | + | |
6 | +using namespace stand::gui; | |
7 | + | |
4 | 8 | TranscriberWindow::TranscriberWindow(QWidget *parent) : |
5 | 9 | QMainWindow(parent), |
6 | 10 | ui(new Ui::TranscriberWindow) |
7 | 11 | { |
8 | 12 | ui->setupUi(this); |
13 | + | |
14 | + while(ui->SettingTabs->count() != 0) | |
15 | + { | |
16 | + QWidget *p = ui->SettingTabs->widget(0); | |
17 | + ui->SettingTabs->removeTab(0); | |
18 | + delete p; | |
19 | + } | |
20 | + ui->SettingTabs->addTab(new TranscribeWidget(this), tr("Base")); | |
9 | 21 | } |
10 | 22 | |
11 | 23 | TranscriberWindow::~TranscriberWindow() |
@@ -12,3 +24,38 @@ | ||
12 | 24 | { |
13 | 25 | delete ui; |
14 | 26 | } |
27 | + | |
28 | +void TranscriberWindow::closeEvent(QCloseEvent *e) | |
29 | +{ | |
30 | + | |
31 | +} | |
32 | + | |
33 | +void TranscriberWindow::addTab() | |
34 | +{ | |
35 | + int index = ui->SettingTabs->count(); | |
36 | + QString num; | |
37 | + num.setNum(index); | |
38 | + | |
39 | + ui->SettingTabs->addTab(new TranscribeWidget(this, index), tr("Opt. ") + num); | |
40 | +} | |
41 | + | |
42 | +void TranscriberWindow::removeTab() | |
43 | +{ | |
44 | + int index = ui->SettingTabs->currentIndex(); | |
45 | + // Base tab cannot be removed. | |
46 | + if(index == 0) | |
47 | + { | |
48 | + QMessageBox::critical(this, tr("Error"), tr("You can not remove base tab."), QMessageBox::Ok); | |
49 | + return; | |
50 | + } | |
51 | + | |
52 | + // | |
53 | + int val = QMessageBox::warning(this, tr("Confirm"), tr("Do you really want to remove current tab.\nYou can not undo this action."), QMessageBox::Yes, QMessageBox::No); | |
54 | + if(val != QMessageBox::Yes) | |
55 | + { | |
56 | + return; | |
57 | + } | |
58 | + QWidget *p = ui->SettingTabs->widget(index); | |
59 | + ui->SettingTabs->removeTab(index); | |
60 | + delete p; | |
61 | +} |
@@ -14,19 +14,34 @@ | ||
14 | 14 | { |
15 | 15 | Q_OBJECT |
16 | 16 | public: |
17 | + struct Map | |
18 | + { | |
19 | + int note; | |
20 | + int brightness; | |
21 | + QColor color; | |
22 | + }; | |
23 | + | |
17 | 24 | explicit MappingView(QWidget *parent = 0); |
18 | 25 | ~MappingView(); |
19 | 26 | |
20 | 27 | void paintEvent(QPaintEvent *e); |
21 | 28 | |
29 | +public slots: | |
30 | + void setMapping(QVector<Map> &mapping); | |
31 | + | |
22 | 32 | signals: |
23 | 33 | |
24 | 34 | public slots: |
25 | 35 | |
26 | 36 | private: |
27 | - QColor **_map; | |
37 | + struct _color | |
38 | + { | |
39 | + int r, g, b; | |
40 | + }; | |
41 | + | |
42 | + _color **_map; | |
43 | + QVector<Map> _data; | |
28 | 44 | const static int _MAPPING_SIZE; |
29 | - | |
30 | 45 | }; |
31 | 46 | |
32 | 47 | } |
@@ -7,16 +7,28 @@ | ||
7 | 7 | class TranscriberWindow; |
8 | 8 | } |
9 | 9 | |
10 | +namespace stand | |
11 | +{ | |
12 | +namespace gui | |
13 | +{ | |
14 | + | |
10 | 15 | class TranscriberWindow : public QMainWindow |
11 | 16 | { |
12 | 17 | Q_OBJECT |
13 | - | |
18 | +public slots: | |
19 | + void addTab(); | |
20 | + void removeTab(); | |
14 | 21 | public: |
15 | 22 | explicit TranscriberWindow(QWidget *parent = 0); |
16 | 23 | ~TranscriberWindow(); |
17 | - | |
24 | + | |
25 | + void closeEvent(QCloseEvent *e); | |
26 | + | |
18 | 27 | private: |
19 | 28 | Ui::TranscriberWindow *ui; |
20 | 29 | }; |
21 | 30 | |
31 | +} | |
32 | +} | |
33 | + | |
22 | 34 | #endif // TRANSCRIBERWINDOW_H |
@@ -21,6 +21,6 @@ | ||
21 | 21 | // ConverterWindow w; |
22 | 22 | TranscriberWindow w; |
23 | 23 | w.show(); |
24 | - | |
24 | + | |
25 | 25 | return a.exec(); |
26 | 26 | } |
@@ -0,0 +1,21 @@ | ||
1 | +StandConverter : v.Connect-STAND用音源変換ツール@Qt | |
2 | + | |
3 | +v.Connect-STAND用音源コネクトライブラリを作成するツールです. | |
4 | +ConverterWindowから圧縮率などの指定をしたvvdファイルを作成し, | |
5 | +TranscriberWindowから時間伸縮に必要なパラメタを計算したのち, | |
6 | +vConnect.iniを作成します. | |
7 | + | |
8 | +Qt以外でコンパイルに必要なライブラリは以下の4つです. | |
9 | +・libfftw3 | |
10 | +・libogg | |
11 | +・libvorbis | |
12 | +・libvorbisfile | |
13 | + | |
14 | + | |
15 | +ToDo::TranscriberWindowの実装 | |
16 | +・GUI表示 | |
17 | +・マルチスレッド化 | |
18 | +・Transcriberの移植 | |
19 | +・出力への説明をどうするか検討 | |
20 | + | |
21 | +Done::ConverterWindow周りの実装 | |
\ No newline at end of file |