mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
made requeste changes
This commit is contained in:
parent
195bb0499b
commit
9b5a287d14
5 changed files with 13 additions and 17 deletions
|
@ -15,7 +15,7 @@ ApplicationWindow {
|
||||||
minimumHeight: 420
|
minimumHeight: 420
|
||||||
palette: colors
|
palette: colors
|
||||||
color: colors.window
|
color: colors.window
|
||||||
title: profile.globalUserProfile ? "Global User Profile" : "Room User Profile"
|
title: profile.isGlobalUserProfile ? "Global User Profile" : "Room User Profile"
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: contentL
|
id: contentL
|
||||||
|
@ -44,19 +44,19 @@ ApplicationWindow {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
||||||
Keys.priority: Keys.BeforeItem
|
onAccepted: profile.changeUsername(displayUsername.text)
|
||||||
Keys.onReturnPressed: profile.changeUsername(displayUsername.text)
|
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
visible: profile.isSelf
|
||||||
anchors.leftMargin: 5
|
anchors.leftMargin: 5
|
||||||
anchors.left: displayUsername.right
|
anchors.left: displayUsername.right
|
||||||
anchors.verticalCenter: displayUsername.verticalCenter
|
anchors.verticalCenter: displayUsername.verticalCenter
|
||||||
image: profile.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png"
|
image: profile.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(profile.isUsernameEditingAllowed) {
|
if (profile.isUsernameEditingAllowed) {
|
||||||
profile.changeUsername(displayUsername.text)
|
profile.changeUsername(displayUsername.text)
|
||||||
}else{
|
} else {
|
||||||
profile.allowUsernameEditing(true)
|
profile.allowUsernameEditing(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
||||||
|
|
||||||
user_info_widget_ = new UserInfoWidget(sideBar_);
|
user_info_widget_ = new UserInfoWidget(sideBar_);
|
||||||
connect(user_info_widget_, &UserInfoWidget::openGlobalUserProfile, this, [this]() {
|
connect(user_info_widget_, &UserInfoWidget::openGlobalUserProfile, this, [this]() {
|
||||||
view_manager_->activeTimeline()->openUserProfile("", true);
|
view_manager_->activeTimeline()->openUserProfile(utils::localUser(), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
user_mentions_popup_ = new popups::UserMentions();
|
user_mentions_popup_ = new popups::UserMentions();
|
||||||
|
|
|
@ -801,11 +801,7 @@ TimelineModel::viewDecryptedRawMessage(QString id) const
|
||||||
void
|
void
|
||||||
TimelineModel::openUserProfile(QString userid, bool global)
|
TimelineModel::openUserProfile(QString userid, bool global)
|
||||||
{
|
{
|
||||||
if (global) {
|
emit openProfile(new UserProfile(global ? "" : room_id_, userid, manager_, this));
|
||||||
emit openProfile(new UserProfile("", utils::localUser(), manager_, this));
|
|
||||||
} else {
|
|
||||||
emit openProfile(new UserProfile(room_id_, userid, manager_, this));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -116,7 +116,7 @@ UserProfile::userid()
|
||||||
QString
|
QString
|
||||||
UserProfile::displayName()
|
UserProfile::displayName()
|
||||||
{
|
{
|
||||||
return globalUserProfile() ? globalUsername : cache::displayName(roomid_, userid_);
|
return isGlobalUserProfile() ? globalUsername : cache::displayName(roomid_, userid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
@ -126,9 +126,9 @@ UserProfile::avatarUrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
UserProfile::globalUserProfile() const
|
UserProfile::isGlobalUserProfile() const
|
||||||
{
|
{
|
||||||
return (roomid_ == "") && isSelf();
|
return roomid_ == "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -241,7 +241,7 @@ UserProfile::startChat()
|
||||||
void
|
void
|
||||||
UserProfile::changeUsername(QString username)
|
UserProfile::changeUsername(QString username)
|
||||||
{
|
{
|
||||||
if (globalUserProfile()) {
|
if (isGlobalUserProfile()) {
|
||||||
// change global
|
// change global
|
||||||
http::client()->set_displayname(
|
http::client()->set_displayname(
|
||||||
username.toStdString(), [this](mtx::http::RequestErr err) {
|
username.toStdString(), [this](mtx::http::RequestErr err) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ class UserProfile : public QObject
|
||||||
Q_PROPERTY(QString userid READ userid CONSTANT)
|
Q_PROPERTY(QString userid READ userid CONSTANT)
|
||||||
Q_PROPERTY(QString avatarUrl READ avatarUrl CONSTANT)
|
Q_PROPERTY(QString avatarUrl READ avatarUrl CONSTANT)
|
||||||
Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList CONSTANT)
|
Q_PROPERTY(DeviceInfoModel *deviceList READ deviceList CONSTANT)
|
||||||
Q_PROPERTY(bool globalUserProfile READ globalUserProfile CONSTANT)
|
Q_PROPERTY(bool isGlobalUserProfile READ isGlobalUserProfile CONSTANT)
|
||||||
Q_PROPERTY(bool isUserVerified READ getUserStatus NOTIFY userStatusChanged)
|
Q_PROPERTY(bool isUserVerified READ getUserStatus NOTIFY userStatusChanged)
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
bool userVerificationEnabled READ userVerificationEnabled NOTIFY userStatusChanged)
|
bool userVerificationEnabled READ userVerificationEnabled NOTIFY userStatusChanged)
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
QString userid();
|
QString userid();
|
||||||
QString displayName();
|
QString displayName();
|
||||||
QString avatarUrl();
|
QString avatarUrl();
|
||||||
bool globalUserProfile() const;
|
bool isGlobalUserProfile() const;
|
||||||
bool getUserStatus();
|
bool getUserStatus();
|
||||||
bool userVerificationEnabled() const;
|
bool userVerificationEnabled() const;
|
||||||
bool isSelf() const;
|
bool isSelf() const;
|
||||||
|
|
Loading…
Reference in a new issue