modernize: Prefer default member init over ctor init
[quassel.git] / src / client / messagemodel.h
index 04e169a..75259da 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   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  *
@@ -18,8 +18,9 @@
  *   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>
@@ -31,7 +32,7 @@
 class MessageModelItem;
 struct MsgId;
 
-class MessageModel : public QAbstractItemModel
+class CLIENT_EXPORT MessageModel : public QAbstractItemModel
 {
     Q_OBJECT
 
@@ -58,13 +59,13 @@ public:
 
     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;
 
@@ -99,7 +100,7 @@ protected:
     virtual void removeAllMessages() = 0;
     virtual Message takeMessageAt(int i) = 0;
 
-    virtual void customEvent(QEvent *event);
+    void customEvent(QEvent *event) override;
 
 private slots:
     void changeOfDay();
@@ -114,6 +115,10 @@ private:
     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;
 };
 
 
@@ -130,7 +135,7 @@ QModelIndex MessageModel::index(int row, int column, const QModelIndex &parent)
 // **************************************************
 //  MessageModelItem
 // **************************************************
-class MessageModelItem
+class CLIENT_EXPORT MessageModelItem
 {
 public:
     //! Creates a MessageModelItem from a Message object.
@@ -164,5 +169,3 @@ private:
 
 
 QDebug operator<<(QDebug dbg, const MessageModelItem &msgItem);
-
-#endif