mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
frontend cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23516 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1e4f5ba47c
commit
e8f16a9bcb
@ -135,7 +135,7 @@ bool GuiToc::initialiseParams(string const & data)
|
||||
{
|
||||
LYXERR(Debug::GUI, data);
|
||||
QString str = QString::fromUtf8(data.c_str());
|
||||
string new_type;
|
||||
QString new_type;
|
||||
if (str.contains("tableofcontents"))
|
||||
new_type = "tableofcontents";
|
||||
else if (str.contains("floatlist")) {
|
||||
@ -154,13 +154,13 @@ bool GuiToc::initialiseParams(string const & data)
|
||||
TocList::const_iterator it = tocs.begin();
|
||||
TocList::const_iterator end = tocs.end();
|
||||
for (; it != end; ++it) {
|
||||
types_.push_back(it->first);
|
||||
type_names_.push_back(guiName(it->first));
|
||||
types_.push_back(toqstr(it->first));
|
||||
type_names_.push_back(toqstr(guiName(it->first)));
|
||||
toc_models_.push_back(new TocModel(it->second));
|
||||
}
|
||||
|
||||
int selected_type = -1;
|
||||
for (size_t i = 0; i != types_.size(); ++i) {
|
||||
for (int i = 0; i != types_.size(); ++i) {
|
||||
if (new_type == types_[i]) {
|
||||
selected_type = i;
|
||||
break;
|
||||
@ -213,7 +213,7 @@ TocIterator GuiToc::currentTocItem(int type) const
|
||||
{
|
||||
BOOST_ASSERT(bufferview());
|
||||
ParConstIterator it(bufferview()->cursor());
|
||||
return buffer().masterBuffer()->tocBackend().item(types_[type], it);
|
||||
return buffer().masterBuffer()->tocBackend().item(fromqstr(types_[type]), it);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,9 +21,7 @@
|
||||
|
||||
#include "TocBackend.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QStandardItemModel>
|
||||
#include <QStringListModel>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -80,8 +78,7 @@ public:
|
||||
TocList const & tocs() const;
|
||||
|
||||
/// Return the list of types available
|
||||
std::vector<docstring> const & typeNames() const
|
||||
{ return type_names_; }
|
||||
QStringList const & typeNames() const { return type_names_; }
|
||||
|
||||
/// Return the first TocItem before the cursor
|
||||
TocIterator currentTocItem(int type) const;
|
||||
@ -97,9 +94,6 @@ public:
|
||||
///
|
||||
void updateBackend();
|
||||
|
||||
std::vector<std::string> types_;
|
||||
std::vector<docstring> type_names_;
|
||||
|
||||
/// Return the guiname from a given cmdName of the TOC param
|
||||
docstring guiName(std::string const & type) const;
|
||||
|
||||
@ -109,6 +103,11 @@ public:
|
||||
void dispatchParams();
|
||||
///
|
||||
bool isBufferDependent() const { return true; }
|
||||
|
||||
///
|
||||
QStringList types_;
|
||||
///
|
||||
QStringList type_names_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -213,8 +213,8 @@ void TocWidget::updateView()
|
||||
|
||||
void TocWidget::updateGui(int selected_type)
|
||||
{
|
||||
vector<docstring> const & type_names = form_.typeNames();
|
||||
if (type_names.empty()) {
|
||||
QStringList const & type_names = form_.typeNames();
|
||||
if (type_names.isEmpty()) {
|
||||
enableControls(false);
|
||||
typeCO->clear();
|
||||
tocTV->setModel(new QStandardItemModel);
|
||||
@ -225,10 +225,8 @@ void TocWidget::updateGui(int selected_type)
|
||||
QString const current_text = typeCO->currentText();
|
||||
typeCO->blockSignals(true);
|
||||
typeCO->clear();
|
||||
for (size_t i = 0; i != type_names.size(); ++i) {
|
||||
QString item = toqstr(type_names[i]);
|
||||
typeCO->addItem(item);
|
||||
}
|
||||
for (int i = 0; i != type_names.size(); ++i)
|
||||
typeCO->addItem(type_names[i]);
|
||||
if (selected_type != -1)
|
||||
typeCO->setCurrentIndex(selected_type);
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user