ui: Added show errors button to title bar of incomplete files (issue #246)
* Shows all errors within the file and all included files.
This commit is contained in:
@@ -305,7 +305,7 @@ void QtCodeFile::setWholeFile(bool isWholeFile, int refCount)
|
||||
|
||||
void QtCodeFile::setIsComplete(bool isComplete)
|
||||
{
|
||||
m_titleBar->getTitleButton()->setIsComplete(isComplete);
|
||||
m_titleBar->setIsComplete(isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFile::setMinimized()
|
||||
|
||||
@@ -304,13 +304,13 @@ void QtCodeFileSingle::setFileData(const FileData& file)
|
||||
if (!file.title.empty())
|
||||
{
|
||||
titleButton->setProject(file.title);
|
||||
titleButton->setIsComplete(true);
|
||||
m_titleBar->setIsComplete(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
titleButton->setFilePath(file.filePath);
|
||||
titleButton->setModificationTime(file.modificationTime);
|
||||
titleButton->setIsComplete(file.isComplete);
|
||||
m_titleBar->setIsComplete(file.isComplete);
|
||||
}
|
||||
|
||||
updateRefCount(m_area->getActiveLocationCount());
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QVariant>
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/messaging/type/MessageShowErrorsForFile.h"
|
||||
|
||||
QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool isSingle)
|
||||
: QtHoverButton(parent)
|
||||
@@ -41,6 +42,20 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
|
||||
titleLayout->addStretch(3);
|
||||
|
||||
m_showErrorsButton = new QPushButton("show errors");
|
||||
m_showErrorsButton->setObjectName("screen_button");
|
||||
m_showErrorsButton->setToolTip("Show all errors related to this file");
|
||||
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_showErrorsButton->hide();
|
||||
titleLayout->addWidget(m_showErrorsButton);
|
||||
|
||||
connect(m_showErrorsButton, &QPushButton::clicked,
|
||||
[this]()
|
||||
{
|
||||
MessageShowErrorsForFile(m_titleButton->getFilePath()).dispatch();
|
||||
}
|
||||
);
|
||||
|
||||
FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/");
|
||||
QColor inactiveColor(0x5E, 0x5D, 0x5D);
|
||||
|
||||
@@ -94,6 +109,12 @@ QtCodeFileTitleButton* QtCodeFileTitleBar::getTitleButton() const
|
||||
return m_titleButton;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::setIsComplete(bool isComplete)
|
||||
{
|
||||
m_titleButton->setIsComplete(isComplete);
|
||||
m_showErrorsButton->setVisible(!isComplete);
|
||||
}
|
||||
|
||||
void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount)
|
||||
{
|
||||
if (refCount > 0)
|
||||
@@ -158,6 +179,7 @@ void QtCodeFileTitleBar::setMaximized()
|
||||
void QtCodeFileTitleBar::updateFromOther(const QtCodeFileTitleBar* other)
|
||||
{
|
||||
m_titleButton->updateFromOther(other->getTitleButton());
|
||||
setIsComplete(m_titleButton->isComplete());
|
||||
|
||||
QString refString = other->m_referenceCount->text();
|
||||
if (refString.size())
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
|
||||
QtCodeFileTitleButton* getTitleButton() const;
|
||||
|
||||
void setIsComplete(bool isComplete);
|
||||
void updateRefCount(int refCount, bool hasErrors, size_t fatalErrorCount);
|
||||
|
||||
void setMinimized();
|
||||
@@ -43,6 +44,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QtCodeFileTitleButton* m_titleButton;
|
||||
QPushButton* m_showErrorsButton;
|
||||
QLabel* m_referenceCount;
|
||||
|
||||
QtIconStateButton* m_minimizeButton;
|
||||
|
||||
@@ -32,6 +32,11 @@ QtCodeFileTitleButton::~QtCodeFileTitleButton()
|
||||
{
|
||||
}
|
||||
|
||||
const FilePath& QtCodeFileTitleButton::getFilePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setFilePath(const FilePath& filePath)
|
||||
{
|
||||
setEnabled(true);
|
||||
@@ -56,6 +61,24 @@ void QtCodeFileTitleButton::setModificationTime(const TimeStamp modificationTime
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setProject(const std::wstring& name)
|
||||
{
|
||||
m_filePath = FilePath();
|
||||
|
||||
setText(QString::fromStdWString(name));
|
||||
setToolTip("edit project");
|
||||
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
|
||||
bool QtCodeFileTitleButton::isComplete() const
|
||||
{
|
||||
return m_isComplete;
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
{
|
||||
if (m_isComplete == isComplete)
|
||||
@@ -82,19 +105,6 @@ void QtCodeFileTitleButton::setIsComplete(bool isComplete)
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::setProject(const std::wstring& name)
|
||||
{
|
||||
m_filePath = FilePath();
|
||||
|
||||
setText(QString::fromStdWString(name));
|
||||
setToolTip("edit project");
|
||||
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateTexts()
|
||||
{
|
||||
if (m_filePath.empty())
|
||||
|
||||
@@ -15,11 +15,15 @@ public:
|
||||
QtCodeFileTitleButton(QWidget* parent = nullptr);
|
||||
virtual ~QtCodeFileTitleButton();
|
||||
|
||||
const FilePath& getFilePath() const;
|
||||
void setFilePath(const FilePath& filePath);
|
||||
|
||||
void setModificationTime(const TimeStamp modificationTime);
|
||||
void setIsComplete(bool isComplete);
|
||||
void setProject(const std::wstring& name);
|
||||
|
||||
bool isComplete() const;
|
||||
void setIsComplete(bool isComplete);
|
||||
|
||||
void updateTexts();
|
||||
|
||||
void updateFromOther(const QtCodeFileTitleButton* other);
|
||||
|
||||
@@ -158,6 +158,7 @@ void QtErrorView::initView()
|
||||
|
||||
{
|
||||
m_allButton = new QPushButton("");
|
||||
m_allButton->setObjectName("screen_button");
|
||||
connect(m_allButton, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
@@ -173,17 +174,17 @@ void QtErrorView::initView()
|
||||
|
||||
|
||||
{
|
||||
QPushButton* editButton = new QPushButton("Edit Project");
|
||||
connect(editButton, &QPushButton::clicked,
|
||||
m_editButton = new QPushButton("Edit Project");
|
||||
m_editButton->setObjectName("screen_button");
|
||||
connect(m_editButton, &QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
MessageProjectEdit().dispatch();
|
||||
}
|
||||
);
|
||||
checkboxes->addWidget(editButton);
|
||||
checkboxes->addWidget(m_editButton);
|
||||
|
||||
editButton->setToolTip("edit project");
|
||||
editButton->setIcon(QPixmap(QString::fromStdWString(ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png").wstr())));
|
||||
m_editButton->setToolTip("edit project");
|
||||
}
|
||||
|
||||
checkboxes->addSpacing(10);
|
||||
@@ -308,6 +309,11 @@ void QtErrorView::setStyleSheet() const
|
||||
|
||||
m_helpButton->setColor(QColor(ColorScheme::getInstance()->getColor("table/text/normal").c_str()));
|
||||
|
||||
m_editButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/edit.png"),
|
||||
"window/button"
|
||||
));
|
||||
|
||||
m_table->updateRows();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ private:
|
||||
QCheckBox* m_showNonIndexedFatals;
|
||||
|
||||
QtHelpButton* m_helpButton;
|
||||
QPushButton* m_editButton;
|
||||
|
||||
QStandardItemModel* m_model;
|
||||
QtTable* m_table;
|
||||
|
||||
@@ -63,6 +63,7 @@ void QtStatusView::initView()
|
||||
filters->addStretch();
|
||||
|
||||
QPushButton* clearButton = new QPushButton("Clear Table");
|
||||
clearButton->setObjectName("screen_button");
|
||||
connect(clearButton, &QPushButton::clicked,
|
||||
[=]()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user