r23896 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 20 02:00:07 UTC 2020


Author: jghali
Date: Sat Jun 20 02:00:06 2020
New Revision: 23896

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

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp
    trunk/Scribus/scribus/ui/storyeditor.cpp
    trunk/Scribus/scribus/ui/storyeditor.h

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23896&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Sat Jun 20 02:00:06 2020
@@ -392,13 +392,13 @@
 	appPrefs.extToolPrefs.gs_Resolution = 72;
 
 	appPrefs.storyEditorPrefs.guiFontColorBackground = QColor(Qt::white);
-	appPrefs.storyEditorPrefs.smartTextSelection=false;
-
-	appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = "";
-	appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = "";
-	appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = "";
-	appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = "";
-	appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = "";
+	appPrefs.storyEditorPrefs.smartTextSelection = false;
+
+	appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.clear();
+	appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.clear();
+	appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.clear();
+	appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.clear();
+	appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.clear();
 	appPrefs.colorPrefs.DCMSset.CMSinUse = false;
 	appPrefs.colorPrefs.DCMSset.SoftProofOn = false;
 	appPrefs.colorPrefs.DCMSset.SoftProofFullOn = false;

Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23896&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp	Sat Jun 20 02:00:06 2020
@@ -1588,50 +1588,10 @@
 	charScaleV->setValue(s / 10.0);
 }
 
-/* Main Story Editor Class */
-// StoryEditor::StoryEditor(QWidget* parent, ScribusDoc *docc, PageItem *ite)
-// 	: QMainWindow(parent, "StoryEditor", WType_TopLevel) //  WType_Dialog) //WShowModal |
-// {
-// 	prefsManager=PrefsManager::instance();
-// 	m_doc = docc;
-// 	seMenuMgr=nullptr;
-// 	buildGUI();
-// 	currItem = ite;
-// // 	charSelect = nullptr;
-// 	m_firstSet = false;
-// 	activFromApp = true;
-// 	Editor->loadItemText(ite);
-// 	Editor->getCursorPosition(&m_currPara, &m_currChar);
-// 	EditorBar->setRepaint(true);
-// 	EditorBar->doRepaint();
-// 	updateProps(m_currPara, m_currChar);
-// 	updateStatus();
-// 	m_textChanged = false;
-// 	disconnectSignals();
-// 	connectSignals();
-// 	Editor->setFocus();
-// 	Editor->setColor(false);
-// 	m_blockUpdate = false;
-// 	loadPrefs();
-// 	// hack to keep charPalette visible. See destructor too - PV
-// 	ScCore->primaryMainWindow()->charPalette->reparent(this, QPoint(0, 0));
-// }
-
 /* Main Story Editor Class, no current document */
 StoryEditor::StoryEditor(QWidget* parent) : QMainWindow(parent, Qt::Window), // WType_Dialog) //WShowModal |
-	activFromApp(true),
-	m_doc(nullptr),
-	m_item(nullptr),
-	m_textChanged(false),
-	m_firstSet(false),
-	m_blockUpdate(false),
-//	m_currPara(0),
-//	m_currChar(0),
-	charSelect(nullptr),
-	charSelectUsed(false),
 	prefsManager(PrefsManager::instance())
 {
-	m_spellActive=false;
 #ifdef Q_OS_MAC
 	noIcon = IconManager::instance().loadPixmap("noicon.png");
 #endif
@@ -1678,7 +1638,7 @@
 					this, SLOT(slot_insertSpecialChar()));
 		disconnect(charSelect, SIGNAL(insertUserSpecialChar(QChar, QString)),
 					this, SLOT(slot_insertUserSpecialChar(QChar, QString)));
-		delete charSelect;
+		charSelect->deleteLater();
 		charSelect = nullptr;
 	}
 	savePrefs();
@@ -2318,7 +2278,6 @@
 			if ((m_item != nullptr) && (!m_blockUpdate))
 				updateTextFrame();
 			activFromApp = false;
-	//		Editor->getCursorPosition(&m_currPara, &m_currChar);
 		}
 		if ( ev->type() == QEvent::WindowActivate )
 		{
@@ -2341,7 +2300,6 @@
 					m_textChanged = false;
 					FontTools->Fonts->RebuildList(m_doc, m_item->isAnnotation());
 					Editor->loadItemText(m_item);
-	//				Editor->getCursorPosition(&m_currPara, &m_currChar);
 					updateStatus();
 					m_textChanged = false;
 					//Editor->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
@@ -2940,7 +2898,6 @@
 	if (Do_new())
 	{
 		Editor->loadItemText(m_item);
-//		Editor->getCursorPosition(&m_currPara, &m_currChar);
 		updateStatus();
 		EditorBar->setRepaint(true);
 		EditorBar->doRepaint();

Modified: trunk/Scribus/scribus/ui/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23896&path=/trunk/Scribus/scribus/ui/storyeditor.h
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.h	(original)
+++ trunk/Scribus/scribus/ui/storyeditor.h	Sat Jun 20 02:00:06 2020
@@ -416,9 +416,10 @@
 
 	ScribusDoc* currentDocument() const;
 	PageItem* currentItem() const;
-	SEditor* Editor;
-	bool activFromApp;
-	MenuManager* seMenuMgr;
+
+	SEditor* Editor { nullptr };
+	bool activFromApp { true };
+	MenuManager* seMenuMgr { nullptr };
 	QMap<QString, QPointer<ScrAction> > seActions;
 
 public slots:
@@ -433,7 +434,6 @@
 
 signals:
 	void DocChanged();
-	void EditSt();
 
 private:
 	//int exec();
@@ -442,18 +442,16 @@
 	bool textDataChanged() const;
 
 	/*! \brief Enables/disables the "smart" selection (#1203) - 10/16/2004 pv */
-	bool m_smartSelection;
-
-	ScribusDoc* m_doc;
-	PageItem* m_item;
-
-	bool m_textChanged;
-	bool m_firstSet;
-	bool m_blockUpdate;
-	
-	int m_result;
-//	int m_currPara;
-//	int m_currChar;
+	bool m_smartSelection { false };
+
+	ScribusDoc* m_doc { nullptr };
+	PageItem* m_item { nullptr };
+
+	bool m_textChanged { false };
+	bool m_firstSet { false };
+	bool m_blockUpdate { false };
+	
+	int m_result { QDialog::Rejected };
 
 protected slots:
 	void setBackPref();
@@ -532,9 +530,9 @@
 	charSelect is created as a copy of the charPalette.
 	\author Petr Vanek <petr at scribus.info>
 	*/
-	CharSelect *charSelect;
+	CharSelect *charSelect { nullptr };
     //! True when there were some glyphs inserted via charSelect
-	bool charSelectUsed;
+	bool charSelectUsed { false };
 
 	void showEvent(QShowEvent *);
 	void hideEvent(QHideEvent *);
@@ -543,40 +541,40 @@
 	void keyPressEvent (QKeyEvent * e);
 	bool eventFilter( QObject* ob, QEvent* ev );
 
-	QHBoxLayout* StoryEd2Layout;
-	QGridLayout* ButtonGroup1Layout;
-	QGridLayout* ButtonGroup2Layout;
+	QHBoxLayout* StoryEd2Layout { nullptr };
+	QGridLayout* ButtonGroup1Layout { nullptr };
+	QGridLayout* ButtonGroup2Layout { nullptr };
 
 	PrefsManager& prefsManager;
-	PrefsContext* prefs;
+	PrefsContext* prefs { nullptr };
 
 	QStringList unicodeCharActionNames;
 	QPixmap noIcon;
 
-	QToolBar* FileTools;
-	SToolBFont* FontTools;
-	SToolBAlign* AlignTools;
-	SToolBColorF* FillTools;
-	SToolBColorS* StrokeTools;
-	SToolBStyle* StyleTools;
-	QSplitter* EdSplit;
-	SideBar* EditorBar;
-	QFrame* ButtonGroup1;
-	QFrame* ButtonGroup2;
-	QLabel* WordCT1;
-	QLabel* WordCT3;
-	QLabel* ParCT;
-	QLabel* ParC;
-	QLabel* WordCT;
-	QLabel* WordC;
-	QLabel* CharCT;
-	QLabel* CharC;
-	QLabel* WordCT2;
-	QLabel* WordC2;
-	QLabel* CharCT2;
-	QLabel* CharC2;
-	
-	bool m_spellActive;
+	QToolBar* FileTools { nullptr };
+	SToolBFont* FontTools { nullptr };
+	SToolBAlign* AlignTools { nullptr };
+	SToolBColorF* FillTools { nullptr };
+	SToolBColorS* StrokeTools { nullptr };
+	SToolBStyle* StyleTools { nullptr };
+	QSplitter* EdSplit { nullptr };
+	SideBar* EditorBar { nullptr };
+	QFrame* ButtonGroup1 { nullptr };
+	QFrame* ButtonGroup2 { nullptr };
+	QLabel* WordCT1 { nullptr };
+	QLabel* WordCT3 { nullptr };
+	QLabel* ParCT { nullptr };
+	QLabel* ParC { nullptr };
+	QLabel* WordCT { nullptr };
+	QLabel* WordC { nullptr };
+	QLabel* CharCT { nullptr };
+	QLabel* CharC { nullptr };
+	QLabel* WordCT2 { nullptr };
+	QLabel* WordC2 { nullptr };
+	QLabel* CharCT2 { nullptr };
+	QLabel* CharC2 { nullptr };
+	
+	bool m_spellActive { false };
 };
 
 #endif




More information about the scribus-commit mailing list