Skip to content

Commit

Permalink
Bring back account label to groupchats
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed May 8, 2024
1 parent bda58ba commit dfb1c8b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
15 changes: 15 additions & 0 deletions src/groupchatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@ GCMainDlg::GCMainDlg(PsiAccount *pa, const Jid &j, TabManager *tabManager) : Tab
hb3a->addWidget(d->typeahead);
ui_.vboxLayout1->addLayout(hb3a);

ui_.lb_ident->setAccount(account());
ui_.lb_ident->setShowJid(false);
connect(account()->psi(), &PsiCon::accountCountChanged, this, &GCMainDlg::updateIdentityVisibility);

ActionList *actList = account()->psi()->actionList()->actionLists(PsiActionList::Actions_Groupchat).at(0);
for (const QString &name : actList->actions()) {
auto action = actList->copyAction(name, this);
Expand Down Expand Up @@ -2355,6 +2359,17 @@ void GCMainDlg::setLooks()
: Qt::ScrollBarAsNeeded);
ui_.lv_users->setLooks();
setMucSelfAvatar();
updateIdentityVisibility();
}

void GCMainDlg::updateIdentityVisibility()
{
if (!PsiOptions::instance()->getOption("options.ui.chat.use-small-chats").toBool()) {
bool visible = account()->psi()->contactList()->enabledAccounts().count() > 1;
ui_.lb_ident->setVisible(visible);
} else {
ui_.lb_ident->setVisible(false);
}
}

void GCMainDlg::setToolbuttons()
Expand Down
1 change: 1 addition & 0 deletions src/groupchatdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ private slots:
inline XMPP::Jid jidForNick(const QString &nick) const;

void setMucSelfAvatar();
void updateIdentityVisibility();
};

#endif // GROUPCHATDLG_H
51 changes: 31 additions & 20 deletions src/groupchatdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<item>
<widget class="ChatSplitter" name="vsplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<widget class="QFrame" name="topFrame">
<property name="sizePolicy">
Expand All @@ -42,10 +42,10 @@
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
Expand Down Expand Up @@ -109,13 +109,20 @@
</size>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
<enum>QToolButton::ToolButtonPopupMode::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="AccountLabel" name="lb_ident">
<property name="text">
<string notr="true">AccountLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="tb_actions">
<property name="font">
Expand All @@ -133,16 +140,16 @@
<string notr="true">≡</string>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
<enum>QToolButton::ToolButtonPopupMode::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
<enum>Qt::ToolButtonStyle::ToolButtonTextOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
<enum>Qt::ArrowType::NoArrow</enum>
</property>
</widget>
</item>
Expand All @@ -158,7 +165,7 @@
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<widget class="ChatView" name="log">
<property name="sizePolicy">
Expand All @@ -168,7 +175,7 @@
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
<enum>Qt::FocusPolicy::NoFocus</enum>
</property>
</widget>
<widget class="GCUserView" name="lv_users">
Expand All @@ -179,7 +186,7 @@
</size>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
</widget>
</widget>
Expand All @@ -194,10 +201,10 @@
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
<enum>QFrame::Shadow::Plain</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
Expand All @@ -224,7 +231,7 @@
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
Expand All @@ -237,7 +244,6 @@
<widget class="QLabel" name="mini_prompt">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -274,7 +280,7 @@
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<enum>Qt::ContextMenuPolicy::CustomContextMenu</enum>
</property>
<property name="toolTip">
<string>Send</string>
Expand All @@ -297,11 +303,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PixmapRatioLabel</class>
<extends>QLabel</extends>
<header>pixmapratiolabel.h</header>
</customwidget>
<customwidget>
<class>ChatView</class>
<extends>QFrame</extends>
Expand All @@ -319,6 +320,16 @@
<extends>QTextEdit</extends>
<header>chateditproxy.h</header>
</customwidget>
<customwidget>
<class>AccountLabel</class>
<extends>QLabel</extends>
<header>accountlabel.h</header>
</customwidget>
<customwidget>
<class>PixmapRatioLabel</class>
<extends>QLabel</extends>
<header>pixmapratiolabel.h</header>
</customwidget>
<customwidget>
<class>ActionLineEdit</class>
<extends>QLineEdit</extends>
Expand Down

0 comments on commit dfb1c8b

Please sign in to comment.