cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23988 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-03-26 22:25:43 +00:00
parent ed6b853964
commit d9a3ca2033
4 changed files with 15 additions and 38 deletions

View File

@ -573,7 +573,7 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event)
case WarningException: case WarningException:
Alert::warning(e.title_, e.details_); Alert::warning(e.title_, e.details_);
return false; return false;
}; }
} }
catch (exception const & e) { catch (exception const & e) {
docstring s = _("LyX has caught an exception, it will now " docstring s = _("LyX has caught an exception, it will now "

View File

@ -137,22 +137,23 @@ TocList const & GuiToc::tocs() const
bool GuiToc::initialiseParams(string const & data) bool GuiToc::initialiseParams(string const & data)
{ {
LYXERR(Debug::GUI, data); LYXERR(Debug::GUI, data);
QString str = QString::fromUtf8(data.c_str()); QString str = toqstr(data);
QString new_type; QString new_type;
if (str.contains("tableofcontents")) if (str.contains("tableofcontents")) {
new_type = "tableofcontents"; new_type = "tableofcontents";
else if (str.contains("floatlist")) { } else if (str.contains("floatlist")) {
if (str.contains("\"figure")) if (str.contains("\"figure"))
new_type = "figure"; new_type = "figure";
else if (str.contains("\"table")) else if (str.contains("\"table"))
new_type = "table"; new_type = "table";
else if (str.contains("\"algorithm")) else if (str.contains("\"algorithm"))
new_type = "algorithm"; new_type = "algorithm";
} else if (!data.empty()) } else if (!str.isEmpty()) {
new_type = toqstr(data); new_type = str;
else } else {
// Default to Outliner. // Default to Outliner.
new_type = "tableofcontents"; new_type = "tableofcontents";
}
types_.clear(); types_.clear();
type_names_.clear(); type_names_.clear();
@ -166,14 +167,7 @@ bool GuiToc::initialiseParams(string const & data)
toc_models_.push_back(new TocModel(it->second)); toc_models_.push_back(new TocModel(it->second));
} }
int selected_type = -1; widget_->updateGui(types_.indexOf(new_type));
for (int i = 0; i != types_.size(); ++i) {
if (new_type == types_[i]) {
selected_type = i;
break;
}
}
widget_->updateGui(selected_type);
return true; return true;
} }

View File

@ -23,21 +23,10 @@ using namespace std;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef std::pair<QModelIndex, TocIterator> TocPair;
TocModel::TocModel(Toc const & toc)
{
populate(toc);
}
TocModel const & TocModel::operator=(Toc const & toc) TocIterator TocModel::tocIterator(QModelIndex const & index) const
{
populate(toc);
return *this;
}
TocIterator const TocModel::tocIterator(QModelIndex const & index) const
{ {
TocMap::const_iterator map_it = toc_map_.find(index); TocMap::const_iterator map_it = toc_map_.find(index);
BOOST_ASSERT(map_it != toc_map_.end()); 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); ModelMap::const_iterator map_it = model_map_.find(it);
//BOOST_ASSERT(it != model_map_.end()); //BOOST_ASSERT(it != model_map_.end());

View File

@ -31,19 +31,15 @@ public:
/// ///
TocModel() {} TocModel() {}
/// ///
TocModel(Toc const & toc); TocModel(Toc const & toc) { populate(toc); }
///
~TocModel() {}
///
TocModel const & operator=(Toc const & toc);
/// ///
void clear(); void clear();
/// ///
void populate(Toc const & toc); 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; int modelDepth() const;
@ -54,8 +50,6 @@ private:
/// ///
typedef std::map<QModelIndex, TocIterator> TocMap; typedef std::map<QModelIndex, TocIterator> TocMap;
/// ///
typedef std::pair<QModelIndex, TocIterator> TocPair;
///
typedef std::map<TocIterator, QModelIndex> ModelMap; typedef std::map<TocIterator, QModelIndex> ModelMap;
/// ///
TocMap toc_map_; TocMap toc_map_;