mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Show hostname in sidebar
This commit is contained in:
@@ -32,7 +32,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "lasans-laptop"
|
||||
text: backend.hostname
|
||||
font.weight: 500
|
||||
font.pointSize: 17
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
#include <QPointer>
|
||||
#include <QSysInfo>
|
||||
#include <QUrl>
|
||||
|
||||
#include "absl/time/time.h"
|
||||
@@ -388,6 +389,10 @@ Backend::~Backend() {
|
||||
shutdown();
|
||||
}
|
||||
|
||||
QString Backend::hostname() const {
|
||||
return QSysInfo::machineHostName();
|
||||
}
|
||||
|
||||
void Backend::startReceive() {
|
||||
SetDesiredMode(Mode::kReceive);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ class Backend : public QObject,
|
||||
public nearby::sharing::ShareTargetDiscoveredCallback {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
Q_PROPERTY(QString hostname READ hostname CONSTANT)
|
||||
Q_PROPERTY(QAbstractListModel* targets READ targets CONSTANT)
|
||||
Q_PROPERTY(QAbstractListModel* transfers READ transfers CONSTANT)
|
||||
|
||||
@@ -113,6 +114,7 @@ class Backend : public QObject,
|
||||
explicit Backend(QObject* parent = nullptr);
|
||||
~Backend() override;
|
||||
|
||||
QString hostname() const;
|
||||
QAbstractListModel* targets() { return &targets_; }
|
||||
QAbstractListModel* transfers() { return &transfers_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user