Sample thread CPU usage without waking idle loops, expose a one-second moving average, and refresh compact GUI indicators at 3 Hz while visible on Android. Add load and bridge regression coverage, streaming notes, and task list cleanup.
56 lines
1.8 KiB
C++
56 lines
1.8 KiB
C++
/* Список каналов и PM с unread/online; загружает данные DbManager и принимает обновления bridge.
|
|
* Выбор и действия пользователя передаёт наружу signals; виджет используется в GUI-потоке. */
|
|
#pragma once
|
|
|
|
#include <QWidget>
|
|
#include <QListView>
|
|
#include <QStandardItemModel>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QHash>
|
|
#include <QTimer>
|
|
|
|
class DbManager;
|
|
class QLabel;
|
|
class CpuLoadIndicator;
|
|
|
|
class ChannelList : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit ChannelList(DbManager* db = nullptr, QWidget *parent = nullptr);
|
|
|
|
void loadChannels();
|
|
void refreshDmPresence();
|
|
void onDmCallRoute(const uint8_t* data, int len);
|
|
void clearDmPresence();
|
|
void selectChannel(const QString& channelId);
|
|
void setChannelPeersOnline(const QString& channelId, int count);
|
|
void setAutoConnectActive(bool active);
|
|
void setCpuLoad(int percent);
|
|
void setChannelUnreadCount(const QString& channelId, int count);
|
|
int getChannelUnreadCount(const QString& channelId) const;
|
|
|
|
signals:
|
|
void channelSelected(const QString& channelId);
|
|
void filesRequested(const QString& channelId);
|
|
void ownFilesDropped(const QString& channelId, const QStringList& paths);
|
|
void joinRequested();
|
|
void createGroupRequested();
|
|
void settingsRequested();
|
|
void connMonitorRequested();
|
|
|
|
protected:
|
|
bool eventFilter(QObject* target, QEvent* event) override;
|
|
|
|
private:
|
|
QListView *m_listView;
|
|
QStandardItemModel *m_model;
|
|
DbManager *m_db;
|
|
QWidget *m_footer;
|
|
QLabel *m_dropHint;
|
|
bool m_autoConnectActive = false;
|
|
QHash<QString, bool> m_dmOnline;
|
|
QTimer* m_dmPresenceTimer;
|
|
CpuLoadIndicator* m_cpuLoad;
|
|
};
|