This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "ApplicationSettings.h"
|
||||
#include "DialogView.h"
|
||||
#include "Project.h"
|
||||
#include "QtHelpButtonInfo.h"
|
||||
#include "StorageAccess.h"
|
||||
#include "TabId.h"
|
||||
|
||||
@@ -140,7 +141,7 @@ void ErrorController::handleMessage(MessageErrorsHelpMessage* message)
|
||||
appSettings->setSeenErrorHelpMessage(true);
|
||||
appSettings->save();
|
||||
|
||||
getView()->showErrorHelpMessage();
|
||||
m_onQtThread([=]() { createErrorHelpButtonInfo().displayMessage(); });
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageIndexingFinished* message)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "MessageIndexingStarted.h"
|
||||
#include "MessageListener.h"
|
||||
#include "MessageShowError.h"
|
||||
#include "QtThreadedFunctor.h"
|
||||
|
||||
#include "Controller.h"
|
||||
#include "ErrorView.h"
|
||||
@@ -62,6 +63,7 @@ private:
|
||||
std::map<Id, bool> m_tabShowsErrors;
|
||||
std::map<Id, FilePath> m_tabActiveFilePath;
|
||||
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
bool m_newErrorsAdded = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ public:
|
||||
const std::vector<ErrorInfo>& errors, const ErrorCountInfo& errorCount, bool scrollTo) = 0;
|
||||
virtual void setErrorId(Id errorId) = 0;
|
||||
|
||||
virtual void showErrorHelpMessage() = 0;
|
||||
|
||||
virtual ErrorFilter getErrorFilter() const = 0;
|
||||
virtual void setErrorFilter(const ErrorFilter& filter) = 0;
|
||||
};
|
||||
|
||||
@@ -192,6 +192,8 @@ add_files(
|
||||
qt/utility/QtFilesAndDirectoriesDialog.h
|
||||
qt/utility/QtFlowLayout.cpp
|
||||
qt/utility/QtFlowLayout.h
|
||||
qt/utility/QtHelpButtonInfo.cpp
|
||||
qt/utility/QtHelpButtonInfo.h
|
||||
qt/utility/QtHighlighter.cpp
|
||||
qt/utility/QtHighlighter.h
|
||||
qt/utility/QtScrollSpeedChangeListener.cpp
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
#include "QtHelpButton.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ResourcePaths.h"
|
||||
|
||||
QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent)
|
||||
QtHelpButton::QtHelpButton(const QtHelpButtonInfo& info, QWidget* parent)
|
||||
: QtIconButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help.png"),
|
||||
ResourcePaths::getGuiPath().concatenate(L"window/help_hover.png"),
|
||||
parent)
|
||||
, m_helpTitle(helpTitle)
|
||||
, m_helpText(helpText)
|
||||
, m_info(info)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
@@ -27,12 +24,5 @@ QtHelpButton::QtHelpButton(const QString& helpTitle, const QString& helpText, QW
|
||||
|
||||
void QtHelpButton::handleHelpPress()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(QStringLiteral("Sourcetrail"));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setText("<b>" + m_helpTitle + "</b>");
|
||||
msgBox.setInformativeText(m_helpText);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
m_info.displayMessage();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef QT_HELP_BUTTON_H
|
||||
#define QT_HELP_BUTTON_H
|
||||
|
||||
#include "QtHelpButtonInfo.h"
|
||||
#include "QtIconButton.h"
|
||||
|
||||
class QtHelpButton: public QtIconButton
|
||||
@@ -8,14 +9,13 @@ class QtHelpButton: public QtIconButton
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtHelpButton(const QString& helpTitle, const QString& helpText, QWidget* parent = nullptr);
|
||||
QtHelpButton(const QtHelpButtonInfo& info, QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void handleHelpPress();
|
||||
|
||||
private:
|
||||
QString m_helpTitle;
|
||||
QString m_helpText;
|
||||
QtHelpButtonInfo m_info;
|
||||
};
|
||||
|
||||
#endif // QT_HELP_BUTTON_H
|
||||
|
||||
@@ -90,7 +90,7 @@ QToolButton* QtProjectWizardContent::createSourceGroupButton(QString name, QStri
|
||||
QtHelpButton* QtProjectWizardContent::addHelpButton(
|
||||
const QString& helpTitle, const QString& helpText, QGridLayout* layout, int row) const
|
||||
{
|
||||
QtHelpButton* button = new QtHelpButton(helpTitle, helpText);
|
||||
QtHelpButton* button = new QtHelpButton(QtHelpButtonInfo(helpTitle, helpText));
|
||||
layout->addWidget(button, row, QtProjectWizardWindow::HELP_COL, Qt::AlignTop);
|
||||
return button;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "QtHelpButtonInfo.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
QtHelpButtonInfo::QtHelpButtonInfo(const QString& title, const QString& text)
|
||||
: m_title(title), m_text(text)
|
||||
{
|
||||
}
|
||||
|
||||
void QtHelpButtonInfo::displayMessage()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(QStringLiteral("Sourcetrail"));
|
||||
msgBox.setIcon(QMessageBox::Information);
|
||||
msgBox.setText("<b>" + m_title + "</b>");
|
||||
msgBox.setInformativeText(m_text);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
QtHelpButtonInfo createErrorHelpButtonInfo()
|
||||
{
|
||||
return QtHelpButtonInfo(
|
||||
QStringLiteral("Fixing Errors"),
|
||||
QStringLiteral(
|
||||
"Please read this if your project is showing errors after indexing.<br />"
|
||||
"There are different types of errors:"
|
||||
"<ul>"
|
||||
"<li><b>Fatals</b> cause the indexer to stop. All or big parts of indexed "
|
||||
"information "
|
||||
"for the involved "
|
||||
"source file is missing. <b>Make sure to fix all fatals.</li>"
|
||||
"<li><b>Errors</b> are issues that the indexer considers as wrong code. Usually "
|
||||
"the "
|
||||
"indexer is able to "
|
||||
"recover from these errors. The indexed information of the involved source file "
|
||||
"may "
|
||||
"not be complete, but "
|
||||
"it is still useful.</li>"
|
||||
"</ul>"
|
||||
"You need to edit your Sourcetrail project and reindex it to fix errors. The "
|
||||
"displayed "
|
||||
"error messages are "
|
||||
"generated by Sourcetrail's language specific indexers:"
|
||||
"<ul>"
|
||||
"<li><b>C/C++</b> error messages are generated by the <b>clang compiler "
|
||||
"frontend</b>.</li>"
|
||||
"<li><b>Java</b> error messages are generated by the <b>Eclipse JDT "
|
||||
"library</b>.</li>"
|
||||
"<li><b>Python</b> error messages are generated by the <b>Jedi static analysis "
|
||||
"library</b>.</li>"
|
||||
"</ul>"
|
||||
"You should be able to find information about errors you are not familiar with "
|
||||
"online. "
|
||||
"<b>Double click</b> "
|
||||
"an error message in the table to select it for <b>copying</b>.<br />"));
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef QT_HELP_BUTTON_INFO_H
|
||||
#define QT_HELP_BUTTON_INFO_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QtHelpButtonInfo
|
||||
{
|
||||
public:
|
||||
QtHelpButtonInfo(const QString& helpTitle, const QString& helpText);
|
||||
|
||||
void displayMessage();
|
||||
|
||||
private:
|
||||
QString m_title;
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
QtHelpButtonInfo createErrorHelpButtonInfo();
|
||||
|
||||
#endif // QT_HELP_BUTTON_INFO_H
|
||||
@@ -57,12 +57,8 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout)
|
||||
m_table->setColumnHidden(Column::ID, true);
|
||||
|
||||
QStringList headers;
|
||||
headers << QStringLiteral("ID")
|
||||
<< QStringLiteral("Type")
|
||||
<< QStringLiteral("Message")
|
||||
<< QStringLiteral("File")
|
||||
<< QStringLiteral("Line")
|
||||
<< QStringLiteral("Indexed")
|
||||
headers << QStringLiteral("ID") << QStringLiteral("Type") << QStringLiteral("Message")
|
||||
<< QStringLiteral("File") << QStringLiteral("Line") << QStringLiteral("Indexed")
|
||||
<< QStringLiteral("Translation Unit");
|
||||
m_model->setHorizontalHeaderLabels(headers);
|
||||
|
||||
@@ -88,40 +84,16 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout)
|
||||
checkboxes->setSpacing(0);
|
||||
|
||||
{
|
||||
m_showFatals = createFilterCheckbox(QStringLiteral("Fatals"), m_errorFilter.fatal, checkboxes);
|
||||
m_showErrors = createFilterCheckbox(QStringLiteral("Errors"), m_errorFilter.error, checkboxes);
|
||||
m_showFatals = createFilterCheckbox(
|
||||
QStringLiteral("Fatals"), m_errorFilter.fatal, checkboxes);
|
||||
m_showErrors = createFilterCheckbox(
|
||||
QStringLiteral("Errors"), m_errorFilter.error, checkboxes);
|
||||
m_showNonIndexedFatals = createFilterCheckbox(
|
||||
QStringLiteral("Fatals in non-indexed files"), m_errorFilter.unindexedFatal, checkboxes);
|
||||
m_showNonIndexedErrors = createFilterCheckbox(
|
||||
QStringLiteral("Errors in non-indexed files"), m_errorFilter.unindexedError, checkboxes);
|
||||
|
||||
m_helpButton = new QtHelpButton(
|
||||
QStringLiteral("Fixing Errors"),
|
||||
QStringLiteral("Please read this if your project is showing errors after indexing.<br />"
|
||||
"There are different types of errors:"
|
||||
"<ul>"
|
||||
"<li><b>Fatals</b> cause the indexer to stop. All or big parts of indexed information "
|
||||
"for the involved "
|
||||
"source file is missing. <b>Make sure to fix all fatals.</li>"
|
||||
"<li><b>Errors</b> are issues that the indexer considers as wrong code. Usually the "
|
||||
"indexer is able to "
|
||||
"recover from these errors. The indexed information of the involved source file may "
|
||||
"not be complete, but "
|
||||
"it is still useful.</li>"
|
||||
"</ul>"
|
||||
"You need to edit your Sourcetrail project and reindex it to fix errors. The displayed "
|
||||
"error messages are "
|
||||
"generated by Sourcetrail's language specific indexers:"
|
||||
"<ul>"
|
||||
"<li><b>C/C++</b> error messages are generated by the <b>clang compiler "
|
||||
"frontend</b>.</li>"
|
||||
"<li><b>Java</b> error messages are generated by the <b>Eclipse JDT library</b>.</li>"
|
||||
"<li><b>Python</b> error messages are generated by the <b>Jedi static analysis "
|
||||
"library</b>.</li>"
|
||||
"</ul>"
|
||||
"You should be able to find information about errors you are not familiar with online. "
|
||||
"<b>Double click</b> "
|
||||
"an error message in the table to select it for <b>copying</b>.<br />"));
|
||||
m_helpButton = new QtHelpButton(createErrorHelpButtonInfo());
|
||||
m_helpButton->setObjectName(QStringLiteral("help_button"));
|
||||
checkboxes->addWidget(m_helpButton);
|
||||
}
|
||||
@@ -222,7 +194,8 @@ void QtErrorView::addErrors(
|
||||
m_errorLabel->setText(
|
||||
"<b>displaying " + QString::number(errorCount.total) + " error" +
|
||||
(errorCount.total != 1 ? "s" : "") +
|
||||
(errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)" : QLatin1String("")) +
|
||||
(errorCount.fatal > 0 ? " (" + QString::number(errorCount.fatal) + " fatal)"
|
||||
: QLatin1String("")) +
|
||||
"</b>");
|
||||
});
|
||||
}
|
||||
@@ -240,11 +213,6 @@ void QtErrorView::setErrorId(Id errorId)
|
||||
});
|
||||
}
|
||||
|
||||
void QtErrorView::showErrorHelpMessage()
|
||||
{
|
||||
m_onQtThread([=]() { m_helpButton->click(); });
|
||||
}
|
||||
|
||||
ErrorFilter QtErrorView::getErrorFilter() const
|
||||
{
|
||||
return m_errorFilter;
|
||||
@@ -328,8 +296,10 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error)
|
||||
item->setData(QVariant(qlonglong(error.id)), Qt::DisplayRole);
|
||||
m_model->setItem(rowNumber, Column::ID, item);
|
||||
|
||||
m_model->setItem(rowNumber, Column::TYPE, new QStandardItem(error.fatal ?
|
||||
QStringLiteral("FATAL") : QStringLiteral("ERROR")));
|
||||
m_model->setItem(
|
||||
rowNumber,
|
||||
Column::TYPE,
|
||||
new QStandardItem(error.fatal ? QStringLiteral("FATAL") : QStringLiteral("ERROR")));
|
||||
if (error.fatal)
|
||||
{
|
||||
m_model->item(rowNumber, Column::TYPE)->setForeground(QBrush(Qt::red));
|
||||
@@ -347,8 +317,10 @@ void QtErrorView::addErrorToTable(const ErrorInfo& error)
|
||||
item->setData(QVariant(qlonglong(error.lineNumber)), Qt::DisplayRole);
|
||||
m_model->setItem(rowNumber, Column::LINE, item);
|
||||
|
||||
m_model->setItem(rowNumber, Column::INDEXED, new QStandardItem(error.indexed ?
|
||||
QStringLiteral("yes") : QStringLiteral("no")));
|
||||
m_model->setItem(
|
||||
rowNumber,
|
||||
Column::INDEXED,
|
||||
new QStandardItem(error.indexed ? QStringLiteral("yes") : QStringLiteral("no")));
|
||||
|
||||
m_model->setItem(
|
||||
rowNumber,
|
||||
|
||||
@@ -39,8 +39,6 @@ public:
|
||||
const std::vector<ErrorInfo>& errors, const ErrorCountInfo& errorCount, bool scrollTo) override;
|
||||
void setErrorId(Id errorId) override;
|
||||
|
||||
void showErrorHelpMessage() override;
|
||||
|
||||
ErrorFilter getErrorFilter() const override;
|
||||
void setErrorFilter(const ErrorFilter& filter) override;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ResourcePaths.h"
|
||||
#include "utilityQt.h"
|
||||
|
||||
QLabel* QtIndexingDialog::createTitleLabel(const QString &title, QBoxLayout* layout)
|
||||
QLabel* QtIndexingDialog::createTitleLabel(const QString& title, QBoxLayout* layout)
|
||||
{
|
||||
QLabel* label = new QLabel(title);
|
||||
label->setObjectName(QStringLiteral("title"));
|
||||
@@ -48,12 +48,8 @@ QWidget* QtIndexingDialog::createErrorWidget(QBoxLayout* layout)
|
||||
ResourcePaths::getGuiPath().concatenate(L"indexing_dialog/error.png").wstr())));
|
||||
errorLayout->addWidget(errorCount);
|
||||
|
||||
QtHelpButton* helpButton = new QtHelpButton(QStringLiteral("aaa"), QStringLiteral("bbb"));
|
||||
QtHelpButton* helpButton = new QtHelpButton(QtHelpButtonInfo(createErrorHelpButtonInfo()));
|
||||
helpButton->setColor(Qt::white);
|
||||
|
||||
helpButton->disconnect();
|
||||
connect(helpButton, &QtHelpButton::clicked, []() { MessageErrorsHelpMessage(true).dispatch(); });
|
||||
|
||||
errorLayout->addWidget(helpButton);
|
||||
|
||||
layout->addWidget(errorWidget, 0, Qt::AlignRight);
|
||||
@@ -83,9 +79,9 @@ QtIndexingDialog::QtIndexingDialog(bool isSubWindow, QWidget* parent)
|
||||
m_window->setStyleSheet(
|
||||
m_window->styleSheet() +
|
||||
QStringLiteral("#window { "
|
||||
"background: #2E3C86;"
|
||||
"border: none;"
|
||||
"}"));
|
||||
"background: #2E3C86;"
|
||||
"border: none;"
|
||||
"}"));
|
||||
|
||||
setStyleSheet(
|
||||
(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"window/window.css")) +
|
||||
|
||||
@@ -41,7 +41,7 @@ QtIndexingStartDialog::QtIndexingStartDialog(
|
||||
modeLabel->setText(QStringLiteral("Mode:"));
|
||||
modeLabel->setAlignment(Qt::AlignLeft);
|
||||
|
||||
QtHelpButton* helpButton = new QtHelpButton(
|
||||
QtHelpButton* helpButton = new QtHelpButton(QtHelpButtonInfo(
|
||||
QStringLiteral("Indexing Modes"),
|
||||
QString("<b>Updated files:</b> Reindexes all files that were modified since the last "
|
||||
"indexing, all new files and all files depending "
|
||||
@@ -58,7 +58,7 @@ QtIndexingStartDialog::QtIndexingStartDialog(
|
||||
"<i>Hint: Use this option for a quick first indexing pass and start browsing "
|
||||
"the code base "
|
||||
"while running a second pass for in-depth indexing.<br /><br />"
|
||||
: ""));
|
||||
: "")));
|
||||
helpButton->setColor(Qt::white);
|
||||
modeTitleLayout->addWidget(helpButton);
|
||||
|
||||
@@ -67,9 +67,11 @@ QtIndexingStartDialog::QtIndexingStartDialog(
|
||||
modeLayout->addLayout(modeTitleLayout);
|
||||
modeLayout->addSpacing(5);
|
||||
|
||||
m_refreshModeButtons.emplace(REFRESH_UPDATED_FILES, new QRadioButton(QStringLiteral("Updated files")));
|
||||
m_refreshModeButtons.emplace(
|
||||
REFRESH_UPDATED_AND_INCOMPLETE_FILES, new QRadioButton(QStringLiteral("Incomplete && updated files")));
|
||||
REFRESH_UPDATED_FILES, new QRadioButton(QStringLiteral("Updated files")));
|
||||
m_refreshModeButtons.emplace(
|
||||
REFRESH_UPDATED_AND_INCOMPLETE_FILES,
|
||||
new QRadioButton(QStringLiteral("Incomplete && updated files")));
|
||||
m_refreshModeButtons.emplace(REFRESH_ALL_FILES, new QRadioButton(QStringLiteral("All files")));
|
||||
|
||||
std::function<void(bool)> func = [=](bool checked) {
|
||||
@@ -108,7 +110,8 @@ QtIndexingStartDialog::QtIndexingStartDialog(
|
||||
|
||||
if (enabledShallowOption)
|
||||
{
|
||||
QCheckBox* shallowIndexingCheckBox = new QCheckBox(QStringLiteral("Shallow Python Indexing"));
|
||||
QCheckBox* shallowIndexingCheckBox = new QCheckBox(
|
||||
QStringLiteral("Shallow Python Indexing"));
|
||||
connect(shallowIndexingCheckBox, &QCheckBox::toggled, [=]() {
|
||||
emit setShallowIndexing(shallowIndexingCheckBox->isChecked());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user