From 3c9fe22bdc6ea6180bb70f976a6216747ce42243 Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Mon, 9 Nov 2009 13:52:54 +0000 Subject: [PATCH] clean ups: whitespace changes, init props in class headers, copy ctors, assignments ops svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1046679 --- src/util/globallog.h | 4 ++-- src/util/report.cpp | 19 +++++++++++-------- src/util/report.h | 19 +++++++++++-------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/util/globallog.h b/src/util/globallog.h index fabb676..1e4f5e3 100644 --- a/src/util/globallog.h +++ b/src/util/globallog.h @@ -41,7 +41,7 @@ class log public: log(Level lev = information) : ref(1), level(lev) {} ~log(); - log(const log& other) : ref(other.ref + 1) {} + log(const log& other) : ref(other.ref + 1), level(other.level) {} private: quint32 ref; @@ -61,7 +61,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT GlobalLog : public QObject friend log operator<<(log l, qint64 i); private: - GlobalLog() {} + GlobalLog() : msg() {} signals: void newMessage(log::Level, const QString&); diff --git a/src/util/report.cpp b/src/util/report.cpp index b10166b..500b287 100644 --- a/src/util/report.cpp +++ b/src/util/report.cpp @@ -40,7 +40,10 @@ Report::Report(Report* p, const QString& cmd) : QObject(), m_Parent(p), - m_Command(cmd) + m_Children(), + m_Command(cmd), + m_Output(), + m_Status() { } @@ -69,7 +72,7 @@ static QString tableLine(const QString& label, const QString contents) s += QString("%1\n").arg(Qt::escape(label)); s += QString("%1\n").arg(Qt::escape(contents)); s += "\n"; - + return s; } @@ -91,7 +94,7 @@ QString Report::htmlHeader() struct utsname info; uname(&info); const QString unameString = QString(info.sysname) + ' ' + info.nodename + ' ' + info.release + ' ' + info.version + ' ' + info.machine; - + s += "\n"; s += tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(KDateTime::currentLocalDateTime())); s += tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version()); @@ -100,14 +103,14 @@ QString Report::htmlHeader() s += tableLine(i18n("Machine:"), unameString); s += tableLine(i18n("User ID:"), QString::number(geteuid())); s += "
\n
\n"; - + return s; } QString Report::htmlFooter() { QString s; - + s += "\n\n\n\n"; return s; @@ -137,13 +140,13 @@ QString Report::toHtml() const else foreach(Report* child, children()) s += child->toHtml(); - + if (!status().isEmpty()) s += "" + Qt::escape(status()) + "
\n\n"; - + if (parent() != NULL) s += "\n\n"; - + return s; } diff --git a/src/util/report.h b/src/util/report.h index 661dcb4..ba4920e 100644 --- a/src/util/report.h +++ b/src/util/report.h @@ -41,7 +41,7 @@ class Report : public QObject friend Report& operator<<(Report& report, const QString& s); friend Report& operator<<(Report& report, qint64 i); - + public: explicit Report(Report* p, const QString& cmd = QString()); ~Report(); @@ -51,15 +51,15 @@ class Report : public QObject public: Report* newChild(const QString& cmd = QString()); - + const QList& children() const { return m_Children; } /**< @return the list of this Report's children */ - + Report* parent() { return m_Parent; } /**< @return pointer to this Reports parent. May be NULL if this is the root Report */ const Report* parent() const { return m_Parent; } /**< @return pointer to this Reports parent. May be NULL if this is the root Report */ Report* root(); const Report* root() const; - + const QString& command() const { return m_Command; } /**< @return the command */ const QString& output() const { return m_Output; } /**< @return the output */ const QString& status() const { return m_Status; } /**< @return the status line */ @@ -67,10 +67,10 @@ class Report : public QObject void setCommand(const QString& s) { m_Command = s; } /**< @param s the new command */ void setStatus(const QString& s) { m_Status = s; } /**< @param s the new status */ void addOutput(const QString& s); - + QString toHtml() const; QString toText() const; - + ReportLine line(); static QString htmlHeader(); @@ -78,7 +78,7 @@ class Report : public QObject protected: void emitOutputChanged(); - + private: Report* m_Parent; QList m_Children; @@ -104,7 +104,7 @@ class ReportLine friend ReportLine operator<<(ReportLine reportLine, const QString& s); friend ReportLine operator<<(ReportLine reportLine, qint64 i); friend class Report; - + protected: ReportLine(Report& r) : ref(1), report(r.newChild()) {} @@ -112,6 +112,9 @@ class ReportLine ~ReportLine() { if (--ref == 0) *report << "\n"; } ReportLine(const ReportLine& other) : ref(other.ref + 1), report(other.report) {} + private: + ReportLine& operator=(const ReportLine&); + private: qint32 ref; Report* report;