diff --git a/retroshare-gui/src/gui/common/RSTabWidget.cpp b/retroshare-gui/src/gui/common/RSTabWidget.cpp
index 2d4e580c9..807315890 100644
--- a/retroshare-gui/src/gui/common/RSTabWidget.cpp
+++ b/retroshare-gui/src/gui/common/RSTabWidget.cpp
@@ -26,6 +26,7 @@
RSTabWidget::RSTabWidget(QWidget *parent) : QTabWidget(parent)
{
+ mHideTabBarWithOneTab = false;
}
QTabBar *RSTabWidget::tabBar() const
@@ -41,3 +42,40 @@ void RSTabWidget::hideCloseButton(int index)
tabButton->hide();
}
}
+
+void RSTabWidget::setHideTabBarWithOneTab(bool hideTabBar)
+{
+ if (mHideTabBarWithOneTab == hideTabBar) {
+ return;
+ }
+
+ mHideTabBarWithOneTab = hideTabBar;
+ hideTabBarWithOneTab();
+}
+
+void RSTabWidget::tabInserted(int index)
+{
+ QTabWidget::tabInserted(index);
+
+ if (mHideTabBarWithOneTab) {
+ hideTabBarWithOneTab();
+ }
+}
+
+void RSTabWidget::tabRemoved(int index)
+{
+ QTabWidget::tabRemoved(index);
+
+ if (mHideTabBarWithOneTab) {
+ hideTabBarWithOneTab();
+ }
+}
+
+void RSTabWidget::hideTabBarWithOneTab()
+{
+ if (mHideTabBarWithOneTab) {
+ tabBar()->setVisible(count() > 1);
+ } else {
+ tabBar()->show();
+ }
+}
diff --git a/retroshare-gui/src/gui/common/RSTabWidget.h b/retroshare-gui/src/gui/common/RSTabWidget.h
index 986c2a2e5..674445069 100644
--- a/retroshare-gui/src/gui/common/RSTabWidget.h
+++ b/retroshare-gui/src/gui/common/RSTabWidget.h
@@ -31,9 +31,20 @@ public:
RSTabWidget(QWidget *parent = 0);
void hideCloseButton(int index);
+ void setHideTabBarWithOneTab(bool hideTabBar);
public:
QTabBar *tabBar() const;
+
+protected:
+ virtual void tabInserted(int index);
+ virtual void tabRemoved(int index);
+
+private:
+ void hideTabBarWithOneTab();
+
+private:
+ bool mHideTabBarWithOneTab;
};
#endif
diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp
index 2e4274731..7e86f5ed4 100644
--- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp
+++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp
@@ -192,6 +192,11 @@ void GxsGroupFrameDialog::setSingleTab(bool singleTab)
}
}
+void GxsGroupFrameDialog::setHideTabBarWithOneTab(bool hideTabBarWithOneTab)
+{
+ ui->messageTabWidget->setHideTabBarWithOneTab(hideTabBarWithOneTab);
+}
+
void GxsGroupFrameDialog::updateDisplay(bool complete)
{
if (complete || !getGrpIds().empty() || !getGrpIdsMeta().empty()) {
diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h
index c4b7336af..892be3f95 100644
--- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h
+++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h
@@ -83,6 +83,7 @@ protected:
RsGxsGroupId groupId() { return mGroupId; }
void setSingleTab(bool singleTab);
+ void setHideTabBarWithOneTab(bool hideTabBarWithOneTab);
bool getCurrentGroupName(QString& name);
virtual RetroShareLink::enumType getLinkType() = 0;
diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp
index 57d6a9138..95a867236 100644
--- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp
+++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp
@@ -100,6 +100,7 @@ QString GxsChannelDialog::icon(IconType type)
void GxsChannelDialog::settingsChanged()
{
setSingleTab(!Settings->getChannelOpenAllInNewTab());
+ setHideTabBarWithOneTab(Settings->getChannelHideTabBarWithOneTab());
}
GxsGroupDialog *GxsChannelDialog::createNewGroupDialog(TokenQueue *tokenQueue)
diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp
index 6b09e58d0..ac2f59ea6 100644
--- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp
+++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp
@@ -104,6 +104,7 @@ QString GxsForumsDialog::icon(IconType type)
void GxsForumsDialog::settingsChanged()
{
setSingleTab(!Settings->getForumOpenAllInNewTab());
+ setHideTabBarWithOneTab(Settings->getForumHideTabBarWithOneTab());
}
GxsGroupDialog *GxsForumsDialog::createNewGroupDialog(TokenQueue *tokenQueue)
diff --git a/retroshare-gui/src/gui/settings/ChannelPage.cpp b/retroshare-gui/src/gui/settings/ChannelPage.cpp
index 8fe5b8bd1..1e19f22ec 100644
--- a/retroshare-gui/src/gui/settings/ChannelPage.cpp
+++ b/retroshare-gui/src/gui/settings/ChannelPage.cpp
@@ -38,6 +38,7 @@ ChannelPage::~ChannelPage()
bool ChannelPage::save(QString &/*errmsg*/)
{
Settings->setChannelOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
+ Settings->setChannelHideTabBarWithOneTab(ui.hideTabBarWithOneTabCheckBox->isChecked());
return true;
}
@@ -46,4 +47,5 @@ bool ChannelPage::save(QString &/*errmsg*/)
void ChannelPage::load()
{
ui.openAllInNewTabCheckBox->setChecked(Settings->getChannelOpenAllInNewTab());
+ ui.hideTabBarWithOneTabCheckBox->setChecked(Settings->getChannelHideTabBarWithOneTab());
}
diff --git a/retroshare-gui/src/gui/settings/ChannelPage.ui b/retroshare-gui/src/gui/settings/ChannelPage.ui
index 53882695a..2454c2f5e 100644
--- a/retroshare-gui/src/gui/settings/ChannelPage.ui
+++ b/retroshare-gui/src/gui/settings/ChannelPage.ui
@@ -25,9 +25,9 @@
-
-
+
- New channel
+ Tabs
-
@@ -37,6 +37,13 @@
+ -
+
+
+ Hide tabbar with one open tab
+
+
+
diff --git a/retroshare-gui/src/gui/settings/ForumPage.cpp b/retroshare-gui/src/gui/settings/ForumPage.cpp
index b23e1fa4f..1f5debc36 100644
--- a/retroshare-gui/src/gui/settings/ForumPage.cpp
+++ b/retroshare-gui/src/gui/settings/ForumPage.cpp
@@ -40,6 +40,7 @@ bool ForumPage::save(QString &/*errmsg*/)
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
+ Settings->setForumHideTabBarWithOneTab(ui.hideTabBarWithOneTabCheckBox->isChecked());
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
return true;
@@ -51,5 +52,6 @@ void ForumPage::load()
ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate());
ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages());
ui.openAllInNewTabCheckBox->setChecked(Settings->getForumOpenAllInNewTab());
+ ui.hideTabBarWithOneTabCheckBox->setChecked(Settings->getForumHideTabBarWithOneTab());
ui.loadEmbeddedImages->setChecked(Settings->getForumLoadEmbeddedImages());
}
diff --git a/retroshare-gui/src/gui/settings/ForumPage.ui b/retroshare-gui/src/gui/settings/ForumPage.ui
index 3fdf7c7ef..7de72a798 100644
--- a/retroshare-gui/src/gui/settings/ForumPage.ui
+++ b/retroshare-gui/src/gui/settings/ForumPage.ui
@@ -55,9 +55,9 @@
-
-
+
- New forum
+ Tabs
-
@@ -67,6 +67,13 @@
+ -
+
+
+ Hide tabbar with one open tab
+
+
+
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp
index b6ee0780e..1c3f0251b 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.cpp
+++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp
@@ -985,7 +985,7 @@ void RshareSettings::setForumExpandNewMessages(bool value)
bool RshareSettings::getForumOpenAllInNewTab()
{
- return valueFromGroup("ForumDialog", "OpenAllInNewTab", true).toBool();
+ return valueFromGroup("ForumDialog", "OpenAllInNewTab", false).toBool();
}
void RshareSettings::setForumOpenAllInNewTab(bool value)
@@ -993,9 +993,19 @@ void RshareSettings::setForumOpenAllInNewTab(bool value)
setValueToGroup("ForumDialog", "OpenAllInNewTab", value);
}
+bool RshareSettings::getForumHideTabBarWithOneTab()
+{
+ return valueFromGroup("ForumDialog", "HideTabBarWithOneTab", true).toBool();
+}
+
+void RshareSettings::setForumHideTabBarWithOneTab(bool value)
+{
+ setValueToGroup("ForumDialog", "HideTabBarWithOneTab", value);
+}
+
bool RshareSettings::getChannelOpenAllInNewTab()
{
- return valueFromGroup("ChannelDialog", "OpenAllInNewTab", true).toBool();
+ return valueFromGroup("ChannelDialog", "OpenAllInNewTab", false).toBool();
}
void RshareSettings::setChannelOpenAllInNewTab(bool value)
@@ -1003,6 +1013,16 @@ void RshareSettings::setChannelOpenAllInNewTab(bool value)
setValueToGroup("ChannelDialog", "OpenAllInNewTab", value);
}
+bool RshareSettings::getChannelHideTabBarWithOneTab()
+{
+ return valueFromGroup("ChannelDialog", "HideTabBarWithOneTab", true).toBool();
+}
+
+void RshareSettings::setChannelHideTabBarWithOneTab(bool value)
+{
+ setValueToGroup("ChannelDialog", "HideTabBarWithOneTab", value);
+}
+
/* time before idle */
uint RshareSettings::getMaxTimeBeforeIdle()
{
diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h
index bbceafcca..0498c7afa 100644
--- a/retroshare-gui/src/gui/settings/rsharesettings.h
+++ b/retroshare-gui/src/gui/settings/rsharesettings.h
@@ -301,10 +301,16 @@ public:
void setForumExpandNewMessages(bool value);
bool getForumOpenAllInNewTab();
void setForumOpenAllInNewTab(bool value);
+ bool getForumHideTabBarWithOneTab();
+ void setForumHideTabBarWithOneTab(bool value);
bool getForumLoadEmbeddedImages();
void setForumLoadEmbeddedImages(bool value);
+
+ /* Channels */
bool getChannelOpenAllInNewTab();
void setChannelOpenAllInNewTab(bool value);
+ bool getChannelHideTabBarWithOneTab();
+ void setChannelHideTabBarWithOneTab(bool value);
/* time before idle */
uint getMaxTimeBeforeIdle();