mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Multi-window: Fix buttons staying pressed while in separate window mode, make dialogs alert, fix group chat event flags
This commit is contained in:
parent
4e5c4cb678
commit
ee627afc87
|
@ -467,6 +467,12 @@ bool ContentDialog::event(QEvent* event)
|
|||
frnd->getFriendWidget()->resetEventFlags();
|
||||
frnd->getFriendWidget()->updateStatusLight();
|
||||
}
|
||||
else
|
||||
{
|
||||
Group* g = activeChatroomWidget->getGroup();
|
||||
g->getGroupWidget()->resetEventFlags();
|
||||
g->getGroupWidget()->updateStatusLight();
|
||||
}
|
||||
}
|
||||
|
||||
currentDialog = this;
|
||||
|
@ -591,7 +597,7 @@ void ContentDialog::onChatroomWidgetClicked(GenericChatroomWidget *widget, bool
|
|||
widget->updateStatusLight();
|
||||
updateTitle(widget);
|
||||
|
||||
if (widget->getFriend() != nullptr)
|
||||
if (widget->getFriend())
|
||||
widget->getFriend()->getFriendWidget()->updateStatusLight();
|
||||
else
|
||||
widget->getGroup()->getGroupWidget()->updateStatusLight();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "src/widget/gui.h"
|
||||
#include "src/widget/translator.h"
|
||||
#include "src/widget/contentlayout.h"
|
||||
#include <QWindow>
|
||||
|
||||
AddFriendForm::AddFriendForm()
|
||||
{
|
||||
|
@ -71,6 +72,7 @@ bool AddFriendForm::isShown() const
|
|||
{
|
||||
if (main->isVisible())
|
||||
{
|
||||
head->window()->windowHandle()->alert(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "src/widget/translator.h"
|
||||
#include "src/widget/contentlayout.h"
|
||||
#include <QFileInfo>
|
||||
#include <QWindow>
|
||||
|
||||
FilesForm::FilesForm()
|
||||
: QObject(), doneIcon(":/ui/fileTransferWidget/fileDone.svg")
|
||||
|
@ -58,6 +59,7 @@ bool FilesForm::isShown() const
|
|||
{
|
||||
if (main.isVisible())
|
||||
{
|
||||
head->window()->windowHandle()->alert(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <QBuffer>
|
||||
#include <QMessageBox>
|
||||
#include <QComboBox>
|
||||
#include <QWindow>
|
||||
|
||||
ProfileForm::ProfileForm(QWidget *parent) :
|
||||
QWidget{parent}, qr{nullptr}
|
||||
|
@ -138,6 +139,7 @@ bool ProfileForm::isShown() const
|
|||
{
|
||||
if (head->isVisible())
|
||||
{
|
||||
window()->windowHandle()->alert(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "src/widget/contentlayout.h"
|
||||
#include <QTabWidget>
|
||||
#include <QLabel>
|
||||
#include <QWindow>
|
||||
|
||||
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
|
@ -91,6 +92,7 @@ bool SettingsWidget::isShown() const
|
|||
{
|
||||
if (body->isVisible())
|
||||
{
|
||||
body->window()->windowHandle()->alert(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,21 +174,7 @@ void Widget::init()
|
|||
|
||||
ui->searchContactFilterBox->setMenu(filterMenu);
|
||||
|
||||
/*ui->mainContent->setLayout(new QVBoxLayout());
|
||||
ui->mainHead->setLayout(new QVBoxLayout());
|
||||
ui->mainHead->layout()->setMargin(0);
|
||||
ui->mainHead->layout()->setSpacing(0);
|
||||
|
||||
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
|
||||
&& Settings::getInstance().getStyle() != "None")
|
||||
{
|
||||
ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
||||
ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
||||
}*/
|
||||
|
||||
#ifndef Q_OS_MAC
|
||||
//ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
|
||||
//ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
|
||||
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
||||
ui->statusPanel->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
||||
#endif
|
||||
|
@ -627,10 +613,9 @@ void Widget::onAddClicked()
|
|||
if (Settings::getInstance().getSeparateWindow())
|
||||
{
|
||||
if (!addFriendForm->isShown())
|
||||
{
|
||||
addFriendForm->show(createContentDialog(AddDialog));
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -651,10 +636,9 @@ void Widget::onTransferClicked()
|
|||
if (Settings::getInstance().getSeparateWindow())
|
||||
{
|
||||
if (!filesForm->isShown())
|
||||
{
|
||||
filesForm->show(createContentDialog(TransferDialog));
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -740,10 +724,9 @@ void Widget::onSettingsClicked()
|
|||
if (Settings::getInstance().getSeparateWindow())
|
||||
{
|
||||
if (!settingsWidget->isShown())
|
||||
{
|
||||
settingsWidget->show(createContentDialog(SettingDialog));
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -759,10 +742,9 @@ void Widget::showProfile() // onAvatarClicked, onUsernameClicked
|
|||
if (Settings::getInstance().getSeparateWindow())
|
||||
{
|
||||
if (!profileForm->isShown())
|
||||
{
|
||||
profileForm->show(createContentDialog(ProfileDialog));
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
|
||||
setActiveToolMenuButton(Widget::None);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1126,6 +1108,7 @@ bool Widget::newGroupMessageAlert(int groupId)
|
|||
bool hasActive;
|
||||
QWidget* currentWindow;
|
||||
ContentDialog* contentDialog = ContentDialog::getGroupDialog(groupId);
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
|
||||
if (contentDialog != nullptr)
|
||||
{
|
||||
|
@ -1135,10 +1118,28 @@ bool Widget::newGroupMessageAlert(int groupId)
|
|||
else
|
||||
{
|
||||
currentWindow = window();
|
||||
hasActive = GroupList::findGroup(groupId)->getGroupWidget() == activeChatroomWidget;
|
||||
hasActive = g->getGroupWidget() == activeChatroomWidget;
|
||||
}
|
||||
|
||||
return newMessageAlert(currentWindow, hasActive);
|
||||
if (newMessageAlert(currentWindow, hasActive))
|
||||
{
|
||||
g->setEventFlag(true);
|
||||
g->getGroupWidget()->updateStatusLight();
|
||||
|
||||
if (contentDialog == nullptr)
|
||||
{
|
||||
if (hasActive)
|
||||
setWindowTitle(g->getGroupWidget()->getTitle());
|
||||
}
|
||||
else
|
||||
{
|
||||
ContentDialog::updateGroupStatus(groupId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Widget::fromDialogType(DialogType type)
|
||||
|
@ -1398,19 +1399,8 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri
|
|||
else
|
||||
g->getChatForm()->addMessage(author, message, isAction, QDateTime::currentDateTime(), true);
|
||||
|
||||
g->setEventFlag(static_cast<GenericChatroomWidget*>(g->getGroupWidget()) != activeChatroomWidget);
|
||||
|
||||
if (targeted || Settings::getInstance().getGroupAlwaysNotify())
|
||||
newGroupMessageAlert(g->getGroupId());
|
||||
|
||||
if (targeted)
|
||||
g->setMentionedFlag(true); // useful for highlighting line or desktop notifications
|
||||
|
||||
g->getGroupWidget()->updateStatusLight();
|
||||
ContentDialog::updateGroupStatus(g->getGroupId());
|
||||
|
||||
if (g->getGroupWidget()->isActive())
|
||||
setWindowTitle(g->getGroupWidget()->getTitle());
|
||||
}
|
||||
|
||||
void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Change)
|
||||
|
|
Loading…
Reference in New Issue
Block a user