mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Added new option to hide the tabbar with one open tab in forums and channels.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7450 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
b6089f3b91
commit
d6408daafc
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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()) {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -100,6 +100,7 @@ QString GxsChannelDialog::icon(IconType type)
|
||||
void GxsChannelDialog::settingsChanged()
|
||||
{
|
||||
setSingleTab(!Settings->getChannelOpenAllInNewTab());
|
||||
setHideTabBarWithOneTab(Settings->getChannelHideTabBarWithOneTab());
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsChannelDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
|
@ -104,6 +104,7 @@ QString GxsForumsDialog::icon(IconType type)
|
||||
void GxsForumsDialog::settingsChanged()
|
||||
{
|
||||
setSingleTab(!Settings->getForumOpenAllInNewTab());
|
||||
setHideTabBarWithOneTab(Settings->getForumHideTabBarWithOneTab());
|
||||
}
|
||||
|
||||
GxsGroupDialog *GxsForumsDialog::createNewGroupDialog(TokenQueue *tokenQueue)
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -25,9 +25,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="gxsGroupBox">
|
||||
<widget class="QGroupBox" name="tabsGroupBox">
|
||||
<property name="title">
|
||||
<string>New channel</string>
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -37,6 +37,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideTabBarWithOneTabCheckBox">
|
||||
<property name="text">
|
||||
<string>Hide tabbar with one open tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -55,9 +55,9 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="gxsGroupBox">
|
||||
<widget class="QGroupBox" name="tabsGroupBox">
|
||||
<property name="title">
|
||||
<string>New forum</string>
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -67,6 +67,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideTabBarWithOneTabCheckBox">
|
||||
<property name="text">
|
||||
<string>Hide tabbar with one open tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user