mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Factor out multiply used ColorSorter.
This cures one problem of monolithic build (where the function was ambiguous)
This commit is contained in:
parent
1f0488bf36
commit
b423c59d3c
@ -103,16 +103,6 @@ static QList<ColorCode> colors()
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
bool ColorSorter(ColorCode lhs, ColorCode rhs)
|
||||
{
|
||||
return support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
@ -192,12 +192,6 @@ void fillComboColor(QComboBox * combo, QList<T> const & list)
|
||||
combo->addItem(qt_("Reset"), "inherit");
|
||||
}
|
||||
|
||||
|
||||
bool ColorSorter(ColorCode lhs, ColorCode rhs)
|
||||
{
|
||||
return support::compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
|
||||
}
|
||||
|
||||
} // namespace anon
|
||||
|
||||
GuiCharacter::GuiCharacter(GuiView & lv)
|
||||
|
@ -1115,19 +1115,6 @@ void PrefScreenFonts::selectTypewriter(const QString & name)
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
struct ColorSorter
|
||||
{
|
||||
bool operator()(ColorCode lhs, ColorCode rhs) const {
|
||||
return
|
||||
compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace anon
|
||||
|
||||
|
||||
PrefColors::PrefColors(GuiPreferences * form)
|
||||
: PrefModule(catLookAndFeel, N_("Colors"), form)
|
||||
{
|
||||
@ -1164,7 +1151,7 @@ PrefColors::PrefColors(GuiPreferences * form)
|
||||
continue;
|
||||
lcolors_.push_back(lc);
|
||||
}
|
||||
sort(lcolors_.begin(), lcolors_.end(), ColorSorter());
|
||||
qSort(lcolors_.begin(), lcolors_.end(), ColorSorter);
|
||||
vector<ColorCode>::const_iterator cit = lcolors_.begin();
|
||||
vector<ColorCode>::const_iterator const end = lcolors_.end();
|
||||
for (; cit != end; ++cit) {
|
||||
|
@ -213,6 +213,12 @@ QString formatLocFPNumber(double d)
|
||||
}
|
||||
|
||||
|
||||
bool ColorSorter(ColorCode lhs, ColorCode rhs)
|
||||
{
|
||||
return compare_no_case(lcolor.getGUIName(lhs), lcolor.getGUIName(rhs)) < 0;
|
||||
}
|
||||
|
||||
|
||||
void setValid(QWidget * widget, bool valid)
|
||||
{
|
||||
if (valid) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifndef QTHELPERS_H
|
||||
#define QTHELPERS_H
|
||||
|
||||
#include "ColorSet.h"
|
||||
#include "Length.h"
|
||||
#include "support/qstring_helpers.h"
|
||||
#include "support/filetools.h"
|
||||
@ -73,6 +74,9 @@ void doubleToWidget(QLineEdit * input, std::string const & value,
|
||||
*/
|
||||
QString formatLocFPNumber(double d);
|
||||
|
||||
/// Method to sort colors by GUI name in combo widgets
|
||||
bool ColorSorter(ColorCode lhs, ColorCode rhs);
|
||||
|
||||
/// colors a widget red if invalid
|
||||
void setValid(QWidget * widget, bool valid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user