vfilelist.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef VFILELIST_H
  2. #define VFILELIST_H
  3. #include <QListWidget>
  4. #include <QJsonObject>
  5. class QAction;
  6. class VFileList : public QListWidget
  7. {
  8. Q_OBJECT
  9. public:
  10. explicit VFileList(QWidget *parent = 0);
  11. signals:
  12. void fileClicked(QJsonObject fileJson);
  13. private slots:
  14. void newFile();
  15. void deleteFile();
  16. void contextMenuRequested(QPoint pos);
  17. void handleItemClicked(QListWidgetItem *currentItem);
  18. public slots:
  19. void setDirectory(QJsonObject dirJson);
  20. private:
  21. void updateFileList();
  22. QListWidgetItem *insertFileListItem(QJsonObject fileJson, bool atFront = false);
  23. void removeFileListItem(QListWidgetItem *item);
  24. void initActions();
  25. bool isConflictNameWithExisting(const QString &name);
  26. QListWidgetItem *createFileAndUpdateList(const QString &name,
  27. const QString &description);
  28. void deleteFileAndUpdateList(QListWidgetItem *item);
  29. void clearDirectoryInfo();
  30. QString rootPath;
  31. QString relativePath;
  32. QString directoryName;
  33. // Actions
  34. QAction *newFileAct;
  35. QAction *deleteFileAct;
  36. };
  37. #endif // VFILELIST_H