diff options
author | GiWoong Kim <giwoong.kim@samsung.com> | 2015-09-08 19:19:11 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2015-09-09 16:34:54 +0900 |
commit | f5608fe9444bbd9cc679a683c6fcb96713e2469e (patch) | |
tree | daffb885cb708e8f724b5628c4db112e3be49e47 /tizen/src/ui/qt5_supplement.cpp | |
parent | 64ff9446027965696b32426e5921ee245ea89639 (diff) | |
download | qemu-f5608fe9444bbd9cc679a683c6fcb96713e2469e.tar.gz qemu-f5608fe9444bbd9cc679a683c6fcb96713e2469e.tar.bz2 qemu-f5608fe9444bbd9cc679a683c6fcb96713e2469e.zip |
xml: modified error message for skin loading failure
Change-Id: I944ba391081a056a26deb5798bacc808b7cc74eb
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
Diffstat (limited to 'tizen/src/ui/qt5_supplement.cpp')
-rw-r--r-- | tizen/src/ui/qt5_supplement.cpp | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp index c8b6610749..59a1e83bdf 100644 --- a/tizen/src/ui/qt5_supplement.cpp +++ b/tizen/src/ui/qt5_supplement.cpp @@ -47,7 +47,7 @@ bool is_display_off(void); //using namespace std; void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &); -void loadMainFormFromXML(QFile *, UIInformation *); +void loadMainFormFromXML(QString, UIInformation *); void loadConFormFromXML(QFile *, UIInformation *); bool qt5IsOnscreen; @@ -121,16 +121,13 @@ void qt5_gui_init(void) } qDebug() << "VM path:" << uiInfo->vmDataPath; - uiInfo->skinPath = QDir( - QString::fromLocal8Bit(get_emul_skin_path())).canonicalPath(); - if (uiInfo->skinPath.endsWith(QDir::separator()) == false) { - uiInfo->skinPath += QDir::separator(); - } + uiInfo->skinPath = QDir::toNativeSeparators( + QString::fromLocal8Bit(get_emul_skin_path())); qDebug() << "skin path:" << uiInfo->skinPath; /* read skin information */ - QSettings skinInfo(uiInfo->skinPath + LAYOUT_SKIN_INFO_FILE, - QSettings::IniFormat); + QSettings skinInfo(uiInfo->skinPath + QDir::separator() + + LAYOUT_SKIN_INFO_FILE, QSettings::IniFormat); QString skinName = skinInfo.value(SKIN_PROPERTY_NAME).toString(); if (skinName.isEmpty() == true) { skinName = GENERIC_TEXT_UNDEFINED; @@ -143,12 +140,12 @@ void qt5_gui_init(void) uiInfo->vmDataPath + GUI_PROPERTIES_FILE, QSettings::IniFormat); /* XML layout */ - QFile mainXMLFile(uiInfo->skinPath + LAYOUT_FORM_FILE_NAME); /* load main form */ - loadMainFormFromXML(&mainXMLFile, uiInfo); + loadMainFormFromXML(uiInfo->skinPath + QDir::separator() + + LAYOUT_FORM_FILE_NAME, uiInfo); - QDir skinDir(uiInfo->skinPath + LAYOUT_CON_FORM_SUBPATH); /* load controller forms */ + QDir skinDir(uiInfo->skinPath + QDir::separator() + LAYOUT_CON_FORM_SUBPATH); QFileInfoList entries = skinDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); if (entries.isEmpty() == false) { @@ -464,68 +461,66 @@ void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QSt } } -void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */) +void loadMainFormFromXML(QString xmlPath, UIInformation *uiInfo/* out */) { - if (file->exists() == false) { - qFatal("%s %s", qPrintable(file->fileName()), MSG_NOT_FOUND); - return; - } + QFile file(xmlPath); - if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) { - qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2); + if (file.exists() == false || + file.open(QIODevice::ReadOnly | QIODevice::Text) == false) { + qFatal("Failed to load the emulator skin. %s%s", MSG_CHECK_PATH, + qPrintable(xmlPath)); return; } - qDebug("main form is loaded from %s", qPrintable(file->fileName())); + qDebug("main form is loaded from %s", qPrintable(file.fileName())); /* read xml */ - QFileInfo fileInfo(*file); - QXmlStreamReader xml(file); + QXmlStreamReader xml(&file); /* parse xml */ + QFileInfo fileInfo(xmlPath); XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo); QString version = parser.parseEmulatorUI(xml); - qDebug() << "layout version :" << version; + qDebug() << "layout version:" << version; const bool hasError = xml.hasError(); xml.clear(); - file->close(); + file.close(); if (hasError == true) { - qFatal(MSG_INVALID_XML_FORMAT); + qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH, + qPrintable(xmlPath)); return; } } void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */) { - if (file->exists() == false) { - qWarning("%s is not found", qPrintable(file->fileName())); - return; - } - - if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) { - qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2); + if (file->exists() == false || + file->open(QIODevice::ReadOnly | QIODevice::Text) == false) { + qWarning() << "Failed to load the controller skin:" << + file->fileName(); return; } qDebug("controller form is loaded from %s", qPrintable(file->fileName())); /* read xml */ - QFileInfo fileInfo(*file); QXmlStreamReader xml(file); /* parse xml */ + QFileInfo fileInfo(*file); XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo); QString version = parser.parseControllerUI(xml); - qDebug() << "layout version :" << version; + qDebug() << "layout version:" << version; const bool hasError = xml.hasError(); xml.clear(); file->close(); - if (hasError == true) { - qFatal(MSG_INVALID_XML_FORMAT); + if (hasError == false) { + qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH, + qPrintable(fileInfo.absoluteFilePath())); return; } } |