summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/interfaces
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/interfaces') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h19
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp62
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.h48
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetup.ui26
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.h1
6 files changed, 92 insertions, 66 deletions
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index e4f405e..4129b3d 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -43,5 +43,5 @@ void Interface::setAttached(bool isAttached){
* emit updateInterface
*/
-void Interface::setHardwareName(QString name){
+void Interface::setHardwareName(const QString &name){
hardwareName = name;
emit(updateInterface(this));
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index fc064fe..989d6d8 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -16,19 +16,18 @@ signals:
public:
Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
- virtual ~Interface(){};
- virtual QString getInterfaceName(){ QString n(this->name()); return n; };
+ QString getInterfaceName(){ QString n(this->name()); return n; };
- virtual bool getStatus(){ return status; };
- virtual void setStatus(bool newStatus);
+ bool getStatus(){ return status; };
+ void setStatus(bool newStatus);
- virtual bool isAttached(){ return attached; };
- virtual void setAttached(bool isAttached=false);
+ bool isAttached(){ return attached; };
+ void setAttached(bool isAttached=false);
- virtual QString getHardwareName(){ return hardwareName; };
- virtual void setHardwareName(QString name="Unknown");
+ QString getHardwareName(){ return hardwareName; };
+ void setHardwareName(const QString &name="Unknown");
- virtual Module* getModuleOwner(){ return moduleOwner; };
- virtual void setModuleOwner(Module *owner=NULL);
+ Module* getModuleOwner(){ return moduleOwner; };
+ void setModuleOwner(Module *owner=NULL);
// inet information.
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index f1b8067..708f399 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -71,5 +71,5 @@ QStringList Interfaces::getInterfaceList(){
* @return true is interface is in auto
*/
-bool Interfaces::isAuto(QString interface){
+bool Interfaces::isAuto(const QString &interface){
QStringList autoLines = interfaces.grep(QRegExp(AUTO));
QStringList awi = autoLines.grep(QRegExp(interface));
@@ -87,5 +87,5 @@ bool Interfaces::isAuto(QString interface){
* @return false if already set to setAuto.
* */
-bool Interfaces::setAuto(QString interface, bool setAuto){
+bool Interfaces::setAuto(const QString &interface, bool setAuto){
// Don't need to set it if it is already set.
if(isAuto(interface) == setAuto)
@@ -157,11 +157,11 @@ bool Interfaces::isInterfaceSet(){
* @return true if successfull.
*/
-bool Interfaces::addInterface(QString interface, QString family, QString method){
+bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
if(acceptedFamily.contains(family)==0)
return false;
- interface = interface.simplifyWhiteSpace();
- interface = interface.replace(QRegExp(" "), "");
+ QString newInterface = interface.simplifyWhiteSpace();
+ newInterface = newInterface.replace(QRegExp(" "), "");
interfaces.append("");
- interfaces.append(QString(IFACE " %1 %2 %3").arg(interface).arg(family).arg(method));
+ interfaces.append(QString(IFACE " %1 %2 %3").arg(newInterface).arg(family).arg(method));
return true;
}
@@ -172,5 +172,5 @@ bool Interfaces::addInterface(QString interface, QString family, QString method)
* @return bool true if successfull
*/
-bool Interfaces::copyInterface(QString interface, QString newInterface){
+bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
if(!setInterface(interface)) return false;
@@ -281,11 +281,11 @@ QString Interfaces::getInterfaceMethod(bool &error){
* @return bool true if successfull.
*/
-bool Interfaces::setInterfaceName(QString newName){
+bool Interfaces::setInterfaceName(const QString &newName){
if(currentIface == interfaces.end())
return false;
- newName = newName.simplifyWhiteSpace();
- newName = newName.replace(QRegExp(" "), "");
+ QString name = newName.simplifyWhiteSpace();
+ name = name.replace(QRegExp(" "), "");
bool returnValue = false;
- (*currentIface) = QString("iface %1 %2 %3").arg(newName).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
+ (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
return !returnValue;
}
@@ -297,5 +297,5 @@ bool Interfaces::setInterfaceName(QString newName){
* @return bool true if successfull.
*/
-bool Interfaces::setInterfaceFamily(QString newName){
+bool Interfaces::setInterfaceFamily(const QString &newName){
if(currentIface == interfaces.end())
return false;
@@ -312,5 +312,5 @@ bool Interfaces::setInterfaceFamily(QString newName){
* @return bool true if successfull.
*/
-bool Interfaces::setInterfaceMethod(QString newName){
+bool Interfaces::setInterfaceMethod(const QString &newName){
if(currentIface == interfaces.end())
return false;
@@ -330,5 +330,5 @@ bool Interfaces::setInterfaceMethod(QString newName){
* @return QString the options value. QString::null if error == true
*/
-QString Interfaces::getInterfaceOption(QString option, bool &error){
+QString Interfaces::getInterfaceOption(const QString &option, bool &error){
return getOption(currentIface, option, error);
}
@@ -342,5 +342,5 @@ QString Interfaces::getInterfaceOption(QString option, bool &error){
* @return QString the options value. QString::null if error == true
*/
-bool Interfaces::setInterfaceOption(QString option, QString value){
+bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
return setOption(currentIface, option, value);
}
@@ -353,5 +353,5 @@ bool Interfaces::setInterfaceOption(QString option, QString value){
* @return QString the options value. QString::null if error == true
*/
-bool Interfaces::removeInterfaceOption(QString option, QString value){
+bool Interfaces::removeInterfaceOption(const QString &option, const QString &value){
return removeOption(currentIface, option, value);
}
@@ -372,8 +372,8 @@ bool Interfaces::removeAllInterfaceOptions(){
* @return bool true if it is successfull.
*/
-bool Interfaces::setMapping(QString interface){
- interface = interface.simplifyWhiteSpace();
- interface = interface.replace(QRegExp(" "), "");
- return setStanza(MAPPING, interface, currentMapping);
+bool Interfaces::setMapping(const QString &interface){
+ QString interfaceName = interface.simplifyWhiteSpace();
+ interfaceName = interfaceName.replace(QRegExp(" "), "");
+ return setStanza(MAPPING, interfaceName, currentMapping);
}
@@ -382,5 +382,5 @@ bool Interfaces::setMapping(QString interface){
* @param interface the name(s) of the interfaces to set to this mapping
*/
-void Interfaces::addMapping(QString option){
+void Interfaces::addMapping(const QString &option){
interfaces.append("");
interfaces.append(QString(MAPPING " %1").arg(option));
@@ -404,5 +404,5 @@ bool Interfaces::removeMapping(){
* @return bool true if it is successfull.
*/
-bool Interfaces::setMap(QString map, QString value){
+bool Interfaces::setMap(const QString &map, const QString &value){
return setOption(currentMapping, map, value);
}
@@ -414,5 +414,5 @@ bool Interfaces::setMap(QString map, QString value){
* @return bool true if it is successfull.
*/
-bool Interfaces::removeMap(QString map, QString value){
+bool Interfaces::removeMap(const QString &map, const QString &value){
return removeOption(currentMapping, map, value);
}
@@ -424,5 +424,5 @@ bool Interfaces::removeMap(QString map, QString value){
* @return value that goes to the map
*/
-QString Interfaces::getMap(QString map, bool &error){
+QString Interfaces::getMap(const QString &map, bool &error){
return getOption(currentMapping, map, error);
}
@@ -433,5 +433,5 @@ QString Interfaces::getMap(QString map, bool &error){
* @return true if successfull.
*/
-bool Interfaces::setScript(QString argument){
+bool Interfaces::setScript(const QString &argument){
return setOption(currentMapping, "script", argument);
}
@@ -445,4 +445,6 @@ QString Interfaces::getScript(bool &error){
}
+
+
/**
* Helper function used to parse through the QStringList and put pointers in
@@ -453,5 +455,5 @@ QString Interfaces::getScript(bool &error){
* @return bool true if the stanza is found.
*/
-bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator &iterator){
+bool Interfaces::setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator){
bool found = false;
iterator = interfaces.end();
@@ -490,5 +492,5 @@ bool Interfaces::setStanza(QString stanza, QString option, QStringList::Iterator
* @return bool true if successfull, false otherwise.
*/
-bool Interfaces::setOption(QStringList::Iterator start, QString option, QString value){
+bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
@@ -525,5 +527,5 @@ bool Interfaces::setOption(QStringList::Iterator start, QString option, QString
* @return bool true if successfull, false otherwise.
*/
-bool Interfaces::removeOption(QStringList::Iterator start, QString option, QString value){
+bool Interfaces::removeOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
@@ -551,5 +553,5 @@ bool Interfaces::removeOption(QStringList::Iterator start, QString option, QStri
* @return bool true if successfull, false otherwise.
*/
-bool Interfaces::removeAllOptions(QStringList::Iterator start){
+bool Interfaces::removeAllOptions(const QStringList::Iterator &start){
if(start == interfaces.end())
return false;
@@ -576,5 +578,5 @@ bool Interfaces::removeAllOptions(QStringList::Iterator start){
* @return QString the value of option QString::null() if error == true.
*/
-QString Interfaces::getOption(QStringList::Iterator start, QString option, bool &error){
+QString Interfaces::getOption(const QStringList::Iterator &start, const QString &option, bool &error){
if(start == interfaces.end()){
error = false;
diff --git a/noncore/settings/networksettings/interfaces/interfaces.h b/noncore/settings/networksettings/interfaces/interfaces.h
index e09ea71..26abb73 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.h
+++ b/noncore/settings/networksettings/interfaces/interfaces.h
@@ -26,40 +26,40 @@ public:
QStringList getInterfaceList();
- bool isAuto(QString interface);
- bool setAuto(QString interface, bool setAuto);
+ bool isAuto(const QString &interface);
+ bool setAuto(const QString &interface, bool setAuto);
bool removeInterface();
- bool addInterface(QString interface, QString family, QString method);
- bool copyInterface(QString oldInterface, QString newInterface);
+ bool addInterface(const QString &interface, const QString &family, const QString &method);
+ bool copyInterface(const QString &oldInterface, const QString &newInterface);
bool setInterface(QString interface);
- bool isInterfaceSet();
+ inline bool isInterfaceSet();
QString getInterfaceName(bool &error);
- bool setInterfaceName(QString newName);
+ bool setInterfaceName(const QString &newName);
QString getInterfaceFamily(bool &error);
- bool setInterfaceFamily(QString newName);
+ bool setInterfaceFamily(const QString &newName);
QString getInterfaceMethod(bool &error);
- bool setInterfaceMethod(QString newName);
- QString getInterfaceOption(QString option, bool &error);
- bool setInterfaceOption(QString option, QString value);
- bool removeInterfaceOption(QString option, QString value);
- bool removeAllInterfaceOptions();
+ bool setInterfaceMethod(const QString &newName);
+ inline QString getInterfaceOption(const QString &option, bool &error);
+ inline bool setInterfaceOption(const QString &option, const QString &value);
+ inline bool removeInterfaceOption(const QString &option, const QString &value);
+ inline bool removeAllInterfaceOptions();
- bool setMapping(QString interface);
+ bool setMapping(const QString &interface);
bool removeMapping();
- void addMapping(QString options);
- bool setMap(QString map, QString value);
- bool removeMap(QString map, QString value);
- QString getMap(QString map, bool &error);
- bool setScript(QString);
- QString getScript(bool &error);
+ inline void addMapping(const QString &options);
+ inline bool setMap(const QString &map, const QString &value);
+ inline bool removeMap(const QString &map, const QString &value);
+ inline QString getMap(const QString &map, bool &error);
+ inline bool setScript(const QString &argument);
+ inline QString getScript(bool &error);
bool write();
private:
- bool setStanza(QString stanza, QString option,QStringList::Iterator &iterator);
- bool setOption(QStringList::Iterator start, QString option, QString value);
- bool removeOption(QStringList::Iterator start, QString option, QString value);
- QString getOption(QStringList::Iterator start, QString option, bool &error);
- bool removeAllOptions(QStringList::Iterator start);
+ bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator);
+ bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value);
+ bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value);
+ QString getOption(const QStringList::Iterator &start, const QString &option, bool &error);
+ bool removeAllOptions(const QStringList::Iterator &start);
QString interfacesFile;
diff --git a/noncore/settings/networksettings/interfaces/interfacesetup.ui b/noncore/settings/networksettings/interfaces/interfacesetup.ui
index ab8e413..df55d25 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetup.ui
+++ b/noncore/settings/networksettings/interfaces/interfacesetup.ui
@@ -100,4 +100,8 @@
</property>
<property stdset="1">
+ <name>lineStep</name>
+ <number>24</number>
+ </property>
+ <property stdset="1">
<name>value</name>
<number>168</number>
@@ -252,4 +256,26 @@
</vbox>
</widget>
+<customwidgets>
+ <customwidget>
+ <class>QWidget</class>
+ <header location="local">qwidget.h</header>
+ <sizehint>
+ <width>100</width>
+ <height>100</height>
+ </sizehint>
+ <container>0</container>
+ <sizepolicy>
+ <hordata>7</hordata>
+ <verdata>7</verdata>
+ </sizepolicy>
+ <pixmap>image0</pixmap>
+ </customwidget>
+</customwidgets>
+<images>
+ <image>
+ <name>image0</name>
+ <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
+ </image>
+</images>
<connections>
<connection>
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.h b/noncore/settings/networksettings/interfaces/interfacesetupimp.h
index a88e190..60933aa 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.h
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.h
@@ -22,5 +22,4 @@ private:
Interfaces *interfaces;
Interface *interface;
-
};