ui: Added shortcuts for navigating to next and previous reference in code view
* Added new class QtCodeNavigator between QtCodeView and QtCodeFileList that handles active ids and navigation * Pass all files as initially collapsed to code view and decide in QtCodeNavigator which ones show content * Rewrote requesting of active snippet display to top down approach * Display other locations focused when active location changes * Show corresponding edges when navigating references
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include <QFrame>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/TimePoint.h"
|
||||
@@ -15,11 +14,12 @@
|
||||
#include "component/view/helper/CodeSnippetParams.h"
|
||||
|
||||
class QtCodeFile;
|
||||
class QtCodeNavigator;
|
||||
class QtCodeSnippet;
|
||||
class TokenLocationFile;
|
||||
|
||||
class QtCodeFileList
|
||||
: public QScrollArea
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -27,7 +27,7 @@ signals:
|
||||
void shouldScrollToSnippet(QtCodeSnippet* widget, uint lineNumber);
|
||||
|
||||
public:
|
||||
QtCodeFileList(QWidget* parent = 0);
|
||||
QtCodeFileList(QtCodeNavigator* navigator);
|
||||
virtual ~QtCodeFileList();
|
||||
|
||||
void addCodeSnippet(const CodeSnippetParams& params, bool insert = false);
|
||||
@@ -35,27 +35,9 @@ public:
|
||||
|
||||
void clearCodeSnippets();
|
||||
|
||||
const std::vector<Id>& getActiveTokenIds() const;
|
||||
void setActiveTokenIds(const std::vector<Id>& activeTokenIds);
|
||||
void showLocation(const FilePath& filePath, Id locationId, bool scrollTo);
|
||||
|
||||
const std::vector<Id>& getActiveLocalSymbolIds() const;
|
||||
void setActiveLocalSymbolIds(const std::vector<Id>& activeLocalSymbolIds);
|
||||
|
||||
const std::vector<Id>& getFocusedTokenIds() const;
|
||||
void setFocusedTokenIds(const std::vector<Id>& focusedTokenIds);
|
||||
|
||||
std::vector<std::string> getErrorMessages() const;
|
||||
void setErrorInfos(const std::vector<ErrorInfo>& errorInfos);
|
||||
|
||||
bool hasErrors() const;
|
||||
size_t getFatalErrorCountForFile(const FilePath& filePath) const;
|
||||
|
||||
void showActiveTokenIds();
|
||||
|
||||
void showFirstActiveSnippet(bool scrollTo);
|
||||
|
||||
void focusTokenIds(const std::vector<Id>& focusedTokenIds);
|
||||
void defocusTokenIds();
|
||||
void requestFileContent(const FilePath& filePath);
|
||||
|
||||
void setFileMinimized(const FilePath path);
|
||||
void setFileSnippets(const FilePath path);
|
||||
@@ -63,32 +45,23 @@ public:
|
||||
|
||||
void updateFiles();
|
||||
void showContents();
|
||||
void scrollToValue(int value);
|
||||
void scrollToLine(std::string, unsigned int line);
|
||||
void scrollToActiveFileIfRequested();
|
||||
|
||||
private slots:
|
||||
void scrolled(int value);
|
||||
void scrollToSnippet(QtCodeSnippet* snippet, uint lineNumber);
|
||||
void setValue();
|
||||
void scrollToLocation(QtCodeFile* file, Id locationId, bool scrollTo);
|
||||
void scrollToLine(std::string filename, unsigned int line);
|
||||
void scrollToSnippetIfRequested();
|
||||
|
||||
private:
|
||||
QtCodeFile* getFile(const FilePath filePath);
|
||||
QtCodeSnippet* getFirstActiveSnippet() const;
|
||||
|
||||
void expandActiveSnippetFile(bool scrollTo);
|
||||
void ensureWidgetVisibleAnimated(QWidget *childWidget, QRectF rect);
|
||||
|
||||
std::shared_ptr<QFrame> m_frame;
|
||||
QtCodeNavigator* m_navigator;
|
||||
|
||||
std::vector<std::shared_ptr<QtCodeFile>> m_files;
|
||||
|
||||
std::vector<Id> m_activeTokenIds;
|
||||
std::vector<Id> m_activeLocalSymbolIds;
|
||||
std::vector<Id> m_focusedTokenIds;
|
||||
std::vector<ErrorInfo> m_errorInfos;
|
||||
|
||||
QtCodeFile* m_scrollToFile;
|
||||
int m_value;
|
||||
Id m_scrollToLocationId;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_LIST
|
||||
|
||||
Reference in New Issue
Block a user