mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Merge pull request #329 from Gelmir/iface_hrNames
Show human readable interface names
This commit is contained in:
commit
dce5c217c8
2 changed files with 13 additions and 3 deletions
|
@ -89,8 +89,10 @@ public slots:
|
||||||
if (combo_iface.currentIndex() == 0) {
|
if (combo_iface.currentIndex() == 0) {
|
||||||
// All interfaces (default)
|
// All interfaces (default)
|
||||||
pref.setNetworkInterface(QString::null);
|
pref.setNetworkInterface(QString::null);
|
||||||
|
pref.setNetworkInterfaceName(QString::null);
|
||||||
} else {
|
} else {
|
||||||
pref.setNetworkInterface(combo_iface.currentText());
|
pref.setNetworkInterface(combo_iface.itemData(combo_iface.currentIndex()).toString());
|
||||||
|
pref.setNetworkInterfaceName(combo_iface.currentText());
|
||||||
}
|
}
|
||||||
// Network address
|
// Network address
|
||||||
QHostAddress addr(txt_network_address.text().trimmed());
|
QHostAddress addr(txt_network_address.text().trimmed());
|
||||||
|
@ -213,7 +215,7 @@ private slots:
|
||||||
int i = 1;
|
int i = 1;
|
||||||
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
|
foreach (const QNetworkInterface& iface, QNetworkInterface::allInterfaces()) {
|
||||||
if (iface.flags() & QNetworkInterface::IsLoopBack) continue;
|
if (iface.flags() & QNetworkInterface::IsLoopBack) continue;
|
||||||
combo_iface.addItem(iface.name());
|
combo_iface.addItem(iface.humanReadableName(),iface.name());
|
||||||
if (!current_iface.isEmpty() && iface.name() == current_iface) {
|
if (!current_iface.isEmpty() && iface.name() == current_iface) {
|
||||||
combo_iface.setCurrentIndex(i);
|
combo_iface.setCurrentIndex(i);
|
||||||
interface_exists = true;
|
interface_exists = true;
|
||||||
|
@ -222,7 +224,7 @@ private slots:
|
||||||
}
|
}
|
||||||
// Saved interface does not exist, show it anyway
|
// Saved interface does not exist, show it anyway
|
||||||
if (!interface_exists) {
|
if (!interface_exists) {
|
||||||
combo_iface.addItem(current_iface);
|
combo_iface.addItem(pref.getNetworkInterfaceName(),current_iface);
|
||||||
combo_iface.setCurrentIndex(i);
|
combo_iface.setCurrentIndex(i);
|
||||||
}
|
}
|
||||||
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);
|
setRow(NETWORK_IFACE, tr("Network Interface (requires restart)"), &combo_iface);
|
||||||
|
|
|
@ -1042,6 +1042,14 @@ public:
|
||||||
QString getNetworkInterface() const {
|
QString getNetworkInterface() const {
|
||||||
return value(QString::fromUtf8("Preferences/Connection/Interface"), QString()).toString();
|
return value(QString::fromUtf8("Preferences/Connection/Interface"), QString()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setNetworkInterfaceName(const QString& iface) {
|
||||||
|
setValue(QString::fromUtf8("Preferences/Connection/InterfaceName"), iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getNetworkInterfaceName() const {
|
||||||
|
return value(QString::fromUtf8("Preferences/Connection/InterfaceName"), QString()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
void setNetworkAddress(const QString& addr) {
|
void setNetworkAddress(const QString& addr) {
|
||||||
setValue(QString::fromUtf8("Preferences/Connection/InetAddress"), addr);
|
setValue(QString::fromUtf8("Preferences/Connection/InetAddress"), addr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue