Browse Source

Code clean up

adaptive-webui-19844
Christophe Dumez 13 years ago
parent
commit
28ba0c25a7
  1. 6
      src/properties/downloadedpiecesbar.cpp
  2. 7
      src/properties/pieceavailabilitybar.cpp

6
src/properties/downloadedpiecesbar.cpp

@ -48,7 +48,7 @@ std::vector<float> DownloadedPiecesBar::bitfieldToFloatVector(const libtorrent:: @@ -48,7 +48,7 @@ std::vector<float> DownloadedPiecesBar::bitfieldToFloatVector(const libtorrent::
{
std::vector<float> result(reqSize, 0.0);
if (vecin.size() == 0)
if (vecin.empty())
return result;
const float ratio = vecin.size() / (float)reqSize;
@ -121,7 +121,7 @@ std::vector<float> DownloadedPiecesBar::bitfieldToFloatVector(const libtorrent:: @@ -121,7 +121,7 @@ std::vector<float> DownloadedPiecesBar::bitfieldToFloatVector(const libtorrent::
// normalization <0, 1>
value /= ratio;
// float precision sometimes gives > 1, bacause in not possible to store irrational numbers
// float precision sometimes gives > 1, because in not possible to store irrational numbers
value = qMin(value, (float)1.0);
result[x] = value;
@ -151,7 +151,7 @@ int DownloadedPiecesBar::mixTwoColors(int &rgb1, int &rgb2, float ratio) @@ -151,7 +151,7 @@ int DownloadedPiecesBar::mixTwoColors(int &rgb1, int &rgb2, float ratio)
void DownloadedPiecesBar::updateImage()
{
// qDebug() << "updateImage";
// qDebug() << "updateImage";
QImage image2(width() - 2, 1, QImage::Format_RGB888);
if (pieces.empty()) {

7
src/properties/pieceavailabilitybar.cpp

@ -48,7 +48,7 @@ std::vector<float> PieceAvailabilityBar::intToFloatVector(const std::vector<int> @@ -48,7 +48,7 @@ std::vector<float> PieceAvailabilityBar::intToFloatVector(const std::vector<int>
{
std::vector<float> result(reqSize, 0.0);
if (vecin.size() == 0)
if (vecin.empty())
return result;
const float ratio = vecin.size() / (float)reqSize;
@ -130,7 +130,7 @@ std::vector<float> PieceAvailabilityBar::intToFloatVector(const std::vector<int> @@ -130,7 +130,7 @@ std::vector<float> PieceAvailabilityBar::intToFloatVector(const std::vector<int>
// normalization <0, 1>
value /= ratio * maxElement;
// float precision sometimes gives > 1, bacause in not possible to store irrational numbers
// float precision sometimes gives > 1, because in not possible to store irrational numbers
value = qMin(value, (float)1.0);
result[x] = value;
@ -159,7 +159,7 @@ int PieceAvailabilityBar::mixTwoColors(int &rgb1, int &rgb2, float ratio) @@ -159,7 +159,7 @@ int PieceAvailabilityBar::mixTwoColors(int &rgb1, int &rgb2, float ratio)
void PieceAvailabilityBar::updateImage()
{
// qDebug() << "updateImageAv";
// qDebug() << "updateImageAv";
QImage image2(width() - 2, 1, QImage::Format_RGB888);
if (pieces.empty()) {
@ -235,3 +235,4 @@ void PieceAvailabilityBar::setColors(int background, int border, int available) @@ -235,3 +235,4 @@ void PieceAvailabilityBar::setColors(int background, int border, int available)
updateImage();
update();
}

Loading…
Cancel
Save