r24681 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 11 15:31:21 UTC 2021


Author: jghali
Date: Sun Jul 11 15:31:21 2021
New Revision: 24681

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

Modified:
    trunk/Scribus/scribus/ui/helpbrowser.cpp

Modified: trunk/Scribus/scribus/ui/helpbrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24681&path=/trunk/Scribus/scribus/ui/helpbrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/helpbrowser.cpp	(original)
+++ trunk/Scribus/scribus/ui/helpbrowser.cpp	Sun Jul 11 15:31:21 2021
@@ -235,7 +235,7 @@
 		stream.setCodec("UTF-8");
 		stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 		stream << "<history>\n";
-		for (QMap<QAction*,histd2>::Iterator it = m_history.begin() ; it != m_history.end(); ++it)
+		for (auto it = m_history.cbegin() ; it != m_history.cend(); ++it)
 			stream << "\t<item title=\"" << it.value().title << "\" url=\"" << it.value().url << "\" />\n";
 		stream << "</history>\n";
 		histFile.close();
@@ -249,7 +249,9 @@
 
 void HelpBrowser::setupLocalUI()
 {
-	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
+	IconManager& iconManager = IconManager::instance();
+
+	setWindowIcon(iconManager.loadIcon("AppIcon.png"));
 	//Add Menus
 	fileMenu = menuBar()->addMenu("");
 	editMenu = menuBar()->addMenu("");
@@ -257,10 +259,10 @@
 	histMenu = new QMenu(this);
 
 	//Add Menu items
-	filePrint = fileMenu->addAction(IconManager::instance().loadIcon("16/document-print.png"), "", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
+	filePrint = fileMenu->addAction(iconManager.loadIcon("16/document-print.png"), "", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
 	fileMenu->addSeparator();
-	fileExit = fileMenu->addAction(IconManager::instance().loadIcon("exit.png"), "", this, SLOT(close()), Qt::CTRL+Qt::Key_W);
-	editFind = editMenu->addAction(IconManager::instance().loadIcon("find.png"), "", this, SLOT(find()), Qt::CTRL+Qt::Key_F);
+	fileExit = fileMenu->addAction(iconManager.loadIcon("exit.png"), "", this, SLOT(close()), Qt::CTRL+Qt::Key_W);
+	editFind = editMenu->addAction(iconManager.loadIcon("find.png"), "", this, SLOT(find()), Qt::CTRL+Qt::Key_F);
 	editFindNext = editMenu->addAction( "", this, SLOT(findNext()), Qt::Key_F3);
 	editFindPrev = editMenu->addAction( "", this, SLOT(findPrevious()), Qt::SHIFT+Qt::Key_F3);
 	bookAdd = bookMenu->addAction( "", this, SLOT(bookmarkButton_clicked()), Qt::CTRL+Qt::Key_D);
@@ -268,9 +270,9 @@
 	bookDelAll = bookMenu->addAction( "", this, SLOT(deleteAllBookmarkButton_clicked()));
 
 	//Add Toolbar items
-	goHome = toolBar->addAction(IconManager::instance().loadIcon("16/go-home.png"), "", textBrowser, SLOT(home()));
-	goBack = toolBar->addAction(IconManager::instance().loadIcon("16/go-previous.png"), "", textBrowser, SLOT(backward()));
-	goFwd = toolBar->addAction(IconManager::instance().loadIcon("16/go-next.png"), "", textBrowser, SLOT(forward()));
+	goHome = toolBar->addAction(iconManager.loadIcon("16/go-home.png"), "", textBrowser, SLOT(home()));
+	goBack = toolBar->addAction(iconManager.loadIcon("16/go-previous.png"), "", textBrowser, SLOT(backward()));
+	goFwd = toolBar->addAction(iconManager.loadIcon("16/go-next.png"), "", textBrowser, SLOT(forward()));
 	goBack->setMenu(histMenu);
 	
 	helpNav->listView->header()->hide();
@@ -389,8 +391,8 @@
 	QDir dir(QDir::toNativeSeparators(aDir + "/"));
 	QStringList in;
 	in.append("*.html");
-	QStringList lst = dir.entryList(in);
-	for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it)
+	QStringList dirEntries = dir.entryList(in);
+	for (auto it = dirEntries.cbegin(); it != dirEntries.cend(); ++it)
 	{
 		QString fname(aDir + "/" + (*it));
 		QFile f(fname);
@@ -417,9 +419,12 @@
 	in.clear();
 	in.append("*");
 	QStringList dst = dir.entryList(in, QDir::Dirs);
-	for (QStringList::Iterator it = dst.begin(); it != dst.end(); ++it)
-		if ((*it)!="." && (*it)!="..")
-			searchingInDirectory(QDir::toNativeSeparators(aDir + QString((*it)) + "/"));
+	for (auto it = dst.cbegin(); it != dst.cend(); ++it)
+	{
+		if ((*it) == "." || (*it) == "..")
+			continue;
+		searchingInDirectory(QDir::toNativeSeparators(aDir + QString((*it)) + "/"));
+	}
 }
 
 void HelpBrowser::find()
@@ -635,7 +640,8 @@
 	QFileInfo baseFi = QFileInfo(toLoad);
 	m_finalBaseDir = baseFi.path();
 	QStringList searchPaths;
-	searchPaths << m_finalBaseDir << m_defaultBaseDir;
+	searchPaths << m_finalBaseDir;
+	searchPaths << m_defaultBaseDir;
 	textBrowser->setSearchPaths(searchPaths);
 
 	delete m_menuModel;




More information about the scribus-commit mailing list