]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiToc.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[features.git] / src / frontends / qt4 / GuiToc.cpp
index f0c91b28912c039aab58b4fb8e5806dcb2e81929..73bd3d751eb4200f8d36a17a003ff5ff7207d355 100644 (file)
@@ -17,6 +17,7 @@
 #include "DockView.h"
 #include "TocWidget.h"
 #include "FuncRequest.h"
+
 #include "insets/InsetCommand.h"
 
 #include "TocModel.h"
@@ -33,6 +34,8 @@
 #include "support/debug.h"
 #include "support/gettext.h"
 
+#include "support/assert.h"
+
 #include <algorithm>
 
 using namespace std;
@@ -86,7 +89,7 @@ QStandardItemModel * GuiToc::tocModel(int type)
        LYXERR(Debug::GUI, "GuiToc: type " << type
                << "  toc_models_.size() " << toc_models_.size());
 
-       BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
+       LASSERT(type >= 0 && type < int(toc_models_.size()), /**/);
        return toc_models_[type];
 }
 
@@ -108,7 +111,7 @@ void GuiToc::goTo(int type, QModelIndex const & index)
                return;
        }
 
-       BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
+       LASSERT(type >= 0 && type < int(toc_models_.size()), /**/);
 
        TocIterator const it = toc_models_[type]->tocIterator(index);
 
@@ -134,22 +137,23 @@ TocList const & GuiToc::tocs() const
 bool GuiToc::initialiseParams(string const & data)
 {
        LYXERR(Debug::GUI, data);
-       QString str = QString::fromUtf8(data.c_str());
+       QString str = toqstr(data);
        QString new_type;
-       if (str.contains("tableofcontents"))
+       if (str.contains("tableofcontents")) {
                new_type = "tableofcontents";
-       else if (str.contains("floatlist")) {
+       else if (str.contains("floatlist")) {
                if (str.contains("\"figure"))
                        new_type = "figure";
                else if (str.contains("\"table"))
                        new_type = "table";
                else if (str.contains("\"algorithm"))
                        new_type = "algorithm";
-       } else if (!data.empty())
-               new_type = toqstr(data);
-       else
+       } else if (!str.isEmpty()) {
+               new_type = str;
+       } else {
                // Default to Outliner.
                new_type = "tableofcontents";
+       }
 
        types_.clear();
        type_names_.clear();
@@ -163,14 +167,7 @@ bool GuiToc::initialiseParams(string const & data)
                toc_models_.push_back(new TocModel(it->second));
        }
 
-       int selected_type = -1;
-       for (int i = 0; i != types_.size(); ++i) {
-               if (new_type == types_[i]) {
-                       selected_type = i;
-                       break;
-               }
-       }
-       widget_->updateGui(selected_type);
+       widget_->updateGui(types_.indexOf(new_type));
 
        return true;
 }
@@ -215,7 +212,7 @@ void GuiToc::updateBackend()
 
 TocIterator GuiToc::currentTocItem(int type) const
 {
-       BOOST_ASSERT(bufferview());
+       LASSERT(bufferview(), /**/);
        ParConstIterator it(bufferview()->cursor());
        return buffer().masterBuffer()->tocBackend().item(fromqstr(types_[type]), it);
 }
@@ -227,8 +224,6 @@ docstring GuiToc::guiName(string const & type) const
                return _("Table of Contents");
        if (type == "child")
                return _("Child Documents");
-       if (type == "embedded")
-               return _("Embedded Files");
        if (type == "graphics")
                return _("List of Graphics");
        if (type == "equation")