I have made the following changes intended for : CE:MW:MTF / libmeegotouch
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/5251 Thank You, Marko Saukko [This message was auto-generated] --- Request # 5251: Messages from BOSS: State: review at 2012-07-22T12:40:07 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: Project:MTF:MW / libmeegotouch -> CE:MW:MTF / libmeegotouch changes files: -------------- --- libmeegotouch.changes +++ libmeegotouch.changes @@ -0,0 +1,3 @@ +* Thu Jul 19 2012 Dmitry Rozhkov <[email protected]> - 0.25.6 +- Enable logging to file + new: ---- 0001-reformat-warning-messages-to-ease-parsing.patch 0002-add-configurable-logging-to-file.patch spec files: ----------- --- libmeegotouch.spec +++ libmeegotouch.spec @@ -1,11 +1,13 @@ # # Do NOT Edit the Auto-generated Part! -# Generated by: spectacle version 0.23 +# Generated by: spectacle version 0.24.1 # + +Name: libmeegotouch + # >> macros # << macros -Name: libmeegotouch Summary: MeeGo Touch Framework Version: 0.25.6 Release: 1 @@ -24,6 +26,8 @@ Patch5: allow-cursor-control-env.patch Patch6: libmeegotouch-0.25.6-link-with-missing-libs.patch Patch7: libmeegotouch-0.24.21-no-werror.patch +Patch8: 0001-reformat-warning-messages-to-ease-parsing.patch +Patch9: 0002-add-configurable-logging-to-file.patch Requires: meegotouch-theme >= 0.20.79 Requires: libmeegotouch-l10n-en Requires(post): /sbin/ldconfig @@ -50,12 +54,10 @@ Obsoletes: libdui < 0.20.0 Obsoletes: libmeegotouch < 0.20.89 - %description Qt based MeeGo Touch Framework for developing touch based user interfaces. - %package devel Summary: MeeGo Touch Framework development files Group: Development/Libraries @@ -200,6 +202,10 @@ %patch6 -p1 # libmeegotouch-0.24.21-no-werror.patch %patch7 -p1 +# 0001-reformat-warning-messages-to-ease-parsing.patch +%patch8 -p1 +# 0002-add-configurable-logging-to-file.patch +%patch9 -p1 # >> setup # << setup @@ -230,6 +236,7 @@ # >> build post # << build post + %install rm -rf %{buildroot} # >> install pre @@ -254,13 +261,12 @@ # Remove some not wanted .git files rm -rf %{buildroot}/%{_libdir}/libmeegotouch-tests/ut_mimagedirectory-samples # << install post + desktop-file-install --delete-original \ --dir %{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/applications/*.desktop %fdupes %{buildroot}/%{_datadir} - - %post -p /sbin/ldconfig %postun @@ -271,46 +277,6 @@ fi # << postun - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %files %defattr(-,root,root,-) # >> files @@ -358,7 +324,6 @@ %attr(1777, -, -) /var/cache/meegotouch # << files - %files devel %defattr(-,root,root,-) # >> files devel @@ -506,4 +471,3 @@ # >> files meegotouch-demos-tests %{_datadir}/meegotouch-demos-widgetsgallery-tests/tests.xml # << files meegotouch-demos-tests - other changes: -------------- ++++++ 0001-reformat-warning-messages-to-ease-parsing.patch (new) --- 0001-reformat-warning-messages-to-ease-parsing.patch +++ 0001-reformat-warning-messages-to-ease-parsing.patch @@ -0,0 +1,48 @@ +From e3802a2ab045f06c9fdfdc4dbd0eea60534593c3 Mon Sep 17 00:00:00 2001 +From: Dmitry Rozhkov <[email protected]> +Date: Thu, 19 Jul 2012 18:12:50 +0300 +Subject: [PATCH 1/2] reformat warning messages to ease parsing + +--- + src/corelib/theme/mimagedirectory.cpp | 4 ++-- + src/corelib/theme/mthemedaemon.cpp | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/corelib/theme/mimagedirectory.cpp b/src/corelib/theme/mimagedirectory.cpp +index 8a5003a..b9f83c4 100644 +--- a/src/corelib/theme/mimagedirectory.cpp ++++ b/src/corelib/theme/mimagedirectory.cpp +@@ -579,7 +579,7 @@ ImageResource *MThemeImagesDirectory::findImage(const QString &imageId) + if (!svgPaths.empty()) { + qDebug() << "Found icon" << imageId << "from locale"; + if (svgPaths.count() > 1) { +- mWarning("MThemeImagesDirectory") << "Found multiple svgs with candidates for id" << imageId << "Using first one: " << svgPaths; ++ mWarning("MThemeImagesDirectory") << "[MULT] Found multiple svgs with candidates for id" << imageId << svgPaths << "Using first one: " << svgPaths.first(); + } + resource = new SvgImageResource(imageId, svgPaths.first()); + localizedImageResources.insert(imageId, resource); +@@ -595,7 +595,7 @@ ImageResource *MThemeImagesDirectory::findImage(const QString &imageId) + QList<QString> svgPaths = idsInSvgImages.values(imageId); + if (!svgPaths.empty()) { + if (svgPaths.count() > 1) { +- mWarning("MThemeImagesDirectory") << "Found multiple svgs with candidates for id" << imageId << "Using first one: " << svgPaths; ++ mWarning("MThemeImagesDirectory") << "[MULT] Found multiple svgs with candidates for id" << imageId << svgPaths << "Using first one: " << svgPaths.first(); + } + resource = new SvgImageResource(imageId, svgPaths.first()); + imageResources.insert(imageId, resource); +diff --git a/src/corelib/theme/mthemedaemon.cpp b/src/corelib/theme/mthemedaemon.cpp +index d88a724..29aba6e 100644 +--- a/src/corelib/theme/mthemedaemon.cpp ++++ b/src/corelib/theme/mthemedaemon.cpp +@@ -113,7 +113,7 @@ bool MThemeDaemon::pixmap(MThemeDaemonClient *client, const PixmapIdentifier &id + // application paths didn't contain the image resource, now check from theme + resource = findImageResource(id.imageId); + if (!resource) { +- mWarning("MThemeDaemon") << " The requested pixmap" << id.imageId << "was not found for client" << client->name(); ++ mWarning("MThemeDaemon") << qPrintable(QString("[MISS] %1 - The requested pixmap %1 was not found for client %2").arg(id.imageId).arg(client->name())); + client->pixmaps.insert(id, NULL); + *handle = MPixmapHandle(); + return true; +-- +1.7.9.5 + ++++++ 0002-add-configurable-logging-to-file.patch (new) --- 0002-add-configurable-logging-to-file.patch +++ 0002-add-configurable-logging-to-file.patch @@ -0,0 +1,278 @@ +From a46f7bf51f382d8bfee1c2f9146d31e5c3f79489 Mon Sep 17 00:00:00 2001 +From: Dmitry Rozhkov <[email protected]> +Date: Fri, 20 Jul 2012 16:30:58 +0300 +Subject: [PATCH 2/2] add configurable logging to file + +--- + mthemedaemon/logger.cpp | 134 +++++++++++++++++++++++++++++++++++++++++ + mthemedaemon/logger.h | 51 ++++++++++++++++ + mthemedaemon/main.cpp | 12 +++- + mthemedaemon/mthemedaemon.pro | 2 + + 4 files changed, 198 insertions(+), 1 deletion(-) + create mode 100644 mthemedaemon/logger.cpp + create mode 100644 mthemedaemon/logger.h + +diff --git a/mthemedaemon/logger.cpp b/mthemedaemon/logger.cpp +new file mode 100644 +index 0000000..74adda2 +--- /dev/null ++++ b/mthemedaemon/logger.cpp +@@ -0,0 +1,134 @@ ++/*************************************************************************** ++** ++** Copyright (C) 2012 Jolla Ltd. ++** All rights reserved. ++** Contact: Jolla Ltd. ([email protected]) ++** ++** This file is part of libmeegotouch. ++** ++** If you have questions regarding the use of this file, please contact ++** Jolla at [email protected]. ++** ++** This library is free software; you can redistribute it and/or ++** modify it under the terms of the GNU Lesser General Public ++** License version 2.1 as published by the Free Software Foundation ++** and appearing in the file LICENSE.LGPL included in the packaging ++** of this file. ++** ++****************************************************************************/ ++ ++#include <QDateTime> ++#include "logger.h" ++ ++Logger::Logger(const QString &logPath, const QString &logLevel) : ++ m_logfile(NULL), ++ m_outputLevel(QtDebugMsg), ++ m_gconfLogPath("/meegotouch/theme/logpath"), ++ m_gconfLogLevel("/meegotouch/theme/loglevel") ++{ ++ if (!logPath.isEmpty()) { ++ setLogPath(logPath); ++ } else if (!m_gconfLogPath.value().isNull()) { ++ // use GConf for default log path ++ setLogPath(m_gconfLogPath.value().toString()); ++ } ++ ++ if (!logLevel.isEmpty()) { ++ setLogLevel(logLevel); ++ } else if (!m_gconfLogLevel.value().isNull()) { ++ // use GConf for default log path ++ setLogLevel(m_gconfLogLevel.value().toString()); ++ } ++ ++ // reopen log file if re-configured ++ connect(&m_gconfLogPath, ++ SIGNAL(valueChanged()), ++ this, ++ SLOT(logPathChanged())); ++ connect(&m_gconfLogLevel, ++ SIGNAL(valueChanged()), ++ this, ++ SLOT(logLevelChanged())); ++} ++ ++Logger::~Logger() {} ++ ++void Logger::log(const QtMsgType type, const QString &msg) ++{ ++ if (type < m_outputLevel) ++ return; ++ if (!m_logstream.device()) ++ return; ++ ++ QString severity; ++ ++ switch (type) { ++ case QtDebugMsg: ++ severity = "debug "; ++ break; ++ case QtWarningMsg: ++ severity = "warning "; ++ break; ++ case QtCriticalMsg: ++ severity = "critical "; ++ break; ++ case QtFatalMsg: ++ severity = "fatal "; ++ } ++ m_logstream << QDateTime::currentDateTime().toString("[dd.MM.yyyy hh:mm:ss.zzz] ") << severity << msg << "\n"; ++ m_logstream.flush(); ++} ++ ++void Logger::setLogPath(const QString &logPath) ++{ ++ if (m_logfile) { ++ m_logfile->close(); ++ delete m_logfile; ++ m_logfile = NULL; ++ } ++ if (!logPath.isEmpty()) { ++ m_logfile = new QFile(logPath, this); ++ if (!m_logfile->open(QIODevice::Append | QIODevice::Text)) { ++ fprintf(stderr, "%s\n", "Can't open log file"); ++ delete m_logfile; ++ m_logfile = NULL; ++ return; ++ } ++ m_logstream.setDevice(m_logfile); ++ } ++} ++ ++void Logger::setLogLevel(const QString &logLevel) ++{ ++ if (logLevel == "debug") { ++ m_outputLevel = QtDebugMsg; ++ } else if (logLevel == "warning") { ++ m_outputLevel = QtWarningMsg; ++ } else if (logLevel == "critical") { ++ m_outputLevel = QtCriticalMsg; ++ } else { ++#ifdef __arm__ ++ m_outputLevel = QtCriticalMsg; ++#else ++ m_outputLevel = QtWarningMsg; ++#endif ++ } ++} ++ ++void Logger::logPathChanged() ++{ ++ if (m_gconfLogPath.value().isNull()) { ++ setLogPath(QString()); ++ } else { ++ setLogPath(m_gconfLogPath.value().toString()); ++ } ++} ++ ++void Logger::logLevelChanged() ++{ ++ if (m_gconfLogLevel.value().isNull()) { ++ setLogLevel(QString()); ++ } else { ++ setLogLevel(m_gconfLogLevel.value().toString()); ++ } ++} +diff --git a/mthemedaemon/logger.h b/mthemedaemon/logger.h +new file mode 100644 +index 0000000..7ebb082 +--- /dev/null ++++ b/mthemedaemon/logger.h +@@ -0,0 +1,51 @@ ++/*************************************************************************** ++** ++** Copyright (C) 2012 Jolla Ltd. ++** All rights reserved. ++** Contact: Jolla Ltd. ([email protected]) ++** ++** This file is part of libmeegotouch. ++** ++** If you have questions regarding the use of this file, please contact ++** Jolla at [email protected]. ++** ++** This library is free software; you can redistribute it and/or ++** modify it under the terms of the GNU Lesser General Public ++** License version 2.1 as published by the Free Software Foundation ++** and appearing in the file LICENSE.LGPL included in the packaging ++** of this file. ++** ++****************************************************************************/ ++ ++#ifndef LOGGER_H ++#define LOGGER_H ++ ++#include <QFile> ++#include <QTextStream> ++#include <MGConfItem> ++ ++//! \internal ++class Logger : public QObject ++{ ++ Q_OBJECT ++public: ++ Logger(const QString &logPath = QString(), const QString &logLevel = QString()); ++ virtual ~Logger(); ++ ++ void log(const QtMsgType type, const QString &msg); ++ void setLogPath(const QString &logPath); ++ void setLogLevel(const QString &logLevel); ++ ++private slots: (79 more lines skipped) ++++++ libmeegotouch.yaml --- libmeegotouch.yaml +++ libmeegotouch.yaml @@ -16,6 +16,8 @@ - allow-cursor-control-env.patch - libmeegotouch-0.25.6-link-with-missing-libs.patch - libmeegotouch-0.24.21-no-werror.patch + - 0001-reformat-warning-messages-to-ease-parsing.patch + - 0002-add-configurable-logging-to-file.patch Description: | Qt based MeeGo Touch Framework for developing touch based user interfaces. Requires:
