renamed RsCollectionFile into RsCollectionEditor

This commit is contained in:
csoler 2017-10-15 21:10:29 +02:00
parent 68763f58d1
commit 847c1b2bce
13 changed files with 87 additions and 98 deletions

View File

@ -30,7 +30,7 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "retroshare-gui/RsAutoUpdatePage.h" #include "retroshare-gui/RsAutoUpdatePage.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/common/RsCollectionFile.h" #include "gui/common/RsCollectionEditor.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/common/RsUrlHandler.h" #include "gui/common/RsUrlHandler.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
@ -345,7 +345,7 @@ void SearchDialog::searchResultWidgetCustomPopupMenu( QPoint /*point*/ )
QList<QTreeWidgetItem*> item =ui.searchResultWidget->selectedItems() ; QList<QTreeWidgetItem*> item =ui.searchResultWidget->selectedItems() ;
if (item.at(0)->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) { if (item.at(0)->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) {
contextMnu.addAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this, SLOT(openFolderSearch())) ; contextMnu.addAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this, SLOT(openFolderSearch())) ;
if (item.at(0)->text(SR_NAME_COL).endsWith(RsCollectionFile::ExtensionString)) { if (item.at(0)->text(SR_NAME_COL).endsWith(RsCollectionEditor::ExtensionString)) {
add_CollActions = true ; add_CollActions = true ;
}//if (item.at(0)->text(SR_NAME_COL).endsWith(RsCollectionFile::ExtensionString)) }//if (item.at(0)->text(SR_NAME_COL).endsWith(RsCollectionFile::ExtensionString))
}//if (item.at(0)->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) }//if (item.at(0)->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool())
@ -448,7 +448,7 @@ void SearchDialog::collCreate()
}//if (!item->text(SR_HASH_COL).isEmpty()) }//if (!item->text(SR_HASH_COL).isEmpty())
}//for (int i = 0; i < numdls; ++i) }//for (int i = 0; i < numdls; ++i)
RsCollectionFile(dirVec).openNewColl(this); RsCollectionEditor(dirVec).openNewColl(this);
} }
void SearchDialog::collModif() void SearchDialog::collModif()
@ -476,8 +476,8 @@ void SearchDialog::collModif()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath()); collection.openColl(qinfo.absoluteFilePath());
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -508,8 +508,8 @@ void SearchDialog::collView()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath(), true); collection.openColl(qinfo.absoluteFilePath(), true);
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -540,8 +540,8 @@ void SearchDialog::collOpen()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(qinfo.absoluteFilePath())) { if (collection.load(qinfo.absoluteFilePath())) {
collection.downloadFiles(); collection.downloadFiles();
return; return;
@ -552,7 +552,7 @@ void SearchDialog::collOpen()
} }
} }
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(this)) { if (collection.load(this)) {
collection.downloadFiles(); collection.downloadFiles();
}//if (collection.load(this)) }//if (collection.load(this))

View File

@ -37,7 +37,7 @@
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/ShareManager.h" #include "gui/ShareManager.h"
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
#include "gui/common/RsCollectionFile.h" #include "gui/common/RsCollectionEditor.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/settings/AddFileAssociationDialog.h" #include "gui/settings/AddFileAssociationDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
@ -499,17 +499,12 @@ void RemoteSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
QMenu contextMnu( this ) ; QMenu contextMnu( this ) ;
//bool bIsRsColl = currentFile.endsWith(RsCollectionFile::ExtensionString);
collCreateAct->setEnabled(true); collCreateAct->setEnabled(true);
//collModifAct->setEnabled(bIsRsColl);
//collViewAct->setEnabled(bIsRsColl);
collOpenAct->setEnabled(true); collOpenAct->setEnabled(true);
QMenu collectionMenu(tr("Collection"), this); QMenu collectionMenu(tr("Collection"), this);
collectionMenu.setIcon(QIcon(IMAGE_LIBRARY)); collectionMenu.setIcon(QIcon(IMAGE_LIBRARY));
collectionMenu.addAction(collCreateAct); collectionMenu.addAction(collCreateAct);
//collectionMenu.addAction(collModifAct);
//collectionMenu.addAction(collViewAct);
collectionMenu.addAction(collOpenAct); collectionMenu.addAction(collOpenAct);
QAction *downloadAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Download" ), &contextMnu ) ; QAction *downloadAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Download" ), &contextMnu ) ;
@ -517,18 +512,12 @@ void RemoteSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
contextMnu.addAction( downloadAct) ; contextMnu.addAction( downloadAct) ;
if ( type == DIR_TYPE_FILE ) { if ( type == DIR_TYPE_FILE ) {
//QAction *copyremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy retroshare Link" ), &contextMnu ) ;
//connect( copyremotelinkAct , SIGNAL( triggered() ), this, SLOT( copyLink() ) ) ;
//QAction *sendremotelinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Link" ), &contextMnu ) ;
//connect( sendremotelinkAct , SIGNAL( triggered() ), this, SLOT( sendremoteLinkTo( ) ) ) ;
contextMnu.addSeparator() ;//------------------------------------ contextMnu.addSeparator() ;//------------------------------------
contextMnu.addAction( copylinkAct) ; contextMnu.addAction( copylinkAct) ;
contextMnu.addAction( sendlinkAct) ; contextMnu.addAction( sendlinkAct) ;
contextMnu.addSeparator() ;//------------------------------------ contextMnu.addSeparator() ;//------------------------------------
contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg())) ; contextMnu.addAction(QIcon(IMAGE_MSG), tr("Recommend in a message to"), this, SLOT(recommendFilesToMsg())) ;
}//if (type == DIR_TYPE_FILE) }
contextMnu.addSeparator() ;//------------------------------------ contextMnu.addSeparator() ;//------------------------------------
contextMnu.addMenu(&collectionMenu) ; contextMnu.addMenu(&collectionMenu) ;
@ -542,7 +531,7 @@ QModelIndexList SharedFilesDialog::getSelected()
QModelIndexList proxyList ; QModelIndexList proxyList ;
for (QModelIndexList::iterator index = list.begin(); index != list.end(); ++index ) { for (QModelIndexList::iterator index = list.begin(); index != list.end(); ++index ) {
proxyList.append(proxyModel->mapToSource(*index)) ; proxyList.append(proxyModel->mapToSource(*index)) ;
}//for (QModelIndexList::iterator index }
return proxyList ; return proxyList ;
} }
@ -692,8 +681,8 @@ void SharedFilesDialog::collModif()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath()); collection.openColl(qinfo.absoluteFilePath());
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -722,8 +711,8 @@ void SharedFilesDialog::collView()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath(), true); collection.openColl(qinfo.absoluteFilePath(), true);
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -752,8 +741,8 @@ void SharedFilesDialog::collOpen()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(qinfo.absoluteFilePath())) { if (collection.load(qinfo.absoluteFilePath())) {
collection.downloadFiles(); collection.downloadFiles();
return; return;
@ -763,7 +752,7 @@ void SharedFilesDialog::collOpen()
} }
} }
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(this)) { if (collection.load(this)) {
collection.downloadFiles(); collection.downloadFiles();
}//if (collection.load(this)) }//if (collection.load(this))
@ -995,7 +984,7 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
QMenu contextMnu(this) ; QMenu contextMnu(this) ;
bool bIsRsColl = currentFile.endsWith(RsCollectionFile::ExtensionString); bool bIsRsColl = currentFile.endsWith(RsCollectionEditor::ExtensionString);
collCreateAct->setEnabled(true); collCreateAct->setEnabled(true);
collModifAct->setEnabled(bIsRsColl); collModifAct->setEnabled(bIsRsColl);
collViewAct->setEnabled(bIsRsColl); collViewAct->setEnabled(bIsRsColl);

View File

@ -31,7 +31,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
#include <gui/common/FilesDefs.h> #include <gui/common/FilesDefs.h>
#include <gui/common/RsCollectionFile.h> #include <gui/common/RsCollectionEditor.h>
#include <gui/common/RsUrlHandler.h> #include <gui/common/RsUrlHandler.h>
#include <gui/common/RSTreeView.h> #include <gui/common/RSTreeView.h>
@ -50,7 +50,7 @@
#include "xprogressbar.h" #include "xprogressbar.h"
#include <gui/settings/rsharesettings.h> #include <gui/settings/rsharesettings.h>
#include "util/misc.h" #include "util/misc.h"
#include <gui/common/RsCollectionFile.h> #include <gui/common/RsCollectionEditor.h>
#include "TransferUserNotify.h" #include "TransferUserNotify.h"
#include "util/QtVersion.h" #include "util/QtVersion.h"
#include "util/RsFile.h" #include "util/RsFile.h"
@ -702,7 +702,7 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ )
add_PlayOption = !add_PreviewOption ; add_PlayOption = !add_PreviewOption ;
}// if (misc::isPreviewable(info.fname.substr(pos + 1).c_str())) }// if (misc::isPreviewable(info.fname.substr(pos + 1).c_str()))
// Check if the file is a collection // Check if the file is a collection
if (RsCollectionFile::ExtensionString == info.fname.substr(pos + 1).c_str()) { if (RsCollectionEditor::ExtensionString == info.fname.substr(pos + 1).c_str()) {
add_CollActions = (info.downloadStatus == FT_STATE_COMPLETE); add_CollActions = (info.downloadStatus == FT_STATE_COMPLETE);
}//if (RsCollectionFile::ExtensionString == info }//if (RsCollectionFile::ExtensionString == info
}// if(pos != std::string::npos) }// if(pos != std::string::npos)
@ -2155,7 +2155,7 @@ void TransfersDialog::collCreate()
dirVec.push_back(details); dirVec.push_back(details);
}//for (it = items.begin(); }//for (it = items.begin();
RsCollectionFile(dirVec).openNewColl(this); RsCollectionEditor(dirVec).openNewColl(this);
} }
void TransfersDialog::collModif() void TransfersDialog::collModif()
@ -2180,8 +2180,8 @@ void TransfersDialog::collModif()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath()); collection.openColl(qinfo.absoluteFilePath());
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -2210,8 +2210,8 @@ void TransfersDialog::collView()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath(), true); collection.openColl(qinfo.absoluteFilePath(), true);
}//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) }//if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString))
}//if (qinfo.exists()) }//if (qinfo.exists())
@ -2240,8 +2240,8 @@ void TransfersDialog::collOpen()
QFileInfo qinfo; QFileInfo qinfo;
qinfo.setFile(QString::fromUtf8(path.c_str())); qinfo.setFile(QString::fromUtf8(path.c_str()));
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(qinfo.absoluteFilePath())) { if (collection.load(qinfo.absoluteFilePath())) {
collection.downloadFiles(); collection.downloadFiles();
return; return;
@ -2252,7 +2252,7 @@ void TransfersDialog::collOpen()
} }
} }
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(this)) { if (collection.load(this)) {
collection.downloadFiles(); collection.downloadFiles();
}//if (collection.load(this)) }//if (collection.load(this))

View File

@ -103,7 +103,7 @@
#include "gui/statistics/StatisticsWindow.h" #include "gui/statistics/StatisticsWindow.h"
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/common/RsCollectionFile.h" #include "gui/common/RsCollectionEditor.h"
#include "settings/rsettingswin.h" #include "settings/rsettingswin.h"
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
#include "settings/WebuiPage.h" #include "settings/WebuiPage.h"
@ -1020,7 +1020,7 @@ void MainWindow::newRsCollection()
{ {
std::vector <DirDetails> dirVec; std::vector <DirDetails> dirVec;
RsCollectionFile(dirVec).openNewColl(this); RsCollectionEditor(dirVec).openNewColl(this);
} }
/** Shows Share Manager */ /** Shows Share Manager */
@ -1448,8 +1448,8 @@ void MainWindow::openRsCollection(const QString &filename)
{ {
QFileInfo qinfo(filename); QFileInfo qinfo(filename);
if (qinfo.exists()) { if (qinfo.exists()) {
if (qinfo.absoluteFilePath().endsWith(RsCollectionFile::ExtensionString)) { if (qinfo.absoluteFilePath().endsWith(RsCollectionEditor::ExtensionString)) {
RsCollectionFile collection; RsCollectionEditor collection;
collection.openColl(qinfo.absoluteFilePath()); collection.openColl(qinfo.absoluteFilePath());
} }
} }

View File

@ -26,7 +26,7 @@
#include <QTimer> #include <QTimer>
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#include <gui/common/RsCollectionFile.h> #include <gui/common/RsCollectionEditor.h>
#include <gui/common/RsUrlHandler.h> #include <gui/common/RsUrlHandler.h>
#include <gui/common/FilesDefs.h> #include <gui/common/FilesDefs.h>
#include <gui/common/GroupDefs.h> #include <gui/common/GroupDefs.h>
@ -1065,7 +1065,7 @@ void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndex
std::vector <DirDetails> dirVec; std::vector <DirDetails> dirVec;
getDirDetailsFromSelect(list, dirVec); getDirDetailsFromSelect(list, dirVec);
RsCollectionFile(dirVec).openNewColl(parent); RsCollectionEditor(dirVec).openNewColl(parent);
} }
void RetroshareDirModel::downloadSelected(const QModelIndexList &list) void RetroshareDirModel::downloadSelected(const QModelIndexList &list)

View File

@ -43,7 +43,7 @@
#include "msgs/MessageComposer.h" #include "msgs/MessageComposer.h"
#include "util/misc.h" #include "util/misc.h"
#include "common/PeerDefs.h" #include "common/PeerDefs.h"
#include "common/RsCollectionFile.h" #include "common/RsCollectionEditor.h"
#include <gui/common/RsUrlHandler.h> #include <gui/common/RsUrlHandler.h>
#include "gui/connect/ConnectFriendWizard.h" #include "gui/connect/ConnectFriendWizard.h"
#include "gui/connect/ConfCertDialog.h" #include "gui/connect/ConfCertDialog.h"
@ -972,10 +972,10 @@ QString RetroShareLink::toHtmlSize() const
{ {
QString size = QString("(%1)").arg(misc::friendlyUnit(_size)); QString size = QString("(%1)").arg(misc::friendlyUnit(_size));
if (type() == TYPE_FILE && RsCollectionFile::isCollectionFile(name())) { if (type() == TYPE_FILE && RsCollectionEditor::isCollectionFile(name())) {
FileInfo finfo; FileInfo finfo;
if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo)) { if (rsFiles->FileDetails(RsFileHash(hash().toStdString()), RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, finfo)) {
RsCollectionFile collection; RsCollectionEditor collection;
if (collection.load(QString::fromUtf8(finfo.path.c_str()), false)) { if (collection.load(QString::fromUtf8(finfo.path.c_str()), false)) {
size += QString(" [%1]").arg(misc::friendlyUnit(collection.size())); size += QString(" [%1]").arg(misc::friendlyUnit(collection.size()));
} }

View File

@ -23,7 +23,7 @@
#include <QFileInfo> #include <QFileInfo>
#include "FilesDefs.h" #include "FilesDefs.h"
#include "RsCollectionFile.h" #include "RsCollectionEditor.h"
static QString getInfoFromFilename(const QString& filename, bool anyForUnknown, bool image) static QString getInfoFromFilename(const QString& filename, bool anyForUnknown, bool image)
{ {
@ -54,7 +54,7 @@ static QString getInfoFromFilename(const QString& filename, bool anyForUnknown,
return image ? ":/images/FileTypeDocument.png" : QApplication::translate("FilesDefs", "Document"); return image ? ":/images/FileTypeDocument.png" : QApplication::translate("FilesDefs", "Document");
} else if (ext == "pdf") { } else if (ext == "pdf") {
return image ? ":/images/mimetypes/pdf.png" : QApplication::translate("FilesDefs", "Document"); return image ? ":/images/mimetypes/pdf.png" : QApplication::translate("FilesDefs", "Document");
} else if (ext == RsCollectionFile::ExtensionString) { } else if (ext == RsCollectionEditor::ExtensionString) {
return image ? ":/images/mimetypes/rscollection-16.png" : QApplication::translate("FilesDefs", "RetroShare collection file"); return image ? ":/images/mimetypes/rscollection-16.png" : QApplication::translate("FilesDefs", "RetroShare collection file");
} else if (ext == "sub" || ext == "srt") { } else if (ext == "sub" || ext == "srt") {
return image ? ":/images/FileTypeAny.png" : QApplication::translate("FilesDefs", "Subtitles"); return image ? ":/images/FileTypeAny.png" : QApplication::translate("FilesDefs", "Subtitles");

View File

@ -29,7 +29,7 @@
#include <QDateTime> #include <QDateTime>
#include <QInputDialog> #include <QInputDialog>
#include "RsCollectionDialog.h" #include "RsCollectionDialog.h"
#include "RsCollectionFile.h" #include "RsCollectionEditor.h"
#include "util/misc.h" #include "util/misc.h"
#define COLUMN_FILE 0 #define COLUMN_FILE 0
#define COLUMN_FILEPATH 1 #define COLUMN_FILEPATH 1
@ -591,12 +591,12 @@ void RsCollectionDialog::changeFileName()
QString fileName; QString fileName;
if(!misc::getSaveFileName(this, RshareSettings::LASTDIR_EXTRAFILE if(!misc::getSaveFileName(this, RshareSettings::LASTDIR_EXTRAFILE
, QApplication::translate("RsCollectionFile", "Create collection file") , QApplication::translate("RsCollectionFile", "Create collection file")
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")" , QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionEditor::ExtensionString + ")"
, fileName,0, QFileDialog::DontConfirmOverwrite)) , fileName,0, QFileDialog::DontConfirmOverwrite))
return; return;
if (!fileName.endsWith("." + RsCollectionFile::ExtensionString)) if (!fileName.endsWith("." + RsCollectionEditor::ExtensionString))
fileName += "." + RsCollectionFile::ExtensionString ; fileName += "." + RsCollectionEditor::ExtensionString ;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl; std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -604,7 +604,7 @@ void RsCollectionDialog::changeFileName()
if(file.exists()) if(file.exists())
{ {
RsCollectionFile collFile; RsCollectionEditor collFile;
if (!collFile.checkFile(fileName,true)) return; if (!collFile.checkFile(fileName,true)) return;
QMessageBox mb; QMessageBox mb;

View File

@ -22,7 +22,7 @@
****************************************************************/ ****************************************************************/
#include "ui_RsCollectionDialog.h" #include "ui_RsCollectionDialog.h"
#include "RsCollectionFile.h" #include "RsCollectionEditor.h"
#include <QFileSystemModel> #include <QFileSystemModel>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>

View File

@ -24,7 +24,7 @@
#include <stdexcept> #include <stdexcept>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include "RsCollectionFile.h" #include "RsCollectionEditor.h"
#include "RsCollectionDialog.h" #include "RsCollectionDialog.h"
#include "util/misc.h" #include "util/misc.h"
@ -36,14 +36,14 @@
#include <QMessageBox> #include <QMessageBox>
#include <QIcon> #include <QIcon>
const QString RsCollectionFile::ExtensionString = QString("rscollection") ; const QString RsCollectionEditor::ExtensionString = QString("rscollection") ;
RsCollectionFile::RsCollectionFile(QObject *parent) RsCollectionEditor::RsCollectionEditor(QObject *parent)
: QObject(parent), _xml_doc("RsCollection") : QObject(parent), _xml_doc("RsCollection")
{ {
} }
RsCollectionFile::RsCollectionFile(const std::vector<DirDetails>& file_infos, QObject *parent) RsCollectionEditor::RsCollectionEditor(const std::vector<DirDetails>& file_infos, QObject *parent)
: QObject(parent), _xml_doc("RsCollection") : QObject(parent), _xml_doc("RsCollection")
{ {
QDomElement root = _xml_doc.createElement("RsCollection"); QDomElement root = _xml_doc.createElement("RsCollection");
@ -53,11 +53,11 @@ RsCollectionFile::RsCollectionFile(const std::vector<DirDetails>& file_infos, QO
recursAddElements(_xml_doc,file_infos[i],root) ; recursAddElements(_xml_doc,file_infos[i],root) ;
} }
RsCollectionFile::~RsCollectionFile() RsCollectionEditor::~RsCollectionEditor()
{ {
} }
void RsCollectionFile::downloadFiles() const void RsCollectionEditor::downloadFiles() const
{ {
// print out the element names of all elements that are direct children // print out the element names of all elements that are direct children
// of the outermost element. // of the outermost element.
@ -87,7 +87,7 @@ static QString purifyFileName(const QString& input,bool& bad)
return output ; return output ;
} }
void RsCollectionFile::recursCollectColFileInfos(const QDomElement& e,std::vector<ColFileInfo>& colFileInfos,const QString& current_path, bool bad_chars_in_parent) const void RsCollectionEditor::recursCollectColFileInfos(const QDomElement& e,std::vector<ColFileInfo>& colFileInfos,const QString& current_path, bool bad_chars_in_parent) const
{ {
QDomNode n = e.firstChild() ; QDomNode n = e.firstChild() ;
@ -139,7 +139,7 @@ void RsCollectionFile::recursCollectColFileInfos(const QDomElement& e,std::vecto
} }
void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& details,QDomElement& e) const void RsCollectionEditor::recursAddElements(QDomDocument& doc,const DirDetails& details,QDomElement& e) const
{ {
if (details.type == DIR_TYPE_FILE) if (details.type == DIR_TYPE_FILE)
{ {
@ -175,7 +175,7 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& det
} }
} }
void RsCollectionFile::recursAddElements(QDomDocument& doc,const ColFileInfo& colFileInfo,QDomElement& e) const void RsCollectionEditor::recursAddElements(QDomDocument& doc,const ColFileInfo& colFileInfo,QDomElement& e) const
{ {
if (colFileInfo.type == DIR_TYPE_FILE) if (colFileInfo.type == DIR_TYPE_FILE)
{ {
@ -208,7 +208,7 @@ static void showErrorBox(const QString& fileName, const QString& error)
mb.exec(); mb.exec();
} }
bool RsCollectionFile::load(const QString& fileName, bool showError /* = true*/) bool RsCollectionEditor::load(const QString& fileName, bool showError /* = true*/)
{ {
if (!checkFile(fileName,showError)) return false; if (!checkFile(fileName,showError)) return false;
@ -238,7 +238,7 @@ bool RsCollectionFile::load(const QString& fileName, bool showError /* = true*/)
} }
// check that the file is a valid rscollection file, and not a lol bomb or some shit like this // check that the file is a valid rscollection file, and not a lol bomb or some shit like this
bool RsCollectionFile::checkFile(const QString& fileName, bool showError) bool RsCollectionEditor::checkFile(const QString& fileName, bool showError)
{ {
QFile file(fileName); QFile file(fileName);
@ -306,10 +306,10 @@ bool RsCollectionFile::checkFile(const QString& fileName, bool showError)
return false; return false;
} }
bool RsCollectionFile::load(QWidget *parent) bool RsCollectionEditor::load(QWidget *parent)
{ {
QString fileName; QString fileName;
if (!misc::getOpenFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", fileName)) if (!misc::getOpenFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionEditor::ExtensionString + ")", fileName))
return false; return false;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl; std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -317,7 +317,7 @@ bool RsCollectionFile::load(QWidget *parent)
return load(fileName, true); return load(fileName, true);
} }
bool RsCollectionFile::save(const QString& fileName) const bool RsCollectionEditor::save(const QString& fileName) const
{ {
QFile file(fileName); QFile file(fileName);
@ -337,14 +337,14 @@ bool RsCollectionFile::save(const QString& fileName) const
return true; return true;
} }
bool RsCollectionFile::save(QWidget *parent) const bool RsCollectionEditor::save(QWidget *parent) const
{ {
QString fileName; QString fileName;
if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Create collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", fileName)) if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Create collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionEditor::ExtensionString + ")", fileName))
return false; return false;
if (!fileName.endsWith("." + RsCollectionFile::ExtensionString)) if (!fileName.endsWith("." + RsCollectionEditor::ExtensionString))
fileName += "." + RsCollectionFile::ExtensionString ; fileName += "." + RsCollectionEditor::ExtensionString ;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl; std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -352,17 +352,17 @@ bool RsCollectionFile::save(QWidget *parent) const
} }
bool RsCollectionFile::openNewColl(QWidget *parent) bool RsCollectionEditor::openNewColl(QWidget *parent)
{ {
QString fileName; QString fileName;
if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE
, QApplication::translate("RsCollectionFile", "Create collection file") , QApplication::translate("RsCollectionFile", "Create collection file")
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")" , QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionEditor::ExtensionString + ")"
, fileName,0, QFileDialog::DontConfirmOverwrite)) , fileName,0, QFileDialog::DontConfirmOverwrite))
return false; return false;
if (!fileName.endsWith("." + RsCollectionFile::ExtensionString)) if (!fileName.endsWith("." + RsCollectionEditor::ExtensionString))
fileName += "." + RsCollectionFile::ExtensionString ; fileName += "." + RsCollectionEditor::ExtensionString ;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl; std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -419,7 +419,7 @@ bool RsCollectionFile::openNewColl(QWidget *parent)
return _saved; return _saved;
} }
bool RsCollectionFile::openColl(const QString& fileName, bool readOnly /* = false */, bool showError /* = true*/) bool RsCollectionEditor::openColl(const QString& fileName, bool readOnly /* = false */, bool showError /* = true*/)
{ {
if (load(fileName, showError)) { if (load(fileName, showError)) {
std::vector<ColFileInfo> colFileInfos ; std::vector<ColFileInfo> colFileInfos ;
@ -437,7 +437,7 @@ bool RsCollectionFile::openColl(const QString& fileName, bool readOnly /* = fals
return false; return false;
} }
qulonglong RsCollectionFile::size() qulonglong RsCollectionEditor::size()
{ {
QDomElement docElem = _xml_doc.documentElement(); QDomElement docElem = _xml_doc.documentElement();
@ -453,14 +453,14 @@ qulonglong RsCollectionFile::size()
return size; return size;
} }
bool RsCollectionFile::isCollectionFile(const QString &fileName) bool RsCollectionEditor::isCollectionFile(const QString &fileName)
{ {
QString ext = QFileInfo(fileName).suffix().toLower(); QString ext = QFileInfo(fileName).suffix().toLower();
return (ext == RsCollectionFile::ExtensionString); return (ext == RsCollectionEditor::ExtensionString);
} }
void RsCollectionFile::saveColl(std::vector<ColFileInfo> colFileInfos, const QString &fileName) void RsCollectionEditor::saveColl(std::vector<ColFileInfo> colFileInfos, const QString &fileName)
{ {
QDomElement root = _xml_doc.elementsByTagName("RsCollection").at(0).toElement(); QDomElement root = _xml_doc.elementsByTagName("RsCollection").at(0).toElement();

View File

@ -56,16 +56,16 @@ public:
}; };
Q_DECLARE_METATYPE(ColFileInfo) Q_DECLARE_METATYPE(ColFileInfo)
class RsCollectionFile : public QObject class RsCollectionEditor : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
RsCollectionFile(QObject *parent = 0) ; RsCollectionEditor(QObject *parent = 0) ;
// create from list of files and directories // create from list of files and directories
RsCollectionFile(const std::vector<DirDetails>& file_entries, QObject *parent = 0) ; RsCollectionEditor(const std::vector<DirDetails>& file_entries, QObject *parent = 0) ;
virtual ~RsCollectionFile() ; virtual ~RsCollectionEditor() ;
static const QString ExtensionString ; static const QString ExtensionString ;

View File

@ -22,14 +22,14 @@
#include <stdexcept> #include <stdexcept>
#include <QDesktopServices> #include <QDesktopServices>
#include <QUrl> #include <QUrl>
#include "RsCollectionFile.h" #include "RsCollectionEditor.h"
#include "RsUrlHandler.h" #include "RsUrlHandler.h"
bool RsUrlHandler::openUrl(const QUrl& url) bool RsUrlHandler::openUrl(const QUrl& url)
{ {
if(url.scheme() == QString("file") && url.toLocalFile().endsWith("."+RsCollectionFile::ExtensionString)) if(url.scheme() == QString("file") && url.toLocalFile().endsWith("."+RsCollectionEditor::ExtensionString))
{ {
RsCollectionFile collection ; RsCollectionEditor collection ;
if(collection.load(url.toLocalFile())) if(collection.load(url.toLocalFile()))
{ {
collection.downloadFiles() ; collection.downloadFiles() ;

View File

@ -476,7 +476,6 @@ HEADERS += rshare.h \
gui/common/ElidedLabel.h \ gui/common/ElidedLabel.h \
gui/common/vmessagebox.h \ gui/common/vmessagebox.h \
gui/common/RsUrlHandler.h \ gui/common/RsUrlHandler.h \
gui/common/RsCollectionFile.h \
gui/common/RsCollectionDialog.h \ gui/common/RsCollectionDialog.h \
gui/common/rwindow.h \ gui/common/rwindow.h \
gui/common/html.h \ gui/common/html.h \
@ -565,7 +564,8 @@ HEADERS += rshare.h \
gui/GetStartedDialog.h \ gui/GetStartedDialog.h \
gui/statistics/BWGraph.h \ gui/statistics/BWGraph.h \
util/RsSyntaxHighlighter.h \ util/RsSyntaxHighlighter.h \
util/imageutil.h util/imageutil.h \
gui/common/RsCollectionEditor.h
# gui/ForumsDialog.h \ # gui/ForumsDialog.h \
# gui/forums/ForumDetails.h \ # gui/forums/ForumDetails.h \
@ -791,7 +791,6 @@ SOURCES += main.cpp \
gui/common/RSGraphWidget.cpp \ gui/common/RSGraphWidget.cpp \
gui/common/ElidedLabel.cpp \ gui/common/ElidedLabel.cpp \
gui/common/vmessagebox.cpp \ gui/common/vmessagebox.cpp \
gui/common/RsCollectionFile.cpp \
gui/common/RsCollectionDialog.cpp \ gui/common/RsCollectionDialog.cpp \
gui/common/RsUrlHandler.cpp \ gui/common/RsUrlHandler.cpp \
gui/common/rwindow.cpp \ gui/common/rwindow.cpp \
@ -925,7 +924,8 @@ SOURCES += main.cpp \
gui/statistics/RttStatistics.cpp \ gui/statistics/RttStatistics.cpp \
gui/statistics/BWGraph.cpp \ gui/statistics/BWGraph.cpp \
util/RsSyntaxHighlighter.cpp \ util/RsSyntaxHighlighter.cpp \
util/imageutil.cpp util/imageutil.cpp \
gui/common/RsCollectionEditor.cpp
# gui/ForumsDialog.cpp \ # gui/ForumsDialog.cpp \
# gui/forums/ForumDetails.cpp \ # gui/forums/ForumDetails.cpp \