mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-05 10:17:30 -05:00
b7f6a89a3e
7b7cd11244
clang-tidy, qt: Force checks for headers in `src/qt` (Hennadii Stepanov)69eacf2c5e
clang-tidy, qt: Fix `modernize-use-default-member-init` in headers (Hennadii Stepanov) Pull request description: This PR split from bitcoin/bitcoin#26705 and contains only changes in `src/qt`. Effectively, it fixes the clang-tidy's `modernize-use-default-member-init` errors, and forces clang-tidy checks for all headers in the `src/qt` directory. ACKs for top commit: jarolrod: ACK7b7cd11244
Tree-SHA512: 79525bb0f31ae7cad88c781e55091a21467c0485ddc1ed03ad62e051480fda3b3710619ea11af480437edba3c6e038f7c40edc6b373e3a37408c006d11b34686
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
// Copyright (c) 2011-2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|
|
#define BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QQueue>
|
|
|
|
#include <chrono>
|
|
|
|
class ClientModel;
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QPaintEvent;
|
|
class QTimer;
|
|
QT_END_NAMESPACE
|
|
|
|
class TrafficGraphWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TrafficGraphWidget(QWidget *parent = nullptr);
|
|
void setClientModel(ClientModel *model);
|
|
std::chrono::minutes getGraphRange() const;
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *) override;
|
|
|
|
public Q_SLOTS:
|
|
void updateRates();
|
|
void setGraphRange(std::chrono::minutes new_range);
|
|
void clear();
|
|
|
|
private:
|
|
void paintPath(QPainterPath &path, QQueue<float> &samples);
|
|
|
|
QTimer* timer{nullptr};
|
|
float fMax{0.0f};
|
|
std::chrono::minutes m_range{0};
|
|
QQueue<float> vSamplesIn;
|
|
QQueue<float> vSamplesOut;
|
|
quint64 nLastBytesIn{0};
|
|
quint64 nLastBytesOut{0};
|
|
ClientModel* clientModel{nullptr};
|
|
};
|
|
|
|
#endif // BITCOIN_QT_TRAFFICGRAPHWIDGET_H
|