Index: sources/view/VNetworkModel.cpp =================================================================== diff -u -r60db0ce19666f04ea58992a7670497d83f9bf7c4 -r13ac42cf8bdc5038dedd3302ba79dc387e5704b4 --- sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision 60db0ce19666f04ea58992a7670497d83f9bf7c4) +++ sources/view/VNetworkModel.cpp (.../VNetworkModel.cpp) (revision 13ac42cf8bdc5038dedd3302ba79dc387e5704b4) @@ -29,8 +29,11 @@ this, SLOT(onDisconnectedNetwork(const Network))); connect(&_WifiInterface, SIGNAL(didError(const QString)), - this, SLOT(onError(const QString))); + this, SLOT(onStatusChanged(const QString))); + connect(&_WifiInterface, SIGNAL(didStatusChanged(const QString)), + this, SLOT(onStatusChanged(const QString))); + // outgoing connect(this, SIGNAL(didScan()), &_WifiInterface, SLOT(doScan())); @@ -43,6 +46,21 @@ connect(this, SIGNAL(didRequestIPSettings()), &_WifiInterface, SLOT(doRequestIPSettings())); + + // static IP address assignment + connect(this, SIGNAL(didRequestSetIPAddress(const QString)), + &_WifiInterface, SLOT(doRequestSetIPAddress(const QString))); + + connect(this, SIGNAL(didRequestSetGateway(const QString)), + &_WifiInterface, SLOT(doRequestSetGateway(const QString))); + + connect(this, SIGNAL(didRequestSetSubnetMask(const QString)), + &_WifiInterface, SLOT(doRequestSetSubnetMask(const QString))); + + connect(this, SIGNAL(didRequestSetDNS(const QString)), + &_WifiInterface, SLOT(doRequestSetDNS(const QString))); + + } /*! @@ -61,6 +79,17 @@ } /*! + * \brief VNetworkModel::removeRows + * Removes all rows from the model + */ +void VNetworkModel::removeAllRows() +{ + beginRemoveRows(QModelIndex(), 0, rowCount()); + _networks.clear(); + endRemoveRows(); +} + +/*! * \brief VNetworkModel::rowCount * Gets the number of networks * \param parent - (QModelIndex) the parent QModelIndex @@ -92,8 +121,8 @@ return network.macAddress(); case SSIDRole: return network.ssid(); - case SecurityLevelRole: - return network.security(); + case SecurityTypesRole: + return network.securityTypesToStringList(network.securityTypes()).join("/"); case StatusRole: return network.status(); case SignalLevelRole: @@ -112,7 +141,7 @@ QHash roles; roles[MacAddressRole] = "macAddress"; roles[SSIDRole] = "ssid"; - roles[SecurityLevelRole] = "securityLevel"; + roles[SecurityTypesRole] = "securityTypes"; roles[StatusRole] = "status"; roles[SignalLevelRole] = "signalLevel"; return roles; @@ -123,7 +152,9 @@ * Handles when a user clicks the Scan button */ void VNetworkModel::doScan() { - qDebug() << __FUNCTION__ << QThread::currentThread()->objectName(); + LOG_DEBUG(QString("VNetworkModel::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); + LOG_DEBUG("Clearing networks before re-scanning."); + removeAllRows(); status(tr("Scanning...")); emit didScan(); } @@ -251,12 +282,48 @@ } /*! - * \brief VNetworkModel::onError - * Called when the wifi interface emits an error + * \brief VNetworkModel::onStatusChanged + * Called when the wifi interface status changes * \param vMessage - (QString) the error message */ -void VNetworkModel::onError(const QString &vMessage) +void VNetworkModel::onStatusChanged(const QString &vMessage) { LOG_DEBUG(QString("VNetworkModel::%1 %2").arg(__FUNCTION__).arg(QThread::currentThread()->objectName())); status(vMessage); } + +/*! + * \brief VNetworkModel::doSetIPAddress + * \param vIPAddress + */ +void VNetworkModel::doSetIPAddress(const QString &vIPAddress) +{ + emit didRequestSetIPAddress(vIPAddress); +} + +/*! + * \brief VNetworkModel::doSetGateway + * \param vGateway + */ +void VNetworkModel::doSetGateway(const QString &vGateway) +{ + emit didRequestSetGateway(vGateway); +} + +/*! + * \brief VNetworkModel::doSetSubnetMask + * \param vSubnetMask + */ +void VNetworkModel::doSetSubnetMask(const QString &vSubnetMask) +{ + emit didRequestSetSubnetMask(vSubnetMask); +} + +/*! + * \brief VNetworkModel::doSetDNS + * \param vDNS + */ +void VNetworkModel::doSetDNS(const QString &vDNS) +{ + emit didRequestSetDNS(vDNS); +}