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:
parent
5036af3e5d
commit
3c9fe22bdc
|
@ -41,7 +41,7 @@ class log
|
||||||
public:
|
public:
|
||||||
log(Level lev = information) : ref(1), level(lev) {}
|
log(Level lev = information) : ref(1), level(lev) {}
|
||||||
~log();
|
~log();
|
||||||
log(const log& other) : ref(other.ref + 1) {}
|
log(const log& other) : ref(other.ref + 1), level(other.level) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
quint32 ref;
|
quint32 ref;
|
||||||
|
@ -61,7 +61,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT GlobalLog : public QObject
|
||||||
friend log operator<<(log l, qint64 i);
|
friend log operator<<(log l, qint64 i);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GlobalLog() {}
|
GlobalLog() : msg() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newMessage(log::Level, const QString&);
|
void newMessage(log::Level, const QString&);
|
||||||
|
|
|
@ -40,7 +40,10 @@
|
||||||
Report::Report(Report* p, const QString& cmd) :
|
Report::Report(Report* p, const QString& cmd) :
|
||||||
QObject(),
|
QObject(),
|
||||||
m_Parent(p),
|
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 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 += QString("<td>%1</td>\n").arg(Qt::escape(contents));
|
||||||
s += "</tr>\n";
|
s += "</tr>\n";
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +94,7 @@ QString Report::htmlHeader()
|
||||||
struct utsname info;
|
struct utsname info;
|
||||||
uname(&info);
|
uname(&info);
|
||||||
const QString unameString = QString(info.sysname) + ' ' + info.nodename + ' ' + info.release + ' ' + info.version + ' ' + info.machine;
|
const QString unameString = QString(info.sysname) + ' ' + info.nodename + ' ' + info.release + ' ' + info.version + ' ' + info.machine;
|
||||||
|
|
||||||
s += "<table>\n";
|
s += "<table>\n";
|
||||||
s += tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(KDateTime::currentLocalDateTime()));
|
s += tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(KDateTime::currentLocalDateTime()));
|
||||||
s += tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version());
|
s += tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version());
|
||||||
|
@ -100,14 +103,14 @@ QString Report::htmlHeader()
|
||||||
s += tableLine(i18n("Machine:"), unameString);
|
s += tableLine(i18n("Machine:"), unameString);
|
||||||
s += tableLine(i18n("User ID:"), QString::number(geteuid()));
|
s += tableLine(i18n("User ID:"), QString::number(geteuid()));
|
||||||
s += "</table>\n<br/>\n";
|
s += "</table>\n<br/>\n";
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Report::htmlFooter()
|
QString Report::htmlFooter()
|
||||||
{
|
{
|
||||||
QString s;
|
QString s;
|
||||||
|
|
||||||
s += "\n\n</body>\n</html>\n";
|
s += "\n\n</body>\n</html>\n";
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
@ -137,13 +140,13 @@ QString Report::toHtml() const
|
||||||
else
|
else
|
||||||
foreach(Report* child, children())
|
foreach(Report* child, children())
|
||||||
s += child->toHtml();
|
s += child->toHtml();
|
||||||
|
|
||||||
if (!status().isEmpty())
|
if (!status().isEmpty())
|
||||||
s += "<b>" + Qt::escape(status()) + "</b><br/>\n\n";
|
s += "<b>" + Qt::escape(status()) + "</b><br/>\n\n";
|
||||||
|
|
||||||
if (parent() != NULL)
|
if (parent() != NULL)
|
||||||
s += "</div>\n\n";
|
s += "</div>\n\n";
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Report : public QObject
|
||||||
|
|
||||||
friend Report& operator<<(Report& report, const QString& s);
|
friend Report& operator<<(Report& report, const QString& s);
|
||||||
friend Report& operator<<(Report& report, qint64 i);
|
friend Report& operator<<(Report& report, qint64 i);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Report(Report* p, const QString& cmd = QString());
|
explicit Report(Report* p, const QString& cmd = QString());
|
||||||
~Report();
|
~Report();
|
||||||
|
@ -51,15 +51,15 @@ class Report : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Report* newChild(const QString& cmd = QString());
|
Report* newChild(const QString& cmd = QString());
|
||||||
|
|
||||||
const QList<Report*>& children() const { return m_Children; } /**< @return the list of this Report's children */
|
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 */
|
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 */
|
const Report* parent() const { return m_Parent; } /**< @return pointer to this Reports parent. May be NULL if this is the root Report */
|
||||||
|
|
||||||
Report* root();
|
Report* root();
|
||||||
const Report* root() const;
|
const Report* root() const;
|
||||||
|
|
||||||
const QString& command() const { return m_Command; } /**< @return the command */
|
const QString& command() const { return m_Command; } /**< @return the command */
|
||||||
const QString& output() const { return m_Output; } /**< @return the output */
|
const QString& output() const { return m_Output; } /**< @return the output */
|
||||||
const QString& status() const { return m_Status; } /**< @return the status line */
|
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 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 setStatus(const QString& s) { m_Status = s; } /**< @param s the new status */
|
||||||
void addOutput(const QString& s);
|
void addOutput(const QString& s);
|
||||||
|
|
||||||
QString toHtml() const;
|
QString toHtml() const;
|
||||||
QString toText() const;
|
QString toText() const;
|
||||||
|
|
||||||
ReportLine line();
|
ReportLine line();
|
||||||
|
|
||||||
static QString htmlHeader();
|
static QString htmlHeader();
|
||||||
|
@ -78,7 +78,7 @@ class Report : public QObject
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void emitOutputChanged();
|
void emitOutputChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Report* m_Parent;
|
Report* m_Parent;
|
||||||
QList<Report*> m_Children;
|
QList<Report*> m_Children;
|
||||||
|
@ -104,7 +104,7 @@ class ReportLine
|
||||||
friend ReportLine operator<<(ReportLine reportLine, const QString& s);
|
friend ReportLine operator<<(ReportLine reportLine, const QString& s);
|
||||||
friend ReportLine operator<<(ReportLine reportLine, qint64 i);
|
friend ReportLine operator<<(ReportLine reportLine, qint64 i);
|
||||||
friend class Report;
|
friend class Report;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ReportLine(Report& r) : ref(1), report(r.newChild()) {}
|
ReportLine(Report& r) : ref(1), report(r.newChild()) {}
|
||||||
|
|
||||||
|
@ -112,6 +112,9 @@ class ReportLine
|
||||||
~ReportLine() { if (--ref == 0) *report << "\n"; }
|
~ReportLine() { if (--ref == 0) *report << "\n"; }
|
||||||
ReportLine(const ReportLine& other) : ref(other.ref + 1), report(other.report) {}
|
ReportLine(const ReportLine& other) : ref(other.ref + 1), report(other.report) {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ReportLine& operator=(const ReportLine&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
qint32 ref;
|
qint32 ref;
|
||||||
Report* report;
|
Report* report;
|
||||||
|
|
Loading…
Reference in New Issue