Author: jghali
Date: Fri Apr 17 23:36:23 2020
New Revision: 23620

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23620
Log:
Refactoring and cleanup of style combo classes

Modified:
    trunk/Scribus/scribus/ui/notesstyleseditor.cpp
    trunk/Scribus/scribus/ui/propertiespalette_table.cpp
    trunk/Scribus/scribus/ui/propertiespalette_text.cpp
    trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
    trunk/Scribus/scribus/ui/spalette.cpp
    trunk/Scribus/scribus/ui/spalette.h
    trunk/Scribus/scribus/ui/storyeditor.cpp

Modified: trunk/Scribus/scribus/ui/notesstyleseditor.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/notesstyleseditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/notesstyleseditor.cpp      (original)
+++ trunk/Scribus/scribus/ui/notesstyleseditor.cpp      Fri Apr 17 23:36:23 2020
@@ -131,9 +131,9 @@
        bool wasSignalsBlocked = signalsBlocked();
        setBlockSignals(true);
        if ((updateFlags & reqCharStylesUpdate) || (updateFlags & 
reqTextStylesUpdate))
-               charStyleCombo->updateFormatList();
+               charStyleCombo->updateStyleList();
        if ((updateFlags & reqParaStylesUpdate) || (updateFlags & 
reqTextStylesUpdate))
-               paraStyleCombo->updateFormatList();
+               paraStyleCombo->updateStyleList();
        readNotesStyle(NSlistBox->currentText());
        setBlockSignals(wasSignalsBlocked);
 }

Modified: trunk/Scribus/scribus/ui/propertiespalette_table.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/propertiespalette_table.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_table.cpp        (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_table.cpp        Fri Apr 17 
23:36:23 2020
@@ -58,8 +58,8 @@
 {
        if (updateFlags & reqColorsUpdate)
                updateColorList();
-       tableStyleCombo->updateFormatList();
-       cellStyleCombo->updateFormatList();
+       tableStyleCombo->updateStyleList();
+       cellStyleCombo->updateStyleList();
 }
 
 void PropertiesPalette_Table::updateColorList()
@@ -163,14 +163,14 @@
 void PropertiesPalette_Table::showTableStyle(const QString& name)
 {
        bool blocked = tableStyleCombo->blockSignals(true);
-       tableStyleCombo->setFormat(name);
+       tableStyleCombo->setStyle(name);
        tableStyleCombo->blockSignals(blocked);
 }
 
 void PropertiesPalette_Table::showCellStyle(const QString& name)
 {
        bool blocked = cellStyleCombo->blockSignals(true);
-       cellStyleCombo->setFormat(name);
+       cellStyleCombo->setStyle(name);
        cellStyleCombo->blockSignals(blocked);
 }
 

Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Fri Apr 17 23:36:23 2020
@@ -287,11 +287,11 @@
                updateColorList();*/
        if (updateFlags & reqCharStylesUpdate)
        {
-               charStyleCombo->updateFormatList();
+               charStyleCombo->updateStyleList();
                parEffectWidgets->updateCharStyles();
        }
        if (updateFlags & reqParaStylesUpdate)
-               paraStyleCombo->updateFormatList();
+               paraStyleCombo->updateStyleList();
        if (updateFlags & reqDefFontListUpdate)
                fonts->rebuildList(nullptr);
        if (updateFlags & reqDocFontListUpdate)
@@ -543,21 +543,21 @@
 
 void PropertiesPalette_Text::updateCharStyles()
 {
-       charStyleCombo->updateFormatList();
+       charStyleCombo->updateStyleList();
        parEffectWidgets->updateCharStyles();
 }
 
 void PropertiesPalette_Text::updateParagraphStyles()
 {
-       paraStyleCombo->updateFormatList();
-       charStyleCombo->updateFormatList();
+       paraStyleCombo->updateStyleList();
+       charStyleCombo->updateStyleList();
        parEffectWidgets->updateCharStyles();
 }
 
 void PropertiesPalette_Text::updateTextStyles()
 {
-       paraStyleCombo->updateFormatList();
-       charStyleCombo->updateFormatList();
+       paraStyleCombo->updateStyleList();
+       charStyleCombo->updateStyleList();
 }
 
 void PropertiesPalette_Text::updateTreeLayout()
@@ -592,7 +592,7 @@
        if (!m_ScMW || m_ScMW->scriptIsRunning())
                return;
        bool blocked = charStyleCombo->blockSignals(true);
-       charStyleCombo->setFormat(name);
+       charStyleCombo->setStyle(name);
        charStyleCombo->blockSignals(blocked);
 }
 
@@ -601,7 +601,7 @@
        if (!m_ScMW || m_ScMW->scriptIsRunning())
                return;
        bool blocked = paraStyleCombo->blockSignals(true);
-       paraStyleCombo->setFormat(name);
+       paraStyleCombo->setStyle(name);
        paraStyleCombo->blockSignals(blocked);
 }
 

Modified: trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp       (original)
+++ trunk/Scribus/scribus/ui/propertywidget_pareffect.cpp       Fri Apr 17 
23:36:23 2020
@@ -33,7 +33,7 @@
        dropCapLines->setValue(2);
 
        if (m_doc)
-               peCharStyleCombo->updateFormatList();
+               peCharStyleCombo->updateStyleList();
        fillBulletStrEditCombo();
        enableParEffect(false);
        
bulletCharTableButton->setIcon(IconManager::instance().loadIcon("22/insert-table.png"));
@@ -154,13 +154,13 @@
 
 void PropertyWidget_ParEffect::updateCharStyles()
 {
-       peCharStyleCombo->updateFormatList();
+       peCharStyleCombo->updateStyleList();
 }
 
 void PropertyWidget_ParEffect::showCharStyle(const QString& name)
 {
        bool blocked = peCharStyleCombo->blockSignals(true);
-       peCharStyleCombo->setFormat(name);
+       peCharStyleCombo->setStyle(name);
        peCharStyleCombo->blockSignals(blocked);
 }
 

Modified: trunk/Scribus/scribus/ui/spalette.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/spalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/spalette.cpp       (original)
+++ trunk/Scribus/scribus/ui/spalette.cpp       Fri Apr 17 23:36:23 2020
@@ -33,36 +33,71 @@
 {
        setEditable(false);
        addItem( CommonStrings::trDefaultParagraphStyle );
-       currentDoc = nullptr;
-       connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
+       connect(this, SIGNAL(activated(int)), this, SLOT(selectedStyle(int)));
+}
+
+QString ParaStyleComboBox::currentStyle() const
+{
+       if (this->currentIndex() == 0)
+               return QString();
+
+       QString currStyleName = this->currentText();
+       if (currStyleName == CommonStrings::trDefaultParagraphStyle)
+               currStyleName = CommonStrings::DefaultParagraphStyle;
+       return currStyleName;
+}
+
+void ParaStyleComboBox::changeEvent(QEvent *e)
+{
+       if (e->type() == QEvent::LanguageChange)
+       {
+               languageChange();
+               return;
+       }
+       QComboBox::changeEvent(e);
+}
+
+void ParaStyleComboBox::languageChange()
+{
+       bool sigBlocked = this->blockSignals(true);
+       int styleIndex = this->currentIndex();
+
+       updateStyleList();
+       if (styleIndex >= 0)
+               this->setCurrentIndex(styleIndex);
+
+       this->blockSignals(sigBlocked);
 }
 
 void ParaStyleComboBox::setDoc(ScribusDoc *newCurrentDoc)
 {
-       currentDoc = newCurrentDoc;
-       updateFormatList();
-}
-
-void ParaStyleComboBox::setFormat(const QString& name)
-{
-       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultParagraphStyle : name);
-}
-
-void ParaStyleComboBox::updateFormatList()
+       m_doc = newCurrentDoc;
+       updateStyleList();
+}
+
+void ParaStyleComboBox::setStyle(const QString& name)
+{
+       QString parStyleName = name;
+       if (parStyleName == CommonStrings::DefaultParagraphStyle)
+               parStyleName = CommonStrings::trDefaultParagraphStyle;
+       setCurrentComboItem(this, parStyleName.isEmpty() ? 
CommonStrings::trDefaultParagraphStyle : parStyleName);
+}
+
+void ParaStyleComboBox::updateStyleList()
 {
        QString oldStyleName;
-       if (currentDoc && this->count() > 0)
+       if (m_doc && this->count() > 0)
                oldStyleName = this->currentText();
 
        bool sigBlocked = this->blockSignals(true);
        clear();
-       if (currentDoc != nullptr)
+       if (m_doc != nullptr)
        {
                QStringList st;
                addItem( CommonStrings::trDefaultParagraphStyle );
-               for (int i = 0; i < currentDoc->paragraphStyles().count(); ++i)
-               {
-                       const ParagraphStyle& paraStyle = 
currentDoc->paragraphStyles()[i];
+               for (int i = 0; i < m_doc->paragraphStyles().count(); ++i)
+               {
+                       const ParagraphStyle& paraStyle = 
m_doc->paragraphStyles()[i];
                        if (!paraStyle.name().isEmpty() && 
!paraStyle.isDefaultStyle())
                                st.append(paraStyle.name());
                }
@@ -86,48 +121,89 @@
        this->blockSignals(sigBlocked);
 }
 
-void ParaStyleComboBox::selFormat(int e)
-{
-       if (e == 0)
+void ParaStyleComboBox::selectedStyle(int index)
+{
+       if (index == 0)
+       {
                emit newStyle(QString());
-       else
-               emit newStyle(currentText());
+               return;
+       }
+       
+       QString newStyleName = currentText();
+       if (newStyleName == CommonStrings::trDefaultParagraphStyle)
+               newStyleName = CommonStrings::DefaultParagraphStyle;
+       emit newStyle(newStyleName);
 }
 
 CharStyleComboBox::CharStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
        addItem( CommonStrings::trDefaultCharacterStyle );
-       currentDoc = nullptr;
-       connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
+       connect(this, SIGNAL(activated(int)), this, SLOT(selectedStyle(int)));
+}
+
+QString CharStyleComboBox::currentStyle() const
+{
+       if (this->currentIndex() == 0)
+               return QString();
+
+       QString currStyleName = this->currentText();
+       if (currStyleName == CommonStrings::trDefaultCharacterStyle)
+               currStyleName = CommonStrings::DefaultCharacterStyle;
+       return currStyleName;
+}
+
+void CharStyleComboBox::changeEvent(QEvent *e)
+{
+       if (e->type() == QEvent::LanguageChange)
+       {
+               languageChange();
+               return;
+       }
+       QComboBox::changeEvent(e);
+}
+
+void CharStyleComboBox::languageChange()
+{
+       bool sigBlocked = this->blockSignals(true);
+       int styleIndex = this->currentIndex();
+
+       updateStyleList();
+       if (styleIndex >= 0)
+               this->setCurrentIndex(styleIndex);
+
+       this->blockSignals(sigBlocked);
 }
 
 void CharStyleComboBox::setDoc(ScribusDoc *newCurrentDoc)
 {
-       currentDoc = newCurrentDoc;
-       updateFormatList();
-}
-
-void CharStyleComboBox::setFormat(const QString& name)
-{
-       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultCharacterStyle : name);
-}
-
-void CharStyleComboBox::updateFormatList()
+       m_doc = newCurrentDoc;
+       updateStyleList();
+}
+
+void CharStyleComboBox::setStyle(const QString& name)
+{
+       QString charStyleName = name;
+       if (charStyleName == CommonStrings::DefaultCharacterStyle)
+               charStyleName = CommonStrings::trDefaultCharacterStyle;
+       setCurrentComboItem(this, charStyleName.isEmpty() ? 
CommonStrings::trDefaultCharacterStyle : charStyleName);
+}
+
+void CharStyleComboBox::updateStyleList()
 {
        QString oldStyleName;
-       if (currentDoc && this->count() > 0)
+       if (m_doc && this->count() > 0)
                oldStyleName = this->currentText();
 
        bool sigBlocked = this->blockSignals(true);
        clear();
-       if (currentDoc != nullptr)
+       if (m_doc != nullptr)
        {
                QStringList st;
                addItem( CommonStrings::trDefaultCharacterStyle );
-               for (int i = 0; i < currentDoc->charStyles().count(); ++i)
-               {
-                       const CharStyle& charStyle = 
currentDoc->charStyles()[i];
+               for (int i = 0; i < m_doc->charStyles().count(); ++i)
+               {
+                       const CharStyle& charStyle = m_doc->charStyles()[i];
                        if (!charStyle.name().isEmpty() && 
!charStyle.isDefaultStyle())
                                st.append(charStyle.name());
                }
@@ -151,48 +227,89 @@
        this->blockSignals(sigBlocked);
 }
 
-void CharStyleComboBox::selFormat(int e)
-{
-       if (e == 0)
+void CharStyleComboBox::selectedStyle(int index)
+{
+       if (index == 0)
+       {
                emit newStyle(QString());
-       else
-               emit newStyle(currentText());
+               return;
+       }
+       
+       QString newStyleName = currentText();
+       if (newStyleName == CommonStrings::trDefaultCharacterStyle)
+               newStyleName = CommonStrings::DefaultCharacterStyle;
+       emit newStyle(newStyleName);
 }
 
 CellStyleComboBox::CellStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
        addItem( CommonStrings::trDefaultCellStyle );
-       currentDoc = nullptr;
-       connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
+       connect(this, SIGNAL(activated(int)), this, SLOT(selectedStyle(int)));
+}
+
+QString CellStyleComboBox::currentStyle() const
+{
+       if (this->currentIndex() == 0)
+               return QString();
+
+       QString currStyleName = this->currentText();
+       if (currStyleName == CommonStrings::trDefaultCellStyle)
+               currStyleName = CommonStrings::DefaultCellStyle;
+       return currStyleName;
+}
+
+void CellStyleComboBox::changeEvent(QEvent *e)
+{
+       if (e->type() == QEvent::LanguageChange)
+       {
+               languageChange();
+               return;
+       }
+       QComboBox::changeEvent(e);
+}
+
+void CellStyleComboBox::languageChange()
+{
+       bool sigBlocked = this->blockSignals(true);
+       int styleIndex = this->currentIndex();
+
+       updateStyleList();
+       if (styleIndex >= 0)
+               this->setCurrentIndex(styleIndex);
+
+       this->blockSignals(sigBlocked);
 }
 
 void CellStyleComboBox::setDoc(ScribusDoc *newCurrentDoc)
 {
-       currentDoc = newCurrentDoc;
-       updateFormatList();
-}
-
-void CellStyleComboBox::setFormat(const QString& name)
-{
-       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultCellStyle : name);
-}
-
-void CellStyleComboBox::updateFormatList()
+       m_doc = newCurrentDoc;
+       updateStyleList();
+}
+
+void CellStyleComboBox::setStyle(const QString& name)
+{
+       QString cellStyleName = name;
+       if (cellStyleName == CommonStrings::DefaultCellStyle)
+               cellStyleName = CommonStrings::trDefaultCellStyle;
+       setCurrentComboItem(this, cellStyleName.isEmpty() ? 
CommonStrings::trDefaultCellStyle : cellStyleName);
+}
+
+void CellStyleComboBox::updateStyleList()
 {
        QString oldStyleName;
-       if (currentDoc && this->count() > 0)
+       if (m_doc && this->count() > 0)
                oldStyleName = this->currentText();
 
        bool sigBlocked = this->blockSignals(true);
        clear();
-       if (currentDoc != nullptr)
+       if (m_doc != nullptr)
        {
                QStringList st;
                addItem( CommonStrings::trDefaultCellStyle  );
-               for (int i = 0; i < currentDoc->cellStyles().count(); ++i)
-               {
-                       const CellStyle& cellStyle = 
currentDoc->cellStyles()[i];
+               for (int i = 0; i < m_doc->cellStyles().count(); ++i)
+               {
+                       const CellStyle& cellStyle = m_doc->cellStyles()[i];
                        if (!cellStyle.name().isEmpty() && 
!cellStyle.isDefaultStyle())
                                st.append(cellStyle.name());
                }
@@ -213,52 +330,89 @@
        this->blockSignals(sigBlocked);
 }
 
-void CellStyleComboBox::selFormat(int e)
-{
-       if (e == 0)
+void CellStyleComboBox::selectedStyle(int index)
+{
+       if (index == 0)
        {
                emit newStyle(QString());
-       }
-       else
-       {
-               emit newStyle(currentText());
-       }
+               return;
+       }
+       
+       QString newStyleName = currentText();
+       if (newStyleName == CommonStrings::trDefaultCellStyle)
+               newStyleName = CommonStrings::DefaultCellStyle;
+       emit newStyle(newStyleName);
 }
 
 TableStyleComboBox::TableStyleComboBox(QWidget* parent) : QComboBox(parent)
 {
        setEditable(false);
        addItem( CommonStrings::trDefaultTableStyle );
-       currentDoc = nullptr;
-       connect(this, SIGNAL(activated(int)), this, SLOT(selFormat(int)));
+       connect(this, SIGNAL(activated(int)), this, SLOT(selectedStyle(int)));
+}
+
+QString TableStyleComboBox::currentStyle() const
+{
+       if (this->currentIndex() == 0)
+               return QString();
+
+       QString currStyleName = this->currentText();
+       if (currStyleName == CommonStrings::trDefaultTableStyle)
+               currStyleName = CommonStrings::DefaultTableStyle;
+       return currStyleName;
+}
+
+void TableStyleComboBox::changeEvent(QEvent *e)
+{
+       if (e->type() == QEvent::LanguageChange)
+       {
+               languageChange();
+               return;
+       }
+       QComboBox::changeEvent(e);
+}
+
+void TableStyleComboBox::languageChange()
+{
+       bool sigBlocked = this->blockSignals(true);
+       int styleIndex = this->currentIndex();
+
+       updateStyleList();
+       if (styleIndex >= 0)
+               this->setCurrentIndex(styleIndex);
+
+       this->blockSignals(sigBlocked);
 }
 
 void TableStyleComboBox::setDoc(ScribusDoc *newCurrentDoc)
 {
-       currentDoc = newCurrentDoc;
-       updateFormatList();
-}
-
-void TableStyleComboBox::setFormat(const QString& name)
-{
-       setCurrentComboItem(this, name.isEmpty() ? 
CommonStrings::trDefaultTableStyle : name);
-}
-
-void TableStyleComboBox::updateFormatList()
+       m_doc = newCurrentDoc;
+       updateStyleList();
+}
+
+void TableStyleComboBox::setStyle(const QString& name)
+{
+       QString tableStyleName = name;
+       if (tableStyleName == CommonStrings::DefaultTableStyle)
+               tableStyleName = CommonStrings::trDefaultTableStyle;
+       setCurrentComboItem(this, tableStyleName.isEmpty() ? 
CommonStrings::trDefaultTableStyle : tableStyleName);
+}
+
+void TableStyleComboBox::updateStyleList()
 {
        QString oldStyleName;
-       if (currentDoc && this->count() > 0)
+       if (m_doc && this->count() > 0)
                oldStyleName = this->currentText();
 
        bool sigBlocked = this->blockSignals(true);
        clear();
-       if (currentDoc != nullptr)
+       if (m_doc != nullptr)
        {
                QStringList st;
                addItem( CommonStrings::trDefaultTableStyle );
-               for (int i = 0; i < currentDoc->tableStyles().count(); ++i)
-               {
-                       const TableStyle& tableStyle = 
currentDoc->tableStyles()[i];
+               for (int i = 0; i < m_doc->tableStyles().count(); ++i)
+               {
+                       const TableStyle& tableStyle = m_doc->tableStyles()[i];
                        if (!tableStyle.name().isEmpty() && 
!tableStyle.isDefaultStyle())
                                st.append(tableStyle.name());
                }
@@ -279,14 +433,16 @@
        this->blockSignals(sigBlocked);
 }
 
-void TableStyleComboBox::selFormat(int e)
-{
-       if (e == 0)
+void TableStyleComboBox::selectedStyle(int index)
+{
+       if (index == 0)
        {
                emit newStyle(QString());
-       }
-       else
-       {
-               emit newStyle(currentText());
-       }
-}
+               return;
+       }
+       
+       QString newStyleName = currentText();
+       if (newStyleName == CommonStrings::trDefaultTableStyle)
+               newStyleName = CommonStrings::DefaultTableStyle;
+       emit newStyle(newStyleName);
+}

Modified: trunk/Scribus/scribus/ui/spalette.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/spalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/spalette.h (original)
+++ trunk/Scribus/scribus/ui/spalette.h Fri Apr 17 23:36:23 2020
@@ -27,6 +27,8 @@
 #include <QComboBox>
 #include <QLayout>
 #include "scribusapi.h"
+
+class QEvent;
 class ScribusDoc;
 
 /**
@@ -40,18 +42,25 @@
 public: 
        ParaStyleComboBox(QWidget* parent);
        ~ParaStyleComboBox() {};
-       
-       ScribusDoc *currentDoc;
+
+       QString currentStyle() const;
        
 public slots:
        void setDoc(ScribusDoc *newCurrentDoc);
-       void setFormat(const QString& name);
-       void updateFormatList();
-       void selFormat(int e);
+       void setStyle(const QString& name);
+       void updateStyleList();
+
+protected:
+       ScribusDoc *m_doc { nullptr };
+
+       void changeEvent(QEvent *e) override;
+       void languageChange();
+
+protected slots:
+       void selectedStyle(int e);
        
 signals:
        void newStyle(const QString&);
-       void editStyle();
 };
 
 class SCRIBUS_API CharStyleComboBox : public QComboBox
@@ -61,18 +70,25 @@
 public: 
        CharStyleComboBox(QWidget* parent);
        ~CharStyleComboBox() {};
-       
-       ScribusDoc *currentDoc;
+
+       QString currentStyle() const;
        
 public slots:
        void setDoc(ScribusDoc *newCurrentDoc);
-       void setFormat(const QString& name);
-       void updateFormatList();
-       void selFormat(int e);
+       void setStyle(const QString& name);
+       void updateStyleList();
+
+protected:
+       ScribusDoc *m_doc { nullptr };
+
+       void changeEvent(QEvent *e) override;
+       void languageChange();
+
+protected slots:
+       void selectedStyle(int e);
        
 signals:
        void newStyle(const QString&);
-       void editCharStyle();
 };
 
 class SCRIBUS_API CellStyleComboBox : public QComboBox
@@ -83,17 +99,24 @@
        CellStyleComboBox(QWidget* parent);
        ~CellStyleComboBox() {};
 
-       ScribusDoc *currentDoc;
+       QString currentStyle() const;
 
 public slots:
        void setDoc(ScribusDoc *newCurrentDoc);
-       void setFormat(const QString& name);
-       void updateFormatList();
-       void selFormat(int e);
+       void setStyle(const QString& name);
+       void updateStyleList();
+
+protected:
+       ScribusDoc *m_doc { nullptr };
+
+       void changeEvent(QEvent *e) override;
+       void languageChange();
+
+protected slots:
+       void selectedStyle(int e);
 
 signals:
        void newStyle(const QString&);
-       void editCharStyle();
 };
 
 class SCRIBUS_API TableStyleComboBox : public QComboBox
@@ -104,17 +127,24 @@
        TableStyleComboBox(QWidget* parent);
        ~TableStyleComboBox() {};
 
-       ScribusDoc *currentDoc;
+       QString currentStyle() const;
 
 public slots:
        void setDoc(ScribusDoc *newCurrentDoc);
-       void setFormat(const QString& name);
-       void updateFormatList();
-       void selFormat(int e);
+       void setStyle(const QString& name);
+       void updateStyleList();
+
+protected:
+       ScribusDoc *m_doc { nullptr };
+
+       void changeEvent(QEvent *e) override;
+       void languageChange();
+
+protected slots:
+       void selectedStyle(int e);
 
 signals:
        void newStyle(const QString&);
-       void editCharStyle();
 };
 
 #endif

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=23620&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp    (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp    Fri Apr 17 23:36:23 2020
@@ -159,7 +159,7 @@
                if (len > 0)
                        styleName = 
m_editor->StyledText.paragraphStyle(pos).parent(); //FIXME ParaStyleComboBox 
and use localized style name
        }
-       paraStyleCombo->setFormat(styleName);
+       paraStyleCombo->setStyle(styleName);
        connect(paraStyleCombo, SIGNAL(newStyle(const QString&)), this, 
SLOT(setPStyle(const QString&)));
        
        paraStyleAct = new QWidgetAction(pmen);
@@ -1486,7 +1486,7 @@
 void SToolBAlign::SetParaStyle(const QString& s)
 {
        QSignalBlocker sigBlocker(paraStyleCombo);
-       paraStyleCombo->setFormat(s);
+       paraStyleCombo->setStyle(s);
 }
 
 /* Toolbar for Font related Settings */


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

Reply via email to