clean ups: whitespace changes, init props in class headers, copy ctors,

assignments ops

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1046679
This commit is contained in:
Volker Lanz 2009-11-09 13:52:54 +00:00
parent 5036af3e5d
commit 3c9fe22bdc
3 changed files with 24 additions and 18 deletions

View File

@ -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&);

View File

@ -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("<td style='font-weight:bold;padding-right:20px;'>%1</td>\n").arg(Qt::escape(label));
s += QString("<td>%1</td>\n").arg(Qt::escape(contents));
s += "</tr>\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 += "<table>\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 += "</table>\n<br/>\n";
return s;
}
QString Report::htmlFooter()
{
QString s;
s += "\n\n</body>\n</html>\n";
return s;
@ -137,13 +140,13 @@ QString Report::toHtml() const
else
foreach(Report* child, children())
s += child->toHtml();
if (!status().isEmpty())
s += "<b>" + Qt::escape(status()) + "</b><br/>\n\n";
if (parent() != NULL)
s += "</div>\n\n";
return s;
}

View File

@ -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<Report*>& 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<Report*> 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;