#include "GuiApplication.h"
#include "Buffer.h"
+#include "BufferParams.h"
#include "BufferList.h"
#include "FuncRequest.h"
// The filter bar
filter_ = new FancyLineEdit(this);
-#if QT_VERSION >= 0x040600
filter_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "svgz,png"));
filter_->setButtonVisible(FancyLineEdit::Right, true);
filter_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
filter_->setAutoHideButton(FancyLineEdit::Right, true);
-#endif
-#if QT_VERSION >= 0x040700
- filter_->setPlaceholderText(qt_("All avail. Labels"));
-#endif
+ filter_->setPlaceholderText(qt_("All available labels"));
filter_->setToolTip(qt_("Enter string to filter the list of available labels"));
filterBarL->addWidget(filter_, 0);
this, SLOT(changed_adaptor()));
connect(filter_, SIGNAL(textEdited(QString)),
this, SLOT(filterLabels()));
+ connect(filter_, SIGNAL(rightButtonClicked()),
+ this, SLOT(resetFilter()));
connect(csFindCB, SIGNAL(clicked()),
this, SLOT(filterLabels()));
connect(nameED, SIGNAL(textChanged(QString)),
this, SLOT(updateClicked()));
connect(bufferCO, SIGNAL(activated(int)),
this, SLOT(updateClicked()));
+ connect(pluralCB, SIGNAL(clicked()),
+ this, SLOT(changed_adaptor()));
+ connect(capsCB, SIGNAL(clicked()),
+ this, SLOT(changed_adaptor()));
+ connect(noprefixCB, SIGNAL(clicked()),
+ this, SLOT(changed_adaptor()));
+
+ enableBoxes();
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
bc().setOK(okPB);
}
+void GuiRef::enableBoxes()
+{
+ bool const isFormatted =
+ (InsetRef::getName(typeCO->currentIndex()) == "formatted");
+ bool const isLabelOnly =
+ (InsetRef::getName(typeCO->currentIndex()) == "labelonly");
+ bool const usingRefStyle = buffer().params().use_refstyle;
+ pluralCB->setEnabled(isFormatted && usingRefStyle);
+ capsCB->setEnabled(isFormatted && usingRefStyle);
+ noprefixCB->setEnabled(isLabelOnly);
+}
+
+
void GuiRef::changed_adaptor()
{
changed();
+ enableBoxes();
}
if (!typeAllowed())
typeCO->setCurrentIndex(0);
+ pluralCB->setChecked(params_["plural"] == "true");
+ capsCB->setChecked(params_["caps"] == "true");
+ noprefixCB->setChecked(params_["noprefix"] == "true");
+
// insert buffer list
bufferCO->clear();
FileNameList const buffers(theBufferList().fileNames());
active_buffer_ = thebuffer;
updateRefs();
+ enableBoxes();
// Activate OK/Apply buttons if the users inserts a new ref
// and we have a valid pre-setting.
bc().setValid(isValid() && new_inset);
params_.setCmdName(InsetRef::getName(typeCO->currentIndex()));
params_["reference"] = qstring_to_ucs4(last_reference_);
params_["name"] = qstring_to_ucs4(nameED->text());
-
+ params_["plural"] = pluralCB->isChecked() ?
+ from_ascii("true") : from_ascii("false");
+ params_["caps"] = capsCB->isChecked() ?
+ from_ascii("true") : from_ascii("false");
+ params_["noprefix"] = noprefixCB->isChecked() ?
+ from_ascii("true") : from_ascii("false");
restored_buffer_ = bufferCO->currentIndex();
}
}
+void GuiRef::resetFilter()
+{
+ filter_->setText(QString());
+ filterLabels();
+}
+
+
bool GuiRef::initialiseParams(std::string const & data)
{
InsetCommand::string2params(data, params_);