[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/solid
From: Kevin Ottens <ervin () kde ! org>
Date: 2007-04-30 20:59:58
Message-ID: 1177966798.740297.18192.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 659814 by ervin:
Cleanup Processor as discussed with Danny.
M +2 -2 solid/backends/fakehw/fakecomputer.xml
M +4 -5 solid/backends/fakehw/fakeprocessor.cpp
M +2 -2 solid/backends/fakehw/fakeprocessor.h
M +6 -4 solid/backends/hal/halprocessor.cpp
M +2 -2 solid/backends/hal/halprocessor.h
M +6 -6 solid/ifaces/processor.h
M +3 -3 solid/processor.cpp
M +7 -7 solid/processor.h
M +1 -1 tests/fakehardwaretest.cpp
M +7 -7 tests/solidhwtest.cpp
--- trunk/KDE/kdelibs/solid/solid/backends/fakehw/fakecomputer.xml #659813:659814
@@ -78,7 +78,7 @@
<property key="parent">/org/kde/solid/fakehw/computer</property>
<property key="number">0</property>
<property key="maxSpeed">3200</property>
- <property key="canThrottle">true</property>
+ <property key="canChangeFrequency">true</property>
</device>
<device udi="/org/kde/solid/fakehw/acpi_CPU1">
<property key="name">Solid Processor #1</property>
@@ -87,7 +87,7 @@
<property key="parent">/org/kde/solid/fakehw/computer</property>
<property key="number">1</property>
<property key="maxSpeed">3200</property>
- <property key="canThrottle">true</property>
+ <property key="canChangeFrequency">true</property>
</device>
--- trunk/KDE/kdelibs/solid/solid/backends/fakehw/fakeprocessor.cpp #659813:659814
@@ -22,7 +22,6 @@
FakeProcessor::FakeProcessor(FakeDevice *device)
: FakeDeviceInterface(device)
{
-
}
FakeProcessor::~FakeProcessor()
@@ -34,14 +33,14 @@
return fakeDevice()->property("number").toInt();
}
-qulonglong FakeProcessor::maxSpeed() const
+int FakeProcessor::maxSpeed() const
{
- return fakeDevice()->property("maxSpeed").toULongLong();
+ return fakeDevice()->property("maxSpeed").toInt();
}
-bool FakeProcessor::canThrottle() const
+bool FakeProcessor::canChangeFrequency() const
{
- return fakeDevice()->property("canThrottle").toBool();
+ return fakeDevice()->property("canChangeFrequency").toBool();
}
#include "backends/fakehw/fakeprocessor.moc"
--- trunk/KDE/kdelibs/solid/solid/backends/fakehw/fakeprocessor.h #659813:659814
@@ -33,8 +33,8 @@
public Q_SLOTS:
virtual int number() const;
- virtual qulonglong maxSpeed() const;
- virtual bool canThrottle() const;
+ virtual int maxSpeed() const;
+ virtual bool canChangeFrequency() const;
};
#endif
--- trunk/KDE/kdelibs/solid/solid/backends/hal/halprocessor.cpp #659813:659814
@@ -37,14 +37,16 @@
return m_device->property("processor.number").toInt();
}
-qulonglong Processor::maxSpeed() const
+int Processor::maxSpeed() const
{
- return m_device->property("processor.maximum_speed").toULongLong();
+ // the property is not mandatory in HAL
+ return m_device->property("processor.maximum_speed").toInt();
}
-bool Processor::canThrottle() const
+bool Processor::canChangeFrequency() const
{
- return m_device->property("processor.can_throttle").toBool();
+ // dummy for now, need some changes in HAL!
+ return false;
}
#include "backends/hal/halprocessor.moc"
--- trunk/KDE/kdelibs/solid/solid/backends/hal/halprocessor.h #659813:659814
@@ -35,8 +35,8 @@
virtual ~Processor();
virtual int number() const;
- virtual qulonglong maxSpeed() const;
- virtual bool canThrottle() const;
+ virtual int maxSpeed() const;
+ virtual bool canChangeFrequency() const;
};
#endif
--- trunk/KDE/kdelibs/solid/solid/ifaces/processor.h #659813:659814
@@ -49,17 +49,17 @@
*
* @return the maximum speed in MHz
*/
- virtual qulonglong maxSpeed() const = 0;
+ virtual int maxSpeed() const = 0;
/**
- * Indicates if the processor can throttle.
+ * Indicates if the processor can change the CPU frequency.
*
- * A processor supports throttling when it's able of decreasing
- * it's own clockspeed (generally for power management).
+ * True if a processor is able to change it's own CPU frequency.
+ * (generally for power management).
*
- * @return true if the processor can throttle, false otherwise
+ * @return true if the processor can change CPU frequency, false otherwise
*/
- virtual bool canThrottle() const = 0;
+ virtual bool canChangeFrequency() const = 0;
};
}
}
--- trunk/KDE/kdelibs/solid/solid/processor.cpp #659813:659814
@@ -40,16 +40,16 @@
return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), 0, number());
}
-qulonglong Solid::Processor::maxSpeed() const
+int Solid::Processor::maxSpeed() const
{
Q_D(const Processor);
return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), 0, maxSpeed());
}
-bool Solid::Processor::canThrottle() const
+bool Solid::Processor::canChangeFrequency() const
{
Q_D(const Processor);
- return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), false, \
canThrottle()); + return_SOLID_CALL(Ifaces::Processor *, d->backendObject(), \
false, canChangeFrequency()); }
#include "processor.moc"
--- trunk/KDE/kdelibs/solid/solid/processor.h #659813:659814
@@ -36,7 +36,7 @@
Q_OBJECT
Q_PROPERTY(int number READ number)
Q_PROPERTY(qulonglong maxSpeed READ maxSpeed)
- Q_PROPERTY(bool canThrottle READ canThrottle)
+ Q_PROPERTY(bool canChangeFrequency READ canChangeFrequency)
Q_DECLARE_PRIVATE(Processor)
public:
@@ -76,17 +76,17 @@
*
* @return the maximum speed in MHz
*/
- qulonglong maxSpeed() const;
+ int maxSpeed() const;
/**
- * Indicates if the processor can throttle.
+ * Indicates if the processor can change the CPU frequency.
*
- * A processor supports throttling when it's able of decreasing
- * it's own clockspeed (generally for power management).
+ * True if a processor is able to change it's own CPU frequency.
+ * (generally for power management).
*
- * @return true if the processor can throttle, false otherwise
+ * @return true if the processor can change CPU frequency, false otherwise
*/
- bool canThrottle() const;
+ bool canChangeFrequency() const;
};
}
--- trunk/KDE/kdelibs/solid/tests/fakehardwaretest.cpp #659813:659814
@@ -60,7 +60,7 @@
Solid::Ifaces::Processor *processor = qobject_cast<Solid::Ifaces::Processor \
*>(interface);
QCOMPARE(processor->number(), 0);
- QCOMPARE(processor->canThrottle(), true);
+ QCOMPARE(processor->canChangeFrequency(), true);
QCOMPARE((int)processor->maxSpeed(), 3200);
}
--- trunk/KDE/kdelibs/solid/tests/solidhwtest.cpp #659813:659814
@@ -325,14 +325,14 @@
Solid::Device dev("/org/kde/solid/fakehw/acpi_CPU0");
Solid::Predicate p1 = Solid::Predicate(Solid::DeviceInterface::Processor, \
"maxSpeed", 3200)
- & Solid::Predicate(Solid::DeviceInterface::Processor, \
"canThrottle", true); + & \
Solid::Predicate(Solid::DeviceInterface::Processor, \
"canChangeFrequency", true);
Solid::Predicate p2 = Solid::Predicate(Solid::DeviceInterface::Processor, \
"maxSpeed", 3200)
- & Solid::Predicate(Solid::DeviceInterface::Processor, \
"canThrottle", false); + & \
Solid::Predicate(Solid::DeviceInterface::Processor, \
"canChangeFrequency", false);
Solid::Predicate p3 = Solid::Predicate(Solid::DeviceInterface::Processor, \
"maxSpeed", 3201)
- | Solid::Predicate(Solid::DeviceInterface::Processor, \
"canThrottle", true); + | \
Solid::Predicate(Solid::DeviceInterface::Processor, \
"canChangeFrequency", true);
Solid::Predicate p4 = Solid::Predicate(Solid::DeviceInterface::Processor, \
"maxSpeed", 3201)
- | Solid::Predicate(Solid::DeviceInterface::Processor, \
"canThrottle", false);
- Solid::Predicate p5 = Solid::Predicate::fromString("[[Processor.maxSpeed == 3201 \
AND Processor.canThrottle == false] OR StorageVolume.mountPoint == '/media/blup']"); \
+ | Solid::Predicate(Solid::DeviceInterface::Processor, \
"canChangeFrequency", false); + Solid::Predicate p5 = \
Solid::Predicate::fromString("[[Processor.maxSpeed == 3201 AND \
Processor.canChangeFrequency == false] OR StorageVolume.mountPoint == \
'/media/blup']");
QVERIFY(p1.matches(dev));
QVERIFY(!p2.matches(dev));
@@ -358,7 +358,7 @@
QVERIFY(!p9.matches(dev));
QVERIFY(p10.matches(dev));
- QString str_pred = "[[Processor.maxSpeed == 3201 AND Processor.canThrottle == \
false] OR StorageVolume.mountPoint == '/media/blup']"; + QString str_pred = \
"[[Processor.maxSpeed == 3201 AND Processor.canChangeFrequency == false] OR \
StorageVolume.mountPoint == '/media/blup']";
// Since str_pred is canonicalized, fromString().toString() should be invariant
QCOMPARE(Solid::Predicate::fromString(str_pred).toString(), str_pred);
@@ -400,7 +400,7 @@
list = Solid::Device::listFromQuery(p4, parentUdi);
QCOMPARE(list.size(), 0);
- list = Solid::Device::listFromQuery("[Processor.canThrottle==true AND \
Processor.number==1]", + list = \
Solid::Device::listFromQuery("[Processor.canChangeFrequency==true AND \
Processor.number==1]", parentUdi);
QCOMPARE(list.size(), 1);
QCOMPARE(list.at(0).udi(), QString("/org/kde/solid/fakehw/acpi_CPU1"));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic