[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-hardware-devel
Subject:    [Kde-hardware-devel] Patch to AccessPoint
From:       "Christopher Blauvelt" <cblauvelt () gmail ! com>
Date:       2008-05-14 4:07:16
Message-ID: ffa898c90805132107j4c054f39ja3e36a91071ea137 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Attached is a patch that allows AccessPoints to be compared by their signal
strength.  This allows an AccessPointList to be sorted and itemmodels that
contain them to sort them.  Does anyone have any objections?
Chris

[Attachment #5 (text/html)]

Attached is a patch that allows AccessPoints to be compared by their signal \
strength.&nbsp; This allows an AccessPointList to be sorted and itemmodels that \
contain them to sort them.&nbsp; Does anyone have any objections?<br>Chris<br>


["comparison_operators.diff" (text/x-patch)]

Index: wirelessaccesspoint.h
===================================================================
--- wirelessaccesspoint.h	(revision 807590)
+++ wirelessaccesspoint.h	(working copy)
@@ -122,6 +122,27 @@
          */
         int signalStrength() const;
 
+        /**
+         * Compares signal strength
+         *
+         * @return true if this access point has a weaker signal than other, otherwise false
+         */
+        bool operator<(const AccessPoint &other) const;
+
+        /**
+         * Compares signal strength
+         *
+         * @return true if this access point has a stronger signal than other, otherwise false
+         */
+        bool operator>(const AccessPoint &other) const;
+
+        /**
+         * Compares signal strength
+         *
+         * @return true if this access point has an equal signal strength as other, otherwise false
+         */
+        bool operator==(const AccessPoint &other) const;
+
     protected:
         /**
          * This signal is emitted when the signal strength of this network has changed.
Index: wirelessaccesspoint.cpp
===================================================================
--- wirelessaccesspoint.cpp	(revision 807590)
+++ wirelessaccesspoint.cpp	(working copy)
@@ -135,6 +135,21 @@
     return_SOLID_CALL(Ifaces::AccessPoint *, d->backendObject(), 0, signalStrength());
 }
 
+bool Solid::Control::AccessPoint::operator<(const AccessPoint &other) const
+{
+    return this->signalStrength() < other.signalStrength();
+}
+
+bool Solid::Control::AccessPoint::operator>(const AccessPoint &other) const
+{
+    return this->signalStrength() > other.signalStrength();
+}
+
+bool Solid::Control::AccessPoint::operator==(const AccessPoint &other) const
+{
+    return this->signalStrength() == other.signalStrength();
+}
+
 void Solid::Control::AccessPointPrivate::setBackendObject(QObject *object)
 {
     FrontendObjectPrivate::setBackendObject(object);


_______________________________________________
Kde-hardware-devel mailing list
Kde-hardware-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-hardware-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic