r25033 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 16 21:58:27 UTC 2022


Author: jghali
Date: Wed Mar 16 21:58:27 2022
New Revision: 25033

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25033
Log:
Code cleanup

Modified:
    trunk/Scribus/scribus/chartablemodel.h
    trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
    trunk/Scribus/scribus/ui/charselectenhanced.cpp
    trunk/Scribus/scribus/ui/charselectenhanced.h

Modified: trunk/Scribus/scribus/chartablemodel.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25033&path=/trunk/Scribus/scribus/chartablemodel.h
==============================================================================
--- trunk/Scribus/scribus/chartablemodel.h	(original)
+++ trunk/Scribus/scribus/chartablemodel.h	Wed Mar 16 21:58:27 2022
@@ -38,9 +38,9 @@
 	int columnCount(const QModelIndex& parent = QModelIndex()) const override;
 
 	//! \brief Get a graphics representation/pixmap of the glyph
-	QVariant data(const QModelIndex& index,
-				  int role = Qt::DisplayRole) const override;
+	QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
 
+	//! \brief Set current font
 	void setFontInUse(const QString& font);
 
 	//! \brief Font in use. It's used in model's view.
@@ -49,17 +49,15 @@
 	void setCharacters(const CharClassDef& ch);
 	void setCharactersAndFonts(const CharClassDef& ch, const QStringList& fonts);
 	void addCharacter(const QString& ch);
-	CharClassDef characters() { return m_characters; }
-	QStringList fonts() { return m_fonts; }
+	const CharClassDef& characters() const { return m_characters; }
+	const QStringList& fonts() const { return m_fonts; }
 
 	//! \brief called to erase glyph at index from table.
 	bool removeCharacter(int index);
 
 	void setDoc(ScribusDoc *doc);
 
-	void setViewWidth(int w) {
-		m_viewWidth = w;
-	};
+	void setViewWidth(int w) { m_viewWidth = w; };
 
 public slots:
 	/*! \brief appends an unicode char into m_characters list.
@@ -87,9 +85,9 @@
 		CharTextAndFontRole = Qt::UserRole + 2
 	};
 
-	ScribusDoc *m_doc;
+	ScribusDoc *m_doc { nullptr };
 	//! \brief Number of the columns for model
-	int m_cols;
+	int m_cols { 1 };
 	//! \brief View's width to compute pixmap sizes.
 	int m_viewWidth {200};
 
@@ -98,7 +96,7 @@
 	QStringList m_fonts;
 
 	//! \brief Internal selection handling. See selectionChanged().
-	QItemSelectionModel * m_selectionModel;
+	QItemSelectionModel * m_selectionModel { nullptr };
 
 	/*! \brief All drag'n'drop actions are handled in this model only
 	See Qt4 docs "Using Drag and Drop with Item Views" for more info.

Modified: trunk/Scribus/scribus/plugins/import/xps/importxps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25033&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	Wed Mar 16 21:58:27 2022
@@ -871,7 +871,7 @@
 				{
 					std::u32string ucs4 = utfString.toStdU32String();
 					// FIXME HOST: this code does not do any text layout!
-					for (int sti = 0; sti < ucs4.length(); sti++)
+					for (size_t sti = 0; sti < ucs4.length(); ++sti)
 					{
 						char32_t chr = ucs4.at(sti);
 						QString utfChar = QString::fromUcs4(&chr, 1);

Modified: trunk/Scribus/scribus/ui/charselectenhanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25033&path=/trunk/Scribus/scribus/ui/charselectenhanced.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charselectenhanced.cpp	(original)
+++ trunk/Scribus/scribus/ui/charselectenhanced.cpp	Wed Mar 16 21:58:27 2022
@@ -21,8 +21,7 @@
 {
 	setupUi(this);
 
-	m_charTableModel = new CharTableModel(this, 26, m_doc);//,
-//                                           PrefsManager::instance().appPrefs.toolSettings.defFont);
+	m_charTableModel = new CharTableModel(this, 26, m_doc);
 	m_charTable->setModel(m_charTableModel);
 	m_charTable->setDragEnabled(true);
 
@@ -61,7 +60,7 @@
 //     tDebug("CharSelectEnhanced setDoc end");
 }
 
-QString CharSelectEnhanced::getUsedFont()
+QString CharSelectEnhanced::getUsedFont() const
 {
 	return m_fontInUse;
 }

Modified: trunk/Scribus/scribus/ui/charselectenhanced.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25033&path=/trunk/Scribus/scribus/ui/charselectenhanced.h
==============================================================================
--- trunk/Scribus/scribus/ui/charselectenhanced.h	(original)
+++ trunk/Scribus/scribus/ui/charselectenhanced.h	Wed Mar 16 21:58:27 2022
@@ -26,7 +26,7 @@
 	~CharSelectEnhanced() = default;
 
 	void setDoc(ScribusDoc* doc);
-	QString getUsedFont();
+	QString getUsedFont() const;
 
 signals:
 	/*! \brief A signal emitted when press the "Insert" button.




More information about the scribus-commit mailing list