source: Extract the strings from source codes
authorSooyoung Ha <yoosah.ha@samsung.com>
Fri, 24 Jul 2015 08:55:17 +0000 (17:55 +0900)
committerSangho Park <sangho.p@samsung.com>
Mon, 27 Jul 2015 08:32:17 +0000 (17:32 +0900)
I extract some strings which shown to users via UI and gather them to
header files. It helps to verify the strings conveniently.

Change-Id: I946e2bfe69d6e9a7b0db497e1ef903b2326cb8de
Signed-off-by: Sooyoung Ha <yoosah.ha@samsung.com>
accel.c
blockdev.c
tizen/src/display/qt5_supplement.cpp
tizen/src/ecs/ecs_msg_injector.c
tizen/src/skin/maruskin_client.h
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/uiinformation.cpp
tizen/src/ui/uistrings.h [new file with mode: 0644]
tizen/src/util/maru_err_table.c
tizen/src/util/maru_util_strings.h [new file with mode: 0644]

diff --git a/accel.c b/accel.c
index bef28e6a93b0cb88047a43a2deaf8d82011ae430..63e15f8e01a54c71d93cf244d3ac24c89c11fb88 100644 (file)
--- a/accel.c
+++ b/accel.c
@@ -127,7 +127,7 @@ int configure_accelerator(MachineState *ms)
             fprintf(stderr, "No accelerator found!\n");
         }
 #ifdef CONFIG_MARU
-        maru_register_exit_msg(MARU_EXIT_UNKNOWN, "No accelerator found.");
+        maru_register_exit_msg(MARU_EXIT_UNKNOWN, NO_ACCELERATOR_FOUND);
 #endif
         exit(1);
     }
index 5870b2571b98538b2af82a93a9cf0c07073ce6c3..db8c7acd65bb350bc69c4442c5f06f2eacf8036c 100644 (file)
@@ -558,7 +558,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
     if (ret < 0) {
 #ifdef CONFIG_MARU
         char *path = get_canonical_path(file);
-        char *msg = g_strdup_printf("Failed to load disk file from the following path. Check if the file is corrupted or missing.\n\n%s", path);
+        char *msg = g_strdup_printf("%s%s%s", FAILED_TO_LOAD_DISK, CHECK_FILE_VALID, path);
 
         start_simple_client(msg);
 
index d64f4ad4fe9e70bbda4dab901a06b13dda8f9098..cee73116b4245c487b1e936259f8698c4a786d34 100644 (file)
@@ -35,6 +35,7 @@
 #include "layout/hardwarekey.h"
 #include "xmllayoutparser.h"
 #include "uiutil.h"
+#include "uistrings.h"
 #include "displaybase.h"
 
 extern "C" {
@@ -458,9 +459,9 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt
 
         QString err;
         QMessageBox::critical(0, "Emulator",
-                              QString("An internal error occurred.\n: ") +
+                              QString(INTERNAL_ERROR_OCCURRED) +
                               err.sprintf("%s", (localMsg.trimmed()).constData()) +
-                              "\n\nEmulator will now exit.");
+                              EMULATOR_WILL_EXIT);
         abort();
     }
 }
@@ -468,12 +469,12 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt
 void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
 {
     if (file->exists() == false) {
-        qFatal("%s is not found", qPrintable(file->fileName()));
+        qFatal("%s %s", qPrintable(file->fileName()), IS_NOT_FOUND);
         return;
     }
 
     if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
-        qFatal("Couldn't open %s file", qPrintable(file->fileName()));
+        qFatal("%s %s %s", COULD_NOT_OPEN_1, qPrintable(file->fileName()), COULD_NOT_OPEN_2);
         return;
     }
 
@@ -493,7 +494,7 @@ void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
     file->close();
 
     if (hasError == true) {
-        qFatal("Invalid xml format");
+        qFatal(INVALID_XML_FORMAT);
         return;
     }
 }
@@ -506,7 +507,7 @@ void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
     }
 
     if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
-        qFatal("Couldn't open %s file", qPrintable(file->fileName()));
+        qFatal("%s %s %s", COULD_NOT_OPEN_1, qPrintable(file->fileName()), COULD_NOT_OPEN_2);
         return;
     }
 
@@ -526,7 +527,7 @@ void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
     file->close();
 
     if (hasError == true) {
-        qFatal("Invalid xml format");
+        qFatal(INVALID_XML_FORMAT);
         return;
     }
 }
index 62df95ed7a4a74f6011d3c3f23097ee815f336b3..dc5f94e07ea08a4ccb2dcdddbd314cbe355bcbeb 100644 (file)
@@ -515,9 +515,9 @@ static void show_error_popup(char* data)
     char* addon = strtok(data, token);
 
     memset(fail_msg, 0, sizeof(fail_msg));
-    strcpy(fail_msg, "Extra package installation is failed.\n");
+    strcpy(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_1);
     strcat(fail_msg, addon);
-    strcat(fail_msg, " must be installed MANUALLY!");
+    strcat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2);
 
     start_simple_client(fail_msg);
 }
index 34321467286c0b227bc1ab002f11cecdc1479022..496956c9bfcd68b32101c2d9090729ebc8d73a69 100644 (file)
@@ -31,6 +31,8 @@
 #ifndef MARUSKIN_CLIENT_H_
 #define MARUSKIN_CLIENT_H_
 
+#include "tizen/src/util/maru_util_strings.h"
+
 int start_skin_client(int argc, char* argv[]);
 int start_simple_client(char* msg);
 
index 43b2b82cf0ff22f8cd1fbd79f7310b205875da20..5c50772139c9b98106859f19d698209d15c990c5 100644 (file)
@@ -32,6 +32,7 @@
 #include "emulator_common.h"
 #include "mainwindow.h"
 #include "uiutil.h"
+#include "uistrings.h"
 #include "menu/advancedmenuitem.h"
 #include "menu/scalemenuitem.h"
 
@@ -555,7 +556,7 @@ void ContextMenu::slotShell()
 
     if (is_sdbd_initialized == 0) {
         showMsgBox(QMessageBox::Warning,
-            "SDB is not ready.\nPlease wait until the emulator is completely boot up.");
+            SDB_NOT_READY);
         return;
     }
 
@@ -564,7 +565,7 @@ void ContextMenu::slotShell()
     QFileInfo sdbFileInfo(sdbPath);
     if (sdbFileInfo.exists() == false) {
         showMsgBox(QMessageBox::Warning,
-            "SDB file does not exist in the following path.\n"
+            SDB_NOT_EXIST
             + sdbFileInfo.absoluteFilePath());
         return;
     }
@@ -664,7 +665,7 @@ void ContextMenu::slotControlPanel()
     QFileInfo ecpFileInfo(ecpPath);
     if (!ecpFileInfo.exists()) {
         showMsgBox(QMessageBox::Warning,
-            "Control Panel file does not exist in the following path.\n"
+            CONTROLPANEL_NOT_EXIST
             + ecpFileInfo.absoluteFilePath());
         return;
     }
@@ -681,7 +682,7 @@ void ContextMenu::slotControlPanel()
         if (menu_get_java_path(&path)) {
             command = QString::fromLocal8Bit(path);
         } else {
-            showMsgBox(QMessageBox::Warning, "Failed to get java path.");
+            showMsgBox(QMessageBox::Warning, FAILED_TO_GET_JAVA_PATH);
             free(path);
             return;
         }
@@ -719,7 +720,7 @@ void ContextMenu::slotControlPanel()
     try {
         QProcess::startDetached(command, arguments);
     } catch (QString &error) {
-        showMsgBox(QMessageBox::Warning, "Failed to open Control Panel : " + error);
+        showMsgBox(QMessageBox::Warning, FAILED_TO_OPEN_CONTROLPANEL + error);
         return;
     }
 }
@@ -774,8 +775,7 @@ void ContextMenu::slotForceClose()
     qDebug("force close");
 
     QMessageBox *msgBox = showMsgBox(QMessageBox::Question,
-        "If you force stop an emulator, it may cause some problems.\n"
-        "Are you sure you want to continue?",
+        FORCE_CLOSE_POPUP,
         QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Cancel);
 
     connect(msgBox, SIGNAL(buttonClicked(QAbstractButton *)),
index 8dd96c2ba56702d22cd2ae6a8096e1fc5eba59e7..895772cfa9948fb7e9f5ddb14f780cfc3406e53f 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include "uiinformation.h"
+#include "uistrings.h"
 
 UIInformation::UIInformation() :
     resolution(0, 0), basePort(0)
@@ -101,7 +102,7 @@ QSize UIInformation::getMainSize()
 {
     MainForm *mainForm = getMainForm();
     if (mainForm == NULL) {
-        qFatal("main form is null");
+        qFatal(MAIN_FORM_IS_NULL);
     }
 
     return mainForm->skinImg[MainForm::normal].size() * uiState.getScaleFactor();
diff --git a/tizen/src/ui/uistrings.h b/tizen/src/ui/uistrings.h
new file mode 100644 (file)
index 0000000..4dc2c43
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * The strings for the emulator ui messages
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sooyoung Ha <yoosah.ha@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+#ifndef UISTRINGS_H
+#define UISTRINGS_H
+
+#define SDB_NOT_READY "SDB is not ready.\nPlease wait until the emulator is completely boot up."
+#define SDB_NOT_EXIST "SDB file does not exist in the following path.\n"
+#define CONTROLPANEL_NOT_EXIST "Control Panel file does not exist in the following path.\n"
+#define FAILED_TO_GET_JAVA_PATH "Failed to get java path."
+#define FAILED_TO_OPEN_CONTROLPANEL "Failed to open Control Panel : "
+#define FORCE_CLOSE_POPUP "If you force stop an emulator, it may cause some problems.\n"\
+                          "Are you sure you want to continue?"
+
+/* qFatal msgs*/
+#define INTERNAL_ERROR_OCCURRED "An internal error occurred.\n: "
+#define EMULATOR_WILL_EXIT "\n\nEmulator will now exit."
+#define MAIN_FORM_IS_NULL "main form is null"
+#define IS_NOT_FOUND "is not found"
+#define COULD_NOT_OPEN_1 "Couldn't open"
+#define COULD_NOT_OPEN_2 "file"
+#define INVALID_XML_FORMAT "Invalid xml format"
+
+#endif /* UISTRINGS_H */
index ad7d03f68e9fda7f6c9b97af26fe1b8486ea30dc..18b80027f5c48c8df6d285975117932d1ef1f55f 100644 (file)
@@ -49,14 +49,11 @@ MULTI_DEBUG_CHANNEL(qemu, backtrace);
 /* This table must match the enum definition */
 static char _maru_string_table[][JAVA_MAX_COMMAND_LENGTH] = {
     /* 0 */ "",
-    /* 1 */ "Failed to allocate memory in qemu.",
-    /* 2 */ "Failed to load a kernel file the following path."
-            " Check if the file is corrupted or missing.\n\n",
-    /* 3 */ "Failed to load a bios file in bios path that mentioned on document."
-            " Check if the file is corrupted or missing.\n\n",
-    /* 4 */ "Skin process cannot be initialized. Skin server is not ready.",
-    /* 5 */ "Emulator has stopped working.\n"
-            "A problem caused the program to stop working correctly.",
+    /* 1 */ FAILED_TO_ALLOCATE_MEMORY,
+    /* 2 */ FAILED_TO_LOAD_KERNEL CHECK_FILE_VALID,
+    /* 3 */ FAILED_TO_LOAD_BIOS CHECK_FILE_VALID,
+    /* 4 */ FAILED_TO_INITIAL_SKIN,
+    /* 5 */ EMULATOR_HAS_STOPPED,
     /* add here.. */
     ""
 };
diff --git a/tizen/src/util/maru_util_strings.h b/tizen/src/util/maru_util_strings.h
new file mode 100644 (file)
index 0000000..4bae1c2
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * The strings for the emulator messages
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sooyoung Ha <yoosah.ha@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+#ifndef __MARU_UTIL_STRINGS_H__
+#define __MARU_UTIL_STRINGS_H__
+
+#define FAILED_TO_ALLOCATE_MEMORY "Failed to allocate memory in qemu."
+#define FAILED_TO_LOAD_KERNEL "Failed to load a kernel file the following path."
+#define FAILED_TO_LOAD_BIOS "Failed to load a bios file in bios path that mentioned on document."
+#define FAILED_TO_LOAD_DISK "Failed to load disk file from the following path."
+#define CHECK_FILE_VALID " Check if the file is corrupted or missing.\n\n"
+#define FAILED_TO_INITIAL_SKIN "Skin process cannot be initialized. Skin server is not ready."
+#define FAILED_TO_INSTALL_EXTRAPACKAGE_1 "Extra package installation is failed.\n"
+#define FAILED_TO_INSTALL_EXTRAPACKAGE_2 " must be installed MANUALLY!"
+#define EMULATOR_HAS_STOPPED "Emulator has stopped working.\nA problem caused the program to stop working correctly."
+#define NO_ACCELERATOR_FOUND "No accelerator found."
+
+#endif /* __MARU_UTIL_STRINGS_H__ */