2011-11-09 16:26:51 -05:00
|
|
|
/*************************************:***************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 - 2011 RetroShare Team
|
|
|
|
*
|
|
|
|
* Cyril Soler (csoler@users.sourceforge.net)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "ui_RsCollectionDialog.h"
|
|
|
|
#include "RsCollectionFile.h"
|
2014-05-29 10:49:45 -04:00
|
|
|
#include <QFileSystemModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
2011-11-09 16:26:51 -05:00
|
|
|
|
|
|
|
class QCheckBox ;
|
|
|
|
|
2014-05-29 10:49:45 -04:00
|
|
|
class RsCollectionDialog: public QDialog
|
2011-11-09 16:26:51 -05:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-16 14:58:52 -04:00
|
|
|
public:
|
2014-05-29 10:49:45 -04:00
|
|
|
RsCollectionDialog(const QString& filename
|
|
|
|
, const std::vector<ColFileInfo> &colFileInfos
|
|
|
|
, const bool& creation
|
|
|
|
, const bool& readOnly = false) ;
|
|
|
|
virtual ~RsCollectionDialog();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
2012-05-16 14:58:52 -04:00
|
|
|
|
|
|
|
private slots:
|
2014-05-29 10:49:45 -04:00
|
|
|
void directoryLoaded(QString dirLoaded);
|
2012-05-16 14:58:52 -04:00
|
|
|
void updateSizes() ;
|
2014-05-29 10:49:45 -04:00
|
|
|
void changeFileName() ;
|
|
|
|
void add() ;
|
|
|
|
void addRecursive() ;
|
|
|
|
void remove() ;
|
|
|
|
void processItem(QMap<QString, QString> &dirToAdd
|
|
|
|
, int &index
|
|
|
|
, ColFileInfo &parent
|
|
|
|
) ;
|
|
|
|
void makeDir() ;
|
|
|
|
void fileHashingFinished(QList<HashedFile> hashedFiles) ;
|
|
|
|
void itemChanged(QTreeWidgetItem* item,int col) ;
|
|
|
|
void cancel() ;
|
|
|
|
void download() ;
|
|
|
|
void save() ;
|
2012-05-16 14:58:52 -04:00
|
|
|
|
2014-05-29 10:49:45 -04:00
|
|
|
signals:
|
|
|
|
void saveColl(std::vector<ColFileInfo>, QString);
|
2012-05-16 14:58:52 -04:00
|
|
|
|
|
|
|
private:
|
2014-05-29 10:49:45 -04:00
|
|
|
void processSettings(bool bLoad) ;
|
|
|
|
QTreeWidgetItem* getRootItem();
|
|
|
|
bool updateList();
|
|
|
|
bool addChild(QTreeWidgetItem *parent, const std::vector<ColFileInfo> &child);
|
|
|
|
void addRecursive(bool recursive) ;
|
|
|
|
bool addAllChild(QFileInfo &fileInfoParent
|
|
|
|
, QMap<QString, QString > &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<ColFileInfo> _newColFileInfos ;
|
2012-05-16 14:58:52 -04:00
|
|
|
|
2014-05-29 10:49:45 -04:00
|
|
|
QFileSystemModel *_dirModel;
|
|
|
|
QSortFilterProxyModel *_tree_proxyModel;
|
|
|
|
QItemSelectionModel *_selectionProxy;
|
|
|
|
bool _dirLoaded;
|
|
|
|
QHash<QString,QString> _listOfFilesAddedInDir;
|
2011-11-09 16:26:51 -05:00
|
|
|
};
|