N_("bigg[[delimiter size]]"), N_("Bigg[[delimiter size]]"), ""};
-string do_match(const string & str)
+QString do_match(QString const & str)
{
if (str == "(") return ")";
if (str == ")") return "(";
}
-string fix_name(const string & str, bool big)
+string fix_name(QString const & str, bool big)
{
if (str == "slash")
return "/";
if (str == "backslash")
return "\\";
- if (str.empty())
+ if (str.isEmpty())
return ".";
if (!big || str == "(" || str == ")" || str == "[" || str == "]")
- return str;
+ return fromqstr(str);
- return "\\" + str;
+ return "\\" + fromqstr(str);
}
} // namespace anon
setWindowTitle(qt_("LyX: Delimiters"));
- for (int i = 0; *delim[i]; ++i) {
- QPixmap pm = QPixmap(toqstr(find_xpm(delim[i])));
- leftCO->addItem(QIcon(pm), "");
- rightCO->addItem(QIcon(pm), "");
+ for (size_t i = 0; i != 21; ++i)
+ delimiters_.append(toqstr(delim[i]));
+
+ // The last element is the empty one.
+ size_t end = delimiters_.size() - 1;
+ for (size_t i = 0; i != end; ++i) {
+ if (delimiters_[i].size() == 1) {
+ leftCO->addItem(delimiters_[i]);
+ rightCO->addItem(delimiters_[i]);
+ } else {
+ QPixmap pm = QPixmap(toqstr(find_xpm(fromqstr(delimiters_[i]))));
+ leftCO->addItem(QIcon(pm), delimiters_[i]);
+ rightCO->addItem(QIcon(pm), delimiters_[i]);
+ }
}
- string empty_xpm(find_xpm("empty"));
- leftCO->addItem(QIcon(QPixmap(toqstr(empty_xpm))), qt_("(None)"));
- rightCO->addItem(QIcon(QPixmap(toqstr(empty_xpm))), qt_("(None)"));
+ leftCO->addItem(qt_("(None)"));
+ rightCO->addItem(qt_("(None)"));
sizeCO->addItem(qt_("Variable"));
void QDelimiterDialog::insertClicked()
{
- string const left_ = delim[leftCO->currentIndex()];
- string const right_ = delim[rightCO->currentIndex()];
+ QString const left_ = delimiters_[leftCO->currentIndex()];
+ QString const right_ = delimiters_[rightCO->currentIndex()];
int const size_ = sizeCO->currentIndex();
if (size_ == 0) {
void QDelimiterDialog::on_leftCO_activated(int item)
{
if (matchCB->isChecked()) {
- string const match = do_match(delim[item]);
- int k = 0;
- while (delim[k] && delim[k] != match)
- ++k;
- rightCO->setCurrentIndex(k);
+ QString const match = do_match(delimiters_[item]);
+ rightCO->setCurrentIndex(delimiters_.indexOf(match));
}
}
void QDelimiterDialog::on_rightCO_activated(int item)
{
if (matchCB->isChecked()) {
- string const match = do_match(delim[item]);
- int k = 0;
- while (delim[k] && delim[k] != match)
- ++k;
- leftCO->setCurrentIndex(k);
+ QString const match = do_match(delimiters_[item]);
+ leftCO->setCurrentIndex(delimiters_.indexOf(match));
}
}
<ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
<class>QDelimiterUi</class>
<widget class="QDialog" name="QDelimiterUi" >
<property name="geometry" >
</property>
<item>
<widget class="QComboBox" name="leftCO" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize" >
<size>
<width>42</width>
<height>42</height>
</size>
</property>
+ <property name="maxVisibleItems" >
+ <number>100</number>
+ </property>
+ <property name="sizeAdjustPolicy" >
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
<property name="iconSize" >
<size>
<width>32</width>
</item>
<item>
<widget class="QComboBox" name="rightCO" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>4</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="minimumSize" >
<size>
<width>42</width>
<height>42</height>
</size>
</property>
+ <property name="maxVisibleItems" >
+ <number>100</number>
+ </property>
<property name="iconSize" >
<size>
<width>32</width>
</item>
</layout>
</widget>
- <pixmapfunction></pixmapfunction>
- <includes>
- <include location="local" >qt_helpers.h</include>
- </includes>
<tabstops>
<tabstop>leftCO</tabstop>
<tabstop>rightCO</tabstop>
<tabstop>insertPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
+ <includes>
+ <include location="local" >qt_helpers.h</include>
+ </includes>
<resources/>
<connections/>
</ui>