You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
139 lines
4.4 KiB
139 lines
4.4 KiB
15 years ago
|
/***************************************************************************
|
||
|
* Copyright © 2007 by Krzysztof Kundzicz *
|
||
|
* athantor@gmail.com *
|
||
|
* *
|
||
|
* This program is free software; you can redistribute it and/or modify *
|
||
|
* it under the terms of the GNU General Public License as published by *
|
||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||
|
* (at your option) any later version. *
|
||
|
* *
|
||
|
* This program is distributed in the hope that it will be useful, *
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||
|
* GNU General Public License for more details. *
|
||
|
* *
|
||
|
* You should have received a copy of the GNU General Public License *
|
||
|
* along with this program; if not, write to the *
|
||
|
* Free Software Foundation, Inc., *
|
||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||
|
***************************************************************************/
|
||
|
|
||
|
#include "StatsSpd.h"
|
||
|
|
||
|
namespace kt {
|
||
|
|
||
14 years ago
|
StatsSpd::StatsSpd(TQWidget *p) : StatsSpdWgt(p),
|
||
15 years ago
|
pmDownCht(new ChartDrawer(DownSpeedGbw, StatsPluginSettings::downloadMeasurements())),
|
||
|
pmPeersSpdCht(new ChartDrawer(PeersSpdGbw, StatsPluginSettings::peersSpeedMeasurements())),
|
||
|
pmUpCht(new ChartDrawer(UpSpeedGbw, StatsPluginSettings::uploadMeasurements()))
|
||
|
{
|
||
|
|
||
|
DownSpeedGbw->setColumnLayout(0, Qt::Vertical );
|
||
13 years ago
|
DownSpeedGbw->layout()->setSpacing( 6 );
|
||
|
DownSpeedGbw->layout()->setMargin( 11 );
|
||
15 years ago
|
|
||
13 years ago
|
pmDSpdLay = new TQVBoxLayout(DownSpeedGbw -> layout());
|
||
15 years ago
|
|
||
|
UpSpeedGbw->setColumnLayout(0, Qt::Vertical );
|
||
13 years ago
|
UpSpeedGbw->layout()->setSpacing( 6 );
|
||
|
UpSpeedGbw->layout()->setMargin( 11 );
|
||
15 years ago
|
|
||
13 years ago
|
pmUSpdLay = new TQVBoxLayout(UpSpeedGbw -> layout());
|
||
15 years ago
|
|
||
|
PeersSpdGbw->setColumnLayout(0, Qt::Vertical );
|
||
13 years ago
|
PeersSpdGbw->layout()->setSpacing( 6 );
|
||
|
PeersSpdGbw->layout()->setMargin( 11 );
|
||
15 years ago
|
|
||
13 years ago
|
pmPeersSpdLay = new TQVBoxLayout(PeersSpdGbw -> layout());
|
||
15 years ago
|
|
||
|
//-----------------
|
||
|
|
||
|
pmUSpdLay -> addWidget(pmUpCht);
|
||
|
pmDSpdLay -> addWidget(pmDownCht);
|
||
|
pmPeersSpdLay -> addWidget(pmPeersSpdCht);
|
||
|
|
||
|
// ----------------
|
||
|
|
||
14 years ago
|
pmUpCht -> AddValuesCnt(TQPen("#f00"), i18n("Current"));
|
||
|
pmDownCht -> AddValuesCnt(TQPen("#f00"), i18n("Current"));
|
||
15 years ago
|
|
||
14 years ago
|
pmUpCht -> AddValuesCnt(TQPen("#00f"), i18n("Average"));
|
||
|
pmDownCht -> AddValuesCnt(TQPen("#00f"), i18n("Average"));
|
||
15 years ago
|
|
||
|
pmUpCht -> AddValuesCnt(i18n("Limit"), 0);
|
||
|
pmDownCht -> AddValuesCnt(i18n("Limit"), 0);
|
||
|
|
||
14 years ago
|
// pmUpCht -> AddValuesCnt(TQPen("#f0f"), i18n("Current torrent"));
|
||
|
// pmDownCht -> AddValuesCnt(TQPen("#f0f"), i18n("Current torrent"));
|
||
15 years ago
|
//
|
||
|
|
||
|
|
||
14 years ago
|
pmPeersSpdCht -> AddValuesCnt(TQPen("#090"), i18n("Average from leecher"));
|
||
|
pmPeersSpdCht -> AddValuesCnt(TQPen("#f00"), i18n("Average to leecher"));
|
||
|
pmPeersSpdCht -> AddValuesCnt(TQPen("#00f"), i18n("Average from seeder"));
|
||
|
pmPeersSpdCht -> AddValuesCnt(TQPen("magenta"), i18n("From leechers"));
|
||
|
pmPeersSpdCht -> AddValuesCnt(TQPen("orange"), i18n("From seeders"));
|
||
15 years ago
|
|
||
|
}
|
||
|
|
||
|
StatsSpd::~StatsSpd()
|
||
|
{
|
||
|
delete pmUpCht;
|
||
|
delete pmDownCht;
|
||
|
delete pmPeersSpdCht;
|
||
|
|
||
|
delete pmUSpdLay;
|
||
|
delete pmDSpdLay;
|
||
|
delete pmPeersSpdLay;
|
||
|
|
||
|
}
|
||
|
|
||
|
void StatsSpd::AddUpSpdVal(const size_t idx, const double val)
|
||
|
{
|
||
|
pmUpCht -> AddValue(idx, val, false);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::AddDownSpdVal(const size_t idx, const double val)
|
||
|
{
|
||
|
pmDownCht -> AddValue(idx, val , false);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::AddPeersSpdVal(const size_t idx, const double val)
|
||
|
{
|
||
|
pmPeersSpdCht -> AddValue(idx, val , false);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::UpdateCharts()
|
||
|
{
|
||
|
pmUpCht -> update();
|
||
|
pmDownCht -> update();
|
||
|
pmPeersSpdCht -> update();
|
||
|
}
|
||
|
|
||
|
void StatsSpd::ChangeDownMsmtCnt(const size_t cnt)
|
||
|
{
|
||
|
pmDownCht -> SetXMax(cnt);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::ChangePrsSpdMsmtCnt(const size_t cnt)
|
||
|
{
|
||
|
pmPeersSpdCht -> SetXMax(cnt);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::ChangeUpMsmtCnt(const size_t cnt)
|
||
|
{
|
||
|
pmUpCht -> SetXMax(cnt);
|
||
|
}
|
||
|
|
||
|
void StatsSpd::ChangeChartsMaxMode(const ChartDrawer::MaxMode mm)
|
||
|
{
|
||
|
pmUpCht -> SetMaxMode(mm);
|
||
|
pmDownCht -> SetMaxMode(mm);
|
||
|
pmPeersSpdCht -> SetMaxMode(mm);
|
||
|
}
|
||
|
|
||
|
|
||
|
} //NS end
|
||
|
|
||
|
#include "StatsSpd.moc"
|