Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 0efede78 authored by David Faure's avatar David Faure

Port to QElapsedTimer; remove unused default constructor

Tested by printing out the value of age(), works like before.
parent 132b8bd0
......@@ -19,6 +19,14 @@
#include "server.h"
IRCMessage::IRCMessage(const QString &str)
: s(str) //, codec(QTextCodec::codecForName("utf8"))
{
t.start();
}
////
int IRCQueue::EmptyingRate::nextInterval(int, int elapsed)
{
if (!isValid())
......
......@@ -19,6 +19,7 @@
#include <QObject>
#include <QList>
#include <QTime>
#include <QElapsedTimer>
class QTimer;
class Server;
......@@ -34,29 +35,24 @@ class Server;
*/
struct IRCMessage
{
IRCMessage() : t(QTime::currentTime()) //, codec(QTextCodec::codecForName("utf8"))
{} ///< this constructor required for QValueList, do not use
/**
Make a new IRCMessage with timestamp of QTime::currentTime().
Note the constructor takes a QString, not a const QString& or a QString *. If you want to modify the
contained text, put it back with setText.
*/
IRCMessage(QString i) : s(i), t(QTime::currentTime()) //, codec(QTextCodec::codecForName("utf8"))
{}
IRCMessage(const QString &str);
QString text() { return s; }
int age() { return t.elapsed(); }
QTime time() { return t; }
void setText(QString text) { s=text; }
QString text() const { return s; }
int age() const { return t.elapsed(); } // in milliseconds
void setText(const QString &text) { s=text; }
private:
QString s;
QTime t;
QElapsedTimer t;
//FIXME wire this up
//QTextCodec* codec;
//operator const char * () const { return codec->fromUnicode(text()); }
//operator QByteArray () const { return codec->fromUnicode(text()); }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment