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:
@@ -0,0 +1,78 @@
|
||||
#ifndef QT_CODE_FILE_SINGLE_H
|
||||
#define QT_CODE_FILE_SINGLE_H
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
#include "utility/TimePoint.h"
|
||||
|
||||
#include "qt/element/QtCodeNavigateable.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QtCodeArea;
|
||||
class QtCodeFileTitleButton;
|
||||
class QtCodeNavigator;
|
||||
|
||||
class QtCodeFileSingle
|
||||
: public QFrame
|
||||
, public QtCodeNavigateable
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtCodeFileSingle(QtCodeNavigator* navigator, QWidget* parent = nullptr);
|
||||
virtual ~QtCodeFileSingle();
|
||||
|
||||
void clearCache();
|
||||
|
||||
// QtCodeNaviatebale implementation
|
||||
virtual QAbstractScrollArea* getScrollArea() override;
|
||||
|
||||
virtual void addCodeSnippet(const CodeSnippetParams& params, bool insert = false) override;
|
||||
|
||||
virtual void requestFileContent(const FilePath& filePath) override;
|
||||
virtual bool requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, bool onTop) override;
|
||||
|
||||
virtual void updateFiles() override;
|
||||
virtual void showContents() override;
|
||||
|
||||
virtual void onWindowFocus() override;
|
||||
|
||||
const FilePath& getCurrentFilePath() const;
|
||||
|
||||
Id getLocationIdOfFirstActiveLocationOfTokenId(Id tokenId) const;
|
||||
|
||||
private:
|
||||
struct FileData
|
||||
{
|
||||
FilePath filePath;
|
||||
TimePoint modificationTime;
|
||||
std::string title;
|
||||
|
||||
std::shared_ptr<QtCodeArea> area;
|
||||
};
|
||||
|
||||
FileData getFileData(const FilePath& filePath) const;
|
||||
void setFileData(const FileData& file);
|
||||
|
||||
void updateRefCount(int refCount);
|
||||
|
||||
QtCodeNavigator* m_navigator;
|
||||
|
||||
QWidget* m_areaWrapper;
|
||||
FilePath m_currentFilePath;
|
||||
|
||||
QtCodeFileTitleButton* m_title;
|
||||
QLabel* m_referenceCount;
|
||||
|
||||
QtCodeArea* m_area;
|
||||
std::map<FilePath, FileData> m_fileDatas;
|
||||
std::deque<FilePath> m_filePaths;
|
||||
|
||||
bool m_contentRequested;
|
||||
};
|
||||
|
||||
#endif // QT_CODE_FILE_SINGLE_H
|
||||
Reference in New Issue
Block a user