/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef MESSAGEMODEL_H_
-#define MESSAGEMODEL_H_
+#pragma once
+
+#include "client-export.h"
#include <QAbstractItemModel>
#include <QDateTime>
class MessageModelItem;
struct MsgId;
-class MessageModel : public QAbstractItemModel
+class CLIENT_EXPORT MessageModel : public QAbstractItemModel
{
Q_OBJECT
MessageModel(QObject *parent);
- inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); }
- inline int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : messageCount(); }
- inline int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const { return 3; }
+ inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ inline QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+ inline int rowCount(const QModelIndex &parent = QModelIndex()) const override { return parent.isValid() ? 0 : messageCount(); }
+ inline int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override { return 3; }
- virtual QVariant data(const QModelIndex &index, int role) const;
- virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
+ QVariant data(const QModelIndex &index, int role) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
//virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual void removeAllMessages() = 0;
virtual Message takeMessageAt(int i) = 0;
- virtual void customEvent(QEvent *event);
+ void customEvent(QEvent *event) override;
private slots:
void changeOfDay();
QTimer _dayChangeTimer;
QDateTime _nextDayChange;
QHash<BufferId, int> _messagesWaiting;
+
+ /// Period of time for one day in milliseconds
+ /// 24 hours * 60 minutes * 60 seconds * 1000 milliseconds
+ const qint64 DAY_IN_MSECS = 24 * 60 * 60 * 1000;
};
// **************************************************
// MessageModelItem
// **************************************************
-class MessageModelItem
+//! Creates a MessageModelItem from a Message object.
+/** This baseclass implementation takes care of all Message data *except* the stylable strings.
+ * Subclasses need to provide Qt::DisplayRole at least, which should describe the plaintext
+ * strings without formattings (e.g. for searching purposes).
+ */
+class CLIENT_EXPORT MessageModelItem
{
public:
- //! Creates a MessageModelItem from a Message object.
- /** This baseclass implementation takes care of all Message data *except* the stylable strings.
- * Subclasses need to provide Qt::DisplayRole at least, which should describe the plaintext
- * strings without formattings (e.g. for searching purposes).
- */
- MessageModelItem() {}
- inline virtual ~MessageModelItem() {}
+ inline virtual ~MessageModelItem() = default;
virtual QVariant data(int column, int role) const;
virtual bool setData(int column, const QVariant &value, int role);
QDebug operator<<(QDebug dbg, const MessageModelItem &msgItem);
-
-#endif