[prev in list] [next in list] [prev in thread] [next in thread]
List: lyx-devel
Subject: Re: Outline more persistent
From: Pavel Sanda <sanda () lyx ! org>
Date: 2008-10-01 15:21:28
Message-ID: 20081001152128.GR30462 () atrey ! karlin ! mff ! cuni ! cz
[Download RAW message or body]
Pavel Sanda wrote:
> Abdelrazak Younes wrote:
> >>> So, the checkbox you are proposing will govern the call to
> >>> setTreeDetph()?
> >>>
> >>
> >> strictly speaking i would like to have ui switch between those two modes
> >> distinguished here:
> >> http://www.lyx.org/trac/changeset/26637
> >>
> >
> > OK, that was my understanding. How would you describe this check box?
> > "Automatic collapsing"?
> > I am not very keen on adding this check box but if this is the only
> > solution to keep each type of user happy, why not...
>
> my proposal is to add checkbox just below sort and it would be good
> to have short naming. what about 'Keep' with 'Keep uncollapsed state'
> tooltip?
would you be oposed to such a solution?
pavel
["persistent.patch" (text/plain)]
diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp
index b854c4d..5c4e7d4 100644
--- a/src/frontends/qt4/TocWidget.cpp
+++ b/src/frontends/qt4/TocWidget.cpp
@@ -35,7 +35,7 @@ namespace lyx {
namespace frontend {
TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
- : QWidget(parent), depth_(0), gui_view_(gui_view)
+ : QWidget(parent), depth_(0), persistent_(false), gui_view_(gui_view)
{
setupUi(this);
@@ -105,6 +105,12 @@ void TocWidget::on_sortCB_stateChanged(int state)
updateView();
}
+void TocWidget::on_persistentCB_stateChanged(int state)
+{
+ persistent_ = state == Qt::Checked;
+}
+
+
/* FIXME (Ugras 17/11/06):
I have implemented a indexDepth function to get the model indices. In my
opinion, somebody should derive a new qvariant class for tocModelItem
@@ -228,6 +234,7 @@ void TocWidget::enableControls(bool enable)
moveDownTB->setEnabled(enable);
moveInTB->setEnabled(enable);
moveOutTB->setEnabled(enable);
+ persistentCB->setEnabled(enable);
if (!enable) {
depthSL->setMaximum(0);
depthSL->setValue(0);
@@ -263,19 +270,22 @@ void TocWidget::updateView()
if (tocTV->model() != toc_model) {
tocTV->setModel(toc_model);
tocTV->setEditTriggers(QAbstractItemView::NoEditTriggers);
- setTreeDepth(depth_);
+ if (persistent_) setTreeDepth(depth_);
}
sortCB->blockSignals(true);
sortCB->setChecked(gui_view_.tocModels().isSorted(current_type_));
sortCB->blockSignals(false);
+ persistentCB->setChecked(persistent_);
+
bool controls_enabled = toc_model && toc_model->rowCount() > 0
&& !gui_view_.buffer()->isReadonly();
enableControls(controls_enabled);
depthSL->setMaximum(gui_view_.tocModels().depth(current_type_));
depthSL->setValue(depth_);
+ if (!persistent_) setTreeDepth(depth_);
if (canNavigate(current_type_))
select(gui_view_.tocModels().currentIndex(current_type_));
tocTV->setEnabled(true);
diff --git a/src/frontends/qt4/TocWidget.h b/src/frontends/qt4/TocWidget.h
index b80e477..cfac929 100644
--- a/src/frontends/qt4/TocWidget.h
+++ b/src/frontends/qt4/TocWidget.h
@@ -49,6 +49,7 @@ protected Q_SLOTS:
void on_tocTV_clicked(QModelIndex const &);
void on_updateTB_clicked();
void on_sortCB_stateChanged(int state);
+ void on_persistentCB_stateChanged(int state);
void on_depthSL_valueChanged(int depth);
void on_typeCO_currentIndexChanged(int value);
void on_moveUpTB_clicked();
@@ -68,6 +69,8 @@ private:
/// depth of list shown
int depth_;
+ /// persistence of uncollapsed nodes in toc view
+ bool persistent_;
///
GuiView & gui_view_;
};
diff --git a/src/frontends/qt4/ui/TocUi.ui b/src/frontends/qt4/ui/TocUi.ui
index 2fe2231..015df28 100644
--- a/src/frontends/qt4/ui/TocUi.ui
+++ b/src/frontends/qt4/ui/TocUi.ui
@@ -8,15 +8,15 @@
<rect>
<x>0</x>
<y>0</y>
- <width>185</width>
- <height>184</height>
+ <width>202</width>
+ <height>332</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" colspan="4" >
+ <item row="0" column="0" colspan="2" >
<widget class="QComboBox" name="typeCO" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
@@ -29,7 +29,7 @@
</property>
</widget>
</item>
- <item row="1" column="0" colspan="4" >
+ <item row="1" column="0" colspan="2" >
<widget class="QTreeView" name="tocTV" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Ignored" >
@@ -39,7 +39,89 @@
</property>
</widget>
</item>
- <item row="3" column="0" colspan="4" >
+ <item row="2" column="0" >
+ <widget class="QSlider" name="depthSL" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Adjust the depth of the navigation tree</string>
+ </property>
+ <property name="maximum" >
+ <number>5</number>
+ </property>
+ <property name="pageStep" >
+ <number>1</number>
+ </property>
+ <property name="value" >
+ <number>2</number>
+ </property>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition" >
+ <enum>QSlider::TicksBothSides</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <layout class="QVBoxLayout" name="_2" >
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <property name="sizeConstraint" >
+ <enum>QLayout::SetMinimumSize</enum>
+ </property>
+ <property name="leftMargin" >
+ <number>4</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="sortCB" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>21</height>
+ </size>
+ </property>
+ <property name="text" >
+ <string>Sort</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="persistentCB" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize" >
+ <size>
+ <width>0</width>
+ <height>21</height>
+ </size>
+ </property>
+ <property name="toolTip" >
+ <string>Keep persistent state of uncollapsed nodes</string>
+ </property>
+ <property name="text" >
+ <string>Keep</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
@@ -162,41 +244,6 @@
</item>
</layout>
</item>
- <item row="2" column="0" colspan="3" >
- <widget class="QSlider" name="depthSL" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip" >
- <string>Adjust the depth of the navigation tree</string>
- </property>
- <property name="maximum" >
- <number>5</number>
- </property>
- <property name="pageStep" >
- <number>1</number>
- </property>
- <property name="value" >
- <number>2</number>
- </property>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition" >
- <enum>QSlider::TicksBothSides</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="3" >
- <widget class="QCheckBox" name="sortCB" >
- <property name="text" >
- <string>Sort</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<tabstops>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic