mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 19:31:02 +01:00
Show the computers ip address in the remote control settings.
This commit is contained in:
parent
916a40b16b
commit
f68f6ddf42
@ -22,7 +22,8 @@
|
||||
#include "networkremote/networkremotehelper.h"
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
#include <QHostInfo>
|
||||
#include <QNetworkInterface>
|
||||
|
||||
NetworkRemoteSettingsPage::NetworkRemoteSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog),
|
||||
@ -67,6 +68,22 @@ void NetworkRemoteSettingsPage::Load() {
|
||||
|
||||
QPixmap android_qr_code(":clementine_remote_qr.png");
|
||||
ui_->android_app_qr->setPixmap(android_qr_code);
|
||||
|
||||
// Get local ip addresses
|
||||
QString ip_addresses;
|
||||
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
|
||||
foreach (const QHostAddress& address, addresses) {
|
||||
// TODO: Add ipv6 support to tinysvcmdns.
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol &&
|
||||
!address.isInSubnet(QHostAddress::parseSubnet("127.0.0.1/8"))) {
|
||||
qLog(Debug) << "IP:" << address.toString();
|
||||
if (!ip_addresses.isEmpty()) {
|
||||
ip_addresses.append("; ");
|
||||
}
|
||||
ip_addresses.append(address.toString());
|
||||
}
|
||||
}
|
||||
ui_->ip_address->setText(ip_addresses);
|
||||
}
|
||||
|
||||
void NetworkRemoteSettingsPage::Save() {
|
||||
|
@ -110,6 +110,27 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="toolTip">
|
||||
<string>Enter this IP in the App to connect to Clementine.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Your IP address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="ip_address">
|
||||
<property name="text">
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user