#include "ConverterCache.h"
#include "FontEnums.h"
#include "FuncRequest.h"
-#include "KeyMap.h"
#include "KeySequence.h"
#include "Language.h"
#include "LyXAction.h"
#include "support/os.h"
#include "support/Package.h"
-#include "graphics/GraphicsTypes.h"
-
#include "frontends/alert.h"
#include "frontends/Application.h"
#include "frontends/FontLoader.h"
toqstr(makeRelPath(qstring_to_ucs4(outname), qstring_to_ucs4(relpath)));
QString testname = reloutname;
+#if QT_VERSION < 0x060000
testname.remove(QRegExp("^(\\.\\./)+"));
+#else
+ testname.remove(QRegularExpression("^(\\.\\./)+"));
+#endif
if (testname.contains("/"))
return outname;
/////////////////////////////////////////////////////////////////////
PrefOutput::PrefOutput(GuiPreferences * form)
- : PrefModule(catOutput, N_("General"), form)
+ : PrefModule(catOutput, N_("General[[settings]]"), form)
{
setupUi(this);
QFontDatabase fontdb;
QStringList families(fontdb.families());
- for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
- screenRomanCO->addItem(*it);
- screenSansCO->addItem(*it);
- screenTypewriterCO->addItem(*it);
+ for (auto const & family : families) {
+ screenRomanCO->addItem(family);
+ screenSansCO->addItem(family);
+ screenTypewriterCO->addItem(family);
}
connect(screenRomanCO, SIGNAL(activated(QString)),
this, SIGNAL(changed()));
continue;
lcolors_.push_back(lc);
}
- qSort(lcolors_.begin(), lcolors_.end(), ColorSorter);
+ sort(lcolors_.begin(), lcolors_.end(), ColorSorter);
vector<ColorCode>::const_iterator cit = lcolors_.begin();
vector<ColorCode>::const_iterator const end = lcolors_.end();
for (; cit != end; ++cit) {
}
-bool PrefColors::setColor(int const row, QColor const new_color,
- QString const old_color)
+bool PrefColors::setColor(int const row, QColor const & new_color,
+ QString const & old_color)
{
if (new_color.isValid() && new_color.name() != old_color) {
newcolors_[size_t(row)] = new_color.name();
}
-bool PrefColors::isDefaultColor(int const row, QString const color)
+bool PrefColors::isDefaultColor(int const row, QString const & color)
{
return color == getDefaultColorByRow(row).name();
}
QColor PrefColors::getDefaultColorByRow(int const row)
{
ColorSet const defaultcolor;
- return defaultcolor.getX11Name(lcolors_[size_t(row)]).c_str();
+ return defaultcolor.getX11HexName(lcolors_[size_t(row)],
+ guiApp->colorCache().isDarkMode()).c_str();
}
{
public:
FormatValidator(QWidget *, Formats const & f);
- void fixup(QString & input) const;
- QValidator::State validate(QString & input, int & pos) const;
+ void fixup(QString & input) const override;
+ QValidator::State validate(QString & input, int & pos) const override;
private:
virtual QString toString(Format const & format) const = 0;
int nr() const;
: FormatValidator(parent, f)
{}
private:
- QString toString(Format const & format) const
+ QString toString(Format const & format) const override
{
return toqstr(format.name());
}
: FormatValidator(parent, f)
{}
private:
- QString toString(Format const & format) const
+ QString toString(Format const & format) const override
{
return toqstr(translateIfPossible(format.prettyname()));
}
startCommandED->setValidator(new NoNewLineValidator(startCommandED));
endCommandED->setValidator(new NoNewLineValidator(endCommandED));
+#if QT_VERSION < 0x060000
defaultDecimalSepED->setValidator(new QRegExpValidator(QRegExp("\\S"), this));
+#else
+ defaultDecimalSepED->setValidator(new QRegularExpressionValidator(QRegularExpression("\\S"), this));
+#endif
defaultDecimalSepED->setMaxLength(1);
defaultLengthUnitCO->addItem(lyx::qt_(unit_name_gui[Length::CM]), Length::CM);
index.data(Qt::UserRole).toString());
}
uiLanguageCO->blockSignals(false);
+
+ // FIXME: restore this when it works (see discussion in #6450).
+ respectOSkbdCB->hide();
}
iconSetCO->addItem(qt_("Classic"), "classic");
iconSetCO->addItem(qt_("Oxygen"), "oxygen");
-#if (!(defined Q_WS_X11 || defined(QPA_XCB)) || QT_VERSION < 0x040600)
- useSystemThemeIconsCB->hide();
+#if QT_VERSION >= 0x040600
+ if (guiApp->platformName() != "qt4x11"
+ && guiApp->platformName() != "xcb"
+ && !guiApp->platformName().contains("wayland"))
#endif
+ useSystemThemeIconsCB->hide();
}
this, SIGNAL(changed()));
connect(cursorWidthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
- connect(fullscreenLimitGB, SIGNAL(clicked()),
+ connect(citationSearchLE, SIGNAL(textChanged(QString)),
this, SIGNAL(changed()));
connect(fullscreenWidthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
}
+void PrefEdit::on_fullscreenLimitCB_toggled(bool const state)
+{
+ fullscreenWidthSB->setEnabled(state);
+ fullscreenWidthLA->setEnabled(state);
+ changed();
+}
+
+
+void PrefEdit::on_citationSearchCB_toggled(bool const state)
+{
+ citationSearchLE->setEnabled(state);
+ citationSearchLA->setEnabled(state);
+ changed();
+}
+
+
void PrefEdit::applyRC(LyXRC & rc) const
{
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
case 2: rc.macro_edit_style = LyXRC::MACRO_EDIT_LIST; break;
}
rc.cursor_width = cursorWidthSB->value();
+ rc.citation_search = citationSearchCB->isChecked();
+ rc.citation_search_pattern = fromqstr(citationSearchLE->text());
rc.full_screen_toolbars = toggleToolbarsCB->isChecked();
rc.full_screen_scrollbar = toggleScrollbarCB->isChecked();
rc.full_screen_statusbar = toggleStatusbarCB->isChecked();
rc.full_screen_tabbar = toggleTabbarCB->isChecked();
rc.full_screen_menubar = toggleMenubarCB->isChecked();
rc.full_screen_width = fullscreenWidthSB->value();
- rc.full_screen_limit = fullscreenLimitGB->isChecked();
+ rc.full_screen_limit = fullscreenLimitCB->isChecked();
}
groupEnvironmentsCB->setChecked(rc.group_layouts);
macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);
cursorWidthSB->setValue(rc.cursor_width);
+ citationSearchCB->setChecked(rc.citation_search);
+ citationSearchLE->setText(toqstr(rc.citation_search_pattern));
+ citationSearchLE->setEnabled(rc.citation_search);
+ citationSearchLA->setEnabled(rc.citation_search);
toggleScrollbarCB->setChecked(rc.full_screen_scrollbar);
toggleStatusbarCB->setChecked(rc.full_screen_statusbar);
toggleToolbarsCB->setChecked(rc.full_screen_toolbars);
toggleTabbarCB->setChecked(rc.full_screen_tabbar);
toggleMenubarCB->setChecked(rc.full_screen_menubar);
fullscreenWidthSB->setValue(rc.full_screen_width);
- fullscreenLimitGB->setChecked(rc.full_screen_limit);
+ fullscreenLimitCB->setChecked(rc.full_screen_limit);
+ fullscreenWidthSB->setEnabled(rc.full_screen_limit);
+ fullscreenWidthLA->setEnabled(rc.full_screen_limit);
}
{
Ui::shortcutUi::setupUi(this);
QDialog::setModal(true);
+ lfunLE->setValidator(new NoNewLineValidator(lfunLE));
}
if (tag == KeyMap::UserUnbind) {
QList<QTreeWidgetItem*> const items = shortcutsTW->findItems(lfun_name,
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
- for (int i = 0; i < items.size(); ++i) {
- if (items[i]->text(1) == shortcut) {
- newItem = items[i];
+ for (auto const & item : items) {
+ if (item->text(1) == shortcut) {
+ newItem = item;
break;
}
}
// list of items that match lfun
QList<QTreeWidgetItem*> items = shortcutsTW->findItems(lfun,
Qt::MatchFlags(Qt::MatchExactly | Qt::MatchRecursive), 0);
- for (int i = 0; i < items.size(); ++i) {
- QTreeWidgetItem * item = items[i];
+ for (auto const & item : items) {
if (isAlwaysHidden(*item)) {
setItemType(item, KeyMap::System);
if (select)
// it seems that only one item can be selected, but I am
// removing all selected items anyway.
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
- for (int i = 0; i < items.size(); ++i) {
- string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
- string lfun = fromqstr(items[i]->text(0));
- FuncRequest func = lyxaction.lookupFunc(lfun);
+ for (auto & item : items) {
+ string shortcut = fromqstr(item->data(1, Qt::UserRole).toString());
+ string lfun = fromqstr(item->text(0));
+ FuncRequest const func = lyxaction.lookupFunc(lfun);
- switch (itemType(*items[i])) {
+ switch (itemType(*item)) {
case KeyMap::System: {
// for system bind, we do not touch the item
// but add an user unbind item
user_unbind_.bind(shortcut, func);
- setItemType(items[i], KeyMap::UserUnbind);
+ setItemType(item, KeyMap::UserUnbind);
removePB->setText(qt_("Res&tore"));
break;
}
case KeyMap::UserBind: {
// for user_bind, we remove this bind
- QTreeWidgetItem * parent = items[i]->parent();
- int itemIdx = parent->indexOfChild(items[i]);
+ QTreeWidgetItem * parent = item->parent();
+ int itemIdx = parent->indexOfChild(item);
parent->takeChild(itemIdx);
if (itemIdx > 0)
shortcutsTW->scrollToItem(parent->child(itemIdx - 1));
user_bind_.unbind(shortcut, func);
// If this user binding hid an empty system binding, unhide the
// latter and select it.
- unhideEmpty(items[i]->text(0), true);
+ unhideEmpty(item->text(0), true);
break;
}
case KeyMap::UserUnbind: {
if (!validateNewShortcut(func, seq, QString()))
break;
user_unbind_.unbind(shortcut, func);
- setItemType(items[i], KeyMap::System);
+ setItemType(item, KeyMap::System);
removePB->setText(qt_("Remo&ve"));
break;
}
case KeyMap::UserExtraUnbind: {
// for user unbind that is not in system bind file,
// remove this unbind file
- QTreeWidgetItem * parent = items[i]->parent();
- parent->takeChild(parent->indexOfChild(items[i]));
+ QTreeWidgetItem * parent = item->parent();
+ parent->takeChild(parent->indexOfChild(item));
user_unbind_.unbind(shortcut, func);
}
}
void PrefShortcuts::deactivateShortcuts(QList<QTreeWidgetItem*> const & items)
{
- for (int i = 0; i < items.size(); ++i) {
- string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
- string lfun = fromqstr(items[i]->text(0));
- FuncRequest func = lyxaction.lookupFunc(lfun);
+ for (auto item : items) {
+ string shortcut = fromqstr(item->data(1, Qt::UserRole).toString());
+ string lfun = fromqstr(item->text(0));
+ FuncRequest const func = lyxaction.lookupFunc(lfun);
- switch (itemType(*items[i])) {
+ switch (itemType(*item)) {
case KeyMap::System:
// for system bind, we do not touch the item
// but add an user unbind item
user_unbind_.bind(shortcut, func);
- setItemType(items[i], KeyMap::UserUnbind);
+ setItemType(item, KeyMap::UserUnbind);
break;
case KeyMap::UserBind: {
// for user_bind, we remove this bind
- QTreeWidgetItem * parent = items[i]->parent();
- int itemIdx = parent->indexOfChild(items[i]);
+ QTreeWidgetItem * parent = item->parent();
+ int itemIdx = parent->indexOfChild(item);
parent->takeChild(itemIdx);
user_bind_.unbind(shortcut, func);
- unhideEmpty(items[i]->text(0), false);
+ unhideEmpty(item->text(0), false);
break;
}
default:
// hide everyone (to avoid searching in matched QList repeatedly
QTreeWidgetItemIterator it(shortcutsTW, QTreeWidgetItemIterator::Selectable);
while (*it)
- shortcutsTW->setItemHidden(*it++, true);
+ (*it++)->setHidden(true);
// show matched items
- for (int i = 0; i < matched.size(); ++i)
- if (!isAlwaysHidden(*matched[i])) {
- matched[i]->setHidden(false);
- matched[i]->parent()->setExpanded(true);
+ for (auto & item : matched)
+ if (!isAlwaysHidden(*item)) {
+ item->setHidden(false);
+ if (item->parent())
+ item->parent()->setExpanded(true);
}
}
void PrefShortcuts::shortcutOkPressed()
{
QString const new_lfun = shortcut_->lfunLE->text();
- FuncRequest func = lyxaction.lookupFunc(fromqstr(new_lfun));
+ FuncRequest const func = lyxaction.lookupFunc(fromqstr(new_lfun));
KeySequence k = shortcut_->shortcutWG->getKeySequence();
// save_lfun_ contains the text of the lfun to modify, if the user clicked
}
-Dialog * createGuiPreferences(GuiView & lv) { return new GuiPreferences(lv); }
-
-
} // namespace frontend
} // namespace lyx