/******************************************************************************* * gui/common/RsCollectionDialog.h * * * * Copyright (C) 2011, Retroshare Team * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU Affero General Public License as * * published by the Free Software Foundation, either version 3 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Affero General Public License for more details. * * * * You should have received a copy of the GNU Affero General Public License * * along with this program. If not, see . * * * *******************************************************************************/ #include "ui_RsCollectionDialog.h" #include "RsCollection.h" #include #include class QCheckBox ; class RsCollectionDialog: public QDialog { Q_OBJECT public: RsCollectionDialog(const QString& filename , const std::vector &colFileInfos , const bool& creation , const bool& readOnly = false) ; virtual ~RsCollectionDialog(); protected: bool eventFilter(QObject *obj, QEvent *ev); private slots: void directoryLoaded(QString dirLoaded); void updateSizes() ; void changeFileName() ; void add() ; void addRecursive() ; void remove() ; void chooseDestinationDirectory(); void setDestinationDirectory(); void openDestinationDirectoryMenu(); void processItem(QMap &dirToAdd , int &index , ColFileInfo &parent ) ; void makeDir() ; void fileHashingFinished(QList hashedFiles) ; void itemChanged(QTreeWidgetItem* item,int col) ; void updateRemoveDuplicate(bool checked); void cancel() ; void download() ; void save() ; signals: void saveColl(std::vector, QString); private: void processSettings(bool bLoad) ; QTreeWidgetItem* getRootItem(); bool updateList(); bool addChild(QTreeWidgetItem *parent, const std::vector &child); bool removeItem(QTreeWidgetItem *item, bool &removeOnlyFile) ; void addRecursive(bool recursive) ; bool addAllChild(QFileInfo &fileInfoParent , QMap &dirToAdd , QStringList &fileToHash , int &count); void saveChild(QTreeWidgetItem *parentItem, ColFileInfo *parentInfo = NULL); Ui::RsCollectionDialog ui; QString _fileName ; const bool _creationMode ; const bool _readOnly; std::vector _newColFileInfos ; QFileSystemModel *_dirModel; QSortFilterProxyModel *_tree_proxyModel; QItemSelectionModel *_selectionProxy; bool _dirLoaded; QHash _listOfFilesAddedInDir; };