mirror of https://github.com/Nheko-Reborn/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.6 KiB
81 lines
2.6 KiB
8 years ago
|
/*
|
||
|
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
8 years ago
|
#pragma once
|
||
8 years ago
|
|
||
7 years ago
|
#include <QMap>
|
||
8 years ago
|
#include <QSharedPointer>
|
||
8 years ago
|
#include <QStackedWidget>
|
||
|
|
||
7 years ago
|
#include "MessageEvent.h"
|
||
|
|
||
7 years ago
|
class JoinedRoom;
|
||
|
class MatrixClient;
|
||
|
class RoomInfoListItem;
|
||
|
class Rooms;
|
||
|
class TimelineView;
|
||
|
struct DescInfo;
|
||
8 years ago
|
|
||
8 years ago
|
class TimelineViewManager : public QStackedWidget
|
||
8 years ago
|
{
|
||
7 years ago
|
Q_OBJECT
|
||
8 years ago
|
|
||
|
public:
|
||
7 years ago
|
TimelineViewManager(QSharedPointer<MatrixClient> client, QWidget *parent);
|
||
|
~TimelineViewManager();
|
||
8 years ago
|
|
||
7 years ago
|
// Initialize with timeline events.
|
||
|
void initialize(const Rooms &rooms);
|
||
|
// Empty initialization.
|
||
|
void initialize(const QList<QString> &rooms);
|
||
7 years ago
|
|
||
|
void addRoom(const JoinedRoom &room, const QString &room_id);
|
||
|
void addRoom(const QString &room_id);
|
||
|
|
||
7 years ago
|
void sync(const Rooms &rooms);
|
||
|
void clearAll();
|
||
8 years ago
|
|
||
7 years ago
|
// Check if all the timelines have been loaded.
|
||
|
bool hasLoaded() const;
|
||
|
|
||
7 years ago
|
static QString chooseRandomColor();
|
||
|
static QString displayName(const QString &userid);
|
||
8 years ago
|
|
||
7 years ago
|
static QMap<QString, QString> DISPLAY_NAMES;
|
||
8 years ago
|
|
||
8 years ago
|
signals:
|
||
7 years ago
|
void clearRoomMessageCount(QString roomid);
|
||
7 years ago
|
void unreadMessages(QString roomid, int count);
|
||
|
void updateRoomsLastMessage(const QString &user, const DescInfo &info);
|
||
8 years ago
|
|
||
8 years ago
|
public slots:
|
||
7 years ago
|
void setHistoryView(const QString &room_id);
|
||
7 years ago
|
void queueTextMessage(const QString &msg);
|
||
|
void queueEmoteMessage(const QString &msg);
|
||
|
void queueImageMessage(const QString &roomid, const QString &filename, const QString &url);
|
||
7 years ago
|
void queueFileMessage(const QString &roomid, const QString &filename, const QString &url);
|
||
8 years ago
|
|
||
|
private slots:
|
||
7 years ago
|
void messageSent(const QString &eventid, const QString &roomid, int txnid);
|
||
7 years ago
|
void messageSendFailed(const QString &roomid, int txnid);
|
||
8 years ago
|
|
||
|
private:
|
||
7 years ago
|
QString active_room_;
|
||
|
QMap<QString, QSharedPointer<TimelineView>> views_;
|
||
|
QSharedPointer<MatrixClient> client_;
|
||
8 years ago
|
};
|