Files
Sourcetrail/src/lib_gui/qt/element/QtCodeFileList.h
T
Eberhard Graether 2bdc9b19a2 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
2017-01-09 00:48:20 +01:00

62 lines
1.5 KiB
C++

#ifndef QT_CODE_FILE_LIST
#define QT_CODE_FILE_LIST
#include <memory>
#include <vector>
#include <QFrame>
#include <QScrollArea>
#include "component/view/helper/CodeSnippetParams.h"
#include "qt/element/QtCodeNavigateable.h"
#include "qt/utility/QtScrollSpeedChangeListener.h"
class QtCodeFile;
class QtCodeNavigator;
class QtCodeSnippet;
class QtCodeFileList
: public QScrollArea
, public QtCodeNavigateable
{
Q_OBJECT
public:
QtCodeFileList(QtCodeNavigator* navigator);
virtual ~QtCodeFileList();
void clear();
QtCodeFile* getFile(const FilePath filePath);
void addFile(const FilePath& filePath, bool isWholeFile, int refCount, TimePoint modificationTime);
// QtCodeNaviatebale implementation
virtual QScrollArea* getScrollArea();
virtual void addCodeSnippet(const CodeSnippetParams& params, bool insert = false);
virtual void requestFileContent(const FilePath& filePath);
virtual bool requestScroll(const FilePath& filePath, uint lineNumber, Id locationId, bool animated, bool onTop);
virtual void updateFiles();
virtual void showContents();
virtual void onWindowFocus();
void setFileMinimized(const FilePath path);
void setFileSnippets(const FilePath path);
void setFileMaximized(const FilePath path);
std::pair<QtCodeSnippet*, uint> getFirstSnippetWithActiveLocation(Id tokenId) const;
private:
QtCodeNavigator* m_navigator;
QFrame* m_filesArea;
std::vector<std::shared_ptr<QtCodeFile>> m_files;
QtScrollSpeedChangeListener m_scrollSpeedChangeListener;
};
#endif // QT_CODE_FILE_LIST