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:
thunder2 2011-12-07 13:08:12 +00:00
parent c9fc77f2d1
commit 0ee35b55f4
35 changed files with 932 additions and 1031 deletions

View File

@ -324,11 +324,13 @@ HEADERS += rshare.h \
gui/common/RSTabWidget.h \
gui/common/RSItemDelegate.h \
gui/common/PeerDefs.h \
gui/common/FilesDefs.h \
gui/common/PopularityDefs.h \
gui/common/GroupTreeWidget.h \
gui/common/RSTreeView.h \
gui/common/AvatarWidget.h \
gui/common/FriendList.h \
gui/common/HashBox.h \
gui/style/RSStyle.h \
gui/style/StyleDialog.h \
gui/MessagesDialog.h \
@ -448,6 +450,7 @@ FORMS += gui/StartDialog.ui \
gui/common/GroupTreeWidget.ui \
gui/common/AvatarWidget.ui \
gui/common/FriendList.ui \
gui/common/HashBox.ui \
gui/common/RsCollectionDialog.ui \
gui/style/StyleDialog.ui \
gui/dht/DhtWindow.ui \
@ -549,11 +552,13 @@ SOURCES += main.cpp \
gui/common/RSTabWidget.cpp \
gui/common/RSItemDelegate.cpp \
gui/common/PeerDefs.cpp \
gui/common/FilesDefs.cpp \
gui/common/PopularityDefs.cpp \
gui/common/GroupTreeWidget.cpp \
gui/common/RSTreeView.cpp \
gui/common/AvatarWidget.cpp \
gui/common/FriendList.cpp \
gui/common/HashBox.cpp \
gui/style/RSStyle.cpp \
gui/style/StyleDialog.cpp \
gui/settings/configpage.cpp \

View File

@ -42,7 +42,6 @@
#include "common/vmessagebox.h"
#include "connect/ConfCertDialog.h"
#include "connect/ConnectFriendWizard.h"
#include "feeds/AttachFileItem.h"
#include "forums/CreateForum.h"
#include "gui/common/AvatarDefs.h"
#include "gui/mainpagestack.h"
@ -109,6 +108,8 @@ FriendsDialog::FriendsDialog(QWidget *parent)
connect(ui.colorChatButton, SIGNAL(clicked()), this, SLOT(setColor()));
connect(ui.actionSave_History, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
ui.fontsButton->setIcon(QIcon(QString(":/images/fonts.png")));
mCurrentColor = Qt::black;
@ -157,6 +158,8 @@ FriendsDialog::FriendsDialog(QWidget *parent)
setAcceptDrops(true);
ui.lineEdit->setAcceptDrops(false);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(true);
/* Set initial size the splitter */
QList<int> sizes;
@ -704,141 +707,44 @@ void FriendsDialog::statusmessage()
void FriendsDialog::addExtraFile()
{
QString file;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", file)) {
addAttachment(file.toUtf8().constData());
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files);
}
}
void FriendsDialog::addAttachment(std::string filePath) {
/* add a AttachFileItem to the attachment section */
std::cerr << "PopupChatDialog::addExtraFile() hashing file." << std::endl;
/* add widget in for new destination */
AttachFileItem *file = new AttachFileItem(filePath);
//file->
ui.verticalLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
if (file->getState() == AFI_STATE_LOCAL) {
fileHashingFinished(file);
} else {
QObject::connect(file,SIGNAL(fileFinished(AttachFileItem *)), SLOT(fileHashingFinished(AttachFileItem *))) ;
}
}
void FriendsDialog::fileHashingFinished(AttachFileItem* file)
void FriendsDialog::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "FriendsDialog::fileHashingFinished() started." << std::endl;
//check that the file is ok tos end
if (file->getState() == AFI_STATE_ERROR) {
#ifdef FRIENDS_DEBUG
std::cerr << "PopupChatDialog::fileHashingFinished error file is not hashed." << std::endl;
#endif
return;
QString mesgString;
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
RetroShareLink link;
if (!link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
continue;
}
mesgString += link.toHtmlSize();
if (it!= hashedFiles.end()) {
mesgString += "<BR>";
}
}
//convert fileSize from uint_64 to string for html link
// char fileSizeChar [100];
// sprintf(fileSizeChar, "%lld", file->FileSize());
// std::string fileSize = *(&fileSizeChar);
RetroShareLink link;
if (!link.createFile(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()))) {
return;
}
QString mesgString = link.toHtmlSize();
// std::string mesgString = "<a href='retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "'>"
// + "retroshare://file|" + (file->FileName()) + "|" + fileSize + "|" + (file->FileHash()) + "</a>";
#ifdef FRIENDS_DEBUG
std::cerr << "FriendsDialog::fileHashingFinished mesgString : " << mesgString.toStdString() << std::endl;
#endif
/* convert to real html document */
QTextBrowser textBrowser;
textBrowser.setHtml(mesgString);
std::wstring msg = textBrowser.toHtml().toStdWString();
if (!mesgString.isEmpty()) {
/* convert to real html document */
QTextBrowser textBrowser;
textBrowser.setHtml(mesgString);
std::wstring msg = textBrowser.toHtml().toStdWString();
rsMsgs->sendPublicChat(msg);
setFont();
}
void FriendsDialog::dropEvent(QDropEvent *event)
{
if (!(Qt::CopyAction & event->possibleActions()))
{
std::cerr << "FriendsDialog::dropEvent() Rejecting uncopyable DropAction" << std::endl;
/* can't do it */
return;
rsMsgs->sendPublicChat(msg);
setFont();
}
std::cerr << "FriendsDialog::dropEvent() Formats" << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString() << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "FriendsDialog::dropEvent() Urls:" << std::endl;
QList<QUrl> urls = event->mimeData()->urls();
QList<QUrl>::iterator uit;
for(uit = urls.begin(); uit != urls.end(); uit++)
{
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false)
{
//Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "FriendsDialog::dropEvent() directory not accepted."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
} else if (QFile::exists(localpath)) {
FriendsDialog::addAttachment(localpath.toUtf8().constData());
} else {
std::cerr << "FriendsDialog::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
}
}
}
}
event->setDropAction(Qt::CopyAction);
event->accept();
}
void FriendsDialog::dragEnterEvent(QDragEnterEvent *event)
{
/* print out mimeType */
std::cerr << "FriendsDialog::dragEnterEvent() Formats" << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString() << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "FriendsDialog::dragEnterEvent() Accepting Urls" << std::endl;
event->acceptProposedAction();
}
else
{
std::cerr << "FriendsDialog::dragEnterEvent() No Urls" << std::endl;
}
}
bool FriendsDialog::fileSave()

View File

@ -36,7 +36,6 @@ class QAction;
class QTextEdit;
class QTextCharFormat;
class ChatDialog;
class AttachFileItem;
class FriendsDialog : public RsAutoUpdatePage
{
@ -59,7 +58,7 @@ public slots:
void setChatInfo(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
void resetStatusBar() ;
void fileHashingFinished(AttachFileItem* file);
void fileHashingFinished(QList<HashedFile> hashedFiles);
void smileyWidgetgroupchat();
void addSmileys();
@ -68,8 +67,6 @@ public slots:
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
protected:
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
bool eventFilter(QObject *obj, QEvent *ev);
void showEvent (QShowEvent *event);
@ -106,7 +103,6 @@ private slots:
void loadmypersonalstatus();
void addExtraFile();
void addAttachment(std::string);
bool fileSave();
bool fileSaveAs();

View File

@ -1204,17 +1204,8 @@ border: 1px solid #CCCCCC;}</string>
</layout>
</widget>
</item>
<item row="2" column="0">
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item row="0" column="0">
<widget class="QSplitter" name="splitter_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1293,6 +1284,19 @@ background: white;}</string>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="HashBox" name="hashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -1431,6 +1435,12 @@ background: white;}</string>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>RSTabWidget</class>
<extends>QTabWidget</extends>

View File

@ -29,6 +29,7 @@
#include <gui/RsAutoUpdatePage.h>
#include <gui/common/RsCollectionFile.h>
#include <gui/common/RsUrlHandler.h>
#include <gui/common/FilesDefs.h>
#include "RemoteDirModel.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h>
@ -277,36 +278,7 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
else if (details.type == DIR_TYPE_FILE) /* File */
{
// extensions predefined
QString ext = QFileInfo(QString::fromUtf8(details.name.c_str())).suffix();
if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif"
|| ext == "bmp" || ext == "ico" || ext == "svg")
return QIcon(":/images/FileTypePicture.png");
else if (ext == "avi" || ext == "AVI" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "ogm"
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
return QIcon(":/images/FileTypeVideo.png");
else if (ext == "ogg" || ext == "mp3" || ext == "wav" || ext == "wma" || ext == "xpm")
return QIcon(":/images/FileTypeAudio.png");
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z"
|| ext == "rar" || ext == "rpm" || ext == "deb")
return QIcon(":/images/FileTypeArchive.png");
else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com"
|| ext == "bin" || ext == "exe" || ext == "js" || ext == "pif"
|| ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws")
return QIcon(":/images/FileTypeProgram.png");
else if (ext == "iso" || ext == "nrg" || ext == "mdf" )
return QIcon(":/images/FileTypeCDImage.png");
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
return QIcon(":/images/FileTypeDocument.png");
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls"
|| ext == "sxc" || ext == "odt" || ext == "ods")
return QIcon(":/images/FileTypeDocument.png");
else if (ext == "html" || ext == "htm" || ext == "php")
return QIcon(":/images/FileTypeDocument.png");
else if (ext == RsCollectionFile::ExtensionString)
return QIcon(":/images/mimetypes/rscollection-16.png");
else
return QIcon(":/images/FileTypeAny.png");
return FilesDefs::getIconFromFilename(QString::fromUtf8(details.name.c_str()));
}
else
return QVariant();

View File

@ -30,6 +30,7 @@
#include "gui/RSHumanReadableDelegate.h"
#include "gui/RsAutoUpdatePage.h"
#include "gui/common/RsCollectionFile.h"
#include "gui/common/FilesDefs.h"
#include "settings/rsharesettings.h"
#include "advsearch/advancedsearchdialog.h"
@ -772,7 +773,6 @@ void SearchDialog::insertDirectory(const std::string &txt, qulonglong searchId,
child->setText(SR_NAME_COL, QString::fromUtf8(dir.name.c_str()));
child->setText(SR_HASH_COL, QString::fromStdString(dir.hash));
QString ext = QFileInfo(QString::fromStdString(dir.name)).suffix();
child->setText(SR_SIZE_COL, QString("%1").arg(dir.count,(int)15,(int)10)); // very important for sorting
child->setText(SR_AGE_COL, QString("%1").arg(dir.age,15,10));
child->setTextAlignment( SR_SIZE_COL, Qt::AlignRight );
@ -781,7 +781,7 @@ void SearchDialog::insertDirectory(const std::string &txt, qulonglong searchId,
child->setTextAlignment( SR_ID_COL, Qt::AlignRight );
child->setText(SR_SEARCH_ID_COL, sid_hexa);
setIconAndType(child, ext);
setIconAndType(child, QString::fromUtf8(dir.name.c_str()));
if (item == NULL) {
ui.searchResultWidget->addTopLevelItem(child);
@ -1072,8 +1072,7 @@ void SearchDialog::insertFile(const std::string& txt,qulonglong searchId, const
item->setText(SR_NAME_COL, QString::fromUtf8(file.name.c_str()));
item->setText(SR_HASH_COL, QString::fromStdString(file.hash));
QString ext = QFileInfo(QString::fromStdString(file.name)).suffix();
setIconAndType(item, ext);
setIconAndType(item, QString::fromUtf8(file.name.c_str()));
/*
* to facilitate downlaods we need to save the file size too
@ -1224,84 +1223,10 @@ void SearchDialog::selectSearchResults(int index)
ui.filterPatternLineEdit->clear();
}
void SearchDialog::setIconAndType(QTreeWidgetItem *item, QString ext)
void SearchDialog::setIconAndType(QTreeWidgetItem *item, const QString& filename)
{
ext = ext.toLower();
if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico"
|| ext == "svg" || ext == "tif" || ext == "tiff")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypePicture.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Picture"));
}
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "mkv" || ext == "mp4"
|| ext == "flv" || ext == "mov" || ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp"
|| ext == "dvx" || ext == "divx")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeVideo.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Video"));
}
else if (ext == "flac" || ext == "ogg" || ext == "mp3" || ext == "m4a" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeAudio.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Audio"));
}
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "tgz" || ext == "gz" || ext == "rar"
|| ext == "rpm" || ext == "7z" || ext == "ace" || ext == "jar" || ext == "cab" || ext == "deb")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeArchive.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Archive"));
}
else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com" || ext == "bin" || ext == "exe" || ext == "js"
|| ext == "msi" ||ext == "pif" || ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeProgram.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Program"));
}
else if (ext == "iso" || ext == "nrg" || ext == "mdf" || ext == "img" || ext == "dmg" || ext == "bin" || ext == "uif" )
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeCDImage.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("CD-Image"));
}
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeDocument.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
}
else if (ext == "pdf" )
{
item->setIcon(SR_NAME_COL, QIcon(":/images/mimetypes/pdf.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
}
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls" || ext == "pps" || ext == "xml" || ext == "nfo"
|| ext == "reg" || ext == "sxc" || ext == "odt" || ext == "ods" || ext == "dot" || ext == "ppt" || ext == "css" || ext == "crt" )
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeDocument.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
}
else if (ext == "html" || ext == "htm" || ext == "php")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeDocument.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Document"));
}
else if (ext == RsCollectionFile::ExtensionString)
{
item->setIcon(SR_NAME_COL, QIcon(":/images/library.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("RetroShare collection file"));
}
else if (ext == "sub" || ext == "srt")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeAny.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Subtitles"));
}
else if (ext == "nds")
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeAny.png"));
item->setText(SR_TYPE_COL, QString::fromUtf8("Nintendo DS Rom"));
}
else
{
item->setIcon(SR_NAME_COL, QIcon(":/images/FileTypeAny.png"));
}
item->setIcon(SR_NAME_COL, FilesDefs::getIconFromFilename(filename));
item->setText(SR_TYPE_COL, FilesDefs::getNameFromFilename(filename));
}
void SearchDialog::copyResultLink()

View File

@ -101,7 +101,7 @@ private:
void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file, int searchType = ANONYMOUS_SEARCH) ;
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item);
void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir);
void setIconAndType(QTreeWidgetItem *item, QString ext);
void setIconAndType(QTreeWidgetItem *item, const QString& filename);
void downloadDirectory(const QTreeWidgetItem *item, const QString &base);
void getSourceFriendsForHash(const std::string& hash,std::list<std::string>& srcIds);

View File

@ -31,6 +31,7 @@
#include <QMessageBox>
#include <gui/common/RsUrlHandler.h>
#include <gui/common/RsCollectionFile.h>
#include <gui/common/FilesDefs.h>
#include <algorithm>
@ -624,46 +625,11 @@ int TransfersDialog::addItem(const QString&, const QString& name, const QString&
DLListModel->setData(DLListModel->index(row, DOWNLOADTIME), QVariant((qlonglong)downloadtime));
DLListModel->setData(DLListModel->index(row, ID), QVariant((QString)coreID));
QString ext = QFileInfo(name).suffix();
DLListModel->setData(DLListModel->index(row,NAME), getIconFromExtension(ext), Qt::DecorationRole);
DLListModel->setData(DLListModel->index(row,NAME), FilesDefs::getIconFromFilename(name), Qt::DecorationRole);
return row ;
}
QIcon TransfersDialog::getIconFromExtension(QString ext)
{
ext = ext.toLower();
if (ext == "jpg" || ext == "jpeg" || ext == "tif" || ext == "tiff" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico" || ext == "svg")
return QIcon(QString::fromUtf8(":/images/FileTypePicture.png")) ;
else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "divx" || ext == "ts"
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov" || ext == "asf" || ext == "xvid"
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp" || ext == "ogm")
return QIcon(QString::fromUtf8(":/images/FileTypeVideo.png")) ;
else if (ext == "ogg" || ext == "mp3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma" || ext == "m4a" || ext == "flac")
return QIcon(QString::fromUtf8(":/images/FileTypeAudio.png")) ;
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z" || ext == "msi"
|| ext == "rar" || ext == "rpm" || ext == "ace" || ext == "jar" || ext == "tgz" || ext == "lha"
|| ext == "cab" || ext == "cbz"|| ext == "cbr" || ext == "alz" || ext == "sit" || ext == "arj" || ext == "deb")
return QIcon(QString::fromUtf8(":/images/FileTypeArchive.png")) ;
else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com"
|| ext == "exe" || ext == "js" || ext == "pif"
|| ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws")
return QIcon(QString::fromUtf8(":/images/FileTypeProgram.png")) ;
else if (ext == "iso" || ext == "nrg" || ext == "mdf" || ext == "img" || ext == "dmg" || ext == "bin" )
return QIcon(QString::fromUtf8(":/images/FileTypeCDImage.png")) ;
else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h")
return QIcon(QString::fromUtf8(":/images/FileTypeDocument.png")) ;
else if (ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls" || ext == "pps" || ext == "xml"
|| ext == "sxc" || ext == "odt" || ext == "ods" || ext == "dot" || ext == "ppt" || ext == "css" )
return QIcon(QString::fromUtf8(":/images/FileTypeDocument.png")) ;
else if (ext == "html" || ext == "htm" || ext == "php")
return QIcon(QString::fromUtf8(":/images/FileTypeDocument.png")) ;
else if (ext == RsCollectionFile::ExtensionString)
return QIcon(QString::fromUtf8(":/images/mimetypes/rscollection-16.png")) ;
else
return QIcon(QString::fromUtf8(":/images/FileTypeAny.png")) ;
}
int TransfersDialog::addPeerToItem(int row, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo)
{
QStandardItem *dlItem = DLListModel->item(row);
@ -808,8 +774,7 @@ int TransfersDialog::addUploadItem( const QString&, const QString& name, const Q
ULListModel->setData(ULListModel->index(row, UHASH), QVariant((QString)coreID));
ULListModel->setData(ULListModel->index(row, UUSERID), QVariant((QString)peer_id));
QString ext = QFileInfo(name).suffix();
ULListModel->setData(ULListModel->index(row,UNAME), getIconFromExtension(ext), Qt::DecorationRole);
ULListModel->setData(ULListModel->index(row,UNAME), FilesDefs::getIconFromFilename(name), Qt::DecorationRole);
return row;
}

View File

@ -108,7 +108,6 @@ signals:
private:
QString getPeerName(const std::string& peer_id) const ;
static QIcon getIconFromExtension(QString) ;
QStandardItemModel *DLListModel;
QStandardItemModel *ULListModel;

View File

@ -27,7 +27,6 @@
#include <QColorDialog>
#include <QDateTime>
#include <QFontDialog>
#include <QDir>
#include <QBuffer>
#include <QTextCodec>
#include <QSound>
@ -40,13 +39,9 @@
#include "rshare.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rsfiles.h>
#include "retroshare/rsinit.h"
#include <retroshare/rsnotify.h>
#include <retroshare/rsstatus.h>
#include <retroshare/rshistory.h>
#include <retroshare/rsiface.h>
#include "gui/settings/rsharesettings.h"
#include "gui/settings/RsharePeerSettings.h"
#include "gui/notifyqt.h"
@ -54,11 +49,10 @@
#include "gui/common/StatusDefs.h"
#include "gui/common/AvatarDefs.h"
#include "gui/common/Emoticons.h"
#include "gui/im_history/ImHistoryBrowser.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/common/PeerDefs.h"
#include "gui/common/FilesDefs.h"
#include "gui/im_history/ImHistoryBrowser.h"
#include "gui/msgs/MessageComposer.h"
#include <time.h>
#include <algorithm>
@ -129,6 +123,8 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi
connect(ui.actionSave_Chat_History, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages()));
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int)));
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
@ -155,6 +151,8 @@ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWi
setAcceptDrops(true);
ui.chattextEdit->setAcceptDrops(false);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(true);
QMenu * toolmenu = new QMenu();
toolmenu->addAction(ui.actionClear_Chat_History);
@ -806,9 +804,9 @@ void PopupChatDialog::on_actionDelete_Chat_History_triggered()
void PopupChatDialog::addExtraFile()
{
QString file;
if (misc::getOpenFileName(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", file)) {
addAttachment(file.toUtf8().constData(), 0);
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files/*, 0*/);
}
}
@ -817,98 +815,38 @@ void PopupChatDialog::addExtraPicture()
// select a picture file
QString file;
if (misc::getOpenFileName(window(), RshareSettings::LASTDIR_IMAGES, tr("Load Picture File"), "Pictures (*.png *.xpm *.jpg)", file)) {
addAttachment(file.toUtf8().constData(), 1);
ui.hashBox->addAttachments(QStringList(file), HashedFile::Picture);
}
}
void PopupChatDialog::addAttachment(std::string filePath,int flag)
void PopupChatDialog::fileHashingFinished(QList<HashedFile> hashedFiles)
{
/* add a AttachFileItem to the attachment section */
std::cerr << "PopupChatDialog::addExtraFile() hashing file.";
std::cerr << std::endl;
/* add widget in for new destination */
AttachFileItem *file = new AttachFileItem(filePath);
//file->
if(flag==1)
file->setPicFlag(1);
ui.vboxLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
if (file->getState() == AFI_STATE_LOCAL) {
fileHashingFinished(file);
} else {
QObject::connect(file,SIGNAL(fileFinished(AttachFileItem *)), SLOT(fileHashingFinished(AttachFileItem *))) ;
}
}
void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
{
std::cerr << "PopupChatDialog::fileHashingFinished() started.";
std::cerr << std::endl;
//check that the file is ok tos end
if (file->getState() == AFI_STATE_ERROR) {
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::fileHashingFinished error file is not hashed.";
#endif
return;
}
std::string ownId;
{
rsiface->lockData(); /* Lock Interface */
const RsConfig &conf = rsiface->getConfig();
ownId = conf.ownId;
rsiface->unlockData(); /* Unlock Interface */
}
std::cerr << "PopupChatDialog::fileHashingFinished() started." << std::endl;
QString message;
QString ext = QFileInfo(QString::fromStdString(file->FileName())).suffix();
if(file->getPicFlag()==1){
message+="<img src=\"file:///";
message+=file->FilePath().c_str();
message+="\" width=\"100\" height=\"100\">";
message+="<br>";
}
else if (ext == "ogg" || ext == "mp3" || ext == "MP3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma")
{
message+="<img src=\":/images/audio-x-monkey.png";
message+="\" width=\"48\" height=\"48\">";
message+="<br>";
}
else if (ext == "avi" || ext == "AVI" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "ogm"
|| ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov"
|| ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp")
{
message+="<img src=\":/images/video-x-generic.png";
message+="\" width=\"48\" height=\"48\">";
message+="<br>";
}
else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z"
|| ext == "rar" || ext == "rpm" || ext == "deb")
{
message+="<img src=\":/images/application-x-rar.png";
message+="\" width=\"48\" height=\"48\">";
message+="<br>";
}
else if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico"
|| ext == "svg" || ext == "tif" || ext == "tiff" || ext == "JPG")
{
message+="<img src=\":/images/application-draw.png";
message+="\" width=\"48\" height=\"48\">";
message+="<br>";
}
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
QString ext = QFileInfo(hashedFile.filename).suffix();
RetroShareLink link;
link.createFile(QString::fromUtf8(file->FileName().c_str()),file->FileSize(),QString::fromStdString(file->FileHash()));
message += link.toHtmlSize();
RetroShareLink link;
link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash));
if (hashedFile.flag & HashedFile::Picture) {
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
message+="<br>";
} else {
QString image = FilesDefs::getImageFromFilename(hashedFile.filename, false);
if (!image.isEmpty()) {
message += QString("<img src=\"%1\">").arg(image);
}
}
message += link.toHtmlSize();
if (it != hashedFiles.end()) {
message += "<BR>";
}
}
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::fileHashingFinished message : " << message.toStdString() << std::endl;
@ -920,94 +858,12 @@ void PopupChatDialog::fileHashingFinished(AttachFileItem* file)
std::wstring msg = textBrowser.toHtml().toStdWString();
if (rsMsgs->sendPrivateChat(dialogId, msg)) {
std::string ownId = rsPeers->getOwnId();
QDateTime currentTime = QDateTime::currentDateTime();
addChatMsg(false, QString::fromUtf8(rsPeers->getPeerName(ownId).c_str()), currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
}
}
void PopupChatDialog::dropEvent(QDropEvent *event)
{
if (!(Qt::CopyAction & event->possibleActions()))
{
std::cerr << "PopupChatDialog::dropEvent() Rejecting uncopyable DropAction";
std::cerr << std::endl;
/* can't do it */
return;
}
std::cerr << "PopupChatDialog::dropEvent() Formats";
std::cerr << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "PopupChatDialog::dropEvent() Urls:";
std::cerr << std::endl;
QList<QUrl> urls = event->mimeData()->urls();
QList<QUrl>::iterator uit;
for(uit = urls.begin(); uit != urls.end(); uit++)
{
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false)
{
//Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "PopupChatDialog::dropEvent() directory not accepted."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
} else if (QFile::exists(localpath)) {
PopupChatDialog::addAttachment(localpath.toUtf8().constData(), false);
} else {
std::cerr << "PopupChatDialog::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
}
}
}
}
event->setDropAction(Qt::CopyAction);
event->accept();
}
void PopupChatDialog::dragEnterEvent(QDragEnterEvent *event)
{
/* print out mimeType */
std::cerr << "PopupChatDialog::dragEnterEvent() Formats";
std::cerr << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "PopupChatDialog::dragEnterEvent() Accepting Urls";
std::cerr << std::endl;
event->acceptProposedAction();
}
else
{
std::cerr << "PopupChatDialog::dragEnterEvent() No Urls";
std::cerr << std::endl;
}
}
bool PopupChatDialog::fileSave()
{
if (fileName.isEmpty())

View File

@ -28,7 +28,6 @@
class QAction;
class QTextEdit;
class QTextCharFormat;
class AttachFileItem;
class ChatInfo;
#include <retroshare/rsmsgs.h>
@ -70,8 +69,6 @@ protected:
~PopupChatDialog();
virtual void resizeEvent(QResizeEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
bool eventFilter(QObject *obj, QEvent *ev);
@ -82,7 +79,7 @@ private slots:
void pasteLink() ;
void contextMenu(QPoint) ;
void fileHashingFinished(AttachFileItem* file);
void fileHashingFinished(QList<HashedFile> hashedFiles);
void smileyWidget();
void addSmiley();
@ -116,7 +113,6 @@ private:
void colorChanged(const QColor &c);
void fontChanged(const QFont &font);
void addAttachment(std::string,int flag);
void processSettings(bool bLoad);
void onPrivateChatChanged(int list, int type);

View File

@ -25,19 +25,22 @@
</property>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="6">
<item row="0" column="0" rowspan="7">
<widget class="QFrame" name="leftsideframe">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -108,7 +111,7 @@
</layout>
</widget>
</item>
<item row="0" column="1" rowspan="6">
<item row="0" column="1" rowspan="7">
<widget class="QFrame" name="avatarframe">
<property name="maximumSize">
<size>
@ -711,9 +714,6 @@ border: 1px solid #CCCCCC;
</layout>
</widget>
</item>
<item row="6" column="0" colspan="3">
<layout class="QVBoxLayout" name="vboxLayout"/>
</item>
<item row="4" column="2">
<widget class="QSplitter" name="chatsplitter">
<property name="lineWidth">
@ -725,6 +725,9 @@ border: 1px solid #CCCCCC;
<property name="handleWidth">
<number>2</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
@ -738,7 +741,7 @@ border: 1px solid #CCCCCC;
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
<height>30</height>
</size>
</property>
<property name="styleSheet">
@ -831,6 +834,13 @@ background: white;}</string>
</widget>
</widget>
</item>
<item row="6" column="2">
<widget class="HashBox" name="hashBox">
<property name="widgetResizable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -912,6 +922,12 @@ background: white;}</string>
<header>gui/common/AvatarWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>

View File

@ -162,7 +162,7 @@ void PopupChatWindow::addDialog(PopupChatDialog *dialog)
ui.tabWidget->addTab(dialog, dialog->getTitle());
} else {
ui.horizontalLayout->addWidget(dialog);
ui.horizontalLayout->setContentsMargins(0, 0, 5, 0);
ui.horizontalLayout->setContentsMargins(0, 0, 0, 0);
peerId = dialog->getPeerId();
chatDialog = dialog;
calculateStyle(dialog);

View File

@ -0,0 +1,85 @@
/****************************************************************
* 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.
****************************************************************/
#include <QApplication>
#include <QFileInfo>
#include "FilesDefs.h"
#include "RsCollectionFile.h"
static QString getInfoFromFilename(const QString& filename, bool anyForUnknown, bool image)
{
QString ext = QFileInfo(filename).suffix().toLower();
if (ext == "jpg" || ext == "jpeg" || ext == "tif" || ext == "tiff" || ext == "png" || ext == "gif" || ext == "bmp" || ext == "ico" || ext == "svg") {
return image ? ":/images/FileTypePicture.png" : QApplication::translate("FilesDefs", "Picture");
} else if (ext == "avi" || ext == "mpg" || ext == "mpeg" || ext == "wmv" || ext == "divx" || ext == "ts" ||
ext == "mkv" || ext == "mp4" || ext == "flv" || ext == "mov" || ext == "asf" || ext == "xvid" ||
ext == "vob" || ext == "qt" || ext == "rm" || ext == "3gp" || ext == "ogm") {
return image ? ":/images/FileTypeVideo.png" : QApplication::translate("FilesDefs", "Video");
} else if (ext == "ogg" || ext == "mp3" || ext == "mp1" || ext == "mp2" || ext == "wav" || ext == "wma" || ext == "m4a" || ext == "flac" ||ext == "xpm") {
return image ? ":/images/FileTypeAudio.png" : QApplication::translate("FilesDefs", "Audio");
} else if (ext == "tar" || ext == "bz2" || ext == "zip" || ext == "gz" || ext == "7z" || ext == "msi" ||
ext == "rar" || ext == "rpm" || ext == "ace" || ext == "jar" || ext == "tgz" || ext == "lha" ||
ext == "cab" || ext == "cbz"|| ext == "cbr" || ext == "alz" || ext == "sit" || ext == "arj" || ext == "deb") {
return image ? ":/images/FileTypeArchive.png" : QApplication::translate("FilesDefs", "Archive");
} else if (ext == "app" || ext == "bat" || ext == "cgi" || ext == "com" ||
ext == "exe" || ext == "js" || ext == "pif" ||
ext == "py" || ext == "pl" || ext == "sh" || ext == "vb" || ext == "ws") {
return image ? ":/images/FileTypeProgram.png" : QApplication::translate("FilesDefs", "Program");
} else if (ext == "iso" || ext == "nrg" || ext == "mdf" || ext == "img" || ext == "dmg" || ext == "bin" || ext == "uif") {
return image ? ":/images/FileTypeCDImage.png" : QApplication::translate("FilesDefs", "CD/DVD-Image");
} else if (ext == "txt" || ext == "cpp" || ext == "c" || ext == "h" || ext == "ui" ||
ext == "doc" || ext == "rtf" || ext == "sxw" || ext == "xls" || ext == "pps" || ext == "xml" || ext == "nfo" ||
ext == "reg" || ext == "sxc" || ext == "odt" || ext == "ods" || ext == "dot" || ext == "ppt" || ext == "css" || ext == "crt" ||
ext == "html" || ext == "htm" || ext == "php") {
return image ? ":/images/FileTypeDocument.png" : QApplication::translate("FilesDefs", "Document");
} else if (ext == "pdf") {
return image ? ":/images/mimetypes/pdf.png" : QApplication::translate("FilesDefs", "Document");
} else if (ext == RsCollectionFile::ExtensionString) {
return image ? ":/images/mimetypes/rscollection-16.png" : QApplication::translate("FilesDefs", "RetroShare collection file");
} else if (ext == "sub" || ext == "srt") {
return image ? ":/images/FileTypeAny.png" : QApplication::translate("FilesDefs", "Subtitles");
} else if (ext == "nds") {
return image ? ":/images/FileTypeAny.png" : QApplication::translate("FilesDefs", "Nintendo DS Rom");
}
if (anyForUnknown) {
return image ? ":/images/FileTypeAny.png" : "";
}
return "";
}
QString FilesDefs::getImageFromFilename(const QString& filename, bool anyForUnknown)
{
return getInfoFromFilename(filename, anyForUnknown, true);
}
QIcon FilesDefs::getIconFromFilename(const QString& filename)
{
return QIcon(getInfoFromFilename(filename, true, true));
}
QString FilesDefs::getNameFromFilename(const QString &filename)
{
return getInfoFromFilename(filename, false, false);
}

View File

@ -0,0 +1,37 @@
/****************************************************************
* 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 _FILESDEFS_H
#define _FILESDEFS_H
#include <QString>
#include <QIcon>
class FilesDefs
{
public:
static QString getImageFromFilename(const QString& filename, bool anyForUnknown);
static QIcon getIconFromFilename(const QString& filename);
static QString getNameFromFilename(const QString& filename);
};
#endif

View File

@ -0,0 +1,259 @@
/****************************************************************
* 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.
****************************************************************/
#include <QMessageBox>
#include <QDir>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QUrl>
#include <QTimer>
#include <iostream>
#include "gui/feeds/AttachFileItem.h"
#include "HashBox.h"
#include "ui_HashBox.h"
HashedFile::HashedFile()
{
size = 0;
flag = NoFlag;
}
HashBox::HashBox(QWidget *parent) :
QScrollArea(parent),
ui(new Ui::HashBox)
{
ui->setupUi(this);
mAutoHide = false;
dropWidget = NULL;
}
HashBox::~HashBox()
{
delete ui;
}
void HashBox::setAutoHide(bool autoHide)
{
mAutoHide = autoHide;
setVisible(!mAutoHide);
}
void HashBox::setDropWidget(QWidget* widget)
{
if (dropWidget) {
dropWidget->removeEventFilter(this);
}
dropWidget = widget;
if (dropWidget) {
widget->installEventFilter(this);
}
}
static void showFormats(const std::string& event, const QStringList& formats)
{
std::cerr << event << "() Formats" << std::endl;
QStringList::const_iterator it;
for (it = formats.begin(); it != formats.end(); ++it) {
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
}
bool HashBox::eventFilter(QObject* object, QEvent* event)
{
if (object == dropWidget) {
if (event->type() == QEvent::DragEnter) {
QDragEnterEvent* dragEnterEvent = static_cast<QDragEnterEvent*>(event);
if (dragEnterEvent) {
/* print out mimeType */
showFormats("HashBox::dragEnterEvent", dragEnterEvent->mimeData()->formats());
if (dragEnterEvent->mimeData()->hasUrls()) {
std::cerr << "HashBox::dragEnterEvent() Accepting Urls" << std::endl;
dragEnterEvent->acceptProposedAction();
} else {
std::cerr << "HashBox::dragEnterEvent() No Urls" << std::endl;
}
}
} else if (event->type() == QEvent::Drop) {
QDropEvent* dropEvent = static_cast<QDropEvent*>(event);
if (dropEvent) {
if (Qt::CopyAction & dropEvent->possibleActions()) {
/* print out mimeType */
showFormats("HashBox::dropEvent", dropEvent->mimeData()->formats());
QStringList files;
if (dropEvent->mimeData()->hasUrls()) {
std::cerr << "HashBox::dropEvent() Urls:" << std::endl;
QList<QUrl> urls = dropEvent->mimeData()->urls();
QList<QUrl>::iterator uit;
for (uit = urls.begin(); uit != urls.end(); ++uit) {
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false) {
//Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "HashBox::dropEvent() directory not accepted." << std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."), QMessageBox::Information, QMessageBox::Ok, 0, 0, this);
mb.exec();
} else if (QFile::exists(localpath)) {
files.push_back(localpath);
} else {
std::cerr << "HashBox::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."), QMessageBox::Information, QMessageBox::Ok, 0, 0, this);
mb.exec();
}
}
}
}
addAttachments(files);
dropEvent->setDropAction(Qt::CopyAction);
dropEvent->accept();
} else {
std::cerr << "HashBox::dropEvent() Rejecting uncopyable DropAction" << std::endl;
}
}
}
}
// pass the event on to the parent class
return QScrollArea::eventFilter(object, event);
}
void HashBox::addAttachments(const QStringList& files, HashedFile::Flags flag)
{
/* add a AttachFileItem to the attachment section */
std::cerr << "PopupChatDialog::addExtraFile() hashing file." << std::endl;
if (files.isEmpty()) {
return;
}
if (mAutoHide) {
show();
}
QStringList::ConstIterator it;
for (it = files.constBegin(); it != files.constEnd(); ++it) {
/* add widget in for new destination */
AttachFileItem* file = new AttachFileItem(*it);
QObject::connect(file, SIGNAL(fileFinished(AttachFileItem*)), this, SLOT(fileFinished(AttachFileItem*)));
HashingInfo hashingInfo;
hashingInfo.item = file;
hashingInfo.flag = flag;
mHashingInfos.push_back(hashingInfo);
ui->verticalLayout->addWidget(file, 1, 0);
}
QApplication::processEvents();
// workaround for Qt bug, the size from the first call to QScrollArea::sizeHint() is stored in QWidgetItemV2 and
// QScrollArea::sizeHint() is never called again so that widgetResizable of QScrollArea doesn't work
// the next line clears the member QScrollArea::widgetSize for recalculation of the added children in QScrollArea::sizeHint()
setWidget(takeWidget());
// the next line set the cache to dirty
updateGeometry();
emit fileHashingStarted();
checkAttachmentReady();
}
void HashBox::fileFinished(AttachFileItem* file)
{
std::cerr << "HashBox::fileHashingFinished() started." << std::endl;
//check that the file is ok
if (file->getState() == AFI_STATE_ERROR) {
std::cerr << "HashBox::fileHashingFinished error file is not hashed.";
return;
}
checkAttachmentReady();
}
void HashBox::checkAttachmentReady()
{
if (mHashingInfos.isEmpty()) {
return;
}
QList<HashingInfo>::iterator it;
for (it = mHashingInfos.begin(); it != mHashingInfos.end(); ++it) {
if (it->item->isHidden()) {
continue;
}
if (!it->item->done()) {
break;
}
}
if (it != mHashingInfos.end()) {
/* repeat... */
QTimer::singleShot(500, this, SLOT(checkAttachmentReady()));
return;
}
if (mAutoHide) {
hide();
}
QList<HashedFile> hashedFiles;
for (it = mHashingInfos.begin(); it != mHashingInfos.end(); ++it) {
HashingInfo& hashingInfo = *it;
if (hashingInfo.item->done()) {
HashedFile hashedFile;
hashedFile.filename = hashingInfo.item->FileName();
hashedFile.filepath = hashingInfo.item->FilePath();
hashedFile.hash = hashingInfo.item->FileHash();
hashedFile.size = hashingInfo.item->FileSize();
hashedFile.flag = hashingInfo.flag;
hashedFiles.push_back(hashedFile);
ui->verticalLayout->removeWidget(hashingInfo.item);
hashingInfo.item->deleteLater();
}
}
mHashingInfos.clear();
QApplication::processEvents();
// workaround for Qt bug, the size from the first call to QScrollArea::sizeHint() is stored in QWidgetItemV2 and
// QScrollArea::sizeHint() is never called again so that widgetResizable of QScrollArea doesn't work
// the next line clears the member QScrollArea::widgetSize for recalculation of the removed children in QScrollArea::sizeHint()
setWidget(takeWidget());
// the next line set the cache to dirty
updateGeometry();
emit fileHashingFinished(hashedFiles);
}

View 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

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>HashBox</class>
<widget class="QScrollArea" name="HashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -61,8 +61,7 @@
const uint32_t AFI_DEFAULT_PERIOD = (30 * 3600 * 24); /* 30 Days */
/** Constructor */
AttachFileItem::AttachFileItem(std::string hash, std::string name, uint64_t size,
uint32_t flags, std::string srcId)
AttachFileItem::AttachFileItem(const std::string& hash, const QString& name, uint64_t size, uint32_t flags, const std::string& srcId)
:QWidget(NULL), mFileHash(hash), mFileName(name), mFileSize(size), mSrcId(srcId)
{
/* Invoke the Qt Designer generated object setup routine */
@ -72,7 +71,6 @@ AttachFileItem::AttachFileItem(std::string hash, std::string name, uint64_t size
mMode = flags & AFI_MASK_STATE;
mType = flags & AFI_MASK_TYPE;
mPicFlag=0;
if (mMode == AFI_STATE_EXTRA)
{
@ -92,7 +90,7 @@ AttachFileItem::AttachFileItem(std::string hash, std::string name, uint64_t size
}
/** Constructor */
AttachFileItem::AttachFileItem(std::string path)
AttachFileItem::AttachFileItem(const QString& path)
:QWidget(NULL), mPath(path), mFileSize(0)
{
/* Invoke the Qt Designer generated object setup routine */
@ -100,10 +98,9 @@ AttachFileItem::AttachFileItem(std::string path)
mMode = AFI_STATE_EXTRA;
mType = AFI_TYPE_ATTACH;
mPicFlag=0;
/* ask for Files to hash/prepare it for us */
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path, AFI_DEFAULT_PERIOD, 0)))
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path.toUtf8().constData(), AFI_DEFAULT_PERIOD, 0)))
{
mMode = AFI_STATE_ERROR;
}
@ -113,7 +110,6 @@ AttachFileItem::AttachFileItem(std::string path)
void AttachFileItem::Setup()
{
connect( cancelButton, SIGNAL( clicked( void ) ), this, SLOT( cancel ( void ) ) );
/* once off check - if remote, check if we have it
@ -127,8 +123,7 @@ void AttachFileItem::Setup()
if (mMode == AFI_STATE_REMOTE)
{
FileInfo fi;
uint32_t hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL
| RS_FILE_HINTS_SPEC_ONLY;
uint32_t hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY;
/* look up path */
if (rsFiles->FileDetails(mFileHash, hintflags, fi))
@ -140,14 +135,12 @@ void AttachFileItem::Setup()
std::cerr << std::endl;
#endif
mMode = AFI_STATE_LOCAL;
mPath = fi.path;
mPath = QString::fromUtf8(fi.path.c_str());
}
}
updateItemStatic();
updateItem();
}
@ -169,7 +162,7 @@ void AttachFileItem::updateItemStatic()
std::cerr << std::endl;
#endif
QString filename = QString::fromUtf8(mFileName.c_str());
QString filename = mFileName;
mDivisor = 1;
if (mFileSize > 10000000) /* 10 Mb */
@ -219,7 +212,7 @@ void AttachFileItem::updateItemStatic()
std::cerr << "AttachFileItem::updateItemStatic() Updated Path";
std::cerr << std::endl;
#endif
mPath = fi.path;
mPath = QString::fromUtf8(fi.path.c_str());
}
}
}
@ -234,12 +227,12 @@ void AttachFileItem::updateItemStatic()
cancelButton->setEnabled(false);
progressBar->setValue(0);
filename = "[ERROR] " + filename;
filename = tr("[ERROR])") + " " + filename;
break;
case AFI_STATE_EXTRA:
filename = QString::fromUtf8(mPath.c_str());
filename = mPath;
progressBar->setRange(0, 100);
progressBar->setFormat("HASHING");
@ -303,10 +296,8 @@ void AttachFileItem::updateItemStatic()
break;
}
fileLabel->setText(filename);
fileLabel->setToolTip(filename);
}
void AttachFileItem::updateItem()
@ -339,7 +330,7 @@ void AttachFileItem::updateItem()
std::cerr << std::endl;
#endif
/* check for file status */
if (rsFiles->ExtraFileStatus(mPath, fi))
if (rsFiles->ExtraFileStatus(mPath.toUtf8().constData(), fi))
{
#ifdef DEBUG_ITEM
std::cerr << "AttachFileItem::updateItem() STATE=>Local";
@ -348,7 +339,7 @@ void AttachFileItem::updateItem()
mMode = AFI_STATE_LOCAL;
/* fill in file details */
mFileName = fi.fname;
mFileName = QString::fromUtf8(fi.fname.c_str());
mFileSize = fi.size;
mFileHash = fi.hash;
@ -422,7 +413,7 @@ void AttachFileItem::updateItem()
/* save path */
/* update progress */
mMode = AFI_STATE_LOCAL;
mPath = fi.path;
mPath = QString::fromUtf8(fi.path.c_str());
stateChanged = true;
}
progressBar->setValue(fi.avail / mDivisor);
@ -442,7 +433,6 @@ void AttachFileItem::updateItem()
/* update progress */
break;
}
}
/****** update based on new state ******/
@ -485,7 +475,6 @@ void AttachFileItem::updateItem()
msec_rate = 2000; /* should be download rate dependent */
break;
}
if (repeat)
{
@ -495,10 +484,8 @@ void AttachFileItem::updateItem()
#endif
QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
}
}
void AttachFileItem::cancel()
{
#ifdef DEBUG_ITEM
@ -519,7 +506,7 @@ void AttachFileItem::cancel()
}
}
uint32_t AttachFileItem::getState() {
uint32_t AttachFileItem::getState()
{
return mMode;
}

View File

@ -41,49 +41,39 @@ const uint32_t AFI_TYPE_ATTACH = 0x0020;
class AttachFileItem : public QWidget, private Ui::AttachFileItem
{
Q_OBJECT
Q_OBJECT
public:
/** Default Constructor */
AttachFileItem(std::string localpath);
AttachFileItem(std::string hash, std::string name, uint64_t size,
uint32_t flags, std::string srcId);
/** Default Constructor */
AttachFileItem(const QString& localpath);
AttachFileItem(const std::string& hash, const QString& name, uint64_t size, uint32_t flags, const std::string& srcId);
/** Default Destructor */
/** Default Destructor */
std::string FileHash() { return mFileHash; }
std::string FileName() { return mFileName; }
uint64_t FileSize() { return mFileSize; }
std::string FilePath() { return mPath; }
int getPicFlag() { return mPicFlag;}
void setPicFlag(int flag) { mPicFlag=flag;}
const std::string& FileHash() { return mFileHash; }
const QString& FileName() { return mFileName; }
uint64_t FileSize() { return mFileSize; }
const QString& FilePath() { return mPath; }
void updateItemStatic();
bool done();
bool done();
bool ready();
uint32_t getState();
public slots:
private slots:
void cancel();
void cancel();
void updateItem();
private:
void Setup();
std::string mPath;
QString mPath;
std::string mFileHash;
std::string mFileName;
QString mFileName;
uint64_t mFileSize;
std::string mSrcId;
uint32_t mPicFlag;
uint32_t mMode;
uint32_t mType;
uint64_t mDivisor;
@ -92,11 +82,8 @@ private:
float amountDone;
signals:
void fileFinished(AttachFileItem * AttachFileItem);
void fileFinished(AttachFileItem * AttachFileItem);
};
#endif

View File

@ -10,11 +10,11 @@
<height>35</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
@ -130,7 +130,7 @@ background: white;}
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../../../../plugins/qdiagram_plugin/qdiagram.qrc">
<normaloff>:/images/delete.png</normaloff>:/images/delete.png</iconset>
</property>
</widget>
@ -154,7 +154,7 @@ background: white;}
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../../../../plugins/qdiagram_plugin/qdiagram.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -26,13 +26,12 @@
#include <QFile>
#include <QDesktopWidget>
#include <QDropEvent>
#include <QPushButton>
#include <retroshare/rsforums.h>
#include <retroshare/rsfiles.h>
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/common/Emoticons.h"
#include "util/misc.h"
@ -52,6 +51,8 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
connect( ui.postmessage_action, SIGNAL( triggered (bool) ), this, SLOT( createMsg( ) ) );
connect( ui.close_action, SIGNAL( triggered (bool) ), this, SLOT( cancelMsg( ) ) );
@ -60,6 +61,8 @@ CreateForumMsg::CreateForumMsg(std::string fId, std::string pId)
connect( ui.pastersButton, SIGNAL(clicked() ), this , SLOT(pasteLink()));
setAcceptDrops(true);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(false);
newMsg();
}
@ -203,130 +206,34 @@ void CreateForumMsg::addFile()
{
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
addAttachment((*fileIt).toUtf8().constData());
}
ui.hashBox->addAttachments(files);
}
}
void CreateForumMsg::addAttachment(std::string filePath) {
/* add a AttachFileItem to the attachment section */
std::cerr << "CreateForumMsg::addFile() hashing file.";
std::cerr << std::endl;
void CreateForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "CreateForumMsg::fileHashingFinished() started." << std::endl;
/* add widget in for new destination */
AttachFileItem *file = new AttachFileItem(filePath);
//file->
QString mesgString;
ui.verticalLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a forum message
if (file->getState() == AFI_STATE_LOCAL) {
fileHashingFinished(file);
} else {
QObject::connect(file,SIGNAL(fileFinished(AttachFileItem *)),this, SLOT(fileHashingFinished(AttachFileItem *))) ;
}
}
void CreateForumMsg::fileHashingFinished(AttachFileItem* file) {
std::cerr << "CreateForumMsg::fileHashingFinished() started.";
std::cerr << std::endl;
//check that the file is ok tos end
if (file->getState() == AFI_STATE_ERROR) {
#ifdef CHAT_DEBUG
std::cerr << "CreateForumMsg::fileHashingFinished error file is not hashed.";
#endif
return;
}
RetroShareLink link;
if (link.createFile(QString::fromUtf8(file->FileName().c_str()), file->FileSize(), QString::fromStdString(file->FileHash()))) {
QString mesgString = link.toHtmlSize() + "<br>";
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
RetroShareLink link;
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
mesgString += link.toHtmlSize() + "<br>";
}
}
#ifdef CHAT_DEBUG
std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
std::cerr << "CreateForumMsg::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
#endif
ui.forumMessage->textCursor().insertHtml(mesgString);
if (!mesgString.isEmpty()) {
ui.forumMessage->textCursor().insertHtml(mesgString);
}
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
}
void CreateForumMsg::dropEvent(QDropEvent *event)
{
if (!(Qt::CopyAction & event->possibleActions()))
{
std::cerr << "CreateForumMsg::dropEvent() Rejecting uncopyable DropAction" << std::endl;
/* can't do it */
return;
}
std::cerr << "CreateForumMsg::dropEvent() Formats" << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString() << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "CreateForumMsg::dropEvent() Urls:" << std::endl;
QList<QUrl> urls = event->mimeData()->urls();
QList<QUrl>::iterator uit;
for(uit = urls.begin(); uit != urls.end(); uit++)
{
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false)
{
// Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "CreateForumMsg::dropEvent() directory not accepted."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
} else if (QFile::exists(localpath)) {
addAttachment(localpath.toUtf8().constData());
} else {
std::cerr << "CreateForumMsg::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
}
}
}
}
event->setDropAction(Qt::CopyAction);
event->accept();
}
void CreateForumMsg::dragEnterEvent(QDragEnterEvent *event)
{
/* print out mimeType */
std::cerr << "CreateForumMsg::dragEnterEvent() Formats" << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++)
{
std::cerr << "Format: " << (*it).toStdString() << std::endl;
}
if (event->mimeData()->hasUrls())
{
std::cerr << "CreateForumMsg::dragEnterEvent() Accepting Urls" << std::endl;
event->acceptProposedAction();
}
else
{
std::cerr << "CreateForumMsg::dragEnterEvent() No Urls" << std::endl;
}
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
void CreateForumMsg::pasteLink()
@ -338,4 +245,3 @@ void CreateForumMsg::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}

View File

@ -25,8 +25,6 @@
#include "ui_CreateForumMsg.h"
class AttachFileItem;
class CreateForumMsg : public QMainWindow
{
Q_OBJECT
@ -40,8 +38,8 @@ private slots:
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(AttachFileItem* file);
/* actions to take.... */
void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */
void createMsg();
void cancelMsg();
void pasteLink();
@ -50,13 +48,9 @@ private slots:
void smileyWidgetForums();
void addSmileys();
void addFile();
void addAttachment(std::string);
protected:
void closeEvent (QCloseEvent * event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
private:
std::string mForumId;

View File

@ -261,44 +261,19 @@ p, li { white-space: pre-wrap; }
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QScrollArea" name="scrollArea">
<widget class="HashBox" name="hashBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>You can attach files via drag and drop here in this window</string>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>57</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="margin">
<number>0</number>
</property>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -343,6 +318,14 @@ p, li { white-space: pre-wrap; }
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>

View File

@ -2,14 +2,10 @@
<qresource prefix="/" >
<file>images/splash.png</file>
<file>images/attach.png</file>
<file>images/audio-x-monkey.png</file>
<file>images/video-x-generic.png</file>
<file>images/application-x-rar.png</file>
<file>images/application-draw.png</file>
<file>images/pgp.png</file>
<file>images/rs_wizard.png</file>
<file>images/about.png</file>
<file>images/backblue.png</file>
<file>images/backblue.png</file>
<file>images/backchat.png</file>
<file>images/buttonframe.png</file>
<file>images/btn1.png</file>
@ -166,7 +162,7 @@
<file>images/filerating5.png</file>
<file>images/fileshare16.png</file>
<file>images/fileshare24.png</file>
<file>images/fileshare32.png</file>
<file>images/fileshare32.png</file>
<file>images/fileshare48.png</file>
<file>images/find.png</file>
<file>images/find-16.png</file>
@ -439,7 +435,7 @@
<file>images/user/friends24.png</file>
<file>images/user/identity16.png</file>
<file>images/user/identity24.png</file>
<file>images/user/identity32.png</file>
<file>images/user/identity32.png</file>
<file>images/user/identity48.png</file>
<file>images/user/identityoffline24.png</file>
<file>images/user/identity24away.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -49,7 +49,6 @@
#include "gui/common/PeerDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h"
#include "gui/feeds/AttachFileItem.h"
#include "gui/common/Emoticons.h"
#include "textformat.h"
#include "util/misc.h"
@ -109,7 +108,7 @@ public:
/** Constructor */
MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags), mCheckAttachment(true)
: QMainWindow(parent, flags)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
@ -168,6 +167,9 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
connect(ui.msgFileList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuFileList(QPoint)));
connect(ui.msgSendList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuMsgSendList(QPoint)));
connect(ui.hashBox, SIGNAL(fileHashingStarted()), this, SLOT(fileHashingStarted()));
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
setWindowModified(ui.msgText->document()->isModified());
actionSave->setEnabled(ui.msgText->document()->isModified());
actionUndo->setEnabled(ui.msgText->document()->isUndoAvailable());
@ -304,6 +306,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
ui.tagButton->setMenu(menu);
setAcceptDrops(true);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(true);
#ifdef RS_RELEASE_VERSION
ui.imagebtn->setVisible(false);
@ -2231,88 +2235,35 @@ void MessageComposer::attachFile()
// select a file
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
for (QStringList::iterator fileIt = files.begin(); fileIt != files.end(); fileIt++) {
addAttachment((*fileIt).toUtf8().constData());
}
ui.hashBox->addAttachments(files);
}
}
void MessageComposer::addAttachment(std::string filePath)
void MessageComposer::fileHashingStarted()
{
/* add a AttachFileItem to the attachment section */
std::cerr << "MessageComposer::addFile() hashing file.";
std::cerr << std::endl;
std::cerr << "MessageComposer::fileHashingStarted() started." << std::endl;
/* add widget in for new destination */
AttachFileItem *file = new AttachFileItem(filePath);
ui.hashBox->show();
ui.msgFileList->hide();
ui.verticalLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
if (file->getState() == AFI_STATE_LOCAL) {
fileHashingFinished(file);
} else {
QObject::connect(file,SIGNAL(fileFinished(AttachFileItem *)),this, SLOT(fileHashingFinished(AttachFileItem *))) ;
}
mAttachments.push_back(file);
if (mCheckAttachment)
{
checkAttachmentReady();
}
ui.hashBox->show();
}
void MessageComposer::fileHashingFinished(AttachFileItem* file)
void MessageComposer::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "MessageComposer::fileHashingFinished() started.";
std::cerr << std::endl;
std::cerr << "MessageComposer::fileHashingFinished() started." << std::endl;
//check that the file is ok tos end
if (file->getState() == AFI_STATE_ERROR) {
#ifdef CHAT_DEBUG
std::cerr << "MessageComposer::fileHashingFinished error file is not hashed.";
#endif
return;
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
FileInfo info;
info.fname = it->filename.toUtf8().constData();
info.hash = it->hash;
info.size = it->size;
addFile(info);
}
FileInfo fileInfo;
fileInfo.fname = file->FileName();
fileInfo.hash = file->FileHash();
fileInfo.size = file->FileSize();
addFile(fileInfo);
}
void MessageComposer::checkAttachmentReady()
{
std::list<AttachFileItem *>::iterator fit;
mCheckAttachment = false;
for(fit = mAttachments.begin(); fit != mAttachments.end(); fit++)
{
if (!(*fit)->isHidden())
{
if (!(*fit)->ready())
{
ui.actionSend->setEnabled(false);
break;
}
}
}
if (fit == mAttachments.end())
{
ui.actionSend->setEnabled(true);
ui.hashBox->hide();
ui.msgFileList->show();
}
/* repeat... */
int msec_rate = 1000;
QTimer::singleShot( msec_rate, this, SLOT(checkAttachmentReady(void)));
ui.actionSend->setEnabled(true);
ui.hashBox->hide();
ui.msgFileList->show();
}
/* clear Filter */
@ -2470,82 +2421,6 @@ void MessageComposer::friendDetails()
ConfCertDialog::showIt(id, ConfCertDialog::PageDetails);
}
void MessageComposer::dragEnterEvent(QDragEnterEvent *event)
{
/* print out mimeType */
std::cerr << "PopupChatDialog::dragEnterEvent() Formats";
std::cerr << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++) {
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasUrls()) {
std::cerr << "PopupChatDialog::dragEnterEvent() Accepting Urls";
std::cerr << std::endl;
event->acceptProposedAction();
} else {
std::cerr << "PopupChatDialog::dragEnterEvent() No Urls";
std::cerr << std::endl;
}
}
void MessageComposer::dropEvent(QDropEvent *event)
{
if (!(Qt::CopyAction & event->possibleActions())) {
std::cerr << "PopupChatDialog::dropEvent() Rejecting uncopyable DropAction";
std::cerr << std::endl;
/* can't do it */
return;
}
std::cerr << "PopupChatDialog::dropEvent() Formats";
std::cerr << std::endl;
QStringList formats = event->mimeData()->formats();
QStringList::iterator it;
for(it = formats.begin(); it != formats.end(); it++) {
std::cerr << "Format: " << (*it).toStdString();
std::cerr << std::endl;
}
if (event->mimeData()->hasUrls()) {
std::cerr << "PopupChatDialog::dropEvent() Urls:";
std::cerr << std::endl;
QList<QUrl> urls = event->mimeData()->urls();
QList<QUrl>::iterator uit;
for(uit = urls.begin(); uit != urls.end(); uit++) {
QString localpath = uit->toLocalFile();
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
if (localpath.isEmpty() == false) {
//Check that the file does exist and is not a directory
QDir dir(localpath);
if (dir.exists()) {
std::cerr << "PopupChatDialog::dropEvent() directory not accepted."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("Directory can't be dropped, only files are accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
} else if (QFile::exists(localpath)) {
addAttachment(localpath.toUtf8().constData());
} else {
std::cerr << "PopupChatDialog::dropEvent() file does not exists."<< std::endl;
QMessageBox mb(tr("Drop file error."), tr("File not found or file name not accepted."),QMessageBox::Information,QMessageBox::Ok,0,0,this);
mb.exec();
}
}
}
}
event->setDropAction(Qt::CopyAction);
event->accept();
}
void MessageComposer::tagAboutToShow()
{
TagsMenu *menu = dynamic_cast<TagsMenu*>(ui.tagButton->menu());
@ -2575,7 +2450,7 @@ void MessageComposer::tagSet(int tagId, bool set)
m_tagIds.push_back(tagId);
/* Keep the list sorted */
m_tagIds.sort();
}
}
} else {
if (set == false) {
m_tagIds.remove(tagId);

View File

@ -31,7 +31,6 @@ class QComboBox;
class QFontComboBox;
class QTextEdit;
class QTextCharFormat;
class AttachFileItem;
class RSTreeWidgetItemCompareRole;
class MessageComposer : public QMainWindow
@ -80,9 +79,6 @@ protected:
void closeEvent (QCloseEvent * event);
bool eventFilter(QObject *obj, QEvent *ev);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
private slots:
/* toggle Contacts DockWidget */
void contextMenu(QPoint);
@ -119,11 +115,10 @@ private slots:
void clipboardDataChanged();
void fileHashingFinished(AttachFileItem* file);
void fileHashingStarted();
void fileHashingFinished(QList<HashedFile> hashedFiles);
void attachFile();
void addAttachment(std::string);
void checkAttachmentReady();
void fontSizeIncrease();
void fontSizeDecrease();
@ -216,11 +211,6 @@ private:
std::list<uint32_t> m_tagIds;
QList<QLabel*> tagLabels;
/* maps of files */
std::list<AttachFileItem *> mAttachments;
bool mCheckAttachment;
RSTreeWidgetItemCompareRole *m_compareRole;
QCompleter *m_completer;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>796</width>
<height>588</height>
<height>624</height>
</rect>
</property>
<property name="contextMenuPolicy">
@ -17,7 +17,7 @@
<string>Compose</string>
</property>
<property name="windowIcon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property>
<property name="styleSheet">
@ -397,7 +397,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset>
</property>
<property name="iconSize">
@ -429,7 +429,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset>
</property>
<property name="iconSize">
@ -467,7 +467,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset>
</property>
<property name="iconSize">
@ -508,7 +508,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property>
<property name="iconSize">
@ -614,7 +614,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
<property name="iconSize">
@ -640,7 +640,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset>
</property>
<property name="iconSize">
@ -673,7 +673,7 @@ border: 1px solid #CCCCCC;}</string>
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
</property>
<property name="iconSize">
@ -711,7 +711,7 @@ border: 1px solid #CCCCCC;}</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset>
</property>
<property name="iconSize">
@ -784,15 +784,6 @@ border: 1px solid #CCCCCC;}</string>
<attribute name="verticalHeaderDefaultSectionSize">
<number>22</number>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>22</number>
</attribute>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="2" column="0" rowspan="2">
@ -835,7 +826,7 @@ border: 1px solid #CCCCCC;}</string>
<string>Tags</string>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/tag24.png</normaloff>:/images/tag24.png</iconset>
</property>
<property name="flat">
@ -923,41 +914,10 @@ border: 1px solid #CCCCCC;}</string>
</widget>
</item>
<item row="2" column="0">
<widget class="QScrollArea" name="hashBox">
<widget class="HashBox" name="hashBox">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>57</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>46</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -1006,7 +966,7 @@ border: 1px solid #CCCCCC;}</string>
</widget>
<action name="actionSend">
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/send24.png</normaloff>:/images/send24.png</iconset>
</property>
<property name="text">
@ -1018,7 +978,7 @@ border: 1px solid #CCCCCC;}</string>
</action>
<action name="actionReply">
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset>
</property>
<property name="text">
@ -1027,7 +987,7 @@ border: 1px solid #CCCCCC;}</string>
</action>
<action name="actionContactsView">
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/contacts24.png</normaloff>:/images/contacts24.png</iconset>
</property>
<property name="text">
@ -1039,7 +999,7 @@ border: 1px solid #CCCCCC;}</string>
</action>
<action name="actionSaveas">
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/save24.png</normaloff>:/images/save24.png</iconset>
</property>
<property name="text">
@ -1051,7 +1011,7 @@ border: 1px solid #CCCCCC;}</string>
</action>
<action name="actionAttach">
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/attach.png</normaloff>:/images/attach.png</iconset>
</property>
<property name="text">
@ -1066,7 +1026,7 @@ border: 1px solid #CCCCCC;}</string>
<bool>true</bool>
</property>
<property name="icon">
<iconset>
<iconset resource="../images.qrc">
<normaloff>:/images/quote_24.png</normaloff>:/images/quote_24.png</iconset>
</property>
<property name="text">
@ -1077,6 +1037,14 @@ border: 1px solid #CCCCCC;}</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>HashBox</class>
<extends>QScrollArea</extends>
<header location="global">gui/common/HashBox.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>recipientWidget</tabstop>
<tabstop>titleEdit</tabstop>
@ -1093,6 +1061,8 @@ border: 1px solid #CCCCCC;}</string>
<tabstop>comboFont</tabstop>
<tabstop>hashBox</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -219,6 +219,11 @@ p, li { white-space: pre-wrap; }
<source>Cancel Download</source>
<translation>Download abbrechen</translation>
</message>
<message>
<location filename="../gui/feeds/AttachFileItem.cpp" line="+230"/>
<source>[ERROR])</source>
<translation>[Fehler]</translation>
</message>
</context>
<context>
<name>AvatarWidget</name>
@ -2423,12 +2428,12 @@ p, li { white-space: pre-wrap; }
<context>
<name>CreateForumMsg</name>
<message>
<location filename="../gui/forums/CreateForumMsg.ui" line="+333"/>
<location filename="../gui/forums/CreateForumMsg.ui" line="+308"/>
<source>Post Forum Msg</source>
<translation>Forumbeitrag schreiben</translation>
</message>
<message>
<location line="-274"/>
<location line="-249"/>
<source>Forum</source>
<translation>Forum</translation>
</message>
@ -2448,18 +2453,18 @@ p, li { white-space: pre-wrap; }
<translation>Betreff</translation>
</message>
<message>
<location line="+265"/>
<location line="+240"/>
<source>Close</source>
<translation>Schliessen</translation>
</message>
<message>
<location line="-325"/>
<location line="-300"/>
<source>Post Forum Message</source>
<translation>Erstelle Forumbeitrag</translation>
</message>
<message>
<location line="+185"/>
<location filename="../gui/forums/CreateForumMsg.cpp" line="+73"/>
<location filename="../gui/forums/CreateForumMsg.cpp" line="+76"/>
<source>Paste RetroShare Link</source>
<translation>RetroShare Link einfügen</translation>
</message>
@ -2499,25 +2504,21 @@ p, li { white-space: pre-wrap; }
<translation>Hänge Dateien mit Drag&apos;n&apos;Drop an</translation>
</message>
<message>
<location line="+6"/>
<location line="+12"/>
<source>You can attach files via drag and drop here in this window</source>
<translation>Du kannst Dateien mit Drag&apos;n&apos;Drop anhängen</translation>
</message>
<message>
<location filename="../gui/forums/CreateForumMsg.cpp" line="+88"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
<translation type="obsolete">Dateifehler bei Drag&apos;n&apos;Drop.</translation>
</message>
<message>
<location line="+0"/>
<source>File not found or file name not accepted.</source>
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
<translation type="obsolete">Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
</message>
<message>
<location line="-6"/>
<source>Directory can&apos;t be dropped, only files are accepted.</source>
<translation>Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
<translation type="obsolete">Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
</message>
</context>
<context>
@ -3521,10 +3522,64 @@ p, li { white-space: pre-wrap; }
<translation>Direkte Freund-Übertragung / Verfügbarkeit angenommen</translation>
</message>
</context>
<context>
<name>FilesDefs</name>
<message>
<location filename="../gui/common/FilesDefs.cpp" line="+33"/>
<source>Picture</source>
<translation>Bild</translation>
</message>
<message>
<location line="+4"/>
<source>Video</source>
<translation>Video</translation>
</message>
<message>
<location line="+2"/>
<source>Audio</source>
<translation>Audio</translation>
</message>
<message>
<location line="+4"/>
<source>Archive</source>
<translation>Archiv</translation>
</message>
<message>
<location line="+4"/>
<source>Program</source>
<translation>Programm</translation>
</message>
<message>
<location line="+2"/>
<source>CD/DVD-Image</source>
<translation>CD/DVD-Abbild</translation>
</message>
<message>
<location line="+5"/>
<location line="+2"/>
<source>Document</source>
<translation>Dokument</translation>
</message>
<message>
<location line="+2"/>
<source>RetroShare collection file</source>
<translation>Kollektion</translation>
</message>
<message>
<location line="+2"/>
<source>Subtitles</source>
<translation>Untertitel</translation>
</message>
<message>
<location line="+2"/>
<source>Nintendo DS Rom</source>
<translation>Nintendo DS Rom</translation>
</message>
</context>
<context>
<name>FlatStyle_RDM</name>
<message>
<location filename="../gui/RemoteDirModel.cpp" line="+674"/>
<location filename="../gui/RemoteDirModel.cpp" line="+646"/>
<source>Friends Directories</source>
<translation>Dateien von Freunden</translation>
</message>
@ -4430,12 +4485,12 @@ p, li { white-space: pre-wrap; }
<translation>Gruppenchat</translation>
</message>
<message>
<location line="+465"/>
<location line="+456"/>
<source>Messages entered here are sent to all connected friends</source>
<translation>Nachrichten, die Du hier eingibst, werden an alle verbundenen Freunde versendet</translation>
</message>
<message>
<location line="-378"/>
<location line="-369"/>
<source>Bold</source>
<translation>Fett</translation>
</message>
@ -4470,7 +4525,7 @@ p, li { white-space: pre-wrap; }
<translation>Senden</translation>
</message>
<message>
<location line="+113"/>
<location line="+117"/>
<source>Clear Chat History</source>
<translation>Nachrichtenverlauf leeren</translation>
</message>
@ -4591,7 +4646,7 @@ p, li { white-space: pre-wrap; }
<translation>Löscht den gespeicherten und angezeigten Chat Verlauf</translation>
</message>
<message>
<location filename="../gui/FriendsDialog.cpp" line="+89"/>
<location filename="../gui/FriendsDialog.cpp" line="+88"/>
<source>Profile</source>
<translation>Profil</translation>
</message>
@ -4601,12 +4656,12 @@ p, li { white-space: pre-wrap; }
<translation>Neuigkeiten</translation>
</message>
<message>
<location line="+31"/>
<location line="+33"/>
<source>Welcome to RetroShare&apos;s group chat.</source>
<translation>Willkommen bei RetroShare&apos;s Gruppenchat.</translation>
</message>
<message>
<location line="+64"/>
<location line="+66"/>
<source>me</source>
<translation>ich</translation>
</message>
@ -4741,23 +4796,19 @@ p, li { white-space: pre-wrap; }
<translation>Zusätzliche Datei hinzufügen</translation>
</message>
<message>
<location line="+97"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
<translation type="obsolete">Dateifehler bei Drag&apos;n&apos;Drop.</translation>
</message>
<message>
<location line="-6"/>
<source>Directory can&apos;t be dropped, only files are accepted.</source>
<translation>Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
<translation type="obsolete">Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
</message>
<message>
<location line="+6"/>
<source>File not found or file name not accepted.</source>
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
<translation type="obsolete">Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
</message>
<message>
<location line="+51"/>
<location line="+57"/>
<source>Save as...</source>
<translation>Speichern unter...</translation>
</message>
@ -5649,6 +5700,25 @@ p, li { white-space: pre-wrap; }
<translation>im Bereich</translation>
</message>
</context>
<context>
<name>HashBox</name>
<message>
<location filename="../gui/common/HashBox.cpp" line="+126"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
</message>
<message>
<location line="-6"/>
<source>Directory can&apos;t be dropped, only files are accepted.</source>
<translation>Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
</message>
<message>
<location line="+6"/>
<source>File not found or file name not accepted.</source>
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
</message>
</context>
<context>
<name>HelpBrowser</name>
<message>
@ -6423,18 +6493,18 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<name>MessageComposer</name>
<message>
<location filename="../gui/msgs/MessageComposer.ui" line="+17"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="+832"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="+836"/>
<source>Compose</source>
<translation>Verfassen</translation>
</message>
<message>
<location line="+49"/>
<location line="+968"/>
<location line="+928"/>
<source>Contacts</source>
<translation>Kontakte</translation>
</message>
<message>
<location line="-953"/>
<location line="-913"/>
<source>Search for Name:</source>
<translation>Suche Name:</translation>
</message>
@ -6464,12 +6534,12 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>&gt;&gt; Bcc</translation>
</message>
<message>
<location line="+573"/>
<location line="+564"/>
<source>Subject:</source>
<translation>Betreff:</translation>
</message>
<message>
<location line="-493"/>
<location line="-484"/>
<source>Paragraph</source>
<translation>Absatz</translation>
</message>
@ -6540,18 +6610,18 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>Unterstrichen</translation>
</message>
<message>
<location line="+111"/>
<location line="+102"/>
<source>Tags:</source>
<translation>Schlagwörter:</translation>
</message>
<message>
<location line="+16"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="-533"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="-535"/>
<source>Tags</source>
<translation>Schlagwörter</translation>
</message>
<message>
<location line="-330"/>
<location line="-321"/>
<source>Italic</source>
<translation>Kursiv</translation>
</message>
@ -6576,7 +6646,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>Setzt Schriftart auf Codestil</translation>
</message>
<message>
<location filename="../gui/msgs/MessageComposer.cpp" line="+1091"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="+1093"/>
<source>To</source>
<translation>An</translation>
</message>
@ -6591,7 +6661,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>Bcc</translation>
</message>
<message>
<location filename="../gui/msgs/MessageComposer.ui" line="+253"/>
<location filename="../gui/msgs/MessageComposer.ui" line="+244"/>
<source>Recommended Files</source>
<translation>Empfohlene Dateien</translation>
</message>
@ -6611,7 +6681,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>Prüfsumme</translation>
</message>
<message>
<location line="+93"/>
<location line="+62"/>
<source>Send</source>
<translation>Senden</translation>
</message>
@ -6661,7 +6731,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>Blockquote hinzufügen</translation>
</message>
<message>
<location filename="../gui/msgs/MessageComposer.cpp" line="-1180"/>
<location filename="../gui/msgs/MessageComposer.cpp" line="-1182"/>
<source>&amp;Left</source>
<translation>&amp;Links</translation>
</message>
@ -6681,7 +6751,7 @@ Bitte gib etwas Speicher frei und drücke OK.</translation>
<translation>&amp;Blocksatz</translation>
</message>
<message>
<location line="+218"/>
<location line="+220"/>
<location line="+1657"/>
<source>Save Message</source>
<translation>Nachricht speichern</translation>
@ -6914,23 +6984,19 @@ Möchtest du die Nachricht speichern ?</translation>
<translation>Zusätzliche Datei hinzufügen</translation>
</message>
<message>
<location line="+299"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
<translation type="obsolete">Dateifehler bei Drag&apos;n&apos;Drop.</translation>
</message>
<message>
<location line="-6"/>
<source>Directory can&apos;t be dropped, only files are accepted.</source>
<translation>Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
<translation type="obsolete">Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
</message>
<message>
<location line="+6"/>
<source>File not found or file name not accepted.</source>
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
<translation type="obsolete">Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
</message>
<message>
<location line="-2124"/>
<location line="-1819"/>
<source>Friend Recommendation(s)</source>
<translation>Freundempfehlung(en)</translation>
</message>
@ -8975,7 +9041,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>PopupChatDialog</name>
<message>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+708"/>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+706"/>
<source>Hide Avatar</source>
<translation>Avatar verstecken</translation>
</message>
@ -8995,40 +9061,39 @@ p, li { white-space: pre-wrap; }
<translation>Lade Bilddatei</translation>
</message>
<message>
<location line="+155"/>
<source>File not found or file name not accepted.</source>
<translation>Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
<translation type="obsolete">Datei nicht gefunden oder Dateiname nicht akzeptiert.</translation>
</message>
<message>
<location line="+89"/>
<location line="+102"/>
<source>Messages you send will be delivered after Friend is again Online</source>
<translation>Nachrichten, die Du versendest gehen bei diesem Freund erst wieder ein wenn er Online ist</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.ui" line="+561"/>
<location line="+278"/>
<location filename="../gui/chat/PopupChatDialog.ui" line="+564"/>
<location line="+285"/>
<source>Bold</source>
<translation>Fett</translation>
</message>
<message>
<location line="-243"/>
<location line="+253"/>
<location line="-250"/>
<location line="+260"/>
<source>Underline</source>
<translation>Unterstrichen</translation>
</message>
<message>
<location line="-218"/>
<location line="+213"/>
<location line="-225"/>
<location line="+220"/>
<source>Italic</source>
<translation>Kursiv</translation>
</message>
<message>
<location line="-143"/>
<location line="-150"/>
<source>Text Color</source>
<translation>Textfarbe</translation>
</message>
<message>
<location line="+183"/>
<location line="+190"/>
<source>Clear offline messages</source>
<translation>Entferne offline Nachrichten</translation>
</message>
@ -9048,12 +9113,12 @@ p, li { white-space: pre-wrap; }
<translation>Nachrichtenverlauf leeren</translation>
</message>
<message>
<location line="-197"/>
<location line="-204"/>
<source>Font</source>
<translation>Schriftart</translation>
</message>
<message>
<location line="+235"/>
<location line="+242"/>
<source>Delete Chat History</source>
<translation>Nachrichtenverlauf löschen</translation>
</message>
@ -9063,12 +9128,12 @@ p, li { white-space: pre-wrap; }
<translation>Löscht den gespeicherten und angezeigten Chat Verlauf</translation>
</message>
<message>
<location line="-402"/>
<location line="-409"/>
<source>Send</source>
<translation>Senden</translation>
</message>
<message>
<location line="+369"/>
<location line="+376"/>
<source>Disable Emoticons</source>
<translation>Deaktiviere Emoticons</translation>
</message>
@ -9078,34 +9143,31 @@ p, li { white-space: pre-wrap; }
<translation>Durchgestrichen</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.cpp" line="-253"/>
<location filename="../gui/chat/PopupChatDialog.cpp" line="-111"/>
<source>Add Extra File</source>
<translation>Zusätzlich eine Datei hinzufügen</translation>
</message>
<message>
<location line="+158"/>
<location line="+6"/>
<source>Drop file error.</source>
<translation>Dateifehler bei Drag&apos;n&apos;Drop.</translation>
<translation type="obsolete">Dateifehler bei Drag&apos;n&apos;Drop.</translation>
</message>
<message>
<location line="-6"/>
<source>Directory can&apos;t be dropped, only files are accepted.</source>
<translation>Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
<translation type="obsolete">Ordner können nicht für Drag&apos;n&apos;Drop genutzt werden. Nur Dateien werden akzeptiert.</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.ui" line="-388"/>
<location filename="../gui/chat/PopupChatDialog.ui" line="-395"/>
<source>Add a File for your Friend</source>
<translation>Füge eine Datei für deinen Freund hinzu</translation>
</message>
<message>
<location line="+410"/>
<location line="+417"/>
<location line="+3"/>
<source>Save Chat History</source>
<translation>Nachrichtenverlauf speichern</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+61"/>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+77"/>
<source>Save as...</source>
<translation>Speichern unter...</translation>
</message>
@ -9115,18 +9177,18 @@ p, li { white-space: pre-wrap; }
<translation>Text Datei (*.txt );;Alle Dateien (*)</translation>
</message>
<message>
<location line="-647"/>
<location line="-505"/>
<source>Your Friend is offline
Do you want to send them a Message instead</source>
<translation>Dein Freund ist Offline. Möchtest du ihm stattdessen eine Nachricht senden</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.ui" line="-445"/>
<location filename="../gui/chat/PopupChatDialog.ui" line="-452"/>
<source>Attach a Picture</source>
<translation>Bild anhängen</translation>
</message>
<message>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+686"/>
<location filename="../gui/chat/PopupChatDialog.cpp" line="+544"/>
<source>is Idle and may not reply</source>
<translation>antwortet möglicherweise nicht, da der Status auf &quot;Untätig&quot; gesetzt wurde</translation>
</message>
@ -9146,7 +9208,7 @@ Do you want to send them a Message instead</source>
<translation>ist Offline.</translation>
</message>
<message>
<location line="-652"/>
<location line="-510"/>
<source>Paste RetroShare Link</source>
<translation>RetroShare Link einfügen</translation>
</message>
@ -10439,7 +10501,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>RetroshareDirModel</name>
<message>
<location filename="../gui/RemoteDirModel.cpp" line="-478"/>
<location filename="../gui/RemoteDirModel.cpp" line="-449"/>
<source>Anonymous</source>
<translation>Anonym</translation>
</message>
@ -10544,7 +10606,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+0"/>
<location line="+30"/>
<location line="+31"/>
<source>Collection files</source>
<translation>Kollektion</translation>
</message>
@ -10687,7 +10749,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+319"/>
<location filename="../gui/SearchDialog.cpp" line="+292"/>
<location filename="../gui/SearchDialog.cpp" line="+293"/>
<source>Download</source>
<translation>Herunterladen</translation>
</message>
@ -10718,13 +10780,13 @@ p, li { white-space: pre-wrap; }
<translation>Alle entfernen</translation>
</message>
<message>
<location line="+380"/>
<location line="+379"/>
<location line="+68"/>
<source>Folder</source>
<translation>Ordner</translation>
</message>
<message>
<location line="+471"/>
<location line="+396"/>
<source>New RetroShare Link(s)</source>
<translation>Neu(e) RetroShare Link(s)</translation>
</message>
@ -10779,7 +10841,7 @@ p, li { white-space: pre-wrap; }
<translation>Such ID</translation>
</message>
<message>
<location filename="../gui/SearchDialog.cpp" line="-997"/>
<location filename="../gui/SearchDialog.cpp" line="-921"/>
<source>Download Notice</source>
<translation>Download</translation>
</message>
@ -12743,7 +12805,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>TransfersDialog</name>
<message>
<location filename="../gui/TransfersDialog.cpp" line="+338"/>
<location filename="../gui/TransfersDialog.cpp" line="+339"/>
<source>Cancel</source>
<translation>Abbrechen</translation>
</message>
@ -12941,7 +13003,7 @@ p, li { white-space: pre-wrap; }
<translation>Blockstrategie</translation>
</message>
<message>
<location line="+401"/>
<location line="+365"/>
<source>Queued</source>
<translation>In Warteschleife</translation>
</message>
@ -12951,12 +13013,12 @@ p, li { white-space: pre-wrap; }
<translation>Pausiert</translation>
</message>
<message>
<location line="-138"/>
<location line="-137"/>
<source>Transferring</source>
<translation>Übertrage</translation>
</message>
<message>
<location line="+369"/>
<location line="+368"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -12991,7 +13053,7 @@ p, li { white-space: pre-wrap; }
<translation>Soll dieser Download wirklich abgebrochen und gelöscht werden?</translation>
</message>
<message>
<location line="-937"/>
<location line="-901"/>
<source>Speed / Queue position</source>
<translation>Geschwindigkeits- / Warteschlangenposition</translation>
</message>
@ -13044,38 +13106,38 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+12"/>
<location line="+541"/>
<location line="+505"/>
<source>Slower</source>
<translation>Langsamer</translation>
</message>
<message>
<location line="-539"/>
<location line="+540"/>
<location line="-503"/>
<location line="+504"/>
<location line="+2"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
<message>
<location line="-540"/>
<location line="+539"/>
<location line="-504"/>
<location line="+503"/>
<source>Faster</source>
<translation>Schneller</translation>
</message>
<message>
<location line="-429"/>
<location line="-393"/>
<source>Move in Queue...</source>
<translation>Verschiebe in Warteschlange...</translation>
</message>
<message>
<location line="+265"/>
<location line="+144"/>
<location line="+230"/>
<location line="+143"/>
<location line="+135"/>
<source>Failed</source>
<translation>Gescheitert</translation>
</message>
<message>
<location line="-275"/>
<location line="+141"/>
<location line="-274"/>
<location line="+140"/>
<location line="+135"/>
<source>Okay</source>
<translation>OK</translation>
@ -13092,8 +13154,8 @@ p, li { white-space: pre-wrap; }
<translation>Ladend</translation>
</message>
<message>
<location line="-131"/>
<location line="+132"/>
<location line="-130"/>
<location line="+131"/>
<location line="+135"/>
<location line="+1"/>
<source>Complete</source>
@ -13120,7 +13182,7 @@ p, li { white-space: pre-wrap; }
<translation>Überprüfe...</translation>
</message>
<message>
<location line="-566"/>
<location line="-530"/>
<source>Force Check</source>
<translation>Erzwinge Überprüfung</translation>
</message>
@ -13128,7 +13190,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>TreeStyle_RDM</name>
<message>
<location filename="../gui/RemoteDirModel.cpp" line="+111"/>
<location filename="../gui/RemoteDirModel.cpp" line="+82"/>
<source>My files</source>
<translation>Meine Dateien</translation>
</message>