]> git.lyx.org Git - features.git/commitdiff
cosmetics
authorAndré Pönitz <poenitz@gmx.net>
Wed, 26 Mar 2008 22:25:43 +0000 (22:25 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 26 Mar 2008 22:25:43 +0000 (22:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23988 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiToc.cpp
src/frontends/qt4/TocModel.cpp
src/frontends/qt4/TocModel.h

index 7d322f36c6f5000483653387b0f50ffdce50be9d..b1ee77e2cf20a00948c88bebb2fe3f9bcbaa8856 100644 (file)
@@ -573,7 +573,7 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event)
                case WarningException:
                        Alert::warning(e.title_, e.details_);
                        return false;
-               };
+               }
        }
        catch (exception const & e) {
                docstring s = _("LyX has caught an exception, it will now "
index 41d24ddc6b97cd5531e368721cfcb7e9a978119a..1c5bc9258e0b46b6f6f8b618f967ef3d551c93cb 100644 (file)
@@ -137,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();
@@ -166,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;
 }
index 2f8fadc5039b8e40e7ab144f3f52272a003856d7..e5a305a704847db469cc32b5f77e972d7a18fdfc 100644 (file)
@@ -23,21 +23,10 @@ using namespace std;
 namespace lyx {
 namespace frontend {
 
-
-TocModel::TocModel(Toc const & toc)
-{
-       populate(toc);
-}
-
-
-TocModel const & TocModel::operator=(Toc const & toc)
-{
-       populate(toc);
-       return *this;
-}
+typedef std::pair<QModelIndex, TocIterator> TocPair;
 
 
-TocIterator const TocModel::tocIterator(QModelIndex const & index) const
+TocIterator TocModel::tocIterator(QModelIndex const & index) const
 {
        TocMap::const_iterator map_it = toc_map_.find(index);
        BOOST_ASSERT(map_it != toc_map_.end());
@@ -45,7 +34,7 @@ TocIterator const TocModel::tocIterator(QModelIndex const & index) const
 }
 
 
-QModelIndex const TocModel::modelIndex(TocIterator const & it) const
+QModelIndex TocModel::modelIndex(TocIterator const & it) const
 {
        ModelMap::const_iterator map_it = model_map_.find(it);
        //BOOST_ASSERT(it != model_map_.end());
index 1c56ed74af6ff0ca1094949d8445f5daaf64c2de..2003fedbc81858114b32a20a15857e31929ec5c8 100644 (file)
@@ -31,19 +31,15 @@ public:
        ///
        TocModel() {}
        ///
-       TocModel(Toc const & toc);
-       ///
-       ~TocModel() {}
-       ///
-       TocModel const & operator=(Toc const & toc);
+       TocModel(Toc const & toc) { populate(toc); }
        ///
        void clear();
        ///
        void populate(Toc const & toc);
        ///
-       TocIterator const tocIterator(QModelIndex const & index) const;
+       TocIterator tocIterator(QModelIndex const & index) const;
        ///
-       QModelIndex const modelIndex(TocIterator const & it) const;
+       QModelIndex modelIndex(TocIterator const & it) const;
        ///
        int modelDepth() const;
 
@@ -54,8 +50,6 @@ private:
        ///
        typedef std::map<QModelIndex, TocIterator> TocMap;
        ///
-       typedef std::pair<QModelIndex, TocIterator> TocPair;
-       ///
        typedef std::map<TocIterator, QModelIndex> ModelMap;
        ///
        TocMap toc_map_;