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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@
#include "msgs/MessageComposer.h"
#include "util/misc.h"
#include "common/PeerDefs.h"
#include "common/RsCollectionFile.h"
#include "common/RsCollectionEditor.h"
#include <gui/common/RsUrlHandler.h>
#include "gui/connect/ConnectFriendWizard.h"
#include "gui/connect/ConfCertDialog.h"
@ -972,10 +972,10 @@ QString RetroShareLink::toHtmlSize() const
{
QString size = QString("(%1)").arg(misc::friendlyUnit(_size));
if (type() == TYPE_FILE && RsCollectionFile::isCollectionFile(name())) {
if (type() == TYPE_FILE && RsCollectionEditor::isCollectionFile(name())) {
FileInfo 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)) {
size += QString(" [%1]").arg(misc::friendlyUnit(collection.size()));
}

View File

@ -23,7 +23,7 @@
#include <QFileInfo>
#include "FilesDefs.h"
#include "RsCollectionFile.h"
#include "RsCollectionEditor.h"
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");
} else if (ext == "pdf") {
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");
} else if (ext == "sub" || ext == "srt") {
return image ? ":/images/FileTypeAny.png" : QApplication::translate("FilesDefs", "Subtitles");

View File

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

View File

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

View File

@ -24,7 +24,7 @@
#include <stdexcept>
#include <retroshare/rsfiles.h>
#include "RsCollectionFile.h"
#include "RsCollectionEditor.h"
#include "RsCollectionDialog.h"
#include "util/misc.h"
@ -36,14 +36,14 @@
#include <QMessageBox>
#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")
{
}
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")
{
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) ;
}
RsCollectionFile::~RsCollectionFile()
RsCollectionEditor::~RsCollectionEditor()
{
}
void RsCollectionFile::downloadFiles() const
void RsCollectionEditor::downloadFiles() const
{
// print out the element names of all elements that are direct children
// of the outermost element.
@ -87,7 +87,7 @@ static QString purifyFileName(const QString& input,bool& bad)
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() ;
@ -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)
{
@ -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)
{
@ -208,7 +208,7 @@ static void showErrorBox(const QString& fileName, const QString& error)
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;
@ -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
bool RsCollectionFile::checkFile(const QString& fileName, bool showError)
bool RsCollectionEditor::checkFile(const QString& fileName, bool showError)
{
QFile file(fileName);
@ -306,10 +306,10 @@ bool RsCollectionFile::checkFile(const QString& fileName, bool showError)
return false;
}
bool RsCollectionFile::load(QWidget *parent)
bool RsCollectionEditor::load(QWidget *parent)
{
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;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -317,7 +317,7 @@ bool RsCollectionFile::load(QWidget *parent)
return load(fileName, true);
}
bool RsCollectionFile::save(const QString& fileName) const
bool RsCollectionEditor::save(const QString& fileName) const
{
QFile file(fileName);
@ -337,14 +337,14 @@ bool RsCollectionFile::save(const QString& fileName) const
return true;
}
bool RsCollectionFile::save(QWidget *parent) const
bool RsCollectionEditor::save(QWidget *parent) const
{
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;
if (!fileName.endsWith("." + RsCollectionFile::ExtensionString))
fileName += "." + RsCollectionFile::ExtensionString ;
if (!fileName.endsWith("." + RsCollectionEditor::ExtensionString))
fileName += "." + RsCollectionEditor::ExtensionString ;
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;
if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE
, QApplication::translate("RsCollectionFile", "Create collection file")
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")"
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionEditor::ExtensionString + ")"
, fileName,0, QFileDialog::DontConfirmOverwrite))
return false;
if (!fileName.endsWith("." + RsCollectionFile::ExtensionString))
fileName += "." + RsCollectionFile::ExtensionString ;
if (!fileName.endsWith("." + RsCollectionEditor::ExtensionString))
fileName += "." + RsCollectionEditor::ExtensionString ;
std::cerr << "Got file name: " << fileName.toStdString() << std::endl;
@ -419,7 +419,7 @@ bool RsCollectionFile::openNewColl(QWidget *parent)
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)) {
std::vector<ColFileInfo> colFileInfos ;
@ -437,7 +437,7 @@ bool RsCollectionFile::openColl(const QString& fileName, bool readOnly /* = fals
return false;
}
qulonglong RsCollectionFile::size()
qulonglong RsCollectionEditor::size()
{
QDomElement docElem = _xml_doc.documentElement();
@ -453,14 +453,14 @@ qulonglong RsCollectionFile::size()
return size;
}
bool RsCollectionFile::isCollectionFile(const QString &fileName)
bool RsCollectionEditor::isCollectionFile(const QString &fileName)
{
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();

View File

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

View File

@ -22,14 +22,14 @@
#include <stdexcept>
#include <QDesktopServices>
#include <QUrl>
#include "RsCollectionFile.h"
#include "RsCollectionEditor.h"
#include "RsUrlHandler.h"
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()))
{
collection.downloadFiles() ;

View File

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