data: saving errors to Storage
* saving errors in separate sqlite table * use MessageShowErrors to show the errors in the UI * show error count permanently in the right side of the status bar with click to show * fixed clicking of error locations * fixed expanding of files with errors
This commit is contained in:
@@ -36,8 +36,8 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
QRect scrollbarArea(scrollbar->pos(), scrollbar->size());
|
||||
QPoint globalMousePos = dynamic_cast<QWheelEvent*>(event)->globalPos();
|
||||
QPoint localMousePos = scrollbar->mapFromGlobal(globalMousePos);
|
||||
|
||||
// instead of "scrollbar->underMouse()" we need this check implemented here because "underMouse()"
|
||||
|
||||
// instead of "scrollbar->underMouse()" we need this check implemented here because "underMouse()"
|
||||
// does not work when the mouse enters the area without being moved
|
||||
if (scrollbarArea.contains(localMousePos))
|
||||
{
|
||||
@@ -114,7 +114,7 @@ QtCodeArea::QtCodeArea(
|
||||
this->setMouseTracking(true);
|
||||
|
||||
// MouseWheelOverScrollbarFilter is deleted by parent.
|
||||
horizontalScrollBar()->installEventFilter(new MouseWheelOverScrollbarFilter(this));
|
||||
horizontalScrollBar()->installEventFilter(new MouseWheelOverScrollbarFilter(this));
|
||||
}
|
||||
|
||||
QtCodeArea::~QtCodeArea()
|
||||
@@ -289,7 +289,7 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
QTextCursor cursor = this->cursorForPosition(event->pos());
|
||||
std::vector<Id> locationIds = findLocationIdsForPosition(cursor.position());
|
||||
if (locationIds.size())
|
||||
if (locationIds.size() && !m_fileWidget->getErrorMessages().size())
|
||||
{
|
||||
MessageActivateTokenLocations(locationIds).dispatch();
|
||||
}
|
||||
@@ -301,7 +301,7 @@ void QtCodeArea::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
MessageShowFile(m_fileWidget->getFilePath().str(), m_startLineNumber, m_startLineNumber + blockCount() - 1).dispatch();
|
||||
MessageShowFile(m_fileWidget->getFilePath().str(), (m_fileWidget->getErrorMessages().size() > 0)).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +382,7 @@ void QtCodeFile::clickedMaximizeButton()
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageShowFile(m_filePath, 0, 0).dispatch();
|
||||
MessageShowFile(m_filePath, (getErrorMessages().size() > 0)).dispatch();
|
||||
}
|
||||
|
||||
m_minimizeButton->setEnabled(true);
|
||||
@@ -449,7 +449,7 @@ void QtCodeFile::doUpdateTitleBar()
|
||||
m_title->setStyleSheet("background-image: url(data/gui/code_view/images/pattern.png);");
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
m_title->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ void QtCodeSnippet::clickedTitle()
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageShowFile(FilePath(m_titleString), 0, 0).dispatch();
|
||||
MessageShowFile(FilePath(m_titleString), (dynamic_cast<QtCodeFile*>(parent())->getErrorMessages().size() > 0)).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <QMovie>
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
|
||||
QtStatusBar::QtStatusBar()
|
||||
: m_text(this)
|
||||
{
|
||||
@@ -19,6 +22,17 @@ QtStatusBar::QtStatusBar()
|
||||
|
||||
m_text.setText("");
|
||||
addWidget(&m_text);
|
||||
|
||||
m_errorButton.hide();
|
||||
m_errorButton.setFlat(true);
|
||||
m_errorButton.setStyleSheet("QPushButton { color: #D00000; margin-right: 0; spacing: none; }");
|
||||
m_errorButton.setIcon(utility::colorizePixmap(
|
||||
QPixmap("data/gui/statusbar_view/octagon.png"),
|
||||
"#D00000"
|
||||
).scaledToHeight(10));
|
||||
addPermanentWidget(&m_errorButton);
|
||||
|
||||
connect(&m_errorButton, SIGNAL(clicked()), this, SLOT(showErrors()));
|
||||
}
|
||||
|
||||
QtStatusBar::~QtStatusBar()
|
||||
@@ -29,7 +43,7 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
|
||||
{
|
||||
if (isError)
|
||||
{
|
||||
m_text.setStyleSheet("QLabel { color: #E00000 }");
|
||||
m_text.setStyleSheet("QLabel { color: #D00000 }");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -47,3 +61,21 @@ void QtStatusBar::setText(const std::string& text, bool isError, bool showLoader
|
||||
|
||||
m_text.setText(text.c_str());
|
||||
}
|
||||
|
||||
void QtStatusBar::setErrorCount(size_t count)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
m_errorButton.setText(QString::number(count) + " error(s)");
|
||||
m_errorButton.show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_errorButton.hide();
|
||||
}
|
||||
}
|
||||
|
||||
void QtStatusBar::showErrors()
|
||||
{
|
||||
MessageShowErrors().dispatch();
|
||||
}
|
||||
|
||||
@@ -2,21 +2,30 @@
|
||||
#define QT_STATUS_BAR_H
|
||||
|
||||
#include <string>
|
||||
#include <QStatusBar>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QStatusBar>
|
||||
|
||||
class QtStatusBar
|
||||
: public QStatusBar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtStatusBar(void);
|
||||
~QtStatusBar(void);
|
||||
virtual ~QtStatusBar(void);
|
||||
|
||||
void setText(const std::string& text, bool isError, bool showLoader);
|
||||
void setErrorCount(size_t count);
|
||||
|
||||
private slots:
|
||||
void showErrors();
|
||||
|
||||
private:
|
||||
QLabel m_text;
|
||||
QLabel m_loader;
|
||||
QPushButton m_errorButton;
|
||||
};
|
||||
|
||||
#endif // QT_STATUS_BAR_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "qt/view/QtStatusBarView.h"
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "qt/view/QtMainView.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
|
||||
@@ -8,12 +9,14 @@ QtStatusBarView::QtStatusBarView(ViewLayout* viewLayout)
|
||||
: StatusBarView(viewLayout)
|
||||
, m_showMessageFunctor(std::bind(
|
||||
&QtStatusBarView::doShowMessage, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))
|
||||
, m_setErrorCountFunctor(std::bind(&QtStatusBarView::doSetErrorCount, this, std::placeholders::_1))
|
||||
{
|
||||
QtMainView* mw = static_cast<QtMainView*>(viewLayout);
|
||||
m_widget = std::make_shared<QtStatusBar>();
|
||||
m_widget->show();
|
||||
|
||||
QtMainView* mw = static_cast<QtMainView*>(viewLayout);
|
||||
QStatusBar* sb = static_cast<QStatusBar*>(m_widget.get());
|
||||
mw->setStatusBar(sb);
|
||||
m_widget->show();
|
||||
}
|
||||
|
||||
QtStatusBarView::~QtStatusBarView()
|
||||
@@ -32,12 +35,22 @@ void QtStatusBarView::refreshView()
|
||||
{
|
||||
}
|
||||
|
||||
void QtStatusBarView::showMessage(const std::string& message, bool isError, bool showLoader)
|
||||
{
|
||||
m_showMessageFunctor(message, isError, showLoader);
|
||||
}
|
||||
|
||||
void QtStatusBarView::setErrorCount(size_t count)
|
||||
{
|
||||
m_setErrorCountFunctor(count);
|
||||
}
|
||||
|
||||
void QtStatusBarView::doShowMessage(const std::string& message, bool isError, bool showLoader)
|
||||
{
|
||||
m_widget->setText(message, isError, showLoader);
|
||||
}
|
||||
|
||||
void QtStatusBarView::showMessage(const std::string& message, bool isError, bool showLoader)
|
||||
void QtStatusBarView::doSetErrorCount(size_t count)
|
||||
{
|
||||
m_showMessageFunctor(message, isError, showLoader);
|
||||
m_widget->setErrorCount(count);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include "qt/element/QtStatusBar.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
class QtStatusBarView : public StatusBarView
|
||||
class QtStatusBarView
|
||||
: public StatusBarView
|
||||
{
|
||||
public:
|
||||
QtStatusBarView(ViewLayout* viewLayout);
|
||||
@@ -21,12 +22,16 @@ public:
|
||||
|
||||
// StatusBar view implementation
|
||||
virtual void showMessage(const std::string& message, bool isError, bool showLoader);
|
||||
virtual void setErrorCount(size_t count);
|
||||
|
||||
private:
|
||||
void doShowMessage(const std::string& message, bool isError, bool showLoader);
|
||||
std::shared_ptr<QtStatusBar> m_widget;
|
||||
void doSetErrorCount(size_t count);
|
||||
|
||||
QtThreadedFunctor<const std::string&, bool, bool> m_showMessageFunctor;
|
||||
QtThreadedFunctor<size_t> m_setErrorCountFunctor;
|
||||
|
||||
std::shared_ptr<QtStatusBar> m_widget;
|
||||
};
|
||||
|
||||
#endif // !QT_STATUS_BAR_VIEW_H
|
||||
|
||||
Reference in New Issue
Block a user