Skip to content

Commit 461471a

Browse files
committed
added log module for hold-sub mismatch repairing
1 parent 9c62d65 commit 461471a

File tree

9 files changed

+103
-62
lines changed

9 files changed

+103
-62
lines changed

Dynamix_chart_width_control/chart_store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void chart_store::clear() {
106106
int chart_store::readfile(string fn) {
107107
/** The function that reads a chart.
108108
* fn:filename
109-
* return:0:success;others:see defs.h;
109+
* return: 0:success; others:see defs.h;
110110
*/
111111

112112
//empty the maps that stores the previous chart

Dynamix_chart_width_control/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,21 @@ int main(int argc, char* argv[])
318318
}
319319
//Hold-sub mismatch autofix
320320
if (fail_read & HOLD_SUB_MISMATCH) {
321-
cout << "mismatched notes found:" << endl;
321+
cout << "mismatched notes found:\n\n" ;
322+
cout << "note_id\tside\ttime" << endl;
322323
for (auto& ii : cs.mismatched_notes) {
323-
cout << ii.first << '\t' << ii.second << endl;
324+
324325
//fix
325326
if (ii.second == "middle") {
327+
cout << ii.first << '\t' << ii.second << '\t' << cs.m_notes[ii.first].time << endl;
326328
cs.m_notes.erase(ii.first);
327329
}
328330
else if (ii.second == "left") {
331+
cout << ii.first << '\t' << ii.second << '\t' << cs.m_left[ii.first].time << endl;
329332
cs.m_left.erase(ii.first);
330333
}
331334
else if (ii.second == "right") {
335+
cout << ii.first << '\t' << ii.second << '\t' << cs.m_right[ii.first].time << endl;
332336
cs.m_right.erase(ii.first);
333337
}
334338
}
344 Bytes
Binary file not shown.

Dynamix_chart_width_control_GUI/DNX_widthGUI_en_en.ts

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -210,99 +210,97 @@
210210
<translation></translation>
211211
</message>
212212
<message>
213-
<location filename="maingui.cpp" line="75"/>
213+
<location filename="maingui.cpp" line="42"/>
214214
<source>Choose an XML chart file</source>
215215
<translation></translation>
216216
</message>
217217
<message>
218-
<location filename="maingui.cpp" line="44"/>
219-
<location filename="maingui.cpp" line="63"/>
218+
<location filename="maingui.cpp" line="41"/>
220219
<source>XML Chart files (*.xml);;All files (*.*)</source>
221220
<translation></translation>
222221
</message>
223222
<message>
224-
<location filename="maingui.cpp" line="111"/>
223+
<location filename="maingui.cpp" line="119"/>
225224
<source>Barpm fix</source>
226225
<translation></translation>
227226
</message>
228227
<message>
229-
<location filename="maingui.cpp" line="112"/>
228+
<location filename="maingui.cpp" line="120"/>
230229
<source>Illegal Barpm! Please enter a valid Barpm:</source>
231230
<translation></translation>
232231
</message>
233232
<message>
234-
<location filename="maingui.cpp" line="126"/>
235-
<location filename="maingui.cpp" line="145"/>
233+
<location filename="maingui.cpp" line="134"/>
234+
<location filename="maingui.cpp" line="153"/>
236235
<source>Left side fix</source>
237236
<oldsource>Left side Fix</oldsource>
238237
<translation></translation>
239238
</message>
240239
<message>
241-
<location filename="maingui.cpp" line="127"/>
240+
<location filename="maingui.cpp" line="135"/>
242241
<source>Left side type is not specified! Please enter a valid side type</source>
243242
<oldsource>Left side type is not specified!</oldsource>
244243
<translation></translation>
245244
</message>
246245
<message>
247-
<location filename="maingui.cpp" line="146"/>
248-
<location filename="maingui.cpp" line="179"/>
246+
<location filename="maingui.cpp" line="154"/>
247+
<location filename="maingui.cpp" line="187"/>
249248
<source>Invalid side type! Please enter again!</source>
250249
<translation></translation>
251250
</message>
252251
<message>
253-
<location filename="maingui.cpp" line="159"/>
254-
<location filename="maingui.cpp" line="178"/>
252+
<location filename="maingui.cpp" line="167"/>
253+
<location filename="maingui.cpp" line="186"/>
255254
<source>Right side fix</source>
256255
<oldsource>Right side Fix</oldsource>
257256
<translation></translation>
258257
</message>
259258
<message>
260-
<location filename="maingui.cpp" line="160"/>
259+
<location filename="maingui.cpp" line="168"/>
261260
<source>Right side type is not specified! Please enter a valid side type</source>
262261
<oldsource>Right side type is not specified! Please enter a valid side type.</oldsource>
263262
<translation></translation>
264263
</message>
265264
<message>
266-
<location filename="maingui.cpp" line="41"/>
267-
<location filename="maingui.cpp" line="60"/>
265+
<location filename="maingui.cpp" line="38"/>
268266
<source>Hint</source>
269-
<translation type="unfinished"></translation>
267+
<translation></translation>
270268
</message>
271269
<message>
272-
<location filename="maingui.cpp" line="42"/>
273-
<location filename="maingui.cpp" line="61"/>
274-
<source>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.</source>
275-
<translation type="unfinished"></translation>
270+
<location filename="maingui.cpp" line="39"/>
271+
<source>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.
272+
For more info, see %1 for details.</source>
273+
<oldsource>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.</oldsource>
274+
<translation></translation>
276275
</message>
277276
<message>
278-
<location filename="maingui.cpp" line="43"/>
279-
<location filename="maingui.cpp" line="62"/>
277+
<location filename="maingui.cpp" line="40"/>
280278
<source>Chart auto repair complete, press save button to save it or use the width changing options to make further changes.</source>
281-
<translation type="unfinished"></translation>
279+
<translation></translation>
282280
</message>
283281
<message>
284-
<location filename="maingui.cpp" line="363"/>
282+
<location filename="maingui.cpp" line="405"/>
285283
<source>Start time must be less than end time!</source>
286284
<oldsource>Start time must be lesser than end time!</oldsource>
287285
<translation></translation>
288286
</message>
289287
<message>
290-
<location filename="maingui.cpp" line="368"/>
288+
<location filename="maingui.cpp" line="410"/>
291289
<source>Hold-Sub mismatch!</source>
292290
<translation></translation>
293291
</message>
294292
<message>
295-
<location filename="maingui.cpp" line="372"/>
293+
<location filename="maingui.cpp" line="414"/>
296294
<source>Width change applied!</source>
297295
<translation></translation>
298296
</message>
299297
<message>
300-
<location filename="maingui.cpp" line="429"/>
298+
<location filename="maingui.cpp" line="471"/>
301299
<source>Save chart to</source>
302300
<translation></translation>
303301
</message>
304302
<message>
305-
<location filename="maingui.cpp" line="430"/>
303+
<location filename="maingui.cpp" line="472"/>
306304
<source>XML Chart files (*.xml)</source>
307305
<translation></translation>
308306
</message>
47 Bytes
Binary file not shown.

Dynamix_chart_width_control_GUI/DNX_widthGUI_zh_CN.ts

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -229,100 +229,99 @@
229229
<translation></translation>
230230
</message>
231231
<message>
232-
<location filename="maingui.cpp" line="75"/>
232+
<location filename="maingui.cpp" line="42"/>
233233
<source>Choose an XML chart file</source>
234234
<translation>选择XML谱面</translation>
235235
</message>
236236
<message>
237-
<location filename="maingui.cpp" line="44"/>
238-
<location filename="maingui.cpp" line="63"/>
237+
<location filename="maingui.cpp" line="41"/>
239238
<source>XML Chart files (*.xml);;All files (*.*)</source>
240239
<translation>XML 谱面文件 (*.xml);;所有文件 (*.*)</translation>
241240
</message>
242241
<message>
243-
<location filename="maingui.cpp" line="111"/>
242+
<location filename="maingui.cpp" line="119"/>
244243
<source>Barpm fix</source>
245244
<oldsource>Barpm Fix</oldsource>
246245
<translation>Barpm修复</translation>
247246
</message>
248247
<message>
249-
<location filename="maingui.cpp" line="112"/>
248+
<location filename="maingui.cpp" line="120"/>
250249
<source>Illegal Barpm! Please enter a valid Barpm:</source>
251250
<translation>无效的Barpm! 请输入合法的Barpm数值:</translation>
252251
</message>
253252
<message>
254-
<location filename="maingui.cpp" line="126"/>
255-
<location filename="maingui.cpp" line="145"/>
253+
<location filename="maingui.cpp" line="134"/>
254+
<location filename="maingui.cpp" line="153"/>
256255
<source>Left side fix</source>
257256
<oldsource>Left side Fix</oldsource>
258257
<translation>左侧面类型修复</translation>
259258
</message>
260259
<message>
261-
<location filename="maingui.cpp" line="127"/>
260+
<location filename="maingui.cpp" line="135"/>
262261
<source>Left side type is not specified! Please enter a valid side type</source>
263262
<oldsource>Left side type is not specified!</oldsource>
264263
<translation>未指定左侧面类型! 请输入合法的左侧面类型</translation>
265264
</message>
266265
<message>
267-
<location filename="maingui.cpp" line="146"/>
268-
<location filename="maingui.cpp" line="179"/>
266+
<location filename="maingui.cpp" line="154"/>
267+
<location filename="maingui.cpp" line="187"/>
269268
<source>Invalid side type! Please enter again!</source>
270269
<translation>侧面类型无效! 请重新输入!</translation>
271270
</message>
272271
<message>
273-
<location filename="maingui.cpp" line="159"/>
274-
<location filename="maingui.cpp" line="178"/>
272+
<location filename="maingui.cpp" line="167"/>
273+
<location filename="maingui.cpp" line="186"/>
275274
<source>Right side fix</source>
276275
<oldsource>Right side Fix</oldsource>
277276
<translation>右侧面类型修复</translation>
278277
</message>
279278
<message>
280-
<location filename="maingui.cpp" line="160"/>
279+
<location filename="maingui.cpp" line="168"/>
281280
<source>Right side type is not specified! Please enter a valid side type</source>
282281
<oldsource>Right side type is not specified! Please enter a valid side type.</oldsource>
283282
<translation>未指定右侧面类型! 请输入合法的右侧面类型</translation>
284283
</message>
285284
<message>
286-
<location filename="maingui.cpp" line="41"/>
287-
<location filename="maingui.cpp" line="60"/>
285+
<location filename="maingui.cpp" line="38"/>
288286
<source>Hint</source>
289287
<translation>提示</translation>
290288
</message>
291289
<message>
292-
<location filename="maingui.cpp" line="42"/>
293-
<location filename="maingui.cpp" line="61"/>
294-
<source>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.</source>
295-
<translation>谱面中Hold-Sub不对应问题已自动修复。</translation>
290+
<location filename="maingui.cpp" line="39"/>
291+
<source>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.
292+
For more info, see %1 for details.</source>
293+
<oldsource>This chart has Hold-Sub mismatch problems, and they have been automatically fixed.</oldsource>
294+
<translation>谱面中Hold-Sub不对应问题已自动修复
295+
详情见%1。</translation>
296296
</message>
297297
<message>
298-
<location filename="maingui.cpp" line="43"/>
299-
<location filename="maingui.cpp" line="62"/>
298+
<location filename="maingui.cpp" line="40"/>
300299
<source>Chart auto repair complete, press save button to save it or use the width changing options to make further changes.</source>
301300
<translation>谱面自动修复完成,您可以点击保存修改按钮将其保存,或者用键宽缩放选项作更多修改。</translation>
302301
</message>
303302
<message>
304-
<location filename="maingui.cpp" line="363"/>
303+
<location filename="maingui.cpp" line="405"/>
305304
<source>Start time must be less than end time!</source>
306305
<oldsource>Start time must be lesser than end time!</oldsource>
307306
<translation>开始时间必须小于结束时间!</translation>
308307
</message>
309308
<message>
310-
<location filename="maingui.cpp" line="368"/>
309+
<location filename="maingui.cpp" line="410"/>
311310
<source>Hold-Sub mismatch!</source>
312311
<translation></translation>
313312
</message>
314313
<message>
315-
<location filename="maingui.cpp" line="372"/>
314+
<location filename="maingui.cpp" line="414"/>
316315
<source>Width change applied!</source>
317316
<translation>键宽缩放已应用!</translation>
318317
</message>
319318
<message>
320-
<location filename="maingui.cpp" line="429"/>
319+
<location filename="maingui.cpp" line="471"/>
321320
<source>Save chart to</source>
322321
<translation>保存谱面到</translation>
323322
</message>
324323
<message>
325-
<location filename="maingui.cpp" line="430"/>
324+
<location filename="maingui.cpp" line="472"/>
326325
<source>XML Chart files (*.xml)</source>
327326
<translation>XML谱面文件 (*.xml)</translation>
328327
</message>

Dynamix_chart_width_control_GUI/chart_store.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void chart_store::clear() {
106106
int chart_store::readfile(string fn) {
107107
/** The function that reads a chart.
108108
* fn:filename
109-
* return:0:success;others:see defs.h;
109+
* return: 0:success; others:see defs.h;
110110
*/
111111

112112
//empty the maps that stores the previous chart

Dynamix_chart_width_control_GUI/maingui.cpp

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
#include<QInputDialog>
88
#include"../version.h"
99
#include"hintdlg.h"
10+
#include<sstream>
11+
#include<ctime>
1012
using std::exception;
13+
using std::ofstream;
14+
using std::ostringstream;
15+
using std::endl;
1116
extern QString customfont;
1217
MainGUI::MainGUI(QWidget* parent) :
1318
QMainWindow(parent),
@@ -28,9 +33,10 @@ MainGUI::MainGUI(QWidget* parent) :
2833
ui->label_7->setFont(QFont(customfont, 18, 300));
2934
}
3035

36+
//retranslate texts
3137
void MainGUI::retranslate_text() {
3238
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);
39+
trans_2 = qApp->translate("MainGUI", "This chart has Hold-Sub mismatch problems, and they have been automatically fixed.\nFor more info, see %1 for details.", nullptr);
3440
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);
3541
trans_ftype = qApp->translate("MainGUI", "XML Chart files (*.xml);;All files (*.*)", nullptr);
3642
trans_choose = tr("Choose an XML chart file");
@@ -188,23 +194,57 @@ void MainGUI::on_loadFile_clicked() {
188194
}
189195
//Hold-sub mismatch autofix
190196
if (success & HOLD_SUB_MISMATCH) {
197+
//generate log
198+
QDir d = QDir::currentPath();
199+
if (!d.exists("logs")) {
200+
d.mkdir("logs");
201+
d.refresh();
202+
}
203+
d.cd("logs");
204+
time_t timer = time(NULL);
205+
struct tm *tblock = localtime(&timer);
206+
ostringstream ostr;
207+
string tarpath_string = d.path().toStdString();
208+
ostr << tarpath_string<< "/" << "_" << tblock->tm_hour << "_" << tblock->tm_min << "_" << tblock->tm_sec << ".log";
209+
string fname = ostr.str();
210+
ofstream flog;
211+
bool log_avail = true;
212+
//create log
213+
flog.open(fname);
214+
if (flog.fail()) {
215+
log_avail = false;
216+
}
217+
if (log_avail) {
218+
flog << "mismatched notes found:\n\n";
219+
flog << "note_id\tside\ttime" << endl;
220+
}
191221
for (auto& ii : cs.mismatched_notes) {
192-
193222
//fix
194223
if (ii.second == "middle") {
224+
if (log_avail) {
225+
flog << ii.first << '\t' << ii.second << '\t' << cs.m_notes[ii.first].time << endl;
226+
}
195227
cs.m_notes.erase(ii.first);
196228
}
197229
else if (ii.second == "left") {
230+
if (log_avail) {
231+
flog << ii.first << '\t' << ii.second << '\t' << cs.m_left[ii.first].time << endl;
232+
}
198233
cs.m_left.erase(ii.first);
199234
}
200235
else if (ii.second == "right") {
236+
if (log_avail) {
237+
flog << ii.first << '\t' << ii.second << '\t' << cs.m_right[ii.first].time << endl;
238+
}
201239
cs.m_right.erase(ii.first);
202240
}
203241
}
242+
flog << "The note(s) above is(are) automatically deleted." << endl;
243+
flog.close();
204244
dlg=new HintDlg(
205245
HintDlg::Warning,
206246
trans_1,
207-
trans_2,
247+
trans_2.arg(QString::fromStdString(fname)),
208248
HintDlg::Ok,this);
209249
dlg->setAttribute(Qt::WA_DeleteOnClose); //关掉消息框后删除指针
210250

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
* The header that specifies the program version.
44
*
55
* */
6-
#define VERSION_H "v1.2.16"
6+
#define VERSION_H "v1.2.26"
77

88
#endif

0 commit comments

Comments
 (0)