mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-23 00:47:21 -06:00
Redesign main core classes.
This commit is contained in:
@@ -34,8 +34,6 @@
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
|
||||
#define BAR_HEIGHT 18
|
||||
|
||||
@@ -44,25 +42,25 @@ class PieceAvailabilityBar: public QWidget {
|
||||
Q_DISABLE_COPY(PieceAvailabilityBar)
|
||||
|
||||
private:
|
||||
QImage image;
|
||||
QImage m_image;
|
||||
|
||||
// I used values, bacause it should be possible to change colors in runtime
|
||||
|
||||
// background color
|
||||
int bg_color;
|
||||
int m_bgColor;
|
||||
// border color
|
||||
int border_color;
|
||||
int m_borderColor;
|
||||
// complete piece color
|
||||
int piece_color;
|
||||
int m_pieceColor;
|
||||
// buffered 256 levels gradient from bg_color to piece_color
|
||||
std::vector<int> piece_colors;
|
||||
QVector<int> m_pieceColors;
|
||||
|
||||
// last used int vector, uses to better resize redraw
|
||||
// TODO: make a diff pieces to new pieces and update only changed pixels, speedup when update > 20x faster
|
||||
std::vector<int> pieces;
|
||||
QVector<int> m_pieces;
|
||||
|
||||
// scale int vector to float vector
|
||||
std::vector<float> intToFloatVector(const std::vector<int> &vecin, int reqSize);
|
||||
QVector<float> intToFloatVector(const QVector<int> &vecin, int reqSize);
|
||||
|
||||
// mix two colors by light model, ratio <0, 1>
|
||||
int mixTwoColors(int &rgb1, int &rgb2, float ratio);
|
||||
@@ -72,7 +70,7 @@ private:
|
||||
public:
|
||||
PieceAvailabilityBar(QWidget *parent);
|
||||
|
||||
void setAvailability(const std::vector<int>& avail);
|
||||
void setAvailability(const QVector<int> &avail);
|
||||
void updatePieceColors();
|
||||
void clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user