Fix a lot of String encoding issues on non-unicode systems

Renaming a folder causes the old folder to be removed
Fix some path separator issues on Win32
Fix file/folder opening in file browser on Win32
This commit is contained in:
Christophe Dumez
2010-06-03 19:41:32 +00:00
parent 2d57d9d32c
commit 4b2d09a07b
8 changed files with 65 additions and 24 deletions

View File

@@ -201,7 +201,7 @@ public:
}
nbFiles = t->num_files();
// Setting file name
fileName = misc::toQString(t->name());
fileName = misc::toQStringU(t->name());
hash = misc::toQString(t->info_hash());
// Use left() to remove .old extension
QString newFileName;
@@ -229,7 +229,7 @@ public:
}
// Loads files path in the torrent
for(uint i=0; i<nbFiles; ++i) {
files_path << misc::toQString(t->file_at(i).path.string());
files_path << misc::toQStringU(t->file_at(i).path.string());
}
// Show the dialog
show();
@@ -457,15 +457,16 @@ public slots:
bool path_changed = false;
for(uint i=0; i<nbFiles; ++i) {
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseSensitive) != 0) {
if(files_path.at(i).compare(misc::toQStringU(t->file_at(i).path.string()), Qt::CaseSensitive) != 0) {
#else
if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseInsensitive) != 0) {
if(files_path.at(i).compare(misc::toQStringU(t->file_at(i).path.string()), Qt::CaseInsensitive) != 0) {
#endif
path_changed = true;
break;
}
}
if(path_changed) {
qDebug("Changing files paths");
TorrentTempData::setFilesPath(hash, files_path);
}
}
@@ -473,7 +474,7 @@ public slots:
// Skip file checking and directly start seeding
if(addInSeed->isChecked()) {
// Check if local file(s) actually exist
if(is_magnet || savePath.exists(misc::toQString(t->name()))) {
if(is_magnet || savePath.exists(misc::toQStringU(t->name()))) {
TorrentTempData::setSeedingMode(hash, true);
} else {
QMessageBox::warning(0, tr("Seeding mode error"), tr("You chose to skip file checking. However, local files do not seem to exist in the current destionation folder. Please disable this feature or update the save path."));