mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
improved tab titles
added default and fixed refresh triggers on split rename
This commit is contained in:
parent
ab6474150d
commit
5b6596066e
3 changed files with 17 additions and 1 deletions
|
@ -38,6 +38,7 @@ static int index = 0;
|
|||
|
||||
ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
|
||||
: BaseWidget(parent)
|
||||
, parentPage(*parent)
|
||||
, channelManager(_channelManager)
|
||||
, completionManager(parent->completionManager)
|
||||
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
|
||||
|
@ -176,6 +177,7 @@ bool ChatWidget::showChangeChannelPopup(const char *dialogTitle, bool empty)
|
|||
QString newChannelName = dialog.getText().trimmed();
|
||||
|
||||
this->channelName = newChannelName.toStdString();
|
||||
this->parentPage.refreshTitle();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,8 @@ private:
|
|||
|
||||
void channelNameUpdated(const std::string &newChannelName);
|
||||
|
||||
NotebookPage &parentPage;
|
||||
|
||||
messages::LimitedQueue<messages::SharedMessageRef> messages;
|
||||
|
||||
std::shared_ptr<Channel> channel;
|
||||
|
|
|
@ -43,6 +43,8 @@ NotebookPage::NotebookPage(ChannelManager &_channelManager, Notebook *parent, No
|
|||
|
||||
this->ui.hbox.setSpacing(1);
|
||||
this->ui.hbox.setMargin(0);
|
||||
|
||||
this->refreshTitle();
|
||||
}
|
||||
|
||||
std::pair<int, int> NotebookPage::removeFromLayout(ChatWidget *widget)
|
||||
|
@ -421,14 +423,24 @@ void NotebookPage::refreshTitle()
|
|||
bool first = true;
|
||||
|
||||
for (const auto &chatWidget : this->chatWidgets) {
|
||||
auto channelName = QString::fromStdString(chatWidget->channelName.getValue());
|
||||
|
||||
if (channelName.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!first) {
|
||||
newTitle += ", ";
|
||||
}
|
||||
newTitle += QString::fromStdString(chatWidget->channelName.getValue());
|
||||
newTitle += channelName;
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
if (newTitle.isEmpty()) {
|
||||
newTitle = "empty";
|
||||
}
|
||||
|
||||
this->tab->setTitle(newTitle);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue