r22613 by craig - clazy and clang fixes, part 11
scribus-commit
scribus-commit at lists.scribus.net
Sun Aug 5 12:47:17 UTC 2018
Author: craig
Date: Sun Aug 5 12:47:17 2018
New Revision: 22613
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22613
Log:
clazy and clang fixes, part 11
Modified:
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/prefsmanager.h
trunk/Scribus/scribus/prefsreader.cpp
trunk/Scribus/scribus/prefstable.cpp
trunk/Scribus/scribus/prefstable.h
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22613&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Sun Aug 5 12:47:17 2018
@@ -66,10 +66,10 @@
extern ScribusQApp* ScQApp;
extern bool emergencyActivated;
-PrefsManager* PrefsManager::m_instance = 0;
+PrefsManager* PrefsManager::m_instance = nullptr;
PrefsManager::PrefsManager(QObject *parent) : QObject(parent),
- prefsFile(0),
+ prefsFile(nullptr),
m_importingFrom12(false),
m_firstTimeIgnoreOldPrefs(false)
{
@@ -83,7 +83,7 @@
PrefsManager* PrefsManager::instance()
{
- if (m_instance == 0)
+ if (m_instance == nullptr)
m_instance = new PrefsManager();
return m_instance;
@@ -91,9 +91,8 @@
void PrefsManager::deleteInstance()
{
- if (m_instance)
- delete m_instance;
- m_instance = 0;
+ delete m_instance;
+ m_instance = nullptr;
}
@@ -149,7 +148,7 @@
SCFonts& availableFonts = appPrefs.fontPrefs.AvailFonts;
for (int i = 0; i < defaultFonts.count(); ++i)
{
- QString defCandidate = defaultFonts.at(i);
+ const QString& defCandidate = defaultFonts.at(i);
if (availableFonts.contains(defCandidate))
{
appPrefs.itemToolPrefs.textFont = defCandidate;
@@ -1239,12 +1238,12 @@
return names;
}
-void PrefsManager::replaceToolColors(const QMap<QString, QString> replaceMap)
+void PrefsManager::replaceToolColors(const QMap<QString, QString>& replaceMap)
{
replaceToolColors(appPrefs.itemToolPrefs, replaceMap);
}
-void PrefsManager::replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString> replaceMap)
+void PrefsManager::replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString>& replaceMap)
{
if (replaceMap.contains(settings.textColor))
settings.textColor = replaceMap[settings.textColor];
@@ -1370,7 +1369,7 @@
return appPrefs.displayPrefs.showPageShadow;
}
-bool PrefsManager::WritePref(QString ho)
+bool PrefsManager::WritePref(const QString& ho)
{
QDomDocument docu("scribusrc");
QString st="<SCRIBUSRC></SCRIBUSRC>";
@@ -1939,7 +1938,7 @@
return result;
}
-bool PrefsManager::ReadPref(QString ho)
+bool PrefsManager::ReadPref(const QString& ho)
{
QDomDocument docu("scridoc");
QFile f(ho);
@@ -1998,7 +1997,7 @@
appPrefs.uiPrefs.useSmallWidgets = dc.attribute("UseSmallWidgets").toInt();
appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UseDocumentTabs", "0").toInt());
appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt());
- appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",0).toInt());
+ appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",nullptr).toInt());
appPrefs.uiPrefs.iconSet = dc.attribute("IconSet", "1_5_0");
}
@@ -2229,11 +2228,11 @@
if (dc.hasAttribute("FontFace"))
{
QString tmpf=dc.attribute("FontFace");
- QString newFont = "";
+ QString newFont;
if (!appPrefs.fontPrefs.AvailFonts.contains(tmpf) || !appPrefs.fontPrefs.AvailFonts[tmpf].usable())
{
ScCore->showSplash(false);
- MissingFont *dia = new MissingFont(0, tmpf, 0);
+ MissingFont *dia = new MissingFont(nullptr, tmpf, nullptr);
dia->exec();
newFont = dia->getReplacementFont();
delete dia;
@@ -2451,7 +2450,7 @@
{
bool gsa1 = testGSAvailability(dc.attribute("Ghostscript", "gs"));
bool gsa2 = testGSAvailability(ghostscriptExecutable());
- if( (gsa1 == true) || (gsa2 == false) )
+ if( (gsa1) || (!gsa2) )
setGhostscriptExecutable(dc.attribute("Ghostscript", "gs"));
appPrefs.extToolPrefs.gs_AntiAliasText = static_cast<bool>(dc.attribute("GhostscriptAntiAliasText", "0").toInt());
appPrefs.extToolPrefs.gs_AntiAliasGraphics = static_cast<bool>(dc.attribute("GhostscriptAntiAliasGraphics", "0").toInt());
@@ -2768,7 +2767,7 @@
CheckerPrefsList::const_iterator it = defaultList.constBegin();
for (; it != defaultList.constEnd(); ++it)
{
- QString name = it.key();
+ const QString& name = it.key();
if (cp.contains(name))
continue;
cp.insert(name, it.value());
Modified: trunk/Scribus/scribus/prefsmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22613&path=/trunk/Scribus/scribus/prefsmanager.h
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.h (original)
+++ trunk/Scribus/scribus/prefsmanager.h Sun Aug 5 12:47:17 2018
@@ -119,13 +119,13 @@
Here is the XML file created itself.
\param ho a file name to write
\retval bool true on success, false on write error */
- bool WritePref(QString ho);
+ bool WritePref(const QString& ho);
/*! \brief Reads the preferences physically from the file.
Here is the XML file parsed itself. Returns false on error.
It's the caller's job to make sure the prefs file actually exists.
\param ho a file name to write
\retval bool true on success, false on write error */
- bool ReadPref(QString ho);
+ bool ReadPref(const QString& ho);
//! \brief Set up the main window with prefs values, recent files list, main window size etc
void setupMainWindow(ScribusMainWindow* mw);
void setGhostscriptExecutable(const QString&);
@@ -182,8 +182,8 @@
QStringList toolColorNames();
static QStringList toolColorNames(const struct ItemToolPrefs& settings);
/*! \brief Replace used colors in tool prefs */
- void replaceToolColors(const QMap<QString, QString> replaceMap);
- static void replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString> replaceMap);
+ void replaceToolColors(const QMap<QString, QString>& replaceMap);
+ static void replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString>& replaceMap);
/*! \brief Finds the fonts on the system
Must be run after: PrefsManager::setup()
Must be run before: PrefsManager::initDefaults()
Modified: trunk/Scribus/scribus/prefsreader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22613&path=/trunk/Scribus/scribus/prefsreader.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsreader.cpp (original)
+++ trunk/Scribus/scribus/prefsreader.cpp Sun Aug 5 12:47:17 2018
@@ -30,8 +30,8 @@
{
m_aContexts = appContexts;
m_pContexts = pluginContexts;
- m_currentContext = 0;
- m_currentTable = 0;
+ m_currentContext = nullptr;
+ m_currentTable = nullptr;
m_inApp = false;
m_rowIndex = 0;
m_colIndex = 0;
Modified: trunk/Scribus/scribus/prefstable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22613&path=/trunk/Scribus/scribus/prefstable.cpp
==============================================================================
--- trunk/Scribus/scribus/prefstable.cpp (original)
+++ trunk/Scribus/scribus/prefstable.cpp Sun Aug 5 12:47:17 2018
@@ -26,7 +26,7 @@
#include "prefstable.h"
-PrefsTable::PrefsTable(QString tableName)
+PrefsTable::PrefsTable(const QString& tableName)
{
m_name = tableName;
m_rowCount = 0;
@@ -152,7 +152,7 @@
for (int i = 0; i < height(); ++i)
{
if ((get(i, searchCol, "__NOT__SET__") == what) &&
- (get(i, searchCol, "__NOT__SET__") != "__NOT__SET__"))
+ (get(i, searchCol, "__NOT__SET__") != "__NOT__SET__"))
{
rowi = i;
break;
Modified: trunk/Scribus/scribus/prefstable.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22613&path=/trunk/Scribus/scribus/prefstable.h
==============================================================================
--- trunk/Scribus/scribus/prefstable.h (original)
+++ trunk/Scribus/scribus/prefstable.h Sun Aug 5 12:47:17 2018
@@ -39,40 +39,40 @@
class SCRIBUS_API PrefsTable
{
-private:
- QString m_name;
- Table m_table;
- int m_rowCount;
- int m_colCount;
- void checkSize(int rowIndex, int colIndex, QString defValue = "");
- void checkHeight(int rowIndex);
- void checkWidth(int rowIndex, int colIndex, QString defValue = "");
-public:
- PrefsTable(QString tableName);
- ~PrefsTable();
- QString getName();
- int height();
- int getRowCount();
- int width();
- int getColCount();
- QString get(int row, int col, const QString& defValue = "");
- void set(int row, int col, const char* value);
- void set(int row, int col, const std::string& value);
- void set(int row, int col, const QString& value);
- int getInt(int row, int col = 0, int defValue = -1);
- void set(int row, int col, int value);
- void set(int row, int col, uint value);
- uint getUInt(int row, int col, uint defValue = 0);
- double getDouble(int row, int col, double defValue = -1.0);
- void set(int row, int col, double value);
- bool getBool(int row, int col, bool defValue = false);
- void set(int row, int col, bool value);
-/*** finds what in searchCol and returns the row index if found if not will return -1 */
- int find(int searchCol, const QString& what);
-/*** Removes the row where in column colIndex can be found text what ********/
- void removeRow(int colIndex, const QString& what);
-/*** Empties the table ***/
- void clear();
+ private:
+ QString m_name;
+ Table m_table;
+ int m_rowCount;
+ int m_colCount;
+ void checkSize(int rowIndex, int colIndex, QString defValue = "");
+ void checkHeight(int rowIndex);
+ void checkWidth(int rowIndex, int colIndex, QString defValue = "");
+ public:
+ PrefsTable(const QString& tableName);
+ ~PrefsTable();
+ QString getName();
+ int height();
+ int getRowCount();
+ int width();
+ int getColCount();
+ QString get(int row, int col, const QString& defValue = "");
+ void set(int row, int col, const char* value);
+ void set(int row, int col, const std::string& value);
+ void set(int row, int col, const QString& value);
+ int getInt(int row, int col = 0, int defValue = -1);
+ void set(int row, int col, int value);
+ void set(int row, int col, uint value);
+ uint getUInt(int row, int col, uint defValue = 0);
+ double getDouble(int row, int col, double defValue = -1.0);
+ void set(int row, int col, double value);
+ bool getBool(int row, int col, bool defValue = false);
+ void set(int row, int col, bool value);
+ /*** finds what in searchCol and returns the row index if found if not will return -1 */
+ int find(int searchCol, const QString& what);
+ /*** Removes the row where in column colIndex can be found text what ********/
+ void removeRow(int colIndex, const QString& what);
+ /*** Empties the table ***/
+ void clear();
};
#endif
More information about the scribus-commit
mailing list