src: applied clang-format
This commit is contained in:
@@ -13,24 +13,22 @@
|
||||
#include <QTextBlock>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "SourceLocationFile.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "QtContextMenu.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "MessageShowError.h"
|
||||
#include "MessageActivateLocalSymbols.h"
|
||||
#include "MessageFocusIn.h"
|
||||
#include "MessageFocusOut.h"
|
||||
#include "MessageMoveIDECursor.h"
|
||||
#include "MessageShowError.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "QtContextMenu.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "TextCodec.h"
|
||||
#include "utility.h"
|
||||
#include "utilityApp.h"
|
||||
#include "utilityString.h"
|
||||
|
||||
MouseWheelOverScrollbarFilter::MouseWheelOverScrollbarFilter()
|
||||
{
|
||||
}
|
||||
MouseWheelOverScrollbarFilter::MouseWheelOverScrollbarFilter() {}
|
||||
|
||||
bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
@@ -41,8 +39,8 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
QPoint globalMousePos = dynamic_cast<QWheelEvent*>(event)->globalPos();
|
||||
QPoint localMousePos = scrollbar->mapFromGlobal(globalMousePos);
|
||||
|
||||
// instead of "scrollbar->underMouse()" we need this check implemented here because "underMouse()"
|
||||
// does not work when the mouse enters the area without being moved
|
||||
// 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))
|
||||
{
|
||||
event->ignore();
|
||||
@@ -52,23 +50,19 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
QtLineNumberArea::QtLineNumberArea(QtCodeArea *codeArea)
|
||||
: QWidget(codeArea)
|
||||
, m_codeArea(codeArea)
|
||||
QtLineNumberArea::QtLineNumberArea(QtCodeArea* codeArea): QWidget(codeArea), m_codeArea(codeArea)
|
||||
{
|
||||
setObjectName("line_number_area");
|
||||
}
|
||||
|
||||
QtLineNumberArea::~QtLineNumberArea()
|
||||
{
|
||||
}
|
||||
QtLineNumberArea::~QtLineNumberArea() {}
|
||||
|
||||
QSize QtLineNumberArea::sizeHint() const
|
||||
{
|
||||
return QSize(m_codeArea->lineNumberAreaWidth(), 0);
|
||||
}
|
||||
|
||||
void QtLineNumberArea::paintEvent(QPaintEvent *event)
|
||||
void QtLineNumberArea::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
m_codeArea->lineNumberAreaPaintEvent(event);
|
||||
}
|
||||
@@ -80,8 +74,7 @@ QtCodeArea::QtCodeArea(
|
||||
std::shared_ptr<SourceLocationFile> locationFile,
|
||||
QtCodeNavigator* navigator,
|
||||
bool showLineNumbers,
|
||||
QWidget* parent
|
||||
)
|
||||
QWidget* parent)
|
||||
: QtCodeField(startLineNumber, code, locationFile, parent)
|
||||
, m_navigator(navigator)
|
||||
, m_digits(0)
|
||||
@@ -131,7 +124,8 @@ QSize QtCodeArea::sizeHint() const
|
||||
width = std::max(rect.width(), width);
|
||||
}
|
||||
|
||||
if (horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum() && utility::getOsType() != OS_MAC)
|
||||
if (horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum() &&
|
||||
utility::getOsType() != OS_MAC)
|
||||
{
|
||||
height += horizontalScrollBar()->height();
|
||||
}
|
||||
@@ -139,7 +133,7 @@ QSize QtCodeArea::sizeHint() const
|
||||
return QSize(width + lineNumberAreaWidth() + 1, height + 5);
|
||||
}
|
||||
|
||||
void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter painter(m_lineNumberArea);
|
||||
|
||||
@@ -154,7 +148,7 @@ void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
const std::set<Id>& activeSymbolIds = m_navigator->getActiveTokenIds();
|
||||
const std::set<Id>& activeLocalTokenIds = m_navigator->getActiveLocalTokenIds();
|
||||
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
bool focus = false;
|
||||
bool active = false;
|
||||
@@ -234,8 +228,8 @@ void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
int drawAreaTop = event->rect().top();
|
||||
int drawAreaBottom = event->rect().bottom() + 1;
|
||||
|
||||
if (horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum() && utility::getOsType() != OS_MAC &&
|
||||
drawAreaBottom > height() - horizontalScrollBar()->height())
|
||||
if (horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum() &&
|
||||
utility::getOsType() != OS_MAC && drawAreaBottom > height() - horizontalScrollBar()->height())
|
||||
{
|
||||
drawAreaBottom = height() - horizontalScrollBar()->height();
|
||||
}
|
||||
@@ -263,7 +257,8 @@ void QtCodeArea::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||
}
|
||||
|
||||
painter.setPen(p);
|
||||
painter.drawText(0, top, m_lineNumberArea->width() - 16, height, Qt::AlignRight, QString::number(number));
|
||||
painter.drawText(
|
||||
0, top, m_lineNumberArea->width() - 16, height, Qt::AlignRight, QString::number(number));
|
||||
}
|
||||
|
||||
block = block.next();
|
||||
@@ -321,7 +316,7 @@ void QtCodeArea::setIsActiveFile(bool isActiveFile)
|
||||
|
||||
size_t QtCodeArea::getLineNumberForLocationId(Id locationId) const
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationId == locationId)
|
||||
{
|
||||
@@ -334,7 +329,7 @@ size_t QtCodeArea::getLineNumberForLocationId(Id locationId) const
|
||||
|
||||
std::pair<size_t, size_t> QtCodeArea::getLineNumbersForLocationId(Id locationId) const
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationId == locationId)
|
||||
{
|
||||
@@ -347,7 +342,7 @@ std::pair<size_t, size_t> QtCodeArea::getLineNumbersForLocationId(Id locationId)
|
||||
|
||||
Id QtCodeArea::getLocationIdOfFirstActiveLocation(Id tokenId) const
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationType == LocationType::LOCATION_TOKEN && annotation.isActive &&
|
||||
(!tokenId || annotation.tokenIds.find(tokenId) != annotation.tokenIds.end()))
|
||||
@@ -361,7 +356,7 @@ Id QtCodeArea::getLocationIdOfFirstActiveLocation(Id tokenId) const
|
||||
|
||||
Id QtCodeArea::getLocationIdOfFirstActiveScopeLocation(Id tokenId) const
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationType == LocationType::LOCATION_SCOPE && annotation.isActive &&
|
||||
annotation.tokenIds.find(tokenId) != annotation.tokenIds.end())
|
||||
@@ -375,7 +370,7 @@ Id QtCodeArea::getLocationIdOfFirstActiveScopeLocation(Id tokenId) const
|
||||
|
||||
Id QtCodeArea::getLocationIdOfFirstHighlightedLocation() const
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if ((annotation.locationType == LocationType::LOCATION_TOKEN && annotation.isActive) ||
|
||||
annotation.locationType == LocationType::LOCATION_FULLTEXT_SEARCH ||
|
||||
@@ -392,9 +387,10 @@ size_t QtCodeArea::getActiveLocationCount() const
|
||||
{
|
||||
size_t count = 0;
|
||||
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationType == LocationType::LOCATION_TOKEN && (annotation.isActive || annotation.isFocused))
|
||||
if (annotation.locationType == LocationType::LOCATION_TOKEN &&
|
||||
(annotation.isActive || annotation.isFocused))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@@ -402,7 +398,7 @@ size_t QtCodeArea::getActiveLocationCount() const
|
||||
|
||||
if (!count)
|
||||
{
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationType == LocationType::LOCATION_FULLTEXT_SEARCH ||
|
||||
annotation.locationType == LocationType::LOCATION_ERROR)
|
||||
@@ -430,11 +426,13 @@ QRectF QtCodeArea::getLineRectForLineNumber(size_t lineNumber) const
|
||||
return blockBoundingGeometry(block);
|
||||
}
|
||||
|
||||
void QtCodeArea::findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
void QtCodeArea::findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
{
|
||||
TextCodec codec(ApplicationSettings::getInstance()->getTextEncoding());
|
||||
// remove carriage return
|
||||
const std::wstring& code = utility::toLowerCase(codec.decode(utility::replace(getCode(), "\r", "")));
|
||||
const std::wstring& code = utility::toLowerCase(
|
||||
codec.decode(utility::replace(getCode(), "\r", "")));
|
||||
size_t pos = 0;
|
||||
while (pos != std::string::npos)
|
||||
{
|
||||
@@ -503,7 +501,7 @@ void QtCodeArea::ensureLocationIdVisible(Id locationId, int parentWidth, bool an
|
||||
scrollBar->setValue(scrollBar->minimum());
|
||||
|
||||
const Annotation* annotationPtr = nullptr;
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.locationId == locationId)
|
||||
{
|
||||
@@ -519,7 +517,7 @@ void QtCodeArea::ensureLocationIdVisible(Id locationId, int parentWidth, bool an
|
||||
|
||||
std::vector<QRect> rects = getCursorRectsForAnnotation(*annotationPtr);
|
||||
QRect boundingRect;
|
||||
for (QRect rect : rects)
|
||||
for (QRect rect: rects)
|
||||
{
|
||||
if (boundingRect.width())
|
||||
{
|
||||
@@ -553,7 +551,8 @@ void QtCodeArea::ensureLocationIdVisible(Id locationId, int parentWidth, bool an
|
||||
}
|
||||
|
||||
const double percentTarget = double(targetWidth) / (totalWidth - visibleWidth);
|
||||
const int newValue = (scrollBar->maximum() - scrollBar->minimum()) * percentTarget + scrollBar->minimum();
|
||||
const int newValue = (scrollBar->maximum() - scrollBar->minimum()) * percentTarget +
|
||||
scrollBar->minimum();
|
||||
|
||||
if (animated && ApplicationSettings::getInstance()->getUseAnimations())
|
||||
{
|
||||
@@ -570,7 +569,7 @@ void QtCodeArea::ensureLocationIdVisible(Id locationId, int parentWidth, bool an
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::resizeEvent(QResizeEvent *e)
|
||||
void QtCodeArea::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
QPlainTextEdit::resizeEvent(e);
|
||||
|
||||
@@ -614,7 +613,8 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
|
||||
viewport()->setCursor(Qt::ArrowCursor);
|
||||
|
||||
if (m_panningDistance < panningThreshold) // dont do anything if mouse is release to end some real panning action.
|
||||
if (m_panningDistance < panningThreshold) // dont do anything if mouse is release to end
|
||||
// some real panning action.
|
||||
{
|
||||
if (Qt::KeyboardModifier::ControlModifier & QApplication::keyboardModifiers())
|
||||
{
|
||||
@@ -623,7 +623,8 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<const Annotation*> annotations = getInteractiveAnnotationsForPosition(event->pos());
|
||||
std::vector<const Annotation*> annotations = getInteractiveAnnotationsForPosition(
|
||||
event->pos());
|
||||
if (annotations.size())
|
||||
{
|
||||
activateAnnotationsOrErrors(annotations);
|
||||
@@ -682,14 +683,16 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (m_navigator->hasErrors())
|
||||
{
|
||||
for (const Annotation* annotation : annotations)
|
||||
for (const Annotation* annotation: annotations)
|
||||
{
|
||||
if (annotation->locationType == LOCATION_ERROR && annotation->tokenIds.size())
|
||||
{
|
||||
std::wstring errorMessage = m_navigator->getErrorMessageForId(*annotation->tokenIds.begin());
|
||||
QToolTip::showText(event->globalPos(), QString::fromStdWString(errorMessage), this);
|
||||
std::wstring errorMessage = m_navigator->getErrorMessageForId(
|
||||
*annotation->tokenIds.begin());
|
||||
QToolTip::showText(
|
||||
event->globalPos(), QString::fromStdWString(errorMessage), this);
|
||||
|
||||
QtCodeField::focusTokenIds({ *annotation->tokenIds.begin() });
|
||||
QtCodeField::focusTokenIds({*annotation->tokenIds.begin()});
|
||||
viewport()->setCursor(Qt::PointingHandCursor);
|
||||
return;
|
||||
}
|
||||
@@ -702,10 +705,12 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::wheelEvent(QWheelEvent *event)
|
||||
void QtCodeArea::wheelEvent(QWheelEvent* event)
|
||||
{
|
||||
if ((event->angleDelta().x() != 0 && horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum()) ||
|
||||
(event->angleDelta().y() != 0 && verticalScrollBar()->minimum() != verticalScrollBar()->maximum()))
|
||||
if ((event->angleDelta().x() != 0 &&
|
||||
horizontalScrollBar()->minimum() != horizontalScrollBar()->maximum()) ||
|
||||
(event->angleDelta().y() != 0 &&
|
||||
verticalScrollBar()->minimum() != verticalScrollBar()->maximum()))
|
||||
{
|
||||
QPlainTextEdit::wheelEvent(event);
|
||||
}
|
||||
@@ -751,7 +756,7 @@ void QtCodeArea::updateLineNumberAreaWidth(int /* newBlockCount */)
|
||||
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
|
||||
}
|
||||
|
||||
void QtCodeArea::updateLineNumberArea(const QRect &rect, int dy)
|
||||
void QtCodeArea::updateLineNumberArea(const QRect& rect, int dy)
|
||||
{
|
||||
if (dy)
|
||||
{
|
||||
@@ -772,7 +777,8 @@ void QtCodeArea::setIDECursorPosition()
|
||||
{
|
||||
std::pair<int, int> lineColumn = toLineColumn(this->cursorForPosition(m_eventPosition).position());
|
||||
|
||||
MessageMoveIDECursor(getSourceLocationFile()->getFilePath(), lineColumn.first, lineColumn.second).dispatch();
|
||||
MessageMoveIDECursor(getSourceLocationFile()->getFilePath(), lineColumn.first, lineColumn.second)
|
||||
.dispatch();
|
||||
}
|
||||
|
||||
void QtCodeArea::setCopyAvailable(bool yes)
|
||||
@@ -804,11 +810,12 @@ void QtCodeArea::activateAnnotationsOrErrors(const std::vector<const Annotation*
|
||||
if (m_navigator->hasErrors())
|
||||
{
|
||||
std::vector<Id> errorIds;
|
||||
for (const Annotation* annotation : annotations)
|
||||
for (const Annotation* annotation: annotations)
|
||||
{
|
||||
if (annotation->locationType == LOCATION_ERROR && annotation->tokenIds.size())
|
||||
{
|
||||
errorIds.insert(errorIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
|
||||
errorIds.insert(
|
||||
errorIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,19 +832,20 @@ void QtCodeArea::activateAnnotationsOrErrors(const std::vector<const Annotation*
|
||||
void QtCodeArea::annotateText()
|
||||
{
|
||||
const std::set<Id>& activeSymbolIds = m_navigator->getCurrentActiveTokenIds();
|
||||
const std::set<Id>& activeLocationIds =
|
||||
utility::concat(m_navigator->getCurrentActiveLocationIds(), m_navigator->getCurrentActiveLocalLocationIds());
|
||||
const std::set<Id>& activeLocationIds = utility::concat(
|
||||
m_navigator->getCurrentActiveLocationIds(), m_navigator->getCurrentActiveLocalLocationIds());
|
||||
|
||||
std::set<Id> focusedSymbolIds = m_navigator->getActiveTokenIds();
|
||||
utility::append(focusedSymbolIds, m_navigator->getActiveLocalTokenIds());
|
||||
|
||||
for (Id currentActiveId : activeSymbolIds)
|
||||
for (Id currentActiveId: activeSymbolIds)
|
||||
{
|
||||
focusedSymbolIds.erase(currentActiveId);
|
||||
}
|
||||
utility::append(focusedSymbolIds, m_navigator->getFocusedTokenIds());
|
||||
|
||||
bool needsUpdate = QtCodeField::annotateText(activeSymbolIds, activeLocationIds, focusedSymbolIds);
|
||||
bool needsUpdate = QtCodeField::annotateText(
|
||||
activeSymbolIds, activeLocationIds, focusedSymbolIds);
|
||||
if (needsUpdate)
|
||||
{
|
||||
m_lineNumberArea->update();
|
||||
@@ -858,5 +866,6 @@ void QtCodeArea::createActions()
|
||||
#endif
|
||||
m_setIDECursorPositionAction->setStatusTip(tr("Set the IDE Cursor to this code position"));
|
||||
m_setIDECursorPositionAction->setToolTip(tr("Set the IDE Cursor to this code position"));
|
||||
connect(m_setIDECursorPositionAction, &QAction::triggered, this, &QtCodeArea::setIDECursorPosition);
|
||||
connect(
|
||||
m_setIDECursorPositionAction, &QAction::triggered, this, &QtCodeArea::setIDECursorPosition);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ class QtCodeNavigator;
|
||||
class QWidget;
|
||||
class QtCodeArea;
|
||||
|
||||
class MouseWheelOverScrollbarFilter
|
||||
: public QObject
|
||||
class MouseWheelOverScrollbarFilter: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -27,8 +26,7 @@ protected:
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
};
|
||||
|
||||
class QtLineNumberArea
|
||||
: public QWidget
|
||||
class QtLineNumberArea: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -45,21 +43,18 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class QtCodeArea
|
||||
: public QtCodeField
|
||||
class QtCodeArea: public QtCodeField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
QtCodeArea(
|
||||
size_t startLineNumber,
|
||||
const std::string& code,
|
||||
std::shared_ptr<SourceLocationFile> locationFile,
|
||||
QtCodeNavigator* navigator,
|
||||
bool showLineNumbers,
|
||||
QWidget* parent = nullptr
|
||||
);
|
||||
QWidget* parent = nullptr);
|
||||
virtual ~QtCodeArea();
|
||||
|
||||
virtual QSize sizeHint() const override;
|
||||
@@ -85,7 +80,8 @@ public:
|
||||
|
||||
QRectF getLineRectForLineNumber(size_t lineNumber) const;
|
||||
|
||||
void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
void findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
void clearScreenMatches();
|
||||
|
||||
void ensureLocationIdVisible(Id locationId, int parentWidth, bool animated);
|
||||
@@ -95,7 +91,7 @@ protected:
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent* event) override;
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
virtual void wheelEvent(QWheelEvent* event) override;
|
||||
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
|
||||
@@ -130,8 +126,8 @@ private:
|
||||
|
||||
QAction* m_copyAction;
|
||||
QAction* m_setIDECursorPositionAction;
|
||||
QPoint m_eventPosition; // is needed for IDE cursor control via context menu
|
||||
// the position where the context menu is opened needs to be stored]
|
||||
QPoint m_eventPosition; // is needed for IDE cursor control via context menu
|
||||
// the position where the context menu is opened needs to be stored]
|
||||
|
||||
bool m_isActiveFile;
|
||||
bool m_showLineNumbers;
|
||||
@@ -139,4 +135,4 @@ private:
|
||||
QtScrollSpeedChangeListener m_scrollSpeedChangeListener;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_AREA_H
|
||||
#endif // QT_CODE_AREA_H
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
#include <QTextBlock>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "SourceLocation.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "QtContextMenu.h"
|
||||
#include "QtHighlighter.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "MessageActivateLocalSymbols.h"
|
||||
@@ -16,6 +12,10 @@
|
||||
#include "MessageActivateTokenIds.h"
|
||||
#include "MessageTabOpenWith.h"
|
||||
#include "MessageTooltipShow.h"
|
||||
#include "QtContextMenu.h"
|
||||
#include "QtHighlighter.h"
|
||||
#include "SourceLocation.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "TextCodec.h"
|
||||
#include "tracing.h"
|
||||
#include "utility.h"
|
||||
@@ -32,8 +32,7 @@ QtCodeField::QtCodeField(
|
||||
const std::string& code,
|
||||
std::shared_ptr<SourceLocationFile> locationFile,
|
||||
bool convertLocationsOnDemand,
|
||||
QWidget* parent
|
||||
)
|
||||
QWidget* parent)
|
||||
: QPlainTextEdit(parent)
|
||||
, m_startLineNumber(startLineNumber)
|
||||
, m_code(code)
|
||||
@@ -73,7 +72,8 @@ QtCodeField::QtCodeField(
|
||||
setPlainText(convertedDisplayCode);
|
||||
if (displayCode.size() != size_t(convertedDisplayCode.length()))
|
||||
{
|
||||
LOG_INFO("Converting displayed code to " + codec.getName() +
|
||||
LOG_INFO(
|
||||
"Converting displayed code to " + codec.getName() +
|
||||
" resulted in offset of source locations. Correcting this now.");
|
||||
createMultibyteCharacterLocationCache(convertedDisplayCode);
|
||||
}
|
||||
@@ -103,9 +103,7 @@ QtCodeField::QtCodeField(
|
||||
connect(m_openInTabAction, &QAction::triggered, this, &QtCodeField::openInTab);
|
||||
}
|
||||
|
||||
QtCodeField::~QtCodeField()
|
||||
{
|
||||
}
|
||||
QtCodeField::~QtCodeField() {}
|
||||
|
||||
QSize QtCodeField::sizeHint() const
|
||||
{
|
||||
@@ -119,8 +117,14 @@ QSize QtCodeField::sizeHint() const
|
||||
height += rect.height();
|
||||
|
||||
int blockWidth = fm.boundingRect(
|
||||
0, 0, 1000000, 1000000,
|
||||
Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs, block.text(), tabStopWidth()).width();
|
||||
0,
|
||||
0,
|
||||
1000000,
|
||||
1000000,
|
||||
Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs,
|
||||
block.text(),
|
||||
tabStopWidth())
|
||||
.width();
|
||||
|
||||
width = std::max(blockWidth, width);
|
||||
}
|
||||
@@ -196,7 +200,7 @@ void QtCodeField::paintEvent(QPaintEvent* event)
|
||||
|
||||
int borderRadius = 3;
|
||||
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
if (annotation.startLine > lastVisibleLine || annotation.endLine < firstVisibleLine)
|
||||
{
|
||||
@@ -206,7 +210,8 @@ void QtCodeField::paintEvent(QPaintEvent* event)
|
||||
const AnnotationColor& color = getAnnotationColorForAnnotation(annotation);
|
||||
|
||||
if (color.text != "transparent" &&
|
||||
QColor(color.text.c_str()) != m_highlighter->getFormat(annotation.start, annotation.end).foreground().color())
|
||||
QColor(color.text.c_str()) !=
|
||||
m_highlighter->getFormat(annotation.start, annotation.end).foreground().color())
|
||||
{
|
||||
// TODO: this causes another paint event if text color changes
|
||||
setTextColorForAnnotation(annotation, QColor(color.text.c_str()));
|
||||
@@ -228,15 +233,17 @@ void QtCodeField::paintEvent(QPaintEvent* event)
|
||||
if (annotation.locationType == LOCATION_SCOPE)
|
||||
{
|
||||
painter.drawRoundedRect(
|
||||
0, top + (annotation.startLine - m_startLineNumber) * blockHeight,
|
||||
width(), (annotation.endLine - annotation.startLine + 1) * blockHeight,
|
||||
borderRadius, borderRadius
|
||||
);
|
||||
0,
|
||||
top + (annotation.startLine - m_startLineNumber) * blockHeight,
|
||||
width(),
|
||||
(annotation.endLine - annotation.startLine + 1) * blockHeight,
|
||||
borderRadius,
|
||||
borderRadius);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<QRect> rects = getCursorRectsForAnnotation(annotation);
|
||||
for (QRect rect : rects)
|
||||
for (QRect rect: rects)
|
||||
{
|
||||
rect.adjust(-1, 0, 1, 1);
|
||||
painter.drawRoundedRect(rect, borderRadius, borderRadius);
|
||||
@@ -247,9 +254,7 @@ void QtCodeField::paintEvent(QPaintEvent* event)
|
||||
QPlainTextEdit::paintEvent(event);
|
||||
}
|
||||
|
||||
void QtCodeField::enterEvent(QEvent* event)
|
||||
{
|
||||
}
|
||||
void QtCodeField::enterEvent(QEvent* event) {}
|
||||
|
||||
void QtCodeField::leaveEvent(QEvent* event)
|
||||
{
|
||||
@@ -316,7 +321,8 @@ void QtCodeField::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
||||
void QtCodeField::focusTokenIds(const std::vector<Id>& focusedTokenIds)
|
||||
{
|
||||
annotateText(std::set<Id>(), std::set<Id>(), std::set<Id>(focusedTokenIds.begin(), focusedTokenIds.end()));
|
||||
annotateText(
|
||||
std::set<Id>(), std::set<Id>(), std::set<Id>(focusedTokenIds.begin(), focusedTokenIds.end()));
|
||||
}
|
||||
|
||||
void QtCodeField::defocusTokenIds(const std::vector<Id>& activeTokenIds)
|
||||
@@ -325,7 +331,9 @@ void QtCodeField::defocusTokenIds(const std::vector<Id>& activeTokenIds)
|
||||
}
|
||||
|
||||
bool QtCodeField::annotateText(
|
||||
const std::set<Id>& activeSymbolIds, const std::set<Id>& activeLocationIds, const std::set<Id>& focusedSymbolIds)
|
||||
const std::set<Id>& activeSymbolIds,
|
||||
const std::set<Id>& activeLocationIds,
|
||||
const std::set<Id>& focusedSymbolIds)
|
||||
{
|
||||
for (size_t i = 0; i < m_annotations.size(); i++)
|
||||
{
|
||||
@@ -333,10 +341,9 @@ bool QtCodeField::annotateText(
|
||||
bool wasActive = annotation.isActive;
|
||||
bool wasFocused = annotation.isFocused;
|
||||
|
||||
annotation.isActive = (
|
||||
utility::shareElement(activeSymbolIds, annotation.tokenIds) ||
|
||||
activeLocationIds.find(annotation.locationId) != activeLocationIds.end()
|
||||
);
|
||||
annotation.isActive =
|
||||
(utility::shareElement(activeSymbolIds, annotation.tokenIds) ||
|
||||
activeLocationIds.find(annotation.locationId) != activeLocationIds.end());
|
||||
|
||||
annotation.isFocused = utility::shareElement(focusedSymbolIds, annotation.tokenIds);
|
||||
|
||||
@@ -349,7 +356,7 @@ bool QtCodeField::annotateText(
|
||||
if (annotation.isFocused)
|
||||
{
|
||||
bool isHovered = false;
|
||||
for (const Annotation* a : m_hoveredAnnotations)
|
||||
for (const Annotation* a: m_hoveredAnnotations)
|
||||
{
|
||||
if (&annotation == a)
|
||||
{
|
||||
@@ -385,69 +392,69 @@ void QtCodeField::createAnnotations(std::shared_ptr<SourceLocationFile> location
|
||||
size_t endLineNumber = getEndLineNumber();
|
||||
std::set<Id> locationIds;
|
||||
|
||||
locationFile->forEachSourceLocation(
|
||||
[&](const SourceLocation* location)
|
||||
locationFile->forEachSourceLocation([&](const SourceLocation* location) {
|
||||
if (location->getLocationId() &&
|
||||
locationIds.find(location->getLocationId()) != locationIds.end())
|
||||
{
|
||||
if (location->getLocationId() && locationIds.find(location->getLocationId()) != locationIds.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
locationIds.insert(location->getLocationId());
|
||||
|
||||
Annotation annotation;
|
||||
|
||||
const SourceLocation* startLocation = location->getStartLocation();
|
||||
if (!startLocation || startLocation->getLineNumber() < m_startLineNumber)
|
||||
{
|
||||
annotation.start = startTextEditPosition();
|
||||
annotation.startLine = m_startLineNumber;
|
||||
annotation.startCol = 0;
|
||||
}
|
||||
else if (startLocation->getLineNumber() <= endLineNumber)
|
||||
{
|
||||
const int startLine = startLocation->getLineNumber();
|
||||
const int startCol = getColumnCorrectedForMultibyteCharacters(startLine, startLocation->getColumnNumber() - 1);
|
||||
|
||||
annotation.start = toTextEditPosition(startLine, startCol);
|
||||
annotation.startLine = startLine;
|
||||
annotation.startCol = startCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const SourceLocation* endLocation = location->getEndLocation();
|
||||
if (!endLocation || endLocation->getLineNumber() > endLineNumber)
|
||||
{
|
||||
annotation.end = endTextEditPosition();
|
||||
annotation.endLine = endLineNumber;
|
||||
annotation.endCol = m_lineLengths[document()->blockCount() - 1];
|
||||
}
|
||||
else if (endLocation->getLineNumber() >= m_startLineNumber)
|
||||
{
|
||||
const int endLine = endLocation->getLineNumber();
|
||||
const int endCol = getColumnCorrectedForMultibyteCharacters(endLine, endLocation->getColumnNumber());
|
||||
|
||||
annotation.end = toTextEditPosition(endLine, endCol);
|
||||
annotation.endLine = endLine;
|
||||
annotation.endCol = endCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
annotation.tokenIds.insert(location->getTokenIds().begin(), location->getTokenIds().end());
|
||||
annotation.locationId = location->getLocationId();
|
||||
annotation.locationType = location->getType();
|
||||
|
||||
annotation.isActive = false;
|
||||
annotation.isFocused = false;
|
||||
|
||||
m_annotations.push_back(annotation);
|
||||
return;
|
||||
}
|
||||
);
|
||||
locationIds.insert(location->getLocationId());
|
||||
|
||||
Annotation annotation;
|
||||
|
||||
const SourceLocation* startLocation = location->getStartLocation();
|
||||
if (!startLocation || startLocation->getLineNumber() < m_startLineNumber)
|
||||
{
|
||||
annotation.start = startTextEditPosition();
|
||||
annotation.startLine = m_startLineNumber;
|
||||
annotation.startCol = 0;
|
||||
}
|
||||
else if (startLocation->getLineNumber() <= endLineNumber)
|
||||
{
|
||||
const int startLine = startLocation->getLineNumber();
|
||||
const int startCol = getColumnCorrectedForMultibyteCharacters(
|
||||
startLine, startLocation->getColumnNumber() - 1);
|
||||
|
||||
annotation.start = toTextEditPosition(startLine, startCol);
|
||||
annotation.startLine = startLine;
|
||||
annotation.startCol = startCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const SourceLocation* endLocation = location->getEndLocation();
|
||||
if (!endLocation || endLocation->getLineNumber() > endLineNumber)
|
||||
{
|
||||
annotation.end = endTextEditPosition();
|
||||
annotation.endLine = endLineNumber;
|
||||
annotation.endCol = m_lineLengths[document()->blockCount() - 1];
|
||||
}
|
||||
else if (endLocation->getLineNumber() >= m_startLineNumber)
|
||||
{
|
||||
const int endLine = endLocation->getLineNumber();
|
||||
const int endCol = getColumnCorrectedForMultibyteCharacters(
|
||||
endLine, endLocation->getColumnNumber());
|
||||
|
||||
annotation.end = toTextEditPosition(endLine, endCol);
|
||||
annotation.endLine = endLine;
|
||||
annotation.endCol = endCol;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
annotation.tokenIds.insert(location->getTokenIds().begin(), location->getTokenIds().end());
|
||||
annotation.locationId = location->getLocationId();
|
||||
annotation.locationType = location->getType();
|
||||
|
||||
annotation.isActive = false;
|
||||
annotation.isFocused = false;
|
||||
|
||||
m_annotations.push_back(annotation);
|
||||
});
|
||||
}
|
||||
|
||||
void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& annotations)
|
||||
@@ -458,9 +465,10 @@ void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& anno
|
||||
|
||||
bool containsUnsolved = false;
|
||||
|
||||
for (const Annotation* annotation : annotations)
|
||||
for (const Annotation* annotation: annotations)
|
||||
{
|
||||
if (annotation->locationType == LOCATION_TOKEN || annotation->locationType == LOCATION_QUALIFIER ||
|
||||
if (annotation->locationType == LOCATION_TOKEN ||
|
||||
annotation->locationType == LOCATION_QUALIFIER ||
|
||||
annotation->locationType == LOCATION_UNSOLVED)
|
||||
{
|
||||
if (annotation->locationId > 0)
|
||||
@@ -487,15 +495,17 @@ void QtCodeField::activateAnnotations(const std::vector<const Annotation*>& anno
|
||||
}
|
||||
}
|
||||
|
||||
if (tokenIds.size() > 1 || localSymbolIds.size() > 1 || (tokenIds.size() && localSymbolIds.size()))
|
||||
if (tokenIds.size() > 1 || localSymbolIds.size() > 1 ||
|
||||
(tokenIds.size() && localSymbolIds.size()))
|
||||
{
|
||||
MessageTooltipShow(locationIds, utility::toVector(localSymbolIds), TOOLTIP_ORIGIN_CODE).dispatch();
|
||||
MessageTooltipShow(locationIds, utility::toVector(localSymbolIds), TOOLTIP_ORIGIN_CODE)
|
||||
.dispatch();
|
||||
}
|
||||
else if (locationIds.size())
|
||||
{
|
||||
MessageActivateSourceLocations(locationIds, containsUnsolved).dispatch();
|
||||
}
|
||||
else if (tokenIds.size()) // fallback for links in project description
|
||||
else if (tokenIds.size()) // fallback for links in project description
|
||||
{
|
||||
MessageActivateTokenIds(utility::toVector(tokenIds)).dispatch();
|
||||
}
|
||||
@@ -553,7 +563,7 @@ void QtCodeField::setHoveredAnnotations(const std::vector<const Annotation*>& an
|
||||
if (m_hoveredAnnotations.size())
|
||||
{
|
||||
std::vector<Id> tokenIds;
|
||||
for (const Annotation* annotation : m_hoveredAnnotations)
|
||||
for (const Annotation* annotation: m_hoveredAnnotations)
|
||||
{
|
||||
tokenIds.insert(tokenIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
|
||||
}
|
||||
@@ -568,7 +578,7 @@ void QtCodeField::setHoveredAnnotations(const std::vector<const Annotation*>& an
|
||||
if (annotations.size())
|
||||
{
|
||||
std::vector<Id> tokenIds;
|
||||
for (const Annotation* annotation : annotations)
|
||||
for (const Annotation* annotation: annotations)
|
||||
{
|
||||
tokenIds.insert(tokenIds.end(), annotation->tokenIds.begin(), annotation->tokenIds.end());
|
||||
}
|
||||
@@ -608,8 +618,7 @@ std::vector<QRect> QtCodeField::getCursorRectsForAnnotation(const Annotation& an
|
||||
rectStart.left(),
|
||||
rectStart.top(),
|
||||
rectEnd.right() - rectStart.left(),
|
||||
rectEnd.bottom() - rectStart.top()
|
||||
));
|
||||
rectEnd.bottom() - rectStart.top()));
|
||||
|
||||
line++;
|
||||
|
||||
@@ -623,17 +632,20 @@ std::vector<QRect> QtCodeField::getCursorRectsForAnnotation(const Annotation& an
|
||||
return rects;
|
||||
}
|
||||
|
||||
const QtCodeField::AnnotationColor& QtCodeField::getAnnotationColorForAnnotation(const Annotation& annotation)
|
||||
const QtCodeField::AnnotationColor& QtCodeField::getAnnotationColorForAnnotation(
|
||||
const Annotation& annotation)
|
||||
{
|
||||
if (!s_annotationColors.size())
|
||||
{
|
||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||
std::vector<std::string> types = { "token", "local_symbol", "scope", "error", "fulltext_search", "screen_search" };
|
||||
std::vector<ColorScheme::ColorState> states = { ColorScheme::NORMAL, ColorScheme::FOCUS, ColorScheme::ACTIVE };
|
||||
std::vector<std::string> types = {
|
||||
"token", "local_symbol", "scope", "error", "fulltext_search", "screen_search"};
|
||||
std::vector<ColorScheme::ColorState> states = {
|
||||
ColorScheme::NORMAL, ColorScheme::FOCUS, ColorScheme::ACTIVE};
|
||||
|
||||
for (const std::string& type : types)
|
||||
for (const std::string& type: types)
|
||||
{
|
||||
for (const ColorScheme::ColorState& state : states)
|
||||
for (const ColorScheme::ColorState& state: states)
|
||||
{
|
||||
AnnotationColor color;
|
||||
color.border = scheme->getCodeAnnotationTypeColor(type, "border", state);
|
||||
@@ -686,19 +698,20 @@ void QtCodeField::setTextColorForAnnotation(const Annotation& annotation, QColor
|
||||
m_highlighter->applyFormat(annotation.start, annotation.end, format);
|
||||
}
|
||||
|
||||
std::vector<const QtCodeField::Annotation*> QtCodeField::getInteractiveAnnotationsForPosition(QPoint position) const
|
||||
std::vector<const QtCodeField::Annotation*> QtCodeField::getInteractiveAnnotationsForPosition(
|
||||
QPoint position) const
|
||||
{
|
||||
std::vector<const QtCodeField::Annotation*> annotations;
|
||||
|
||||
QTextCursor cursor = this->cursorForPosition(position);
|
||||
int pos = cursor.position();
|
||||
|
||||
for (const Annotation& annotation : m_annotations)
|
||||
for (const Annotation& annotation: m_annotations)
|
||||
{
|
||||
const LocationType& type = annotation.locationType;
|
||||
if ((type == LOCATION_TOKEN || type == LOCATION_QUALIFIER || type == LOCATION_LOCAL_SYMBOL
|
||||
|| type == LOCATION_UNSOLVED || type == LOCATION_ERROR)
|
||||
&& pos >= annotation.start && pos <= annotation.end)
|
||||
if ((type == LOCATION_TOKEN || type == LOCATION_QUALIFIER ||
|
||||
type == LOCATION_LOCAL_SYMBOL || type == LOCATION_UNSOLVED || type == LOCATION_ERROR) &&
|
||||
pos >= annotation.start && pos <= annotation.end)
|
||||
{
|
||||
annotations.push_back(&annotation);
|
||||
}
|
||||
@@ -710,7 +723,7 @@ std::vector<const QtCodeField::Annotation*> QtCodeField::getInteractiveAnnotatio
|
||||
void QtCodeField::checkOpenInTabActionEnabled(QPoint position)
|
||||
{
|
||||
std::vector<Id> locationIds;
|
||||
for (const Annotation* annotation : getInteractiveAnnotationsForPosition(position))
|
||||
for (const Annotation* annotation: getInteractiveAnnotationsForPosition(position))
|
||||
{
|
||||
const LocationType& type = annotation->locationType;
|
||||
if (type == LOCATION_TOKEN || type == LOCATION_QUALIFIER || type == LOCATION_UNSOLVED)
|
||||
@@ -755,7 +768,8 @@ void QtCodeField::createLineLengthCache()
|
||||
void QtCodeField::createMultibyteCharacterLocationCache(const QString& code)
|
||||
{
|
||||
m_multibyteCharacterLocations.clear();
|
||||
QTextCodec* codec = QTextCodec::codecForName(ApplicationSettings::getInstance()->getTextEncoding().c_str());
|
||||
QTextCodec* codec = QTextCodec::codecForName(
|
||||
ApplicationSettings::getInstance()->getTextEncoding().c_str());
|
||||
|
||||
for (const QString& line: code.split("\n"))
|
||||
{
|
||||
@@ -782,7 +796,8 @@ int QtCodeField::getColumnCorrectedForMultibyteCharacters(int line, int column)
|
||||
const size_t relativeLineNumber = line - m_startLineNumber;
|
||||
if (relativeLineNumber < m_multibyteCharacterLocations.size())
|
||||
{
|
||||
for (const std::pair<int, int> m_multibyteCharacterLocation : m_multibyteCharacterLocations[relativeLineNumber])
|
||||
for (const std::pair<int, int> m_multibyteCharacterLocation:
|
||||
m_multibyteCharacterLocations[relativeLineNumber])
|
||||
{
|
||||
if (column > m_multibyteCharacterLocation.first)
|
||||
{
|
||||
|
||||
@@ -13,8 +13,7 @@ class QtHighlighter;
|
||||
class SourceLocation;
|
||||
class SourceLocationFile;
|
||||
|
||||
class QtCodeField
|
||||
: public QPlainTextEdit
|
||||
class QtCodeField: public QPlainTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -84,7 +83,9 @@ protected:
|
||||
};
|
||||
|
||||
bool annotateText(
|
||||
const std::set<Id>& activeSymbolIds, const std::set<Id>& activeLocationIds, const std::set<Id>& focusedSymbolIds);
|
||||
const std::set<Id>& activeSymbolIds,
|
||||
const std::set<Id>& activeLocationIds,
|
||||
const std::set<Id>& focusedSymbolIds);
|
||||
|
||||
void createAnnotations(std::shared_ptr<SourceLocationFile> locationFile);
|
||||
void activateAnnotations(const std::vector<const Annotation*>& annotations);
|
||||
@@ -137,4 +138,4 @@ private:
|
||||
Id m_openInTabLocationId;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FIELD_H
|
||||
#endif // QT_CODE_FIELD_H
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
#include "QtCodeFile.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QStyle>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "MessageChangeFileView.h"
|
||||
|
||||
#include "SourceLocationFile.h"
|
||||
#include "QtCodeFileTitleBar.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "QtCodeSnippet.h"
|
||||
#include "SourceLocationFile.h"
|
||||
|
||||
QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator, bool isFirst)
|
||||
: QFrame()
|
||||
, m_navigator(navigator)
|
||||
, m_filePath(filePath)
|
||||
, m_isWholeFile(false)
|
||||
: QFrame(), m_navigator(navigator), m_filePath(filePath), m_isWholeFile(false)
|
||||
{
|
||||
setObjectName("code_file");
|
||||
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
@@ -46,9 +43,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator, boo
|
||||
update();
|
||||
}
|
||||
|
||||
QtCodeFile::~QtCodeFile()
|
||||
{
|
||||
}
|
||||
QtCodeFile::~QtCodeFile() {}
|
||||
|
||||
void QtCodeFile::setModificationTime(const TimeStamp modificationTime)
|
||||
{
|
||||
@@ -94,7 +89,7 @@ void QtCodeFile::updateSourceLocations(const CodeSnippetParams& params)
|
||||
return;
|
||||
}
|
||||
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
if (snippet->getStartLineNumber() == params.startLineNumber &&
|
||||
snippet->getEndLineNumber() == params.endLineNumber)
|
||||
@@ -113,7 +108,7 @@ std::vector<QtCodeSnippet*> QtCodeFile::getVisibleSnippets() const
|
||||
{
|
||||
std::vector<QtCodeSnippet*> snippets;
|
||||
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
if (snippet->isVisible())
|
||||
{
|
||||
@@ -126,7 +121,7 @@ std::vector<QtCodeSnippet*> QtCodeFile::getVisibleSnippets() const
|
||||
|
||||
QtCodeSnippet* QtCodeFile::getSnippetForLocationId(Id locationId) const
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
if (snippet->getLineNumberForLocationId(locationId))
|
||||
{
|
||||
@@ -139,7 +134,7 @@ QtCodeSnippet* QtCodeFile::getSnippetForLocationId(Id locationId) const
|
||||
|
||||
QtCodeSnippet* QtCodeFile::getSnippetForLine(unsigned int line) const
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
if (snippet->getStartLineNumber() <= line && line <= snippet->getEndLineNumber())
|
||||
{
|
||||
@@ -154,7 +149,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFile::getFirstSnippetWithActiveLocationId(Id
|
||||
{
|
||||
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
|
||||
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
Id locationId = snippet->getFirstActiveLocationId(tokenId);
|
||||
if (locationId != 0)
|
||||
@@ -176,8 +171,7 @@ void QtCodeFile::requestWholeFileContent(size_t targetLineNumber)
|
||||
m_filePath,
|
||||
MessageChangeFileView::FILE_MAXIMIZED,
|
||||
MessageChangeFileView::VIEW_LIST,
|
||||
CodeScrollParams::toLine(m_filePath, targetLineNumber, CodeScrollParams::Target::VISIBLE)
|
||||
);
|
||||
CodeScrollParams::toLine(m_filePath, targetLineNumber, CodeScrollParams::Target::VISIBLE));
|
||||
msg.setSchedulerId(m_navigator->getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
@@ -191,7 +185,7 @@ void QtCodeFile::updateContent()
|
||||
{
|
||||
updateSnippets();
|
||||
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
snippet->updateContent();
|
||||
}
|
||||
@@ -216,7 +210,7 @@ void QtCodeFile::setIsIndexed(bool isIndexed)
|
||||
|
||||
void QtCodeFile::setMinimized()
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
snippet->hide();
|
||||
}
|
||||
@@ -226,7 +220,7 @@ void QtCodeFile::setMinimized()
|
||||
|
||||
void QtCodeFile::setSnippets()
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
snippet->show();
|
||||
}
|
||||
@@ -241,7 +235,7 @@ bool QtCodeFile::hasSnippets() const
|
||||
|
||||
void QtCodeFile::clearSnippets()
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
m_snippetLayout->removeWidget(snippet);
|
||||
snippet->hide();
|
||||
@@ -264,15 +258,15 @@ void QtCodeFile::updateSnippets()
|
||||
}
|
||||
|
||||
int maxDigits = 1;
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
maxDigits = qMax(maxDigits, snippet->lineNumberDigits());
|
||||
}
|
||||
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
snippet->setProperty("first", snippet == m_snippets.front());
|
||||
snippet->style()->polish(snippet); // recomputes style to make property take effect
|
||||
snippet->style()->polish(snippet); // recomputes style to make property take effect
|
||||
snippet->updateLineNumberAreaWidthForDigits(maxDigits);
|
||||
}
|
||||
}
|
||||
@@ -282,9 +276,10 @@ void QtCodeFile::updateTitleBar()
|
||||
m_titleBar->getTitleButton()->updateTexts();
|
||||
}
|
||||
|
||||
void QtCodeFile::findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
void QtCodeFile::findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
{
|
||||
for (QtCodeSnippet* snippet : m_snippets)
|
||||
for (QtCodeSnippet* snippet: m_snippets)
|
||||
{
|
||||
if (snippet->isVisible())
|
||||
{
|
||||
@@ -299,8 +294,7 @@ void QtCodeFile::clickedMinimizeButton()
|
||||
m_filePath,
|
||||
MessageChangeFileView::FILE_MINIMIZED,
|
||||
MessageChangeFileView::VIEW_LIST,
|
||||
CodeScrollParams::toFile(m_filePath, CodeScrollParams::Target::VISIBLE)
|
||||
);
|
||||
CodeScrollParams::toFile(m_filePath, CodeScrollParams::Target::VISIBLE));
|
||||
msg.setSchedulerId(m_navigator->getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
@@ -311,8 +305,7 @@ void QtCodeFile::clickedSnippetButton()
|
||||
m_filePath,
|
||||
MessageChangeFileView::FILE_SNIPPETS,
|
||||
MessageChangeFileView::VIEW_LIST,
|
||||
CodeScrollParams::toFile(m_filePath, CodeScrollParams::Target::VISIBLE)
|
||||
);
|
||||
CodeScrollParams::toFile(m_filePath, CodeScrollParams::Target::VISIBLE));
|
||||
msg.setSchedulerId(m_navigator->getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
@@ -340,17 +333,16 @@ void QtCodeFile::clickedMaximizeButton()
|
||||
|
||||
m_navigator->setMode(QtCodeNavigator::MODE_SINGLE);
|
||||
|
||||
CodeScrollParams scrollParams = locationId ?
|
||||
CodeScrollParams::toReference(m_filePath, locationId, CodeScrollParams::Target::CENTER) :
|
||||
CodeScrollParams::toLine(m_filePath, lineNumber, CodeScrollParams::Target::CENTER);
|
||||
CodeScrollParams scrollParams = locationId
|
||||
? CodeScrollParams::toReference(m_filePath, locationId, CodeScrollParams::Target::CENTER)
|
||||
: CodeScrollParams::toLine(m_filePath, lineNumber, CodeScrollParams::Target::CENTER);
|
||||
|
||||
MessageChangeFileView msg(
|
||||
m_filePath,
|
||||
MessageChangeFileView::FILE_MAXIMIZED,
|
||||
MessageChangeFileView::VIEW_SINGLE,
|
||||
scrollParams,
|
||||
true
|
||||
);
|
||||
true);
|
||||
msg.setSchedulerId(m_navigator->getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ class QtCodeSnippet;
|
||||
class QVBoxLayout;
|
||||
class TimeStamp;
|
||||
|
||||
class QtCodeFile
|
||||
: public QFrame
|
||||
class QtCodeFile: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -59,7 +58,8 @@ public:
|
||||
void updateSnippets();
|
||||
void updateTitleBar();
|
||||
|
||||
void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
void findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
|
||||
public slots:
|
||||
void clickedMinimizeButton();
|
||||
@@ -80,4 +80,4 @@ private:
|
||||
bool m_isWholeFile;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_H
|
||||
#endif // QT_CODE_FILE_H
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#include "QtCodeFileList.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "utilityApp.h"
|
||||
#include "utility.h"
|
||||
#include "utilityApp.h"
|
||||
|
||||
#include "SourceLocationFile.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "QtCodeFile.h"
|
||||
#include "QtCodeFileTitleBar.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "QtCodeSnippet.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "utilityQt.h"
|
||||
#include "ColorScheme.h"
|
||||
|
||||
QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator)
|
||||
: QFrame()
|
||||
@@ -47,7 +47,8 @@ QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator)
|
||||
{
|
||||
// set style on scrollbar because it always has bright background by default
|
||||
m_lastSnippetScrollBar->setStyleSheet(
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"main/scrollbar.css")).c_str());
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(L"main/scrollbar.css"))
|
||||
.c_str());
|
||||
m_styleSize = m_lastSnippetScrollBar->styleSheet().size();
|
||||
}
|
||||
else
|
||||
@@ -56,7 +57,8 @@ QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator)
|
||||
}
|
||||
|
||||
m_lastSnippetScrollBar->hide();
|
||||
connect(m_lastSnippetScrollBar, &QScrollBar::valueChanged, this, &QtCodeFileList::scrollLastSnippet);
|
||||
connect(
|
||||
m_lastSnippetScrollBar, &QScrollBar::valueChanged, this, &QtCodeFileList::scrollLastSnippet);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
@@ -66,13 +68,21 @@ QtCodeFileList::QtCodeFileList(QtCodeNavigator* navigator)
|
||||
|
||||
m_scrollSpeedChangeListener.setScrollBar(m_scrollArea->verticalScrollBar());
|
||||
|
||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged, this, &QtCodeFileList::updateSnippetTitleAndScrollBar);
|
||||
connect(m_scrollArea->verticalScrollBar(), &QScrollBar::valueChanged, m_navigator, &QtCodeNavigator::scrolled);
|
||||
connect(
|
||||
m_scrollArea->verticalScrollBar(),
|
||||
&QScrollBar::valueChanged,
|
||||
this,
|
||||
&QtCodeFileList::updateSnippetTitleAndScrollBar);
|
||||
connect(
|
||||
m_scrollArea->verticalScrollBar(),
|
||||
&QScrollBar::valueChanged,
|
||||
m_navigator,
|
||||
&QtCodeNavigator::scrolled);
|
||||
}
|
||||
|
||||
void QtCodeFileList::clear()
|
||||
{
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
file->hide();
|
||||
file->deleteLater();
|
||||
@@ -94,7 +104,7 @@ QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
|
||||
{
|
||||
QtCodeFile* file = nullptr;
|
||||
|
||||
for (QtCodeFile* filePtr : m_files)
|
||||
for (QtCodeFile* filePtr: m_files)
|
||||
{
|
||||
if (filePtr->getFilePath() == filePath)
|
||||
{
|
||||
@@ -152,7 +162,7 @@ void QtCodeFileList::addFile(const CodeFileParams& params)
|
||||
{
|
||||
file->clearSnippets();
|
||||
|
||||
for (const CodeSnippetParams& snippetParams : params.snippetParams)
|
||||
for (const CodeSnippetParams& snippetParams: params.snippetParams)
|
||||
{
|
||||
file->addCodeSnippet(snippetParams);
|
||||
}
|
||||
@@ -178,7 +188,7 @@ void QtCodeFileList::updateSourceLocations(const CodeSnippetParams& params)
|
||||
|
||||
void QtCodeFileList::updateFiles()
|
||||
{
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
file->setProperty("last", file == m_files.back());
|
||||
file->updateContent();
|
||||
@@ -191,7 +201,11 @@ void QtCodeFileList::updateFiles()
|
||||
}
|
||||
|
||||
void QtCodeFileList::scrollTo(
|
||||
const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target)
|
||||
const FilePath& filePath,
|
||||
size_t lineNumber,
|
||||
Id locationId,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target)
|
||||
{
|
||||
QtCodeFile* file = getFile(filePath);
|
||||
if (!file)
|
||||
@@ -253,7 +267,7 @@ void QtCodeFileList::scrollTo(
|
||||
|
||||
void QtCodeFileList::onWindowFocus()
|
||||
{
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
file->updateTitleBar();
|
||||
}
|
||||
@@ -264,9 +278,10 @@ void QtCodeFileList::onWindowFocus()
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeFileList::findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
void QtCodeFileList::findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
{
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
file->findScreenMatches(query, screenMatches);
|
||||
}
|
||||
@@ -282,7 +297,7 @@ void QtCodeFileList::maximizeFirstFile()
|
||||
|
||||
std::pair<QtCodeFile*, Id> QtCodeFileList::getFirstFileWithActiveLocationId() const
|
||||
{
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
std::pair<QtCodeSnippet*, Id> snippet = file->getFirstSnippetWithActiveLocationId(0);
|
||||
if (snippet.first != nullptr)
|
||||
@@ -298,7 +313,7 @@ std::pair<QtCodeSnippet*, Id> QtCodeFileList::getFirstSnippetWithActiveLocationI
|
||||
{
|
||||
std::pair<QtCodeSnippet*, Id> result(nullptr, 0);
|
||||
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
result = file->getFirstSnippetWithActiveLocationId(tokenId);
|
||||
if (result.first != nullptr)
|
||||
@@ -329,21 +344,21 @@ void QtCodeFileList::updateSnippetTitleAndScrollBar(int value)
|
||||
|
||||
const QRect visibleRect(-m_filesArea->pos(), m_scrollArea->viewport()->size());
|
||||
|
||||
for (QtCodeFile* file : m_files)
|
||||
for (QtCodeFile* file: m_files)
|
||||
{
|
||||
QRect fileRect = getFocusRectForWidget(file, m_filesArea);
|
||||
|
||||
if (!firstFile && visibleRect.top() > fileRect.top() &&
|
||||
visibleRect.top() < fileRect.bottom() + 1 &&
|
||||
file->getVisibleSnippets().size())
|
||||
visibleRect.top() < fileRect.bottom() + 1 && file->getVisibleSnippets().size())
|
||||
{
|
||||
firstFile = file;
|
||||
fileTitleBarOffset = std::min(0, fileRect.bottom() + 1 - (visibleRect.top() + m_firstSnippetTitleBar->height()));
|
||||
fileTitleBarOffset = std::min(
|
||||
0, fileRect.bottom() + 1 - (visibleRect.top() + m_firstSnippetTitleBar->height()));
|
||||
}
|
||||
|
||||
if (visibleRect.bottom() > fileRect.top() && fileRect.bottom() > visibleRect.bottom())
|
||||
{
|
||||
for (QtCodeSnippet* snippet : file->getVisibleSnippets())
|
||||
for (QtCodeSnippet* snippet: file->getVisibleSnippets())
|
||||
{
|
||||
QScrollBar* scrollbar = snippet->getArea()->horizontalScrollBar();
|
||||
if (!scrollbar || scrollbar->minimum() == scrollbar->maximum())
|
||||
@@ -398,22 +413,33 @@ void QtCodeFileList::updateFirstSnippetTitleBar(const QtCodeFile* file, int file
|
||||
{
|
||||
m_firstSnippetTitleBar->updateFromOther(mirroredTitleBar);
|
||||
|
||||
connect(m_firstSnippetTitleBar, &QtCodeFileTitleBar::minimize, file, &QtCodeFile::clickedMinimizeButton);
|
||||
connect(m_firstSnippetTitleBar, &QtCodeFileTitleBar::snippet, file, &QtCodeFile::clickedSnippetButton);
|
||||
connect(m_firstSnippetTitleBar, &QtCodeFileTitleBar::maximize, file, &QtCodeFile::clickedMaximizeButton);
|
||||
connect(
|
||||
m_firstSnippetTitleBar,
|
||||
&QtCodeFileTitleBar::minimize,
|
||||
file,
|
||||
&QtCodeFile::clickedMinimizeButton);
|
||||
connect(
|
||||
m_firstSnippetTitleBar,
|
||||
&QtCodeFileTitleBar::snippet,
|
||||
file,
|
||||
&QtCodeFile::clickedSnippetButton);
|
||||
connect(
|
||||
m_firstSnippetTitleBar,
|
||||
&QtCodeFileTitleBar::maximize,
|
||||
file,
|
||||
&QtCodeFile::clickedMaximizeButton);
|
||||
|
||||
m_firstSnippetTitleBar->setGeometry(
|
||||
file->pos().x() + mirroredTitleBar->pos().x(),
|
||||
0,
|
||||
mirroredTitleBar->width(),
|
||||
mirroredTitleBar->height()
|
||||
);
|
||||
mirroredTitleBar->height());
|
||||
m_firstSnippetTitleBar->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Forces the title button icon to get reloaded next time, which fixes a color change issue when changing
|
||||
// color scheme
|
||||
// Forces the title button icon to get reloaded next time, which fixes a color change
|
||||
// issue when changing color scheme
|
||||
m_firstSnippetTitleBar->getTitleButton()->setFilePath(FilePath());
|
||||
m_firstSnippetTitleBar->hide();
|
||||
}
|
||||
@@ -446,7 +472,11 @@ void QtCodeFileList::updateLastSnippetScrollBar(QScrollBar* mirroredScrollBar)
|
||||
|
||||
if (mirroredScrollBar)
|
||||
{
|
||||
connect(mirroredScrollBar, &QScrollBar::valueChanged, this, &QtCodeFileList::scrollLastSnippetScrollBar);
|
||||
connect(
|
||||
mirroredScrollBar,
|
||||
&QScrollBar::valueChanged,
|
||||
this,
|
||||
&QtCodeFileList::scrollLastSnippetScrollBar);
|
||||
|
||||
m_lastSnippetScrollBar->setMinimum(mirroredScrollBar->minimum());
|
||||
m_lastSnippetScrollBar->setMaximum(mirroredScrollBar->maximum());
|
||||
@@ -458,8 +488,7 @@ void QtCodeFileList::updateLastSnippetScrollBar(QScrollBar* mirroredScrollBar)
|
||||
mirroredScrollBar->mapTo(m_scrollArea, mirroredScrollBar->pos()).x(),
|
||||
m_scrollArea->viewport()->size().height() - mirroredScrollBar->height(),
|
||||
mirroredScrollBar->width(),
|
||||
mirroredScrollBar->height()
|
||||
);
|
||||
mirroredScrollBar->height());
|
||||
m_lastSnippetScrollBar->show();
|
||||
|
||||
if (utility::getOsType() == OS_MAC)
|
||||
@@ -467,9 +496,11 @@ void QtCodeFileList::updateLastSnippetScrollBar(QScrollBar* mirroredScrollBar)
|
||||
// set style on scrollbar because it always has bright background by default
|
||||
QString style = m_lastSnippetScrollBar->styleSheet();
|
||||
style.resize(m_styleSize);
|
||||
m_lastSnippetScrollBar->setStyleSheet(style + (
|
||||
"\nQScrollBar:horizontal { background: " + ColorScheme::getInstance()->getColor("code/snippet/background") + "; }"
|
||||
).c_str());
|
||||
m_lastSnippetScrollBar->setStyleSheet(
|
||||
style +
|
||||
("\nQScrollBar:horizontal { background: " +
|
||||
ColorScheme::getInstance()->getColor("code/snippet/background") + "; }")
|
||||
.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,11 +38,17 @@ public:
|
||||
void updateSourceLocations(const CodeSnippetParams& params) override;
|
||||
void updateFiles() override;
|
||||
|
||||
void scrollTo(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target) override;
|
||||
void scrollTo(
|
||||
const FilePath& filePath,
|
||||
size_t lineNumber,
|
||||
Id locationId,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target) override;
|
||||
|
||||
void onWindowFocus() override;
|
||||
|
||||
void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) override;
|
||||
void findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) override;
|
||||
|
||||
void maximizeFirstFile();
|
||||
|
||||
@@ -79,4 +85,4 @@ private:
|
||||
int m_styleSize = 0;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_LIST
|
||||
#endif // QT_CODE_FILE_LIST
|
||||
|
||||
@@ -7,18 +7,17 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "FilePath.h"
|
||||
#include "logging.h"
|
||||
#include "MessageChangeFileView.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "QtCodeArea.h"
|
||||
#include "QtCodeFileTitleBar.h"
|
||||
#include "QtCodeFileTitleButton.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "logging.h"
|
||||
#include "utilityQt.h"
|
||||
|
||||
QtCodeFileSingle::QtCodeFileSingle(QtCodeNavigator* navigator, QWidget* parent)
|
||||
: m_navigator(navigator)
|
||||
, m_area(nullptr)
|
||||
: m_navigator(navigator), m_area(nullptr)
|
||||
{
|
||||
setObjectName("code_container");
|
||||
|
||||
@@ -34,7 +33,8 @@ QtCodeFileSingle::QtCodeFileSingle(QtCodeNavigator* navigator, QWidget* parent)
|
||||
|
||||
m_areaWrapper = new QWidget();
|
||||
m_areaWrapper->setObjectName("code_file_single");
|
||||
m_areaWrapper->setSizePolicy(m_areaWrapper->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding);
|
||||
m_areaWrapper->setSizePolicy(
|
||||
m_areaWrapper->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding);
|
||||
m_areaWrapper->setLayout(new QVBoxLayout());
|
||||
m_areaWrapper->layout()->setMargin(0);
|
||||
m_areaWrapper->layout()->setSpacing(0);
|
||||
@@ -50,7 +50,7 @@ void QtCodeFileSingle::clearCache()
|
||||
{
|
||||
clearFile();
|
||||
|
||||
for (auto& p : m_fileDatas)
|
||||
for (auto& p: m_fileDatas)
|
||||
{
|
||||
p.second.area->deleteLater();
|
||||
}
|
||||
@@ -106,8 +106,13 @@ bool QtCodeFileSingle::addFile(const CodeFileParams& params, bool useSingleFileC
|
||||
file.title = params.fileParams->title;
|
||||
}
|
||||
|
||||
file.area = new QtCodeArea(1, params.fileParams->code, locationFile, m_navigator, !params.fileParams->isOverview, this);
|
||||
connect(file.area->verticalScrollBar(), &QScrollBar::valueChanged, m_navigator, &QtCodeNavigator::scrolled);
|
||||
file.area = new QtCodeArea(
|
||||
1, params.fileParams->code, locationFile, m_navigator, !params.fileParams->isOverview, this);
|
||||
connect(
|
||||
file.area->verticalScrollBar(),
|
||||
&QScrollBar::valueChanged,
|
||||
m_navigator,
|
||||
&QtCodeNavigator::scrolled);
|
||||
|
||||
setFileData(file);
|
||||
updateRefCount(params.referenceCount);
|
||||
@@ -161,7 +166,11 @@ void QtCodeFileSingle::updateFiles()
|
||||
}
|
||||
|
||||
void QtCodeFileSingle::scrollTo(
|
||||
const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target)
|
||||
const FilePath& filePath,
|
||||
size_t lineNumber,
|
||||
Id locationId,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target)
|
||||
{
|
||||
if (m_currentFilePath != filePath)
|
||||
{
|
||||
@@ -200,7 +209,8 @@ void QtCodeFileSingle::onWindowFocus()
|
||||
m_titleBar->getTitleButton()->updateTexts();
|
||||
}
|
||||
|
||||
void QtCodeFileSingle::findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
void QtCodeFileSingle::findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
{
|
||||
if (m_area)
|
||||
{
|
||||
@@ -243,8 +253,8 @@ void QtCodeFileSingle::clickedSnippetButton()
|
||||
MessageChangeFileView::FILE_SNIPPETS,
|
||||
MessageChangeFileView::VIEW_LIST,
|
||||
CodeScrollParams::toFile(m_currentFilePath, CodeScrollParams::Target::TOP),
|
||||
true
|
||||
).dispatch();
|
||||
true)
|
||||
.dispatch();
|
||||
}
|
||||
|
||||
QtCodeFileSingle::FileData QtCodeFileSingle::getFileData(const FilePath& filePath) const
|
||||
@@ -319,7 +329,8 @@ void QtCodeFileSingle::setFileData(const FileData& file)
|
||||
void QtCodeFileSingle::updateRefCount(int refCount)
|
||||
{
|
||||
bool hasErrors = m_navigator->hasErrors();
|
||||
size_t fatalErrorCount = hasErrors ? m_navigator->getFatalErrorCountForFile(m_currentFilePath) : 0;
|
||||
size_t fatalErrorCount = hasErrors ? m_navigator->getFatalErrorCountForFile(m_currentFilePath)
|
||||
: 0;
|
||||
|
||||
m_titleBar->updateRefCount(refCount, hasErrors, fatalErrorCount);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,12 @@ public:
|
||||
void updateSourceLocations(const CodeSnippetParams& params) override;
|
||||
void updateFiles() override;
|
||||
|
||||
void scrollTo(const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target) override;
|
||||
void scrollTo(
|
||||
const FilePath& filePath,
|
||||
size_t lineNumber,
|
||||
Id locationId,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target) override;
|
||||
|
||||
void onWindowFocus() override;
|
||||
|
||||
@@ -84,4 +89,4 @@ private:
|
||||
std::shared_ptr<SourceLocationFile> m_lastLocationFile;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_SINGLE_H
|
||||
#endif // QT_CODE_FILE_SINGLE_H
|
||||
|
||||
@@ -16,7 +16,7 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
{
|
||||
setObjectName("title_bar");
|
||||
setProperty("hovering", isHovering);
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
|
||||
if (!isSingle)
|
||||
{
|
||||
@@ -31,21 +31,31 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
|
||||
FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/");
|
||||
|
||||
m_expandButton = new QtSelfRefreshIconButton("", imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this);
|
||||
m_collapseButton = new QtSelfRefreshIconButton("", imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this);
|
||||
m_expandButton = new QtSelfRefreshIconButton(
|
||||
"", imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this);
|
||||
m_collapseButton = new QtSelfRefreshIconButton(
|
||||
"", imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this);
|
||||
|
||||
m_expandButton->setToolTip("expand");
|
||||
m_collapseButton->setToolTip("collapse");
|
||||
|
||||
for (QtSelfRefreshIconButton* button : { m_expandButton, m_collapseButton })
|
||||
for (QtSelfRefreshIconButton* button: {m_expandButton, m_collapseButton})
|
||||
{
|
||||
button->setIconSize(QSize(9, 9));
|
||||
button->setObjectName("expand_button");
|
||||
titleLayout->addWidget(button);
|
||||
}
|
||||
|
||||
connect(m_expandButton, &QtSelfRefreshIconButton::clicked, this, &QtCodeFileTitleBar::clickedExpandButton);
|
||||
connect(m_collapseButton, &QtSelfRefreshIconButton::clicked, this, &QtCodeFileTitleBar::clickedCollapseButton);
|
||||
connect(
|
||||
m_expandButton,
|
||||
&QtSelfRefreshIconButton::clicked,
|
||||
this,
|
||||
&QtCodeFileTitleBar::clickedExpandButton);
|
||||
connect(
|
||||
m_collapseButton,
|
||||
&QtSelfRefreshIconButton::clicked,
|
||||
this,
|
||||
&QtCodeFileTitleBar::clickedCollapseButton);
|
||||
|
||||
m_titleButton = new QtCodeFileTitleButton(this);
|
||||
QSizePolicy policy = m_titleButton->sizePolicy();
|
||||
@@ -65,32 +75,39 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
m_showErrorsButton = new QPushButton("show errors");
|
||||
m_showErrorsButton->setObjectName("screen_button");
|
||||
m_showErrorsButton->setToolTip("Show all errors causing this file to be incomplete");
|
||||
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_showErrorsButton->hide();
|
||||
titleLayout->addWidget(m_showErrorsButton);
|
||||
|
||||
connect(m_showErrorsButton, &QPushButton::clicked,
|
||||
[this]()
|
||||
{
|
||||
MessageErrorsForFile(m_titleButton->getFilePath()).dispatch();
|
||||
}
|
||||
);
|
||||
connect(m_showErrorsButton, &QPushButton::clicked, [this]() {
|
||||
MessageErrorsForFile(m_titleButton->getFilePath()).dispatch();
|
||||
});
|
||||
|
||||
QColor inactiveColor(0x5E, 0x5D, 0x5D);
|
||||
|
||||
m_snippetButton = new QtIconStateButton(this);
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_DEFAULT, imageDir.getConcatenated(L"snippet_active.png"));
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_HOVERED, imageDir.getConcatenated(L"snippet_inactive.png"), inactiveColor);
|
||||
m_snippetButton->addState(QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"snippet_inactive.png"));
|
||||
m_snippetButton->addState(
|
||||
QtIconStateButton::STATE_DEFAULT, imageDir.getConcatenated(L"snippet_active.png"));
|
||||
m_snippetButton->addState(
|
||||
QtIconStateButton::STATE_HOVERED,
|
||||
imageDir.getConcatenated(L"snippet_inactive.png"),
|
||||
inactiveColor);
|
||||
m_snippetButton->addState(
|
||||
QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"snippet_inactive.png"));
|
||||
m_snippetButton->setToolTip("show snippets");
|
||||
|
||||
m_maximizeButton = new QtIconStateButton(this);
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_DEFAULT, imageDir.getConcatenated(L"maximize_active.png"));
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_HOVERED, imageDir.getConcatenated(L"maximize_inactive.png"), inactiveColor);
|
||||
m_maximizeButton->addState(QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"maximize_inactive.png"));
|
||||
m_maximizeButton->addState(
|
||||
QtIconStateButton::STATE_DEFAULT, imageDir.getConcatenated(L"maximize_active.png"));
|
||||
m_maximizeButton->addState(
|
||||
QtIconStateButton::STATE_HOVERED,
|
||||
imageDir.getConcatenated(L"maximize_inactive.png"),
|
||||
inactiveColor);
|
||||
m_maximizeButton->addState(
|
||||
QtIconStateButton::STATE_DISABLED, imageDir.getConcatenated(L"maximize_inactive.png"));
|
||||
m_maximizeButton->setToolTip("maximize");
|
||||
|
||||
for (QtIconStateButton* button : { m_snippetButton, m_maximizeButton })
|
||||
for (QtIconStateButton* button: {m_snippetButton, m_maximizeButton})
|
||||
{
|
||||
button->setIconSize(QSize(16, 16));
|
||||
button->setObjectName("file_button");
|
||||
@@ -98,8 +115,10 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
titleLayout->addWidget(button);
|
||||
}
|
||||
|
||||
connect(m_snippetButton, &QtIconStateButton::clicked, this, &QtCodeFileTitleBar::clickedSnippetButton);
|
||||
connect(m_maximizeButton, &QtIconStateButton::clicked, this, &QtCodeFileTitleBar::clickedMaximizeButton);
|
||||
connect(
|
||||
m_snippetButton, &QtIconStateButton::clicked, this, &QtCodeFileTitleBar::clickedSnippetButton);
|
||||
connect(
|
||||
m_maximizeButton, &QtIconStateButton::clicked, this, &QtCodeFileTitleBar::clickedMaximizeButton);
|
||||
|
||||
if (isSingle)
|
||||
{
|
||||
|
||||
@@ -9,8 +9,7 @@ class QtCodeFileTitleButton;
|
||||
class QtIconStateButton;
|
||||
class QtSelfRefreshIconButton;
|
||||
|
||||
class QtCodeFileTitleBar
|
||||
: public QtHoverButton
|
||||
class QtCodeFileTitleBar: public QtHoverButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -53,4 +52,4 @@ private:
|
||||
QtIconStateButton* m_maximizeButton;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_TITLE_BAR_H
|
||||
#endif // QT_CODE_FILE_TITLE_BAR_H
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include "utilityString.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "ColorScheme.h"
|
||||
#include "Project.h"
|
||||
#include "QtContextMenu.h"
|
||||
#include "ColorScheme.h"
|
||||
|
||||
QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
: QtSelfRefreshIconButton("", FilePath(), "code/file/title", parent)
|
||||
@@ -22,7 +22,7 @@ QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
, m_isIndexed(true)
|
||||
{
|
||||
setObjectName("title_button");
|
||||
minimumSizeHint(); // force font loading
|
||||
minimumSizeHint(); // force font loading
|
||||
|
||||
setFixedHeight(std::max(fontMetrics().height() * 1.2, 28.0));
|
||||
setSizePolicy(sizePolicy().horizontalPolicy(), QSizePolicy::Fixed);
|
||||
@@ -249,7 +249,8 @@ void QtCodeFileTitleButton::updateIcon()
|
||||
}
|
||||
else if (!m_isComplete)
|
||||
{
|
||||
setIconPath(ResourcePaths::getGuiPath().concatenate(L"graph_view/images/file_incomplete.png"));
|
||||
setIconPath(
|
||||
ResourcePaths::getGuiPath().concatenate(L"graph_view/images/file_incomplete.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -261,13 +262,14 @@ void QtCodeFileTitleButton::updateHatching()
|
||||
{
|
||||
if (!m_isIndexed)
|
||||
{
|
||||
FilePath hatchingFilePath = ResourcePaths::getGuiPath().concatenate(L"code_view/images/pattern_" +
|
||||
utility::decodeFromUtf8(ColorScheme::getInstance()->getColor("code/file/title/hatching")) + L".png"
|
||||
);
|
||||
FilePath hatchingFilePath = ResourcePaths::getGuiPath().concatenate(
|
||||
L"code_view/images/pattern_" +
|
||||
utility::decodeFromUtf8(
|
||||
ColorScheme::getInstance()->getColor("code/file/title/hatching")) +
|
||||
L".png");
|
||||
|
||||
setStyleSheet(QString::fromStdWString(
|
||||
L"#title_button { background-image: url(" + hatchingFilePath.wstr() + L"); }"
|
||||
));
|
||||
L"#title_button { background-image: url(" + hatchingFilePath.wstr() + L"); }"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
#include "QtSelfRefreshIconButton.h"
|
||||
#include "TimeStamp.h"
|
||||
|
||||
class QtCodeFileTitleButton
|
||||
: public QtSelfRefreshIconButton
|
||||
class QtCodeFileTitleButton: public QtSelfRefreshIconButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -51,4 +50,4 @@ private:
|
||||
QAction* m_openInTabAction;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_TITLE_BUTTON_H
|
||||
#endif // QT_CODE_FILE_TITLE_BUTTON_H
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
|
||||
#include "ApplicationSettings.h"
|
||||
|
||||
QtCodeNavigateable::~QtCodeNavigateable()
|
||||
{
|
||||
}
|
||||
QtCodeNavigateable::~QtCodeNavigateable() {}
|
||||
|
||||
void QtCodeNavigateable::ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget, const QWidget *childWidget, QRectF rect, bool animated, CodeScrollParams::Target target)
|
||||
const QWidget* parentWidget,
|
||||
const QWidget* childWidget,
|
||||
QRectF rect,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target)
|
||||
{
|
||||
QAbstractScrollArea* area = getScrollArea();
|
||||
if (!area || !parentWidget->isAncestorOf(childWidget))
|
||||
@@ -24,7 +26,8 @@ void QtCodeNavigateable::ensureWidgetVisibleAnimated(
|
||||
|
||||
if (rect.height() > 0)
|
||||
{
|
||||
focusRect = QRect(childWidget->mapTo(parentWidget, rect.topLeft().toPoint()), rect.size().toSize());
|
||||
focusRect = QRect(
|
||||
childWidget->mapTo(parentWidget, rect.topLeft().toPoint()), rect.size().toSize());
|
||||
|
||||
if (focusRect.height() < 100)
|
||||
{
|
||||
@@ -166,10 +169,12 @@ void QtCodeNavigateable::ensurePercentVisibleAnimated(
|
||||
}
|
||||
}
|
||||
|
||||
QRect QtCodeNavigateable::getFocusRectForWidget(const QWidget* childWidget, const QWidget* parentWidget) const
|
||||
QRect QtCodeNavigateable::getFocusRectForWidget(
|
||||
const QWidget* childWidget, const QWidget* parentWidget) const
|
||||
{
|
||||
const QRect microFocus = childWidget->inputMethodQuery(Qt::ImCursorRectangle).toRect();
|
||||
const QRect defaultMicroFocus = childWidget->QWidget::inputMethodQuery(Qt::ImCursorRectangle).toRect();
|
||||
const QRect defaultMicroFocus =
|
||||
childWidget->QWidget::inputMethodQuery(Qt::ImCursorRectangle).toRect();
|
||||
|
||||
if (microFocus != defaultMicroFocus)
|
||||
{
|
||||
@@ -180,4 +185,3 @@ QRect QtCodeNavigateable::getFocusRectForWidget(const QWidget* childWidget, cons
|
||||
return QRect(childWidget->mapTo(parentWidget, QPoint(0, 0)), childWidget->size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,18 +25,28 @@ public:
|
||||
virtual void updateFiles() = 0;
|
||||
|
||||
virtual void scrollTo(
|
||||
const FilePath& filePath, size_t lineNumber, Id locationId, bool animated, CodeScrollParams::Target target) = 0;
|
||||
const FilePath& filePath,
|
||||
size_t lineNumber,
|
||||
Id locationId,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target) = 0;
|
||||
|
||||
virtual void onWindowFocus() = 0;
|
||||
|
||||
virtual void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) = 0;
|
||||
virtual void findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches) = 0;
|
||||
|
||||
protected:
|
||||
void ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget, const QWidget *childWidget, QRectF rect, bool animated, CodeScrollParams::Target target);
|
||||
void ensurePercentVisibleAnimated(double percentA, double percentB, bool animated, CodeScrollParams::Target target);
|
||||
const QWidget* parentWidget,
|
||||
const QWidget* childWidget,
|
||||
QRectF rect,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target);
|
||||
void ensurePercentVisibleAnimated(
|
||||
double percentA, double percentB, bool animated, CodeScrollParams::Target target);
|
||||
|
||||
QRect getFocusRectForWidget(const QWidget* childWidget, const QWidget* parentWidget) const;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_NAVIGATEABLE_H
|
||||
#endif // QT_CODE_NAVIGATEABLE_H
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "ApplicationSettings.h"
|
||||
#include "logging.h"
|
||||
#include "MessageCodeReference.h"
|
||||
#include "MessageScrollCode.h"
|
||||
#include "MessageShowError.h"
|
||||
@@ -21,14 +20,12 @@
|
||||
#include "SourceLocationCollection.h"
|
||||
#include "SourceLocationFile.h"
|
||||
#include "TabId.h"
|
||||
#include "logging.h"
|
||||
#include "utility.h"
|
||||
#include "utilityQt.h"
|
||||
|
||||
QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_mode(MODE_NONE)
|
||||
, m_oldMode(MODE_NONE)
|
||||
, m_schedulerId(TabId::ignore())
|
||||
: QWidget(parent), m_mode(MODE_NONE), m_oldMode(MODE_NONE), m_schedulerId(TabId::ignore())
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
@@ -45,10 +42,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
navLayout->setContentsMargins(7, 7, 7, 6);
|
||||
|
||||
{
|
||||
m_prevReferenceButton =
|
||||
new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_up.png"), true);
|
||||
m_nextReferenceButton =
|
||||
new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
|
||||
m_prevReferenceButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_up.png"), true);
|
||||
m_nextReferenceButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
|
||||
|
||||
m_prevReferenceButton->setObjectName("reference_button_previous");
|
||||
m_nextReferenceButton->setObjectName("reference_button_next");
|
||||
@@ -62,8 +59,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
navLayout->addWidget(m_prevReferenceButton);
|
||||
navLayout->addWidget(m_nextReferenceButton);
|
||||
|
||||
connect(m_prevReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::previousReference);
|
||||
connect(m_nextReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::nextReference);
|
||||
connect(
|
||||
m_prevReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::previousReference);
|
||||
connect(
|
||||
m_nextReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::nextReference);
|
||||
|
||||
// m_refLabel = new QLabel("0 files | 0 references");
|
||||
m_refLabel = new QLabel("0 references");
|
||||
@@ -74,10 +73,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
}
|
||||
|
||||
{
|
||||
m_prevLocalReferenceButton =
|
||||
new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_up.png"), true);
|
||||
m_nextLocalReferenceButton =
|
||||
new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
|
||||
m_prevLocalReferenceButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_up.png"), true);
|
||||
m_nextLocalReferenceButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
|
||||
|
||||
m_prevLocalReferenceButton->setObjectName("local_reference_button_previous");
|
||||
m_nextLocalReferenceButton->setObjectName("local_reference_button_next");
|
||||
@@ -91,8 +90,16 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
navLayout->addWidget(m_prevLocalReferenceButton);
|
||||
navLayout->addWidget(m_nextLocalReferenceButton);
|
||||
|
||||
connect(m_prevLocalReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::previousLocalReference);
|
||||
connect(m_nextLocalReferenceButton, &QPushButton::clicked, this, &QtCodeNavigator::nextLocalReference);
|
||||
connect(
|
||||
m_prevLocalReferenceButton,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&QtCodeNavigator::previousLocalReference);
|
||||
connect(
|
||||
m_nextLocalReferenceButton,
|
||||
&QPushButton::clicked,
|
||||
this,
|
||||
&QtCodeNavigator::nextLocalReference);
|
||||
|
||||
m_localRefLabel = new QLabel("0/0 local references");
|
||||
m_localRefLabel->setObjectName("references_label");
|
||||
@@ -109,8 +116,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
m_localRefLabel->hide();
|
||||
}
|
||||
|
||||
m_listButton = new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/list.png"), true);
|
||||
m_fileButton = new QtSearchBarButton(ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"), true);
|
||||
m_listButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/list.png"), true);
|
||||
m_fileButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/file.png"), true);
|
||||
|
||||
m_listButton->setObjectName("mode_button_list");
|
||||
m_fileButton->setObjectName("mode_button_single");
|
||||
@@ -156,9 +165,7 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
updateFiles();
|
||||
}
|
||||
|
||||
QtCodeNavigator::~QtCodeNavigator()
|
||||
{
|
||||
}
|
||||
QtCodeNavigator::~QtCodeNavigator() {}
|
||||
|
||||
void QtCodeNavigator::addSnippetFile(const CodeFileParams& params)
|
||||
{
|
||||
@@ -180,7 +187,9 @@ void QtCodeNavigator::updateReferenceCount(
|
||||
{
|
||||
if (referenceIndex != referenceCount)
|
||||
{
|
||||
m_refLabel->setText(QString::number(referenceIndex + 1) + "/" + QString::number(referenceCount) + " references");
|
||||
m_refLabel->setText(
|
||||
QString::number(referenceIndex + 1) + "/" + QString::number(referenceCount) +
|
||||
" references");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -188,7 +197,9 @@ void QtCodeNavigator::updateReferenceCount(
|
||||
}
|
||||
|
||||
m_refLabel->setMinimumWidth(
|
||||
m_refLabel->fontMetrics().width(QString(QString::number(referenceCount).size() * 2, 'a') + "/ references") + 30);
|
||||
m_refLabel->fontMetrics().width(
|
||||
QString(QString::number(referenceCount).size() * 2, 'a') + "/ references") +
|
||||
30);
|
||||
|
||||
m_prevReferenceButton->setEnabled(referenceCount > 1);
|
||||
m_nextReferenceButton->setEnabled(referenceCount > 1);
|
||||
@@ -196,7 +207,9 @@ void QtCodeNavigator::updateReferenceCount(
|
||||
|
||||
if (localReferenceIndex != localReferenceCount)
|
||||
{
|
||||
m_localRefLabel->setText(QString::number(localReferenceIndex + 1) + "/" + QString::number(localReferenceCount) + " local references");
|
||||
m_localRefLabel->setText(
|
||||
QString::number(localReferenceIndex + 1) + "/" + QString::number(localReferenceCount) +
|
||||
" local references");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,7 +217,9 @@ void QtCodeNavigator::updateReferenceCount(
|
||||
}
|
||||
|
||||
m_localRefLabel->setMinimumWidth(
|
||||
m_localRefLabel->fontMetrics().width(QString(QString::number(localReferenceCount).size() * 2, 'a') + "/ local references") + 30);
|
||||
m_localRefLabel->fontMetrics().width(
|
||||
QString(QString::number(localReferenceCount).size() * 2, 'a') + "/ local references") +
|
||||
30);
|
||||
|
||||
m_nextLocalReferenceButton->setVisible(localReferenceCount > 1);
|
||||
m_prevLocalReferenceButton->setVisible(localReferenceCount > 1);
|
||||
@@ -279,7 +294,8 @@ const std::set<Id>& QtCodeNavigator::getCurrentActiveTokenIds() const
|
||||
|
||||
void QtCodeNavigator::setCurrentActiveTokenIds(const std::vector<Id>& currentActiveTokenIds)
|
||||
{
|
||||
m_currentActiveTokenIds = std::set<Id>(currentActiveTokenIds.begin(), currentActiveTokenIds.end());
|
||||
m_currentActiveTokenIds = std::set<Id>(
|
||||
currentActiveTokenIds.begin(), currentActiveTokenIds.end());
|
||||
m_currentActiveLocationIds.clear();
|
||||
}
|
||||
|
||||
@@ -290,9 +306,10 @@ const std::set<Id>& QtCodeNavigator::getCurrentActiveLocationIds() const
|
||||
|
||||
void QtCodeNavigator::setCurrentActiveLocationIds(const std::vector<Id>& currentActiveLocationIds)
|
||||
{
|
||||
setActiveLocalTokenIds({ }, LOCATION_TOKEN);
|
||||
setActiveLocalTokenIds({}, LOCATION_TOKEN);
|
||||
|
||||
m_currentActiveLocationIds = std::set<Id>(currentActiveLocationIds.begin(), currentActiveLocationIds.end());
|
||||
m_currentActiveLocationIds = std::set<Id>(
|
||||
currentActiveLocationIds.begin(), currentActiveLocationIds.end());
|
||||
m_currentActiveTokenIds.clear();
|
||||
}
|
||||
|
||||
@@ -303,7 +320,8 @@ const std::set<Id>& QtCodeNavigator::getCurrentActiveLocalLocationIds() const
|
||||
|
||||
void QtCodeNavigator::setCurrentActiveLocalLocationIds(const std::vector<Id>& currentActiveLocalLocationIds)
|
||||
{
|
||||
m_currentActiveLocalLocationIds = std::set<Id>(currentActiveLocalLocationIds.begin(), currentActiveLocalLocationIds.end());
|
||||
m_currentActiveLocalLocationIds = std::set<Id>(
|
||||
currentActiveLocalLocationIds.begin(), currentActiveLocalLocationIds.end());
|
||||
}
|
||||
|
||||
const std::set<Id>& QtCodeNavigator::getActiveTokenIds() const
|
||||
@@ -313,7 +331,7 @@ const std::set<Id>& QtCodeNavigator::getActiveTokenIds() const
|
||||
|
||||
void QtCodeNavigator::setActiveTokenIds(const std::vector<Id>& activeTokenIds)
|
||||
{
|
||||
setActiveLocalTokenIds({ }, LOCATION_TOKEN);
|
||||
setActiveLocalTokenIds({}, LOCATION_TOKEN);
|
||||
setCurrentActiveTokenIds(activeTokenIds);
|
||||
|
||||
m_activeTokenIds = std::set<Id>(activeTokenIds.begin(), activeTokenIds.end());
|
||||
@@ -324,9 +342,10 @@ const std::set<Id>& QtCodeNavigator::getActiveLocalTokenIds() const
|
||||
return m_activeLocalTokenIds;
|
||||
}
|
||||
|
||||
void QtCodeNavigator::setActiveLocalTokenIds(const std::vector<Id>& activeLocalTokenIds, LocationType locationType)
|
||||
void QtCodeNavigator::setActiveLocalTokenIds(
|
||||
const std::vector<Id>& activeLocalTokenIds, LocationType locationType)
|
||||
{
|
||||
setCurrentActiveLocalLocationIds({ });
|
||||
setCurrentActiveLocalLocationIds({});
|
||||
|
||||
m_activeLocalTokenIds = std::set<Id>(activeLocalTokenIds.begin(), activeLocalTokenIds.end());
|
||||
}
|
||||
@@ -357,7 +376,7 @@ void QtCodeNavigator::setErrorInfos(const std::vector<ErrorInfo>& errorInfos)
|
||||
{
|
||||
m_errorInfos.clear();
|
||||
|
||||
for (const ErrorInfo& info : errorInfos)
|
||||
for (const ErrorInfo& info: errorInfos)
|
||||
{
|
||||
m_errorInfos.emplace(info.id, info);
|
||||
}
|
||||
@@ -371,7 +390,7 @@ bool QtCodeNavigator::hasErrors() const
|
||||
size_t QtCodeNavigator::getFatalErrorCountForFile(const FilePath& filePath) const
|
||||
{
|
||||
size_t fatalErrorCount = 0;
|
||||
for (const std::pair<Id, ErrorInfo>& p : m_errorInfos)
|
||||
for (const std::pair<Id, ErrorInfo>& p: m_errorInfos)
|
||||
{
|
||||
const ErrorInfo& error = p.second;
|
||||
if (error.filePath == filePath.wstr() && error.fatal)
|
||||
@@ -400,7 +419,7 @@ void QtCodeNavigator::focusTokenIds(const std::vector<Id>& focusedTokenIds)
|
||||
|
||||
void QtCodeNavigator::defocusTokenIds()
|
||||
{
|
||||
setFocusedTokenIds({ });
|
||||
setFocusedTokenIds({});
|
||||
updateFiles();
|
||||
}
|
||||
|
||||
@@ -415,21 +434,21 @@ void QtCodeNavigator::updateFiles()
|
||||
|
||||
switch (m_mode)
|
||||
{
|
||||
case MODE_SINGLE:
|
||||
m_list->hide();
|
||||
m_single->show();
|
||||
m_separatorLine->hide();
|
||||
break;
|
||||
case MODE_SINGLE:
|
||||
m_list->hide();
|
||||
m_single->show();
|
||||
m_separatorLine->hide();
|
||||
break;
|
||||
|
||||
case MODE_LIST:
|
||||
m_single->hide();
|
||||
m_list->show();
|
||||
m_separatorLine->show();
|
||||
break;
|
||||
case MODE_LIST:
|
||||
m_single->hide();
|
||||
m_list->show();
|
||||
m_separatorLine->show();
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR("Wrong mode set in code navigator");
|
||||
return;
|
||||
default:
|
||||
LOG_ERROR("Wrong mode set in code navigator");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationSettings::getInstance()->setCodeViewModeSingle(m_mode == MODE_SINGLE);
|
||||
@@ -460,8 +479,12 @@ void QtCodeNavigator::activateScreenMatch(size_t matchIndex)
|
||||
m_currentActiveLocationIds.insert(m_activeScreenMatchId);
|
||||
p.first->updateContent();
|
||||
|
||||
scrollTo(CodeScrollParams::toReference(
|
||||
p.first->getSourceLocationFile()->getFilePath(),m_activeScreenMatchId, CodeScrollParams::Target::CENTER), true);
|
||||
scrollTo(
|
||||
CodeScrollParams::toReference(
|
||||
p.first->getSourceLocationFile()->getFilePath(),
|
||||
m_activeScreenMatchId,
|
||||
CodeScrollParams::Target::CENTER),
|
||||
true);
|
||||
}
|
||||
|
||||
void QtCodeNavigator::deactivateScreenMatch(size_t matchIndex)
|
||||
@@ -490,7 +513,7 @@ void QtCodeNavigator::clearScreenMatches()
|
||||
m_activeScreenMatchId = 0;
|
||||
}
|
||||
|
||||
for (auto p : m_screenMatches)
|
||||
for (auto p: m_screenMatches)
|
||||
{
|
||||
p.first->clearScreenMatches();
|
||||
}
|
||||
@@ -506,33 +529,27 @@ void QtCodeNavigator::scrollTo(const CodeScrollParams& params, bool animated)
|
||||
return;
|
||||
}
|
||||
|
||||
std::function<void()> func = [=](){};
|
||||
std::function<void()> func = [=]() {};
|
||||
|
||||
switch (params.type)
|
||||
{
|
||||
case CodeScrollParams::Type::TO_REFERENCE:
|
||||
func = [=]()
|
||||
{
|
||||
func = [=]() {
|
||||
m_current->scrollTo(params.filePath, 0, params.locationId, animated, params.target);
|
||||
};
|
||||
break;
|
||||
case CodeScrollParams::Type::TO_FILE:
|
||||
func = [=]()
|
||||
{
|
||||
m_current->scrollTo(params.filePath, 0, 0, animated, params.target);
|
||||
};
|
||||
func = [=]() { m_current->scrollTo(params.filePath, 0, 0, animated, params.target); };
|
||||
break;
|
||||
case CodeScrollParams::Type::TO_LINE:
|
||||
func = [=]()
|
||||
{
|
||||
func = [=]() {
|
||||
m_current->scrollTo(params.filePath, params.line, 0, animated, params.target);
|
||||
};
|
||||
break;
|
||||
case CodeScrollParams::Type::TO_VALUE:
|
||||
if ((m_mode == MODE_LIST) == params.inListMode)
|
||||
{
|
||||
func = [=]()
|
||||
{
|
||||
func = [=]() {
|
||||
QAbstractScrollArea* area = m_current->getScrollArea();
|
||||
if (area)
|
||||
{
|
||||
@@ -617,33 +634,18 @@ void QtCodeNavigator::setModeSingle()
|
||||
|
||||
void QtCodeNavigator::handleMessage(MessageIndexingFinished* message)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
clearCache();
|
||||
}
|
||||
);
|
||||
m_onQtThread([=]() { clearCache(); });
|
||||
}
|
||||
|
||||
void QtCodeNavigator::handleMessage(MessageSwitchColorScheme* message)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
clearCache();
|
||||
}
|
||||
);
|
||||
m_onQtThread([=]() { clearCache(); });
|
||||
}
|
||||
|
||||
void QtCodeNavigator::handleMessage(MessageWindowFocus* message)
|
||||
{
|
||||
if (message->focusIn)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_current->onWindowFocus();
|
||||
}
|
||||
);
|
||||
m_onQtThread([=]() { m_current->onWindowFocus(); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
#include "ErrorInfo.h"
|
||||
#include "LocationType.h"
|
||||
#include "MessageIndexingFinished.h"
|
||||
#include "MessageListener.h"
|
||||
#include "MessageSwitchColorScheme.h"
|
||||
#include "MessageWindowFocus.h"
|
||||
#include "QtCodeFileList.h"
|
||||
#include "QtCodeFileSingle.h"
|
||||
#include "QtThreadedFunctor.h"
|
||||
#include "MessageListener.h"
|
||||
#include "MessageIndexingFinished.h"
|
||||
#include "MessageSwitchColorScheme.h"
|
||||
#include "MessageWindowFocus.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
@@ -42,7 +42,10 @@ public:
|
||||
bool addSingleFile(const CodeFileParams& params, bool useSingleFileCache);
|
||||
void updateSourceLocations(const CodeSnippetParams& params);
|
||||
void updateReferenceCount(
|
||||
size_t referenceCount, size_t referenceIndex, size_t localReferenceCount, size_t localReferenceIndex);
|
||||
size_t referenceCount,
|
||||
size_t referenceIndex,
|
||||
size_t localReferenceCount,
|
||||
size_t localReferenceIndex);
|
||||
|
||||
void clear();
|
||||
void clearSnippets();
|
||||
@@ -157,4 +160,4 @@ private:
|
||||
Id m_activeScreenMatchId = 0;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_NAVIGATOR_H
|
||||
#endif // QT_CODE_NAVIGATOR_H
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#include "QtCodeSnippet.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <qmenu.h>
|
||||
#include <QPushButton>
|
||||
#include <qmenu.h>
|
||||
|
||||
#include "MessageShowScope.h"
|
||||
|
||||
#include "SourceLocationFile.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "QtCodeFile.h"
|
||||
#include "QtCodeNavigator.h"
|
||||
#include "SourceLocationFile.h"
|
||||
|
||||
QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* navigator, QtCodeFile* file)
|
||||
: QFrame(file)
|
||||
@@ -33,7 +33,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
|
||||
if (!m_titleString.empty() && !params.isOverview)
|
||||
{
|
||||
m_title = createScopeLine(layout);
|
||||
if (m_titleId == 0) // title is a file path
|
||||
if (m_titleId == 0) // title is a file path
|
||||
{
|
||||
m_title->setText(QString::fromStdWString(FilePath(m_titleString).fileName()));
|
||||
}
|
||||
@@ -44,13 +44,14 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
|
||||
connect(m_title, &QPushButton::clicked, this, &QtCodeSnippet::clickedTitle);
|
||||
}
|
||||
|
||||
m_codeArea = new QtCodeArea(params.startLineNumber, params.code, params.locationFile, navigator, !params.isOverview, this);
|
||||
m_codeArea = new QtCodeArea(
|
||||
params.startLineNumber, params.code, params.locationFile, navigator, !params.isOverview, this);
|
||||
layout->addWidget(m_codeArea);
|
||||
|
||||
if (!m_footerString.empty())
|
||||
{
|
||||
m_footer = createScopeLine(layout);
|
||||
if (m_footerId == 0) // footer is a file path
|
||||
if (m_footerId == 0) // footer is a file path
|
||||
{
|
||||
m_footer->setText(QString::fromStdWString(FilePath(m_footerString).fileName()));
|
||||
}
|
||||
@@ -62,9 +63,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
|
||||
}
|
||||
}
|
||||
|
||||
QtCodeSnippet::~QtCodeSnippet()
|
||||
{
|
||||
}
|
||||
QtCodeSnippet::~QtCodeSnippet() {}
|
||||
|
||||
QtCodeFile* QtCodeSnippet::getFile() const
|
||||
{
|
||||
@@ -146,7 +145,8 @@ std::string QtCodeSnippet::getCode() const
|
||||
return m_codeArea->getCode();
|
||||
}
|
||||
|
||||
void QtCodeSnippet::findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
void QtCodeSnippet::findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
|
||||
{
|
||||
m_codeArea->findScreenMatches(query, screenMatches);
|
||||
}
|
||||
@@ -190,14 +190,14 @@ QPushButton* QtCodeSnippet::createScopeLine(QBoxLayout* layout)
|
||||
|
||||
QPushButton* dots = new QPushButton(this);
|
||||
dots->setObjectName("dots");
|
||||
dots->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
dots->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
lineLayout->addWidget(dots);
|
||||
m_dots.push_back(dots);
|
||||
|
||||
QPushButton* line = new QPushButton(this);
|
||||
line->setObjectName("scope_name");
|
||||
line->minimumSizeHint(); // force font loading
|
||||
line->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
line->minimumSizeHint(); // force font loading
|
||||
line->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
lineLayout->addWidget(line);
|
||||
|
||||
@@ -206,7 +206,7 @@ QPushButton* QtCodeSnippet::createScopeLine(QBoxLayout* layout)
|
||||
|
||||
void QtCodeSnippet::updateDots()
|
||||
{
|
||||
for (QPushButton* dots : m_dots)
|
||||
for (QPushButton* dots: m_dots)
|
||||
{
|
||||
dots->setText(QString::fromStdString(std::string(lineNumberDigits(), '.')));
|
||||
dots->setMinimumWidth(m_codeArea->lineNumberAreaWidth());
|
||||
|
||||
@@ -17,8 +17,7 @@ class QtCodeFile;
|
||||
class QtCodeNavigator;
|
||||
class SourceLocationFile;
|
||||
|
||||
class QtCodeSnippet
|
||||
: public QFrame
|
||||
class QtCodeSnippet: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -49,7 +48,8 @@ public:
|
||||
|
||||
std::string getCode() const;
|
||||
|
||||
void findScreenMatches(const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
void findScreenMatches(
|
||||
const std::wstring& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches);
|
||||
|
||||
void ensureLocationIdVisible(Id locationId, bool animated);
|
||||
|
||||
@@ -77,4 +77,4 @@ private:
|
||||
QtCodeArea* m_codeArea;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_SNIPPET_H
|
||||
#endif // QT_CODE_SNIPPET_H
|
||||
|
||||
Reference in New Issue
Block a user