diff --git a/retroshare-gui/src/gui/SharedFilesDialog.cpp b/retroshare-gui/src/gui/SharedFilesDialog.cpp index 2fad86bff..c2b7661ba 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/SharedFilesDialog.cpp @@ -149,6 +149,11 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent) connect( localModel, SIGNAL( layoutAboutToBeChanged() ), ui.localDirTreeView, SLOT( reset() ) ); connect( localModel, SIGNAL( layoutChanged() ), ui.localDirTreeView, SLOT( update() ) ); + connect(ui.filterClearButton, SIGNAL(clicked()), this, SLOT(clearFilter())); + connect(ui.filterStartButton, SIGNAL(clicked()), this, SLOT(startFilter())); + connect(ui.filterPatternLineEdit, SIGNAL(returnPressed()), this, SLOT(startFilter())); + connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged())); + /* Set header resize modes and initial section sizes */ QHeaderView * l_header = ui.localDirTreeView->header () ; // l_header->setResizeMode (0, QHeaderView::Interactive); @@ -189,6 +194,13 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent) ui.remoteDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); ui.localDirTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection); +#ifdef RS_RELEASE_VERSION + ui.filterLabel->hide(); + ui.filterPatternLineEdit->hide(); +#endif + ui.filterStartButton->hide(); + ui.filterClearButton->hide(); + // load settings processSettings(true); @@ -631,6 +643,10 @@ void SharedFilesDialog::postModDirectories(bool update_local) { model->postMods(); ui.remoteDirTreeView->update() ; + + if (ui.filterPatternLineEdit->text().isEmpty() == false) { + FilterItems(); + } } QCoreApplication::flush(); @@ -817,3 +833,84 @@ void SharedFilesDialog::indicatorChanged(int index) updateDisplay() ; } +void SharedFilesDialog::filterRegExpChanged() +{ + QString text = ui.filterPatternLineEdit->text(); + + if (text.isEmpty()) { + ui.filterClearButton->hide(); + } else { + ui.filterClearButton->show(); + } + + if (text == lastFilterString) { + ui.filterStartButton->hide(); + } else { + ui.filterStartButton->show(); + } +} + +/* clear Filter */ +void SharedFilesDialog::clearFilter() +{ + ui.filterPatternLineEdit->clear(); + ui.filterPatternLineEdit->setFocus(); + + startFilter(); +} + +/* clear Filter */ +void SharedFilesDialog::startFilter() +{ + ui.filterStartButton->hide(); + lastFilterString = ui.filterPatternLineEdit->text(); + + FilterItems(); +} + +void SharedFilesDialog::FilterItems() +{ + QString text = ui.filterPatternLineEdit->text(); + + setCursor(Qt::WaitCursor); + + int rowCount = ui.remoteDirTreeView->model()->rowCount(); + for (int row = 0; row < rowCount; row++) { + /* Filter name */ + FilterItem(ui.remoteDirTreeView->model()->index(row, 0), text, 0); + } + + setCursor(Qt::ArrowCursor); +} + +bool SharedFilesDialog::FilterItem(const QModelIndex &index, const QString &text, int level) +{ + bool visible = true; + + if (text.isEmpty() == false) { + // better use RemoteDirModel::getType, but its slow enough + if (/*index.parent().isValid()*/ level >= 1) { + if (index.data(RemoteDirModel::FileNameRole).toString().contains(text, Qt::CaseInsensitive) == false) { + visible = false; + } + } else { + visible = false; + } + } + + int visibleChildCount = 0; + int rowCount = ui.remoteDirTreeView->model()->rowCount(index); + for (int row = 0; row < rowCount; row++) { + if (FilterItem(ui.remoteDirTreeView->model()->index(row, index.column(), index), text, level + 1)) { + visibleChildCount++; + } + } + + if (visible || visibleChildCount) { + ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), false); + } else { + ui.remoteDirTreeView->setRowHidden(index.row(), index.parent(), true); + } + + return (visible || visibleChildCount); +} diff --git a/retroshare-gui/src/gui/SharedFilesDialog.h b/retroshare-gui/src/gui/SharedFilesDialog.h index 24ed611b5..e1e92974a 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.h +++ b/retroshare-gui/src/gui/SharedFilesDialog.h @@ -83,6 +83,10 @@ private slots: void indicatorChanged(int index); + void filterRegExpChanged(); + void clearFilter(); + void startFilter(); + signals: void playFiles(QStringList files); @@ -96,7 +100,10 @@ private: void processSettings(bool bLoad); - void copyLink (const QModelIndexList& lst, bool remote); + void copyLink (const QModelIndexList& lst, bool remote); + + void FilterItems(); + bool FilterItem(const QModelIndex &index, const QString &text, int level); QModelIndexList getRemoteSelected(); QModelIndexList getLocalSelected(); @@ -115,7 +122,6 @@ private: QAction* sendchatlinkAct; QAction* copylinklocalhtmlAct; - /** Qt Designer generated object */ Ui::SharedFilesDialog ui; @@ -128,6 +134,8 @@ private: QString currentCommand; QString currentFile; + QString lastFilterString; + QAction* fileAssotiationAction(const QString fileName); }; diff --git a/retroshare-gui/src/gui/SharedFilesDialog.ui b/retroshare-gui/src/gui/SharedFilesDialog.ui index fa04dc45f..8702747dd 100644 --- a/retroshare-gui/src/gui/SharedFilesDialog.ui +++ b/retroshare-gui/src/gui/SharedFilesDialog.ui @@ -1,889 +1,986 @@ - - - SharedFilesDialog - - - - 0 - 0 - 525 - 297 - - - - - 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 - - - - - - - - Qt::NoContextMenu - - - - 0 - - - - - - 0 - 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;} - - - - 2 - - - 6 - - - - - - 24 - 24 - - - - - - - :/images/fileshare24.png - - - true - - - - - - - - 16777215 - 16 - - - - - Arial - 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:11pt; 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-family:'MS Shell Dlg 2'; font-weight:600;">Files</span></p></body></html> - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 100 - 20 - - - - - - - - - 24 - 24 - - - - Splitted View - - - - - - - :/images/view_split_top_bottom.png:/images/view_split_top_bottom.png - - - true - - - true - - - true - - - - - - - - 24 - 24 - - - - Friends Folders - - - - - - - :/images/friendsfolder24.png:/images/friendsfolder24.png - - - true - - - false - - - true - - - - - - - - 24 - 24 - - - - My Folders - - - - - - - :/images/folder16.png:/images/folder16.png - - - true - - - false - - - true - - - - - - - - All - - - - :/images/view_calendar_list.png:/images/view_calendar_list.png - - - - - One day old - - - - :/images/view_calendar_day.png:/images/view_calendar_day.png - - - - - One Week old - - - - :/images/view_calendar_week.png:/images/view_calendar_week.png - - - - - One month old - - - - :/images/view_calendar_month.png:/images/view_calendar_month.png - - - - - - - - - - - - - - Qt::Vertical - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - - - - 4 - 0 - - - - Qt::CustomContextMenu - - - #remoteDirTreeView{border: 1px solid #CCCCCC; -background: white;} - - - true - - - QAbstractItemView::DragOnly - - - false - - - 0 - - - true - - - true - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - false - - - #localDirTreeView{border: 1px solid #CCCCCC; -background: white;} - - - true - - - QAbstractItemView::DragOnly - - - false - - - QAbstractItemView::ContiguousSelection - - - true - - - - - - - - - - - 2 - - - - - - 140 - 0 - - - - - 16777215 - 28 - - - - Download selected - - - Download - - - - :/images/download16.png:/images/download16.png - - - - - - - Qt::Horizontal - - - - 391 - 20 - - - - - - - - check files - - - - - - - - - - - - - - - - - - - + + + SharedFilesDialog + + + + 0 + 0 + 525 + 297 + + + + + 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 + + + + + + + + Qt::NoContextMenu + + + + 0 + + + + + + 0 + 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;} + + + + 2 + + + 6 + + + + + + 24 + 24 + + + + + + + :/images/fileshare24.png + + + true + + + + + + + + 16777215 + 16 + + + + + Arial + 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:11pt; 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-family:'MS Shell Dlg 2'; font-weight:600;">Files</span></p></body></html> + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 100 + 20 + + + + + + + + + 24 + 24 + + + + Splitted View + + + + + + + :/images/view_split_top_bottom.png:/images/view_split_top_bottom.png + + + true + + + true + + + true + + + + + + + + 24 + 24 + + + + Friends Folders + + + + + + + :/images/friendsfolder24.png:/images/friendsfolder24.png + + + true + + + false + + + true + + + + + + + + 24 + 24 + + + + My Folders + + + + + + + :/images/folder16.png:/images/folder16.png + + + true + + + false + + + true + + + + + + + + All + + + + :/images/view_calendar_list.png:/images/view_calendar_list.png + + + + + One day old + + + + :/images/view_calendar_day.png:/images/view_calendar_day.png + + + + + One Week old + + + + :/images/view_calendar_week.png:/images/view_calendar_week.png + + + + + One month old + + + + :/images/view_calendar_month.png:/images/view_calendar_month.png + + + + + + + + 2 + + + + + + + + :/images/find-16.png + + + + + + + Search files + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + MS Shell Dlg 2 + + + + Start Search + + + QPushButton +{ + border-image: url(:/images/start.png) +} + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + MS Shell Dlg 2 + + + + Reset + + + QPushButton +{ + border-image: url(:/images/closenormal.png) +} + +QPushButton:hover +{ +border-image: url(:/images/closehover.png) +} + +QPushButton:pressed { +border-image: url(:/images/closepressed.png) +} + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + + 4 + 0 + + + + Qt::CustomContextMenu + + + #remoteDirTreeView{border: 1px solid #CCCCCC; +background: white;} + + + true + + + QAbstractItemView::DragOnly + + + false + + + 0 + + + true + + + true + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + + 0 + 0 + + + + Qt::CustomContextMenu + + + false + + + #localDirTreeView{border: 1px solid #CCCCCC; +background: white;} + + + true + + + QAbstractItemView::DragOnly + + + false + + + QAbstractItemView::ContiguousSelection + + + true + + + + + + + + + + + 2 + + + + + + 140 + 0 + + + + + 16777215 + 28 + + + + Download selected + + + Download + + + + :/images/download16.png:/images/download16.png + + + + + + + Qt::Horizontal + + + + 391 + 20 + + + + + + + + check files + + + + + + + + + + + + + + + + + + + diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index 5bc62d001..6b459f1c4 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 d02f85669..a9fd21015 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -2290,7 +2290,7 @@ p, li { white-space: pre-wrap; } Zusätzlich eine Datei hinzufügen - + RetroShare @@ -8329,7 +8329,7 @@ Do you want to send them a Message instead ProfileView - + Clear Photo Photo entfernen @@ -9981,13 +9981,13 @@ p, li { white-space: pre-wrap; } SharedFilesDialog - - + + Download Herunterladen - + Splitted View Geteiltes Fenster @@ -10035,28 +10035,43 @@ p, li { white-space: pre-wrap; } Einen Monat alt - + + Search files + Suche Dateien + + + + Start Search + Starte Suche + + + + Reset + Zurücksetzen + + + check files Prüfe Dateien - + Open File Datei öffnen - + Open Folder Ordner öffnen - + Set command for opening this file Setze eine Regel zum Öffnen dieser Datei - + Copy retroshare Link Kopiere RetroShare Link @@ -10107,12 +10122,12 @@ p, li { white-space: pre-wrap; } - + Recommend in a message to Empfehle in einer Nachricht an - + RetroShare Link @@ -10127,7 +10142,7 @@ p, li { white-space: pre-wrap; } Empfehlung(en) - + <strong>My Shared Files</strong> <strong>Meine Dateien</strong> @@ -10672,7 +10687,7 @@ p, li { white-space: pre-wrap; } - + Play File Datei abspielen