From: Sooyoung Ha Date: Fri, 24 Jul 2015 08:55:17 +0000 (+0900) Subject: source: Extract the strings from source codes X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~286^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c21655b34ea087dcb944488c542b73bbf1bb567;p=sdk%2Femulator%2Fqemu.git source: Extract the strings from source codes 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 --- diff --git a/accel.c b/accel.c index bef28e6a93..63e15f8e01 100644 --- 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); } diff --git a/blockdev.c b/blockdev.c index 5870b2571b..db8c7acd65 100644 --- a/blockdev.c +++ b/blockdev.c @@ -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); diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index d64f4ad4fe..cee73116b4 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -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; } } diff --git a/tizen/src/ecs/ecs_msg_injector.c b/tizen/src/ecs/ecs_msg_injector.c index 62df95ed7a..dc5f94e07e 100644 --- a/tizen/src/ecs/ecs_msg_injector.c +++ b/tizen/src/ecs/ecs_msg_injector.c @@ -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); } diff --git a/tizen/src/skin/maruskin_client.h b/tizen/src/skin/maruskin_client.h index 3432146728..496956c9bf 100644 --- a/tizen/src/skin/maruskin_client.h +++ b/tizen/src/skin/maruskin_client.h @@ -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); diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 43b2b82cf0..5c50772139 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -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 *)), diff --git a/tizen/src/ui/uiinformation.cpp b/tizen/src/ui/uiinformation.cpp index 8dd96c2ba5..895772cfa9 100644 --- a/tizen/src/ui/uiinformation.cpp +++ b/tizen/src/ui/uiinformation.cpp @@ -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 index 0000000000..4dc2c43cfb --- /dev/null +++ b/tizen/src/ui/uistrings.h @@ -0,0 +1,53 @@ +/* + * The strings for the emulator ui messages + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Sooyoung Ha + * GiWoong Kim + * SeokYeon Hwang + * Sangho Park + * + * 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 */ diff --git a/tizen/src/util/maru_err_table.c b/tizen/src/util/maru_err_table.c index ad7d03f68e..18b80027f5 100644 --- a/tizen/src/util/maru_err_table.c +++ b/tizen/src/util/maru_err_table.c @@ -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 index 0000000000..4bae1c221e --- /dev/null +++ b/tizen/src/util/maru_util_strings.h @@ -0,0 +1,47 @@ +/* + * The strings for the emulator messages + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Sooyoung Ha + * GiWoong Kim + * SeokYeon Hwang + * Sangho Park + * + * 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__ */