From 38e3af01c5f19a66c6378b3085bbe2d2a72d1b3f Mon Sep 17 00:00:00 2001 From: GiWoong Kim Date: Tue, 29 Jul 2014 15:34:50 +0900 Subject: [PATCH] ui: modify log format temporary add time information to logging delete unused files and lines Change-Id: I498faff95ce6d68a4337927725a0e0a14e4c4f02 Signed-off-by: GiWoong Kim --- tizen/src/display/qt5_supplement.cpp | 62 +++--- tizen/src/display/qt5_supplement.h | 6 - tizen/src/ui/main.cpp | 192 ------------------ tizen/src/ui/skinkeyitem.cpp | 2 +- tizen/src/ui/skinview.cpp | 4 +- tizen/src/ui/widgets_app.pro | 56 ------ tizen/src/ui/widgets_app.pro.user | 289 --------------------------- 7 files changed, 31 insertions(+), 580 deletions(-) delete mode 100644 tizen/src/ui/main.cpp delete mode 100644 tizen/src/ui/widgets_app.pro delete mode 100644 tizen/src/ui/widgets_app.pro.user diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp index 7c154165ce..87a1507823 100644 --- a/tizen/src/display/qt5_supplement.cpp +++ b/tizen/src/display/qt5_supplement.cpp @@ -43,6 +43,7 @@ #include "ui/xml/layouttype.h" //using namespace std; +void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &); void loadSkinLayoutFromXML(QFile *, UIInformation *); void loadControllerLayoutFromXML(QFile *, UIInformation *); @@ -50,22 +51,7 @@ static QApplication *app; QT5Console::QT5Console() { - label = new QLabel(); - label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - label->setAlignment(Qt::AlignCenter); - label->setFixedSize(720 / 2, 1280 / 2); - layout = new QVBoxLayout(); - layout->addWidget(label); - layout->setContentsMargins( 0, 0, 0, 0); - setLayout(layout); - - setWindowTitle(tr("Emulator with Qt5")); -} - -QLabel *QT5Console::getLabel() -{ - return label; } static int argc = 0; @@ -77,6 +63,7 @@ static UIInformation *uiInfo; void qt5_skin_init(void) { Q_INIT_RESOURCE(resource); + qInstallMessageHandler(qMessageOutput); // QApplication app(argc, argv); @@ -93,9 +80,9 @@ void qt5_skin_init(void) #if 0 /* wearable */ - uiInfo.resolution.setWidth(320); - uiInfo.resolution.setHeight(320); - uiInfo.skinPath = "/skins/wearable-320x320-1btn/"; + uiInfo->resolution.setWidth(320); + uiInfo->resolution.setHeight(320); + uiInfo->skinPath = "/skins/wearable-320x320-1btn/"; #elif 1 /* mobile */ uiInfo->resolution.setWidth(720); @@ -104,6 +91,7 @@ void qt5_skin_init(void) uiInfo->uiState.layoutScale = 50; #endif + /* XML */ // TODO: convert QML to XML @@ -124,10 +112,6 @@ void qt5_skin_init(void) // mainwindow->move(100, 100); // TODO: MRU mainwindow->show(); -// MainWindow window(&uiInfo); -// window.move(100, 100); // TODO: MRU -// window.show(); - // app.exec(); } @@ -140,16 +124,9 @@ void qt5_prepare(void) // console->show(); } -int qt5_get_win_id(void) -{ - return mainwindow->winId(); -// return console->winId(); -} - void qt5_update_internal(void *data, int width, int height) { QPixmap pixmap = QPixmap(); -// QLabel *label = console->getLabel(); QLabel *label = mainwindow->getLabel(); QImage image = QImage((uchar *)data, width, height, QImage::Format_ARGB32); @@ -168,12 +145,29 @@ void qt5_refresh_internal(void) app->processEvents(); } -void qt5_mouse_warp(void) -{ -} - -void sdl_mouse_define(void) +void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { + QByteArray localMsg = msg.toLocal8Bit(); + QByteArray dateMsg = QDateTime::currentDateTime().toString("hh:mm:ss").toLocal8Bit(); + + switch (type) { + case QtDebugMsg: + fprintf(stdout, "%s [Debug:%s:%u] %s\n", dateMsg.constData(), + context.category, context.line, localMsg.constData()); + break; + case QtWarningMsg: + fprintf(stdout, "%s [Warning:%s:%u] %s\n", dateMsg.constData(), + context.category, context.line, localMsg.constData()); + break; + case QtCriticalMsg: + fprintf(stderr, "%s [Critical:%s:%u] %s\n", dateMsg.constData(), + context.category, context.line, localMsg.constData()); + break; + case QtFatalMsg: + fprintf(stderr, "%s [Fatal:%s:%u] %s\n", dateMsg.constData(), + context.category, context.line, localMsg.constData()); + abort(); + } } void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) diff --git a/tizen/src/display/qt5_supplement.h b/tizen/src/display/qt5_supplement.h index cd6e152f8b..c83410b047 100644 --- a/tizen/src/display/qt5_supplement.h +++ b/tizen/src/display/qt5_supplement.h @@ -38,13 +38,10 @@ class QT5Console : public QWidget public: QT5Console(); - QLabel *getLabel(); protected: private: - QLabel *label; - QLayout *layout; }; #endif @@ -52,13 +49,10 @@ private: extern "C" { #endif void qt5_prepare(void); -int qt5_get_win_id(void); void qt5_update_internal(void *data, int width, int height); void qt5_switch_internal(void); void qt5_refresh_internal(void); -void qt5_mouse_warp_internal(void); -void sdl_mouse_define_internal(void); #ifdef __cplusplus } #endif diff --git a/tizen/src/ui/main.cpp b/tizen/src/ui/main.cpp deleted file mode 100644 index 7cfa5a8b8d..0000000000 --- a/tizen/src/ui/main.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "mainwindow.h" -#include "uiinformation.h" -#include "hardwarekey.h" -#include "xml/hardwarekeytype.h" -#include "xml/keylisttype.h" -#include "xml/layouttype.h" - - -void loadSkinLayoutFromXML(QFile *, UIInformation *); -void loadControllerLayoutFromXML(QFile *, UIInformation *); - -int main(int argc, char *argv[]) -{ - Q_INIT_RESOURCE(resource); - - QApplication app(argc, argv); - - UIInformation uiInfo; - - /* parameter parsing */ - // TODO: - QString vmName = "test"; - int basePort = 26100; - - uiInfo.vmName = vmName; - uiInfo.basePort = basePort; - -#if 0 - /* wearable */ - uiInfo.resolution.setWidth(320); - uiInfo.resolution.setHeight(320); - uiInfo.skinPath = "/skins/wearable-320x320-1btn/"; -#elif 1 - /* mobile */ - uiInfo.resolution.setWidth(720); - uiInfo.resolution.setHeight(1280); - uiInfo.skinPath = "/skins/mobile-720x1280-3btn/"; - - uiInfo.uiState.layoutScale = 50; -#endif - - /* XML */ - // TODO: convert QML to XML - - // Register custom QML element - qmlRegisterType("EmulatorComponent", 1, 0, "Region"); - qmlRegisterType("EmulatorComponent", 1, 0, "Key"); - qmlRegisterType("EmulatorComponent", 1, 0, "KeyList"); - - QFile skinXMLFile(":" + uiInfo.skinPath + "layout.qml"); - loadSkinLayoutFromXML(&skinXMLFile, &uiInfo); - - QFile conXMLFile(":" + uiInfo.skinPath + "controller-layout/Basic/layout.qml"); - loadControllerLayoutFromXML(&conXMLFile, &uiInfo); - - /* GUI */ - qDebug("start!"); - MainWindow window(&uiInfo); - window.move(100, 100); // TODO: MRU - window.show(); - - return app.exec(); -} - -void loadSkinLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) -{ - if (file->exists() == false) { - qDebug("skin xml file is null"); - return; - } - - qDebug("load skin layout from %s", file->fileName().toLocal8Bit().data()); - - qmlRegisterType("EmulatorComponent", 1, 0, "Layout"); - - /* QML */ - QQmlEngine *engine = new QQmlEngine(); - QQmlComponent *component = new QQmlComponent(engine); - - QUrl qmlSource("qrc" + file->fileName()); - // Other possible QML files that are used engine->addImportPath("qrc:/other"); - component->loadUrl(qmlSource); - if (!component->isReady()) { - qWarning("%s", qPrintable(component->errorString())); - //return -1; - } - QObject *object = component->create(); - - if (object != NULL) { - QFileInfo fileInfo(*file); - qDebug() << "xml version :" << QQmlProperty::read(object, "version").toString(); - - LayoutType *layoutType = NULL; - KeyListType *keyListType = NULL; - HardwareKeyType *hwKeyType = NULL; - - QObjectList layoutTypeList = object->children(); - for (int index = 0; index < layoutTypeList.count(); index++) { - SkinLayout *layout = new SkinLayout(); /* dst */ - - layoutType = (LayoutType *)layoutTypeList.at(index); /* src */ - - layout->displayRegion = layoutType->displayRegion(); - layout->skinImg[SkinLayout::normal].load( - fileInfo.absolutePath() + "/" + layoutType->mainImageName()); - layout->skinImg[SkinLayout::pressed].load( - fileInfo.absolutePath() + "/" + layoutType->pressedImageName()); - - keyListType = layoutType->keyListType(); - if (keyListType != NULL) { - for (int i = 0; i < keyListType->list.count(); i++) { - hwKeyType = keyListType->list.at(i); - if (hwKeyType != NULL) { - layout->keyList.append( - new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), - hwKeyType->region(), hwKeyType->tooltip())); - } - } - } - - uiInfo->layoutList.append(layout); - } - - delete object; - } - - delete component; - delete engine; -} - -void loadControllerLayoutFromXML(QFile *file, UIInformation *uiInfo/* out */) -{ - if (file->exists() == false) { - qDebug("con xml file is null"); - return; - } - - qDebug("load con layout from %s", file->fileName().toLocal8Bit().data()); - - /* QML */ - QQmlEngine *engine = new QQmlEngine(); - QQmlComponent *component = new QQmlComponent(engine); - - QUrl qmlSource("qrc" + file->fileName()); - component->loadUrl(qmlSource); - if (!component->isReady()) { - qWarning("%s", qPrintable(component->errorString())); - } - QObject *object = component->create(); - - if (object != NULL) { - QFileInfo fileInfo(*file); - qDebug() << "xml version :" << QQmlProperty::read(object, "version").toString(); - - LayoutType *layoutType = (LayoutType *)object; - KeyListType *keyListType = NULL; - HardwareKeyType *hwKeyType = NULL; - - ControllerLayout *layout = new ControllerLayout(); - layout->conImg[ControllerLayout::normal].load( - fileInfo.absolutePath() + "/" + layoutType->mainImageName()); - layout->conImg[ControllerLayout::pressed].load( - fileInfo.absolutePath() + "/" + layoutType->pressedImageName()); - - keyListType = layoutType->keyListType(); - if (keyListType != NULL) { - for (int i = 0; i < keyListType->list.count(); i++) { - hwKeyType = keyListType->list.at(i); - if (hwKeyType != NULL) { - layout->keyList.append( - new HardwareKey(hwKeyType->objectName(), hwKeyType->keycode(), - hwKeyType->region(), hwKeyType->tooltip())); - } - } - } - - uiInfo->controllerList.append(layout); - - delete object; - } - - delete component; - delete engine; -} diff --git a/tizen/src/ui/skinkeyitem.cpp b/tizen/src/ui/skinkeyitem.cpp index 3075e098be..49d51cc507 100644 --- a/tizen/src/ui/skinkeyitem.cpp +++ b/tizen/src/ui/skinkeyitem.cpp @@ -78,5 +78,5 @@ void SkinKeyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio SkinKeyItem::~SkinKeyItem() { - qDebug("destory key item"); + //qDebug("destory key item"); } diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp index 2ae5fc1ef3..c9be238b8e 100644 --- a/tizen/src/ui/skinview.cpp +++ b/tizen/src/ui/skinview.cpp @@ -75,7 +75,7 @@ void SkinView::mousePressEvent(QMouseEvent *event) //qDebug("pressed %dx%d", event->x(), event->y()); if (event->button() == Qt::LeftButton) { - qDebug("grab"); + //qDebug("grab"); QWidget *win = ((QWidget *) this->parent()); grabWinPos = win->pos(); @@ -90,7 +90,7 @@ void SkinView::mouseReleaseEvent(QMouseEvent *event) //qDebug("released %dx%d", event->x(), event->y()); if (event->button() == Qt::LeftButton) { - qDebug("unloose"); + //qDebug("unloose"); grabPos = QPoint(-1, -1); } diff --git a/tizen/src/ui/widgets_app.pro b/tizen/src/ui/widgets_app.pro deleted file mode 100644 index 2269f18eaf..0000000000 --- a/tizen/src/ui/widgets_app.pro +++ /dev/null @@ -1,56 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2014-06-19T16:25:10 -# -#------------------------------------------------- - -QT += opengl core gui qml - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - -TARGET = widgets_app -#TEMPLATE = app - -HEADERS += mainwindow.h \ - menu/contextmenu.h \ - menu/detailedinfodialog.h \ - skinbezelitem.h \ - displaywidget.h \ - skinview.h \ - uiinformation.h \ - skinlayout.h \ - uistate.h \ - menu/aboutdialog.h \ - hardwarekey.h \ - xml/hardwarekeytype.h \ - xml/keylisttype.h \ - skinkeyitem.h \ - skincontrollerview.h \ - controllerlayout.h \ - xml/regiontype.h \ - xml/layouttype.h -SOURCES += main.cpp\ - mainwindow.cpp \ - menu/contextmenu.cpp \ - menu/detailedinfodialog.cpp \ - skinbezelitem.cpp \ - displaywidget.cpp \ - skinview.cpp \ - uiinformation.cpp \ - skinlayout.cpp \ - uistate.cpp \ - menu/aboutdialog.cpp \ - hardwarekey.cpp \ - xml/keylisttype.cpp \ - xml/hardwarekeytype.cpp \ - skinkeyitem.cpp \ - skincontrollerview.cpp \ - controllerlayout.cpp \ - xml/regiontype.cpp \ - xml/layouttype.cpp - -RESOURCES += \ - resource/resource.qrc - -OTHER_FILES += \ - #resource/wearable-320x320-1btn/layout.qml diff --git a/tizen/src/ui/widgets_app.pro.user b/tizen/src/ui/widgets_app.pro.user deleted file mode 100644 index caaa4aa8a1..0000000000 --- a/tizen/src/ui/widgets_app.pro.user +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - ProjectExplorer.Project.ActiveTarget - 0 - - - ProjectExplorer.Project.EditorSettings - - true - false - true - - Cpp - - CppGlobal - - - - QmlJS - - QmlJSGlobal - - - 2 - UTF-8 - false - 4 - false - 80 - true - true - 1 - true - false - 0 - true - 0 - 8 - true - 1 - true - true - true - false - - - - ProjectExplorer.Project.PluginSettings - - - - ProjectExplorer.Project.Target.0 - - Desktop Qt 5.3.0 GCC 32bit - Desktop Qt 5.3.0 GCC 32bit - qt.53.gcc_kit - 0 - 0 - 0 - - /home/giwoongkim/workspace_qt/build-widgets_app-Desktop_Qt_5_3_0_GCC_32bit-Debug - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - false - - false - - - false - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - - false - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - clean -j8 - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - -j8 - - - 4 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Debug - - Qt4ProjectManager.Qt4BuildConfiguration - 2 - true - - - /home/giwoongkim/workspace_qt/build-widgets_app-Desktop_Qt_5_3_0_GCC_32bit-Release - - - true - qmake - - QtProjectManager.QMakeBuildStep - false - true - - false - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - false - - - - 2 - Build - - ProjectExplorer.BuildSteps.Build - - - - true - Make - - Qt4ProjectManager.MakeStep - - -w - -r - - true - clean - - - 1 - Clean - - ProjectExplorer.BuildSteps.Clean - - 2 - false - - Release - - Qt4ProjectManager.Qt4BuildConfiguration - 0 - true - - 2 - - - 0 - Deploy - - ProjectExplorer.BuildSteps.Deploy - - 1 - Deploy locally - - ProjectExplorer.DefaultDeployConfiguration - - 1 - - - - false - false - false - false - true - 0.01 - 10 - true - 1 - 25 - - 1 - true - false - true - valgrind - - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - 13 - 14 - - 2 - - widgets_app - - Qt4ProjectManager.Qt4RunConfiguration:/home/giwoongkim/workspace_qt/widgets_app/widgets_app.pro - - widgets_app.pro - false - false - - 3768 - false - true - false - false - true - - 1 - - - - ProjectExplorer.Project.TargetCount - 1 - - - ProjectExplorer.Project.Updater.EnvironmentId - {ba48b818-3753-4d11-b657-7c6ff4d15224} - - - ProjectExplorer.Project.Updater.FileVersion - 15 - - -- 2.34.1