mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 17:15:47 -04:00
added unicode support for file names. Not completely fixed though
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.4.x@1654 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8658ceda8d
commit
7e596c58bb
3 changed files with 60 additions and 57 deletions
|
@ -477,7 +477,7 @@ void SearchDialog::searchKeywords()
|
|||
{
|
||||
fd = *resultsIter;
|
||||
// get this file's extension
|
||||
qName = QString::fromStdString(fd.name);
|
||||
qName = QString::fromUtf8(fd.name.c_str());
|
||||
extIndex = qName.lastIndexOf(".");
|
||||
if (extIndex >= 0) {
|
||||
qExt = qName.mid(extIndex+1);
|
||||
|
@ -514,7 +514,7 @@ void SearchDialog::resultsToTree(std::string txt, std::list<FileDetail> results)
|
|||
for(it = results.begin(); it != results.end(); it++)
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(SR_NAME_COL, QString::fromStdString(it->name));
|
||||
item->setText(SR_NAME_COL, QString::fromUtf8(it->name.c_str()));
|
||||
item->setText(SR_HASH_COL, QString::fromStdString(it->hash));
|
||||
item->setText(SR_SEARCH_ID_COL, QString::fromStdString(out.str()));
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
DLDelegate = new DLListDelegate();
|
||||
ui.downloadList->setItemDelegate(DLDelegate);
|
||||
|
||||
ui.downloadList->setAutoScroll(false) ;
|
||||
// ui.downloadList->setAutoScroll(false) ;
|
||||
|
||||
//Selection Setup
|
||||
selection = ui.downloadList->selectionModel();
|
||||
|
@ -111,7 +111,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
|||
ULDelegate = new ULListDelegate();
|
||||
ui.uploadsList->setItemDelegate(ULDelegate);
|
||||
|
||||
ui.uploadsList->setAutoScroll(false) ;
|
||||
// ui.uploadsList->setAutoScroll(false) ;
|
||||
ui.uploadsList->setRootIsDecorated(false);
|
||||
|
||||
//Selection Setup
|
||||
|
@ -191,8 +191,8 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||
|
||||
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||
// clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||
// connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||
|
||||
contextMnu.clear();
|
||||
if (addPlayOption)
|
||||
|
@ -203,7 +203,7 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
|||
|
||||
contextMnu.addAction( cancelAct);
|
||||
contextMnu.addSeparator();
|
||||
contextMnu.addAction( clearcompletedAct);
|
||||
// contextMnu.addAction( clearcompletedAct);
|
||||
contextMnu.exec( mevent->globalPos() );
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ void TransfersDialog::insertTransfers()
|
|||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
name = QString::fromUtf8(info.fname.c_str());
|
||||
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||
|
||||
switch(pit->status)
|
||||
|
@ -436,7 +436,7 @@ void TransfersDialog::insertTransfers()
|
|||
status = tr("Complete");
|
||||
}
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
dlspeed = (pit->status == FT_STATE_DOWNLOADING)?( pit->tfRate * 1024.0 ) :0.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
|
@ -459,7 +459,7 @@ void TransfersDialog::insertTransfers()
|
|||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
name = QString::fromUtf8(info.fname.c_str());
|
||||
sources = tr("Unknown");
|
||||
|
||||
switch(info.downloadStatus)
|
||||
|
@ -483,14 +483,13 @@ void TransfersDialog::insertTransfers()
|
|||
|
||||
}
|
||||
|
||||
dlspeed = info.tfRate * 1024.0;
|
||||
dlspeed = (pit->status == FT_STATE_DOWNLOADING)?( pit->tfRate * 1024.0 ) :0.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
addItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining);
|
||||
|
||||
/* if found in selectedIds -> select again */
|
||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
||||
|
@ -516,7 +515,7 @@ void TransfersDialog::insertTransfers()
|
|||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
name = QString::fromUtf8(info.fname.c_str());
|
||||
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||
|
||||
switch(pit->status)
|
||||
|
@ -545,7 +544,7 @@ void TransfersDialog::insertTransfers()
|
|||
// status = "Complete";
|
||||
// }
|
||||
|
||||
dlspeed = pit->tfRate * 1024.0;
|
||||
dlspeed = (pit->status == FT_STATE_DOWNLOADING)?( pit->tfRate * 1024.0 ) :0.0;
|
||||
fileSize = info.size;
|
||||
completed = info.transfered;
|
||||
progress = info.transfered * 100.0 / info.size;
|
||||
|
@ -560,7 +559,7 @@ void TransfersDialog::insertTransfers()
|
|||
{
|
||||
symbol = "";
|
||||
coreId = QString::fromStdString(info.hash);
|
||||
name = QString::fromStdString(info.fname);
|
||||
name = QString::fromUtf8(info.fname.c_str());
|
||||
sources = tr("Unknown");
|
||||
|
||||
switch(info.downloadStatus)
|
||||
|
@ -590,8 +589,7 @@ void TransfersDialog::insertTransfers()
|
|||
progress = info.transfered * 100.0 / info.size;
|
||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
||||
dlspeed, sources, status, completed, remaining);
|
||||
addUploadItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining);
|
||||
ulCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <set>
|
||||
|
||||
#include "gui/Preferences/rsharesettings.h"
|
||||
#include "RemoteDirModel.h"
|
||||
#include "rsfiles.h"
|
||||
|
||||
|
@ -24,7 +25,12 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
|||
|
||||
}
|
||||
|
||||
|
||||
std::wstring getWString(const std::string& s)
|
||||
{
|
||||
std::wstring w ;
|
||||
for(int i=0;i<s.length();++i)
|
||||
w.push_back(s[i]) ;
|
||||
}
|
||||
|
||||
bool RemoteDirModel::hasChildren(const QModelIndex &parent) const
|
||||
{
|
||||
|
@ -392,8 +398,7 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
|||
{
|
||||
switch(coln)
|
||||
{
|
||||
case 0:
|
||||
return QString::fromStdString(details.name);
|
||||
case 0: return QString::fromUtf8(details.name.c_str()) ;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
|
@ -427,7 +432,7 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
|||
switch(coln)
|
||||
{
|
||||
case 0:
|
||||
return QString::fromStdString(details.name);
|
||||
return QString::fromUtf8(details.name.c_str());
|
||||
break;
|
||||
case 1:
|
||||
//return QString("");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue