On May 17, 2010, Aaron J. Seigo wrote: Thanks for your comments.
> * using hardcoded colors isn't going to work with all themes; this needs to > use the Plasma::Theme colors in the some way, even if it means expsing more > of > the colors in the color scheme to do so Well, without a patch with my theme they look like grey and grey, which is not very useful. But I don't mind using some theme colors. Are there any colors that can be used for upload and download speed? Optionally I can write a patch to make them configurable. Should I modify this one, or we need to decide something on this patch first and then I write another one to advance it? > * i'd probably overload setPlotCount into setPlotCount(int count) and > setPlotCount(const QList<QColor> &) .. the latter is a bit odd looking, but > it > will result in cleaner code than setPlotCount(int, const QList<QColor> &). Ok. New patch attached. -- Sergey
diff -ur system-monitor/net.cpp system-monitor-new2/net.cpp --- system-monitor/net.cpp 2010-05-17 07:15:02.000000000 +0300 +++ system-monitor-new2/net.cpp 2010-05-19 03:49:13.000000000 +0300 @@ -93,7 +93,8 @@ SM::Plotter *plotter = new SM::Plotter(this); plotter->setTitle(interface); plotter->setUnit("KiB/s"); - plotter->setPlotCount(2); + plotter->setCustomPlots(QList<QColor>() << QColor("#00f000") << QColor("#f00000")); + plotter->setStackPlots(false); appendPlotter(interface, plotter); connectSource("network/interfaces/" + interface + "/receiver/data"); setPreferredItemHeight(80); diff -ur system-monitor/plotter.cpp system-monitor-new2/plotter.cpp --- system-monitor/plotter.cpp 2010-05-17 07:15:02.000000000 +0300 +++ system-monitor-new2/plotter.cpp 2010-05-19 03:48:34.000000000 +0300 @@ -102,6 +102,11 @@ m_plotter->scale(scale); } +void Plotter::setStackPlots(bool stack) +{ + m_plotter->setStackPlots(stack); +} + void Plotter::setPlotCount(int count) { for (int i = 0; i < m_plotCount; ++i) { @@ -117,6 +122,17 @@ } } +void Plotter::setCustomPlots(const QList<QColor>& colors) +{ + for (int i = 0; i < m_plotCount; ++i) { + m_plotter->removePlot(0); + } + m_plotCount = colors.count(); + foreach (QColor color, colors) { + m_plotter->addPlot(color); + } +} + void Plotter::createWidgets() { m_layout = new QGraphicsLinearLayout(Qt::Horizontal); diff -ur system-monitor/plotter.h system-monitor-new2/plotter.h --- system-monitor/plotter.h 2010-05-17 07:15:02.000000000 +0300 +++ system-monitor-new2/plotter.h 2010-05-19 03:44:04.000000000 +0300 @@ -47,7 +47,9 @@ void setTitle(const QString& title); void setUnit(const QString& unit); void setPlotCount(int count); + void setCustomPlots(const QList<QColor>& colors); void setScale(qreal scale); + void setStackPlots(bool stack); protected slots: void themeChanged();
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel