src: clazy compiler warnings

get rid of most clazy warnings (https://github.com/KDE/clazy)
* range loop use refs
* qcolor ctor with ints
* missing Q_OBJECT macro
* use .constfirst instead of .first

enabled ccache for unix systems for fasterr recompiling
* if ccache is in path we use it now
This commit is contained in:
Andreas Stallinger
2017-08-10 09:45:55 +02:00
parent bb5c1d49b6
commit 37ead804bf
97 changed files with 339 additions and 344 deletions
@@ -122,7 +122,6 @@ QString QtAutocompletionModel::longestType() const
QtAutocompletionDelegate::QtAutocompletionDelegate(QtAutocompletionModel* model, QObject* parent)
: QStyledItemDelegate(parent)
, m_model(model)
, m_arrow()
{
resetCharSizes();
}
@@ -145,8 +144,10 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
// define highlight colors
ColorScheme* scheme = ColorScheme::getInstance().get();
QColor fillColor("#FFFFFF");
QColor textColor("#000000");
// QColor fillColor("#FFFFFF");
QColor fillColor(0xFF, 0xFF, 0xFF);
// QColor textColor("#000000");
QColor textColor(0, 0, 0);
if (type.size() && type != "command")
{
@@ -169,7 +170,7 @@ void QtAutocompletionDelegate::paint(QPainter* painter, const QStyleOptionViewIt
// draw highlights at indices
QString highlightText(text.size(), ' ');
if (indices.size())
if (!indices.empty())
{
for (int i = 0; i < indices.size(); i++)
{
@@ -42,6 +42,7 @@ private:
class QtAutocompletionDelegate
: public QStyledItemDelegate
{
Q_OBJECT
public:
explicit QtAutocompletionDelegate(QtAutocompletionModel* model, QObject* parent = 0);
virtual ~QtAutocompletionDelegate();
+5 -5
View File
@@ -48,23 +48,23 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
return QObject::eventFilter(obj, event);
}
QtCodeArea::LineNumberArea::LineNumberArea(QtCodeArea *codeArea)
QtLineNumberArea::QtLineNumberArea(QtCodeArea *codeArea)
: QWidget(codeArea)
, m_codeArea(codeArea)
{
setObjectName("line_number_area");
}
QtCodeArea::LineNumberArea::~LineNumberArea()
QtLineNumberArea::~QtLineNumberArea()
{
}
QSize QtCodeArea::LineNumberArea::sizeHint() const
QSize QtLineNumberArea::sizeHint() const
{
return QSize(m_codeArea->lineNumberAreaWidth(), 0);
}
void QtCodeArea::LineNumberArea::paintEvent(QPaintEvent *event)
void QtLineNumberArea::paintEvent(QPaintEvent *event)
{
m_codeArea->lineNumberAreaPaintEvent(event);
}
@@ -90,7 +90,7 @@ QtCodeArea::QtCodeArea(
{
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
m_lineNumberArea = new LineNumberArea(this);
m_lineNumberArea = new QtLineNumberArea(this);
m_digits = lineNumberDigits();
updateLineNumberAreaWidth();
+18 -15
View File
@@ -13,6 +13,7 @@ class QResizeEvent;
class QSize;
class QtCodeNavigator;
class QWidget;
class QtCodeArea;
class MouseWheelOverScrollbarFilter
: public QObject
@@ -26,6 +27,23 @@ protected:
bool eventFilter(QObject* obj, QEvent* event);
};
class QtLineNumberArea
: public QWidget
{
Q_OBJECT
public:
QtLineNumberArea(QtCodeArea* codeArea);
virtual ~QtLineNumberArea();
QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
private:
QtCodeArea* m_codeArea;
};
class QtCodeArea
: public QtCodeField
@@ -33,21 +51,6 @@ class QtCodeArea
Q_OBJECT
public:
class LineNumberArea
: public QWidget
{
public:
LineNumberArea(QtCodeArea* codeArea);
virtual ~LineNumberArea();
QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE;
private:
QtCodeArea* m_codeArea;
};
QtCodeArea(
uint startLineNumber,
+16 -13
View File
@@ -62,7 +62,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
m_minimizeButton = new QtIconStateButton(this);
m_minimizeButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_active.png").c_str());
m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), "#5E5D5D");
// m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), "#5E5D5D");
m_minimizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
m_minimizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/minimize_inactive.png").c_str());
m_minimizeButton->setObjectName("file_button");
m_minimizeButton->setToolTip("minimize");
@@ -70,7 +71,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
m_snippetButton = new QtIconStateButton(this);
m_snippetButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_active.png").c_str());
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), "#5E5D5D");
// m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), "#5E5D5D");
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
m_snippetButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/snippet_inactive.png").c_str());
m_snippetButton->setObjectName("file_button");
m_snippetButton->setToolTip("show snippets");
@@ -78,7 +80,8 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator)
m_maximizeButton = new QtIconStateButton(this);
m_maximizeButton->addState(QtIconStateButton::STATE_DEFAULT, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_active.png").c_str());
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), "#5E5D5D");
// m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), "#5E5D5D");
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str(), QColor(0x5E, 0x5D, 0x5D));
m_maximizeButton->addState(QtIconStateButton::STATE_DISABLED, (ResourcePaths::getGuiPath().str() + "code_view/images/maximize_inactive.png").c_str());
m_maximizeButton->setObjectName("file_button");
m_maximizeButton->setToolTip("maximize");
@@ -131,7 +134,7 @@ std::string QtCodeFile::getFileName() const
QtCodeSnippet* QtCodeFile::addCodeSnippet(const CodeSnippetParams& params)
{
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet->getStartLineNumber() == params.startLineNumber &&
snippet->getEndLineNumber() == params.endLineNumber)
@@ -226,7 +229,7 @@ QtCodeSnippet* QtCodeFile::insertCodeSnippet(const CodeSnippetParams& params)
QtCodeSnippet* QtCodeFile::getSnippetForLocationId(Id locationId) const
{
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet->getLineNumberForLocationId(locationId))
{
@@ -244,7 +247,7 @@ QtCodeSnippet* QtCodeFile::getSnippetForLine(unsigned int line) const
return m_fileSnippet.get();
}
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet->getStartLineNumber() <= line && line <= snippet->getEndLineNumber())
{
@@ -264,7 +267,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFile::getFirstSnippetWithActiveLocationId(Id
{
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
Id locationId = snippet->getFirstActiveLocationId(tokenId);
if (locationId != 0)
@@ -303,7 +306,7 @@ void QtCodeFile::updateContent()
{
updateSnippets();
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
snippet->updateContent();
}
@@ -329,7 +332,7 @@ void QtCodeFile::setIsComplete(bool isComplete)
void QtCodeFile::setMinimized()
{
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
snippet->hide();
}
@@ -352,7 +355,7 @@ void QtCodeFile::setMinimized()
void QtCodeFile::setSnippets()
{
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
snippet->show();
}
@@ -375,7 +378,7 @@ void QtCodeFile::setSnippets()
void QtCodeFile::setMaximized()
{
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
snippet->hide();
}
@@ -409,7 +412,7 @@ void QtCodeFile::updateSnippets()
}
int maxDigits = 1;
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet != m_snippets.front() && snippet->styleSheet().size())
{
@@ -419,7 +422,7 @@ void QtCodeFile::updateSnippets()
maxDigits = qMax(maxDigits, snippet->lineNumberDigits());
}
for (std::shared_ptr<QtCodeSnippet> snippet : m_snippets)
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
snippet->updateLineNumberAreaWidthForDigits(maxDigits);
}
+5 -5
View File
@@ -47,7 +47,7 @@ QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
{
QtCodeFile* file = nullptr;
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
{
if (filePtr->getFilePath() == filePath)
{
@@ -177,7 +177,7 @@ bool QtCodeFileList::requestScroll(const FilePath& filePath, uint lineNumber, Id
void QtCodeFileList::updateFiles()
{
for (std::shared_ptr<QtCodeFile> file : m_files)
for (const std::shared_ptr<QtCodeFile>& file : m_files)
{
file->updateContent();
}
@@ -185,7 +185,7 @@ void QtCodeFileList::updateFiles()
void QtCodeFileList::showContents()
{
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
{
filePtr->show();
}
@@ -193,7 +193,7 @@ void QtCodeFileList::showContents()
void QtCodeFileList::onWindowFocus()
{
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
{
filePtr->updateTitleBar();
}
@@ -218,7 +218,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFileList::getFirstSnippetWithActiveLocationI
{
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
for (std::shared_ptr<QtCodeFile> filePtr : m_files)
for (const std::shared_ptr<QtCodeFile>& filePtr : m_files)
{
if (filePtr->isCollapsed())
{
@@ -228,7 +228,6 @@ bool QtDirectoryListBox::event(QEvent* event)
void QtDirectoryListBox::dropEvent(QDropEvent *event)
{
QFileInfo fileInfo;
foreach(QUrl url, event->mimeData()->urls())
{
QtListItemWidget* widget = addListBoxItem();
+1
View File
@@ -24,6 +24,7 @@ protected:
class QtIconButton
: public QPushButton
{
Q_OBJECT
public:
QtIconButton(QString iconPath, QString hoveredIconPath, QWidget* parent = nullptr);
+2 -2
View File
@@ -862,7 +862,7 @@ void QtSmartSearchBox::layoutElements()
bool QtSmartSearchBox::hasSelectedElements() const
{
for (const std::shared_ptr<QtSearchElement> element : m_elements)
for (const std::shared_ptr<QtSearchElement>& element : m_elements)
{
if (element->isChecked())
{
@@ -887,7 +887,7 @@ std::string QtSmartSearchBox::getSelectedString() const
void QtSmartSearchBox::selectAllElementsWith(bool selected)
{
for (const std::shared_ptr<QtSearchElement> element : m_elements)
for (const std::shared_ptr<QtSearchElement>& element : m_elements)
{
element->setChecked(selected);
}
+2 -1
View File
@@ -41,7 +41,8 @@ QtStatusBar::QtStatusBar()
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
m_errorButton.setIcon(utility::colorizePixmap(
QPixmap((ResourcePaths::getGuiPath().str() + "statusbar_view/dot.png").c_str()),
"#D00000"
// "#D00000"
QColor(0xD0, 0, 0)
).scaledToHeight(12));
addPermanentWidget(&m_errorButton);
+1
View File
@@ -131,3 +131,4 @@ void QtTable::resizeEvent(QResizeEvent* event)
updateRows();
}
+1 -1
View File
@@ -37,7 +37,7 @@ void QtTooltip::setTooltipInfo(TooltipInfo info)
addTitle(info.title.c_str(), info.count, info.countText.c_str());
}
for (TooltipSnippet snippet : info.snippets)
for (TooltipSnippet& snippet : info.snippets)
{
QtCodeField* field = new QtCodeField(1, snippet.code, snippet.locationFile);
+1 -1
View File
@@ -434,7 +434,7 @@ QString ShowSaveFileDialog(QWidget *parent,
if (dialog.exec() == QDialog::Accepted)
{
QString file_name = dialog.selectedFiles().first();
QString file_name = dialog.selectedFiles().constFirst();
QFileInfo info(file_name);
if (info.suffix().isEmpty() && !dialog.selectedNameFilter().isEmpty())
+3
View File
@@ -26,6 +26,9 @@ void QtRequest::finished(QNetworkReply *reply)
QVariant statusCodeV = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
QVariant redirectionTargetUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
Q_UNUSED(statusCodeV);
Q_UNUSED(redirectionTargetUrl);
if (reply->error() != QNetworkReply::NoError)
{
LOG_ERROR_STREAM(<< "An error occured during http request. ERRORCODE: " << reply->error());
-2
View File
@@ -16,8 +16,6 @@ QtTcpWrapper::QtTcpWrapper(QObject* parent, const std::string& ip, const quint16
void QtTcpWrapper::startListening()
{
QHostAddress address(m_ip.c_str());
if (!m_tcpServer->listen(QHostAddress::LocalHost, m_serverPort))
{
LOG_ERROR_STREAM(<< "TCP server failed to start with error: \"" + m_tcpServer->errorString().toStdString() + "\". Unable to listen for IDE plugin messages.");
+1 -1
View File
@@ -33,7 +33,7 @@ public:
{
m_freeCallbacks.acquire();
m_callback = callback;
signalExecution();
emit signalExecution();
}
private:
+1 -1
View File
@@ -59,7 +59,7 @@ namespace utility
for (int loadedFontId: loadedFontIds)
{
for (QString family: QFontDatabase::applicationFontFamilies(loadedFontId))
for (QString& family: QFontDatabase::applicationFontFamilies(loadedFontId))
{
LOG_INFO("Loaded FontFamily: " + family.toStdString());
}
-10
View File
@@ -179,16 +179,6 @@ void QtDialogView::finishedIndexingDialog(
size_t indexedFileCount, size_t totalIndexedFileCount, size_t completedFileCount, size_t totalFileCount,
float time, ErrorCountInfo errorInfo, bool interrupted)
{
std::stringstream ss;
ss << "Finished indexing: ";
ss << indexedFileCount << "/" << totalIndexedFileCount << " source files indexed; ";
ss << utility::timeToString(time);
ss << "; " << errorInfo.total << " error" << (errorInfo.total != 1 ? "s" : "");
if (errorInfo.fatal > 0)
{
ss << " (" << errorInfo.fatal << " fatal)";
}
MessageStatus(ss.str(), false, false).dispatch();
m_onQtThread(
[=]()
+1
View File
@@ -352,3 +352,4 @@ bool QtErrorView::isShownError(const ErrorInfo& error)
}
return false;
}
+8 -8
View File
@@ -206,13 +206,13 @@ void QtGraphView::activateEdge(Id edgeId, bool centerOrigin)
m_onQtThread(
[=]()
{
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
{
edge->setIsActive(false);
edge->setIsFocused(false);
}
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
{
if (edge->getData() && edge->getData()->getId() == edgeId)
{
@@ -264,7 +264,7 @@ void QtGraphView::finishedTransition()
void QtGraphView::clickedInEmptySpace()
{
std::vector<std::shared_ptr<QtGraphEdge>> activeEdges;
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
for (std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
{
if (edge->getIsActive())
{
@@ -276,7 +276,7 @@ void QtGraphView::clickedInEmptySpace()
if (m_graph && m_graph->getTrailMode() != Graph::TRAIL_NONE)
{
for (std::shared_ptr<QtGraphEdge> edge : activeEdges)
for (std::shared_ptr<QtGraphEdge>& edge : activeEdges)
{
edge->setIsActive(false);
}
@@ -639,14 +639,14 @@ void QtGraphView::doRebuildGraph(
// create edges
Graph::TrailMode trailMode = m_graph ? m_graph->getTrailMode() : Graph::TRAIL_NONE;
std::set<Id> visibleEdgeIds;
for (const std::shared_ptr<DummyEdge> edge : edges)
for (const std::shared_ptr<DummyEdge>& edge : edges)
{
if (!edge->data || !edge->data->isType(Edge::EDGE_AGGREGATION))
{
createEdge(view, edge.get(), &visibleEdgeIds, trailMode, offset, params.bezierEdges);
}
}
for (const std::shared_ptr<DummyEdge> edge : edges)
for (const std::shared_ptr<DummyEdge>& edge : edges)
{
if (edge->data && edge->data->isType(Edge::EDGE_AGGREGATION))
{
@@ -1025,7 +1025,7 @@ void QtGraphView::createTransition()
vanish->addAnimation(anim);
}
for (std::shared_ptr<QtGraphEdge> edge : m_oldEdges)
for (const std::shared_ptr<QtGraphEdge>& edge : m_oldEdges)
{
QPropertyAnimation* anim = new QPropertyAnimation(edge.get(), "opacity");
anim->setDuration(150);
@@ -1105,7 +1105,7 @@ void QtGraphView::createTransition()
node->blendOut();
}
for (std::shared_ptr<QtGraphEdge> edge : m_edges)
for (const std::shared_ptr<QtGraphEdge>& edge : m_edges)
{
QPropertyAnimation* anim = new QPropertyAnimation(edge.get(), "opacity");
anim->setDuration(150);
+2 -2
View File
@@ -249,7 +249,7 @@ void QtLogView::updateTable()
m_model->removeRows(0, m_model->rowCount());
}
for ( Log log : m_logs )
for ( Log& log : m_logs )
{
if (log.type & m_logLevel)
{
@@ -298,7 +298,7 @@ void QtLogView::doAddLog(Logger::LogLevel type, const LogMessage& message)
void QtLogView::doAddLogs(const std::vector<Log>& logs)
{
doClear();
for(Log log : logs)
for(const Log& log : logs)
{
if( log.type & m_logLevel )
{
+3 -2
View File
@@ -14,9 +14,10 @@ class QStandardItemModel;
class QtTable;
class QtLogView
: public LogView
, public QWidget
: public QWidget
, public LogView
{
Q_OBJECT
public:
QtLogView(ViewLayout* viewLayout);
virtual ~QtLogView();
+1 -1
View File
@@ -139,7 +139,7 @@ void QtStatusView::doRefreshView()
void QtStatusView::doAddStatus(const std::vector<Status>& status)
{
for (Status s : status)
for (const Status& s : status)
{
const int rowNumber = m_table->getFilledRowCount();
if (rowNumber < m_model->rowCount())
+3 -2
View File
@@ -12,9 +12,10 @@ class QStandardItemModel;
class QtTable;
class QtStatusView
: public StatusView
, public QWidget
: public QWidget
, public StatusView
{
Q_OBJECT
public:
QtStatusView(ViewLayout* viewLayout);
virtual ~QtStatusView();
@@ -8,6 +8,7 @@
class QtGraphNodeAccess
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeAccess(AccessKind accessKind);
virtual ~QtGraphNodeAccess();
@@ -9,6 +9,7 @@ class QtCountCircleItem;
class QtGraphNodeBundle
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeBundle(Id tokenId, size_t nodeCount, Node::NodeType type, std::string name);
virtual ~QtGraphNodeBundle();
@@ -8,6 +8,7 @@ class FilePath;
class QtGraphNodeData
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeData(const Node* data, const std::string& name, bool hasParent, bool childVisible, bool hasQualifier);
virtual ~QtGraphNodeData();
@@ -8,6 +8,7 @@
class QtGraphNodeExpandToggle
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeExpandToggle(bool expanded, int invisibleSubNodeCount);
virtual ~QtGraphNodeExpandToggle();
@@ -9,6 +9,7 @@
class QtGraphNodeQualifier
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeQualifier(const NameHierarchy& name);
virtual ~QtGraphNodeQualifier();
@@ -6,6 +6,7 @@
class QtGraphNodeText
: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeText(const std::string& name);
virtual ~QtGraphNodeText();
+1
View File
@@ -6,6 +6,7 @@
class QtAboutLicense
: public QtWindow
{
Q_OBJECT
public:
QtAboutLicense(QWidget* parent = 0);
QSize sizeHint() const override;
+3 -3
View File
@@ -132,17 +132,17 @@ void QtBookmarkBrowser::setBookmarks(const std::vector<std::shared_ptr<Bookmark>
m_bookmarkTree->clear();
std::map<std::string, BookmarkCategory> categoryNamesOrdered;
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
for (const std::shared_ptr<Bookmark>& bookmark : bookmarks)
{
categoryNamesOrdered.emplace(bookmark->getCategory().getName(), bookmark->getCategory());
}
for (auto p : categoryNamesOrdered)
for (const auto& p : categoryNamesOrdered)
{
findOrCreateTreeCategory(p.second);
}
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
for (const std::shared_ptr<Bookmark>& bookmark : bookmarks)
{
QtBookmark* qtBookmark = new QtBookmark();
qtBookmark->setBookmark(bookmark);
+1
View File
@@ -6,6 +6,7 @@
class QtEulaWindow
: public QtWindow
{
Q_OBJECT
public:
static const int EULA_VERSION = 2;
@@ -9,6 +9,7 @@
class QtShortcutTable
: public QTableWidget
{
Q_OBJECT
public:
QtShortcutTable(QWidget* parent = nullptr);
void updateSize();
@@ -32,7 +32,7 @@ void QtSelectPathsDialog::setPathsList(const std::vector<FilePath>& paths, const
{
std::set<FilePath> checked(checkedPaths.begin(), checkedPaths.end());
for (FilePath s : paths)
for (const FilePath& s : paths)
{
QListWidgetItem* item = new QListWidgetItem(s.str().c_str(), m_list);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
@@ -61,7 +61,7 @@ void QtSelectPathsDialog::setPathsList(const std::vector<FilePath>& paths, const
void QtSelectPathsDialog::checkSelected(bool checked)
{
for(QListWidgetItem* item : m_list->selectedItems())
for (QListWidgetItem* item : m_list->selectedItems())
{
item->setCheckState( (checked ? Qt::Checked : Qt::Unchecked) );
}
@@ -9,6 +9,7 @@ class QListWidget;
class QtSelectPathsDialog
: public QtTextEditDialog
{
Q_OBJECT
public:
QtSelectPathsDialog(const QString& title, const QString& description, QWidget* parent = 0);
+1
View File
@@ -95,3 +95,4 @@ void QtSplashScreen::drawContents(QPainter *painter)
painter->drawText(r, Qt::AlignLeft, m_string);
}
+1
View File
@@ -8,6 +8,7 @@
class QtWindowStackElement
: public QWidget
{
Q_OBJECT
public:
QtWindowStackElement(QWidget* parent = nullptr);
@@ -252,7 +252,7 @@ bool QtProjectWizzard::applicationSettingsContainVisualStudioHeaderSearchPaths()
{
std::vector<FilePath> expandedPaths;
const std::shared_ptr<CombinedPathDetector> headerPathDetector = utility::getCxxVsHeaderPathDetector();
for (const std::string& detectorName: headerPathDetector->getWorkingDetectorNames())
for (const std::string& detectorName : headerPathDetector->getWorkingDetectorNames())
{
for (const FilePath& path: headerPathDetector->getPaths(detectorName))
{
@@ -319,7 +319,7 @@ void QtProjectWizzard::updateSourceGroupList()
{
m_sourceGroupList->clear();
for (const std::shared_ptr<SourceGroupSettings> group : m_allSourceGroupSettings)
for (const std::shared_ptr<SourceGroupSettings>& group : m_allSourceGroupSettings)
{
QListWidgetItem *item = new QListWidgetItem(QString::fromStdString(group->getName()));
m_sourceGroupList->addItem(item);
@@ -44,10 +44,10 @@ void QtProjectWizzardContentCDBSource::load()
std::vector<FilePath> filePaths =
IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath);
for (FilePath path : filePaths)
for (FilePath& path : filePaths)
{
bool excluded = false;
for (FilePath p : excludePaths)
for (const FilePath& p : excludePaths)
{
if (p == path || p.contains(path))
{
@@ -66,6 +66,7 @@ private slots:
class QtProjectWizzardContentPathSourceMaven
: public QtProjectWizzardContentPath
{
Q_OBJECT
public:
QtProjectWizzardContentPathSourceMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
@@ -85,6 +86,7 @@ private:
class QtProjectWizzardContentPathDependenciesMaven
: public QtProjectWizzardContentPath
{
Q_OBJECT
public:
QtProjectWizzardContentPathDependenciesMaven(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
@@ -56,6 +56,7 @@ private:
class QtProjectWizzardContentPathsSource
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsSource(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
@@ -89,6 +90,7 @@ private slots:
class QtProjectWizzardContentPathsExclude
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsExclude(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
@@ -101,7 +103,6 @@ class QtProjectWizzardContentPathsHeaderSearch
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsHeaderSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
@@ -123,6 +124,7 @@ private:
class QtProjectWizzardContentPathsHeaderSearchGlobal
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsHeaderSearchGlobal(QtProjectWizzardWindow* window);
@@ -135,6 +137,7 @@ public:
class QtProjectWizzardContentPathsFrameworkSearch
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsFrameworkSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window, bool isCDB = false);
@@ -149,6 +152,7 @@ public:
class QtProjectWizzardContentPathsFrameworkSearchGlobal
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsFrameworkSearchGlobal(QtProjectWizzardWindow* window);
@@ -160,6 +164,7 @@ public:
class QtProjectWizzardContentPathsClassJava
: public QtProjectWizzardContentPaths
{
Q_OBJECT
public:
QtProjectWizzardContentPathsClassJava(std::shared_ptr<SourceGroupSettings> settings, QtProjectWizzardWindow* window);
@@ -61,7 +61,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
vlayout->setSpacing(10);
m_languages = new QButtonGroup();
for (auto it: sourceGroupInfos)
for (auto& it: sourceGroupInfos)
{
QPushButton* b = new QPushButton(languageTypeToString(it.first).c_str(), this);
b->setObjectName("menuButton");
@@ -85,10 +85,10 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
selectedLanguage = LanguageType(languageTypeInt);
}
for (auto it: m_buttons)
for (auto& it: m_buttons)
{
it.second->setExclusive(false);
for (QAbstractButton* button: it.second->buttons())
for (QAbstractButton* button : it.second->buttons())
{
button->setChecked(false);
button->setVisible(it.first == selectedLanguage);
@@ -104,11 +104,11 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
QHBoxLayout* hlayout = new QHBoxLayout();
for (auto languageIt: sourceGroupInfos)
for (auto& languageIt: sourceGroupInfos)
{
QButtonGroup* sourceGroupButtons = new QButtonGroup(this);
for (auto sourceGroupIt: languageIt.second)
for (auto& sourceGroupIt: languageIt.second)
{
QToolButton* b = createSourceGroupButton(
utility::insertLineBreaksAtBlankSpaces(sourceGroupTypeToProjectSetupString(sourceGroupIt.type), 15).c_str(),
@@ -122,7 +122,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
m_buttons[languageIt.first] = sourceGroupButtons;
}
for (auto it: m_buttons)
for (auto& it: m_buttons)
{
connect(it.second, static_cast<void(QButtonGroup::*)(QAbstractButton*)>(&QButtonGroup::buttonClicked),
[this](QAbstractButton* button)
@@ -166,14 +166,14 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 1);
layout->setHorizontalSpacing(0);
m_languages->buttons().first()->click();
m_languages->buttons().constFirst()->click();
}
void QtProjectWizzardContentSelect::save()
{
SourceGroupType selectedType;
for (auto it: m_buttons)
for (auto& it: m_buttons)
{
if (QAbstractButton* b = it.second->checkedButton())
{
@@ -193,7 +193,7 @@ bool QtProjectWizzardContentSelect::check()
{
bool sourceGroupChosen = false;
for (auto it: m_buttons)
for (auto& it: m_buttons)
{
if (it.second->checkedId() != -1)
{
@@ -19,7 +19,7 @@ void CombinedPathDetector::addDetector(std::shared_ptr<PathDetector> detector)
std::vector<std::string> CombinedPathDetector::getWorkingDetectorNames()
{
std::vector<std::string> names;
for (std::shared_ptr<PathDetector> detector: m_detectors)
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
{
if (detector->isWorking())
{
@@ -31,7 +31,7 @@ std::vector<std::string> CombinedPathDetector::getWorkingDetectorNames()
std::vector<FilePath> CombinedPathDetector::getPaths() const
{
for (std::shared_ptr<PathDetector> detector: m_detectors)
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
{
std::vector<FilePath> detectedPaths = detector->getPaths();
if (!detectedPaths.empty())
@@ -44,7 +44,7 @@ std::vector<FilePath> CombinedPathDetector::getPaths() const
std::vector<FilePath> CombinedPathDetector::getPaths(std::string detectorName) const
{
for (std::shared_ptr<PathDetector> detector: m_detectors)
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
{
if (detector->getName() == detectorName)
{
@@ -15,7 +15,7 @@ namespace utility
if (!standardHeaders.empty())
{
for (std::string s : utility::splitToVector(standardHeaders, '\n'))
for (const std::string& s : utility::splitToVector(standardHeaders, '\n'))
{
paths.push_back(utility::trim(s));
}
@@ -5,12 +5,11 @@
#include "utility/utilityString.h"
#ifdef __x86_64__
const std::string arch = "amd64";
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/amd64/server/libjvm.so";
#else
const std::string arch = "i386";
const char jvmLibPathRelativeToJavaExecutable[] = "/../lib/i386/server/libjvm.so";
#endif
const std::string jvmLibPathRelativeToJavaExecutable = "/../lib/" + arch + "/server/libjvm.so";
JavaPathDetectorLinux::JavaPathDetectorLinux(const std::string javaVersion)
: JavaPathDetector("Java " + javaVersion + " for Linux", javaVersion)
@@ -109,7 +108,7 @@ std::vector<FilePath> JavaPathDetectorLinux::getPaths() const
paths.push_back(FilePath("/usr/lib/jvm/default/bin/java"));
paths.push_back(FilePath("/usr/lib/jvm/java-openjdk/bin/java"));
for ( FilePath path : paths )
for (const FilePath& path : paths )
{
if (checkVersion(path))
{