Author: jghali
Date: Sat Jan 25 18:12:34 2020
New Revision: 23452

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23452
Log:
Simplify PropertyWidget_TextColor::showTextColors() by using new 
ColorCombo::setCurrentColor()

Modified:
    trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
    trunk/Scribus/scribus/ui/propertywidget_textcolor.h

Modified: trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23452&path=/trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp       (original)
+++ trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp       Sat Jan 25 
18:12:34 2020
@@ -260,49 +260,28 @@
        textEffects->StrikeVal->LWidth->showValue(w / 10.0);
 }
 
-void PropertyWidget_TextColor::showTextColors(const QString& p, const QString& 
b, const QString& bc, double shp, double shb, double sbc)
-{
-       if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
-               return;
-       ColorList::Iterator it;
-       int c = 0;
-       fillShade->setValue(qRound(shb));
-       strokeShade->setValue(qRound(shp));
-       backShade->setValue(qRound(sbc));
-       if ((b != CommonStrings::None) && (!b.isEmpty()))
-       {
-               c++;
-               for (it = m_doc->PageColors.begin(); it != 
m_doc->PageColors.end(); ++it)
-               {
-                       if (it.key() == b)
-                               break;
-                       c++;
-               }
-       }
-       fillColor->setCurrentIndex(c);
-       c = 0;
-       if ((p != CommonStrings::None) && (!p.isEmpty()))
-       {
-               for (it = m_doc->PageColors.begin(); it != 
m_doc->PageColors.end(); ++it)
-               {
-                       if (it.key() == p)
-                               break;
-                       c++;
-               }
-       }
-       strokeColor->setCurrentIndex(c);
-       c = 0;
-       if ((bc != CommonStrings::None) && (!bc.isEmpty()))
-       {
-               c++;
-               for (it = m_doc->PageColors.begin(); it != 
m_doc->PageColors.end(); ++it)
-               {
-                       if (it.key() == bc)
-                               break;
-                       c++;
-               }
-       }
-       backColor->setCurrentIndex(c);
+void PropertyWidget_TextColor::showTextColors(const QString& strokeCol, const 
QString& fillCol, const QString& backCol, double strokeShd, double fillShd, 
double backShd)
+{
+       if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+               return;
+
+       QSignalBlocker fillShadeBlocker(fillShade);
+       QSignalBlocker strokeShadeBlocker(strokeShade);
+       QSignalBlocker backShadeBlocker(backShade);
+       QSignalBlocker fillColorBlocker(fillColor);
+       QSignalBlocker strokeColorBlocker(strokeColor);
+       QSignalBlocker backColorBlocker(backColor);
+
+       fillShade->setValue(qRound(fillShd));
+       strokeShade->setValue(qRound(strokeShd));
+       backShade->setValue(qRound(backShd));
+
+       if (!fillCol.isEmpty())
+               fillColor->setCurrentColor(fillCol);
+       if (!strokeCol.isEmpty())
+               strokeColor->setCurrentColor(strokeCol);
+       if (!backCol.isEmpty())
+               backColor->setCurrentColor(backCol);
 }
 
 void PropertyWidget_TextColor::showTextEffects(int s)

Modified: trunk/Scribus/scribus/ui/propertywidget_textcolor.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23452&path=/trunk/Scribus/scribus/ui/propertywidget_textcolor.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_textcolor.h (original)
+++ trunk/Scribus/scribus/ui/propertywidget_textcolor.h Sat Jan 25 18:12:34 2020
@@ -50,7 +50,7 @@
        void showOutlineW(double x);
        void showShadowOffset(double x, double y);
        void showStrikeThru(double p, double w);
-       void showTextColors(const QString& p, const QString& b, const QString& 
bc, double shp, double shb, double sbc);
+       void showTextColors(const QString& strokeCol, const QString& fillCol, 
const QString& backCol, double strokeShade, double fillShade, double backShade);
        void showTextEffects(int s);
        void showUnderline(double p, double w);
 


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to