]> git.lyx.org Git - features.git/commitdiff
Factor out multiply used ColorSorter.
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 16 Nov 2015 07:19:16 +0000 (08:19 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 16 Nov 2015 07:19:16 +0000 (08:19 +0100)
This cures one problem of monolithic build (where the function was
ambiguous)

src/frontends/qt4/GuiBox.cpp
src/frontends/qt4/GuiCharacter.cpp
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/qt_helpers.cpp
src/frontends/qt4/qt_helpers.h

index 0999039ddadb9fcea100b6c07aae1bd5f2709585..e4d425692a7e93e1ca4d5e4fc0022099decc3367 100644 (file)
@@ -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);
index c673d2d9c3fff479caca1c83b01b522c39bdab85..e01687678a95194310c2f79c96b04b54256dc8b6 100644 (file)
@@ -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)
index a0764027213b49b1a896a8f26d84c3d15e79e3eb..2c99deec41e115f451e7b5537210d375bf5516c4 100644 (file)
@@ -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) {
index 4eacaca749e7346f6046dfe521851740124bd265..c1294e56df2d4a869af0d390c5379e4f0fdb18e2 100644 (file)
@@ -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) {
index fcdcd53102e85a9dfcdd2230e180e9653d9cd44e..d4afc78a338b7e615729a6debd1a377a4d5391e4 100644 (file)
@@ -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);