ui: Added single file mode to code view
* Added navigation to top of code view for iterating references and switching between list and single file mode * current file name and reference count is shown on top in single file mode * refactored scrolling to location or line via request system * added parameters animated and toTop to scrolling system * refactored class hierarchy and removed unused stuff in list mode
This commit is contained in:
@@ -12,8 +12,6 @@
|
||||
|
||||
QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
: CodeView(viewLayout)
|
||||
, m_refreshViewFunctor(std::bind(&QtCodeView::doRefreshView, this))
|
||||
, m_clearFunctor(std::bind(&QtCodeView::doClear, this))
|
||||
, m_showCodeSnippetsFunctor(
|
||||
std::bind(&QtCodeView::doShowCodeSnippets, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))
|
||||
, m_addCodeSnippetsFunctor(std::bind(&QtCodeView::doAddCodeSnippets, this, std::placeholders::_1, std::placeholders::_2))
|
||||
@@ -23,10 +21,6 @@ QtCodeView::QtCodeView(ViewLayout* viewLayout)
|
||||
, m_doShowActiveTokenIdsFunctor(std::bind(&QtCodeView::doShowActiveTokenIds, this, std::placeholders::_1))
|
||||
, m_doShowActiveLocalSymbolIdsFunctor(std::bind(&QtCodeView::doShowActiveLocalSymbolIds, this, std::placeholders::_1))
|
||||
, m_focusTokenIdsFunctor(std::bind(&QtCodeView::doFocusTokenIds, this, std::placeholders::_1))
|
||||
, m_defocusTokenIdsFunctor(std::bind(&QtCodeView::doDefocusTokenIds, this))
|
||||
, m_showContentsFunctor(std::bind(&QtCodeView::doShowContents, this))
|
||||
, m_scrollToValueFunctor(std::bind(&QtCodeView::doScrollToValue, this, std::placeholders::_1))
|
||||
, m_scrollToLineFunctor(std::bind(&QtCodeView::doScrollToLine, this, std::placeholders::_1, std::placeholders::_2))
|
||||
{
|
||||
m_widget = new QtCodeNavigator();
|
||||
setStyleSheet();
|
||||
@@ -47,12 +41,25 @@ void QtCodeView::initView()
|
||||
|
||||
void QtCodeView::refreshView()
|
||||
{
|
||||
m_refreshViewFunctor();
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
setStyleSheet();
|
||||
|
||||
QtCodeArea::clearAnnotationColors();
|
||||
QtHighlighter::clearHighlightingRules();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::clear()
|
||||
{
|
||||
m_clearFunctor();
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->clearCodeSnippets();
|
||||
}
|
||||
);
|
||||
|
||||
m_errorInfos.clear();
|
||||
}
|
||||
@@ -106,22 +113,42 @@ void QtCodeView::focusTokenIds(const std::vector<Id>& focusedTokenIds)
|
||||
|
||||
void QtCodeView::defocusTokenIds()
|
||||
{
|
||||
m_defocusTokenIdsFunctor();
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->defocusTokenIds();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::showContents()
|
||||
{
|
||||
m_showContentsFunctor();
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->showContents();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::scrollToValue(int value)
|
||||
void QtCodeView::scrollToValue(int value, bool inListMode)
|
||||
{
|
||||
m_scrollToValueFunctor(value);
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->scrollToValue(value, inListMode);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::scrollToLine(const FilePath filePath, unsigned int line)
|
||||
{
|
||||
m_scrollToLineFunctor(filePath, line);
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_widget->scrollToLine(filePath, line);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::scrollToDefinition()
|
||||
@@ -134,19 +161,6 @@ void QtCodeView::scrollToDefinition()
|
||||
);
|
||||
}
|
||||
|
||||
void QtCodeView::doRefreshView()
|
||||
{
|
||||
setStyleSheet();
|
||||
|
||||
QtCodeArea::clearAnnotationColors();
|
||||
QtHighlighter::clearHighlightingRules();
|
||||
}
|
||||
|
||||
void QtCodeView::doClear()
|
||||
{
|
||||
m_widget->clearCodeSnippets();
|
||||
}
|
||||
|
||||
void QtCodeView::doShowCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles)
|
||||
{
|
||||
@@ -165,6 +179,8 @@ void QtCodeView::doShowCodeSnippets(
|
||||
}
|
||||
}
|
||||
|
||||
m_widget->addedFiles();
|
||||
|
||||
if (setupFiles)
|
||||
{
|
||||
m_widget->setupFiles();
|
||||
@@ -228,26 +244,6 @@ void QtCodeView::doFocusTokenIds(const std::vector<Id>& focusedTokenIds)
|
||||
m_widget->focusTokenIds(focusedTokenIds);
|
||||
}
|
||||
|
||||
void QtCodeView::doDefocusTokenIds()
|
||||
{
|
||||
m_widget->defocusTokenIds();
|
||||
}
|
||||
|
||||
void QtCodeView::doShowContents()
|
||||
{
|
||||
m_widget->showContents();
|
||||
}
|
||||
|
||||
void QtCodeView::doScrollToValue(int value)
|
||||
{
|
||||
m_widget->scrollToValue(value);
|
||||
}
|
||||
|
||||
void QtCodeView::doScrollToLine(const FilePath filePath, unsigned int line)
|
||||
{
|
||||
m_widget->scrollToLine(filePath, line);
|
||||
}
|
||||
|
||||
void QtCodeView::setStyleSheet() const
|
||||
{
|
||||
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background"));
|
||||
|
||||
@@ -47,14 +47,11 @@ public:
|
||||
|
||||
virtual void showContents();
|
||||
|
||||
virtual void scrollToValue(int value);
|
||||
virtual void scrollToValue(int value, bool inListMode);
|
||||
virtual void scrollToLine(const FilePath filePath, unsigned int line);
|
||||
virtual void scrollToDefinition();
|
||||
|
||||
private:
|
||||
void doRefreshView();
|
||||
void doClear();
|
||||
|
||||
void doShowCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles);
|
||||
void doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
|
||||
@@ -67,17 +64,9 @@ private:
|
||||
void doShowActiveLocalSymbolIds(const std::vector<Id>& localSymbolIds);
|
||||
|
||||
void doFocusTokenIds(const std::vector<Id>& focusedTokenIds);
|
||||
void doDefocusTokenIds();
|
||||
|
||||
void doShowContents();
|
||||
|
||||
void doScrollToValue(int value);
|
||||
void doScrollToLine(const FilePath filePath, unsigned int line);
|
||||
|
||||
void setStyleSheet() const;
|
||||
|
||||
QtThreadedFunctor<> m_refreshViewFunctor;
|
||||
QtThreadedFunctor<> m_clearFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, const std::vector<Id>&, bool> m_showCodeSnippetsFunctor;
|
||||
QtThreadedFunctor<const std::vector<CodeSnippetParams>&, bool> m_addCodeSnippetsFunctor;
|
||||
QtThreadedFunctor<const FilePath, FileState> m_setFileStateFunctor;
|
||||
@@ -85,10 +74,6 @@ private:
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_doShowActiveTokenIdsFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_doShowActiveLocalSymbolIdsFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_focusTokenIdsFunctor;
|
||||
QtThreadedFunctor<> m_defocusTokenIdsFunctor;
|
||||
QtThreadedFunctor<> m_showContentsFunctor;
|
||||
QtThreadedFunctor<int> m_scrollToValueFunctor;
|
||||
QtThreadedFunctor<const FilePath, unsigned int> m_scrollToLineFunctor;
|
||||
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user