mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-29 19:18:42 -07:00
Coding style for many files
This commit is contained in:
parent
acdb7a27dc
commit
ae1634623e
23 changed files with 637 additions and 662 deletions
|
@ -191,20 +191,20 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
Utils::Misc::friendlyUnit(0, true)
|
||||
};
|
||||
|
||||
int yAxeWidth = 0;
|
||||
int yAxisWidth = 0;
|
||||
for (const QString &label : speedLabels)
|
||||
if (fontMetrics.width(label) > yAxeWidth)
|
||||
yAxeWidth = fontMetrics.width(label);
|
||||
if (fontMetrics.width(label) > yAxisWidth)
|
||||
yAxisWidth = fontMetrics.width(label);
|
||||
|
||||
int i = 0;
|
||||
for (const QString &label : speedLabels) {
|
||||
QRectF labelRect(rect.topLeft() + QPointF(-yAxeWidth, (i++) * 0.25 * rect.height() - fontMetrics.height()),
|
||||
QSizeF(2 * yAxeWidth, fontMetrics.height()));
|
||||
QRectF labelRect(rect.topLeft() + QPointF(-yAxisWidth, (i++) * 0.25 * rect.height() - fontMetrics.height()),
|
||||
QSizeF(2 * yAxisWidth, fontMetrics.height()));
|
||||
painter.drawText(labelRect, label, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
// draw grid lines
|
||||
rect.adjust(yAxeWidth + 4, 0, 0, 0);
|
||||
rect.adjust(yAxisWidth + 4, 0, 0, 0);
|
||||
|
||||
QPen gridPen;
|
||||
gridPen.setStyle(Qt::DashLine);
|
||||
|
@ -236,18 +236,16 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
boost::circular_buffer<PointData> &queue = getCurrentData();
|
||||
|
||||
for (int id = UP; id < NB_GRAPHS; ++id) {
|
||||
|
||||
if (!m_properties[static_cast<GraphID>(id)].enable)
|
||||
continue;
|
||||
|
||||
QVector<QPoint> points;
|
||||
|
||||
for (int i = int(queue.size()) - 1, j = 0; i >= 0 && j <= m_viewablePointsCount; --i, ++j) {
|
||||
|
||||
int new_x = rect.right() - j * xTickSize;
|
||||
int new_y = rect.bottom() - queue[i].y[id] * yMultiplier;
|
||||
int newX = rect.right() - j * xTickSize;
|
||||
int newY = rect.bottom() - queue[i].y[id] * yMultiplier;
|
||||
|
||||
points.push_back(QPoint(new_x, new_y));
|
||||
points.push_back(QPoint(newX, newY));
|
||||
}
|
||||
|
||||
painter.setPen(m_properties[static_cast<GraphID>(id)].pen);
|
||||
|
@ -260,7 +258,6 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
double legendHeight = 0;
|
||||
int legendWidth = 0;
|
||||
for (const auto &property : m_properties) {
|
||||
|
||||
if (!property.enable)
|
||||
continue;
|
||||
|
||||
|
@ -276,7 +273,6 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
|
||||
i = 0;
|
||||
for (const auto &property : m_properties) {
|
||||
|
||||
if (!property.enable)
|
||||
continue;
|
||||
|
||||
|
@ -293,10 +289,12 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||
|
||||
SpeedPlotView::GraphProperties::GraphProperties()
|
||||
: enable(false)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
SpeedPlotView::GraphProperties::GraphProperties(const QString &name, const QPen &pen, bool enable)
|
||||
: name(name)
|
||||
, pen(pen)
|
||||
, enable(enable)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue