diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 9935e9aee..7e1cb1482 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -335,6 +335,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) /** StatusBar section ********/ /* initialize combobox in status bar */ statusComboBox = new QComboBox(statusBar()); + statusComboBox->setFocusPolicy(Qt::ClickFocus); initializeStatusObject(statusComboBox, true); QWidget *widget = new QWidget(); diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index 439fdc1b9..4bfbc3a9f 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -916,19 +916,10 @@ void RetroshareDirModel::createCollectionFile(const QModelIndexList &list) return ; } - QString filename ; - - if(!misc::getSaveFileName(NULL,RshareSettings::LASTDIR_EXTRAFILE,tr("Create selection file"),tr("Collection files")+" (*."+RsCollectionFile::ExtensionString+")",filename)) - return ; - - if(!filename.endsWith("."+RsCollectionFile::ExtensionString)) - filename += "."+RsCollectionFile::ExtensionString ; - - std::cerr << "Got file name: "<< filename.toStdString() << std::endl; std::vector dirVec; getDirDetailsFromSelect(list, dirVec); - RsCollectionFile(dirVec).save(filename) ; + RsCollectionFile(dirVec).save(); } void RetroshareDirModel::downloadSelected(const QModelIndexList &list) diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index b6aaacdb1..1479a679a 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -44,11 +44,12 @@ #include "TurtleRouterStatistics.h" #include "xprogressbar.h" #include "settings/rsharesettings.h" +#include "util/misc.h" +#include "common/RsCollectionFile.h" #include #include #include -#include "util/misc.h" /**** * #define SHOW_RTT_STATISTICS 1 @@ -322,6 +323,7 @@ TransfersDialog::TransfersDialog(QWidget *parent) #endif QObject::connect(ui._showCacheTransfers_CB,SIGNAL(toggled(bool)),this,SLOT(insertTransfers())) ; + QObject::connect(ui.openCollection, SIGNAL(clicked()), this, SLOT(openCollection())); // Actions. Only need to be defined once. pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this); @@ -1690,3 +1692,11 @@ QString TransfersDialog::getSources(int row, QStandardItemModel *model) { return model->data(model->index(row, SOURCES), Qt::DisplayRole).toString(); } + +void TransfersDialog::openCollection() +{ + RsCollectionFile Collection; + if (Collection.load()) { + Collection.downloadFiles(); + } +} diff --git a/retroshare-gui/src/gui/TransfersDialog.h b/retroshare-gui/src/gui/TransfersDialog.h index b42611234..91cffce8d 100644 --- a/retroshare-gui/src/gui/TransfersDialog.h +++ b/retroshare-gui/src/gui/TransfersDialog.h @@ -101,6 +101,8 @@ private slots: void showDetailsDialog(); void updateDetailsDialog(); + void openCollection(); + signals: void playFiles(QStringList files); diff --git a/retroshare-gui/src/gui/TransfersDialog.ui b/retroshare-gui/src/gui/TransfersDialog.ui index 7fc5884cd..275ecf37e 100644 --- a/retroshare-gui/src/gui/TransfersDialog.ui +++ b/retroshare-gui/src/gui/TransfersDialog.ui @@ -1,835 +1,848 @@ - - - TransfersDialog - - - - 0 - 0 - 620 - 353 - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 0 - 0 - 0 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 192 - 192 - 192 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - 104 - 104 - 104 - - - - - - - 208 - 208 - 208 - - - - - - - 255 - 255 - 255 - - - - - - - 247 - 247 - 247 - - - - - - - 104 - 104 - 104 - - - - - - - 139 - 139 - 139 - - - - - - - 104 - 104 - 104 - - - - - - - 255 - 255 - 255 - - - - - - - 104 - 104 - 104 - - - - - - - 240 - 240 - 240 - - - - - - - 240 - 240 - 240 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 0 - 128 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 255 - - - - - - - 255 - 0 - 255 - - - - - - - 231 - 231 - 231 - - - - - - - - - Arial - 8 - 50 - false - false - false - false - - - - true - - - Qt::PreventContextMenu - - - - - - Qt::Vertical - - - - - 0 - - - - - - 0 - 32 - - - - - 16777215 - 32 - - - - QFrame#frame{ -background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, -stop:0 #FEFEFE, stop:1 #E8E8E8); - -border: 1px solid #CCCCCC;} - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 2 - - - - - 0 - - - 6 - - - - - - - - :/images/down.png - - - - - - - - 10 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Downloads:</span></p></body></html> - - - - - - - - - Qt::Horizontal - - - - 483 - 20 - - - - - - - - Show cache transfers - - - - - - - - - - - Arial - 9 - - - - true - - - Qt::CustomContextMenu - - - false - - - 0 - - - QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked - - - false - - - false - - - false - - - QAbstractItemView::NoDragDrop - - - false - - - true - - - true - - - false - - - true - - - false - - - - - - - - - 75 - true - - - - 1 - - - - - :/images/up.png:/images/up.png - - - Uploads - - - - 0 - - - 0 - - - - - - Arial - 9 - - - - true - - - - - - - - - :/images/blockdevice.png:/images/blockdevice.png - - - Selected transfer - - - - 0 - - - 6 - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 598 - 99 - - - - - - - - - 6 - - - - - - - - - - :/images/graph-downloaded.png - - - - - - - Done - - - - - - - - - - - - - - :/images/graph-downloading.png - - - - - - - Active - - - - - - - - - - - - - - :/images/graph-notdownload.png - - - - - - - Outstanding - - - - - - - - - Qt::Horizontal - - - - 368 - 13 - - - - - - - - - - - - - - - - - - + + + TransfersDialog + + + + 0 + 0 + 620 + 353 + + + + + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 0 + 0 + 0 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 192 + 192 + 192 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + 104 + 104 + 104 + + + + + + + 208 + 208 + 208 + + + + + + + 255 + 255 + 255 + + + + + + + 247 + 247 + 247 + + + + + + + 104 + 104 + 104 + + + + + + + 139 + 139 + 139 + + + + + + + 104 + 104 + 104 + + + + + + + 255 + 255 + 255 + + + + + + + 104 + 104 + 104 + + + + + + + 240 + 240 + 240 + + + + + + + 240 + 240 + 240 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 0 + 128 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 255 + + + + + + + 255 + 0 + 255 + + + + + + + 231 + 231 + 231 + + + + + + + + + Arial + 8 + 50 + false + false + false + false + + + + true + + + Qt::PreventContextMenu + + + + + + Qt::Vertical + + + + + 0 + + + + + + 0 + 32 + + + + + 16777215 + 32 + + + + QFrame#frame{ +background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, +stop:0 #FEFEFE, stop:1 #E8E8E8); + +border: 1px solid #CCCCCC;} + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 2 + + + + + 0 + + + 6 + + + + + + + + :/images/down.png + + + + + + + + 10 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Arial'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Downloads:</span></p></body></html> + + + + + + + + + Qt::Horizontal + + + + 483 + 20 + + + + + + + + Qt::NoFocus + + + Open Collection + + + + + + + Qt::ClickFocus + + + Show cache transfers + + + + + + + + + + + Arial + 9 + + + + true + + + Qt::CustomContextMenu + + + false + + + 0 + + + QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + false + + + false + + + false + + + QAbstractItemView::NoDragDrop + + + false + + + true + + + true + + + false + + + true + + + false + + + + + + + + + 75 + true + + + + 1 + + + + + :/images/up.png:/images/up.png + + + Uploads + + + + 0 + + + 0 + + + + + + Arial + 9 + + + + true + + + + + + + + + :/images/blockdevice.png:/images/blockdevice.png + + + Selected transfer + + + + 0 + + + 6 + + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 596 + 101 + + + + + + + + + 6 + + + + + + + + + + :/images/graph-downloaded.png + + + + + + + Done + + + + + + + + + + + + + + :/images/graph-downloading.png + + + + + + + Active + + + + + + + + + + + + + + :/images/graph-notdownload.png + + + + + + + Outstanding + + + + + + + + + Qt::Horizontal + + + + 368 + 13 + + + + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/gui/common/RsCollectionFile.cpp b/retroshare-gui/src/gui/common/RsCollectionFile.cpp index b2b95c730..1a2e1b42e 100644 --- a/retroshare-gui/src/gui/common/RsCollectionFile.cpp +++ b/retroshare-gui/src/gui/common/RsCollectionFile.cpp @@ -26,33 +26,22 @@ #include "RsCollectionFile.h" #include "RsCollectionDialog.h" +#include "util/misc.h" #include #include #include -#include #include #include #include +#include +#include const QString RsCollectionFile::ExtensionString = QString("rscollection") ; -RsCollectionFile::RsCollectionFile(const QString& filename) - : _xml_doc("RsCollection"),_filename(filename) +RsCollectionFile::RsCollectionFile() + : _xml_doc("RsCollection") { - QFile file(filename); - - if (!file.open(QIODevice::ReadOnly)) - { - std::cerr << "Cannot open file " << filename.toStdString() << " !!" << std::endl; - return; - } - - bool ok = _xml_doc.setContent(&file) ; - file.close(); - - if(!ok) - throw std::runtime_error("Error parsing xml file") ; } void RsCollectionFile::downloadFiles() const @@ -143,14 +132,55 @@ RsCollectionFile::RsCollectionFile(const std::vector& file_infos) recursAddElements(_xml_doc,file_infos[i],root) ; } -void RsCollectionFile::save(const QString& filename) const +static void showError(const QString& filename, const QString& error) +{ + QMessageBox mb(QMessageBox::Warning, QObject::tr("Treatment of collection file has failed"), QObject::tr("The collection file %1 could not be openned.\nReported error is: %2").arg(filename).arg(error), QMessageBox::Ok); + mb.setWindowIcon(QIcon(":/images/rstray3.png")); + mb.exec(); +} + +bool RsCollectionFile::load(const QString& filename) +{ + QFile file(filename); + + if (!file.open(QIODevice::ReadOnly)) + { + std::cerr << "Cannot open file " << filename.toStdString() << " !!" << std::endl; + showError(filename, QApplication::translate("RsCollectionFile", "Cannot open file %1").arg(filename)); + return false; + } + + bool ok = _xml_doc.setContent(&file) ; + file.close(); + + if (ok) { + _filename = filename; + } else { + showError(filename, QApplication::translate("RsCollectionFile", "Error parsing xml file")); + } + + return ok; +} + +bool RsCollectionFile::load() +{ + QString filename; + if (!misc::getOpenFileName(NULL, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Open collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename)) + return false; + + std::cerr << "Got file name: " << filename.toStdString() << std::endl; + + return load(filename); +} + +bool RsCollectionFile::save(const QString& filename) const { QFile file(filename); if (!file.open(QIODevice::WriteOnly)) { std::cerr << "Cannot write to file " << filename.toStdString() << " !!" << std::endl; - return; + return false; } QTextStream stream(&file) ; @@ -158,5 +188,20 @@ void RsCollectionFile::save(const QString& filename) const stream << _xml_doc.toString() ; file.close(); + + return true; } +bool RsCollectionFile::save() const +{ + QString filename; + if(!misc::getSaveFileName(NULL, RshareSettings::LASTDIR_EXTRAFILE, QApplication::translate("RsCollectionFile", "Create collection file"), QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollectionFile::ExtensionString + ")", filename)) + return false; + + if (!filename.endsWith("." + RsCollectionFile::ExtensionString)) + filename += "." + RsCollectionFile::ExtensionString ; + + std::cerr << "Got file name: " << filename.toStdString() << std::endl; + + return save(filename); +} diff --git a/retroshare-gui/src/gui/common/RsCollectionFile.h b/retroshare-gui/src/gui/common/RsCollectionFile.h index 2923ef6f6..70f0ada69 100644 --- a/retroshare-gui/src/gui/common/RsCollectionFile.h +++ b/retroshare-gui/src/gui/common/RsCollectionFile.h @@ -40,14 +40,18 @@ class RsCollectionFile public: static const QString ExtensionString ; - // Loads file from disk. - RsCollectionFile(const QString& filename) ; + RsCollectionFile() ; // create from list of files and directories RsCollectionFile(const std::vector& file_entries) ; + // Loads file from disk. + bool load(); + bool load(const QString& filename); + // Save to disk - void save(const QString& filename) const ; + bool save() const ; + bool save(const QString& filename) const ; // Download the content. void downloadFiles() const ; diff --git a/retroshare-gui/src/gui/common/RsUrlHandler.cpp b/retroshare-gui/src/gui/common/RsUrlHandler.cpp index c397982a9..5b200b859 100644 --- a/retroshare-gui/src/gui/common/RsUrlHandler.cpp +++ b/retroshare-gui/src/gui/common/RsUrlHandler.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include "RsCollectionFile.h" #include "RsUrlHandler.h" @@ -30,14 +29,9 @@ bool RsUrlHandler::openUrl(const QUrl& url) { if(url.scheme() == QString("file") && url.toLocalFile().endsWith("."+RsCollectionFile::ExtensionString)) { - try - { - RsCollectionFile(url.toLocalFile().toUtf8().constData()).downloadFiles() ; - } - catch(std::runtime_error& e) - { - QMessageBox::warning(NULL,QObject::tr("Treatment of collection file has failed."),QObject::tr("The collection file ") + url.toLocalFile() + QObject::tr(" could not be openned. Reported error is: ") + QString::fromStdString(e.what())) ; - return false ; + RsCollectionFile Collection; + if (Collection.load(url.toLocalFile().toUtf8().constData())) { + Collection.downloadFiles() ; } return true; } diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index 3bb4ef005..f28436e78 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index 5919c76aa..b31a317e2 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -6135,7 +6135,7 @@ Die folgenden Wege sind möglich: - + Notify Meldungen @@ -6265,7 +6265,7 @@ Die folgenden Wege sind möglich: Schnellstart Assistent - + Search Suchen @@ -6280,7 +6280,7 @@ Die folgenden Wege sind möglich: Messenger - + Show/Hide Anzeigen/Verbergen @@ -6331,7 +6331,7 @@ Die folgenden Wege sind möglich: Maximieren - + Unfinished unfertig @@ -6341,7 +6341,7 @@ Die folgenden Wege sind möglich: - + Help Hilfe @@ -6351,7 +6351,7 @@ Die folgenden Wege sind möglich: Über - + Forums Foren @@ -6361,7 +6361,7 @@ Die folgenden Wege sind möglich: RetroShare %1 eine sichere und dezentralisierte Kommunikationsplattform - + Open Messages Öffne Nachrichten @@ -6371,12 +6371,12 @@ Die folgenden Wege sind möglich: Anwendungen - + Plugins - + Do you really want to exit RetroShare ? Möchtest du RetroShare wirklich beenden? @@ -10052,18 +10052,14 @@ Lockdatei: - - Treatment of collection file has failed. + + Treatment of collection file has failed - The collection file - - - - - could not be openned. Reported error is: + The collection file %1 could not be openned. +Reported error is: %2 @@ -10463,14 +10459,12 @@ p, li { white-space: pre-wrap; } NEU - Create selection file - Erstelle Kollektion + Erstelle Kollektion - Collection files - Kollektion + Kollektion @@ -10531,6 +10525,35 @@ p, li { white-space: pre-wrap; } Herunterladen + + RsCollectionFile + + + Cannot open file %1 + Kann Datei %1 nicht öffnen + + + + Error parsing xml file + Fehler beim Parsen des XML + + + + Open collection file + Öffne Kollektion + + + + + Collection files + Kollektion + + + + Create collection file + Kollektion erstellen + + Rshare @@ -11833,7 +11856,7 @@ p, li { white-space: pre-wrap; } Lade Konfiguration - + Create interface Erstelle Oberfläche @@ -12720,7 +12743,7 @@ p, li { white-space: pre-wrap; } TransfersDialog - + Cancel Abbrechen @@ -12730,7 +12753,7 @@ p, li { white-space: pre-wrap; } Fertige ausblenden - + Status Status @@ -12754,7 +12777,12 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Downloads:</span></p></body></html> - + + Open Collection + Öffne Kollektion + + + Show cache transfers Zeige Cache Übertragungen @@ -12838,7 +12866,7 @@ p, li { white-space: pre-wrap; } Übertragen - + Play Abspielen @@ -12963,7 +12991,7 @@ p, li { white-space: pre-wrap; } Soll dieser Download wirklich abgebrochen und gelöscht werden? - + Speed / Queue position Geschwindigkeits- / Warteschlangenposition @@ -13005,7 +13033,7 @@ p, li { white-space: pre-wrap; } - + Copy RetroShare Link Kopiere RetroShare Link @@ -13100,7 +13128,7 @@ p, li { white-space: pre-wrap; } TreeStyle_RDM - + My files Meine Dateien