Author: jghali
Date: Sun Mar 13 01:23:49 2022
New Revision: 25028

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25028
Log:
Move CharStyle's hyphenChar from uint to char32_t and fix some more deprecation 
warnings

Modified:
    trunk/Scribus/scribus/desaxe/saxiohelper.cpp
    trunk/Scribus/scribus/desaxe/saxiohelper.h
    trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
    trunk/Scribus/scribus/plugins/import/xps/importxps.h
    trunk/Scribus/scribus/styles/charstyle.attrdefs.cxx
    trunk/Scribus/scribus/ui/smcstylewidget.cpp

Modified: trunk/Scribus/scribus/desaxe/saxiohelper.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/desaxe/saxiohelper.cpp
==============================================================================
--- trunk/Scribus/scribus/desaxe/saxiohelper.cpp        (original)
+++ trunk/Scribus/scribus/desaxe/saxiohelper.cpp        Sun Mar 13 01:23:49 2022
@@ -56,6 +56,11 @@
        return QString::number(val);
 }
 
+char32_t parseChar32(const Xml_string& str)
+{
+       return static_cast<char32_t>(str.toUInt());
+}
+
 unsigned int parseUInt(const Xml_string& str)
 {
        return str.toUInt();

Modified: trunk/Scribus/scribus/desaxe/saxiohelper.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/desaxe/saxiohelper.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/saxiohelper.h  (original)
+++ trunk/Scribus/scribus/desaxe/saxiohelper.h  Sun Mar 13 01:23:49 2022
@@ -34,6 +34,7 @@
 Xml_string toXMLString(const QList<int>& intlist);
 Xml_string toXMLString(const QStringList& list);
 
+char32_t parseChar32(const Xml_string& str);
 unsigned int parseUInt(const Xml_string& str);
 int parseInt(const Xml_string& str);
 unsigned long parseULong(const Xml_string& str);
@@ -79,6 +80,13 @@
 Xml_string parse<Xml_string>(const Xml_string& str)
 {
        return str;
+}
+
+template<>
+inline
+char32_t parse<char32_t>(const Xml_string& str)
+{
+       return parseChar32(str);
 }
 
 template<>

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.cpp      (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.cpp      Sun Mar 13 
01:23:49 2022
@@ -28,6 +28,7 @@
 #include <cstdlib>
 #include <climits>
 #include <limits>
+#include <string>
 
 #include "commonstrings.h"
 
@@ -69,8 +70,6 @@
        m_Doc = doc;
        importerFlags = flags;
        interactive = (flags & LoadSavePlugin::lfInteractive);
-       progressDialog = nullptr;
-       uz = nullptr;
 }
 
 QImage XpsPlug::readThumbnail(const QString& fName)
@@ -120,7 +119,7 @@
        }
        if (!found)
        {
-               QFileInfo fi = QFileInfo(fName);
+               QFileInfo fi(fName);
                baseFile = 
QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
                docWidth = 
PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
                docHeight = 
PrefsManager::instance().appPrefs.docSetupPrefs.pageHeight;
@@ -205,7 +204,7 @@
        baseFile = 
QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
        if ( showProgress )
        {
-               ScribusMainWindow* mw=(m_Doc==nullptr) ? 
ScCore->primaryMainWindow() : m_Doc->scMW();
+               ScribusMainWindow* mw = (m_Doc==nullptr) ? 
ScCore->primaryMainWindow() : m_Doc->scMW();
                progressDialog = new MultiProgressDialog( tr("Importing: 
%1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
                QStringList barNames, barTexts;
                barNames << "GI";
@@ -218,14 +217,14 @@
                progressDialog->setProgress("GI", 0);
                progressDialog->show();
                connect(progressDialog, SIGNAL(canceled()), this, 
SLOT(cancelRequested()));
-               qApp->processEvents();
+               QApplication::processEvents();
        }
        else
                progressDialog = nullptr;
        if (progressDialog)
        {
                progressDialog->setOverallProgress(1);
-               qApp->processEvents();
+               QApplication::processEvents();
        }
        /* Set default Page to size defined in Preferences */
        docWidth = PrefsManager::instance().appPrefs.docSetupPrefs.pageWidth;
@@ -253,12 +252,12 @@
                        baseY = m_Doc->currentPage()->yOffset() + 
m_Doc->currentPage()->height() / 2.0;
                }
        }
-       if ((!ret) && (interactive))
+       if (!ret && interactive)
        {
                baseX = m_Doc->currentPage()->xOffset();
                baseY = m_Doc->currentPage()->yOffset() + 
m_Doc->currentPage()->height() / 2.0;
        }
-       if ((ret) || (!interactive))
+       if (ret || !interactive)
        {
                if (docWidth > docHeight)
                        m_Doc->setPageOrientation(1);
@@ -274,7 +273,7 @@
        if ((!(flags & LoadSavePlugin::lfLoadAsPattern)) && (m_Doc->view() != 
nullptr))
                m_Doc->view()->updatesOn(false);
        m_Doc->scMW()->setScriptRunning(true);
-       qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
+       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
        QString CurDirP = QDir::currentPath();
        QDir::setCurrent(fi.path());
        if (convert(fNameIn))
@@ -286,7 +285,7 @@
                m_Doc->DoDrawing = true;
                m_Doc->scMW()->setScriptRunning(false);
                m_Doc->setLoading(false);
-               qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+               QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
                if ((Elements.count() > 0) && (!ret) && (interactive))
                {
                        if (flags & LoadSavePlugin::lfScripted)
@@ -362,7 +361,7 @@
                m_Doc->scMW()->setScriptRunning(false);
                if (!(flags & LoadSavePlugin::lfLoadAsPattern))
                        m_Doc->view()->updatesOn(true);
-               qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+               QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
                success = false;
        }
        if (interactive)
@@ -370,10 +369,10 @@
        //CB If we have a gui we must refresh it if we have used the progressbar
        if (!(flags & LoadSavePlugin::lfLoadAsPattern))
        {
-               if ((showProgress) && (!interactive))
+               if (showProgress && !interactive)
                        m_Doc->view()->DrawNew();
        }
-       qApp->restoreOverrideCursor();
+       QApplication::restoreOverrideCursor();
        return success;
 }
 
@@ -401,7 +400,7 @@
        {
                progressDialog->setOverallProgress(2);
                progressDialog->setLabel("GI", tr("Generating Items"));
-               qApp->processEvents();
+               QApplication::processEvents();
        }
 
        uz = new ScZipHandler();
@@ -505,20 +504,20 @@
                QString pageString = "*";
                int pgCount = 0;
                int maxPages = docElem.childNodes().count();
-               if (((interactive) || (importerFlags & 
LoadSavePlugin::lfCreateDoc)) && (maxPages > 1))
+               if ((interactive || (importerFlags & 
LoadSavePlugin::lfCreateDoc)) && (maxPages > 1))
                {
                        if (progressDialog)
                                progressDialog->hide();
-                       qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+                       
QApplication::changeOverrideCursor(QCursor(Qt::ArrowCursor));
                        XpsImportOptions optImp(ScCore->primaryMainWindow());
                        optImp.setUpOptions(m_FileName, 1, maxPages, 
interactive);
                        if (optImp.exec() != QDialog::Accepted)
                                return false;
                        pageString = optImp.getPagesString();
-                       qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
+                       
QApplication::changeOverrideCursor(QCursor(Qt::WaitCursor));
                        if (progressDialog)
                                progressDialog->show();
-                       qApp->processEvents();
+                       QApplication::processEvents();
                }
                parsePagesString(pageString, &pageNs, maxPages);
                if (pageString != "*")
@@ -527,7 +526,7 @@
                {
                        progressDialog->setTotalSteps("GI", maxPages);
                        progressDialog->setProgress("GI", pgCount);
-                       qApp->processEvents();
+                       QApplication::processEvents();
                }
                QDomNodeList pgList = docElem.childNodes();
                for (uint ap = 0; ap < pageNs.size(); ++ap)
@@ -870,11 +869,11 @@
                                int glInd = 0;
                                if (!utfString.isEmpty())
                                {
-                                       QVector<uint> ucs4 = utfString.toUcs4();
+                                       std::u32string ucs4 = 
utfString.toStdU32String();
                                        // FIXME HOST: this code does not do 
any text layout!
                                        for (int sti = 0; sti < ucs4.length(); 
sti++)
                                        {
-                                               uint chr = ucs4[sti];
+                                               char32_t chr = ucs4.at(sti);
                                                QString utfChar = 
QString::fromUcs4(&chr, 1);
                                                uint gl = 
iteFont.char2CMap(chr);
                                                if (gl != 0)
@@ -908,8 +907,8 @@
                                                                                
{
                                                                                
        if (glyInd[0].startsWith("("))
                                                                                
        {
-                                                                               
                int r = glyInd[0].indexOf(")");
-                                                                               
                QString comb = glyInd[0].mid(1, r-1);
+                                                                               
                qsizetype r = glyInd[0].indexOf(")");
+                                                                               
                QString comb = glyInd[0].mid(1, r - 1);
                                                                                
                QStringList combInd = comb.split(":");
                                                                                
                int advUtf = combInd[0].toInt() - 1;
                                                                                
                sti += advUtf;
@@ -986,8 +985,8 @@
                                                        {
                                                                if 
(glyInd[0].startsWith("("))
                                                                {
-                                                                       int r = 
glyInd[0].indexOf(")");
-                                                                       QString 
comb = glyInd[0].mid(1, r-1);
+                                                                       
qsizetype r = glyInd[0].indexOf(")");
+                                                                       QString 
comb = glyInd[0].mid(1, r - 1);
                                                                        
QStringList combInd = comb.split(":");
                                                                        int 
advUtf = combInd[0].toInt() - 1;
                                                                        glInd 
+= advUtf;
@@ -1926,10 +1925,10 @@
                }
                // Obfuscation - xor bytes in font binary with bytes from guid 
(font's filename)
                const static int mapping[] = {15, 14, 13, 12, 11, 10, 9, 8, 6, 
7, 4, 5, 0, 1, 2, 3};
-               for (int i = 0; i < 16; i++)
+               for (int i = 0; i < 16; ++i)
                {
                        fontData[i] = fontData[i] ^ guid[mapping[i]];
-                       fontData[i+16] = fontData[i+16] ^ guid[mapping[i]];
+                       fontData[i+16] = fontData[i + 16] ^ guid[mapping[i]];
                }
        }
        QFile ft(fname);

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/plugins/import/xps/importxps.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xps/importxps.h        (original)
+++ trunk/Scribus/scribus/plugins/import/xps/importxps.h        Sun Mar 13 
01:23:49 2022
@@ -13,10 +13,6 @@
 #ifndef IMPORTXPS_H
 #define IMPORTXPS_H
 
-#include "pluginapi.h"
-#include "pageitem.h"
-#include "sccolor.h"
-#include "fpointarray.h"
 #include <QList>
 #include <QTransform>
 #include <QMultiMap>
@@ -25,6 +21,12 @@
 #include <QString>
 #include <QDomDocument>
 #include <QDomElement>
+
+#include "commonstrings.h"
+#include "pluginapi.h"
+#include "pageitem.h"
+#include "sccolor.h"
+#include "fpointarray.h"
 
 class MultiProgressDialog;
 class ScribusDoc;
@@ -67,41 +69,41 @@
        struct ObjState
        {
                QPainterPath currentPath;
-               bool currentPathClosed;
+               bool currentPathClosed { false };
                QPainterPath clipPath;
                QTransform transform;
-               QString CurrColorFill;
-               double fillOpacity;
-               QString CurrColorStroke;
-               double strokeOpacity;
-               double LineW;
+               QString CurrColorFill { CommonStrings::None };
+               double fillOpacity { 0.0 };
+               QString CurrColorStroke { CommonStrings::None };
+               double strokeOpacity { 0.0 };
+               double LineW { 1.0 };
                VGradient currentGradient;
                QPointF gradientStart;
                QPointF gradientEnd;
                QPointF gradientFocus;
-               double gradientScale;
-               int fillGradientTyp;
+               double gradientScale { 1.0 };
+               int fillGradientTyp { 0 };
                QString imagePath;
                QString patternName;
                VGradient gradientMask;
                QPointF maskStart;
                QPointF maskEnd;
                QPointF maskFocus;
-               double maskScale;
-               int maskTyp;
+               double maskScale { 1.0 };
+               int maskTyp{ 0 };
                QString patternMask;
                VGradient gradientStroke;
                QPointF strokeStart;
                QPointF strokeEnd;
                QPointF strokeFocus;
-               double strokeScale;
-               int strokeTyp;
+               double strokeScale { 1.0 };
+               int strokeTyp { 0 };
                QString patternStroke;
-               int itemType;
-               Qt::PenCapStyle CapStyle;
-               Qt::PenJoinStyle JoinStyle;
+               int itemType { 0 };
+               Qt::PenCapStyle CapStyle { Qt::FlatCap };
+               Qt::PenJoinStyle JoinStyle { Qt::MiterJoin };
                QVector<double> DashPattern;
-               double DashOffset;
+               double DashOffset { 0.0 };
        };
        bool convert(const QString& fn);
        bool parseDocSequence(const QString& designMap);
@@ -122,34 +124,36 @@
        int hex2int(char hex);
        bool parseGUID( const QString &guidString, unsigned short guid[16]);
        ScFace loadFontByName(const QString &fileName);
+
        QList<PageItem*> Elements;
-       double baseX, baseY;
-       double docWidth;
-       double docHeight;
+       double baseX { 0.0 };
+       double baseY { 0.0 };
+       double docWidth { 1.0 };
+       double docHeight { 1.0 };
 
        FPointArray Coords;
-       bool interactive;
-       MultiProgressDialog * progressDialog;
-       bool cancel;
-       ScribusDoc* m_Doc;
-       Selection* tmpSel;
+       bool interactive { false };
+       MultiProgressDialog * progressDialog { nullptr};
+       bool cancel { false };
+       ScribusDoc* m_Doc { nullptr };
+       Selection* tmpSel { nullptr };
        int importerFlags;
        QString baseFile;
        QString m_FileName;
        QStringList importedColors;
        QStringList importedPatterns;
-       bool firstPage;
-       int pagecount;
-       double topMargin;
-       double leftMargin;
-       double rightMargin;
-       double bottomMargin;
-       double conversionFactor;
+       bool firstPage { true };
+       int pagecount { 1 };
+       double topMargin { 0.0 };
+       double leftMargin { 0.0 };
+       double rightMargin { 0.0 };
+       double bottomMargin { 0.0 };
+       double conversionFactor { 1.0 };
        QHash<QString, QPainterPath> pathResources;
        QHash<QString, PageItem*> linkTargets;
        QHash<PageItem*, QString> linkSources;
        QHash<QString, ScFace> loadedFonts;
-       ScZipHandler *uz;
+       ScZipHandler *uz { nullptr };
        QStringList tempFontFiles;
 
 public slots:

Modified: trunk/Scribus/scribus/styles/charstyle.attrdefs.cxx
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/styles/charstyle.attrdefs.cxx
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.attrdefs.cxx (original)
+++ trunk/Scribus/scribus/styles/charstyle.attrdefs.cxx Sun Mar 13 01:23:49 2022
@@ -41,4 +41,4 @@
 ATTRDEF(ScFace, font, Font, ScFace::none(), true)
 ATTRDEF(QStringList, features, Features, QStringList(CharStyle::INHERIT), 
false)
 ATTRDEF(int, hyphenWordMin, HyphenWordMin, 3, false)
-ATTRDEF(uint, hyphenChar, HyphenChar, 0x2010, false)
+ATTRDEF(char32_t, hyphenChar, HyphenChar, 0x2010, false)

Modified: trunk/Scribus/scribus/ui/smcstylewidget.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=25028&path=/trunk/Scribus/scribus/ui/smcstylewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smcstylewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/smcstylewidget.cpp Sun Mar 13 01:23:49 2022
@@ -260,13 +260,13 @@
                smallestWordSpinBox->setValue(cstyle->hyphenWordMin(), 
cstyle->isInhHyphenWordMin());
                smallestWordSpinBox->setParentValue(parent->hyphenWordMin());
 
-               uint hyphenChar = cstyle->hyphenChar();
+               char32_t hyphenChar = cstyle->hyphenChar();
                QString hyphenText;
                if (hyphenChar)
                        hyphenText = QString::fromUcs4(&hyphenChar, 1);
                hyphenCharLineEdit->setValue(hyphenText, 
cstyle->isInhHyphenChar());
 
-               uint parentHyphenChar = parent->hyphenChar();
+               char32_t parentHyphenChar = parent->hyphenChar();
                QString parentHyphenText;
                if (parentHyphenChar)
                        parentHyphenText = QString::fromUcs4(&parentHyphenChar, 
1);
@@ -291,7 +291,7 @@
                fontfeaturesSetting->setFontFeatures(cstyle->fontFeatures(), 
cstyle->font().fontFeatures());
                smallestWordSpinBox->setValue(cstyle->hyphenWordMin());
 
-               uint hyphenChar = cstyle->hyphenChar();
+               char32_t hyphenChar = cstyle->hyphenChar();
                QString hyphenText;
                if (hyphenChar)
                        hyphenText = QString::fromUcs4(&hyphenChar, 1);
@@ -667,8 +667,8 @@
 
 void SMCStyleWidget::showHyphenChar(const QList<CharStyle *> &cstyles)
 {
-       uint empty = 0;
-       uint ch(cstyles[0]->hyphenChar());
+       char32_t empty = 0;
+       char32_t ch(cstyles[0]->hyphenChar());
        for (int i = 0; i < cstyles.count(); ++i)
        {
                if (ch != cstyles[i]->hyphenChar())


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

Reply via email to