mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1859 from csoler/v0.6-ImprovedGUI_4
Making channels faster to load
This commit is contained in:
commit
5120f693be
@ -35,7 +35,6 @@ bool operator<(const std::pair<uint32_t,GxsRequest*>& p1,const std::pair<uint32_
|
||||
return p1.second->Options.mPriority <= p2.second->Options.mPriority ; // <= so that new elements with same priority are inserted before
|
||||
}
|
||||
|
||||
|
||||
RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) :
|
||||
mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {}
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ int RsServer::StartupRetroShare()
|
||||
std::cerr << "(EE) Cannot create extensions directory " << extensions_dir
|
||||
<< ". This is not mandatory, but you probably have a permission problem." << std::endl;
|
||||
|
||||
#ifdef DEBUG_PLUGIN_SYSTEM
|
||||
#ifndef DEBUG_PLUGIN_SYSTEM
|
||||
plugins_directories.push_back(".") ; // this list should be saved/set to some correct value.
|
||||
// possible entries include: /usr/lib/retroshare, ~/.retroshare/extensions/, etc.
|
||||
#endif
|
||||
|
@ -1470,7 +1470,7 @@ void SearchDialog::hideOrShowSearchResult(QTreeWidgetItem* resultItem, QString c
|
||||
|
||||
void SearchDialog::setIconAndType(QTreeWidgetItem *item, const QString& filename)
|
||||
{
|
||||
item->setIcon(SR_NAME_COL, FilesDefs::getIconFromFilename(filename));
|
||||
item->setIcon(SR_NAME_COL, FilesDefs::getIconFromFileType(filename));
|
||||
item->setText(SR_TYPE_COL, FilesDefs::getNameFromFilename(filename));
|
||||
}
|
||||
|
||||
|
@ -594,7 +594,7 @@ public:
|
||||
if(col == COLUMN_NAME)
|
||||
{
|
||||
if(source_id == -1)
|
||||
return QVariant(FilesDefs::getIconFromFilename(QString::fromUtf8(fileInfo.fname.c_str())));
|
||||
return QVariant(FilesDefs::getIconFromFileType(QString::fromUtf8(fileInfo.fname.c_str())));
|
||||
else
|
||||
{
|
||||
QString iconName,tooltip;
|
||||
@ -919,10 +919,10 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
|
||||
QObject::connect(ui.downloadList->selectionModel(),SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),this,SLOT(showFileDetails())) ;
|
||||
|
||||
ui.tabWidget->insertTab(2,searchDialog = new SearchDialog(), QIcon(IMAGE_SEARCH), tr("Search")) ;
|
||||
ui.tabWidget->insertTab(3,remoteSharedFiles = new RemoteSharedFilesDialog(), QIcon(IMAGE_FRIENDSFILES), tr("Friends files")) ;
|
||||
ui.tabWidget->insertTab(2,searchDialog = new SearchDialog(), FilesDefs::getIconFromQtResourcePath(IMAGE_SEARCH), tr("Search")) ;
|
||||
ui.tabWidget->insertTab(3,remoteSharedFiles = new RemoteSharedFilesDialog(), FilesDefs::getIconFromQtResourcePath(IMAGE_FRIENDSFILES), tr("Friends files")) ;
|
||||
|
||||
ui.tabWidget->addTab(localSharedFiles = new LocalSharedFilesDialog(), QIcon(IMAGE_MYFILES), tr("My files")) ;
|
||||
ui.tabWidget->addTab(localSharedFiles = new LocalSharedFilesDialog(), FilesDefs::getIconFromQtResourcePath(IMAGE_MYFILES), tr("My files")) ;
|
||||
|
||||
for(int i=0;i<rsPlugins->nbPlugins();++i)
|
||||
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_transfers_tab() != NULL)
|
||||
@ -933,79 +933,79 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
/** Setup the actions for the context menu */
|
||||
|
||||
// Actions. Only need to be defined once.
|
||||
pauseAct = new QAction(QIcon(IMAGE_PAUSE), tr("Pause"), this);
|
||||
pauseAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PAUSE), tr("Pause"), this);
|
||||
connect(pauseAct, SIGNAL(triggered()), this, SLOT(pauseFileTransfer()));
|
||||
|
||||
resumeAct = new QAction(QIcon(IMAGE_RESUME), tr("Resume"), this);
|
||||
resumeAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_RESUME), tr("Resume"), this);
|
||||
connect(resumeAct, SIGNAL(triggered()), this, SLOT(resumeFileTransfer()));
|
||||
|
||||
forceCheckAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Force Check" ), this );
|
||||
forceCheckAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_CANCEL), tr( "Force Check" ), this );
|
||||
connect( forceCheckAct , SIGNAL( triggered() ), this, SLOT( forceCheck() ) );
|
||||
|
||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
cancelAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||
|
||||
openFolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
openFolderAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(openFolderAct, SIGNAL(triggered()), this, SLOT(dlOpenFolder()));
|
||||
|
||||
openFileAct = new QAction(QIcon(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
openFileAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_OPENFILE), tr("Open File"), this);
|
||||
connect(openFileAct, SIGNAL(triggered()), this, SLOT(dlOpenFile()));
|
||||
|
||||
previewFileAct = new QAction(QIcon(IMAGE_PREVIEW), tr("Preview File"), this);
|
||||
previewFileAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PREVIEW), tr("Preview File"), this);
|
||||
connect(previewFileAct, SIGNAL(triggered()), this, SLOT(dlPreviewFile()));
|
||||
|
||||
detailsFileAct = new QAction(QIcon(IMAGE_INFO), tr("Details..."), this);
|
||||
detailsFileAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_INFO), tr("Details..."), this);
|
||||
connect(detailsFileAct, SIGNAL(triggered()), this, SLOT(showDetailsDialog()));
|
||||
|
||||
clearCompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
clearCompletedAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
connect( clearCompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||
|
||||
|
||||
copyLinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy RetroShare Link" ), this );
|
||||
copyLinkAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYLINK), tr( "Copy RetroShare Link" ), this );
|
||||
connect( copyLinkAct , SIGNAL( triggered() ), this, SLOT( dlCopyLink() ) );
|
||||
pasteLinkAct = new QAction(QIcon(IMAGE_PASTELINK), tr( "Paste RetroShare Link" ), this );
|
||||
pasteLinkAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PASTELINK), tr( "Paste RetroShare Link" ), this );
|
||||
connect( pasteLinkAct , SIGNAL( triggered() ), this, SLOT( pasteLink() ) );
|
||||
queueDownAct = new QAction(QIcon(":/images/go-down.png"), tr("Down"), this);
|
||||
queueDownAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/go-down.png"), tr("Down"), this);
|
||||
connect(queueDownAct, SIGNAL(triggered()), this, SLOT(priorityQueueDown()));
|
||||
queueUpAct = new QAction(QIcon(":/images/go-up.png"), tr("Up"), this);
|
||||
queueUpAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/go-up.png"), tr("Up"), this);
|
||||
connect(queueUpAct, SIGNAL(triggered()), this, SLOT(priorityQueueUp()));
|
||||
queueTopAct = new QAction(QIcon(":/images/go-top.png"), tr("Top"), this);
|
||||
queueTopAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/go-top.png"), tr("Top"), this);
|
||||
connect(queueTopAct, SIGNAL(triggered()), this, SLOT(priorityQueueTop()));
|
||||
queueBottomAct = new QAction(QIcon(":/images/go-bottom.png"), tr("Bottom"), this);
|
||||
queueBottomAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/go-bottom.png"), tr("Bottom"), this);
|
||||
connect(queueBottomAct, SIGNAL(triggered()), this, SLOT(priorityQueueBottom()));
|
||||
chunkStreamingAct = new QAction(QIcon(IMAGE_STREAMING), tr("Streaming"), this);
|
||||
chunkStreamingAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_STREAMING), tr("Streaming"), this);
|
||||
connect(chunkStreamingAct, SIGNAL(triggered()), this, SLOT(chunkStreaming()));
|
||||
prioritySlowAct = new QAction(QIcon(IMAGE_PRIORITYLOW), tr("Slower"), this);
|
||||
prioritySlowAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITYLOW), tr("Slower"), this);
|
||||
connect(prioritySlowAct, SIGNAL(triggered()), this, SLOT(speedSlow()));
|
||||
priorityMediumAct = new QAction(QIcon(IMAGE_PRIORITYNORMAL), tr("Average"), this);
|
||||
priorityMediumAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITYNORMAL), tr("Average"), this);
|
||||
connect(priorityMediumAct, SIGNAL(triggered()), this, SLOT(speedAverage()));
|
||||
priorityFastAct = new QAction(QIcon(IMAGE_PRIORITYHIGH), tr("Faster"), this);
|
||||
priorityFastAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITYHIGH), tr("Faster"), this);
|
||||
connect(priorityFastAct, SIGNAL(triggered()), this, SLOT(speedFast()));
|
||||
chunkRandomAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Random"), this);
|
||||
chunkRandomAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITYAUTO), tr("Random"), this);
|
||||
connect(chunkRandomAct, SIGNAL(triggered()), this, SLOT(chunkRandom()));
|
||||
chunkProgressiveAct = new QAction(QIcon(IMAGE_PRIORITYAUTO), tr("Progressive"), this);
|
||||
chunkProgressiveAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITYAUTO), tr("Progressive"), this);
|
||||
connect(chunkProgressiveAct, SIGNAL(triggered()), this, SLOT(chunkProgressive()));
|
||||
playAct = new QAction(QIcon(IMAGE_PLAY), tr( "Play" ), this );
|
||||
playAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_PLAY), tr( "Play" ), this );
|
||||
connect( playAct , SIGNAL( triggered() ), this, SLOT( dlOpenFile() ) );
|
||||
renameFileAct = new QAction(QIcon(IMAGE_RENAMEFILE), tr("Rename file..."), this);
|
||||
renameFileAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_RENAMEFILE), tr("Rename file..."), this);
|
||||
connect(renameFileAct, SIGNAL(triggered()), this, SLOT(renameFile()));
|
||||
specifyDestinationDirectoryAct = new QAction(QIcon(IMAGE_SEARCH),tr("Specify..."),this) ;
|
||||
specifyDestinationDirectoryAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_SEARCH),tr("Specify..."),this) ;
|
||||
connect(specifyDestinationDirectoryAct,SIGNAL(triggered()),this,SLOT(chooseDestinationDirectory()));
|
||||
expandAllDLAct= new QAction(QIcon(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
expandAllDLAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
connect(expandAllDLAct,SIGNAL(triggered()),this,SLOT(expandAllDL()));
|
||||
collapseAllDLAct= new QAction(QIcon(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
collapseAllDLAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
connect(collapseAllDLAct,SIGNAL(triggered()),this,SLOT(collapseAllDL()));
|
||||
expandAllULAct= new QAction(QIcon(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
expandAllULAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_EXPAND),tr("Expand all"),this);
|
||||
connect(expandAllULAct,SIGNAL(triggered()),this,SLOT(expandAllUL()));
|
||||
collapseAllULAct= new QAction(QIcon(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
collapseAllULAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLAPSE),tr("Collapse all"),this);
|
||||
connect(collapseAllULAct,SIGNAL(triggered()),this,SLOT(collapseAllUL()));
|
||||
collCreateAct= new QAction(QIcon(IMAGE_COLLCREATE), tr("Create Collection..."), this);
|
||||
collCreateAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLCREATE), tr("Create Collection..."), this);
|
||||
connect(collCreateAct,SIGNAL(triggered()),this,SLOT(collCreate()));
|
||||
collModifAct= new QAction(QIcon(IMAGE_COLLMODIF), tr("Modify Collection..."), this);
|
||||
collModifAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLMODIF), tr("Modify Collection..."), this);
|
||||
connect(collModifAct,SIGNAL(triggered()),this,SLOT(collModif()));
|
||||
collViewAct= new QAction(QIcon(IMAGE_COLLVIEW), tr("View Collection..."), this);
|
||||
collViewAct= new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLVIEW), tr("View Collection..."), this);
|
||||
connect(collViewAct,SIGNAL(triggered()),this,SLOT(collView()));
|
||||
collOpenAct = new QAction(QIcon(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
|
||||
collOpenAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COLLOPEN), tr( "Download from collection file..." ), this );
|
||||
connect(collOpenAct, SIGNAL(triggered()), this, SLOT(collOpen()));
|
||||
connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(collAutoOpen(QString)));
|
||||
|
||||
@ -1068,9 +1068,9 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
connect(showULHashAct,SIGNAL(triggered(bool)),this,SLOT(setShowULHashColumn(bool))) ;
|
||||
|
||||
/** Setup the actions for the upload context menu */
|
||||
ulOpenFolderAct = new QAction(QIcon(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
ulOpenFolderAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_OPENFOLDER), tr("Open Folder"), this);
|
||||
connect(ulOpenFolderAct, SIGNAL(triggered()), this, SLOT(ulOpenFolder()));
|
||||
ulCopyLinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Copy RetroShare Link" ), this );
|
||||
ulCopyLinkAct = new QAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPYLINK), tr( "Copy RetroShare Link" ), this );
|
||||
connect( ulCopyLinkAct , SIGNAL( triggered() ), this, SLOT( ulCopyLink() ) );
|
||||
|
||||
// load settings
|
||||
@ -1237,26 +1237,26 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ )
|
||||
FileInfo info;
|
||||
|
||||
QMenu priorityQueueMenu(tr("Move in Queue..."), this);
|
||||
priorityQueueMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
priorityQueueMenu.setIcon(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITY));
|
||||
priorityQueueMenu.addAction(queueTopAct);
|
||||
priorityQueueMenu.addAction(queueUpAct);
|
||||
priorityQueueMenu.addAction(queueDownAct);
|
||||
priorityQueueMenu.addAction(queueBottomAct);
|
||||
|
||||
QMenu prioritySpeedMenu(tr("Priority (Speed)..."), this);
|
||||
prioritySpeedMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
prioritySpeedMenu.setIcon(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITY));
|
||||
prioritySpeedMenu.addAction(prioritySlowAct);
|
||||
prioritySpeedMenu.addAction(priorityMediumAct);
|
||||
prioritySpeedMenu.addAction(priorityFastAct);
|
||||
|
||||
QMenu chunkMenu(tr("Chunk strategy"), this);
|
||||
chunkMenu.setIcon(QIcon(IMAGE_PRIORITY));
|
||||
chunkMenu.setIcon(FilesDefs::getIconFromQtResourcePath(IMAGE_PRIORITY));
|
||||
chunkMenu.addAction(chunkStreamingAct);
|
||||
chunkMenu.addAction(chunkProgressiveAct);
|
||||
chunkMenu.addAction(chunkRandomAct);
|
||||
|
||||
QMenu collectionMenu(tr("Collection"), this);
|
||||
collectionMenu.setIcon(QIcon(IMAGE_LIBRARY));
|
||||
collectionMenu.setIcon(FilesDefs::getIconFromQtResourcePath(IMAGE_LIBRARY));
|
||||
collectionMenu.addAction(collCreateAct);
|
||||
collectionMenu.addAction(collModifAct);
|
||||
collectionMenu.addAction(collViewAct);
|
||||
@ -1337,7 +1337,7 @@ void TransfersDialog::downloadListCustomPopupMenu( QPoint /*point*/ )
|
||||
contextMnu.addAction( renameFileAct) ;
|
||||
}
|
||||
|
||||
QMenu *directoryMenu = contextMnu.addMenu(QIcon(IMAGE_OPENFOLDER), tr("Set destination directory")) ;
|
||||
QMenu *directoryMenu = contextMnu.addMenu(FilesDefs::getIconFromQtResourcePath(IMAGE_OPENFOLDER), tr("Set destination directory")) ;
|
||||
directoryMenu->addAction(specifyDestinationDirectoryAct) ;
|
||||
|
||||
// Now get the list of existing directories.
|
||||
@ -1528,285 +1528,6 @@ void TransfersDialog::setDestinationDirectory()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
|
||||
{
|
||||
QString fileHash = QString::fromStdString(fileInfo.hash.toStdString());
|
||||
double fileDlspeed = (fileInfo.downloadStatus == FT_STATE_DOWNLOADING) ? (fileInfo.tfRate * 1024.0) : 0.0;
|
||||
|
||||
QString status;
|
||||
switch (fileInfo.downloadStatus) {
|
||||
case FT_STATE_FAILED: status = tr("Failed"); break;
|
||||
case FT_STATE_OKAY: status = tr("Okay"); break;
|
||||
case FT_STATE_WAITING: status = tr("Waiting"); break;
|
||||
case FT_STATE_DOWNLOADING: status = tr("Downloading"); break;
|
||||
case FT_STATE_COMPLETE: status = tr("Complete"); break;
|
||||
case FT_STATE_QUEUED: status = tr("Queued"); break;
|
||||
case FT_STATE_PAUSED: status = tr("Paused"); break;
|
||||
case FT_STATE_CHECKING_HASH:status = tr("Checking..."); break;
|
||||
default: status = tr("Unknown"); break;
|
||||
}
|
||||
|
||||
double priority = PRIORITY_NULL;
|
||||
|
||||
if (fileInfo.downloadStatus == FT_STATE_QUEUED) {
|
||||
priority = fileInfo.queue_position;
|
||||
} else if (fileInfo.downloadStatus == FT_STATE_COMPLETE) {
|
||||
priority = 0;
|
||||
} else {
|
||||
switch (fileInfo.priority) {
|
||||
case SPEED_LOW: priority = PRIORITY_SLOWER; break;
|
||||
case SPEED_NORMAL: priority = PRIORITY_AVERAGE; break;
|
||||
case SPEED_HIGH: priority = PRIORITY_FASTER; break;
|
||||
default: priority = PRIORITY_AVERAGE; break;
|
||||
}
|
||||
}
|
||||
|
||||
qlonglong completed = fileInfo.transfered;
|
||||
qlonglong remaining = fileInfo.size - fileInfo.transfered;
|
||||
|
||||
qlonglong downloadtime = (fileInfo.tfRate > 0)?( (fileInfo.size - fileInfo.transfered) / (fileInfo.tfRate * 1024.0) ) : 0 ;
|
||||
qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits<qint64>::max();
|
||||
|
||||
if (qi64LastDL == 0) // file is complete, or any raison why the time has not been set properly
|
||||
{
|
||||
QFileInfo file;
|
||||
|
||||
if (fileInfo.downloadStatus == FT_STATE_COMPLETE)
|
||||
file = QFileInfo(QString::fromUtf8(fileInfo.path.c_str()), QString::fromUtf8(fileInfo.fname.c_str()));
|
||||
else
|
||||
file = QFileInfo(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()), QString::fromUtf8(fileInfo.hash.toStdString().c_str()));
|
||||
|
||||
//Get Last Access on File
|
||||
if (file.exists())
|
||||
qi64LastDL = file.lastModified().toTime_t();
|
||||
}
|
||||
QString strPath = QString::fromUtf8(fileInfo.path.c_str());
|
||||
QString strPathAfterDL = strPath;
|
||||
strPathAfterDL.replace(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()),"");
|
||||
|
||||
FileChunksInfo fcinfo;
|
||||
if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
FileProgressInfo pinfo;
|
||||
pinfo.cmap = fcinfo.chunks;
|
||||
pinfo.type = FileProgressInfo::DOWNLOAD_LINE;
|
||||
pinfo.progress = (fileInfo.size == 0) ? 0 : (completed * 100.0 / fileInfo.size);
|
||||
pinfo.nb_chunks = pinfo.cmap._map.empty() ? 0 : fcinfo.chunks.size();
|
||||
|
||||
for (uint32_t i = 0; i < fcinfo.chunks.size(); ++i)
|
||||
switch(fcinfo.chunks[i])
|
||||
{
|
||||
case FileChunksInfo::CHUNK_CHECKING: pinfo.chunks_in_checking.push_back(i);
|
||||
break ;
|
||||
case FileChunksInfo::CHUNK_ACTIVE: pinfo.chunks_in_progress.push_back(i);
|
||||
break ;
|
||||
case FileChunksInfo::CHUNK_DONE:
|
||||
case FileChunksInfo::CHUNK_OUTSTANDING:
|
||||
break ;
|
||||
}
|
||||
|
||||
QString tooltip;
|
||||
|
||||
if (fileInfo.downloadStatus == FT_STATE_CHECKING_HASH) {
|
||||
tooltip = tr("If the hash of the downloaded data does\nnot correspond to the hash announced\nby the file source. The data is likely \nto be corrupted.\n\nRetroShare will ask the source a detailed \nmap of the data; it will compare and invalidate\nbad blocks, and download them again\n\nTry to be patient!") ;
|
||||
}
|
||||
|
||||
if (row < 0) {
|
||||
row = DLListModel->rowCount();
|
||||
DLListModel->insertRow(row);
|
||||
|
||||
// change progress column to own class for sorting
|
||||
DLListModel->setItem(row, COLUMN_PROGRESS, new ProgressItem(NULL));
|
||||
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_SIZE), QVariant((qlonglong) fileInfo.size));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_ID), fileHash, Qt::DisplayRole);
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_ID), fileHash, Qt::UserRole);
|
||||
}
|
||||
QString fileName = QString::fromUtf8(fileInfo.fname.c_str());
|
||||
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_NAME), fileName);
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_NAME), FilesDefs::getIconFromFilename(fileName), Qt::DecorationRole);
|
||||
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_COMPLETED), QVariant((qlonglong)completed));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_DLSPEED), QVariant((double)fileDlspeed));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PROGRESS), QVariant((float)pinfo.progress));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PROGRESS), QVariant::fromValue(pinfo), Qt::UserRole);
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_STATUS), QVariant(status));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PRIORITY), QVariant(priority));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_REMAINING), QVariant((qlonglong)remaining));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_DOWNLOADTIME), QVariant((qlonglong)downloadtime));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_LASTDL), QVariant(qi64LastDL));
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_PATH), QVariant(strPathAfterDL));
|
||||
DLListModel->item(row,COLUMN_PATH)->setToolTip(strPath);
|
||||
DLListModel->item(row,COLUMN_STATUS)->setToolTip(tooltip);
|
||||
|
||||
QStandardItem *dlItem = DLListModel->item(row);
|
||||
|
||||
std::set<int> used_rows ;
|
||||
int active = 0;
|
||||
|
||||
if (fileInfo.downloadStatus != FT_STATE_COMPLETE) {
|
||||
for (std::vector<TransferInfo>::const_iterator pit = fileInfo.peers.begin() ; pit != fileInfo.peers.end(); ++pit)
|
||||
{
|
||||
const TransferInfo &transferInfo = *pit;
|
||||
|
||||
//unique combination: fileHash + peerId, variant: hash + peerName (too long)
|
||||
QString hashFileAndPeerId = fileHash + QString::fromStdString(transferInfo.peerId.toStdString());
|
||||
|
||||
double peerDlspeed = 0;
|
||||
if ((uint32_t)transferInfo.status == FT_STATE_DOWNLOADING && fileInfo.downloadStatus != FT_STATE_PAUSED && fileInfo.downloadStatus != FT_STATE_COMPLETE)
|
||||
peerDlspeed = transferInfo.tfRate * 1024.0;
|
||||
|
||||
FileProgressInfo peerpinfo;
|
||||
peerpinfo.cmap = fcinfo.compressed_peer_availability_maps[transferInfo.peerId];
|
||||
peerpinfo.type = FileProgressInfo::DOWNLOAD_SOURCE ;
|
||||
peerpinfo.progress = 0.0; // we don't display completion for sources.
|
||||
peerpinfo.nb_chunks = peerpinfo.cmap._map.empty() ? 0 : fcinfo.chunks.size();
|
||||
|
||||
int row_id = addPeerToDLItem(dlItem, transferInfo.peerId, hashFileAndPeerId, peerDlspeed, transferInfo.status, peerpinfo);
|
||||
|
||||
used_rows.insert(row_id);
|
||||
|
||||
// get the sources (number of online peers)
|
||||
if (transferInfo.tfRate > 0 && fileInfo.downloadStatus == FT_STATE_DOWNLOADING)
|
||||
++active;
|
||||
}
|
||||
}
|
||||
|
||||
float fltSources = active + (float)fileInfo.peers.size()/1000;
|
||||
DLListModel->setData(DLListModel->index(row, COLUMN_SOURCES), fltSources);
|
||||
|
||||
// This is not optimal, but we deal with a small number of elements. The reverse order is really important,
|
||||
// because rows after the deleted rows change positions !
|
||||
//
|
||||
for (int r = dlItem->rowCount() - 1; r >= 0; --r) {
|
||||
if (used_rows.find(r) == used_rows.end()) {
|
||||
dlItem->removeRow(r);
|
||||
}
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
int TransfersDialog::addPeerToDLItem(QStandardItem *dlItem, const RsPeerId& peer_ID, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo)
|
||||
{
|
||||
// try to find the item
|
||||
int childRow = -1;
|
||||
|
||||
QStandardItem *childId = NULL;
|
||||
for (int count = 0; (childId = dlItem->child(count, COLUMN_ID)) != NULL; ++count) {
|
||||
if (childId->data(Qt::UserRole).toString() == coreID) {
|
||||
childRow = count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *siName = NULL;
|
||||
QStandardItem *siStatus = NULL;
|
||||
|
||||
if (childRow == -1) {
|
||||
// set this false if you want to expand on double click
|
||||
dlItem->setEditable(false);
|
||||
|
||||
QHeaderView *header = ui.downloadList->header();
|
||||
|
||||
QStandardItem *iName = new QStandardItem(); //COLUMN_NAME
|
||||
QStandardItem *iSize = new SortByNameItem(header); //COLUMN_SIZE
|
||||
QStandardItem *iCompleted = new SortByNameItem(header); //COLUMN_COMPLETED
|
||||
QStandardItem *iDlSpeed = new SortByNameItem(header); //COLUMN_DLSPEED
|
||||
QStandardItem *iProgress = new ProgressItem(header); //COLUMN_PROGRESS
|
||||
QStandardItem *iSource = new SortByNameItem(header); //COLUMN_SOURCES
|
||||
QStandardItem *iStatus = new SortByNameItem(header); //COLUMN_STATUS
|
||||
QStandardItem *iPriority = new SortByNameItem(header); //COLUMN_PRIORITY
|
||||
QStandardItem *iRemaining = new SortByNameItem(header); //COLUMN_REMAINING
|
||||
QStandardItem *iDownloadTime = new SortByNameItem(header); //COLUMN_DOWNLOADTIME
|
||||
QStandardItem *iID = new SortByNameItem(header); //COLUMN_ID
|
||||
QStandardItem *iLastDL = new SortByNameItem(header); //COLUMN_LASTDL
|
||||
QStandardItem *iPath = new SortByNameItem(header); //COLUMN_PATH
|
||||
|
||||
siName = iName;
|
||||
siStatus = iStatus;
|
||||
|
||||
QList<QStandardItem*> items;
|
||||
QString iconName;
|
||||
QString tooltip;
|
||||
iName->setData(QVariant(getPeerName(peer_ID, iconName, tooltip)), Qt::DisplayRole);
|
||||
iName->setData(QIcon(iconName), Qt::DecorationRole);
|
||||
iName->setData(QVariant(tooltip), Qt::ToolTipRole);
|
||||
iSize->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
iCompleted->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
iDlSpeed->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
||||
iProgress->setData(QVariant((float)peerInfo.progress), Qt::DisplayRole);
|
||||
iProgress->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
|
||||
iSource->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
|
||||
iPriority->setData(QVariant((double)PRIORITY_NULL), Qt::DisplayRole); // blank field for priority
|
||||
iRemaining->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
iDownloadTime->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
iID->setData(QVariant() , Qt::DisplayRole);
|
||||
iID->setData(QVariant(coreID), Qt::UserRole);
|
||||
iLastDL->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
iPath->setData(QVariant(QString()), Qt::DisplayRole);
|
||||
|
||||
items.append(iName);
|
||||
items.append(iSize);
|
||||
items.append(iCompleted);
|
||||
items.append(iDlSpeed);
|
||||
items.append(iProgress);
|
||||
items.append(iSource);
|
||||
items.append(iStatus);
|
||||
items.append(iPriority);
|
||||
items.append(iRemaining);
|
||||
items.append(iDownloadTime);
|
||||
items.append(iID);
|
||||
items.append(iLastDL);
|
||||
items.append(iPath);
|
||||
dlItem->appendRow(items);
|
||||
|
||||
childRow = dlItem->rowCount() - 1;
|
||||
} else {
|
||||
// just update the child (peer)
|
||||
dlItem->child(childRow, COLUMN_DLSPEED)->setData(QVariant((double)dlspeed), Qt::DisplayRole);
|
||||
dlItem->child(childRow, COLUMN_PROGRESS)->setData(QVariant((float)peerInfo.progress), Qt::DisplayRole);
|
||||
dlItem->child(childRow, COLUMN_PROGRESS)->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
|
||||
|
||||
siName = dlItem->child(childRow,COLUMN_NAME);
|
||||
siStatus = dlItem->child(childRow, COLUMN_STATUS);
|
||||
}
|
||||
|
||||
switch (status) {
|
||||
case FT_STATE_FAILED:
|
||||
siStatus->setData(QVariant(tr("Failed"))) ;
|
||||
siName->setData(QIcon(":/images/Client1.png"), Qt::StatusTipRole);
|
||||
break ;
|
||||
case FT_STATE_OKAY:
|
||||
siStatus->setData(QVariant(tr("Okay")));
|
||||
siName->setData(QIcon(":/images/Client2.png"), Qt::StatusTipRole);
|
||||
break ;
|
||||
case FT_STATE_WAITING:
|
||||
siStatus->setData(QVariant(tr("")));
|
||||
siName->setData(QIcon(":/images/Client3.png"), Qt::StatusTipRole);
|
||||
break ;
|
||||
case FT_STATE_DOWNLOADING:
|
||||
siStatus->setData(QVariant(tr("Transferring")));
|
||||
siName->setData(QIcon(":/images/Client0.png"), Qt::StatusTipRole);
|
||||
break ;
|
||||
case FT_STATE_COMPLETE:
|
||||
siStatus->setData(QVariant(tr("Complete")));
|
||||
siName->setData(QIcon(":/images/Client0.png"), Qt::StatusTipRole);
|
||||
break ;
|
||||
default:
|
||||
siStatus->setData(QVariant(tr("")));
|
||||
siName->setData(QIcon(":/images/Client4.png"), Qt::StatusTipRole);
|
||||
}
|
||||
|
||||
return childRow;
|
||||
}
|
||||
*/
|
||||
|
||||
int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
||||
{
|
||||
if (fileInfo.peers.empty())
|
||||
@ -1828,7 +1549,7 @@ int TransfersDialog::addULItem(int row, const FileInfo &fileInfo)
|
||||
//ULListModel->setItem(row, COLUMN_UPROGRESS, new ProgressItem(NULL));
|
||||
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UNAME), fileName);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UNAME), FilesDefs::getIconFromFilename(fileName), Qt::DecorationRole);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UNAME), FilesDefs::getIconFromFileType(fileName), Qt::DecorationRole);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UHASH), fileHash);
|
||||
ULListModel->setData(ULListModel->index(row, COLUMN_UHASH), fileHash, Qt::UserRole);
|
||||
}
|
||||
|
@ -100,11 +100,9 @@ static bool isNewerThanEpoque(uint32_t ts)
|
||||
|
||||
void RetroshareDirModel::treeStyle()
|
||||
{
|
||||
categoryIcon.addPixmap(QPixmap(":/icons/folder.png"),
|
||||
QIcon::Normal, QIcon::Off);
|
||||
categoryIcon.addPixmap(QPixmap(":/icons/folderopen.png"),
|
||||
QIcon::Normal, QIcon::On);
|
||||
peerIcon = QIcon(":/images/user/identity16.png");
|
||||
categoryIcon.addPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/folder.png"), QIcon::Normal, QIcon::Off);
|
||||
categoryIcon.addPixmap(FilesDefs::getPixmapFromQtResourcePath(":/icons/folderopen.png"), QIcon::Normal, QIcon::On);
|
||||
peerIcon = FilesDefs::getIconFromQtResourcePath(":/images/user/identity16.png");
|
||||
}
|
||||
void TreeStyle_RDM::update()
|
||||
{
|
||||
@ -349,19 +347,19 @@ const QIcon& RetroshareDirModel::getFlagsIcon(FileStorageFlags flags)
|
||||
QList<QIcon> icons ;
|
||||
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_SEARCH)
|
||||
icons.push_back(QIcon(":icons/search_red_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/search_red_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/void_128.png")) ;
|
||||
|
||||
if(flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD)
|
||||
icons.push_back(QIcon(":icons/anonymous_blue_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/anonymous_blue_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/void_128.png")) ;
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE)
|
||||
icons.push_back(QIcon(":icons/browsable_green_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/browsable_green_128.png")) ;
|
||||
else
|
||||
icons.push_back(QIcon(":icons/void_128.png")) ;
|
||||
icons.push_back(FilesDefs::getIconFromQtResourcePath(":icons/void_128.png")) ;
|
||||
|
||||
QPixmap pix ;
|
||||
GxsIdDetails::GenerateCombinedPixmap(pix, icons, 128);
|
||||
@ -399,13 +397,13 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(ageIndicator != IND_ALWAYS && now > details.max_mtime + ageIndicator)
|
||||
return QIcon(":/images/folder_grey.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_grey.png");
|
||||
else if (ageIndicator == IND_LAST_DAY )
|
||||
return QIcon(":/images/folder_green.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_green.png");
|
||||
else if (ageIndicator == IND_LAST_WEEK )
|
||||
return QIcon(":/images/folder_yellow.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_yellow.png");
|
||||
else if (ageIndicator == IND_LAST_MONTH )
|
||||
return QIcon(":/images/folder_red.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_red.png");
|
||||
else
|
||||
return (QIcon(peerIcon));
|
||||
}
|
||||
@ -414,13 +412,13 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(ageIndicator != IND_ALWAYS && now > details.max_mtime + ageIndicator)
|
||||
return QIcon(":/images/folder_grey.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_grey.png");
|
||||
else if (ageIndicator == IND_LAST_DAY )
|
||||
return QIcon(":/images/folder_green.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_green.png");
|
||||
else if (ageIndicator == IND_LAST_WEEK )
|
||||
return QIcon(":/images/folder_yellow.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_yellow.png");
|
||||
else if (ageIndicator == IND_LAST_MONTH )
|
||||
return QIcon(":/images/folder_red.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/folder_red.png");
|
||||
else
|
||||
return QIcon(categoryIcon);
|
||||
}
|
||||
@ -428,9 +426,9 @@ QVariant RetroshareDirModel::decorationRole(const DirDetails& details,int coln)
|
||||
{
|
||||
// extensions predefined
|
||||
if(details.hash.isNull())
|
||||
return QIcon(":/images/reset.png") ; // file is being hashed
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/reset.png") ; // file is being hashed
|
||||
else
|
||||
return FilesDefs::getIconFromFilename(QString::fromUtf8(details.name.c_str()));
|
||||
return FilesDefs::getIconFromFileType(QString::fromUtf8(details.name.c_str()));
|
||||
}
|
||||
else
|
||||
return QVariant();
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
//#define DEBUG_FILESDEFS 1
|
||||
|
||||
static QString getInfoFromFilename(const QString& filename, bool anyForUnknown, bool image)
|
||||
{
|
||||
QString ext = QFileInfo(filename).suffix().toLower();
|
||||
@ -85,23 +87,69 @@ QString FilesDefs::getImageFromFilename(const QString& filename, bool anyForUnkn
|
||||
return getInfoFromFilename(filename, anyForUnknown, true);
|
||||
}
|
||||
|
||||
QIcon FilesDefs::getIconFromFilename(const QString& filename)
|
||||
QPixmap FilesDefs::getPixmapFromQtResourcePath(const QString& resource_path)
|
||||
{
|
||||
QString sImage = getInfoFromFilename(filename, true, true);
|
||||
static std::map<QString,QIcon> mIconCache;
|
||||
QIcon icon;
|
||||
auto item = mIconCache.find(sImage);
|
||||
if (item == mIconCache.end())
|
||||
static std::map<QString,QPixmap> mPixmapCache;
|
||||
QPixmap pixmap;
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << "Creating Pixmap from resource path " << resource_path.toStdString() ;
|
||||
#endif
|
||||
|
||||
auto item = mPixmapCache.find(resource_path);
|
||||
|
||||
if (item == mPixmapCache.end())
|
||||
{
|
||||
icon = QIcon(sImage);
|
||||
mIconCache[sImage] = icon;
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << " Not in cache. Creating new one." << std::endl;
|
||||
#endif
|
||||
pixmap = QPixmap(resource_path);
|
||||
mPixmapCache[resource_path] = pixmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << " In cache. " << std::endl;
|
||||
#endif
|
||||
pixmap = item->second;
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
QIcon FilesDefs::getIconFromQtResourcePath(const QString& resource_path)
|
||||
{
|
||||
static std::map<QString,QIcon> mIconCache;
|
||||
QIcon icon;
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << "Creating Icon from resource path " << resource_path.toStdString() ;
|
||||
#endif
|
||||
|
||||
auto item = mIconCache.find(resource_path);
|
||||
|
||||
if (item == mIconCache.end())
|
||||
{
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << " Not in cache. Creating new one." << std::endl;
|
||||
#endif
|
||||
icon = QIcon(resource_path);
|
||||
mIconCache[resource_path] = icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_FILESDEFS
|
||||
std::cerr << " In cache. " << std::endl;
|
||||
#endif
|
||||
icon = item->second;
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
QIcon FilesDefs::getIconFromFileType(const QString& filename)
|
||||
{
|
||||
return getIconFromQtResourcePath(getInfoFromFilename(filename,true,true));
|
||||
}
|
||||
|
||||
QString FilesDefs::getNameFromFilename(const QString &filename)
|
||||
{
|
||||
return getInfoFromFilename(filename, false, false);
|
||||
|
@ -28,7 +28,18 @@ class FilesDefs
|
||||
{
|
||||
public:
|
||||
static QString getImageFromFilename(const QString& filename, bool anyForUnknown);
|
||||
static QIcon getIconFromFilename(const QString& filename);
|
||||
|
||||
// Theses methods is here to fix a Qt design flow that makes QIcon loaded from filename (e.g. :/images/icon.png) to not use the cache.
|
||||
// As a result, icons created by Qt in this way (mostly from GUI) do not use data sharing.
|
||||
// The method below has its own cache.
|
||||
|
||||
static QIcon getIconFromQtResourcePath(const QString& resource_path);
|
||||
static QPixmap getPixmapFromQtResourcePath(const QString& resource_path);
|
||||
|
||||
// This method returns a QIcon that is suitable to represent a file of a particular type (image, movie, etc.)
|
||||
|
||||
static QIcon getIconFromFileType(const QString& filename);
|
||||
|
||||
static QString getNameFromFilename(const QString& filename);
|
||||
};
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QIcon>
|
||||
|
||||
#include "gui/common/StatusDefs.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/common/AvatarDefs.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
@ -815,13 +816,13 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
||||
|
||||
switch(entry.type)
|
||||
{
|
||||
case ENTRY_TYPE_GROUP: return QVariant(QIcon(IMAGE_GROUP24));
|
||||
case ENTRY_TYPE_GROUP: return QVariant(FilesDefs::getIconFromQtResourcePath(IMAGE_GROUP24));
|
||||
|
||||
case ENTRY_TYPE_PROFILE:
|
||||
{
|
||||
if(!isProfileExpanded(entry))
|
||||
{
|
||||
QPixmap sslAvatar(AVATAR_DEFAULT_IMAGE);
|
||||
QPixmap sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE);
|
||||
|
||||
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QStyle>
|
||||
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "rshare.h"
|
||||
#include "GxsChannelPostItem.h"
|
||||
#include "ui_GxsChannelPostItem.h"
|
||||
@ -44,21 +45,56 @@
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate)
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group_meta, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate),
|
||||
mGroupMeta(group_meta)
|
||||
{
|
||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
init(messageId,older_versions) ;
|
||||
mPost.mMeta.mGroupId = mGroupMeta.mGroupId;
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
setup();
|
||||
|
||||
// no call to loadGroup() here because we have it already.
|
||||
}
|
||||
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) // this one should be in GxsFeedItem
|
||||
{
|
||||
mPost.mMeta.mMsgId.clear(); // security
|
||||
init(post.mMeta.mMsgId,older_versions) ;
|
||||
mPost = post ;
|
||||
mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded
|
||||
|
||||
QVector<RsGxsMessageId> v;
|
||||
//bool self = false;
|
||||
|
||||
for(std::set<RsGxsMessageId>::const_iterator it(older_versions.begin());it!=older_versions.end();++it)
|
||||
v.push_back(*it) ;
|
||||
|
||||
if(older_versions.find(messageId) == older_versions.end())
|
||||
v.push_back(messageId);
|
||||
|
||||
setMessageVersions(v) ;
|
||||
setup();
|
||||
|
||||
loadGroup();
|
||||
}
|
||||
|
||||
// GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate,const std::set<RsGxsMessageId>& older_versions) :
|
||||
// GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||
// {
|
||||
// mPost.mMeta.mMsgId.clear(); // security
|
||||
// init(post.mMeta.mMsgId,older_versions) ;
|
||||
// mPost = post ;
|
||||
// }
|
||||
|
||||
void GxsChannelPostItem::init(const RsGxsMessageId& messageId,const std::set<RsGxsMessageId>& older_versions)
|
||||
{
|
||||
QVector<RsGxsMessageId> v;
|
||||
@ -86,7 +122,11 @@ void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
mLoaded = true ;
|
||||
|
||||
requestGroup();
|
||||
std::set<RsGxsMessageId> older_versions; // not so nice. We need to use std::set everywhere
|
||||
for(auto& m:messageVersions())
|
||||
older_versions.insert(m);
|
||||
|
||||
fill();
|
||||
requestMessage();
|
||||
requestComment();
|
||||
}
|
||||
@ -107,9 +147,28 @@ bool GxsChannelPostItem::isUnread() const
|
||||
void GxsChannelPostItem::setup()
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
|
||||
ui = new Ui::GxsChannelPostItem;
|
||||
ui->setupUi(this);
|
||||
|
||||
// Manually set icons to allow to use clever resource sharing that is missing in Qt for Icons loaded from Qt resource file.
|
||||
// This is particularly important here because a channel may contain many posts, so duplicating the QImages here is deadly for the
|
||||
// memory.
|
||||
|
||||
ui->logoLabel->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/thumb-default-video.png"));
|
||||
ui->warn_image_label->setPixmap(FilesDefs::getPixmapFromQtResourcePath(":/images/status_unknown.png"));
|
||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
||||
ui->voteUpButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_up.png"));
|
||||
ui->voteDownButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/vote_down.png"));
|
||||
ui->downloadButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/download.png"));
|
||||
ui->playButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/play.png"));
|
||||
ui->commentButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/commnt.png"));
|
||||
ui->editButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/pencil-edit-button.png"));
|
||||
ui->copyLinkButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/copy.png"));
|
||||
ui->expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/down-arrow.png"));
|
||||
ui->readAndClearButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/correct.png"));
|
||||
ui->clearButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/icons/png/exit2.png"));
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
mInFill = false;
|
||||
@ -165,29 +224,6 @@ void GxsChannelPostItem::setup()
|
||||
ui->expandFrame->hide();
|
||||
}
|
||||
|
||||
bool GxsChannelPostItem::setGroup(const RsGxsChannelGroup &group, bool doFill)
|
||||
{
|
||||
if (groupId() != group.mMeta.mGroupId) {
|
||||
std::cerr << "GxsChannelPostItem::setGroup() - Wrong id, cannot set post";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
mGroup = group;
|
||||
|
||||
// If not publisher, hide the edit button. Without the publish key, there's no way to edit a message.
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "Group subscribe flags = " << std::hex << mGroup.mMeta.mSubscribeFlags << std::dec << std::endl ;
|
||||
#endif
|
||||
if( !IS_GROUP_PUBLISHER(mGroup.mMeta.mSubscribeFlags) )
|
||||
ui->editButton->hide() ;
|
||||
|
||||
if (doFill) {
|
||||
fill();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsChannelPostItem::setPost(const RsGxsChannelPost &post, bool doFill)
|
||||
{
|
||||
@ -222,7 +258,7 @@ QString GxsChannelPostItem::getMsgLabel()
|
||||
|
||||
QString GxsChannelPostItem::groupName()
|
||||
{
|
||||
return QString::fromUtf8(mGroup.mMeta.mGroupName.c_str());
|
||||
return QString::fromUtf8(mGroupMeta.mGroupName.c_str());
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadComments()
|
||||
@ -231,46 +267,6 @@ void GxsChannelPostItem::loadComments()
|
||||
comments(title);
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadGroup()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups))
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
setGroup(group);
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadMessage()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
@ -292,7 +288,9 @@ void GxsChannelPostItem::loadMessage()
|
||||
|
||||
if (posts.size() == 1)
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl;
|
||||
#endif
|
||||
const RsGxsChannelPost& post(posts[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this );
|
||||
@ -300,7 +298,9 @@ void GxsChannelPostItem::loadMessage()
|
||||
else if(comments.size() == 1)
|
||||
{
|
||||
const RsGxsComment& cmt = comments[0];
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl;
|
||||
#endif
|
||||
|
||||
RsQThreadUtils::postToObject( [cmt,this]()
|
||||
{
|
||||
@ -317,8 +317,10 @@ void GxsChannelPostItem::loadMessage()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelPostItem::loadMessage() Wrong number of Items. Remove It.";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsQThreadUtils::postToObject( [this]() { removeItem(); }, this );
|
||||
}
|
||||
@ -408,6 +410,9 @@ void GxsChannelPostItem::fill()
|
||||
ui->logoLabel->setPixmap(thumbnail);
|
||||
}
|
||||
|
||||
if( !IS_GROUP_PUBLISHER(mGroupMeta.mSubscribeFlags) )
|
||||
ui->editButton->hide() ;
|
||||
|
||||
if (!mIsHome)
|
||||
{
|
||||
if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) {
|
||||
@ -422,7 +427,7 @@ void GxsChannelPostItem::fill()
|
||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName());
|
||||
//ui->subjectLabel->setText(msgLink.toHtml());
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))
|
||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||
{
|
||||
ui->unsubscribeButton->setEnabled(true);
|
||||
}
|
||||
@ -461,7 +466,7 @@ void GxsChannelPostItem::fill()
|
||||
ui->unsubscribeButton->hide();
|
||||
ui->copyLinkButton->show();
|
||||
|
||||
if (IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroup.mMeta.mSubscribeFlags))
|
||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||
{
|
||||
ui->readButton->setVisible(true);
|
||||
|
||||
@ -586,12 +591,12 @@ void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
|
||||
if (isUnread)
|
||||
{
|
||||
ui->readButton->setChecked(true);
|
||||
ui->readButton->setIcon(QIcon(":/images/message-state-unread.png"));
|
||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->readButton->setChecked(false);
|
||||
ui->readButton->setIcon(QIcon(":/images/message-state-read.png"));
|
||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png"));
|
||||
}
|
||||
|
||||
ui->newLabel->setVisible(isNew);
|
||||
@ -704,7 +709,7 @@ void GxsChannelPostItem::doExpand(bool open)
|
||||
if (open)
|
||||
{
|
||||
ui->expandFrame->show();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/icons/png/up-arrow.png")));
|
||||
ui->expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/up-arrow.png")));
|
||||
ui->expandButton->setToolTip(tr("Hide"));
|
||||
|
||||
readToggled(false);
|
||||
@ -712,7 +717,7 @@ void GxsChannelPostItem::doExpand(bool open)
|
||||
else
|
||||
{
|
||||
ui->expandFrame->hide();
|
||||
ui->expandButton->setIcon(QIcon(QString(":/icons/png/down-arrow.png")));
|
||||
ui->expandButton->setIcon(FilesDefs::getIconFromQtResourcePath(QString(":/icons/png/down-arrow.png")));
|
||||
ui->expandButton->setToolTip(tr("Expand"));
|
||||
}
|
||||
|
||||
@ -746,7 +751,6 @@ void GxsChannelPostItem::readAndClearItem()
|
||||
std::cerr << "GxsChannelPostItem::readAndClearItem()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
readToggled(false);
|
||||
removeItem();
|
||||
}
|
||||
@ -774,7 +778,7 @@ void GxsChannelPostItem::download()
|
||||
|
||||
void GxsChannelPostItem::edit()
|
||||
{
|
||||
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mGroup.mMeta.mGroupId,mPost.mMeta.mMsgId);
|
||||
CreateGxsChannelMsg *msgDialog = new CreateGxsChannelMsg(mGroupMeta.mGroupId,mPost.mMeta.mMsgId);
|
||||
msgDialog->show();
|
||||
}
|
||||
|
||||
@ -829,3 +833,43 @@ void GxsChannelPostItem::makeUpVote()
|
||||
|
||||
emit vote(msgId, true);
|
||||
}
|
||||
|
||||
void GxsChannelPostItem::loadGroup()
|
||||
{
|
||||
#ifdef DEBUG_ITEM
|
||||
std::cerr << "GxsChannelGroupItem::loadGroup()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
// 1 - get group data
|
||||
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
const std::list<RsGxsGroupId> groupIds = { groupId() };
|
||||
|
||||
if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group
|
||||
{
|
||||
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
RsGxsChannelGroup group(groups[0]);
|
||||
|
||||
RsQThreadUtils::postToObject( [group,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
mGroupMeta = group.mMeta;
|
||||
|
||||
}, this );
|
||||
});
|
||||
}
|
||||
|
@ -42,15 +42,18 @@ public:
|
||||
// It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of
|
||||
// previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed.
|
||||
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
// This method can be called when additional information is known about the post. In this case, the widget will be initialized with some
|
||||
// minimap information from the post and completed when the use displays it, which shouldn't cost anything more.
|
||||
// This one is used in channel thread widget. We don't want the group data to reload at every post, so we load it in the hosting
|
||||
// GxsChannelsPostsWidget and pass it to created items.
|
||||
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
// // This method can be called when additional information is known about the post. In this case, the widget will be initialized with some
|
||||
// // minimap information from the post and completed when the use displays it, which shouldn't cost anything more.
|
||||
//
|
||||
// GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost& post, bool isHome, bool autoUpdate, const std::set<RsGxsMessageId>& older_versions = std::set<RsGxsMessageId>());
|
||||
|
||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||
virtual ~GxsChannelPostItem();
|
||||
|
||||
uint64_t uniqueIdentifier() const override { return hash_64bits("GxsChannelPostItem " + messageId().toStdString()) ; }
|
||||
@ -65,6 +68,7 @@ public:
|
||||
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
||||
|
||||
bool isUnread() const ;
|
||||
const std::set<RsGxsMessageId>& olderVersions() const { return mPost.mOlderVersions; }
|
||||
|
||||
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
|
||||
protected:
|
||||
@ -120,7 +124,7 @@ private:
|
||||
bool mCloseOnRead;
|
||||
bool mLoaded;
|
||||
|
||||
RsGxsChannelGroup mGroup;
|
||||
RsGroupMetaData mGroupMeta;
|
||||
RsGxsChannelPost mPost;
|
||||
|
||||
std::list<SubFileItem*> mFileItems;
|
||||
|
@ -62,9 +62,6 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/thumb-default-video.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -156,9 +153,6 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../images.qrc">:/images/status_unknown.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -213,10 +207,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Toggle Message Read Status</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -249,10 +239,6 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -263,10 +249,6 @@
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/vote_down.png</normaloff>:/images/vote_down.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -277,10 +259,6 @@
|
||||
<property name="text">
|
||||
<string>Download</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -294,10 +272,6 @@
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/play.png</normaloff>:/icons/png/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -305,10 +279,6 @@
|
||||
<property name="text">
|
||||
<string>Comments</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/comment.png</normaloff>:/icons/png/comment.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -316,10 +286,6 @@
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/pencil-edit-button.png</normaloff>:/icons/png/pencil-edit-button.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -336,10 +302,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Copy RetroShare Link</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/copy.png</normaloff>:/icons/png/copy.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -398,10 +360,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Expand</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/down-arrow.png</normaloff>:/icons/png/down-arrow.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -418,10 +376,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Set as read and remove item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/correct.png</normaloff>:/icons/png/correct.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -438,10 +392,6 @@
|
||||
<property name="toolTip">
|
||||
<string>Remove Item</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/exit2.png</normaloff>:/icons/png/exit2.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <QTextDocument>
|
||||
|
||||
#include "gui/common/RSElidedItemDelegate.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "gui/gxs/GxsCommentTreeWidget.h"
|
||||
#include "gui/gxs/GxsCreateCommentDialog.h"
|
||||
#include "gui/gxs/GxsIdTreeWidgetItem.h"
|
||||
@ -186,18 +187,18 @@ void GxsCommentTreeWidget::setCurrentCommentMsgId(QTreeWidgetItem *current, QTre
|
||||
void GxsCommentTreeWidget::customPopUpMenu(const QPoint& /*point*/)
|
||||
{
|
||||
QMenu contextMnu( this );
|
||||
QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
||||
QAction* action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
||||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||
action->setDisabled(mMsgVersions.empty());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPY), tr("Copy Comment"), this, SLOT(copyComment()));
|
||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_COPY), tr("Copy Comment"), this, SLOT(copyComment()));
|
||||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
action = contextMnu.addAction(QIcon(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp()));
|
||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEUP), tr("Vote Up"), this, SLOT(voteUp()));
|
||||
action->setDisabled(mVoterId.isNull());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown()));
|
||||
action = contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_VOTEDOWN), tr("Vote Down"), this, SLOT(voteDown()));
|
||||
action->setDisabled(mVoterId.isNull());
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ void GxsMessageFramePostWidget::loadGroupData()
|
||||
|
||||
RsThread::async([this]()
|
||||
{
|
||||
RsGxsGenericGroupData *data;
|
||||
RsGxsGenericGroupData *data = nullptr;
|
||||
getGroupData(data);
|
||||
|
||||
if(!data)
|
||||
|
@ -67,7 +67,6 @@ protected:
|
||||
virtual void fillThreadCreatePost(const QVariant &/*post*/, bool /*related*/, int /*current*/, int /*count*/) {}
|
||||
|
||||
/* GXS functions */
|
||||
void requestGroupData();
|
||||
void loadGroupData();
|
||||
void loadAllPosts();
|
||||
void loadPosts(const std::set<RsGxsMessageId>& msgIds);
|
||||
|
@ -458,19 +458,24 @@ void GxsChannelPostsWidget::filterChanged(int filter)
|
||||
return bVisible;
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
|
||||
#ifdef TODO
|
||||
void GxsChannelPostsWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,bool related)
|
||||
{
|
||||
GxsChannelPostItem *item = NULL;
|
||||
RsGxsChannelPost post;
|
||||
|
||||
if(!post.mMeta.mOrigMsgId.isNull())
|
||||
if(!meta.mOrigMsgId.isNull())
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mOrigMsgId)) ;
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
|
||||
if(item)
|
||||
{
|
||||
post = feedItem->post();
|
||||
ui->feedWidget->removeFeedItem(item) ;
|
||||
|
||||
post.mOlderVersions.insert(post.mMeta.mMsgId);
|
||||
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
|
||||
@ -480,19 +485,72 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
|
||||
|
||||
if (related)
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mMsgId)) ;
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
}
|
||||
if (item) {
|
||||
if (item)
|
||||
{
|
||||
item->setPost(post);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
} else {
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
else
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
ui->fileWidget->addFiles(post, related);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
|
||||
{
|
||||
GxsChannelPostItem *item = NULL;
|
||||
|
||||
const RsMsgMetaData& meta(post.mMeta);
|
||||
|
||||
if(!meta.mOrigMsgId.isNull())
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
|
||||
if(item)
|
||||
{
|
||||
std::set<RsGxsMessageId> older_versions(item->olderVersions()); // we make a copy because the item will be deleted
|
||||
ui->feedWidget->removeFeedItem(item) ;
|
||||
|
||||
older_versions.insert(meta.mMsgId);
|
||||
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, false,older_versions);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (related)
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
}
|
||||
if (item)
|
||||
{
|
||||
item->setPost(post);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
else
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup.mMeta,meta.mMsgId, true, true);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
ui->fileWidget->addFiles(post, related);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GxsChannelPostsWidget::fillThreadCreatePost(const QVariant &post, bool related, int current, int count)
|
||||
{
|
||||
@ -738,9 +796,16 @@ void GxsChannelPostsWidget::toggleAutoDownload()
|
||||
|
||||
bool GxsChannelPostsWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
||||
{
|
||||
insertChannelDetails(*dynamic_cast<const RsGxsChannelGroup*>(data));
|
||||
return true;
|
||||
const RsGxsChannelGroup *d = dynamic_cast<const RsGxsChannelGroup*>(data);
|
||||
|
||||
if(!d)
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Cannot dynamic cast input data (" << (void*)data << " to RsGxsGenericGroupData. Something bad happenned." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
insertChannelDetails(*d);
|
||||
return true;
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,std::vector<RsGxsGenericMsgData*>& psts)
|
||||
@ -771,11 +836,18 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& pst
|
||||
|
||||
bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
||||
{
|
||||
if(groupId().isNull())
|
||||
{
|
||||
RsErr() << __PRETTY_FUNCTION__ << " Trying to get data about null group!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
std::vector<RsGxsChannelGroup> groups;
|
||||
|
||||
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({groupId()}),groups) && groups.size()==1)
|
||||
{
|
||||
data = new RsGxsChannelGroup(groups[0]);
|
||||
|
||||
mGroup = groups[0]; // make a local copy to pass on to items
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -786,6 +858,7 @@ bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
||||
{
|
||||
insertChannelDetails(distant_group);
|
||||
data = new RsGxsChannelGroup(distant_group);
|
||||
mGroup = distant_group; // make a local copy to pass on to items
|
||||
return true ;
|
||||
}
|
||||
}
|
||||
@ -797,7 +870,7 @@ void GxsChannelPostsWidget::insertAllPosts(const std::vector<RsGxsGenericMsgData
|
||||
{
|
||||
std::vector<RsGxsChannelPost> cposts;
|
||||
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some time, and the cposts list is being modified in the insert method.
|
||||
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
||||
|
||||
insertChannelPosts(cposts, thread, false);
|
||||
|
@ -106,6 +106,7 @@ private:
|
||||
private:
|
||||
QAction *mAutoDownloadAction;
|
||||
|
||||
RsGxsChannelGroup mGroup;
|
||||
bool mUseThread;
|
||||
RsEventsHandlerId_t mEventHandlerId ;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QModelIndex>
|
||||
#include <QIcon>
|
||||
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
@ -359,8 +360,8 @@ QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*
|
||||
if(role == Qt::DecorationRole)
|
||||
switch(section)
|
||||
{
|
||||
case COLUMN_THREAD_DISTRIBUTION: return QIcon(":/icons/flag-green.png");
|
||||
case COLUMN_THREAD_READ: return QIcon(":/images/message-state-read.png");
|
||||
case COLUMN_THREAD_DISTRIBUTION: return FilesDefs::getIconFromQtResourcePath(":/icons/flag-green.png");
|
||||
case COLUMN_THREAD_READ: return FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -819,7 +819,10 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
|
||||
bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||
|
||||
if(setToReadOnActive)
|
||||
{
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
mThreadModel->setMsgReadStatus(src_index, true,false);
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
@ -839,6 +842,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
|
||||
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
||||
{
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
ForumModelPostEntry fmpe;
|
||||
|
||||
QModelIndex src_index = mThreadProxyModel->mapToSource(index);
|
||||
@ -847,6 +851,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "Setting message read status to false" << std::endl;
|
||||
#endif
|
||||
|
||||
mThreadModel->setMsgReadStatus(src_index, IS_MSG_UNREAD(fmpe.mMsgStatus),false);
|
||||
}
|
||||
#ifdef DEBUG_FORUMS
|
||||
@ -1270,6 +1275,7 @@ void GxsForumThreadWidget::markMsgAsReadUnread (bool read, bool children, bool f
|
||||
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) {
|
||||
return;
|
||||
}
|
||||
saveExpandedItems(mSavedExpandedMessages);
|
||||
|
||||
if(forum)
|
||||
mThreadModel->setMsgReadStatus(mThreadModel->root(),read,children);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QIcon>
|
||||
|
||||
#include "gui/common/TagDefs.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/HandleRichText.h"
|
||||
#include "util/DateTime.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
@ -171,9 +172,9 @@ QVariant RsMessageModel::headerData(int section, Qt::Orientation orientation, in
|
||||
if(role == Qt::DecorationRole)
|
||||
switch(section)
|
||||
{
|
||||
case COLUMN_THREAD_STAR: return QIcon(IMAGE_STAR_ON);
|
||||
case COLUMN_THREAD_READ: return QIcon(":/images/message-state-header.png");
|
||||
case COLUMN_THREAD_ATTACHMENT: return QIcon(":/icons/png/attachements.png");
|
||||
case COLUMN_THREAD_STAR: return FilesDefs::getIconFromQtResourcePath(IMAGE_STAR_ON);
|
||||
case COLUMN_THREAD_READ: return FilesDefs::getIconFromQtResourcePath(":/images/message-state-header.png");
|
||||
case COLUMN_THREAD_ATTACHMENT: return FilesDefs::getIconFromQtResourcePath(":/icons/png/attachements.png");
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -511,39 +512,39 @@ QVariant RsMessageModel::decorationRole(const Rs::Msgs::MsgInfoSummary& fmpe,int
|
||||
{
|
||||
if(col == COLUMN_THREAD_READ)
|
||||
if(fmpe.msgflags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER))
|
||||
return QIcon(":/images/message-state-unread.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png");
|
||||
else
|
||||
return QIcon(":/images/message-state-read.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png");
|
||||
|
||||
if(col == COLUMN_THREAD_SUBJECT)
|
||||
{
|
||||
if(fmpe.msgflags & RS_MSG_NEW ) return QIcon(":/images/message-state-new.png");
|
||||
if(fmpe.msgflags & RS_MSG_USER_REQUEST) return QIcon(":/images/user/user_request16.png");
|
||||
if(fmpe.msgflags & RS_MSG_FRIEND_RECOMMENDATION) return QIcon(":/images/user/friend_suggestion16.png");
|
||||
if(fmpe.msgflags & RS_MSG_PUBLISH_KEY) return QIcon(":/images/share-icon-16.png");
|
||||
if(fmpe.msgflags & RS_MSG_NEW ) return FilesDefs::getIconFromQtResourcePath(":/images/message-state-new.png");
|
||||
if(fmpe.msgflags & RS_MSG_USER_REQUEST) return FilesDefs::getIconFromQtResourcePath(":/images/user/user_request16.png");
|
||||
if(fmpe.msgflags & RS_MSG_FRIEND_RECOMMENDATION) return FilesDefs::getIconFromQtResourcePath(":/images/user/friend_suggestion16.png");
|
||||
if(fmpe.msgflags & RS_MSG_PUBLISH_KEY) return FilesDefs::getIconFromQtResourcePath(":/images/share-icon-16.png");
|
||||
|
||||
if(fmpe.msgflags & RS_MSG_UNREAD_BY_USER)
|
||||
{
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) return QIcon(":/images/message-mail-replied.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_FORWARDED) return QIcon(":/images/message-mail-forwarded.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == (RS_MSG_REPLIED | RS_MSG_FORWARDED)) return QIcon(":/images/message-mail-replied-forw.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-replied.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_FORWARDED) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-forwarded.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == (RS_MSG_REPLIED | RS_MSG_FORWARDED)) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-replied-forw.png");
|
||||
|
||||
return QIcon(":/images/message-mail.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/message-mail.png");
|
||||
}
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) return QIcon(":/images/message-mail-replied-read.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_FORWARDED) return QIcon(":/images/message-mail-forwarded-read.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == (RS_MSG_REPLIED | RS_MSG_FORWARDED)) return QIcon(":/images/message-mail-replied-forw-read.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-replied-read.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_FORWARDED) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-forwarded-read.png");
|
||||
if((fmpe.msgflags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == (RS_MSG_REPLIED | RS_MSG_FORWARDED)) return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-replied-forw-read.png");
|
||||
|
||||
return QIcon(":/images/message-mail-read.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(":/images/message-mail-read.png");
|
||||
}
|
||||
|
||||
if(col == COLUMN_THREAD_STAR)
|
||||
return QIcon((fmpe.msgflags & RS_MSG_STAR) ? (IMAGE_STAR_ON ): (IMAGE_STAR_OFF));
|
||||
return FilesDefs::getIconFromQtResourcePath((fmpe.msgflags & RS_MSG_STAR) ? (IMAGE_STAR_ON ): (IMAGE_STAR_OFF));
|
||||
|
||||
bool isNew = fmpe.msgflags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER);
|
||||
|
||||
if(col == COLUMN_THREAD_READ)
|
||||
return QIcon(isNew ? ":/images/message-state-unread.png": ":/images/message-state-read.png");
|
||||
return FilesDefs::getIconFromQtResourcePath(isNew ? ":/images/message-state-unread.png": ":/images/message-state-read.png");
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user