This commit is contained in:
csoler 2018-02-20 20:26:33 +01:00
commit c897962678
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
7 changed files with 259 additions and 204 deletions

View File

@ -1,6 +1,6 @@
##Compilation on Windows ## Compilation on Windows
###Qt Installation ### Qt Installation
Install Qt via: [Qt Download](http://www.qt.io/download/) Install Qt via: [Qt Download](http://www.qt.io/download/)
@ -12,7 +12,7 @@ Add to the PATH environment variable
Depends on wich version of Qt you use. Depends on wich version of Qt you use.
Change build-all-mingw32make.bat with these values too if you don't use MSys2. Change build-all-mingw32make.bat with these values too if you don't use MSys2.
###MSYS2 INSTALLATION ### MSYS2 INSTALLATION
Choose your MSYS2 installer here: [MSYS2](http://msys2.github.io/) Choose your MSYS2 installer here: [MSYS2](http://msys2.github.io/)
@ -33,7 +33,7 @@ Choose only w64-i686 if you want only compilation in 32b architecture.
pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
###Install other binutils: ### Install other binutils:
pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc pacman -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc
pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3 pacman -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3
pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex pacman -S mingw-w64-i686-speex mingw-w64-x86_64-speex
@ -49,7 +49,7 @@ Add MSYS2 to PATH environment variable depends your windows
;C:\msys32\mingw32\bin ;C:\msys32\mingw32\bin
###Git Installation ### Git Installation
Install Git Gui or other client: [Git Scm](https://git-scm.com/download/win) Install Git Gui or other client: [Git Scm](https://git-scm.com/download/win)
@ -63,7 +63,7 @@ Paste this text on git console:
git clone https://github.com/RetroShare/RetroShare.git git clone https://github.com/RetroShare/RetroShare.git
###Last Settings ### Last Settings
In QtCreator Option Git add its path: *C:\Program Files\Git\bin* In QtCreator Option Git add its path: *C:\Program Files\Git\bin*
@ -75,7 +75,7 @@ Move to build_scripts:
cd /c/Development/GIT/RetroShare/msys2_build_libs/ cd /c/Development/GIT/RetroShare/msys2_build_libs/
###Compile missing library ### Compile missing library
make make
You can now compile RS into Qt Creator You can now compile RS into Qt Creator

View File

@ -19,39 +19,39 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <set> #include "SharedFilesDialog.h"
#include <QString>
#include <QTreeView>
#include <QClipboard>
#include <QMenu>
#include <QPainter>
#include <QProcess>
#include <QMessageBox>
#include <QSortFilterProxyModel>
#include <QStyledItemDelegate>
#include "rshare.h" #include "rshare.h"
#include "SharedFilesDialog.h"
#include "gui/notifyqt.h"
#include "gui/MainWindow.h" #include "gui/MainWindow.h"
#include "gui/notifyqt.h"
#include "gui/RemoteDirModel.h" #include "gui/RemoteDirModel.h"
#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/RsCollection.h" #include "gui/common/RsCollection.h"
#include "gui/msgs/MessageComposer.h" #include "gui/msgs/MessageComposer.h"
#include "gui/settings/AddFileAssociationDialog.h"
#include "gui/gxschannels/GxsChannelDialog.h" #include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/gxsforums/GxsForumsDialog.h" #include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/settings/AddFileAssociationDialog.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h" #include "util/QtVersion.h"
#include "util/RsAction.h" #include "util/RsAction.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rsexpr.h> #include <retroshare/rsexpr.h>
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
#include <QClipboard>
#include <QMenu>
#include <QMessageBox>
#include <QPainter>
#include <QProcess>
#include <QSortFilterProxyModel>
#include <QString>
#include <QStyledItemDelegate>
#include <QTreeView>
#include <set>
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_DOWNLOAD ":/images/download16.png" #define IMAGE_DOWNLOAD ":/images/download16.png"
@ -75,14 +75,6 @@
#define IMAGE_EDITSHARE ":/images/edit_16.png" #define IMAGE_EDITSHARE ":/images/edit_16.png"
#define IMAGE_MYFILES ":/icons/svg/folders1.svg" #define IMAGE_MYFILES ":/icons/svg/folders1.svg"
/*define dirTreeView Column */
#define COLUMN_NAME 0
#define COLUMN_SIZE 1
#define COLUMN_AGE 2
#define COLUMN_FRIEND 3
#define COLUMN_DIR 4
#define COLUMN_COUNT 5
/*define viewType_CB value */ /*define viewType_CB value */
#define VIEW_TYPE_TREE 0 #define VIEW_TYPE_TREE 0
#define VIEW_TYPE_FLAT 1 #define VIEW_TYPE_FLAT 1
@ -199,10 +191,11 @@ SharedFilesDialog::SharedFilesDialog(RetroshareDirModel *_tree_model,RetroshareD
QHeaderView * header = ui.dirTreeView->header () ; QHeaderView * header = ui.dirTreeView->header () ;
header->resizeSection ( COLUMN_NAME, 490 ); header->resizeSection ( COLUMN_NAME, 490 );
header->resizeSection ( COLUMN_SIZE, 70 ); header->resizeSection ( COLUMN_FILENB, 70 );
header->resizeSection ( COLUMN_AGE, 100 ); header->resizeSection ( COLUMN_SIZE, 70 );
header->resizeSection ( COLUMN_FRIEND,100); header->resizeSection ( COLUMN_AGE, 100 );
header->resizeSection ( COLUMN_DIR, 100 ); header->resizeSection ( COLUMN_FRIEND_ACCESS,100);
header->resizeSection ( COLUMN_WN_VISU_DIR, 100 );
header->setStretchLastSection(false); header->setStretchLastSection(false);
@ -231,7 +224,7 @@ LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
: SharedFilesDialog(new TreeStyle_RDM(false),new FlatStyle_RDM(false),parent) : SharedFilesDialog(new TreeStyle_RDM(false),new FlatStyle_RDM(false),parent)
{ {
// Hide columns after loading the settings // Hide columns after loading the settings
ui.dirTreeView->setColumnHidden(COLUMN_DIR, false) ; ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
ui.downloadButton->hide() ; ui.downloadButton->hide() ;
// load settings // load settings
@ -250,14 +243,14 @@ LocalSharedFilesDialog::LocalSharedFilesDialog(QWidget *parent)
ui.titleBarPixmap->setPixmap(QPixmap(IMAGE_MYFILES)) ; ui.titleBarPixmap->setPixmap(QPixmap(IMAGE_MYFILES)) ;
ui.dirTreeView->setItemDelegateForColumn(COLUMN_FRIEND,new ShareFlagsItemDelegate()) ; ui.dirTreeView->setItemDelegateForColumn(COLUMN_FRIEND_ACCESS,new ShareFlagsItemDelegate()) ;
} }
RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent) RemoteSharedFilesDialog::RemoteSharedFilesDialog(QWidget *parent)
: SharedFilesDialog(new TreeStyle_RDM(true),new FlatStyle_RDM(true),parent) : SharedFilesDialog(new TreeStyle_RDM(true),new FlatStyle_RDM(true),parent)
{ {
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, false) ;
ui.dirTreeView->setColumnHidden(COLUMN_DIR, true) ; ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, true) ;
ui.checkButton->hide() ; ui.checkButton->hide() ;
connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected())); connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(downloadRemoteSelected()));
@ -413,7 +406,7 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
QHeaderView * header = ui.dirTreeView->header () ; QHeaderView * header = ui.dirTreeView->header () ;
QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Interactive); QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Interactive);
ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal, COLUMN_NAME, COLUMN_DIR) ; ui.dirTreeView->header()->headerDataChanged(Qt::Horizontal, COLUMN_NAME, COLUMN_WN_VISU_DIR) ;
// recursRestoreExpandedItems(ui.dirTreeView->rootIndex(),expanded_indexes); // recursRestoreExpandedItems(ui.dirTreeView->rootIndex(),expanded_indexes);
FilterItems(); FilterItems();
@ -423,8 +416,9 @@ void LocalSharedFilesDialog::showProperColumns()
{ {
if(model == tree_model) if(model == tree_model)
{ {
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FILENB, false) ;
ui.dirTreeView->setColumnHidden(COLUMN_DIR, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, false) ;
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW #ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->hide(); ui.filterLabel->hide();
ui.filterPatternLineEdit->hide(); ui.filterPatternLineEdit->hide();
@ -434,8 +428,9 @@ void LocalSharedFilesDialog::showProperColumns()
} }
else else
{ {
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND, true) ; ui.dirTreeView->setColumnHidden(COLUMN_FILENB, true) ;
ui.dirTreeView->setColumnHidden(COLUMN_DIR, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, true) ;
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW #ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->show(); ui.filterLabel->show();
ui.filterPatternLineEdit->show(); ui.filterPatternLineEdit->show();
@ -446,8 +441,9 @@ void RemoteSharedFilesDialog::showProperColumns()
{ {
if(model == tree_model) if(model == tree_model)
{ {
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND, true) ; ui.dirTreeView->setColumnHidden(COLUMN_FILENB, false) ;
ui.dirTreeView->setColumnHidden(COLUMN_DIR, true) ; ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, true) ;
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, true) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW #ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->hide(); ui.filterLabel->hide();
ui.filterPatternLineEdit->hide(); ui.filterPatternLineEdit->hide();
@ -457,8 +453,9 @@ void RemoteSharedFilesDialog::showProperColumns()
} }
else else
{ {
ui.dirTreeView->setColumnHidden(COLUMN_FRIEND, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FILENB, true) ;
ui.dirTreeView->setColumnHidden(COLUMN_DIR, false) ; ui.dirTreeView->setColumnHidden(COLUMN_FRIEND_ACCESS, false) ;
ui.dirTreeView->setColumnHidden(COLUMN_WN_VISU_DIR, false) ;
#ifdef DONT_USE_SEARCH_IN_TREE_VIEW #ifdef DONT_USE_SEARCH_IN_TREE_VIEW
ui.filterLabel->show(); ui.filterLabel->show();
ui.filterPatternLineEdit->show(); ui.filterPatternLineEdit->show();
@ -1254,12 +1251,12 @@ void SharedFilesDialog::filterRegExpChanged()
ui.filterStartButton->show(); ui.filterStartButton->show();
} }
bool valid = false ; //bool valid = false ;
QColor color ; //QColor color ;
if(text.length() > 0 && text.length() < 3) if(text.length() > 0 && text.length() < 3)
{ {
valid = false; //valid = false;
ui.filterStartButton->setEnabled(false) ; ui.filterStartButton->setEnabled(false) ;
ui.filterPatternFrame->setToolTip(tr("Search string should be at least 3 characters long.")) ; ui.filterPatternFrame->setToolTip(tr("Search string should be at least 3 characters long.")) ;

View File

@ -19,26 +19,26 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <QFileInfo>
#include <QDir>
#include <QUrl>
#include <QMimeData>
#include <QTimer>
#include <retroshare-gui/RsAutoUpdatePage.h>
#include <gui/common/RsCollection.h>
#include <gui/common/RsUrlHandler.h>
#include <gui/common/FilesDefs.h>
#include <gui/common/GroupDefs.h>
#include <gui/gxs/GxsIdDetails.h>
#include "RemoteDirModel.h" #include "RemoteDirModel.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h> #include "RsAutoUpdatePage.h"
#include <retroshare/rspeers.h> #include "gui/common/FilesDefs.h"
#include "gui/common/GroupDefs.h"
#include "gui/common/RsCollection.h"
#include "gui/common/RsUrlHandler.h"
#include "gui/gxs/GxsIdDetails.h"
#include "retroshare/rsfiles.h"
#include "retroshare/rspeers.h"
#include "util/misc.h" #include "util/misc.h"
#include <set> #include <QDir>
#include <QFileInfo>
#include <QMimeData>
#include <QTimer>
#include <QUrl>
#include <algorithm> #include <algorithm>
#include <set>
#include <time.h> #include <time.h>
/***** /*****
@ -212,11 +212,11 @@ int FlatStyle_RDM::rowCount(const QModelIndex &parent) const
} }
int TreeStyle_RDM::columnCount(const QModelIndex &/*parent*/) const int TreeStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
{ {
return 5; return COLUMN_COUNT;
} }
int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
{ {
return 5; return COLUMN_COUNT;
} }
QString RetroshareDirModel::getFlagsString(FileStorageFlags flags) QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
{ {
@ -324,7 +324,7 @@ const QIcon& RetroshareDirModel::getFlagsIcon(FileStorageFlags flags)
QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln) const QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln) const
{ {
if(coln == 3) if(coln == COLUMN_FRIEND_ACCESS)
{ {
if(details.type == DIR_TYPE_PERSON) return QVariant() ; if(details.type == DIR_TYPE_PERSON) return QVariant() ;
@ -392,7 +392,7 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
{ {
switch(coln) switch(coln)
{ {
case 0: { case COLUMN_NAME: {
//SharedDirStats stats ; //SharedDirStats stats ;
QString res ; QString res ;
@ -406,31 +406,41 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
} }
return res ; return res ;
} }
case 1: { case COLUMN_FILENB: {
SharedDirStats stats ; SharedDirStats stats ;
QString res ;
if(RemoteMode) if(RemoteMode)
{
//res = QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
rsFiles->getSharedDirStatistics(details.id,stats) ; rsFiles->getSharedDirStatistics(details.id,stats) ;
}
else else
{ rsFiles->getSharedDirStatistics(rsPeers->getOwnId(),stats) ;
//res = tr("My files");
rsFiles->getSharedDirStatistics(rsPeers->getOwnId(),stats) ;
}
if(stats.total_number_of_files > 0) if(stats.total_number_of_files > 0)
res += QString::number(stats.total_number_of_files) + " files, " + misc::friendlyUnit(stats.total_shared_size) ; {
if (stats.total_number_of_files > 1)
return res ; return QString::number(stats.total_number_of_files) + " " + tr("Files");
else
return QString::number(stats.total_number_of_files) + " " + tr("File");
}
return tr("Empty");
} }
case 2: if(!isNewerThanEpoque(details.max_mtime)) case COLUMN_SIZE: {
return QString(); SharedDirStats stats ;
if(RemoteMode)
rsFiles->getSharedDirStatistics(details.id,stats) ;
else else
return misc::timeRelativeToNow(details.max_mtime); rsFiles->getSharedDirStatistics(rsPeers->getOwnId(),stats) ;
if(stats.total_shared_size > 0)
return misc::friendlyUnit(stats.total_shared_size) ;
return QString();
}
case COLUMN_AGE:
if(!isNewerThanEpoque(details.max_mtime))
return QString();
else
return misc::timeRelativeToNow(details.max_mtime);
default: default:
return QString() ; return QString() ;
@ -440,16 +450,18 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
{ {
switch(coln) switch(coln)
{ {
case 0: case COLUMN_NAME:
return QString::fromUtf8(details.name.c_str()); return QString::fromUtf8(details.name.c_str());
case 1: case COLUMN_FILENB:
return QVariant();
case COLUMN_SIZE:
return misc::friendlyUnit(details.count); return misc::friendlyUnit(details.count);
case 2: case COLUMN_AGE:
return misc::timeRelativeToNow(details.max_mtime); return misc::timeRelativeToNow(details.max_mtime);
case 3: case COLUMN_FRIEND_ACCESS:
return QVariant(); return QVariant();
case 4: case COLUMN_WN_VISU_DIR:
return getGroupsString(details.flags,details.parent_groups) ; return getGroupsString(details.flags,details.parent_groups) ;
default: default:
return tr("FILE"); return tr("FILE");
@ -459,21 +471,23 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
{ {
switch(coln) switch(coln)
{ {
case 0: case COLUMN_NAME:
return QString::fromUtf8(details.name.c_str()); return QString::fromUtf8(details.name.c_str());
break; break;
case 1: case COLUMN_FILENB:
if (details.count > 1) if (details.count > 1)
{ {
return QString::number(details.count) + " " + tr("Files"); return QString::number(details.count) + " " + tr("Files");
} }
return QString::number(details.count) + " " + tr("File"); return QString::number(details.count) + " " + tr("File");
case 2: case COLUMN_SIZE:
return QVariant();
case COLUMN_AGE:
return misc::timeRelativeToNow(details.max_mtime); return misc::timeRelativeToNow(details.max_mtime);
case 3: case COLUMN_FRIEND_ACCESS:
return QVariant(); return QVariant();
case 4: case COLUMN_WN_VISU_DIR:
return getGroupsString(details.flags,details.parent_groups) ; return getGroupsString(details.flags,details.parent_groups) ;
default: default:
return tr("DIR"); return tr("DIR");
@ -501,19 +515,20 @@ void FlatStyle_RDM::update()
postMods() ; postMods() ;
} }
} }
QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
{ {
QString dir ; QString dir ;
DirDetails det ; DirDetails det ;
if(!requestDirDetails(details.parent,RemoteMode,det)) if(!requestDirDetails(details.parent,RemoteMode,det))
return QString(); return QString();
#ifdef SHOW_TOTAL_PATH #ifdef SHOW_TOTAL_PATH
do do
{ {
#endif #endif
dir = QString::fromUtf8(det.name.c_str())+"/"+dir ; dir = QString::fromUtf8(det.name.c_str())+"/"+dir ;
#ifdef SHOW_TOTAL_PATH #ifdef SHOW_TOTAL_PATH
if(!requestDirDetails(det.parent,det,flags)) if(!requestDirDetails(det.parent,det,flags))
@ -530,17 +545,19 @@ QVariant FlatStyle_RDM::displayRole(const DirDetails& details,int coln) const
if (details.type == DIR_TYPE_FILE) /* File */ if (details.type == DIR_TYPE_FILE) /* File */
switch(coln) switch(coln)
{ {
case 0: return QString::fromUtf8(details.name.c_str()); case COLUMN_NAME: return QString::fromUtf8(details.name.c_str());
case 1: return misc::friendlyUnit(details.count); case COLUMN_FILENB: return QString();
case 2: return misc::timeRelativeToNow(details.max_mtime); case COLUMN_SIZE: return misc::friendlyUnit(details.count);
case 3: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str()); case COLUMN_AGE: return misc::timeRelativeToNow(details.max_mtime);
case 4: return computeDirectoryPath(details); case COLUMN_FRIEND_ACCESS: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
case COLUMN_WN_VISU_DIR: return computeDirectoryPath(details);
default: default:
return QVariant() ; return QVariant() ;
} }
return QVariant(); return QVariant();
} /* end of DisplayRole */ } /* end of DisplayRole */
QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const
{ {
/* /*
@ -553,11 +570,29 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
{ {
switch(coln) switch(coln)
{ {
case 0: case COLUMN_NAME:
return (RemoteMode)?(QString::fromUtf8(rsPeers->getPeerName(details.id).c_str())):tr("My files"); return (RemoteMode)?(QString::fromUtf8(rsPeers->getPeerName(details.id).c_str())):tr("My files");
case 1: case COLUMN_FILENB: {
return QString(); SharedDirStats stats ;
case 2:
if(RemoteMode)
rsFiles->getSharedDirStatistics(details.id,stats) ;
else
rsFiles->getSharedDirStatistics(rsPeers->getOwnId(),stats) ;
return (qulonglong) stats.total_number_of_files;
}
case COLUMN_SIZE: {
SharedDirStats stats ;
if(RemoteMode)
rsFiles->getSharedDirStatistics(details.id,stats) ;
else
rsFiles->getSharedDirStatistics(rsPeers->getOwnId(),stats) ;
return (qulonglong) stats.total_shared_size;
}
case COLUMN_AGE:
return details.max_mtime; return details.max_mtime;
default: default:
return QString(); return QString();
@ -567,15 +602,17 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
{ {
switch(coln) switch(coln)
{ {
case 0: case COLUMN_NAME:
return QString::fromUtf8(details.name.c_str()); return QString::fromUtf8(details.name.c_str());
case 1: case COLUMN_FILENB:
return (qulonglong) 0;
case COLUMN_SIZE:
return (qulonglong) details.count; return (qulonglong) details.count;
case 2: case COLUMN_AGE:
return details.max_mtime; return details.max_mtime;
case 3: case COLUMN_FRIEND_ACCESS:
return getFlagsString(details.flags); return getFlagsString(details.flags);
case 4: case COLUMN_WN_VISU_DIR:
{ {
QString ind(""); QString ind("");
if (ageIndicator != IND_ALWAYS) if (ageIndicator != IND_ALWAYS)
@ -590,13 +627,15 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
{ {
switch(coln) switch(coln)
{ {
case 0: case COLUMN_NAME:
return QString::fromUtf8(details.name.c_str()); return QString::fromUtf8(details.name.c_str());
case 1: case COLUMN_FILENB:
return (qulonglong) details.count; return (qulonglong) details.count;
case 2: case COLUMN_SIZE:
return (qulonglong) 0;
case COLUMN_AGE:
return details.max_mtime; return details.max_mtime;
case 3: case COLUMN_FRIEND_ACCESS:
return getFlagsString(details.flags); return getFlagsString(details.flags);
default: default:
return tr("DIR"); return tr("DIR");
@ -604,6 +643,7 @@ QVariant TreeStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
} }
return QVariant(); return QVariant();
} }
QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails& details,int coln) const
{ {
/* /*
@ -616,16 +656,16 @@ QVariant FlatStyle_RDM::sortRole(const QModelIndex& /*index*/,const DirDetails&
{ {
switch(coln) switch(coln)
{ {
case 0: return QString::fromUtf8(details.name.c_str()); case COLUMN_NAME: return QString::fromUtf8(details.name.c_str());
case 1: return (qulonglong) details.count; case COLUMN_FILENB: return (qulonglong) 0;
case 2: return details.max_mtime; case COLUMN_SIZE: return (qulonglong) details.count;
case 3: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str()); case COLUMN_AGE: return details.max_mtime;
case COLUMN_FRIEND_ACCESS: return QString::fromUtf8(rsPeers->getPeerName(details.id).c_str());
case COLUMN_WN_VISU_DIR: {
RS_STACK_MUTEX(_ref_mutex) ;
case 4: { return computeDirectoryPath(details);
RS_STACK_MUTEX(_ref_mutex) ; }
return computeDirectoryPath(details);
}
} }
} }
return QVariant(); return QVariant();
@ -652,9 +692,9 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
if (role == Qt::TextAlignmentRole) if (role == Qt::TextAlignmentRole)
{ {
if(coln == 1) if((coln == COLUMN_FILENB) || (coln == COLUMN_SIZE))
return int( Qt::AlignRight | Qt::AlignVCenter); return int( Qt::AlignRight | Qt::AlignVCenter);
else else
return QVariant(); return QVariant();
} }
@ -747,7 +787,7 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int
int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ; int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ;
int defh = QFontMetricsF(QWidget().font()).height(); int defh = QFontMetricsF(QWidget().font()).height();
if (section < 2) if (section < COLUMN_AGE)
{ {
defw = 200/16.0*defh; defw = 200/16.0*defh;
} }
@ -761,36 +801,38 @@ QVariant TreeStyle_RDM::headerData(int section, Qt::Orientation orientation, int
{ {
switch(section) switch(section)
{ {
case 0: case COLUMN_NAME:
if (RemoteMode) if (RemoteMode)
if(mUpdating) if(mUpdating)
return tr("Friends Directories [updating...]"); return tr("Friends Directories [updating...]");
else else
return tr("Friends Directories"); return tr("Friends Directories");
else else
if(mUpdating) if(mUpdating)
return tr("My Directories [updating...]"); return tr("My Directories [updating...]");
else else
return tr("My Directories"); return tr("My Directories");
case 1: case COLUMN_FILENB:
return tr("# Files");
case COLUMN_SIZE:
return tr("Size"); return tr("Size");
case 2: case COLUMN_AGE:
return tr("Age"); return tr("Age");
case 3: case COLUMN_FRIEND_ACCESS:
if (RemoteMode) if (RemoteMode)
return tr("Friend"); return tr("Friend");
else else
return tr("Access"); return tr("Access");
case 4: case COLUMN_WN_VISU_DIR:
if (RemoteMode) if (RemoteMode)
return tr("What's new"); return tr("What's new");
else else
return tr("Visibility"); return tr("Visibility");
} }
return QString("Column %1").arg(section); return tr("Column %1").arg(section);
} }
else else
return QString("Row %1").arg(section); return tr("Row %1").arg(section);
} }
QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int role) const QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int role) const
{ {
@ -799,7 +841,7 @@ QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int
int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ; int defw = QFontMetricsF(QWidget().font()).width(headerData(section,Qt::Horizontal,Qt::DisplayRole).toString()) ;
int defh = QFontMetricsF(QWidget().font()).height(); int defh = QFontMetricsF(QWidget().font()).height();
if (section < 2) if (section < COLUMN_AGE)
{ {
defw = defh*200/16.0; defw = defh*200/16.0;
} }
@ -813,28 +855,30 @@ QVariant FlatStyle_RDM::headerData(int section, Qt::Orientation orientation, int
{ {
switch(section) switch(section)
{ {
case 0: case COLUMN_NAME:
if (RemoteMode) if (RemoteMode)
{ {
return tr("Friends Directories"); return tr("Friends Directories");
} }
return tr("My Directories"); return tr("My Directories");
case 1: case COLUMN_FILENB:
return tr("# Files");
case COLUMN_SIZE:
return tr("Size"); return tr("Size");
case 2: case COLUMN_AGE:
return tr("Age"); return tr("Age");
case 3: case COLUMN_FRIEND_ACCESS:
if(RemoteMode) if(RemoteMode)
return tr("Friend"); return tr("Friend");
else else
return tr("Share Flags"); return tr("Share Flags");
case 4: case COLUMN_WN_VISU_DIR:
return tr("Directory"); return tr("Directory");
} }
return QString("Column %1").arg(section); return tr("Column %1").arg(section);
} }
else else
return QString("Row %1").arg(section); return tr("Row %1").arg(section);
} }
QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent) const QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent) const
@ -939,7 +983,7 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
std::cerr << "Creating index 3 row=" << details.prow << ", column=" << 0 << ", ref=" << (void*)details.parent << std::endl; std::cerr << "Creating index 3 row=" << details.prow << ", column=" << 0 << ", ref=" << (void*)details.parent << std::endl;
#endif #endif
return createIndex(details.prow, 0, details.parent); return createIndex(details.prow, COLUMN_NAME, details.parent);
} }
QModelIndex FlatStyle_RDM::parent( const QModelIndex & index ) const QModelIndex FlatStyle_RDM::parent( const QModelIndex & index ) const
{ {
@ -964,17 +1008,17 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
void *ref = index.internalPointer(); void *ref = index.internalPointer();
DirDetails details ; DirDetails details ;
if (! requestDirDetails(ref, RemoteMode,details)) if (! requestDirDetails(ref, RemoteMode,details))
return Qt::ItemIsSelectable; // Error. return Qt::ItemIsSelectable; // Error.
switch(details.type) switch(details.type)
{ {
// we grey out a person that has never been updated. It's easy to spot these, since the min age of the directory is approx equal to time(NULL), which exceeds 40 years. // we grey out a person that has never been updated. It's easy to spot these, since the min age of the directory is approx equal to time(NULL), which exceeds 40 years.
case DIR_TYPE_PERSON:return isNewerThanEpoque(details.max_mtime)? (Qt::ItemIsEnabled):(Qt::NoItemFlags) ; case DIR_TYPE_PERSON: return isNewerThanEpoque(details.max_mtime)? (Qt::ItemIsEnabled):(Qt::NoItemFlags) ;
case DIR_TYPE_DIR: return Qt::ItemIsSelectable | Qt::ItemIsEnabled; case DIR_TYPE_DIR: return Qt::ItemIsSelectable | Qt::ItemIsEnabled;
case DIR_TYPE_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled; case DIR_TYPE_FILE: return Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled;
} }
return Qt::ItemIsSelectable; return Qt::ItemIsSelectable;
@ -1070,7 +1114,7 @@ void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndex
QString dir_name; QString dir_name;
if(!RemoteMode) if(!RemoteMode)
{ {
if(dirVec.size()) if(!dirVec.empty())
{ {
const DirDetails& details = dirVec[0]; const DirDetails& details = dirVec[0];
dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName(); dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
@ -1165,24 +1209,24 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec) void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec)
{ {
dirVec.clear(); dirVec.clear();
/* Fire off requests */ /* Fire off requests */
QModelIndexList::const_iterator it; QModelIndexList::const_iterator it;
for(it = list.begin(); it != list.end(); ++it) for(it = list.begin(); it != list.end(); ++it)
{ {
if(it->column()==1) if(it->column()==COLUMN_FILENB)
{ {
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
DirDetails details ; DirDetails details ;
if(!requestDirDetails(ref, RemoteMode,details)) if(!requestDirDetails(ref, RemoteMode,details))
continue; continue;
dirVec.push_back(details); dirVec.push_back(details);
} }
} }
} }
/**************************************************************************** /****************************************************************************
@ -1208,7 +1252,7 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
std::set<std::string> already_in ; std::set<std::string> already_in ;
for(QModelIndexList::const_iterator it(list.begin()); it != list.end(); ++it) for(QModelIndexList::const_iterator it(list.begin()); it != list.end(); ++it)
if(it->column()==0) if(it->column()==COLUMN_NAME)
{ {
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
@ -1258,8 +1302,6 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
return; return;
} }
std::list<std::string> dirs_to_open;
std::list<DirDetails> files_info; std::list<DirDetails> files_info;
std::list<DirDetails>::iterator it; std::list<DirDetails>::iterator it;
getFileInfoFromIndexList(qmil, files_info); getFileInfoFromIndexList(qmil, files_info);
@ -1268,10 +1310,7 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
{ {
if ((*it).type & DIR_TYPE_PERSON) continue; if ((*it).type & DIR_TYPE_PERSON) continue;
//std::string path, name; QDir dir(QString::fromUtf8((*it).path.c_str()));
//rsFiles->ConvertSharedFilePath((*it).path, path);
QDir dir(QString::fromUtf8((*it).path.c_str()));
QString dest; QString dest;
if ((*it).type & DIR_TYPE_FILE) { if ((*it).type & DIR_TYPE_FILE) {
dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str())); dest = dir.absoluteFilePath(QString::fromUtf8(it->name.c_str()));
@ -1291,7 +1330,7 @@ void RetroshareDirModel::openSelected(const QModelIndexList &qmil)
void RetroshareDirModel::getFilePath(const QModelIndex& index, std::string& fullpath) void RetroshareDirModel::getFilePath(const QModelIndex& index, std::string& fullpath)
{ {
void *ref = index.sibling(index.row(),1).internalPointer(); void *ref = index.sibling(index.row(),COLUMN_FILENB).internalPointer();
DirDetails details ; DirDetails details ;

View File

@ -22,11 +22,21 @@
#ifndef REMOTE_DIR_MODEL #ifndef REMOTE_DIR_MODEL
#define REMOTE_DIR_MODEL #define REMOTE_DIR_MODEL
#include <retroshare/rstypes.h>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QIcon> #include <QIcon>
#include <vector>
#include <stdint.h> #include <stdint.h>
#include <retroshare/rstypes.h> #include <vector>
#define COLUMN_NAME 0
#define COLUMN_FILENB 1
#define COLUMN_SIZE 2
#define COLUMN_AGE 3
#define COLUMN_FRIEND_ACCESS 4
#define COLUMN_WN_VISU_DIR 5
#define COLUMN_COUNT 6
class DirDetails; class DirDetails;

View File

@ -656,6 +656,14 @@ void GxsGroupFrameDialog::changedGroup(const QString &groupId)
return; return;
} }
if (groupId.isEmpty()) {
if (mMessageWidget) {
mMessageWidget->setGroupId(RsGxsGroupId());
ui->messageTabWidget->setCurrentWidget(mMessageWidget);
}
return;
}
mGroupId = RsGxsGroupId(groupId.toStdString()); mGroupId = RsGxsGroupId(groupId.toStdString());
if (mGroupId.isNull()) { if (mGroupId.isNull()) {
return; return;

View File

@ -173,8 +173,8 @@
<string>Add new post</string> <string>Add new post</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/mail_send.png</normaloff>:/images/mail_send.png</iconset> <normaloff>:/icons/png/add.png</normaloff>:/icons/png/add.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -619,6 +619,7 @@ p, li { white-space: pre-wrap; }
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -88,8 +88,8 @@
<string>New Thread</string> <string>New Thread</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../icons.qrc">
<normaloff>:/images/mail_new.png</normaloff>:/images/mail_new.png</iconset> <normaloff>:/icons/png/add.png</normaloff>:/icons/png/add.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -329,9 +329,9 @@
<iconset resource="../images.qrc"> <iconset resource="../images.qrc">
<normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset> <normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum> <enum>Qt::ToolButtonTextBesideIcon</enum>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -539,9 +539,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>RSTextBrowser</class> <class>GxsIdLabel</class>
<extends>QTextBrowser</extends> <extends>QLabel</extends>
<header>gui/common/RSTextBrowser.h</header> <header>gui/gxs/GxsIdLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>LineEditClear</class> <class>LineEditClear</class>
@ -553,16 +553,16 @@
<extends>QToolButton</extends> <extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header> <header>gui/common/SubscribeToolButton.h</header>
</customwidget> </customwidget>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget> <customwidget>
<class>RSTreeWidget</class> <class>RSTreeWidget</class>
<extends>QTreeWidget</extends> <extends>QTreeWidget</extends>
<header>gui/common/RSTreeWidget.h</header> <header>gui/common/RSTreeWidget.h</header>
</customwidget> </customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>ElidedLabel</class> <class>ElidedLabel</class>
<extends>QLabel</extends> <extends>QLabel</extends>
@ -577,8 +577,8 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>