logic: Refactored Code View to process all contents in one update
* Use unified showCodeSnippets method for setting file information on CodeView * Made async initial file and snippet expansion synced * Add ScrollParams API to CodeView * Regard scope size when scrolling to definition * Only use QtThreadedLambdaFunctor in QtCodeView now
This commit is contained in:
@@ -1,17 +1,10 @@
|
||||
#ifndef QT_CODE_VIEW_H
|
||||
#define QT_CODE_VIEW_H
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
#include "component/view/CodeView.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
class QFrame;
|
||||
class QtCodeNavigator;
|
||||
class QWidget;
|
||||
|
||||
class QtCodeView
|
||||
: public CodeView
|
||||
@@ -27,15 +20,12 @@ public:
|
||||
|
||||
// CodeView implementation
|
||||
virtual void clear();
|
||||
virtual void clearCodeSnippets();
|
||||
|
||||
virtual void setErrorInfos(const std::vector<ErrorInfo>& errorInfos);
|
||||
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const CodeParams params);
|
||||
virtual void scrollTo(const ScrollParams params);
|
||||
|
||||
virtual bool showsErrors() const;
|
||||
|
||||
virtual void showCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles);
|
||||
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
|
||||
|
||||
virtual void setFileState(const FilePath filePath, FileState state);
|
||||
|
||||
virtual void showActiveSnippet(
|
||||
@@ -48,41 +38,20 @@ public:
|
||||
|
||||
virtual void showContents();
|
||||
|
||||
virtual void scrollToValue(int value, bool inListMode);
|
||||
virtual void scrollToLine(const FilePath filePath, unsigned int line);
|
||||
virtual void scrollToDefinition(bool ignoreActiveReference);
|
||||
|
||||
virtual bool isInListMode() const;
|
||||
virtual bool hasSingleFileCached(const FilePath& filePath) const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void doShowCodeSnippets(
|
||||
const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds, bool setupFiles);
|
||||
void doAddCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert);
|
||||
|
||||
void doSetFileState(const FilePath filePath, FileState state);
|
||||
|
||||
void doShowActiveSnippet(
|
||||
const std::vector<Id>& activeTokenIds, std::shared_ptr<SourceLocationCollection> collection, bool scrollTo);
|
||||
void doShowActiveTokenIds(const std::vector<Id>& activeTokenIds);
|
||||
void doShowActiveLocalSymbolIds(const std::vector<Id>& localSymbolIds);
|
||||
|
||||
void doFocusTokenIds(const std::vector<Id>& focusedTokenIds);
|
||||
|
||||
void performScroll();
|
||||
void setStyleSheet() const;
|
||||
|
||||
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;
|
||||
QtThreadedFunctor<const std::vector<Id>&, std::shared_ptr<SourceLocationCollection>, bool> m_doShowActiveSnippetFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_doShowActiveTokenIdsFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_doShowActiveLocalSymbolIdsFunctor;
|
||||
QtThreadedFunctor<const std::vector<Id>&> m_focusTokenIdsFunctor;
|
||||
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
QtCodeNavigator* m_widget;
|
||||
|
||||
std::vector<ErrorInfo> m_errorInfos;
|
||||
ScrollParams m_scrollParams;
|
||||
};
|
||||
|
||||
# endif // QT_CODE_VIEW_H
|
||||
|
||||
Reference in New Issue
Block a user