removed duplicated functionalities from chat window tool bar and moved the other ones into context menu

This commit is contained in:
csoler 2019-08-25 11:10:13 +02:00
parent 34f0c46bc9
commit 014c50c104
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
3 changed files with 42 additions and 13 deletions

View File

@ -22,6 +22,7 @@
#include <QPixmap>
#include <QCloseEvent>
#include <QMenu>
#include "PopupChatWindow.h"
#include "ChatDialog.h"
@ -75,21 +76,30 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WindowFlags f
ui.tabWidget->setVisible(tabbedWindow);
if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW) {
ui.actionDockTab->setVisible(tabbedWindow == false);
ui.actionUndockTab->setVisible(tabbedWindow);
} else {
ui.actionDockTab->setVisible(false);
ui.actionUndockTab->setVisible(false);
}
// if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW) {
// ui.actionDockTab->setVisible(tabbedWindow == false);
// ui.actionUndockTab->setVisible(tabbedWindow);
// } else {
// ui.actionDockTab->setVisible(false);
// ui.actionUndockTab->setVisible(false);
//
// }
// ui.actionAvatar->setVisible(false); // removed because it is already handled by clicking on your own avatar.
// ui.actionSetOnTop->setVisible(false);// removed, because the window manager should handle this already.
// ui.actionColor->setVisible(false);// moved to the context menu
ui.chattoolBar->hide(); // no widgets left!
setAttribute(Qt::WA_DeleteOnClose, true);
connect(ui.actionAvatar, SIGNAL(triggered()),this, SLOT(getAvatar()));
connect(ui.actionColor, SIGNAL(triggered()), this, SLOT(setStyle()));
connect(ui.actionDockTab, SIGNAL(triggered()), this, SLOT(dockTab()));
connect(ui.actionUndockTab, SIGNAL(triggered()), this, SLOT(undockTab()));
connect(ui.actionSetOnTop, SIGNAL(toggled(bool)), this, SLOT(setOnTop()));
// connect(ui.actionAvatar, SIGNAL(triggered()),this, SLOT(getAvatar()));
// connect(ui.actionColor, SIGNAL(triggered()), this, SLOT(setStyle()));
// connect(ui.actionDockTab, SIGNAL(triggered()), this, SLOT(dockTab()));
// connect(ui.actionUndockTab, SIGNAL(triggered()), this, SLOT(undockTab()));
// connect(ui.actionSetOnTop, SIGNAL(toggled(bool)), this, SLOT(setOnTop()));
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
connect(ui.tabWidget, SIGNAL(tabChanged(ChatDialog*)), this, SLOT(tabChanged(ChatDialog*)));
connect(ui.tabWidget, SIGNAL(tabClosed(ChatDialog*)), this, SLOT(tabClosed(ChatDialog*)));
@ -102,6 +112,21 @@ PopupChatWindow::PopupChatWindow(bool tabbed, QWidget *parent, Qt::WindowFlags f
}
}
void PopupChatWindow::showContextMenu(QPoint)
{
QMenu contextMnu(this);
contextMnu.addAction(QIcon(":/images/highlight.png"),tr("Choose window color..."),this,SLOT(setStyle()));
if (Settings->getChatFlags() & RS_CHAT_TABBED_WINDOW)
{
if(tabbedWindow)
contextMnu.addAction(QIcon(":/images/tab-dock.png"),tr("Dock window"),this,SLOT(docTab()));
contextMnu.addAction(QIcon(":/images/tab-undock.png"),tr("Dock window"),this,SLOT(undockTab()));
}
contextMnu.exec(QCursor::pos());
}
/** Destructor. */
PopupChatWindow::~PopupChatWindow()
{

View File

@ -55,6 +55,7 @@ protected:
void closeEvent(QCloseEvent *event);
private slots:
void setStyle();
void getAvatar();
void tabChanged(ChatDialog *dialog);
void tabInfoChanged(ChatDialog *dialog);
@ -63,9 +64,9 @@ private slots:
void dialogClose(ChatDialog *dialog);
void dockTab();
void undockTab();
void setStyle();
void setOnTop();
void blink(bool on);
void showContextMenu(QPoint p);
private:
bool tabbedWindow;

View File

@ -10,6 +10,9 @@
<height>451</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="windowTitle">
<string notr="true">MainWindow</string>
</property>