perf: Fix more clazy qstring-allocation warnings and pass parameters by reference (#910)

* Fix some more clazy-qstring-allocation warnings

* Fix missing refs on large types in lib_gui

* Fix trivially copyable types being passed by ref in lib_gui
This commit is contained in:
Waqar Ahmed
2020-02-12 22:13:36 +01:00
committed by GitHub
parent 71ef2f31a1
commit 222e3d578a
103 changed files with 522 additions and 414 deletions
+6 -6
View File
@@ -55,16 +55,16 @@ public:
virtual void clear() = 0;
virtual void showSnippets(
const std::vector<CodeFileParams> files,
const CodeParams params,
const CodeScrollParams scrollParams) = 0;
const std::vector<CodeFileParams>& files,
const CodeParams& params,
const CodeScrollParams& scrollParams) = 0;
virtual void showSingleFile(
const CodeFileParams file, const CodeParams params, const CodeScrollParams scrollParams) = 0;
const CodeFileParams& file, const CodeParams& params, const CodeScrollParams& scrollParams) = 0;
virtual void updateSourceLocations(const std::vector<CodeFileParams> files) = 0;
virtual void updateSourceLocations(const std::vector<CodeFileParams>& files) = 0;
virtual void scrollTo(const CodeScrollParams params, bool animated) = 0;
virtual void scrollTo(const CodeScrollParams& params, bool animated) = 0;
virtual bool showsErrors() const = 0;
+2 -2
View File
@@ -17,11 +17,11 @@ public:
virtual void clear() = 0;
virtual void openTab(bool showTab, SearchMatch match) = 0;
virtual void openTab(bool showTab, const SearchMatch& match) = 0;
virtual void closeTab() = 0;
virtual void destroyTab(Id tabId) = 0;
virtual void selectTab(bool next) = 0;
virtual void updateTab(Id tabId, std::vector<SearchMatch> matches) = 0;
virtual void updateTab(Id tabId, const std::vector<SearchMatch>& matches) = 0;
};
#endif // TABS_VIEW_H
+1 -1
View File
@@ -17,7 +17,7 @@ public:
// View implementation
virtual std::string getName() const;
virtual void showTooltip(TooltipInfo info, const View* parent) = 0;
virtual void showTooltip(const TooltipInfo& info, const View* parent) = 0;
virtual void hideTooltip(bool force) = 0;
virtual bool tooltipVisible() const = 0;
+14 -10
View File
@@ -51,7 +51,7 @@ QtStatusBar::QtStatusBar(): m_text(this), m_ideStatusText(this)
m_errorButton.setFlat(true);
m_errorButton.setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_errorButton.setStyleSheet(
"QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
QStringLiteral("QPushButton { color: #D00000; margin-right: 0; spacing: none; }"));
m_errorButton.setIcon(
utility::colorizePixmap(
QPixmap(QString::fromStdWString(
@@ -72,7 +72,8 @@ QtStatusBar::QtStatusBar(): m_text(this), m_ideStatusText(this)
m_indexingStatus = new QPushButton(this);
m_indexingStatus->setFlat(true);
m_indexingStatus->setMinimumWidth(150);
m_indexingStatus->setStyleSheet("QPushButton { margin-right: 0; spacing: none; }");
m_indexingStatus->setStyleSheet(
QStringLiteral("QPushButton { margin-right: 0; spacing: none; }"));
m_indexingStatus->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_indexingStatus->setCursor(Qt::PointingHandCursor);
@@ -81,7 +82,7 @@ QtStatusBar::QtStatusBar(): m_text(this), m_ideStatusText(this)
QHBoxLayout* layout = new QHBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(new QLabel("Indexing:"));
layout->addWidget(new QLabel(QStringLiteral("Indexing:")));
m_indexingProgress = new QProgressBar();
m_indexingProgress->setMinimum(0);
@@ -100,12 +101,13 @@ void QtStatusBar::setText(const std::wstring& text, bool isError, bool showLoade
{
if (isError)
{
m_text.setStyleSheet(
"QPushButton { color: #D00000; margin-right: 0; spacing: none; text-align: left; }");
m_text.setStyleSheet(QStringLiteral(
"QPushButton { color: #D00000; margin-right: 0; spacing: none; text-align: left; }"));
}
else
{
m_text.setStyleSheet("QPushButton { margin-right: 0; spacing: none; text-align: left; }");
m_text.setStyleSheet(
QStringLiteral("QPushButton { margin-right: 0; spacing: none; text-align: left; }"));
}
if (showLoader)
@@ -128,7 +130,8 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
{
m_errorButton.setText(
QString::number(errorCount.total) + " error" + (errorCount.total > 1 ? "s" : "") +
(errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)" : ""));
(errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)"
: QLatin1String("")));
m_errorButton.setMinimumWidth(
m_errorButton.fontMetrics().width(QString(m_errorButton.text().size(), 'a')));
@@ -136,11 +139,12 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
if (errorCount.fatal > 0)
{
m_errorButton.setStyleSheet(
"QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
QStringLiteral("QPushButton { color: #D00000; margin-right: 0; spacing: none; }"));
}
else
{
m_errorButton.setStyleSheet("QPushButton { margin-right: 0; spacing: none; }");
m_errorButton.setStyleSheet(
QStringLiteral("QPushButton { margin-right: 0; spacing: none; }"));
}
m_errorButton.show();
@@ -197,7 +201,7 @@ QWidget* QtStatusBar::addPermanentVLine()
{
QFrame* vline = new QFrame(this);
vline->setFrameShape(QFrame::VLine);
vline->setStyleSheet("color: #777");
vline->setStyleSheet(QStringLiteral("color: #777"));
addPermanentWidget(vline);
return vline;
}
+6 -5
View File
@@ -30,15 +30,16 @@ QSize QtTabBar::minimumTabSizeHint(int index) const
void QtTabBar::contextMenuEvent(QContextMenuEvent* event)
{
QtContextMenu menu(event, this);
QAction * m_closeTabsToRight = new QAction("Close tabs to the right", this);
QAction* m_closeTabsToRight = new QAction(QStringLiteral("Close tabs to the right"), this);
menu.addAction(m_closeTabsToRight);
connect(m_closeTabsToRight, &QAction::triggered, this, [&]()
{
// We dont want to close tabs right of the current active tab.
connect(m_closeTabsToRight, &QAction::triggered, this, [&]() {
// We dont want to close tabs right of the current active tab.
// No, our intend is to close tabs right of the currently hovered tab.
auto tabNum = tabAt(event->pos());
LOG_INFO("Handling closeTabs... emitting signal to close tabs right of tab nr. " + std::to_string(tabNum));
LOG_INFO(
"Handling closeTabs... emitting signal to close tabs right of tab nr. " +
std::to_string(tabNum));
emit signalCloseTabsToRight(tabNum);
});
+2 -2
View File
@@ -6,7 +6,7 @@
class QtTabBar: public QTabBar
{
Q_OBJECT
public:
QtTabBar(QWidget* parent = nullptr);
@@ -19,7 +19,7 @@ protected:
QSize tabSizeHint(int index) const override;
QSize minimumTabSizeHint(int index) const override;
// New ContextMenu that lets the user close all tabs to the
// New ContextMenu that lets the user close all tabs to the
// right of current mouse position.
void contextMenuEvent(QContextMenuEvent* event) override;
};
+6 -6
View File
@@ -17,7 +17,7 @@
QtTooltip::QtTooltip(QWidget* parent): QFrame(parent), m_parentView(nullptr), m_isHovered(false)
{
QWidget::setWindowFlags(Qt::ToolTip);
setObjectName("tooltip");
setObjectName(QStringLiteral("tooltip"));
QVBoxLayout* layout = new QVBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
@@ -27,7 +27,7 @@ QtTooltip::QtTooltip(QWidget* parent): QFrame(parent), m_parentView(nullptr), m_
QtTooltip::~QtTooltip() {}
void QtTooltip::setTooltipInfo(TooltipInfo info)
void QtTooltip::setTooltipInfo(const TooltipInfo& info)
{
int maxWidth = 600;
QWidget* parent = m_parentView ? m_parentView : parentWidget();
@@ -140,21 +140,21 @@ void QtTooltip::enterEvent(QEvent* event)
m_isHovered = true;
}
void QtTooltip::addTitle(QString title, int count, QString countText)
void QtTooltip::addTitle(const QString& title, int count, const QString& countText)
{
QHBoxLayout* titleLayout = new QHBoxLayout();
titleLayout->setContentsMargins(0, 0, 0, 0);
titleLayout->setSpacing(0);
QLabel* titleLabel = new QLabel(title);
titleLabel->setObjectName("tooltip_title");
titleLabel->setObjectName(QStringLiteral("tooltip_title"));
titleLayout->addWidget(titleLabel);
if (count >= 0)
{
QLabel* referenceLabel = new QLabel(
QString::number(count) + " " + countText + (count != 1 ? "s" : ""));
referenceLabel->setObjectName("tooltip_references");
referenceLabel->setObjectName(QStringLiteral("tooltip_references"));
titleLayout->addWidget(referenceLabel, 0, Qt::AlignRight);
}
@@ -168,7 +168,7 @@ void QtTooltip::addTitle(QString title, int count, QString countText)
void QtTooltip::addWidget(QWidget* widget)
{
widget->setObjectName("tooltip_widget");
widget->setObjectName(QStringLiteral("tooltip_widget"));
layout()->addWidget(widget);
}
+2 -2
View File
@@ -13,7 +13,7 @@ public:
QtTooltip(QWidget* parent = nullptr);
virtual ~QtTooltip();
void setTooltipInfo(TooltipInfo info);
void setTooltipInfo(const TooltipInfo& info);
void setParentView(QWidget* parentView);
@@ -28,7 +28,7 @@ protected:
virtual void enterEvent(QEvent* event);
private:
void addTitle(QString title, int count, QString countText);
void addTitle(const QString& title, int count, const QString& countText);
void addWidget(QWidget* widget);
void clearLayout(QLayout* layout);
@@ -39,7 +39,8 @@ QtBookmarkCategory::QtBookmarkCategory(ControllerProxy<BookmarkController>* cont
m_deleteButton = new QPushButton();
m_deleteButton->setObjectName(QStringLiteral("category_delete_button"));
m_deleteButton->setToolTip(QStringLiteral("Delete this Bookmark Category and the containing Bookmarks"));
m_deleteButton->setToolTip(
QStringLiteral("Delete this Bookmark Category and the containing Bookmarks"));
m_deleteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
m_deleteButton->setIconSize(QSize(20, 20));
m_deleteButton->setIcon(QPixmap(
@@ -90,7 +90,7 @@ void QtIconStateButton::leaveEvent(QEvent* event)
}
}
void QtIconStateButton::setState(State state)
void QtIconStateButton::setState(const State& state)
{
QPixmap pixmap = QPixmap(QString::fromStdWString(state.iconPath.wstr()));
@@ -40,7 +40,7 @@ protected:
void leaveEvent(QEvent* event);
private:
void setState(State state);
void setState(const State& state);
std::map<ButtonState, State> m_states;
};
+1 -1
View File
@@ -787,7 +787,7 @@ void QtCodeArea::updateLineNumberAreaWidth(int /* newBlockCount */)
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
}
void QtCodeArea::updateLineNumberArea(const QRect& rect, int dy)
void QtCodeArea::updateLineNumberArea(QRect rect, int dy)
{
if (dy)
{
+1 -1
View File
@@ -100,7 +100,7 @@ protected:
private slots:
void updateLineNumberAreaWidth(int newBlockCount = 0);
void updateLineNumberArea(const QRect&, int);
void updateLineNumberArea(QRect , int);
void setIDECursorPosition();
void setCopyAvailable(bool yes);
@@ -100,7 +100,7 @@ void QtCodeFileList::clearSnippetTitleAndScrollBar()
updateLastSnippetScrollBar(nullptr);
}
QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
QtCodeFile* QtCodeFileList::getFile(const FilePath& filePath)
{
QtCodeFile* file = nullptr;
+1 -1
View File
@@ -28,7 +28,7 @@ public:
void clear();
void clearSnippetTitleAndScrollBar();
QtCodeFile* getFile(const FilePath filePath);
QtCodeFile* getFile(const FilePath& filePath);
void addFile(const CodeFileParams& params);
@@ -32,7 +32,10 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/");
m_expandButton = new QtSelfRefreshIconButton(
QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this);
QLatin1String(""),
imageDir.getConcatenated(L"snippet_arrow_right.png"),
"code/file/title",
this);
m_collapseButton = new QtSelfRefreshIconButton(
QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this);
@@ -74,7 +77,8 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
m_showErrorsButton = new QPushButton(QStringLiteral("show errors"));
m_showErrorsButton->setObjectName(QStringLiteral("screen_button"));
m_showErrorsButton->setToolTip(QStringLiteral("Show all errors causing this file to be incomplete"));
m_showErrorsButton->setToolTip(
QStringLiteral("Show all errors causing this file to be incomplete"));
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_showErrorsButton->hide();
titleLayout->addWidget(m_showErrorsButton);
@@ -168,7 +172,8 @@ void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fat
if (fatalErrorCount > 0)
{
label += QStringLiteral(" (") + QString::number(fatalErrorCount) + QStringLiteral(" fatal)");
label += QStringLiteral(" (") + QString::number(fatalErrorCount) +
QStringLiteral(" fatal)");
}
QString text = QString::number(refCount) + QChar(' ') + label;
@@ -11,7 +11,7 @@ QtCodeNavigateable::~QtCodeNavigateable() {}
void QtCodeNavigateable::ensureWidgetVisibleAnimated(
const QWidget* parentWidget,
const QWidget* childWidget,
QRectF rect,
const QRectF& rect,
bool animated,
CodeScrollParams::Target target)
{
@@ -40,7 +40,7 @@ protected:
void ensureWidgetVisibleAnimated(
const QWidget* parentWidget,
const QWidget* childWidget,
QRectF rect,
const QRectF& rect,
bool animated,
CodeScrollParams::Target target);
void ensurePercentVisibleAnimated(
@@ -78,8 +78,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
m_nextLocalReferenceButton = new QtSearchBarButton(
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
m_prevLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_previous"));
m_nextLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_next"));
m_prevLocalReferenceButton->setObjectName(
QStringLiteral("local_reference_button_previous"));
m_nextLocalReferenceButton->setObjectName(
QStringLiteral("local_reference_button_next"));
m_prevLocalReferenceButton->setToolTip(QStringLiteral("previous local reference"));
m_nextLocalReferenceButton->setToolTip(QStringLiteral("next local reference"));
@@ -48,7 +48,7 @@ void QtLocationPicker::paintEvent(QPaintEvent*)
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
void QtLocationPicker::setPlaceholderText(QString text)
void QtLocationPicker::setPlaceholderText(const QString& text)
{
m_data->setPlaceholderText(text);
}
@@ -58,7 +58,7 @@ QString QtLocationPicker::getText()
return m_data->text();
}
void QtLocationPicker::setText(QString text)
void QtLocationPicker::setText(const QString& text)
{
m_data->setText(text);
}
@@ -15,9 +15,9 @@ public:
virtual void paintEvent(QPaintEvent*) override;
void setPlaceholderText(QString text);
void setPlaceholderText(const QString& text);
QString getText();
void setText(QString text);
void setText(const QString& text);
void clearText();
bool pickDirectory() const;
@@ -63,7 +63,7 @@ void QtPathListBox::setPaths(const std::vector<FilePath>& list, bool readOnly)
void QtPathListBox::addPaths(const std::vector<FilePath>& list, bool readOnly)
{
for (FilePath path: list)
for (const FilePath& path: list)
{
QtListBoxItem* item = addListBoxItemWithText(QString::fromStdWString(path.wstr()));
item->setReadOnly(readOnly);
@@ -37,10 +37,12 @@ void QtPathListBoxItem::handleButtonPress()
switch (m_listBox->getSelectionPolicy())
{
case QtPathListBox::SELECTION_POLICY_FILES_ONLY:
list.append(QtFileDialog::getOpenFileName(this, QStringLiteral("Select Directory"), path, QLatin1String("")));
list.append(QtFileDialog::getOpenFileName(
this, QStringLiteral("Select Directory"), path, QLatin1String("")));
break;
case QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY:
list.append(QtFileDialog::getExistingDirectory(this, QStringLiteral("Select Directory"), path));
list.append(
QtFileDialog::getExistingDirectory(this, QStringLiteral("Select Directory"), path));
break;
case QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES:
list = QtFileDialog::getFileNamesAndDirectories(this, path);
@@ -75,7 +75,7 @@ void QtUpdateCheckerWidget::checkUpdate(bool force)
std::shared_ptr<bool> deleteCheck = m_deleteCheck;
QtUpdateChecker::check(force, [deleteCheck, this](QtUpdateChecker::Result result) {
QtUpdateChecker::check(force, [deleteCheck, this](const QtUpdateChecker::Result& result) {
if (*deleteCheck.get())
{
return;
@@ -98,7 +98,7 @@ void QtUpdateCheckerWidget::checkUpdate(bool force)
});
}
void QtUpdateCheckerWidget::setDownloadUrl(QString url)
void QtUpdateCheckerWidget::setDownloadUrl(const QString& url)
{
m_button->setText(QStringLiteral("new version available"));
m_button->disconnect();
@@ -20,7 +20,7 @@ signals:
private:
void checkUpdate(bool force);
void setDownloadUrl(QString url);
void setDownloadUrl(const QString& url);
QPushButton* m_button;
@@ -29,8 +29,8 @@ QtHistoryItem::QtHistoryItem(const SearchMatch& match, size_t index, bool isCurr
m_name = new QLabel(QString::fromStdWString(name), this);
m_name->setAttribute(Qt::WA_MacShowFocusRect, 0);
m_name->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
m_name->setObjectName(isCurrent ?
QStringLiteral("history_item_current") : QStringLiteral("history_item"));
m_name->setObjectName(
isCurrent ? QStringLiteral("history_item_current") : QStringLiteral("history_item"));
m_name->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
layout->addWidget(m_name);
@@ -384,7 +384,7 @@ QtAutocompletionList::QtAutocompletionList(QWidget* parent): QCompleter(parent)
QtAutocompletionList::~QtAutocompletionList() {}
void QtAutocompletionList::completeAt(const QPoint& pos, const std::vector<SearchMatch>& autocompletionList)
void QtAutocompletionList::completeAt(QPoint pos, const std::vector<SearchMatch>& autocompletionList)
{
m_model->setMatchList(autocompletionList);
@@ -79,7 +79,7 @@ public:
QtAutocompletionList(QWidget* parent = 0);
virtual ~QtAutocompletionList();
void completeAt(const QPoint& pos, const std::vector<SearchMatch>& autocompletionList);
void completeAt(QPoint pos, const std::vector<SearchMatch>& autocompletionList);
const SearchMatch* getSearchMatchAt(int idx) const;
@@ -180,7 +180,7 @@ void QtScreenSearchBox::findMatches()
{
m_controllerProxy->executeAsTask([this](ScreenSearchController* controller) {
std::set<std::string> responderNames;
for (auto p: m_checkBoxes)
for (const auto& p: m_checkBoxes)
{
if (p.second->isChecked())
{
+25 -15
View File
@@ -42,7 +42,8 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
, m_zoomInButtonSpeed(20.0f)
, m_zoomOutButtonSpeed(-20.0f)
{
QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd") : QStringLiteral("Ctrl");
QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd")
: QStringLiteral("Ctrl");
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
@@ -62,8 +63,10 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
connect(m_openInTabAction, &QAction::triggered, this, &QtGraphicsView::openInTab);
m_copyNodeNameAction = new QAction(QStringLiteral("Copy Name"), this);
m_copyNodeNameAction->setStatusTip(QStringLiteral("Copies the name of this node to the clipboard"));
m_copyNodeNameAction->setToolTip(QStringLiteral("Copies the name of this node to the clipboard"));
m_copyNodeNameAction->setStatusTip(
QStringLiteral("Copies the name of this node to the clipboard"));
m_copyNodeNameAction->setToolTip(
QStringLiteral("Copies the name of this node to the clipboard"));
connect(m_copyNodeNameAction, &QAction::triggered, this, &QtGraphicsView::copyNodeName);
m_collapseAction = new QAction(QStringLiteral("Collapse Node (Shift + Left Click)"), this);
@@ -76,20 +79,26 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
m_expandAction->setToolTip(QStringLiteral("Show unconnected members of the node"));
connect(m_expandAction, &QAction::triggered, this, &QtGraphicsView::expandNode);
m_showInIDEAction = new QAction(QStringLiteral("Show Definition in IDE (Ctrl + Left Click)"), this);
m_showInIDEAction = new QAction(
QStringLiteral("Show Definition in IDE (Ctrl + Left Click)"), this);
#if defined(Q_OS_MAC)
m_showInIDEAction->setText("Show Definition in IDE (Cmd + Left Click)");
#endif
m_showInIDEAction->setStatusTip(QStringLiteral("Show definition of this symbol in the IDE (via plug-in)"));
m_showInIDEAction->setToolTip(QStringLiteral("Show definition of this symbol in the IDE (via plug-in)"));
m_showInIDEAction->setStatusTip(
QStringLiteral("Show definition of this symbol in the IDE (via plug-in)"));
m_showInIDEAction->setToolTip(
QStringLiteral("Show definition of this symbol in the IDE (via plug-in)"));
connect(m_showInIDEAction, &QAction::triggered, this, &QtGraphicsView::showInIDE);
m_showDefinitionAction = new QAction(QStringLiteral("Show Definition (Ctrl + Alt + Left Click)"), this);
m_showDefinitionAction = new QAction(
QStringLiteral("Show Definition (Ctrl + Alt + Left Click)"), this);
#if defined(Q_OS_MAC)
m_showDefinitionAction->setText("Show Definition (Cmd + Alt + Left Click)");
#endif
m_showDefinitionAction->setStatusTip(QStringLiteral("Show definition of this symbol in the code"));
m_showDefinitionAction->setToolTip(QStringLiteral("Show definition of this symbol in the code"));
m_showDefinitionAction->setStatusTip(
QStringLiteral("Show definition of this symbol in the code"));
m_showDefinitionAction->setToolTip(
QStringLiteral("Show definition of this symbol in the code"));
connect(m_showDefinitionAction, &QAction::triggered, this, &QtGraphicsView::showDefinition);
m_hideNodeAction = new QAction(QStringLiteral("Hide Node (Alt + Left Click)"), this);
@@ -556,12 +565,13 @@ void QtGraphicsView::exportGraph()
const QString exportNotice = QStringLiteral("Exported from Sourcetrail");
const int margin = 10;
FilePath filePath(QtFileDialog::showSaveFileDialog(
nullptr,
QStringLiteral("Save image"),
FilePath(),
QStringLiteral("PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp);;SVG (*.svg)"))
.toStdWString());
FilePath filePath(
QtFileDialog::showSaveFileDialog(
nullptr,
QStringLiteral("Save image"),
FilePath(),
QStringLiteral("PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp);;SVG (*.svg)"))
.toStdWString());
if (filePath.extension() == L".svg")
@@ -19,11 +19,11 @@ QtLineItemBase::QtLineItemBase(QGraphicsItem* parent)
QtLineItemBase::~QtLineItemBase() {}
void QtLineItemBase::updateLine(
Vec4i ownerRect,
Vec4i targetRect,
Vec4i ownerParentRect,
Vec4i targetParentRect,
GraphViewStyle::EdgeStyle style,
const Vec4i& ownerRect,
const Vec4i& targetRect,
const Vec4i& ownerParentRect,
const Vec4i& targetParentRect,
const GraphViewStyle::EdgeStyle& style,
size_t weight,
bool showArrow)
{
@@ -318,7 +318,7 @@ QPolygon QtLineItemBase::getPath() const
return poly;
}
int QtLineItemBase::getDirection(const QPointF& a, const QPointF& b) const
int QtLineItemBase::getDirection(QPointF a, QPointF b) const
{
if (a.x() != b.x())
{
@@ -21,11 +21,11 @@ public:
virtual ~QtLineItemBase();
void updateLine(
Vec4i ownerRect,
Vec4i targetRect,
Vec4i ownerParentRect,
Vec4i targetParentRect,
GraphViewStyle::EdgeStyle style,
const Vec4i& ownerRect,
const Vec4i& targetRect,
const Vec4i& ownerParentRect,
const Vec4i& targetParentRect,
const GraphViewStyle::EdgeStyle& style,
size_t weight,
bool showArrow);
@@ -37,7 +37,7 @@ public:
protected:
QPolygon getPath() const;
int getDirection(const QPointF& a, const QPointF& b) const;
int getDirection(QPointF a, QPointF b) const;
QRectF getArrowBoundingRect(const QPolygon& poly) const;
void drawArrow(const QPolygon& poly, QPainterPath* path, QPainterPath* arrowPath = nullptr) const;
@@ -10,7 +10,8 @@ QtLineItemStraight::QtLineItemStraight(QGraphicsItem* parent): QGraphicsLineItem
QtLineItemStraight::~QtLineItemStraight() {}
void QtLineItemStraight::updateLine(Vec2i origin, Vec2i target, GraphViewStyle::EdgeStyle style)
void QtLineItemStraight::updateLine(
const Vec2i& origin, const Vec2i& target, const GraphViewStyle::EdgeStyle& style)
{
prepareGeometryChange();
@@ -11,7 +11,7 @@ public:
QtLineItemStraight(QGraphicsItem* parent);
virtual ~QtLineItemStraight();
void updateLine(Vec2i origin, Vec2i target, GraphViewStyle::EdgeStyle style);
void updateLine(const Vec2i& origin, const Vec2i& target, const GraphViewStyle::EdgeStyle& style);
virtual QPainterPath shape() const;
};
@@ -518,7 +518,7 @@ bool QtGraphEdge::isTrailEdge() const
return m_isTrailEdge;
}
void QtGraphEdge::setIsTrailEdge(std::vector<Vec4i> path, bool horizontal)
void QtGraphEdge::setIsTrailEdge(const std::vector<Vec4i>& path, bool horizontal)
{
m_path = path;
m_isTrailEdge = true;
+1 -1
View File
@@ -57,7 +57,7 @@ public:
void setDirection(TokenComponentAggregation::Direction direction);
bool isTrailEdge() const;
void setIsTrailEdge(std::vector<Vec4i> path, bool horizontal);
void setIsTrailEdge(const std::vector<Vec4i>& path, bool horizontal);
void setUseBezier(bool useBezier);
void clearPath();
@@ -143,7 +143,7 @@ QSize QtGraphNode::size() const
return QSize(m_size.x, m_size.y);
}
void QtGraphNode::setSize(const QSize& size)
void QtGraphNode::setSize(QSize size)
{
setSize(Vec2i(size.width(), size.height()));
}
@@ -607,8 +607,8 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style)
m_matchText->setPos(
style.iconOffset.x + style.iconSize + style.textOffset.x, style.textOffset.y);
float charWidth = QFontMetrics(font).width(
QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) / 37.0f;
float charWidth =
QFontMetrics(font).width(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) / 37.0f;
float charHeight = QFontMetrics(font).height();
m_matchRect->setRect(
style.iconOffset.x + style.iconSize + style.textOffset.x + m_matchPos * charWidth,
+1 -1
View File
@@ -51,7 +51,7 @@ public:
void setColumnSize(const Vec2i& size);
QSize size() const;
void setSize(const QSize& size);
void setSize(QSize size);
Vec4i getBoundingRect() const;
@@ -8,7 +8,7 @@
#include "GraphViewStyle.h"
#include "QtCountCircleItem.h"
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name)
QtGraphNodeBundle::QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, const std::wstring& name)
: QtGraphNode(), m_tokenId(tokenId), m_type(type)
{
this->setName(name);
@@ -10,7 +10,7 @@ class QtGraphNodeBundle: public QtGraphNode
{
Q_OBJECT
public:
QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, std::wstring name);
QtGraphNodeBundle(Id tokenId, size_t nodeCount, NodeType type, const std::wstring& name);
virtual ~QtGraphNodeBundle();
// QtGraphNode implementation
+1 -1
View File
@@ -11,7 +11,7 @@ QtRequest::QtRequest()
QObject::connect(m_networkManager, &QNetworkAccessManager::finished, this, &QtRequest::finished);
}
void QtRequest::sendRequest(QString url)
void QtRequest::sendRequest(const QString& url)
{
LOG_INFO_STREAM(<< "send HTTP request: " << url.toStdString());
+1 -1
View File
@@ -13,7 +13,7 @@ class QtRequest: public QObject
public:
QtRequest();
void sendRequest(QString url);
void sendRequest(const QString& url);
signals:
void receivedData(QByteArray bytes);
+12 -10
View File
@@ -37,23 +37,23 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
appSettings->setUpdateDownloadUrl("");
appSettings->save();
QString urlString = QStringLiteral("https://www.sourcetrail.com/api/v2/versions/latest");
std::string urlString = "https://www.sourcetrail.com/api/v2/versions/latest";
// OS
std::string osString = utility::getOsTypeString();
urlString += ("?os=" + osString).c_str();
urlString += "?os=" + osString;
// architecture
std::string platformString =
(utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64 ? "64" : "32");
urlString += ("&platform=" + platformString + "bit").c_str();
urlString += "&platform=" + platformString + "bit";
// version
// Version::setApplicationVersion(Version::fromString("2017.3.48")); // for debugging
urlString += ("&version=" + Version::getApplicationVersion().toDisplayString()).c_str();
urlString += "&version=" + Version::getApplicationVersion().toDisplayString();
// license
urlString += QLatin1String("&license=free"); // options: test, private, commercial
urlString += "&license=free"; // options: test, private, commercial
// user token
std::string token = appSettings->getUserToken();
@@ -64,12 +64,12 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
appSettings->save();
}
urlString += ("&token=" + token).c_str();
urlString += "&token=" + token;
// send request
QtRequest* request = new QtRequest();
QObject::connect(
request, &QtRequest::receivedData, [force, callback, request](QByteArray bytes) {
request, &QtRequest::receivedData, [force, callback, request](const QByteArray& bytes) {
Result result;
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
@@ -131,8 +131,10 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
"Sourcetrail " + version + " is available for download: <a href=\"" + url +
"\">" + url + "</a>");
msgBox.addButton(QStringLiteral("Close"), QMessageBox::ButtonRole::NoRole);
msgBox.addButton(QStringLiteral("Skip this Version"), QMessageBox::ButtonRole::NoRole);
QPushButton* but = msgBox.addButton(QStringLiteral("Download"), QMessageBox::ButtonRole::YesRole);
msgBox.addButton(
QStringLiteral("Skip this Version"), QMessageBox::ButtonRole::NoRole);
QPushButton* but = msgBox.addButton(
QStringLiteral("Download"), QMessageBox::ButtonRole::YesRole);
msgBox.setDefaultButton(but);
int val = msgBox.exec();
@@ -167,7 +169,7 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
callback(result);
});
request->sendRequest(urlString);
request->sendRequest(QString::fromStdString(urlString));
MessageStatus(L"Checking for new version", false, true).dispatch();
}
@@ -734,7 +734,7 @@ void QtProjectWizard::selectedSourceGroupChanged(int index)
m_previouslySelectedIndex = index;
}
void QtProjectWizard::selectedSourceGroupNameChanged(QString name)
void QtProjectWizard::selectedSourceGroupNameChanged(const QString& name)
{
m_sourceGroupList->item(m_sourceGroupList->currentRow())->setText(name);
}
@@ -806,7 +806,8 @@ void QtProjectWizard::duplicateSelectedSourceGroup()
newName = newNameBase + (id > 0 ? " (" + std::to_string(id) + ")" : "");
bool nameAlreadyExists = false;
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings: m_allSourceGroupSettings)
for (const std::shared_ptr<SourceGroupSettings>& sourceGroupSettings:
m_allSourceGroupSettings)
{
if (sourceGroupSettings && sourceGroupSettings->getName() == newName)
{
@@ -1013,11 +1014,11 @@ void QtProjectWizard::createProject()
MessageStatus(L"Unable to save project to location: " + path.wstr()).dispatch();
QMessageBox msgBox(this);
msgBox.setText("Could not create Project");
msgBox.setText(QStringLiteral("Could not create Project"));
msgBox.setInformativeText(QString::fromStdWString(
L"<p>Sourcetrail was unable to save the project to the specified path. Please pick a "
L"different project location.</p>"));
msgBox.addButton("Ok", QMessageBox::ButtonRole::AcceptRole);
msgBox.addButton(QStringLiteral("Ok"), QMessageBox::ButtonRole::AcceptRole);
msgBox.exec();
return;
@@ -63,7 +63,7 @@ private:
private slots:
void generalButtonClicked();
void selectedSourceGroupChanged(int index);
void selectedSourceGroupNameChanged(QString name);
void selectedSourceGroupNameChanged(const QString& name);
void removeSelectedSourceGroup();
void duplicateSelectedSourceGroup();
@@ -54,7 +54,7 @@ void QtProjectWizardContent::setIsRequired(bool isRequired)
m_isRequired = isRequired;
}
QLabel* QtProjectWizardContent::createFormTitle(QString name) const
QLabel* QtProjectWizardContent::createFormTitle(const QString& name) const
{
QLabel* label = new QLabel(name);
label->setObjectName(QStringLiteral("titleLabel"));
@@ -72,7 +72,7 @@ QLabel* QtProjectWizardContent::createFormLabel(QString name) const
return createFormSubLabel(name);
}
QLabel* QtProjectWizardContent::createFormSubLabel(QString name) const
QLabel* QtProjectWizardContent::createFormSubLabel(const QString& name) const
{
QLabel* label = new QLabel(name);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
@@ -81,7 +81,8 @@ QLabel* QtProjectWizardContent::createFormSubLabel(QString name) const
return label;
}
QToolButton* QtProjectWizardContent::createSourceGroupButton(QString name, QString iconPath) const
QToolButton* QtProjectWizardContent::createSourceGroupButton(
const QString& name, const QString& iconPath) const
{
QToolButton* button = new QToolButton();
button->setObjectName(QStringLiteral("sourceGroupButton"));
@@ -102,7 +103,7 @@ QtHelpButton* QtProjectWizardContent::addHelpButton(
return button;
}
QPushButton* QtProjectWizardContent::addFilesButton(QString name, QGridLayout* layout, int row) const
QPushButton* QtProjectWizardContent::addFilesButton(const QString& name, QGridLayout* layout, int row) const
{
QPushButton* button = new QPushButton(name);
button->setObjectName(QStringLiteral("windowButton"));
@@ -36,14 +36,14 @@ public:
void setIsRequired(bool isRequired);
protected:
QLabel* createFormTitle(QString name) const;
QLabel* createFormTitle(const QString& name) const;
QLabel* createFormLabel(QString name) const;
QLabel* createFormSubLabel(QString name) const;
QToolButton* createSourceGroupButton(QString name, QString iconPath) const;
QLabel* createFormSubLabel(const QString& name) const;
QToolButton* createSourceGroupButton(const QString& name, const QString& iconPath) const;
QtHelpButton* addHelpButton(
const QString& helpTitle, const QString& helpText, QGridLayout* layout, int row) const;
QPushButton* addFilesButton(QString name, QGridLayout* layout, int row) const;
QPushButton* addFilesButton(const QString& name, QGridLayout* layout, int row) const;
QFrame* addSeparator(QGridLayout* layout, int row) const;
QtProjectWizardWindow* m_window;
@@ -16,7 +16,10 @@ void QtProjectWizardContentCStandard::populate(QGridLayout* layout, int& row)
{
m_standard = new QComboBox();
layout->addWidget(
createFormLabel("C Standard"), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
createFormLabel(QStringLiteral("C Standard")),
row,
QtProjectWizardWindow::FRONT_COL,
Qt::AlignRight);
layout->addWidget(m_standard, row, QtProjectWizardWindow::BACK_COL, Qt::AlignLeft);
row++;
}
@@ -16,7 +16,10 @@ void QtProjectWizardContentCppStandard::populate(QGridLayout* layout, int& row)
{
m_standard = new QComboBox();
layout->addWidget(
createFormLabel("C++ Standard"), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
createFormLabel(QStringLiteral("C++ Standard")),
row,
QtProjectWizardWindow::FRONT_COL,
Qt::AlignRight);
layout->addWidget(m_standard, row, QtProjectWizardWindow::BACK_COL, Qt::AlignLeft);
row++;
}
@@ -26,14 +26,16 @@ void QtProjectWizardContentCrossCompilationOptions::populate(QGridLayout* layout
createFormLabel("Cross-Compilation"), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
addHelpButton(
"Cross-Compilation",
"<p>Use these options to specify the target architecture for the provided source code. "
"Even though Sourcetrail will "
"not generate a target binary, providing these options will affect which headers the "
"indexer will be looking for "
"while analyzing your source code.</p>"
"<p>If you are not sure which value to pick for a certain option just choose \"unknown\" "
"and Sourcetrail will try "
"to guess the correct value.</p>",
QStringLiteral(
"<p>Use these options to specify the target architecture for the provided source code. "
"Even though Sourcetrail will "
"not generate a target binary, providing these options will affect which headers the "
"indexer will be looking for "
"while analyzing your source code.</p>"
"<p>If you are not sure which value to pick for a certain option just choose "
"\"unknown\" "
"and Sourcetrail will try "
"to guess the correct value.</p>"),
layout,
row);
@@ -16,32 +16,36 @@ QtProjectWizardContentCxxPchFlags::QtProjectWizardContentCxxPchFlags(
void QtProjectWizardContentCxxPchFlags::populate(QGridLayout* layout, int& row)
{
const QString labelText("Precompiled Header Flags");
const QString labelText(QStringLiteral("Precompiled Header Flags"));
layout->addWidget(
createFormLabel(labelText), row, QtProjectWizardWindow::FRONT_COL, 2, 1, Qt::AlignTop);
const QString optionText(
m_isCDB ? "Use flags of first indexed file and 'Additional Compiler Flags'"
: "Use 'Compiler Flags'");
m_isCDB ? QStringLiteral("Use flags of first indexed file and 'Additional Compiler Flags'")
: QStringLiteral("Use 'Compiler Flags'"));
const QString optionHelp(
m_isCDB
? "Check <b>" + optionText +
"</b> to use the flags specified "
"in the first compile command of the Compilation Database and all flags specified "
"at 'Additional Compiler Flags'."
: "Check <b>" + optionText + "</b> to reuse the flags specified at 'Compiler Flags'.");
m_isCDB ? QStringLiteral("Check <b>") + optionText +
QStringLiteral("</b> to use the flags specified "
"in the first compile command of the Compilation Database and all "
"flags specified "
"at 'Additional Compiler Flags'.")
: QStringLiteral("Check <b>") + optionText +
QStringLiteral("</b> to reuse the flags specified at 'Compiler Flags'."));
addHelpButton(
"Precompiled Header Flags",
"<p>Define compiler flags used during precompiled header file generation.</p>"
"<p>" +
QStringLiteral("Precompiled Header Flags"),
QStringLiteral(
"<p>Define compiler flags used during precompiled header file generation.</p>"
"<p>") +
optionHelp +
"</p>"
"<p>Additionally add compiler flags to the list for precompiled header generation "
"only. Some examples:</p>"
"<p>* use \"-DRELEASE\" to add a preprocessor #define for \"RELEASE\"</p>"
"<p>* use \"-U__clang__\" to remove the preprocessor #define for \"__clang__\"</p>",
QStringLiteral(
"</p>"
"<p>Additionally add compiler flags to the list for precompiled header generation "
"only. Some examples:</p>"
"<p>* use \"-DRELEASE\" to add a preprocessor #define for \"RELEASE\"</p>"
"<p>* use \"-U__clang__\" to remove the preprocessor #define for "
"\"__clang__\"</p>"),
layout,
row);
@@ -25,10 +25,11 @@ void QtProjectWizardContentFlags::populate(QGridLayout* layout, int& row)
addHelpButton(
labelText,
"<p>Define additional Clang compiler flags used during indexing. Here are some "
"examples:</p>"
"<p>use \"-DRELEASE\" to add a preprocessor #define for \"RELEASE\"</p>"
"<p>use \"-U__clang__\" to remove the preprocessor #define for \"__clang__\"</p>",
QStringLiteral(
"<p>Define additional Clang compiler flags used during indexing. Here are some "
"examples:</p>"
"<p>use \"-DRELEASE\" to add a preprocessor #define for \"RELEASE\"</p>"
"<p>use \"-U__clang__\" to remove the preprocessor #define for \"__clang__\"</p>"),
layout,
row);
@@ -9,11 +9,11 @@
#include <QTimer>
#include "ApplicationSettings.h"
#include "FileLogger.h"
#include "FileSystem.h"
#include "MessageSwitchColorScheme.h"
#include "ResourcePaths.h"
#include "logging.h"
#include "FileLogger.h"
#include "utility.h"
#include "utilityApp.h"
#include "utilityPathDetection.h"
@@ -68,7 +68,12 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
// font size
m_fontSize = addComboBox(
QStringLiteral("Font Size"), appSettings->getFontSizeMin(), appSettings->getFontSizeMax(), QLatin1String(""), layout, row);
QStringLiteral("Font Size"),
appSettings->getFontSizeMin(),
appSettings->getFontSizeMax(),
QLatin1String(""),
layout,
row);
// tab width
m_tabWidth = addComboBox(QStringLiteral("Tab Width"), 1, 16, QLatin1String(""), layout, row);
@@ -113,8 +118,9 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_showDirectoryInCode = addCheckBox(
QStringLiteral("Directory in File Title"),
QStringLiteral("Show directory of file in code title"),
QStringLiteral("<p>Enable display of the parent directory of a code file relative to the project "
"file.</p>"),
QStringLiteral(
"<p>Enable display of the parent directory of a code file relative to the project "
"file.</p>"),
layout,
row);
layout->setRowMinimumHeight(row - 1, 30);
@@ -136,13 +142,17 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_screenAutoScalingInfoLabel = new QLabel(QLatin1String(""));
m_screenAutoScaling = addComboBoxWithWidgets(
QStringLiteral("Auto Scaling to DPI"),
QStringLiteral("<p>Define if automatic scaling to screen DPI resolution is active. "
"This setting manipulates the environment flag QT_AUTO_SCREEN_SCALE_FACTOR of the Qt "
"framework "
"(<a "
"href=\"http://doc.qt.io/qt-5/highdpi.html\">http://doc.qt.io/qt-5/highdpi.html</a>). "
"Choose 'system' to stick to the setting of your current environment.</p>"
"<p>Changes to this setting require a restart of the application to take effect.</p>"),
QStringLiteral(
"<p>Define if automatic scaling to screen DPI resolution is active. "
"This setting manipulates the environment flag QT_AUTO_SCREEN_SCALE_FACTOR of the "
"Qt "
"framework "
"(<a "
"href=\"http://doc.qt.io/qt-5/highdpi.html\">http://doc.qt.io/qt-5/highdpi.html</"
"a>). "
"Choose 'system' to stick to the setting of your current environment.</p>"
"<p>Changes to this setting require a restart of the application to take "
"effect.</p>"),
{m_screenAutoScalingInfoLabel},
layout,
row);
@@ -159,12 +169,15 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_screenScaleFactorInfoLabel = new QLabel(QLatin1String(""));
m_screenScaleFactor = addComboBoxWithWidgets(
QStringLiteral("Scale Factor"),
QStringLiteral("<p>Define a screen scale factor for the user interface of the application. "
"This setting manipulates the environment flag QT_SCALE_FACTOR of the Qt framework "
"(<a "
"href=\"http://doc.qt.io/qt-5/highdpi.html\">http://doc.qt.io/qt-5/highdpi.html</a>). "
"Choose 'system' to stick to the setting of your current environment.</p>"
"<p>Changes to this setting require a restart of the application to take effect.</p>"),
QStringLiteral(
"<p>Define a screen scale factor for the user interface of the application. "
"This setting manipulates the environment flag QT_SCALE_FACTOR of the Qt framework "
"(<a "
"href=\"http://doc.qt.io/qt-5/highdpi.html\">http://doc.qt.io/qt-5/highdpi.html</"
"a>). "
"Choose 'system' to stick to the setting of your current environment.</p>"
"<p>Changes to this setting require a restart of the application to take "
"effect.</p>"),
{m_screenScaleFactorInfoLabel},
layout,
row);
@@ -195,19 +208,21 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
// scroll speed
m_scrollSpeed = addLineEdit(
QStringLiteral("Scroll Speed"),
QStringLiteral("<p>Set a multiplier for the in app scroll speed.</p>"
"<p>A value between 0 and 1 results in slower scrolling while a value higher than 1 "
"increases scroll speed.</p>"),
QStringLiteral(
"<p>Set a multiplier for the in app scroll speed.</p>"
"<p>A value between 0 and 1 results in slower scrolling while a value higher than 1 "
"increases scroll speed.</p>"),
layout,
row);
// graph zooming
QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd") : QStringLiteral("Ctrl");
QString modifierName = utility::getOsType() == OS_MAC ? QStringLiteral("Cmd")
: QStringLiteral("Ctrl");
m_graphZooming = addCheckBox(
QStringLiteral("Graph Zoom"),
QStringLiteral("Zoom graph on mouse wheel"),
QStringLiteral("<p>Enable graph zoom using mouse wheel only, instead of using ") + modifierName +
QStringLiteral(" + Mouse Wheel.</p>"),
QStringLiteral("<p>Enable graph zoom using mouse wheel only, instead of using ") +
modifierName + QStringLiteral(" + Mouse Wheel.</p>"),
layout,
row);
@@ -232,10 +247,11 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_verboseIndexerLoggingEnabled = addCheckBox(
QStringLiteral("Indexer Logging"),
QStringLiteral("Enable verbose indexer logging"),
QStringLiteral("<p>Enable additional logs of abstract syntax tree traversal during indexing. This "
"information can help "
"tracking down crashes that occurr during indexing.</p>"
"<p><b>Warning</b>: This slows down indexing performance a lot.</p>"),
QStringLiteral(
"<p>Enable additional logs of abstract syntax tree traversal during indexing. This "
"information can help "
"tracking down crashes that occurr during indexing.</p>"
"<p><b>Warning</b>: This slows down indexing performance a lot.</p>"),
layout,
row);
@@ -258,10 +274,11 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_automaticUpdateCheck = addCheckBox(
QStringLiteral("Automatic<br />Update Check"),
QStringLiteral("Check automatically for updates"),
QStringLiteral("<p>Automatically connects to the Sourcetrail server once a day to check "
"if a new release is available.</p>"
"<p>Note: No personally identifiable information will be transmitted to conduct this "
"check.</p>"),
QStringLiteral(
"<p>Automatically connects to the Sourcetrail server once a day to check "
"if a new release is available.</p>"
"<p>Note: No personally identifiable information will be transmitted to conduct this "
"check.</p>"),
layout,
row);
addGap(layout, row);
@@ -272,14 +289,16 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
// Sourcetrail port
m_sourcetrailPort = addLineEdit(
QStringLiteral("Sourcetrail Port"),
QStringLiteral("<p>Port number that Sourcetrail uses to listen for incoming messages from plugins.</p>"),
QStringLiteral("<p>Port number that Sourcetrail uses to listen for incoming messages from "
"plugins.</p>"),
layout,
row);
// Sourcetrail port
m_pluginPort = addLineEdit(
QStringLiteral("Plugin Port"),
QStringLiteral("<p>Port number that Sourcetrail uses to sends outgoing messages to plugins.</p>"),
QStringLiteral(
"<p>Port number that Sourcetrail uses to sends outgoing messages to plugins.</p>"),
layout,
row);
@@ -295,7 +314,8 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
QStringLiteral("Indexer Threads"),
0,
24,
QStringLiteral("<p>Set the number of threads used to work on indexing your project in parallel.</p>"),
QStringLiteral(
"<p>Set the number of threads used to work on indexing your project in parallel.</p>"),
{m_threadsInfoLabel},
layout,
row);
@@ -310,9 +330,10 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_multiProcessIndexing = addCheckBox(
QStringLiteral("Multi Process<br />C/C++ Indexing"),
QStringLiteral("Run C/C++ indexer threads in different process"),
QStringLiteral("<p>Enable C/C++ indexer threads to run in different process.</p>"
"<p>This prevents the application from crashing due to unforseen exceptions while "
"indexing.</p>"),
QStringLiteral(
"<p>Enable C/C++ indexer threads to run in different process.</p>"
"<p>This prevents the application from crashing due to unforseen exceptions while "
"indexing.</p>"),
layout,
row);
@@ -333,12 +354,15 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_javaPath->setPlaceholderText(QStringLiteral("<jre_path>/bin/client/jvm.dll"));
break;
case OS_MAC:
m_javaPath->setFileFilter(QStringLiteral("JLI or JVM Library (libjli.dylib libjvm.dylib)"));
m_javaPath->setPlaceholderText(QStringLiteral("<jre_path>/Contents/Home/jre/lib/jli/libjli.dylib"));
m_javaPath->setFileFilter(
QStringLiteral("JLI or JVM Library (libjli.dylib libjvm.dylib)"));
m_javaPath->setPlaceholderText(
QStringLiteral("<jre_path>/Contents/Home/jre/lib/jli/libjli.dylib"));
break;
case OS_LINUX:
m_javaPath->setFileFilter(QStringLiteral("JVM Library (libjvm.so)"));
m_javaPath->setPlaceholderText(QStringLiteral("<jre_path>/bin/<arch>/server/libjvm.so"));
m_javaPath->setPlaceholderText(
QStringLiteral("<jre_path>/bin/<arch>/server/libjvm.so"));
break;
default:
LOG_WARNING("No placeholders and filters set for Java path selection");
@@ -381,8 +405,9 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
addHelpButton(
QStringLiteral("JRE System Library"),
QStringLiteral("<p>Only required for indexing Java projects.</p>"
"<p>Add the jar files of your JRE System Library. These jars can be found inside your "
"JRE install directory.</p>"),
"<p>Add the jar files of your JRE System Library. These jars can be "
"found inside your "
"JRE install directory.</p>"),
layout,
row);
@@ -415,8 +440,9 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
addHelpButton(
QStringLiteral("Maven Path"),
QStringLiteral("<p>Only required for indexing projects using Maven.</p>"
"<p>Provide the location of your installed Maven executable. You can also use the auto "
"detection below.</p>"),
"<p>Provide the location of your installed Maven executable. You can "
"also use the auto "
"detection below.</p>"),
layout,
row);
row++;
@@ -433,13 +459,16 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
m_pythonPostProcessing = addCheckBox(
QStringLiteral("Post Processing"),
QStringLiteral("Add ambiguous edges for unsolved references (recommended)"),
QStringLiteral("<p>Enable a post processing step to solve unsolved references after the indexing is done. "
"</p>"
"<p>These references will be marked \"ambiguous\" to indicate that some of these edges may "
"never "
"be encountered during runtime of the indexed code because the post processing only relies "
"on "
"symbol names and types.</p>"),
QStringLiteral("<p>Enable a post processing step to solve unsolved references after the "
"indexing is done. "
"</p>"
"<p>These references will be marked \"ambiguous\" to indicate that some of "
"these edges may "
"never "
"be encountered during runtime of the indexed code because the post "
"processing only relies "
"on "
"symbol names and types.</p>"),
layout,
row);
@@ -682,7 +711,7 @@ void QtProjectWizardContentPreferences::uiAutoScalingChanges(int index)
}
m_screenAutoScalingInfoLabel->setText(
QStringLiteral("detected: '") + autoScale + QStringLiteral("'"));
QStringLiteral("detected: '") + autoScale + QStringLiteral("'"));
m_screenAutoScalingInfoLabel->show();
}
else
@@ -704,7 +733,7 @@ void QtProjectWizardContentPreferences::uiScaleFactorChanges(int index)
}
m_screenScaleFactorInfoLabel->setText(
QStringLiteral("detected: '") + scale + QStringLiteral("%'"));
QStringLiteral("detected: '") + scale + QStringLiteral("%'"));
m_screenScaleFactorInfoLabel->show();
}
else
@@ -831,12 +860,12 @@ void QtProjectWizardContentPreferences::addMavenPathDetection(QGridLayout* layou
row++;
}
void QtProjectWizardContentPreferences::addTitle(QString title, QGridLayout* layout, int& row)
void QtProjectWizardContentPreferences::addTitle(const QString& title, QGridLayout* layout, int& row)
{
layout->addWidget(createFormTitle(title), row++, QtProjectWizardWindow::FRONT_COL, Qt::AlignLeft);
}
void QtProjectWizardContentPreferences::addLabel(QString label, QGridLayout* layout, int row)
void QtProjectWizardContentPreferences::addLabel(const QString& label, QGridLayout* layout, int row)
{
layout->addWidget(createFormLabel(label), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
}
@@ -848,7 +877,7 @@ void QtProjectWizardContentPreferences::addWidget(
}
void QtProjectWizardContentPreferences::addLabelAndWidget(
QString label, QWidget* widget, QGridLayout* layout, int row, Qt::Alignment widgetAlignment)
const QString& label, QWidget* widget, QGridLayout* layout, int row, Qt::Alignment widgetAlignment)
{
addLabel(label, layout, row);
addWidget(widget, layout, row, widgetAlignment);
@@ -860,7 +889,7 @@ void QtProjectWizardContentPreferences::addGap(QGridLayout* layout, int& row)
}
QCheckBox* QtProjectWizardContentPreferences::addCheckBox(
QString label, QString text, QString helpText, QGridLayout* layout, int& row)
const QString& label, const QString& text, const QString& helpText, QGridLayout* layout, int& row)
{
QCheckBox* checkBox = new QCheckBox(text, this);
addLabelAndWidget(label, checkBox, layout, row, Qt::AlignLeft);
@@ -876,7 +905,7 @@ QCheckBox* QtProjectWizardContentPreferences::addCheckBox(
}
QComboBox* QtProjectWizardContentPreferences::addComboBox(
QString label, QString helpText, QGridLayout* layout, int& row)
const QString& label, const QString& helpText, QGridLayout* layout, int& row)
{
QComboBox* comboBox = new QComboBox(this);
addLabelAndWidget(label, comboBox, layout, row, Qt::AlignLeft);
@@ -892,7 +921,11 @@ QComboBox* QtProjectWizardContentPreferences::addComboBox(
}
QComboBox* QtProjectWizardContentPreferences::addComboBoxWithWidgets(
QString label, QString helpText, std::vector<QWidget*> widgets, QGridLayout* layout, int& row)
const QString& label,
const QString& helpText,
std::vector<QWidget*> widgets,
QGridLayout* layout,
int& row)
{
QComboBox* comboBox = new QComboBox(this);
@@ -921,7 +954,7 @@ QComboBox* QtProjectWizardContentPreferences::addComboBoxWithWidgets(
}
QComboBox* QtProjectWizardContentPreferences::addComboBox(
QString label, int min, int max, QString helpText, QGridLayout* layout, int& row)
const QString& label, int min, int max, const QString& helpText, QGridLayout* layout, int& row)
{
QComboBox* comboBox = addComboBox(label, helpText, layout, row);
@@ -937,10 +970,10 @@ QComboBox* QtProjectWizardContentPreferences::addComboBox(
}
QComboBox* QtProjectWizardContentPreferences::addComboBoxWithWidgets(
QString label,
const QString& label,
int min,
int max,
QString helpText,
const QString& helpText,
std::vector<QWidget*> widgets,
QGridLayout* layout,
int& row)
@@ -959,7 +992,7 @@ QComboBox* QtProjectWizardContentPreferences::addComboBoxWithWidgets(
}
QLineEdit* QtProjectWizardContentPreferences::addLineEdit(
QString label, QString helpText, QGridLayout* layout, int& row)
const QString& label, const QString& helpText, QGridLayout* layout, int& row)
{
QLineEdit* lineEdit = new QLineEdit(this);
lineEdit->setObjectName(QStringLiteral("name"));
@@ -59,33 +59,42 @@ private:
void addJreSystemLibraryPathsDetection(QGridLayout* layout, int& row);
void addMavenPathDetection(QGridLayout* layout, int& row);
void addTitle(QString title, QGridLayout* layout, int& row);
void addLabel(QString label, QGridLayout* layout, int row);
void addTitle(const QString& title, QGridLayout* layout, int& row);
void addLabel(const QString& label, QGridLayout* layout, int row);
void addWidget(
QWidget* widget, QGridLayout* layout, int row, Qt::Alignment widgetAlignment = Qt::Alignment());
void addLabelAndWidget(
QString label,
const QString& label,
QWidget* widget,
QGridLayout* layout,
int row,
Qt::Alignment widgetAlignment = Qt::Alignment());
void addGap(QGridLayout* layout, int& row);
QCheckBox* addCheckBox(QString label, QString text, QString helpText, QGridLayout* layout, int& row);
QComboBox* addComboBox(QString label, QString helpText, QGridLayout* layout, int& row);
QCheckBox* addCheckBox(
const QString& label,
const QString& text,
const QString& helpText,
QGridLayout* layout,
int& row);
QComboBox* addComboBox(const QString& label, const QString& helpText, QGridLayout* layout, int& row);
QComboBox* addComboBoxWithWidgets(
QString label, QString helpText, std::vector<QWidget*> widgets, QGridLayout* layout, int& row);
QComboBox* addComboBox(
QString label, int min, int max, QString helpText, QGridLayout* layout, int& row);
QComboBox* addComboBoxWithWidgets(
QString label,
int min,
int max,
QString helpText,
const QString& label,
const QString& helpText,
std::vector<QWidget*> widgets,
QGridLayout* layout,
int& row);
QLineEdit* addLineEdit(QString label, QString helpText, QGridLayout* layout, int& row);
QComboBox* addComboBox(
const QString& label, int min, int max, const QString& helpText, QGridLayout* layout, int& row);
QComboBox* addComboBoxWithWidgets(
const QString& label,
int min,
int max,
const QString& helpText,
std::vector<QWidget*> widgets,
QGridLayout* layout,
int& row);
QLineEdit* addLineEdit(const QString& label, const QString& helpText, QGridLayout* layout, int& row);
QFontComboBox* m_fontFace;
QtComboBoxPlaceHolder* m_fontFacePlaceHolder;
@@ -194,8 +194,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
m_window->setNextEnabled(false);
m_title->setText("Source Group Types - " + m_languages->checkedButton()->text());
m_description->setText(hasRecommeded ?
QStringLiteral("<b>* recommended</b>") : QLatin1String(""));
m_description->setText(
hasRecommeded ? QStringLiteral("<b>* recommended</b>") : QLatin1String(""));
});
QtFlowLayout* flayout = new QtFlowLayout(10, 0, 0);
@@ -21,7 +21,10 @@ void QtProjectWizardContentSourceGroupData::populate(QGridLayout* layout, int& r
connect(m_name, &QLineEdit::textEdited, this, &QtProjectWizardContentSourceGroupData::editedName);
layout->addWidget(
createFormLabel(QStringLiteral("Source Group Name")), row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
createFormLabel(QStringLiteral("Source Group Name")),
row,
QtProjectWizardWindow::FRONT_COL,
Qt::AlignRight);
layout->addWidget(m_name, row, QtProjectWizardWindow::BACK_COL);
row++;
@@ -10,37 +10,36 @@ QtProjectWizardContentVS::QtProjectWizardContentVS(QtProjectWizardWindow* window
void QtProjectWizardContentVS::populate(QGridLayout* layout, int& row)
{
layout->setRowMinimumHeight(row++, 10);
QLabel* nameLabel = createFormLabel("Create Compilation Database");
QLabel* nameLabel = createFormLabel(QStringLiteral("Create Compilation Database"));
layout->addWidget(nameLabel, row, QtProjectWizardWindow::FRONT_COL);
addHelpButton(
"Create Compilation Database",
"To create a new Compilation Database from a Visual Studio Solution, a Solution has to be open in Visual "
QStringLiteral("Create Compilation Database"),
QStringLiteral("To create a new Compilation Database from a Visual Studio Solution, a Solution has to be open in Visual "
"Studio.\n Sourcetrail will call Visual Studio to open the 'Create Compilation Database' dialog. Please follow "
"the instructions in Visual Studio to complete the process.\n Note: Sourcetrail's Visual Studio plugin has to "
"be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded.",
"be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded."),
layout,
row);
QLabel* descriptionLabel = createFormSubLabel(
"Call Visual Studio to create a Compilation Database from the loaded Solution (requires installed "
QLabel* descriptionLabel = createFormSubLabel(
QStringLiteral("Call Visual Studio to create a Compilation Database from the loaded Solution (requires installed "
"<a href=\"https://sourcetrail.com/documentation/index.html#VisualStudio\">Sourcetrail Visual Studio "
"Extension</a>).");
descriptionLabel->setObjectName("description");
"Extension</a>)."));
descriptionLabel->setObjectName(QStringLiteral("description"));
descriptionLabel->setOpenExternalLinks(true);
descriptionLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
layout->addWidget(descriptionLabel, row, QtProjectWizardWindow::BACK_COL);
row++;
QPushButton* button = new QPushButton("Create Compilation Database");
button->setObjectName("windowButton");
QPushButton* button = new QPushButton(QStringLiteral("Create Compilation Database"));
button->setObjectName(QStringLiteral("windowButton"));
layout->addWidget(button, row, QtProjectWizardWindow::BACK_COL);
row++;
QLabel* skipLabel = createFormSubLabel(
"*Skip this step if you already have a Compilation Database for your Solution.");
skipLabel->setObjectName("description");
QLabel* skipLabel = createFormLabel(QStringLiteral(
"*Skip this step if you already have a Compilation Database for your Solution."));
skipLabel->setObjectName(QStringLiteral("description"));
skipLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
layout->addWidget(skipLabel, row, QtProjectWizardWindow::BACK_COL);
row++;
@@ -15,7 +15,7 @@ QtProjectWizardContentPathCDB::QtProjectWizardContentPathCDB(
m_settings->getProjectDirectoryPath());
})
{
setTitleString("Compilation Database (compile_commands.json)");
setTitleString(QStringLiteral("Compilation Database (compile_commands.json)"));
setHelpString(
"Select the compilation database file for the project. Sourcetrail will index your project "
"based on the compile "
@@ -32,7 +32,7 @@ void QtProjectWizardContentPathCDB::populate(QGridLayout* layout, int& row)
{
QtProjectWizardContentPath::populate(layout, row);
m_picker->setPickDirectory(false);
m_picker->setFileFilter("JSON Compilation Database (*.json)");
m_picker->setFileFilter(QStringLiteral("JSON Compilation Database (*.json)"));
connect(
m_picker, &QtLocationPicker::locationPicked, this, &QtProjectWizardContentPathCDB::pickedPath);
connect(
@@ -46,21 +46,21 @@ void QtProjectWizardContentPathCDB::populate(QGridLayout* layout, int& row)
"and stay up-to-date "
"with changes on refresh.",
this);
description->setObjectName("description");
description->setObjectName(QStringLiteral("description"));
description->setWordWrap(true);
layout->addWidget(description, row, QtProjectWizardWindow::BACK_COL);
row++;
QLabel* title = createFormSubLabel("Source Files to Index");
QLabel* title = createFormSubLabel(QStringLiteral("Source Files to Index"));
layout->addWidget(title, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
m_fileCountLabel = new QLabel("");
m_fileCountLabel = new QLabel(QLatin1String(""));
m_fileCountLabel->setWordWrap(true);
layout->addWidget(m_fileCountLabel, row, QtProjectWizardWindow::BACK_COL, Qt::AlignTop);
row++;
addFilesButton("show source files", layout, row);
addFilesButton(QStringLiteral("show source files"), layout, row);
row++;
}
@@ -95,12 +95,12 @@ std::vector<FilePath> QtProjectWizardContentPathCDB::getFilePaths() const
QString QtProjectWizardContentPathCDB::getFileNamesTitle() const
{
return "Source Files";
return QStringLiteral("Source Files");
}
QString QtProjectWizardContentPathCDB::getFileNamesDescription() const
{
return " source files will be indexed.";
return QStringLiteral(" source files will be indexed.");
}
void QtProjectWizardContentPathCDB::pickedPath()
@@ -14,7 +14,7 @@ QtProjectWizardContentPathCodeblocksProject::QtProjectWizardContentPathCodeblock
m_settings->getProjectDirectoryPath());
})
{
setTitleString("Code::Blocks Project (.cbp)");
setTitleString(QStringLiteral("Code::Blocks Project (.cbp)"));
setHelpString(
"Select the Code::Blocks file for the project. Sourcetrail will index your project based "
"on the settings "
@@ -31,7 +31,7 @@ void QtProjectWizardContentPathCodeblocksProject::populate(QGridLayout* layout,
{
QtProjectWizardContentPath::populate(layout, row);
m_picker->setPickDirectory(false);
m_picker->setFileFilter("Code::Blocks Project (*.cbp)");
m_picker->setFileFilter(QStringLiteral("Code::Blocks Project (*.cbp)"));
connect(
m_picker,
&QtLocationPicker::locationPicked,
@@ -42,21 +42,21 @@ void QtProjectWizardContentPathCodeblocksProject::populate(QGridLayout* layout,
"Sourcetrail will use all settings from the Code::Blocks project and stay up-to-date with "
"changes on refresh.",
this);
description->setObjectName("description");
description->setObjectName(QStringLiteral("description"));
description->setWordWrap(true);
layout->addWidget(description, row, QtProjectWizardWindow::BACK_COL);
row++;
QLabel* title = createFormSubLabel("Source Files to Index");
QLabel* title = createFormSubLabel(QStringLiteral("Source Files to Index"));
layout->addWidget(title, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignTop);
layout->setRowStretch(row, 0);
m_fileCountLabel = new QLabel("");
m_fileCountLabel = new QLabel(QLatin1String(""));
m_fileCountLabel->setWordWrap(true);
layout->addWidget(m_fileCountLabel, row, QtProjectWizardWindow::BACK_COL, Qt::AlignTop);
row++;
addFilesButton("show source files", layout, row);
addFilesButton(QStringLiteral("show source files"), layout, row);
row++;
}
@@ -86,12 +86,12 @@ std::vector<FilePath> QtProjectWizardContentPathCodeblocksProject::getFilePaths(
QString QtProjectWizardContentPathCodeblocksProject::getFileNamesTitle() const
{
return "Source Files";
return QStringLiteral("Source Files");
}
QString QtProjectWizardContentPathCodeblocksProject::getFileNamesDescription() const
{
return " source files will be indexed.";
return QStringLiteral(" source files will be indexed.");
}
void QtProjectWizardContentPathCodeblocksProject::pickedPath()
@@ -15,7 +15,7 @@ QtProjectWizardContentPathCxxPch::QtProjectWizardContentPathCxxPch(
QtProjectWizardWindow* window)
: QtProjectWizardContentPath(window), m_settings(settings), m_settingsCxxPch(settingsCxxPch)
{
setTitleString("Precompiled Header File");
setTitleString(QStringLiteral("Precompiled Header File"));
setHelpString(
"Specify the path to the input header file that should be used to generate a precompiled "
"header before indexing.<br />"
@@ -27,7 +27,7 @@ QtProjectWizardContentPathCxxPch::QtProjectWizardContentPathCxxPch(
"<br />"
"Leave blank to disable the use of precompiled headers. You can make use of environment "
"variables with ${ENV_VAR}.");
setPlaceholderString("Not Using Precompiled Header");
setPlaceholderString(QStringLiteral("Not Using Precompiled Header"));
}
void QtProjectWizardContentPathCxxPch::populate(QGridLayout* layout, int& row)
@@ -57,7 +57,7 @@ bool QtProjectWizardContentPathCxxPch::check()
if (!cdb)
{
QMessageBox msgBox(m_window);
msgBox.setText("Unable to open and read the provided compilation database file.");
msgBox.setText(QStringLiteral("Unable to open and read the provided compilation database file."));
msgBox.exec();
return false;
}
@@ -73,9 +73,9 @@ bool QtProjectWizardContentPathCxxPch::check()
"precompiled headers to speed up your indexer, please specify an input at "
"Precompiled Header File.");
QPushButton* cancelButton = msgBox.addButton(
"Cancel", QMessageBox::ButtonRole::RejectRole);
QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole);
QPushButton* continueButton = msgBox.addButton(
"Continue", QMessageBox::ButtonRole::AcceptRole);
QStringLiteral("Continue"), QMessageBox::ButtonRole::AcceptRole);
msgBox.exec();
if (msgBox.clickedButton() == cancelButton)
{
@@ -94,9 +94,9 @@ bool QtProjectWizardContentPathCxxPch::check()
"specified input file at "
"Precompiled Header File will not be used.");
QPushButton* cancelButton = msgBox.addButton(
"Cancel", QMessageBox::ButtonRole::RejectRole);
QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole);
QPushButton* continueButton = msgBox.addButton(
"Continue", QMessageBox::ButtonRole::AcceptRole);
QStringLiteral("Continue"), QMessageBox::ButtonRole::AcceptRole);
msgBox.exec();
if (msgBox.clickedButton() == cancelButton)
{
@@ -93,8 +93,10 @@ bool QtProjectWizardContentPaths::check()
"remove them before continuing?")
.arg(m_titleString));
msgBox.setDetailedText(missingPaths);
QPushButton* removeButton = msgBox.addButton(QStringLiteral("Remove"), QMessageBox::YesRole);
QPushButton* keepButton = msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole);
QPushButton* removeButton = msgBox.addButton(
QStringLiteral("Remove"), QMessageBox::YesRole);
QPushButton* keepButton = msgBox.addButton(
QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole);
QPushButton* cancelButton = msgBox.addButton(
QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole);
@@ -10,7 +10,8 @@ QtProjectWizardContentPathsFrameworkSearch::QtProjectWizardContentPathsFramework
: QtProjectWizardContentPaths(settings, window, QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY, true)
{
setTitleString(
indicateAsAdditional ? "Additional Framework Search Paths" : "Framework Search Paths");
indicateAsAdditional ? QStringLiteral("Additional Framework Search Paths")
: QStringLiteral("Framework Search Paths"));
setHelpString(
"Framework Search Paths define where MacOS framework containers (.framework), that your "
"project depends on, are "
@@ -11,7 +11,7 @@ QtProjectWizardContentPathsFrameworkSearchGlobal::QtProjectWizardContentPathsFra
QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY,
true)
{
setTitleString("Global Framework Search Paths");
setTitleString(QStringLiteral("Global Framework Search Paths"));
setHelpString(
"The Global Framework Search Paths will be used in all your projects - in addition to the "
"project specific "
@@ -64,8 +64,8 @@ void QtProjectWizardContentPathsHeaderSearch::populate(QGridLayout* layout, int&
if (!m_indicateAsAdditional)
{
{
QPushButton* detectionButton = new QPushButton("auto-detect");
detectionButton->setObjectName("windowButton");
QPushButton* detectionButton = new QPushButton(QStringLiteral("auto-detect"));
detectionButton->setObjectName(QStringLiteral("windowButton"));
connect(
detectionButton,
&QPushButton::clicked,
@@ -75,8 +75,9 @@ void QtProjectWizardContentPathsHeaderSearch::populate(QGridLayout* layout, int&
detectionButton, row, QtProjectWizardWindow::BACK_COL, Qt::AlignLeft | Qt::AlignTop);
}
{
QPushButton* validateionButton = new QPushButton("validate include directives");
validateionButton->setObjectName("windowButton");
QPushButton* validateionButton = new QPushButton(
QStringLiteral("validate include directives"));
validateionButton->setObjectName(QStringLiteral("windowButton"));
connect(
validateionButton,
&QPushButton::clicked,
@@ -124,7 +125,7 @@ void QtProjectWizardContentPathsHeaderSearch::detectIncludesButtonClicked()
QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY);
m_pathsDialog->setup();
m_pathsDialog->updateNextButton("Start");
m_pathsDialog->updateNextButton(QStringLiteral("Start"));
m_pathsDialog->setCloseVisible(true);
m_pathsDialog->setRelativeRootDirectory(m_settings->getProjectDirectoryPath());
@@ -367,7 +368,7 @@ void QtProjectWizardContentPathsHeaderSearch::showDetectedIncludesResult(
m_filesDialog->setup();
m_filesDialog->setReadOnly(true);
m_filesDialog->setCloseVisible(true);
m_filesDialog->updateNextButton("Add");
m_filesDialog->updateNextButton(QStringLiteral("Add"));
m_filesDialog->setText(detailedText);
m_filesDialog->showWindow();
@@ -392,7 +393,7 @@ void QtProjectWizardContentPathsHeaderSearch::showValidationResult(
{
QMessageBox msgBox(m_window);
msgBox.setText(
"<p>All include directives throughout the indexed files have been resolved.</p>");
QStringLiteral("<p>All include directives throughout the indexed files have been resolved.</p>"));
msgBox.exec();
}
else
@@ -15,7 +15,7 @@ QtProjectWizardContentPathsHeaderSearchGlobal::QtProjectWizardContentPathsHeader
QtPathListBox::SELECTION_POLICY_DIRECTORIES_ONLY,
true)
{
setTitleString("Global Include Paths");
setTitleString(QStringLiteral("Global Include Paths"));
setHelpString(
"The Global Include Paths will be used in all your projects in addition to the project "
"specific Include Paths. "
@@ -74,7 +74,7 @@ bool QtProjectWizardContentPathsHeaderSearchGlobal::check()
if (compilerHeaderPaths.size())
{
QMessageBox msgBox(m_window);
msgBox.setText("Multiple Compiler Headers");
msgBox.setText(QStringLiteral("Multiple Compiler Headers"));
msgBox.setInformativeText(
"Your Global Include Paths contain other paths that hold C/C++ compiler headers, "
"probably those of your local C/C++ compiler. They are possibly in conflict with the "
@@ -83,8 +83,8 @@ bool QtProjectWizardContentPathsHeaderSearchGlobal::check()
"you want to remove "
"these paths?");
msgBox.setDetailedText(compilerHeaderPaths);
msgBox.addButton("Remove", QMessageBox::ButtonRole::YesRole);
msgBox.addButton("Keep", QMessageBox::ButtonRole::NoRole);
msgBox.addButton(QStringLiteral("Remove"), QMessageBox::ButtonRole::YesRole);
msgBox.addButton(QStringLiteral("Keep"), QMessageBox::ButtonRole::NoRole);
msgBox.setIcon(QMessageBox::Icon::Question);
int ret = msgBox.exec();
@@ -103,14 +103,14 @@ std::vector<FilePath> QtProjectWizardContentPathsIndexedHeaders::getIndexedPaths
QtProjectWizardContentPathsIndexedHeaders::QtProjectWizardContentPathsIndexedHeaders(
std::shared_ptr<SourceGroupSettings> settings,
QtProjectWizardWindow* window,
std::string projectKindName)
const std::string& projectKindName)
: QtProjectWizardContentPaths(
settings, window, QtPathListBox::SELECTION_POLICY_FILES_AND_DIRECTORIES, true)
, m_projectKindName(projectKindName)
{
m_showFilesString = "";
m_showFilesString = QLatin1String("");
setTitleString("Header Files & Directories to Index");
setTitleString(QStringLiteral("Header Files & Directories to Index"));
setHelpString(QString::fromStdString(
"The provided " + m_projectKindName +
" already specifies which source files are part of your project. But Sourcetrail still "
@@ -135,7 +135,7 @@ void QtProjectWizardContentPathsIndexedHeaders::populate(QGridLayout* layout, in
QtProjectWizardContentPaths::populate(layout, row);
QPushButton* button = new QPushButton(QString::fromStdString("Select from " + m_projectKindName));
button->setObjectName("windowButton");
button->setObjectName(QStringLiteral("windowButton"));
connect(
button, &QPushButton::clicked, this, &QtProjectWizardContentPathsIndexedHeaders::buttonClicked);
@@ -166,7 +166,7 @@ bool QtProjectWizardContentPathsIndexedHeaders::check()
if (m_list->getPathsAsDisplayed().empty())
{
QMessageBox msgBox(m_window);
msgBox.setText("You didn't specify any Header Files & Directories to Index.");
msgBox.setText(QStringLiteral("You didn't specify any Header Files & Directories to Index."));
msgBox.setInformativeText(QString::fromStdString(
"Sourcetrail will only index the source files listed in the " + m_projectKindName +
" file and none of the included header files."));
@@ -197,7 +197,7 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
if (!codeblocksProjectPath.exists())
{
QMessageBox msgBox(m_window);
msgBox.setText("The provided Code::Blocks project path does not exist.");
msgBox.setText(QStringLiteral("The provided Code::Blocks project path does not exist."));
msgBox.setDetailedText(QString::fromStdWString(codeblocksProjectPath.wstr()));
msgBox.exec();
return;
@@ -241,7 +241,7 @@ void QtProjectWizardContentPathsIndexedHeaders::buttonClicked()
if (!cdbPath.exists())
{
QMessageBox msgBox(m_window);
msgBox.setText("The provided Compilation Database path does not exist.");
msgBox.setText(QStringLiteral("The provided Compilation Database path does not exist."));
msgBox.setDetailedText(QString::fromStdWString(cdbPath.wstr()));
msgBox.exec();
return;
@@ -19,7 +19,7 @@ public:
QtProjectWizardContentPathsIndexedHeaders(
std::shared_ptr<SourceGroupSettings> settings,
QtProjectWizardWindow* window,
std::string projectKindName);
const std::string& projectKindName);
virtual void populate(QGridLayout* layout, int& row) override;
+1 -1
View File
@@ -47,7 +47,7 @@ void QtContextMenu::addUndoActions()
addAction(s_redoAction);
}
void QtContextMenu::addFileActions(FilePath filePath)
void QtContextMenu::addFileActions(const FilePath& filePath)
{
s_filePath = filePath;
+1 -1
View File
@@ -17,7 +17,7 @@ public:
void addAction(QAction* action);
void addUndoActions();
void addFileActions(FilePath filePath);
void addFileActions(const FilePath& filePath);
static QtContextMenu* getInstance();
@@ -12,7 +12,7 @@ qreal QtDeviceScaledPixmap::devicePixelRatio()
QtDeviceScaledPixmap::QtDeviceScaledPixmap() {}
QtDeviceScaledPixmap::QtDeviceScaledPixmap(QString filePath): m_pixmap(filePath)
QtDeviceScaledPixmap::QtDeviceScaledPixmap(const QString& filePath): m_pixmap(filePath)
{
m_pixmap.setDevicePixelRatio(devicePixelRatio());
}
@@ -9,7 +9,7 @@ public:
static qreal devicePixelRatio();
QtDeviceScaledPixmap();
QtDeviceScaledPixmap(QString filePath);
QtDeviceScaledPixmap(const QString& filePath);
virtual ~QtDeviceScaledPixmap();
const QPixmap& pixmap() const;
@@ -13,7 +13,8 @@ QtFilesAndDirectoriesDialog::QtFilesAndDirectoriesDialog(QWidget* parent): QFile
setOption(QFileDialog::DontUseNativeDialog, true);
for (QPushButton* button: findChildren<QPushButton*>())
{
if (button->text().toLower().contains(QLatin1String("open")) || button->text().toLower().contains(QLatin1String("choose")))
if (button->text().toLower().contains(QLatin1String("open")) ||
button->text().toLower().contains(QLatin1String("choose")))
{
button->installEventFilter(this);
button->disconnect(SIGNAL(clicked()));
+1 -1
View File
@@ -114,7 +114,7 @@ QSize QtFlowLayout::minimumSize() const
return size;
}
int QtFlowLayout::doLayout(const QRect& rect, bool testOnly) const
int QtFlowLayout::doLayout(QRect rect, bool testOnly) const
{
int left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
+1 -1
View File
@@ -34,7 +34,7 @@ public:
int count() const override;
private:
int doLayout(const QRect& rect, bool testOnly) const;
int doLayout(QRect rect, bool testOnly) const;
int smartSpacing(QStyle::PixelMetric pm) const;
QList<QLayoutItem*> itemList;
+18 -20
View File
@@ -42,17 +42,16 @@ std::string QtHighlighter::highlightTypeToString(QtHighlighter::HighlightType ty
return "text";
}
QtHighlighter::HighlightType QtHighlighter::highlightTypeFromString(const std::string typeStr)
QtHighlighter::HighlightType QtHighlighter::highlightTypeFromString(const std::string& typeStr)
{
const std::array<HighlightType, 8> types = {
HighlightType::COMMENT,
HighlightType::DIRECTIVE,
HighlightType::FUNCTION,
HighlightType::KEYWORD,
HighlightType::NUMBER,
HighlightType::QUOTATION,
HighlightType::TEXT,
HighlightType::TYPE};
const std::array<HighlightType, 8> types = {HighlightType::COMMENT,
HighlightType::DIRECTIVE,
HighlightType::FUNCTION,
HighlightType::KEYWORD,
HighlightType::NUMBER,
HighlightType::QUOTATION,
HighlightType::TEXT,
HighlightType::TYPE};
for (HighlightType type: types)
{
@@ -69,15 +68,14 @@ void QtHighlighter::loadHighlightingRules()
{
ColorScheme* scheme = ColorScheme::getInstance().get();
const std::array<HighlightType, 8> types = {
HighlightType::COMMENT,
HighlightType::DIRECTIVE,
HighlightType::FUNCTION,
HighlightType::KEYWORD,
HighlightType::NUMBER,
HighlightType::QUOTATION,
HighlightType::TEXT,
HighlightType::TYPE};
const std::array<HighlightType, 8> types = {HighlightType::COMMENT,
HighlightType::DIRECTIVE,
HighlightType::FUNCTION,
HighlightType::KEYWORD,
HighlightType::NUMBER,
HighlightType::QUOTATION,
HighlightType::TEXT,
HighlightType::TYPE};
s_charFormats.clear();
for (HighlightType type: types)
@@ -87,7 +85,7 @@ void QtHighlighter::loadHighlightingRules()
s_charFormats.emplace(type, format);
}
for (const FilePath path: FileSystem::getFilePathsFromDirectory(
for (const FilePath& path: FileSystem::getFilePathsFromDirectory(
ResourcePaths::getSyntaxHighlightingRulesPath(), {L".rules"}))
{
std::wstring language = path.withoutExtension().fileName();
+1 -1
View File
@@ -22,7 +22,7 @@ public:
};
static std::string highlightTypeToString(HighlightType type);
static HighlightType highlightTypeFromString(const std::string typeStr);
static HighlightType highlightTypeFromString(const std::string& typeStr);
static void loadHighlightingRules();
static void clearHighlightingRules();
+4 -2
View File
@@ -170,7 +170,9 @@ std::string getStyleSheet(const FilePath& path)
{
if (!ColorScheme::getInstance()->hasColor(val))
{
LOG_WARNING("Color scheme does not provide value for key \"" + val + "\" requested by style \"" + path.str() + "\".");
LOG_WARNING(
"Color scheme does not provide value for key \"" + val +
"\" requested by style \"" + path.str() + "\".");
}
val = ColorScheme::getInstance()->getColor(val);
}
@@ -250,7 +252,7 @@ QtMainWindow* getMainWindowforMainView(ViewLayout* viewLayout)
return nullptr;
}
void copyNewFilesFromDirectory(QString src, QString dst)
void copyNewFilesFromDirectory(const QString& src, const QString& dst)
{
QDir dir(src);
if (!dir.exists())
+1 -1
View File
@@ -26,7 +26,7 @@ QIcon createButtonIcon(const FilePath& iconPath, const std::string& colorId);
QtMainWindow* getMainWindowforMainView(ViewLayout* viewLayout);
void copyNewFilesFromDirectory(QString src, QString dst);
void copyNewFilesFromDirectory(const QString& src, const QString& dst);
} // namespace utility
#endif // UTILITY_QT_H
@@ -106,10 +106,12 @@ void QtBookmarkButtonsView::createBookmarkClicked()
{
QMessageBox msgBox;
msgBox.setText(QStringLiteral("Edit Bookmark"));
msgBox.setInformativeText(QStringLiteral("Do you want to edit or delete the bookmark for this symbol?"));
msgBox.setInformativeText(
QStringLiteral("Do you want to edit or delete the bookmark for this symbol?"));
msgBox.addButton(QStringLiteral("Edit"), QMessageBox::ButtonRole::YesRole);
msgBox.addButton(QStringLiteral("Delete"), QMessageBox::ButtonRole::NoRole);
QPushButton* cancelButton = msgBox.addButton(QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole);
QPushButton* cancelButton = msgBox.addButton(
QStringLiteral("Cancel"), QMessageBox::ButtonRole::RejectRole);
msgBox.setDefaultButton(cancelButton);
msgBox.setIcon(QMessageBox::Icon::Question);
int ret = msgBox.exec();
+6 -6
View File
@@ -84,9 +84,9 @@ bool QtCodeView::showsErrors() const
}
void QtCodeView::showSnippets(
const std::vector<CodeFileParams> files,
const CodeParams params,
const CodeScrollParams scrollParams)
const std::vector<CodeFileParams>& files,
const CodeParams& params,
const CodeScrollParams& scrollParams)
{
m_onQtThread([=]() {
TRACE("show snippets");
@@ -112,7 +112,7 @@ void QtCodeView::showSnippets(
}
void QtCodeView::showSingleFile(
const CodeFileParams file, const CodeParams params, const CodeScrollParams scrollParams)
const CodeFileParams& file, const CodeParams& params, const CodeScrollParams& scrollParams)
{
m_onQtThread([=]() {
TRACE("show single file");
@@ -145,7 +145,7 @@ void QtCodeView::showSingleFile(
});
}
void QtCodeView::updateSourceLocations(const std::vector<CodeFileParams> files)
void QtCodeView::updateSourceLocations(const std::vector<CodeFileParams>& files)
{
m_onQtThread([=]() {
TRACE("update source locations");
@@ -168,7 +168,7 @@ void QtCodeView::updateSourceLocations(const std::vector<CodeFileParams> files)
});
}
void QtCodeView::scrollTo(const CodeScrollParams params, bool animated)
void QtCodeView::scrollTo(const CodeScrollParams& params, bool animated)
{
m_onQtThread([=]() { m_widget->scrollTo(params, animated); });
}
+8 -8
View File
@@ -27,18 +27,18 @@ public:
void clear() override;
void showSnippets(
const std::vector<CodeFileParams> files,
const CodeParams params,
const CodeScrollParams scrollParams) override;
const std::vector<CodeFileParams>& files,
const CodeParams& params,
const CodeScrollParams& scrollParams) override;
void showSingleFile(
const CodeFileParams file,
const CodeParams params,
const CodeScrollParams scrollParams) override;
const CodeFileParams& file,
const CodeParams& params,
const CodeScrollParams& scrollParams) override;
void updateSourceLocations(const std::vector<CodeFileParams> files) override;
void updateSourceLocations(const std::vector<CodeFileParams>& files) override;
void scrollTo(const CodeScrollParams params, bool animated) override;
void scrollTo(const CodeScrollParams& params, bool animated) override;
bool showsErrors() const override;
+5 -3
View File
@@ -219,7 +219,8 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout)
QColor(scheme->getNodeTypeColor(t, "fill", ColorScheme::FOCUS).c_str()));
}
QVBoxLayout* filterLayout = addFilters(QStringLiteral("Nodes:"), nodeFilters, nodeColors, &m_nodeFilters, 11);
QVBoxLayout* filterLayout = addFilters(
QStringLiteral("Nodes:"), nodeFilters, nodeColors, &m_nodeFilters, 11);
filterLayout->setContentsMargins(25, 10, 25, 10);
panelC1->setLayout(filterLayout);
}
@@ -255,7 +256,8 @@ QtCustomTrailView::QtCustomTrailView(ViewLayout* viewLayout)
edgeColors.push_back(QColor(scheme->getEdgeTypeColor(t, ColorScheme::FOCUS).c_str()));
}
QVBoxLayout* filterLayout = addFilters(QStringLiteral("Edges:"), edgeFilters, edgeColors, &m_edgeFilters, 5);
QVBoxLayout* filterLayout = addFilters(
QStringLiteral("Edges:"), edgeFilters, edgeColors, &m_edgeFilters, 5);
filterLayout->setContentsMargins(10, 10, 25, 10);
panelC2->setLayout(filterLayout);
}
@@ -477,7 +479,7 @@ QWidget* QtCustomTrailView::createSearchBox(QtSmartSearchBox* searchBox) const
}
QVBoxLayout* QtCustomTrailView::addFilters(
QString name,
const QString& name,
const std::vector<QString>& filters,
const std::vector<QColor>& colors,
std::vector<QCheckBox*>* checkBoxes,
+1 -1
View File
@@ -43,7 +43,7 @@ private:
QWidget* createSearchBox(QtSmartSearchBox* searchBox) const;
QVBoxLayout* addFilters(
QString name,
const QString& name,
const std::vector<QString>& filters,
const std::vector<QColor>& colors,
std::vector<QCheckBox*>* checkBoxes,
+6 -3
View File
@@ -106,7 +106,8 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout)
m_collapseButton->setIconSize(QSize(16, 16));
connect(m_collapseButton, &QPushButton::clicked, this, &QtGraphView::clickedCollapse);
m_customTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui);
m_customTrailButton = new QtSelfRefreshIconButton(
QLatin1String(""), FilePath(), "search/button", ui);
m_customTrailButton->setObjectName(QStringLiteral("trail_button"));
m_customTrailButton->setIconSize(QSize(16, 16));
m_customTrailButton->setToolTip(QStringLiteral("custom trail"));
@@ -115,13 +116,15 @@ QtGraphView::QtGraphView(ViewLayout* viewLayout)
connect(
m_customTrailButton, &QPushButton::clicked, this, &QtGraphView::clickedCustomTrail);
m_forwardTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui);
m_forwardTrailButton = new QtSelfRefreshIconButton(
QLatin1String(""), FilePath(), "search/button", ui);
m_forwardTrailButton->setObjectName(QStringLiteral("trail_button"));
m_forwardTrailButton->setIconSize(QSize(16, 16));
connect(
m_forwardTrailButton, &QPushButton::clicked, this, &QtGraphView::clickedForwardTrail);
m_backwardTrailButton = new QtSelfRefreshIconButton(QLatin1String(""), FilePath(), "search/button", ui);
m_backwardTrailButton = new QtSelfRefreshIconButton(
QLatin1String(""), FilePath(), "search/button", ui);
m_backwardTrailButton->setObjectName(QStringLiteral("trail_button"));
m_backwardTrailButton->setIconSize(QSize(16, 16));
connect(
+8 -6
View File
@@ -34,8 +34,7 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout): StatusView(viewLayout)
// m_table->setColumnWidth(STATUSVIEW_COLUMN::STATUS, 150);
QStringList headers;
headers << QStringLiteral("Type")
<< QStringLiteral("Message");
headers << QStringLiteral("Type") << QStringLiteral("Message");
m_model->setHorizontalHeaderLabels(headers);
layout->addWidget(m_table);
@@ -46,8 +45,10 @@ QtStatusView::QtStatusView(ViewLayout* viewLayout): StatusView(viewLayout)
filters->setSpacing(25);
const StatusFilter filter = ApplicationSettings::getInstance()->getStatusFilter();
m_showInfo = createFilterCheckbox(QStringLiteral("Info"), filters, filter & StatusType::STATUS_INFO);
m_showErrors = createFilterCheckbox(QStringLiteral("Error"), filters, filter & StatusType::STATUS_ERROR);
m_showInfo = createFilterCheckbox(
QStringLiteral("Info"), filters, filter & StatusType::STATUS_INFO);
m_showErrors = createFilterCheckbox(
QStringLiteral("Error"), filters, filter & StatusType::STATUS_ERROR);
filters->addStretch();
@@ -107,8 +108,9 @@ void QtStatusView::addStatus(const std::vector<Status>& status)
m_model->insertRow(rowNumber);
}
QString statusType = (s.type == StatusType::STATUS_ERROR ?
QStringLiteral("ERROR") : QStringLiteral("INFO"));
QString statusType =
(s.type == StatusType::STATUS_ERROR ? QStringLiteral("ERROR")
: QStringLiteral("INFO"));
m_model->setItem(rowNumber, STATUSVIEW_COLUMN::TYPE, new QStandardItem(statusType));
m_model->setItem(
rowNumber,
+9 -8
View File
@@ -40,7 +40,9 @@ QtTabsView::QtTabsView(ViewLayout* viewLayout)
connect(m_tabBar, &QTabBar::currentChanged, this, &QtTabsView::changedTab);
QPushButton* addButton = new QtSelfRefreshIconButton(
QLatin1String(""), ResourcePaths::getGuiPath().concatenate(L"tabs_view/images/add.png"), "tab/bar/button");
QLatin1String(""),
ResourcePaths::getGuiPath().concatenate(L"tabs_view/images/add.png"),
"tab/bar/button");
addButton->setObjectName(QStringLiteral("add_button"));
addButton->setIconSize(QSize(14, 14));
@@ -84,7 +86,7 @@ void QtTabsView::clear()
});
}
void QtTabsView::openTab(bool showTab, SearchMatch match)
void QtTabsView::openTab(bool showTab, const SearchMatch& match)
{
m_onQtThread([=]() { insertTab(showTab, match); });
}
@@ -111,7 +113,7 @@ void QtTabsView::selectTab(bool next)
});
}
void QtTabsView::updateTab(Id tabId, std::vector<SearchMatch> matches)
void QtTabsView::updateTab(Id tabId, const std::vector<SearchMatch>& matches)
{
m_onQtThread([=]() {
for (int i = 0; i < m_tabBar->count(); i++)
@@ -133,7 +135,7 @@ void QtTabsView::addTab()
}
}
void QtTabsView::insertTab(bool showTab, SearchMatch match)
void QtTabsView::insertTab(bool showTab, const SearchMatch& match)
{
int tabId = TabId::nextTab();
@@ -259,7 +261,7 @@ void QtTabsView::setTabState(int idx, const std::vector<SearchMatch>& matches)
->setStyleSheet(
QStringLiteral("#type_circle { background-color: ") + QString::fromStdString(color) +
QStringLiteral("; } "
"#type_circle[selected=true] { background-color: ") +
"#type_circle[selected=true] { background-color: ") +
QString::fromStdString(activeColor) + QStringLiteral("; } "));
}
@@ -277,11 +279,10 @@ void QtTabsView::closeTabsToRight(int tabNum)
{
LOG_INFO("Closing tabs to the right of tab nr. " + std::to_string(tabNum));
// We are closing tabs to the right, hence the increase.
tabNum++;
tabNum++;
// Now close tabs at position tabNum until count has decreased low enough.
while(tabNum < m_tabBar->count() )
while (tabNum < m_tabBar->count())
{
m_tabBar->removeTab(tabNum);
}
}
+3 -3
View File
@@ -25,15 +25,15 @@ public:
// TabsView implementation
void clear() override;
void openTab(bool showTab, SearchMatch match) override;
void openTab(bool showTab, const SearchMatch& match) override;
void closeTab() override;
void destroyTab(Id tabId) override;
void selectTab(bool next) override;
void updateTab(Id tabId, std::vector<SearchMatch> matches) override;
void updateTab(Id tabId, const std::vector<SearchMatch>& matches) override;
private slots:
void addTab();
void insertTab(bool showTab, SearchMatch match);
void insertTab(bool showTab, const SearchMatch& match);
void changedTab(int index);
void removeTab(int index);
void closeTabsToRight(int index);
+1 -1
View File
@@ -26,7 +26,7 @@ void QtTooltipView::refreshView()
});
}
void QtTooltipView::showTooltip(TooltipInfo info, const View* parent)
void QtTooltipView::showTooltip(const TooltipInfo& info, const View* parent)
{
m_onQtThread([=]() {
if (m_widget->isHovered())
+1 -1
View File
@@ -18,7 +18,7 @@ public:
void refreshView() override;
// TooltipView implementation
void showTooltip(TooltipInfo info, const View* parent) override;
void showTooltip(const TooltipInfo& info, const View* parent) override;
void hideTooltip(bool force) override;
bool tooltipVisible() const override;
+14 -14
View File
@@ -69,12 +69,12 @@ void QtAbout::setupAbout()
QLabel* companyLabel = new QLabel(
QStringLiteral("<b>Coati Software KG</b><br />"
"Jakob-Haringer-Straße 1/127<br />"
"5020 Salzburg<br />"
"Austria<br />"
"<b>support@sourcetrail.com</b><br />"
"<b><a href=\"https://sourcetrail.com\" style=\"color: "
"white;\">sourcetrail.com</a></b>"));
"Jakob-Haringer-Straße 1/127<br />"
"5020 Salzburg<br />"
"Austria<br />"
"<b>support@sourcetrail.com</b><br />"
"<b><a href=\"https://sourcetrail.com\" style=\"color: "
"white;\">sourcetrail.com</a></b>"));
companyLabel->setOpenExternalLinks(true);
layoutHorz1->addWidget(companyLabel);
@@ -82,20 +82,20 @@ void QtAbout::setupAbout()
QLabel* developerLabel = new QLabel(
QStringLiteral("<br /><br />"
"<b>Team:</b><br />"
"Manuel Dobusch<br />"
"Eberhard Gräther<br />"
"Malte Langkabel<br />"
"Viktoria Pfausler<br />"
"Andreas Stallinger<br />"));
"<b>Team:</b><br />"
"Manuel Dobusch<br />"
"Eberhard Gräther<br />"
"Malte Langkabel<br />"
"Viktoria Pfausler<br />"
"Andreas Stallinger<br />"));
developerLabel->setObjectName(QStringLiteral("small"));
layoutHorz1->addWidget(developerLabel);
}
windowLayout->addStretch();
QLabel* acknowledgementsLabel = new QLabel(
QStringLiteral("<b>Acknowledgements:</b><br />"
QLabel* acknowledgementsLabel = new QLabel(QStringLiteral(
"<b>Acknowledgements:</b><br />"
"Sourcetrail (aka Coati) 0.1 was created in the context of education at "
"<a href=\"http://www.fh-salzburg.ac.at/en/\" style=\"color: white;\">Salzburg University "
"of Applied Sciences</a>.<br />"
+2 -2
View File
@@ -29,8 +29,8 @@ void QtBookmarkCreator::setupBookmarkCreator()
{
// title
QLabel* title = new QLabel(m_editBookmarkId ?
QStringLiteral("Edit Bookmark") : QStringLiteral("Create Bookmark"));
QLabel* title = new QLabel(
m_editBookmarkId ? QStringLiteral("Edit Bookmark") : QStringLiteral("Create Bookmark"));
title->setObjectName(QStringLiteral("creator_title_label"));
mainLayout->addWidget(title);
}
+1 -1
View File
@@ -19,7 +19,7 @@ class QtIndexingDialog: public QtWindowBase
protected:
static QBoxLayout* createLayout(QWidget* parent);
static QLabel* createTitleLabel(const QString &title, QBoxLayout* layout);
static QLabel* createTitleLabel(const QString& title, QBoxLayout* layout);
static QLabel* createMessageLabel(QBoxLayout* layout);
static QWidget* createErrorWidget(QBoxLayout* layout);
static QLabel* createFlagLabel(QWidget* parent);
@@ -86,7 +86,8 @@ void QtIndexingProgressDialog::updateErrorCount(size_t errorCount, size_t fatalC
str += " (" + QString::number(fatalCount) + " Fatal)";
}
QPushButton* errorCount = m_errorWidget->findChild<QPushButton*>(QStringLiteral("errorCount"));
QPushButton* errorCount = m_errorWidget->findChild<QPushButton*>(
QStringLiteral("errorCount"));
errorCount->setText(str);
m_errorWidget->show();
@@ -73,7 +73,8 @@ QtIndexingReportDialog::QtIndexingReportDialog(
}
else if (shallow)
{
QPushButton* startInDepthButton = new QPushButton(QStringLiteral("Start In-Depth Indexing"));
QPushButton* startInDepthButton = new QPushButton(
QStringLiteral("Start In-Depth Indexing"));
startInDepthButton->setObjectName(QStringLiteral("windowButton"));
connect(
startInDepthButton,
@@ -86,8 +87,8 @@ QtIndexingReportDialog::QtIndexingReportDialog(
buttons->addStretch();
QPushButton* confirmButton = new QPushButton(
interrupted ? QStringLiteral("Keep") :
(shallow ? QStringLiteral("Later") : QStringLiteral("OK")));
interrupted ? QStringLiteral("Keep")
: (shallow ? QStringLiteral("Later") : QStringLiteral("OK")));
confirmButton->setObjectName(QStringLiteral("windowButton"));
confirmButton->setDefault(true);
connect(
@@ -125,7 +126,8 @@ void QtIndexingReportDialog::updateErrorCount(size_t errorCount, size_t fatalCou
str += QStringLiteral(" (") + QString::number(fatalCount) + QStringLiteral(" Fatal)");
}
QPushButton* errorCount = m_errorWidget->findChild<QPushButton*>(QStringLiteral("errorCount"));
QPushButton* errorCount = m_errorWidget->findChild<QPushButton*>(
QStringLiteral("errorCount"));
errorCount->setText(str);
m_errorWidget->show();
+4 -3
View File
@@ -520,13 +520,14 @@ void QtMainWindow::showErrorHelpMessage()
void QtMainWindow::showChangelog()
{
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/blob/master/CHANGELOG.md")));
QDesktopServices::openUrl(QUrl(
QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/blob/master/CHANGELOG.md")));
}
void QtMainWindow::showBugtracker()
{
QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/issues")));
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail/issues")));
}
void QtMainWindow::showLicenses()
+4 -3
View File
@@ -202,8 +202,8 @@ void QtStartScreen::setupStartScreen()
githubButton->setIcon(m_githubIcon);
githubButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(githubButton, &QPushButton::clicked, []() {
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail"), QUrl::TolerantMode));
QDesktopServices::openUrl(QUrl(
QStringLiteral("https://github.com/CoatiSoftware/Sourcetrail"), QUrl::TolerantMode));
});
col->addWidget(githubButton);
@@ -216,7 +216,8 @@ void QtStartScreen::setupStartScreen()
patreonButton->setIcon(m_patreonIcon);
patreonButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(patreonButton, &QPushButton::clicked, []() {
QDesktopServices::openUrl(QUrl(QStringLiteral("https://www.patreon.com/sourcetrail"), QUrl::TolerantMode));
QDesktopServices::openUrl(
QUrl(QStringLiteral("https://www.patreon.com/sourcetrail"), QUrl::TolerantMode));
});
col->addWidget(patreonButton);
+4 -4
View File
@@ -114,7 +114,7 @@ std::wstring QtWindow::getTitle() const
return L"";
}
void QtWindow::updateSubTitle(QString subTitle)
void QtWindow::updateSubTitle(const QString& subTitle)
{
if (m_subTitle)
{
@@ -122,7 +122,7 @@ void QtWindow::updateSubTitle(QString subTitle)
}
}
void QtWindow::updateNextButton(QString text)
void QtWindow::updateNextButton(const QString& text)
{
if (m_nextButton)
{
@@ -130,7 +130,7 @@ void QtWindow::updateNextButton(QString text)
}
}
void QtWindow::updatePreviousButton(QString text)
void QtWindow::updatePreviousButton(const QString& text)
{
if (m_previousButton)
{
@@ -138,7 +138,7 @@ void QtWindow::updatePreviousButton(QString text)
}
}
void QtWindow::updateCloseButton(QString text)
void QtWindow::updateCloseButton(const QString& text)
{
if (m_closeButton)
{
+4 -4
View File
@@ -29,11 +29,11 @@ public:
void updateTitle(const QString& title);
std::wstring getTitle() const;
void updateSubTitle(QString subTitle);
void updateSubTitle(const QString& subTitle);
void updateNextButton(QString text);
void updatePreviousButton(QString text);
void updateCloseButton(QString text);
void updateNextButton(const QString& text);
void updatePreviousButton(const QString& text);
void updateCloseButton(const QString& text);
void setNextEnabled(bool enabled);
void setPreviousEnabled(bool enabled);
@@ -35,7 +35,7 @@ std::vector<FilePath> CombinedPathDetector::getPaths() const
return std::vector<FilePath>();
}
std::vector<FilePath> CombinedPathDetector::getPaths(std::string detectorName) const
std::vector<FilePath> CombinedPathDetector::getPaths(const std::string& detectorName) const
{
for (const std::shared_ptr<PathDetector>& detector: m_detectors)
{
@@ -18,7 +18,7 @@ public:
std::vector<std::string> getWorkingDetectorNames();
std::vector<FilePath> getPaths() const override;
std::vector<FilePath> getPaths(std::string detectorName) const;
std::vector<FilePath> getPaths(const std::string& detectorName) const;
private:
std::vector<std::shared_ptr<PathDetector>> m_detectors;

Some files were not shown because too many files have changed in this diff Show More