mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 00:31:32 -04:00
Added new widget for hashing files.
Added new common class FilesDefs to handle informations of file types like icons and names. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4713 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c9fc77f2d1
commit
0ee35b55f4
35 changed files with 932 additions and 1031 deletions
91
retroshare-gui/src/gui/common/HashBox.h
Normal file
91
retroshare-gui/src/gui/common/HashBox.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2011, RetroShare Team
|
||||
*
|
||||
* 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.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef HASHBOX_H
|
||||
#define HASHBOX_H
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
namespace Ui {
|
||||
class HashBox;
|
||||
}
|
||||
|
||||
class AttachFileItem;
|
||||
class QVBoxLayout;
|
||||
|
||||
class HashedFile
|
||||
{
|
||||
public:
|
||||
enum Flags {
|
||||
NoFlag = 0,
|
||||
Picture = 1
|
||||
};
|
||||
|
||||
public:
|
||||
QString filename;
|
||||
QString filepath;
|
||||
uint64_t size;
|
||||
std::string hash;
|
||||
Flags flag;
|
||||
|
||||
public:
|
||||
HashedFile();
|
||||
};
|
||||
|
||||
class HashBox : public QScrollArea
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HashBox(QWidget *parent = 0);
|
||||
~HashBox();
|
||||
|
||||
void setAutoHide(bool autoHide);
|
||||
void addAttachments(const QStringList& files, HashedFile::Flags flag = HashedFile::NoFlag);
|
||||
|
||||
void setDropWidget(QWidget* widget);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private slots:
|
||||
void fileFinished(AttachFileItem* file);
|
||||
void checkAttachmentReady();
|
||||
|
||||
signals:
|
||||
void fileHashingStarted();
|
||||
void fileHashingFinished(QList<HashedFile> hashedFiles);
|
||||
|
||||
private:
|
||||
class HashingInfo
|
||||
{
|
||||
public:
|
||||
AttachFileItem* item;
|
||||
HashedFile::Flags flag;
|
||||
};
|
||||
|
||||
QList<HashingInfo> mHashingInfos;
|
||||
bool mAutoHide;
|
||||
QWidget* dropWidget;
|
||||
Ui::HashBox *ui;
|
||||
};
|
||||
|
||||
#endif // HASHBOX_H
|
Loading…
Add table
Add a link
Reference in a new issue