Show hostname in sidebar

This commit is contained in:
Lasan Mahaliyana
2026-07-20 16:38:26 +05:30
parent 71b6c0e6d5
commit 3b67895106
3 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ Rectangle {
}
Text {
text: "lasans-laptop"
text: backend.hostname
font.weight: 500
font.pointSize: 17
horizontalAlignment: Text.AlignHCenter
+5
View File
@@ -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);
}
+2
View File
@@ -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_; }