diff --git a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp index bff8885b8..813491423 100644 --- a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.cpp @@ -52,7 +52,8 @@ #include #include #include -#include // Ajouté +#include // Added +#include // Added #include @@ -128,7 +129,7 @@ public: protected: virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { - // 1. Custom Upload Check + // 1. Custom Upload Check (MODIFIED) if (m_uploadedOnly) { // Check column 6 (Uploaded) QModelIndex uploadIdx = sourceModel()->index(source_row, SHARED_FILES_DIALOG_COLUMN_UPLOADED, source_parent); @@ -137,7 +138,6 @@ protected: if (uploadStr.isEmpty() || uploadStr == "-") return false; } - // 2. Default logic (preserves the "filtered" role check used by RetroShare for search/filtering) return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } @@ -155,7 +155,7 @@ protected: private: RetroshareDirModel *m_dirModel; - bool m_uploadedOnly; + bool m_uploadedOnly; // Added member }; // This class allows to draw the item in the share flags column using an appropriate size @@ -197,19 +197,11 @@ SharedFilesDialog::~SharedFilesDialog() } /** Constructor */ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent) - : RsAutoUpdatePage(1000,parent), model(NULL) + : RsAutoUpdatePage(1000,parent), model(NULL), uploadedOnly_CB(NULL) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); - // --- Ajout de la CheckBox --- - uploadedOnly_CB = new QCheckBox(tr("Uploaded only"), this); - uploadedOnly_CB->setToolTip(tr("Show only files and folders that have been uploaded")); - // On l'ajoute au layout horizontal existant qui contient les filtres - ui.horizontalLayout_2->addWidget(uploadedOnly_CB); - connect(uploadedOnly_CB, SIGNAL(toggled(bool)), this, SLOT(filterUploadedOnlyToggled(bool))); - // ---------------------------- - //connect(notify, SIGNAL(filesPreModChanged(bool)), this, SLOT(preModDirectories(bool))); //connect(notify, SIGNAL(filesPostModChanged(bool)), this, SLOT(postModDirectories(bool))); @@ -293,7 +285,8 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent) header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_FILENB , charWidth*15 ); header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_SIZE , charWidth*10 ); header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_AGE , charWidth*6 ); - header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, charWidth*10 ); + // MODIFIED: Reduced column width for Access (from 10 to 4) as requested + header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_FRIEND_ACCESS, charWidth*4 ); header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR , charWidth*20 ); header->resizeSection ( SHARED_FILES_DIALOG_COLUMN_UPLOADED , charWidth*20 ); @@ -326,6 +319,16 @@ SharedFilesDialog::SharedFilesDialog(bool remote_mode, QWidget *parent) LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent) : SharedFilesDialog(false,parent) { + // MODIFIED: Create and insert the checkbox only here (for My files) + uploadedOnly_CB = new QCheckBox(tr("Uploaded only"), this); + uploadedOnly_CB->setToolTip(tr("Show only files and folders that have been uploaded")); + + // Insert immediately after the view selector + int cbIndex = ui.horizontalLayout_2->indexOf(ui.viewType_CB); + ui.horizontalLayout_2->insertWidget(cbIndex + 1, uploadedOnly_CB); + + connect(uploadedOnly_CB, SIGNAL(toggled(bool)), this, SLOT(filterUploadedOnlyToggled(bool))); + // Hide columns after loading the settings ui.dirTreeView->setColumnHidden(SHARED_FILES_DIALOG_COLUMN_WN_VISU_DIR, false) ; ui.downloadButton->hide() ; diff --git a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.h b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.h index 0883fbf54..e79885221 100644 --- a/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.h +++ b/retroshare-gui/src/gui/FileTransfer/SharedFilesDialog.h @@ -29,7 +29,7 @@ #include "util/RsProtectedTimer.h" #include -#include // Ajout pour la checkbox +#include // For the new filter feature class RetroshareDirModel; class QSortFilterProxyModel; @@ -86,7 +86,7 @@ private slots: void updateDirTreeView(); - // Nouveau slot pour le filtre + // Slot for the new checkbox filter void filterUploadedOnlyToggled(bool checked); public slots: @@ -142,7 +142,7 @@ protected: RetroshareDirModel *flat_model; RetroshareDirModel *model; - // Changé le type pour utiliser notre classe personnalisée + // Changed to specific Proxy model type to access new methods SFDSortFilterProxyModel *tree_proxyModel; SFDSortFilterProxyModel *flat_proxyModel; QSortFilterProxyModel *proxyModel; @@ -156,7 +156,7 @@ protected: RsEventsHandlerId_t mEventHandlerId ; - // Nouvelle CheckBox + // New Checkbox member (protected to be accessible by LocalSharedFilesDialog) QCheckBox *uploadedOnly_CB; }; diff --git a/retroshare-gui/src/gui/RemoteDirModel.cpp b/retroshare-gui/src/gui/RemoteDirModel.cpp index 73fc3f9e1..80a0971f1 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.cpp +++ b/retroshare-gui/src/gui/RemoteDirModel.cpp @@ -211,7 +211,7 @@ void TreeStyle_RDM::recalculateDirectoryTotals() } } // DEBUG: Summary - std::cerr << "UPLOAD_DBG: --- Finished Recalc. Processed " << processedFiles << " active files. Map size: " << m_folderUploadTotals.size() << " ---" << std::endl; + // std::cerr << "UPLOAD_DBG: --- Finished Recalc. Processed " << processedFiles << " active files. Map size: " << m_folderUploadTotals.size() << " ---" << std::endl; } void TreeStyle_RDM::update() @@ -381,15 +381,10 @@ int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const return REMOTEDIRMODEL_COLUMN_COUNT; } -QString RetroshareDirModel::getFlagsString(FileStorageFlags flags) +// MODIFIED: Return empty string to hide B, S, N letters +QString RetroshareDirModel::getFlagsString(FileStorageFlags /*flags*/) { - char str[11] = "- - -" ; - - if(flags & DIR_FLAGS_BROWSABLE) str[0] = 'B' ; - if(flags & DIR_FLAGS_ANONYMOUS_SEARCH) str[3] = 'S' ; - if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD) str[6] = 'N' ; - - return QString(str) ; + return QString("") ; } QString RetroshareDirModel::getGroupsString(FileStorageFlags flags,const std::list& group_ids) { @@ -706,13 +701,13 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const auto it = m_folderUploadTotals.find(path); // DEBUG: Display role request - std::cerr << "UPLOAD_DBG: Display Role for DIR. Name: " << details.name - << " | Raw Path: " << details.path - << " | Lookup Key: [" << path.toStdString() << "]" << std::endl; + // std::cerr << "UPLOAD_DBG: Display Role for DIR. Name: " << details.name + // << " | Raw Path: " << details.path + // << " | Lookup Key: [" << path.toStdString() << "]" << std::endl; if(it != m_folderUploadTotals.end() && it.value() > 0) { - std::cerr << "UPLOAD_DBG: -> FOUND! Value: " << it.value() << std::endl; + // std::cerr << "UPLOAD_DBG: -> FOUND! Value: " << it.value() << std::endl; return misc::friendlyUnit(it.value()); } @@ -950,6 +945,15 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const if (role == Qt::ForegroundRole) { + // MODIFIED: Colorize Uploaded column (Directory=Blue, File=Green) + if (coln == REMOTEDIRMODEL_COLUMN_UPLOADED) + { + if (details.type == DIR_TYPE_DIR) + return QColor(Qt::blue); + else if (details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) + return QColor(Qt::darkGreen); + } + if((details.type == DIR_TYPE_FILE || details.type == DIR_TYPE_EXTRA_FILE) && details.hash.isNull()) return QVariant(QColor(Qt::green)) ; else if(ageIndicator != IND_ALWAYS && details.max_mtime + ageIndicator < time(NULL)) diff --git a/retroshare-gui/src/gui/RemoteDirModel.h b/retroshare-gui/src/gui/RemoteDirModel.h index befcb78e0..37d731fee 100644 --- a/retroshare-gui/src/gui/RemoteDirModel.h +++ b/retroshare-gui/src/gui/RemoteDirModel.h @@ -1,4 +1,4 @@ - /******************************************************************************* +/******************************************************************************* * gui/RemoteDirModel.h * * * * Copyright (c) 2006 Retroshare Team * @@ -28,7 +28,7 @@ #include #include #include -#include // Changed from map to QHash for efficiency with QString +#include #include #include @@ -212,7 +212,7 @@ class TreeStyle_RDM: public RetroshareDirModel QAction *_showEmptyAct; bool _showEmpty; - // Helper: Calculate totals using normalized paths + // Helper to calculate total upload per directory void recalculateDirectoryTotals(); QHash m_folderUploadTotals;