mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -04:00
Changed some internals in the chat dialog handling (private chat and lobby).
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4855 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
44ff9fe4f7
commit
2aa1ede192
7 changed files with 62 additions and 8 deletions
|
@ -21,6 +21,7 @@
|
|||
****************************************************************/
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "PopupChatWindow.h"
|
||||
#include "ChatDialog.h"
|
||||
|
@ -137,6 +138,27 @@ void PopupChatWindow::showEvent(QShowEvent */*event*/)
|
|||
}
|
||||
}
|
||||
|
||||
void PopupChatWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
if (tabbedWindow) {
|
||||
for (int index = ui.tabWidget->count() - 1; index >= 0; --index) {
|
||||
ChatDialog *dialog = dynamic_cast<ChatDialog*>(ui.tabWidget->widget(0));
|
||||
if (dialog == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!dialog->close()) {
|
||||
event->ignore();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (chatDialog && !chatDialog->close()) {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ChatDialog *PopupChatWindow::getCurrentDialog()
|
||||
{
|
||||
if (tabbedWindow) {
|
||||
|
@ -160,6 +182,8 @@ void PopupChatWindow::addDialog(ChatDialog *dialog)
|
|||
|
||||
/* signal toggled is called */
|
||||
ui.actionSetOnTop->setChecked(PeerSettings->getPrivateChatOnTop(peerId));
|
||||
|
||||
QObject::connect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
||||
}
|
||||
|
||||
QObject::connect(dialog, SIGNAL(infoChanged(ChatDialog*)), this, SLOT(tabInfoChanged(ChatDialog*)));
|
||||
|
@ -178,6 +202,8 @@ void PopupChatWindow::removeDialog(ChatDialog *dialog)
|
|||
deleteLater();
|
||||
}
|
||||
} else {
|
||||
QObject::disconnect(dialog, SIGNAL(dialogClose(ChatDialog*)), this, SLOT(dialogClose(ChatDialog*)));
|
||||
|
||||
if (chatDialog == dialog) {
|
||||
saveSettings();
|
||||
dialog->removeFromParent(this);
|
||||
|
@ -280,6 +306,13 @@ void PopupChatWindow::tabClosed(ChatDialog *dialog)
|
|||
}
|
||||
}
|
||||
|
||||
void PopupChatWindow::dialogClose(ChatDialog *dialog)
|
||||
{
|
||||
if (!tabbedWindow) {
|
||||
removeDialog(dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void PopupChatWindow::tabChanged(ChatDialog *dialog)
|
||||
{
|
||||
calculateStyle(dialog);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue