mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Improve user friendliness of changing chat widget channel/opening new chat widget
This commit is contained in:
parent
5c8d3f9eef
commit
417c4028a0
4 changed files with 19 additions and 6 deletions
|
@ -157,18 +157,26 @@ LimitedQueueSnapshot<SharedMessageRef> ChatWidget::getMessagesSnapshot()
|
||||||
return this->messages.getSnapshot();
|
return this->messages.getSnapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::showChangeChannelPopup()
|
bool ChatWidget::showChangeChannelPopup(const char *dialogTitle, bool empty)
|
||||||
{
|
{
|
||||||
// create new input dialog and execute it
|
// create new input dialog and execute it
|
||||||
TextInputDialog dialog(this);
|
TextInputDialog dialog(this);
|
||||||
|
|
||||||
|
dialog.setWindowTitle(dialogTitle);
|
||||||
|
|
||||||
|
if (!empty) {
|
||||||
dialog.setText(QString::fromStdString(this->channelName));
|
dialog.setText(QString::fromStdString(this->channelName));
|
||||||
|
}
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
QString newChannelName = dialog.getText().trimmed();
|
QString newChannelName = dialog.getText().trimmed();
|
||||||
|
|
||||||
this->channelName = newChannelName.toStdString();
|
this->channelName = newChannelName.toStdString();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::layoutMessages(bool forceUpdate)
|
void ChatWidget::layoutMessages(bool forceUpdate)
|
||||||
|
@ -229,7 +237,7 @@ void ChatWidget::doCloseSplit()
|
||||||
|
|
||||||
void ChatWidget::doChangeChannel()
|
void ChatWidget::doChangeChannel()
|
||||||
{
|
{
|
||||||
this->showChangeChannelPopup();
|
this->showChangeChannelPopup("Change channel");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doPopup()
|
void ChatWidget::doPopup()
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
std::shared_ptr<Channel> getChannel() const;
|
std::shared_ptr<Channel> getChannel() const;
|
||||||
std::shared_ptr<Channel> &getChannelRef();
|
std::shared_ptr<Channel> &getChannelRef();
|
||||||
|
|
||||||
void showChangeChannelPopup();
|
bool showChangeChannelPopup(const char *dialogTitle, bool empty = false);
|
||||||
messages::LimitedQueueSnapshot<messages::SharedMessageRef> getMessagesSnapshot();
|
messages::LimitedQueueSnapshot<messages::SharedMessageRef> getMessagesSnapshot();
|
||||||
void layoutMessages(bool forceUpdate = false);
|
void layoutMessages(bool forceUpdate = false);
|
||||||
void updateGifEmotes();
|
void updateGifEmotes();
|
||||||
|
|
|
@ -132,7 +132,7 @@ void ChatWidgetHeader::mouseMoveEvent(QMouseEvent *event)
|
||||||
void ChatWidgetHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
void ChatWidgetHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
this->chatWidget->showChangeChannelPopup();
|
this->chatWidget->showChangeChannelPopup("Change channel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,12 @@ void NotebookPage::addChat(bool openChannelNameDialog)
|
||||||
ChatWidget *w = this->createChatWidget();
|
ChatWidget *w = this->createChatWidget();
|
||||||
|
|
||||||
if (openChannelNameDialog) {
|
if (openChannelNameDialog) {
|
||||||
w->showChangeChannelPopup();
|
bool ret = w->showChangeChannelPopup("Open channel", true);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
delete w;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->addToLayout(w, std::pair<int, int>(-1, -1));
|
this->addToLayout(w, std::pair<int, int>(-1, -1));
|
||||||
|
|
Loading…
Reference in a new issue