r23803 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Wed May 13 16:44:13 UTC 2020


Author: jghali
Date: Wed May 13 16:44:13 2020
New Revision: 23803

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

Modified:
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.h
    trunk/Scribus/scribus/ui/newdocdialog.cpp

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23803&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.cpp	Wed May 13 16:44:13 2020
@@ -16,7 +16,6 @@
 	// Set action info in languageChange, so we only have to do
 	// it in one place.
 	languageChange();
-	pictureBrowser = nullptr;
 }
 
 PictureBrowserPlugin::~PictureBrowserPlugin()
@@ -45,7 +44,8 @@
 	//m_actionInfo.keySequence = "CTRL+ALT+F3"
 	// Should the menu item be enabled when the app starts
 	// (even without a document open) ?
-	m_actionInfo.enabledOnStartup = false;
+	m_actionInfo.enabledOnStartup = false;
+	m_actionInfo.needsNumObjects = -1;
 }
 
 QString PictureBrowserPlugin::fullTrName() const
@@ -60,25 +60,22 @@
 	return about;
 }
 
-void PictureBrowserPlugin::deleteAboutData ( const AboutData* about ) const
+void PictureBrowserPlugin::deleteAboutData(const AboutData* about) const
 {
 	Q_ASSERT ( about );
 	delete about;
 }
 
-bool PictureBrowserPlugin::run ( ScribusDoc* doc, const QString& target )
+bool PictureBrowserPlugin::run(ScribusDoc* doc, const QString& target)
 {
 	//picturebrowser isn't running yet, so create it
-	if ( !pictureBrowser )
+	if (!pictureBrowser)
 	{
-		pictureBrowser = new PictureBrowser ( doc, nullptr );
+		pictureBrowser = new PictureBrowser(doc, nullptr);
+		if (!pictureBrowser)
+			return false;
 
-		if ( !pictureBrowser )
-		{
-			return false;
-		}
-
-		connect ( pictureBrowser, SIGNAL ( destroyed() ), this, SLOT ( pictureBrowserClosed() ) );
+		connect(pictureBrowser, SIGNAL (destroyed()), this, SLOT (pictureBrowserClosed()));
 	}
 	//picturebrowser exists, just bring it to the top
 	else
@@ -86,7 +83,7 @@
 		pictureBrowser->hide();
 	}
 
-	Q_CHECK_PTR ( pictureBrowser );
+	Q_CHECK_PTR (pictureBrowser);
 
 	pictureBrowser->setAttribute ( Qt::WA_DeleteOnClose );
 	//show, get on top and activate window
@@ -97,22 +94,22 @@
 	return true;
 }
 
-void PictureBrowserPlugin::setDoc ( ScribusDoc* doc )
+void PictureBrowserPlugin::setDoc(ScribusDoc* doc)
 {
-	if ( pictureBrowser )
-		pictureBrowser->changedDocument ( doc );
+	if (pictureBrowser)
+		pictureBrowser->changedDocument(doc);
 }
 
 void PictureBrowserPlugin::unsetDoc()
 {
-	if ( pictureBrowser )
+	if (pictureBrowser)
 		pictureBrowser->closedDocument();
 }
 
-void PictureBrowserPlugin::changedDoc ( ScribusDoc* doc )
+void PictureBrowserPlugin::changedDoc(ScribusDoc* doc)
 {
-//	if ( pictureBrowser )
-//		pictureBrowser->changedDocument ( doc );
+//	if (pictureBrowser)
+//		pictureBrowser->changedDocument (doc);
 }
 
 void PictureBrowserPlugin::closePictureBrowser()
@@ -144,7 +141,7 @@
 	return plug;
 }
 
-void picturebrowser_freePlugin ( ScPlugin* plugin )
+void picturebrowser_freePlugin(ScPlugin* plugin)
 {
 	PictureBrowserPlugin* plug = dynamic_cast<PictureBrowserPlugin*> ( plugin );
 	Q_ASSERT ( plug );

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23803&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.h	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowserplugin.h	Wed May 13 16:44:13 2020
@@ -39,7 +39,7 @@
 		void closePictureBrowser();
 
 	private:
-		PictureBrowser *pictureBrowser;
+		PictureBrowser *pictureBrowser { nullptr };
 
 	private slots:
 		//only called on auto delete on close, resets ptr

Modified: trunk/Scribus/scribus/ui/newdocdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23803&path=/trunk/Scribus/scribus/ui/newdocdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newdocdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/newdocdialog.cpp	Wed May 13 16:44:13 2020
@@ -88,7 +88,7 @@
 	return QSize(maxX, maxY);
 }
 
-NewDocDialog::NewDocDialog( QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog( parent ),
+NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog(parent),
 	prefsManager(PrefsManager::instance())
 {
 	setObjectName(QString::fromLocal8Bit("NewDocumentWindow"));




More information about the scribus-commit mailing list