Commit 221a2fb6460b43512a3102c76c4eed2154d5865b

Authored by 김태훈
1 parent eef4fca440
Exists in master and in 2 other branches fhd, fhd-demo

요리 이름에 다국어 지원

Showing 1 changed file with 20 additions and 1 deletions   Show diff stats
app/gui/oven_control/cookbook.cpp
@@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
3 #include <QApplication> 3 #include <QApplication>
4 #include <QErrorMessage> 4 #include <QErrorMessage>
5 5
  6 +#include "config.h"
  7 +
6 static QErrorMessage *errorDialog = NULL; 8 static QErrorMessage *errorDialog = NULL;
7 static void showError(QString errorMessage) 9 static void showError(QString errorMessage)
8 { 10 {
@@ -54,6 +56,23 @@ CookBook::CookBook(Define::CookType type) @@ -54,6 +56,23 @@ CookBook::CookBook(Define::CookType type)
54 return; 56 return;
55 } 57 }
56 58
  59 + int cookNameSection;
  60 + Define::language_type lang = (Define::language_type) Config::getConfigValue(Define::config_language).d32;
  61 + switch (lang)
  62 + {
  63 + case Define::language_kr:
  64 + cookNameSection = 1;
  65 + break;
  66 + case Define::language_en:
  67 + cookNameSection = 2;
  68 + break;
  69 + case Define::language_ch:
  70 + cookNameSection = 3;
  71 + break;
  72 + default:
  73 + cookNameSection = 1;
  74 + }
  75 +
57 int lineCount = 0; 76 int lineCount = 0;
58 while (!file.atEnd()) 77 while (!file.atEnd())
59 { 78 {
@@ -75,7 +94,7 @@ CookBook::CookBook(Define::CookType type) @@ -75,7 +94,7 @@ CookBook::CookBook(Define::CookType type)
75 continue; 94 continue;
76 } 95 }
77 96
78 - QString cookname = line.section(',', 1, 1).trimmed(); 97 + QString cookname = line.section(',', cookNameSection, cookNameSection).trimmed();
79 if (cookname.isEmpty()) 98 if (cookname.isEmpty())
80 { 99 {
81 showError(errorMessage.arg("Cook name is missed")); 100 showError(errorMessage.arg("Cook name is missed"));