r24551 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat Mar 6 13:59:31 UTC 2021


Author: jghali
Date: Sat Mar  6 13:59:31 2021
New Revision: 24551

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

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

Modified: trunk/Scribus/scribus/ui/scrspinbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24551&path=/trunk/Scribus/scribus/ui/scrspinbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.cpp	(original)
+++ trunk/Scribus/scribus/ui/scrspinbox.cpp	Sat Mar  6 13:59:31 2021
@@ -145,14 +145,14 @@
 	m_constants = constants;
 }
 
-double ScrSpinBox::valueFromText ( const QString & text ) const
+double ScrSpinBox::valueFromText(const QString & text) const
 {
 	//Get a copy for use
 	QString ts = text.trimmed();
 	//Find our suffix
 	QString su(unitGetStrFromIndex(m_unitIndex));
 	//Replace our pica XpY.Z format with (X*12+Y.Z)pt
-	if (CommonStrings::trStrP.localeAwareCompare(CommonStrings::strP)!=0)
+	if (CommonStrings::trStrP.localeAwareCompare(CommonStrings::strP) != 0)
 		ts.replace(CommonStrings::trStrP, CommonStrings::strP);
 
 //	const lconv * lc(localeconv());
@@ -170,7 +170,7 @@
 	QString crtSepDecimal(LocaleManager::instance().userPreferredLocale().decimalPoint());
 //	qDebug()<<"crtSepDecimal"<<crtSepDecimal;
 	QRegExp rxP;
-	if (m_unitIndex==SC_PICAS)
+	if (m_unitIndex == SC_PICAS)
 		rxP.setPattern("\\b(\\d+)" + CommonStrings::strP + "?(\\d+\\" + crtSepDecimal + "?\\d*)?\\b");
 	else
 		rxP.setPattern("\\b(\\d+)" + CommonStrings::strP + "(\\d+\\" + crtSepDecimal + "?\\d*)?\\b");
@@ -251,15 +251,15 @@
 	//To return to previous functionality, remove the follow replacement ifs,
 	//S&R in the trStr* assignments trStrPT->strPT and remove the current str* ones. 
 	//IE, send the translated strings through to the regexp.
-	if (CommonStrings::trStrPT.localeAwareCompare(CommonStrings::strPT)!=0)
+	if (CommonStrings::trStrPT.localeAwareCompare(CommonStrings::strPT) != 0)
 		ts.replace(CommonStrings::trStrPT, CommonStrings::strPT);
-	if (CommonStrings::trStrMM.localeAwareCompare(CommonStrings::strMM)!=0)
+	if (CommonStrings::trStrMM.localeAwareCompare(CommonStrings::strMM) != 0)
 		ts.replace(CommonStrings::trStrMM, CommonStrings::strMM);
-	if (CommonStrings::trStrIN.localeAwareCompare(CommonStrings::strIN)!=0)
+	if (CommonStrings::trStrIN.localeAwareCompare(CommonStrings::strIN) != 0)
 		ts.replace(CommonStrings::trStrIN, CommonStrings::strIN);
-	if (CommonStrings::trStrCM.localeAwareCompare(CommonStrings::strCM)!=0)
+	if (CommonStrings::trStrCM.localeAwareCompare(CommonStrings::strCM) != 0)
 		ts.replace(CommonStrings::trStrCM, CommonStrings::strCM);
-	if (CommonStrings::trStrC.localeAwareCompare(CommonStrings::strC)!=0)
+	if (CommonStrings::trStrC.localeAwareCompare(CommonStrings::strC) != 0)
 		ts.replace(CommonStrings::trStrC, CommonStrings::strC);
 
 	//Add in the fparser constants using our unit strings, and the conversion factors.
@@ -296,13 +296,12 @@
 {
 	if (m_unitIndex == SC_PICAS)
 	{
-// 		QString r=QString("%1%2%3").arg((static_cast<int>(value))/12).arg(unitGetStrFromIndex(m_unitIndex)).arg(fabs(fmod(value, 12)));
 		int a = (static_cast<int>(value)) / 12;
 		double b = fabs(fmod(value, 12));
-		QString prefix((a==0 && value < 0.0) ? "-" : "");
+		QString prefix((a == 0 && value < 0.0) ? "-" : "");
 		return QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(m_unitIndex)).arg(b);
 	}
-	return QDoubleSpinBox::textFromValue ( value );
+	return QDoubleSpinBox::textFromValue(value);
 }
 
 QValidator::State ScrSpinBox::validate(QString & input, int & pos) const

Modified: trunk/Scribus/scribus/ui/scrspinbox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24551&path=/trunk/Scribus/scribus/ui/scrspinbox.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.h	(original)
+++ trunk/Scribus/scribus/ui/scrspinbox.h	Sat Mar  6 13:59:31 2021
@@ -27,10 +27,10 @@
 		~ScrSpinBox() override;
 		
 		//overridden members
-		double valueFromText ( const QString & text ) const override;
-		QString textFromValue ( double value ) const override;
-		QValidator::State validate ( QString & input, int & pos ) const override;
-		void fixup ( QString & input ) const override;
+		double valueFromText (const QString & text) const override;
+		QString textFromValue (double value) const override;
+		QValidator::State validate (QString & input, int & pos) const override;
+		void fixup (QString & input) const override;
 
 		// call QDoubleSpinBox::setValue() without emitting valueChanged() signal
 		void showValue(double val);
@@ -54,7 +54,7 @@
 		void setValues(double min, double max, int deci, double val);
 	
 	protected:
-		uint m_unitIndex;
+		uint m_unitIndex { 0 };
 		const QMap<QString, double>* m_constants;
 
 		void setParameters(int s);




More information about the scribus-commit mailing list