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;
|
fd = *resultsIter;
|
||||||
// get this file's extension
|
// get this file's extension
|
||||||
qName = QString::fromStdString(fd.name);
|
qName = QString::fromUtf8(fd.name.c_str());
|
||||||
extIndex = qName.lastIndexOf(".");
|
extIndex = qName.lastIndexOf(".");
|
||||||
if (extIndex >= 0) {
|
if (extIndex >= 0) {
|
||||||
qExt = qName.mid(extIndex+1);
|
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++)
|
for(it = results.begin(); it != results.end(); it++)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
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_HASH_COL, QString::fromStdString(it->hash));
|
||||||
item->setText(SR_SEARCH_ID_COL, QString::fromStdString(out.str()));
|
item->setText(SR_SEARCH_ID_COL, QString::fromStdString(out.str()));
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
DLDelegate = new DLListDelegate();
|
DLDelegate = new DLListDelegate();
|
||||||
ui.downloadList->setItemDelegate(DLDelegate);
|
ui.downloadList->setItemDelegate(DLDelegate);
|
||||||
|
|
||||||
ui.downloadList->setAutoScroll(false) ;
|
// ui.downloadList->setAutoScroll(false) ;
|
||||||
|
|
||||||
//Selection Setup
|
//Selection Setup
|
||||||
selection = ui.downloadList->selectionModel();
|
selection = ui.downloadList->selectionModel();
|
||||||
|
@ -111,7 +111,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||||
ULDelegate = new ULListDelegate();
|
ULDelegate = new ULListDelegate();
|
||||||
ui.uploadsList->setItemDelegate(ULDelegate);
|
ui.uploadsList->setItemDelegate(ULDelegate);
|
||||||
|
|
||||||
ui.uploadsList->setAutoScroll(false) ;
|
// ui.uploadsList->setAutoScroll(false) ;
|
||||||
ui.uploadsList->setRootIsDecorated(false);
|
ui.uploadsList->setRootIsDecorated(false);
|
||||||
|
|
||||||
//Selection Setup
|
//Selection Setup
|
||||||
|
@ -191,8 +191,8 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||||
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
cancelAct = new QAction(QIcon(IMAGE_CANCEL), tr( "Cancel" ), this );
|
||||||
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
connect( cancelAct , SIGNAL( triggered() ), this, SLOT( cancel() ) );
|
||||||
|
|
||||||
clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
// clearcompletedAct = new QAction(QIcon(IMAGE_CLEARCOMPLETED), tr( "Clear Completed" ), this );
|
||||||
connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
// connect( clearcompletedAct , SIGNAL( triggered() ), this, SLOT( clearcompleted() ) );
|
||||||
|
|
||||||
contextMnu.clear();
|
contextMnu.clear();
|
||||||
if (addPlayOption)
|
if (addPlayOption)
|
||||||
|
@ -203,7 +203,7 @@ void TransfersDialog::downloadListCostumPopupMenu( QPoint point )
|
||||||
|
|
||||||
contextMnu.addAction( cancelAct);
|
contextMnu.addAction( cancelAct);
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction( clearcompletedAct);
|
// contextMnu.addAction( clearcompletedAct);
|
||||||
contextMnu.exec( mevent->globalPos() );
|
contextMnu.exec( mevent->globalPos() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ void TransfersDialog::insertTransfers()
|
||||||
{
|
{
|
||||||
symbol = "";
|
symbol = "";
|
||||||
coreId = QString::fromStdString(info.hash);
|
coreId = QString::fromStdString(info.hash);
|
||||||
name = QString::fromStdString(info.fname);
|
name = QString::fromUtf8(info.fname.c_str());
|
||||||
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||||
|
|
||||||
switch(pit->status)
|
switch(pit->status)
|
||||||
|
@ -436,7 +436,7 @@ void TransfersDialog::insertTransfers()
|
||||||
status = tr("Complete");
|
status = tr("Complete");
|
||||||
}
|
}
|
||||||
|
|
||||||
dlspeed = pit->tfRate * 1024.0;
|
dlspeed = (pit->status == FT_STATE_DOWNLOADING)?( pit->tfRate * 1024.0 ) :0.0;
|
||||||
fileSize = info.size;
|
fileSize = info.size;
|
||||||
completed = info.transfered;
|
completed = info.transfered;
|
||||||
progress = info.transfered * 100.0 / info.size;
|
progress = info.transfered * 100.0 / info.size;
|
||||||
|
@ -459,7 +459,7 @@ void TransfersDialog::insertTransfers()
|
||||||
{
|
{
|
||||||
symbol = "";
|
symbol = "";
|
||||||
coreId = QString::fromStdString(info.hash);
|
coreId = QString::fromStdString(info.hash);
|
||||||
name = QString::fromStdString(info.fname);
|
name = QString::fromUtf8(info.fname.c_str());
|
||||||
sources = tr("Unknown");
|
sources = tr("Unknown");
|
||||||
|
|
||||||
switch(info.downloadStatus)
|
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;
|
fileSize = info.size;
|
||||||
completed = info.transfered;
|
completed = info.transfered;
|
||||||
progress = info.transfered * 100.0 / info.size;
|
progress = info.transfered * 100.0 / info.size;
|
||||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||||
|
|
||||||
addItem(symbol, name, coreId, fileSize, progress,
|
addItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining);
|
||||||
dlspeed, sources, status, completed, remaining);
|
|
||||||
|
|
||||||
/* if found in selectedIds -> select again */
|
/* if found in selectedIds -> select again */
|
||||||
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
if (selectedIds.end() != std::find(selectedIds.begin(), selectedIds.end(), info.hash))
|
||||||
|
@ -516,7 +515,7 @@ void TransfersDialog::insertTransfers()
|
||||||
{
|
{
|
||||||
symbol = "";
|
symbol = "";
|
||||||
coreId = QString::fromStdString(info.hash);
|
coreId = QString::fromStdString(info.hash);
|
||||||
name = QString::fromStdString(info.fname);
|
name = QString::fromUtf8(info.fname.c_str());
|
||||||
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
sources = QString::fromStdString(rsPeers->getPeerName(pit->peerId));
|
||||||
|
|
||||||
switch(pit->status)
|
switch(pit->status)
|
||||||
|
@ -545,7 +544,7 @@ void TransfersDialog::insertTransfers()
|
||||||
// status = "Complete";
|
// status = "Complete";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
dlspeed = pit->tfRate * 1024.0;
|
dlspeed = (pit->status == FT_STATE_DOWNLOADING)?( pit->tfRate * 1024.0 ) :0.0;
|
||||||
fileSize = info.size;
|
fileSize = info.size;
|
||||||
completed = info.transfered;
|
completed = info.transfered;
|
||||||
progress = info.transfered * 100.0 / info.size;
|
progress = info.transfered * 100.0 / info.size;
|
||||||
|
@ -560,7 +559,7 @@ void TransfersDialog::insertTransfers()
|
||||||
{
|
{
|
||||||
symbol = "";
|
symbol = "";
|
||||||
coreId = QString::fromStdString(info.hash);
|
coreId = QString::fromStdString(info.hash);
|
||||||
name = QString::fromStdString(info.fname);
|
name = QString::fromUtf8(info.fname.c_str());
|
||||||
sources = tr("Unknown");
|
sources = tr("Unknown");
|
||||||
|
|
||||||
switch(info.downloadStatus)
|
switch(info.downloadStatus)
|
||||||
|
@ -590,8 +589,7 @@ void TransfersDialog::insertTransfers()
|
||||||
progress = info.transfered * 100.0 / info.size;
|
progress = info.transfered * 100.0 / info.size;
|
||||||
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
remaining = (info.size - info.transfered) / (info.tfRate * 1024.0);
|
||||||
|
|
||||||
addUploadItem(symbol, name, coreId, fileSize, progress,
|
addUploadItem(symbol, name, coreId, fileSize, progress, dlspeed, sources, status, completed, remaining);
|
||||||
dlspeed, sources, status, completed, remaining);
|
|
||||||
ulCount++;
|
ulCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include "gui/Preferences/rsharesettings.h"
|
||||||
#include "RemoteDirModel.h"
|
#include "RemoteDirModel.h"
|
||||||
#include "rsfiles.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
|
bool RemoteDirModel::hasChildren(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
|
@ -392,34 +398,33 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
||||||
{
|
{
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: return QString::fromUtf8(details.name.c_str()) ;
|
||||||
return QString::fromStdString(details.name);
|
break;
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
//out << details.count;
|
//out << details.count;
|
||||||
//return QString::fromStdString(out.str());
|
//return QString::fromStdString(out.str());
|
||||||
return misc::friendlyUnit(details.count);
|
return misc::friendlyUnit(details.count);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << details.rank;
|
out << details.rank;
|
||||||
return QString::fromStdString(out.str());
|
return QString::fromStdString(out.str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
//out << details.age;
|
//out << details.age;
|
||||||
return misc::userFriendlyDuration(details.age);
|
return misc::userFriendlyDuration(details.age);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return QString(tr("FILE"));
|
return QString(tr("FILE"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (details.type == DIR_TYPE_DIR) /* Dir */
|
else if (details.type == DIR_TYPE_DIR) /* Dir */
|
||||||
|
@ -427,24 +432,24 @@ RemoteDirModel::RemoteDirModel(bool mode, QObject *parent)
|
||||||
switch(coln)
|
switch(coln)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return QString::fromStdString(details.name);
|
return QString::fromUtf8(details.name.c_str());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//return QString("");
|
//return QString("");
|
||||||
{
|
{
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
out << details.count;
|
out << details.count;
|
||||||
return QString::fromStdString(out.str());
|
return QString::fromStdString(out.str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return QString("");
|
return QString("");
|
||||||
//return QString::fromStdString(details.path);
|
//return QString::fromStdString(details.path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QString(tr("DIR"));
|
return QString(tr("DIR"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* end of DisplayRole */
|
} /* end of DisplayRole */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue