Skip to content

Commit 9c62d65

Browse files
committed
Fixed some translations
1 parent 0910d2c commit 9c62d65

File tree

8 files changed

+260
-37
lines changed

8 files changed

+260
-37
lines changed

Dynamix_chart_width_control_GUI/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ set(PROJECT_SOURCES
6161
resources.rc
6262
defs.h
6363
qdefs.h
64+
hintdlg.cpp
65+
hintdlg.h
6466
)
6567

6668
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)

Dynamix_chart_width_control_GUI/DNX_widthGUI_en_en.ts

Lines changed: 67 additions & 17 deletions
Large diffs are not rendered by default.
437 Bytes
Binary file not shown.

Dynamix_chart_width_control_GUI/DNX_widthGUI_zh_CN.ts

Lines changed: 112 additions & 17 deletions
Large diffs are not rendered by default.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "hintdlg.h"
2+
3+
4+
HintDlg::HintDlg(Icon icon, const QString& title, const QString& text,
5+
StandardButtons buttons, QWidget* parent) :
6+
QMessageBox(icon, title, text, buttons,parent) {
7+
}
8+
9+
HintDlg::~HintDlg() {
10+
11+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef HINTDLG_H
2+
#define HINTDLG_H
3+
4+
#include <QMessageBox>
5+
#include <QObject>
6+
#include <QWidget>
7+
8+
class HintDlg : public QMessageBox
9+
{
10+
Q_OBJECT
11+
public:
12+
HintDlg(Icon icon, const QString& title, const QString& text,
13+
StandardButtons buttons, QWidget* parent = 0);
14+
~HintDlg();
15+
16+
};
17+
18+
#endif // HINTDLG_H

Dynamix_chart_width_control_GUI/maingui.cpp

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include<QMessageBox>
77
#include<QInputDialog>
88
#include"../version.h"
9+
#include"hintdlg.h"
910
using std::exception;
1011
extern QString customfont;
1112
MainGUI::MainGUI(QWidget* parent) :
@@ -27,6 +28,14 @@ MainGUI::MainGUI(QWidget* parent) :
2728
ui->label_7->setFont(QFont(customfont, 18, 300));
2829
}
2930

31+
void MainGUI::retranslate_text() {
32+
trans_1 = qApp->translate("MainGUI", "Hint", nullptr);
33+
trans_2 = qApp->translate("MainGUI", "This chart has Hold-Sub mismatch problems, and they have been automatically fixed.", nullptr);
34+
trans_3 = qApp->translate("MainGUI", "Chart auto repair complete, press save button to save it or use the width changing options to make further changes.", nullptr);
35+
trans_ftype = qApp->translate("MainGUI", "XML Chart files (*.xml);;All files (*.*)", nullptr);
36+
trans_choose = tr("Choose an XML chart file");
37+
}
38+
3039
//translate to Chinese
3140
void MainGUI::translate_cn() {
3241
QTranslator cn_trans;
@@ -36,6 +45,9 @@ void MainGUI::translate_cn() {
3645
QMessageBox::critical(this, "Error", "Translation not found");
3746
}
3847
ui->retranslateUi(this);
48+
//save translation text
49+
retranslate_text();
50+
//qDebug() << qApp->translate("MainGUI", "Chart auto repair complete, press save button to save it or use the width changing options to make further changes.", nullptr) << "cccc";
3951
ui->loaded_file->setText(tmptext);
4052
ui->version->setText(QString(VERSION_H));
4153
}
@@ -49,6 +61,8 @@ void MainGUI::translate_en() {
4961
QMessageBox::critical(this, "Error", "Translation not found");
5062
}
5163
ui->retranslateUi(this);
64+
//save translation text
65+
retranslate_text();
5266
ui->loaded_file->setText(tmptext);
5367
ui->version->setText(QString(VERSION_H));
5468
}
@@ -60,14 +74,15 @@ void MainGUI::on_exitButton_clicked() {
6074
//The browse button
6175
void MainGUI::on_browse_clicked() {
6276
QString filename = QFileDialog::getOpenFileName(this,
63-
tr("Choose an XML chart file"),
64-
QDir::currentPath(), tr("XML Chart files (*.xml);;All files (*.*)"));
77+
trans_choose,
78+
QDir::currentPath(), trans_ftype);
6579
ui->open_file_name->setText(filename);
6680
}
6781

6882
//The load file button
6983
void MainGUI::on_loadFile_clicked() {
7084
ui->listWidget->clear();
85+
//qDebug() << qApp->translate("MainGUI", "Chart auto repair complete, press save button to save it or use the width changing options to make further changes.", nullptr) << "cccc";
7186
if (ui->open_file_name->text() == "") {
7287
ui->loaded_file->setText("");
7388
//no file loaded or load error, lock all objects
@@ -85,6 +100,10 @@ void MainGUI::on_loadFile_clicked() {
85100
try {
86101
int success = cs.readfile(qstr2str_utf8(ui->open_file_name->text()));
87102
//fixing stage
103+
bool fix_stage=false;
104+
if(success!=0){
105+
fix_stage=true;
106+
}
88107
//missing barpm
89108
if (success & BARPM_MISSING) {
90109
double new_barpm = 0;
@@ -182,10 +201,29 @@ void MainGUI::on_loadFile_clicked() {
182201
cs.m_right.erase(ii.first);
183202
}
184203
}
185-
QMessageBox::warning(this, "Hint", "This chart has Hold-Sub mismatch problems, and they have been automatically fixed.");
204+
dlg=new HintDlg(
205+
HintDlg::Warning,
206+
trans_1,
207+
trans_2,
208+
HintDlg::Ok,this);
209+
dlg->setAttribute(Qt::WA_DeleteOnClose); //关掉消息框后删除指针
210+
211+
dlg->exec();
212+
//QMessageBox::warning(this, "Hint", "This chart has Hold-Sub mismatch problems, and they have been automatically fixed.");
186213
//set status to success
187214
success &= (~(int)HOLD_SUB_MISMATCH);
188215
}
216+
if(fix_stage){
217+
dlg=new HintDlg(HintDlg::Warning,
218+
trans_1,
219+
trans_3,
220+
HintDlg::Ok,this);
221+
222+
223+
dlg->setAttribute(Qt::WA_DeleteOnClose); //关掉消息框后删除指针
224+
//qDebug() << qApp->translate("MainGUI", "Chart auto repair complete, press save button to save it or use the width changing options to make further changes.", nullptr) <<"cccc";
225+
dlg->exec();
226+
}
189227
if (success != 0) {
190228
throw std::logic_error("Unknown error");
191229
}

Dynamix_chart_width_control_GUI/maingui.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <QMainWindow>
55
#include"chart_store.h"
66
#include<qtranslator.h>
7+
#include"hintdlg.h"
78
#include"qdefs.h"
89
namespace Ui {
910
class MainGUI;
@@ -43,6 +44,14 @@ private slots:
4344
private:
4445
chart_store cs;
4546
Ui::MainGUI* ui;
47+
HintDlg* dlg;
48+
void retranslate_text();
49+
//translation strings;
50+
QString trans_1;//"Hint"
51+
QString trans_2;//"This chart has Hold-Sub mismatch problems, and they have been automatically fixed."
52+
QString trans_3;//"Chart auto repair complete, press save button to save it or use the width changing options to make further changes."
53+
QString trans_ftype;//"XML Chart files (*.xml);;All files (*.*)"
54+
QString trans_choose;//"Choose an XML chart file"
4655
};
4756

4857
#endif // MAINGUI_H

0 commit comments

Comments
 (0)