updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / kdeplasma-applets-driveio / kde46_buildfix.patch
blob81c24386c6a9b1575c7737720d96e0adc3e2ea09
1 diff -ru plasma-applet-sm_driveio/applet.h plasma-applet-sm_driveio-4.6//applet.h
2 --- plasma-applet-sm_driveio/applet.h 2010-09-21 15:48:16.000000000 +0200
3 +++ plasma-applet-sm_driveio-4.6//applet.h 2011-01-29 18:42:29.846668038 +0100
4 @@ -1,5 +1,6 @@
5 /*
6 * Copyright (C) 2007 Petri Damsten <damu@iki.fi>
7 + * Copyright (C) 2010 Michel Lafon-Puyo <michel.lafonpuyo@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Library General Public License version 2 as
11 @@ -27,18 +28,15 @@
12 #define PREFERRED 200
14 class QGraphicsLinearLayout;
15 +class QGraphicsWidget;
17 namespace Plasma {
18 - class Meter;
19 - class SignalPlotter;
20 class Frame;
21 class IconWidget;
24 namespace SM {
26 -class Plotter;
28 class SM_EXPORT Applet : public Plasma::Applet
30 Q_OBJECT
31 @@ -63,12 +61,15 @@
32 qreal preferredItemHeight() { return m_preferredItemHeight; };
33 void setPreferredItemHeight(qreal preferredItemHeight)
34 { m_preferredItemHeight = preferredItemHeight; };
35 - QStringList items() { return m_items; };
36 - void appendItem(const QString& item) { m_items.append(item); };
37 - void setItems(const QStringList& items) { m_items = items; };
38 - void clearItems() { m_items.clear(); };
39 + QStringList sources() { return m_sources; };
40 + void appendSource(const QString& source) { m_sources.append(source); };
41 + void setSources(const QStringList& sources) { m_sources = sources; };
42 + void clearSources() { m_sources.clear(); };
43 + void clear();
45 KConfigGroup config();
46 + void configureLayout();
47 + void removeLayout();
48 void connectToEngine();
49 void connectSource(const QString& source);
50 QStringList connectedSources();
51 @@ -77,8 +78,6 @@
52 QGraphicsLinearLayout* mainLayout();
53 Plasma::DataEngine* engine();
54 void setEngine(Plasma::DataEngine* engine);
55 - QHash<QString, SM::Plotter*> plotters();
56 - void appendPlotter(const QString& source, SM::Plotter* plotter);
57 uint interval();
58 void setInterval(uint interval);
59 QString title();
60 @@ -86,9 +85,11 @@
61 QHash<QString, QString> tooltips() const;
62 void setToolTip(const QString &source, const QString &tipContent);
63 Mode mode();
64 - virtual bool addMeter(const QString&);
65 + QGraphicsWidget* visualization(const QString& source);
66 + virtual bool addVisualization(const QString& source);
67 + void appendVisualization(const QString& source, QGraphicsWidget *visualization);
68 + virtual void deleteVisualizations();
69 void displayNoAvailableSources();
70 - virtual void deleteMeters();
71 virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
73 private:
74 @@ -97,10 +98,10 @@
75 QString m_title;
76 bool m_titleSpacer;
77 Plasma::Frame* m_header;
78 - QStringList m_items;
79 + QStringList m_sources;
80 QStringList m_connectedSources;
81 Plasma::DataEngine *m_engine;
82 - QHash<QString, SM::Plotter*> m_plotters;
83 + QHash<QString, QGraphicsWidget*> m_visualizations;
84 QHash<QString, QString> m_toolTips;
85 Qt::Orientation m_orientation;
86 Plasma::IconWidget *m_noSourcesIcon;
87 diff -ru plasma-applet-sm_driveio/driveio.cpp plasma-applet-sm_driveio-4.6//driveio.cpp
88 --- plasma-applet-sm_driveio/driveio.cpp 2010-09-21 16:22:15.000000000 +0200
89 +++ plasma-applet-sm_driveio-4.6//driveio.cpp 2011-01-29 18:42:29.846668038 +0100
90 @@ -57,7 +57,7 @@
92 KConfigGroup cg = config();
93 setInterval(cg.readEntry("interval", 2.0) * 1000);
94 - setItems(cg.readEntry("drives", m_drives));
95 + setSources(cg.readEntry("drives", m_drives));
96 connectToEngine();
99 @@ -82,7 +82,7 @@
100 m_drives.removeAll(name);
103 -bool SM::Driveio::addMeter(const QString& source)
104 +bool SM::Driveio::addVisualization(const QString& source)
106 QStringList l = source.split('/');
107 if (l.count() < 2) {
108 @@ -94,7 +94,7 @@
109 plotter->setUnit("KiB/s");
110 plotter->setCustomPlots(QList<QColor>() << QColor("#0099ff") << QColor("#91ff00"));
111 //plotter->setStackPlots(false);
112 - appendPlotter(drive, plotter);
113 + appendVisualization(drive, plotter);
114 connectSource("disk/" + drive + "/Rate/rblk");
115 setPreferredItemHeight(80);
116 return true;
117 @@ -114,12 +114,12 @@
119 m_data[drive][index] = qMax(0.0, data["value"].toDouble());
120 if (!m_data[drive].contains(-1)) {
121 - SM::Plotter *plotter = plotters()[drive];
122 + SM::Plotter *plotter = qobject_cast<SM::Plotter*>(visualization(drive));
123 if (plotter) {
124 plotter->addSample(m_data[drive]);
125 if (mode() == SM::Applet::Panel) {
126 setToolTip(drive,
127 - QString("<tr><td>%1</td><td>write</td><td>%2</td><td>read</td><td>%3</td></tr>")
128 + QString("<tr><td rowspan=\"2\">%1</td><td>read</td><td align=\"right\">%2</td><td>KiB/s</td></tr><tr><td>write</td><td align=\"right\">%3</td><td>KiB/s</td></tr>")
129 .arg(plotter->title())
130 .arg(m_data[drive][0], 2, 'f', 0)
131 .arg(m_data[drive][1], 2, 'f', 0));
132 @@ -143,7 +143,7 @@
133 item1->setEditable(false);
134 item1->setCheckable(true);
135 item1->setData(drive);
136 - if (items().contains(drive)) {
137 + if (sources().contains(drive)) {
138 item1->setCheckState(Qt::Checked);
140 parentItem->appendRow(QList<QStandardItem *>() << item1);
141 @@ -163,16 +163,16 @@
142 KConfigGroup cg = config();
143 QStandardItem *parentItem = m_model.invisibleRootItem();
145 - clearItems();
146 + clear();
147 for (int i = 0; i < parentItem->rowCount(); ++i) {
148 QStandardItem *item = parentItem->child(i, 0);
149 if (item) {
150 if (item->checkState() == Qt::Checked) {
151 - appendItem(item->data().toString());
152 + appendSource(item->data().toString());
156 - cg.writeEntry("drives", items());
157 + cg.writeEntry("drives", sources());
159 double interval = ui.intervalSpinBox->value();
160 cg.writeEntry("interval", interval);
161 diff -ru plasma-applet-sm_driveio/driveio.h plasma-applet-sm_driveio-4.6//driveio.h
162 --- plasma-applet-sm_driveio/driveio.h 2010-03-09 02:18:48.000000000 +0100
163 +++ plasma-applet-sm_driveio-4.6//driveio.h 2011-01-29 18:42:29.846668038 +0100
164 @@ -39,7 +39,7 @@
165 ~Driveio();
167 virtual void init();
168 - virtual bool addMeter(const QString&);
169 + virtual bool addVisualization(const QString&);
170 virtual void createConfigurationInterface(KConfigDialog *parent);
172 public slots: