mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23988 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ed6b853964
commit
d9a3ca2033
@ -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 "
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -23,21 +23,10 @@ using namespace std;
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
TocModel::TocModel(Toc const & toc)
|
||||
{
|
||||
populate(toc);
|
||||
}
|
||||
typedef std::pair<QModelIndex, TocIterator> TocPair;
|
||||
|
||||
|
||||
TocModel const & TocModel::operator=(Toc const & toc)
|
||||
{
|
||||
populate(toc);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
|
@ -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_;
|
||||
|
Loading…
Reference in New Issue
Block a user