Commit 43132c7b authored by Joris Guisson's avatar Joris Guisson
Browse files

Merged rev 778996 and 778998 (stats plugin fixes)


svn path=/branches/ktorrent/3.0/; revision=779673
parent b7bd126b
......@@ -5,6 +5,8 @@ Changes in 3.0.1 :
- Fix hidden_on_exit (158273)
- Add pause resume option to system tray icon (158278)
- Added XFS cmake checks for XFS delayed allocation
- Fix zeroing average speeds on BOTH charts after choosing to reset ONLY one
in stats plugin
Changes in 3.O :
- Fix sorting of upload and download rate (157939)
......
......@@ -207,7 +207,7 @@ void ConnsTabPage::GatherData(Plugin * pPlug)
}
}
void ConnsTabPage::ResetAvg()
void ConnsTabPage::ResetAvg(ChartDrawer *)
{
}
......
......@@ -95,7 +95,7 @@ class ConnsTabPage : public PluginPage
void ApplySettings();
void UpdateAllCharts();
void GatherData(Plugin *);
void ResetAvg();
void ResetAvg(ChartDrawer *);
};
} // ns end
......
......@@ -24,6 +24,7 @@
#include <utility>
#include <interfaces/plugin.h>
#include <drawer/ChartDrawer.h>
namespace kt {
......@@ -64,7 +65,7 @@ class PluginPage : public QWidget
*/
virtual void GatherData(Plugin * pP) = 0;
///Resets average
virtual void ResetAvg() = 0;
virtual void ResetAvg(ChartDrawer *) = 0;
};
} // ns end
......
......@@ -30,11 +30,20 @@ SpdTabPage::SpdTabPage(QWidget *p) : PluginPage(p), pmUiSpd(new Ui::SpdWgt), mDl
pmDlChtWgt.reset(new PlainChartDrawer(this));
pmPeersChtWgt.reset(new PlainChartDrawer(this));
pmUlChtWgt.reset(new PlainChartDrawer(this));
connect( dynamic_cast<PlainChartDrawer *>(pmDlChtWgt.get()), SIGNAL(Zeroed(ChartDrawer *)), this, SLOT(ResetAvg(ChartDrawer *)));
connect( dynamic_cast<PlainChartDrawer *>(pmUlChtWgt.get()), SIGNAL(Zeroed(ChartDrawer *)), this, SLOT(ResetAvg(ChartDrawer *)));
} else if(StatsPluginSettings::widgetType() == 1) {
pmDlChtWgt.reset(new KPlotWgtDrawer(this));
pmPeersChtWgt.reset(new KPlotWgtDrawer(this));
pmUlChtWgt.reset(new KPlotWgtDrawer(this));
}
connect( dynamic_cast<KPlotWgtDrawer *>(pmDlChtWgt.get()), SIGNAL(Zeroed(ChartDrawer *)), this, SLOT(ResetAvg(ChartDrawer *)));
connect( dynamic_cast<KPlotWgtDrawer *>(pmUlChtWgt.get()), SIGNAL(Zeroed(ChartDrawer *)), this, SLOT(ResetAvg(ChartDrawer *)));
}
SetupUi();
}
......@@ -212,10 +221,24 @@ void SpdTabPage::GatherData(Plugin * pPlug)
GatherUlSpeed(pPlug);
}
void SpdTabPage::ResetAvg()
void SpdTabPage::ResetAvg(ChartDrawer * c)
{
mDlAvg = std::make_pair(0,0);
mUlAvg = std::make_pair(0,0);
if(!c)
{
return;
}
else if(c == pmDlChtWgt.get())
{
mDlAvg = std::make_pair(0,0);
}
else if(c == pmUlChtWgt.get())
{
mUlAvg = std::make_pair(0,0);
}
else
{
qDebug("Got unreckognized widget!");
}
}
} //ns e
......@@ -101,7 +101,7 @@ class SpdTabPage : public PluginPage
void ApplySettings();
void UpdateAllCharts();
void GatherData(Plugin *);
void ResetAvg();
void ResetAvg(ChartDrawer *);
};
} //ns end
......
......@@ -189,7 +189,29 @@ void KPlotWgtDrawer::Zero (const size_t idx)
return;
}
std::list<buff_t::iterator> lb;
//iteration through elements to-be-removed is EVIL
for(buff_t::iterator it = pmBuff -> begin();
it != pmBuff -> end();
it++)
{
if( it -> first == idx)
{
lb.push_back(it);
}
}
//EVIL I SAY!
for(std::list<buff_t::iterator>::iterator it = lb.begin();
it != lb.end();
it++)
{
pmBuff -> erase(*it);
}
kpol[idx] -> clearPoints();
FindSetMax();
}
void KPlotWgtDrawer::ZeroAll()
......@@ -199,7 +221,7 @@ void KPlotWgtDrawer::ZeroAll()
Zero(i);
}
pmBuff -> clear();
emit Zeroed(this);
}
void KPlotWgtDrawer::SetUnitName(const QString & rN)
......@@ -369,10 +391,6 @@ void KPlotWgtDrawer::MakeCtxMenu()
QAction * rst = pmCtxMenu -> addAction(i18n("Reset"));
connect(rst, SIGNAL(triggered ( bool )), this, SLOT(ZeroAll()));
if(parent() != 0)
{
connect(rst, SIGNAL(triggered ( bool )), parent(), SLOT(ResetAvg()));
}
}
void KPlotWgtDrawer::ShowCtxMenu(const QPoint & pos)
......
......@@ -120,7 +120,8 @@ class KPlotWgtDrawer : public KPlotWidget, public ChartDrawer
void ShowCtxMenu(const QPoint & rP);
void RenderToImage();
signals:
void Zeroed(ChartDrawer *);
};
......
......@@ -331,10 +331,6 @@ void PlainChartDrawer::MakeCtxMenu()
QAction * rst = pmCtxMenu -> addAction(i18n("Reset"));
connect(rst, SIGNAL(triggered ( bool )), this, SLOT(ZeroAll()));
if(parent() != 0)
{
connect(rst, SIGNAL(triggered ( bool )), parent(), SLOT(ResetAvg()));
}
}
void PlainChartDrawer::ShowCtxMenu(const QPoint & pos)
......@@ -431,6 +427,7 @@ void PlainChartDrawer::ZeroAll ()
}
FindSetMax();
emit Zeroed(this);
}
void PlainChartDrawer::SetMaxMode (const MaxMode mm)
......
......@@ -146,7 +146,9 @@ class PlainChartDrawer : public QFrame, public ChartDrawer
void EnableAntiAlias (const bool aa);
void EnableBgdGrid(bool bg);
signals:
void Zeroed(ChartDrawer *);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment