diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp
index 39065e4a4..a45e35faf 100644
--- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp
+++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp
@@ -29,25 +29,18 @@
#define IMAGE_SUBSCRIBE ""
#define IMAGE_UNSUBSCRIBE ""
-static ChatLobbyWidget *instance = NULL;
-
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
: RsAutoUpdatePage(5000,parent)
{
setupUi(this);
- if (instance == NULL) {
- instance = this;
- }
-
QObject::connect(NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged()));
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&)));
QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites()));
QObject::connect(lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCostumPopupMenu()));
QObject::connect(lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int)));
- QObject::connect(lobbyTabWidget, SIGNAL(infoChanged()), this, SLOT(tabInfoChanged()));
-
+
QObject::connect(newlobbypushButton, SIGNAL(clicked()), this, SLOT(createChatLobby()));
compareRole = new RSTreeWidgetItemCompareRole;
@@ -86,14 +79,6 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags)
ChatLobbyWidget::~ChatLobbyWidget()
{
- if (this == instance) {
- instance = NULL;
- }
-}
-
-/*static*/ ChatTabWidget *ChatLobbyWidget::getTabWidget()
-{
- return instance ? instance->lobbyTabWidget : NULL;
}
void ChatLobbyWidget::lobbyTreeWidgetCostumPopupMenu()
@@ -367,13 +352,3 @@ void ChatLobbyWidget::readChatLobbyInvites()
}
}
}
-
-void ChatLobbyWidget::tabInfoChanged()
-{
- emit infoChanged();
-}
-
-void ChatLobbyWidget::getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon)
-{
- lobbyTabWidget->getInfo(isTyping, hasNewMessage, icon);
-}
diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.h b/retroshare-gui/src/gui/ChatLobbyWidget.h
index d8ce27f4b..f4f17484b 100644
--- a/retroshare-gui/src/gui/ChatLobbyWidget.h
+++ b/retroshare-gui/src/gui/ChatLobbyWidget.h
@@ -4,7 +4,6 @@
#include "RsAutoUpdatePage.h"
class RSTreeWidgetItemCompareRole;
-class ChatTabWidget;
class ChatLobbyWidget : public RsAutoUpdatePage, Ui::ChatLobbyWidget
{
@@ -18,12 +17,6 @@ public:
~ChatLobbyWidget();
virtual void updateDisplay();
- void getInfo(bool &isTyping, bool &hasNewMessage, QIcon *icon);
-
- static ChatTabWidget *getTabWidget();
-
-signals:
- void infoChanged();
protected slots:
void lobbyChanged();
@@ -34,7 +27,6 @@ protected slots:
void itemDoubleClicked(QTreeWidgetItem *item, int column);
void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& nickname, const QString& str);
void readChatLobbyInvites();
- void tabInfoChanged();
private:
RSTreeWidgetItemCompareRole *compareRole;
diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.ui b/retroshare-gui/src/gui/ChatLobbyWidget.ui
index 52c350d31..6b6574dc1 100644
--- a/retroshare-gui/src/gui/ChatLobbyWidget.ui
+++ b/retroshare-gui/src/gui/ChatLobbyWidget.ui
@@ -174,22 +174,11 @@ p, li { white-space: pre-wrap; }
-
-
-
- -1
-
+
-
-
- ChatTabWidget
- QTabWidget
-
- 1
-
-
diff --git a/retroshare-gui/src/gui/FriendsDialog.cpp b/retroshare-gui/src/gui/FriendsDialog.cpp
index 1387a8799..2ae6eb8eb 100644
--- a/retroshare-gui/src/gui/FriendsDialog.cpp
+++ b/retroshare-gui/src/gui/FriendsDialog.cpp
@@ -68,6 +68,8 @@
* #define FRIENDS_DEBUG 1
*****/
+static FriendsDialog *instance = NULL;
+
/** Constructor */
FriendsDialog::FriendsDialog(QWidget *parent)
: RsAutoUpdatePage(1500,parent)
@@ -75,6 +77,10 @@ FriendsDialog::FriendsDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
+ if (instance == NULL) {
+ instance = this;
+ }
+
last_status_send_time = 0 ;
connect( ui.mypersonalstatuslabel, SIGNAL(clicked()), SLOT(statusmessage()));
@@ -87,18 +93,20 @@ FriendsDialog::FriendsDialog(QWidget *parent)
ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME);
ui.avatar->setOwnId();
- chatLobbyWidget = new ChatLobbyWidget();
- QObject::connect(chatLobbyWidget, SIGNAL(infoChanged()), this, SLOT(lobbyInfoChanged()));
- chatlobbyTabIndex = ui.peertabWidget->addTab(chatLobbyWidget, tr("Chat lobbies"));
- ui.peertabWidget->setTabPosition(QTabWidget::North);
- ui.peertabWidget->addTab(new ProfileWidget(), tr("Profile"));
+ ui.tabWidget->setTabPosition(QTabWidget::North);
+ ui.tabWidget->addTab(new ChatLobbyWidget(), tr("Chat lobbies"));
+ ui.tabWidget->addTab(new ProfileWidget(), tr("Profile"));
NewsFeed *newsFeed = new NewsFeed();
- newsFeedTabIndex = ui.peertabWidget->addTab(newsFeed, tr("News Feed"));
- ui.peertabWidget->tabBar()->setIconSize(QSize(10, 10));
+ newsFeedTabIndex = ui.tabWidget->addTab(newsFeed, tr("News Feed"));
+
+ ui.tabWidget->hideCloseButton(0);
+ ui.tabWidget->hideCloseButton(1);
+ ui.tabWidget->hideCloseButton(2);
+ ui.tabWidget->hideCloseButton(3);
/* get the current text and text color of the tab bar */
- newsFeedTabColor = ui.peertabWidget->tabBar()->tabTextColor(newsFeedTabIndex);
- newsFeedText = ui.peertabWidget->tabBar()->tabText(newsFeedTabIndex);
+ newsFeedTabColor = ui.tabWidget->tabBar()->tabTextColor(newsFeedTabIndex);
+ newsFeedText = ui.tabWidget->tabBar()->tabText(newsFeedTabIndex);
connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int)));
@@ -206,6 +214,10 @@ FriendsDialog::~FriendsDialog ()
{
// save settings
processSettings(false);
+
+ if (this == instance) {
+ instance = NULL;
+ }
}
void FriendsDialog::processSettings(bool bLoad)
@@ -810,28 +822,23 @@ void FriendsDialog::on_actionAdd_Group_activated()
void FriendsDialog::newsFeedChanged(int count)
{
if (count) {
- ui.peertabWidget->tabBar()->setTabText(newsFeedTabIndex, QString("%1 (%2)").arg(newsFeedText).arg(count));
- ui.peertabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, Qt::blue);
- ui.peertabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED_NEW));
+ ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, QString("%1 (%2)").arg(newsFeedText).arg(count));
+ ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, Qt::blue);
+ ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED_NEW));
} else {
- ui.peertabWidget->tabBar()->setTabText(newsFeedTabIndex, newsFeedText);
- ui.peertabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, newsFeedTabColor);
- ui.peertabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
+ ui.tabWidget->tabBar()->setTabText(newsFeedTabIndex, newsFeedText);
+ ui.tabWidget->tabBar()->setTabTextColor(newsFeedTabIndex, newsFeedTabColor);
+ ui.tabWidget->tabBar()->setTabIcon(newsFeedTabIndex, QIcon(IMAGE_NEWSFEED));
}
}
-void FriendsDialog::lobbyInfoChanged()
-{
- bool isTyping;
- bool hasNewMessage;
- QIcon icon;
- chatLobbyWidget->getInfo(isTyping, hasNewMessage, &icon);
-
- ui.peertabWidget->setTabIcon(chatlobbyTabIndex, icon);
-}
-
void FriendsDialog::createChatLobby()
{
std::list friends;
CreateLobbyDialog(friends).exec();
}
+
+/*static*/ ChatTabWidget *FriendsDialog::getTabWidget()
+{
+ return instance ? instance->ui.tabWidget : NULL;
+}
diff --git a/retroshare-gui/src/gui/FriendsDialog.h b/retroshare-gui/src/gui/FriendsDialog.h
index 2aeb8709b..b5298e15f 100644
--- a/retroshare-gui/src/gui/FriendsDialog.h
+++ b/retroshare-gui/src/gui/FriendsDialog.h
@@ -27,7 +27,6 @@
#include "mainpage.h"
-
#ifndef MINIMAL_RSGUI
#include "ui_FriendsDialog.h"
@@ -35,8 +34,7 @@ class QFont;
class QAction;
class QTextEdit;
class QTextCharFormat;
-class ChatDialog;
-class ChatLobbyWidget;
+class ChatTabWidget;
class FriendsDialog : public RsAutoUpdatePage
{
@@ -50,6 +48,8 @@ public:
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
+ static ChatTabWidget *getTabWidget();
+
public slots:
void publicChatChanged(int type);
@@ -112,8 +112,6 @@ private slots:
void newsFeedChanged(int count);
- void lobbyInfoChanged();
-
void createChatLobby();
signals:
@@ -142,9 +140,6 @@ private:
QColor newsFeedTabColor;
QString newsFeedText;
- ChatLobbyWidget *chatLobbyWidget;
- int chatlobbyTabIndex;
-
/** Qt Designer generated object */
Ui::FriendsDialog ui;
};
diff --git a/retroshare-gui/src/gui/FriendsDialog.ui b/retroshare-gui/src/gui/FriendsDialog.ui
index a7196d36e..5a094c9c0 100644
--- a/retroshare-gui/src/gui/FriendsDialog.ui
+++ b/retroshare-gui/src/gui/FriendsDialog.ui
@@ -810,10 +810,13 @@ p, li { white-space: pre-wrap; }
-
-
+
0
+
+ true
+
Group Chat
@@ -1441,6 +1444,12 @@ background: white;}
+
+ ChatTabWidget
+ QTabWidget
+
+ 1
+
AvatarWidget
QWidget
@@ -1453,12 +1462,6 @@ background: white;}
1
-
- RSTabWidget
- QTabWidget
-
- 1
-
FriendList
QWidget
diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp
index 766c4fbce..12187ee54 100644
--- a/retroshare-gui/src/gui/MessagesDialog.cpp
+++ b/retroshare-gui/src/gui/MessagesDialog.cpp
@@ -300,11 +300,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.messagestreeView->installEventFilter(this);
// remove close button of the the first tab
- QTabBar::ButtonPosition buttonPosition = (QTabBar::ButtonPosition) ui.tabWidget->tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, 0);
- QWidget *tabButton = ui.tabWidget->tabBar()->tabButton(0, buttonPosition);
- if (tabButton) {
- tabButton->hide();
- }
+ ui.tabWidget->hideCloseButton(0);
/* Hide platform specific features */
#ifdef Q_WS_WIN
diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
index f6fed23c2..186ab46af 100644
--- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
+++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
@@ -23,9 +23,10 @@
#include
#include "ChatLobbyDialog.h"
-#include "gui/ChatLobbyWidget.h"
+#include "ChatTabWidget.h"
#include "gui/settings/rsharesettings.h"
#include "gui/settings/RsharePeerSettings.h"
+#include "gui/FriendsDialog.h"
#include
@@ -55,7 +56,7 @@ void ChatLobbyDialog::init(const std::string &peerId, const QString &title)
showParticipantsFrame(PeerSettings->getShowParticipantsFrame(peerId));
// add to window
- ChatTabWidget *tabWidget = ChatLobbyWidget::getTabWidget();
+ ChatTabWidget *tabWidget = FriendsDialog::getTabWidget();
if (tabWidget) {
tabWidget->addDialog(this);
}
@@ -174,7 +175,7 @@ bool ChatLobbyDialog::canClose()
void ChatLobbyDialog::showDialog(uint chatflags)
{
if (chatflags & RS_CHAT_FOCUS) {
- ChatTabWidget *tabWidget = ChatLobbyWidget::getTabWidget();
+ ChatTabWidget *tabWidget = FriendsDialog::getTabWidget();
if (tabWidget) {
tabWidget->setCurrentWidget(this);
}
diff --git a/retroshare-gui/src/gui/chat/ChatTabWidget.cpp b/retroshare-gui/src/gui/chat/ChatTabWidget.cpp
index 00fc8db6f..271a9f28a 100644
--- a/retroshare-gui/src/gui/chat/ChatTabWidget.cpp
+++ b/retroshare-gui/src/gui/chat/ChatTabWidget.cpp
@@ -30,7 +30,7 @@
#define IMAGE_CHAT ":/images/chat.png"
ChatTabWidget::ChatTabWidget(QWidget *parent) :
- QTabWidget(parent),
+ RSTabWidget(parent),
ui(new Ui::ChatTabWidget)
{
ui->setupUi(this);
diff --git a/retroshare-gui/src/gui/chat/ChatTabWidget.h b/retroshare-gui/src/gui/chat/ChatTabWidget.h
index cf2a438e5..388f51b46 100644
--- a/retroshare-gui/src/gui/chat/ChatTabWidget.h
+++ b/retroshare-gui/src/gui/chat/ChatTabWidget.h
@@ -23,7 +23,7 @@
#ifndef CHATTABWIDGET_H
#define CHATTABWIDGET_H
-#include
+#include "gui/common/RSTabWidget.h"
namespace Ui {
class ChatTabWidget;
@@ -31,7 +31,7 @@ class ChatTabWidget;
class ChatDialog;
-class ChatTabWidget : public QTabWidget
+class ChatTabWidget : public RSTabWidget
{
Q_OBJECT
diff --git a/retroshare-gui/src/gui/common/RSTabWidget.cpp b/retroshare-gui/src/gui/common/RSTabWidget.cpp
index b9e3f79de..2d4e580c9 100644
--- a/retroshare-gui/src/gui/common/RSTabWidget.cpp
+++ b/retroshare-gui/src/gui/common/RSTabWidget.cpp
@@ -19,6 +19,9 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
+#include
+#include
+
#include "RSTabWidget.h"
RSTabWidget::RSTabWidget(QWidget *parent) : QTabWidget(parent)
@@ -27,5 +30,14 @@ RSTabWidget::RSTabWidget(QWidget *parent) : QTabWidget(parent)
QTabBar *RSTabWidget::tabBar() const
{
- return QTabWidget::tabBar();
-};
+ return QTabWidget::tabBar();
+}
+
+void RSTabWidget::hideCloseButton(int index)
+{
+ QTabBar::ButtonPosition buttonPosition = (QTabBar::ButtonPosition) tabBar()->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, 0);
+ QWidget *tabButton = tabBar()->tabButton(index, buttonPosition);
+ if (tabButton) {
+ tabButton->hide();
+ }
+}
diff --git a/retroshare-gui/src/gui/common/RSTabWidget.h b/retroshare-gui/src/gui/common/RSTabWidget.h
index 68a728554..986c2a2e5 100644
--- a/retroshare-gui/src/gui/common/RSTabWidget.h
+++ b/retroshare-gui/src/gui/common/RSTabWidget.h
@@ -28,10 +28,12 @@
class RSTabWidget : public QTabWidget
{
public:
- RSTabWidget(QWidget *parent = 0);
+ RSTabWidget(QWidget *parent = 0);
+
+ void hideCloseButton(int index);
public:
- QTabBar *tabBar() const;
+ QTabBar *tabBar() const;
};
#endif