diff --git a/src/misc.cpp b/src/misc.cpp index b3e9ac047..c24252b72 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -151,7 +151,7 @@ QString misc::QDesktopServicesCacheLocation() { long long misc::freeDiskSpaceOnPath(QString path) { if(path.isEmpty()) return -1; - path = path.replace("\\", "/"); + path.replace("\\", "/"); QDir dir_path(path); if(!dir_path.exists()) { QStringList parts = path.split("/"); @@ -475,15 +475,15 @@ QString misc::updateLabelInSavePath(QString defaultSavePath, QString save_path, QString misc::toValidFileSystemName(QString filename) { qDebug("toValidFSName: %s", qPrintable(filename)); - filename = filename.replace("\\", "/").trimmed(); + filename.replace("\\", "/").trimmed(); const QRegExp regex("[/:?\"*<>|]"); - filename = filename.replace(regex, " ").trimmed(); + filename.replace(regex, " ").trimmed(); qDebug("toValidFSName, result: %s", qPrintable(filename)); return filename; } bool misc::isValidFileSystemName(QString filename) { - filename = filename.replace("\\", "/").trimmed(); + filename.replace("\\", "/").trimmed(); if(filename.isEmpty()) return false; const QRegExp regex("[/:?\"*<>|]"); if(filename.contains(regex)) @@ -712,7 +712,7 @@ QString misc::expandPath(QString path) { if(path[0] == '~' ) return QDir::homePath(); } if(path[0] == '~' && path[1] == QDir::separator()) { - path = path.replace(0, 1, QDir::homePath()); + path.replace(0, 1, QDir::homePath()); } else { if(QDir::isAbsolutePath(path)) { path = QDir(path).absolutePath(); diff --git a/src/misc.h b/src/misc.h index f7865734d..015b91696 100644 --- a/src/misc.h +++ b/src/misc.h @@ -88,7 +88,7 @@ public: static inline QString removeLastPathPart(QString path) { if(path.isEmpty()) return path; - path = path.replace("\\", "/"); + path.replace("\\", "/"); QStringList tmp = path.split("/"); tmp.removeLast(); return tmp.join("/"); diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index aad34b208..aa3acb465 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -382,13 +382,13 @@ void options_imp::saveOptions(){ // Downloads preferences QString save_path = getSavePath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - save_path = save_path.replace("\\", "/"); + save_path.replace("\\", "/"); #endif pref.setSavePath(save_path); pref.setTempPathEnabled(isTempPathEnabled()); QString temp_path = getTempPath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - temp_path = temp_path.replace("\\", "/"); + temp_path.replace("\\", "/"); #endif pref.setTempPath(temp_path); pref.setAppendTorrentLabel(checkAppendLabel->isChecked()); @@ -402,7 +402,7 @@ void options_imp::saveOptions(){ addedScanDirs.clear(); QString export_dir = getExportDir(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - export_dir = export_dir.replace("\\", "/"); + export_dir.replace("\\", "/"); #endif pref.setExportDir(export_dir); pref.setMailNotificationEnabled(groupMailNotification->isChecked()); @@ -462,7 +462,7 @@ void options_imp::saveOptions(){ if(isFilteringEnabled()){ QString filter_path = textFilterPath->text(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - filter_path = filter_path.replace("\\", "/"); + filter_path.replace("\\", "/"); #endif pref.setFilter(filter_path); } @@ -554,7 +554,7 @@ void options_imp::loadOptions(){ // Downloads preferences QString save_path = pref.getSavePath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - save_path = save_path.replace("/", "\\"); + save_path.replace("/", "\\"); #endif textSavePath->setText(save_path); if(pref.isTempPathEnabled()) { @@ -565,7 +565,7 @@ void options_imp::loadOptions(){ } QString temp_path = pref.getTempPath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - temp_path = temp_path.replace("/", "\\"); + temp_path.replace("/", "\\"); #endif textTempPath->setText(temp_path); checkAppendLabel->setChecked(pref.appendTorrentLabel()); @@ -584,7 +584,7 @@ void options_imp::loadOptions(){ // enable checkExportDir->setChecked(true); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - strValue = strValue.replace("/", "\\"); + strValue.replace("/", "\\"); #endif textExportDir->setText(strValue); } @@ -855,7 +855,7 @@ QString options_imp::getSavePath() const{ if(textSavePath->text().trimmed().isEmpty()){ QString save_path = Preferences().getSavePath(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - save_path = save_path.replace("/", "\\"); + save_path.replace("/", "\\"); #endif textSavePath->setText(save_path); } @@ -1093,7 +1093,7 @@ void options_imp::on_browseExportDirButton_clicked() { } if(!dir.isNull()){ #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - dir = dir.replace("/", "\\"); + dir.replace("/", "\\"); #endif textExportDir->setText(dir); } @@ -1110,7 +1110,7 @@ void options_imp::on_browseFilterButton_clicked() { } if(!ipfilter.isNull()){ #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - ipfilter = ipfilter.replace("/", "\\"); + ipfilter.replace("/", "\\"); #endif textFilterPath->setText(ipfilter); } @@ -1128,7 +1128,7 @@ void options_imp::on_browseSaveDirButton_clicked(){ } if(!dir.isNull()){ #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - dir = dir.replace("/", "\\"); + dir.replace("/", "\\"); #endif textSavePath->setText(dir); } @@ -1145,7 +1145,7 @@ void options_imp::on_browseTempDirButton_clicked(){ } if(!dir.isNull()){ #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - dir = dir.replace("/", "\\"); + dir.replace("/", "\\"); #endif textTempPath->setText(dir); } diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index a94aebf53..6cbcf9c4d 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -222,7 +222,7 @@ void PropertiesWidget::updateSavePath(const QTorrentHandle& _h) { p = h.save_path(); } #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - p = p.replace("/", "\\"); + p.replace("/", "\\"); #endif save_path->setText(p); } @@ -524,8 +524,7 @@ void PropertiesWidget::renameSelectedFile() { // File renaming const int file_index = PropListModel->getFileIndex(index); if(!h.is_valid() || !h.has_metadata()) return; - QString old_name = h.filepath_at(file_index); - old_name = old_name.replace("\\", "/"); + QString old_name = h.filepath_at(file_index).replace("\\", "/"); if(old_name.endsWith(".!qB") && !new_name_last.endsWith(".!qB")) { new_name_last += ".!qB"; } @@ -713,7 +712,7 @@ void PropertiesWidget::on_changeSavePathButton_clicked() { display_path = savePath.absolutePath(); } #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - display_path = display_path.replace("/", "\\"); + display_path.replace("/", "\\"); #endif save_path->setText(display_path); } diff --git a/src/qinisettings.h b/src/qinisettings.h index ea04e26c2..7bd6695bb 100644 --- a/src/qinisettings.h +++ b/src/qinisettings.h @@ -69,7 +69,7 @@ public: void setValue(const QString &key, const QVariant &val) { QString key_tmp(key); if(format() == QSettings::NativeFormat) - key_tmp = key_tmp.replace("\\", "/"); + key_tmp.replace("\\", "/"); QSettings::setValue(key_tmp, val); } #endif diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 8e376b890..d054198b6 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1281,7 +1281,7 @@ void QBtSession::loadTorrentTempData(QTorrentHandle &h, QString savePath, bool m if(files_path.size() == h.num_files()) { for(int i=0; ipath; - ret = ret.replace("/", "\\"); - return ret; + return pathData->path.replace("/", "\\"); #else return pathData->path; #endif diff --git a/src/torrentadditiondlg.cpp b/src/torrentadditiondlg.cpp index 364193aea..b06022749 100644 --- a/src/torrentadditiondlg.cpp +++ b/src/torrentadditiondlg.cpp @@ -96,7 +96,7 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) : display_path += "/"; path_history << display_path; #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - display_path = display_path.replace("/", "\\"); + display_path.replace("/", "\\"); #endif savePathTxt->addItem(display_path); @@ -311,7 +311,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { QString save_path = savePathTxt->currentText(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - save_path = save_path.replace("/", "\\"); + save_path.replace("/", "\\"); #endif if(!save_path.endsWith(QDir::separator())) save_path += QDir::separator(); @@ -327,7 +327,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) { QString single_file_relpath = misc::toQStringU(t->file_at(0).path.string()); #endif #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - single_file_relpath = single_file_relpath.replace("/", "\\"); + single_file_relpath.replace("/", "\\"); #endif save_path += single_file_relpath; } @@ -414,7 +414,7 @@ void torrentAdditionDialog::renameSelectedFile() { // File renaming const uint file_index = PropListModel->getFileIndex(index); QString old_name = files_path.at(file_index); - old_name = old_name.replace("\\", "/"); + old_name.replace("\\", "/"); qDebug("Old name: %s", qPrintable(old_name)); QStringList path_items = old_name.split("/"); path_items.removeLast(); @@ -580,7 +580,7 @@ void torrentAdditionDialog::on_browseButton_clicked(){ savePathTxt->setCurrentIndex(cur_index); } #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - new_path = new_path.replace("/", "\\"); + new_path.replace("/", "\\"); #endif savePathTxt->setEditText(new_path); } @@ -611,7 +611,7 @@ void torrentAdditionDialog::on_OkButton_clicked(){ } QString save_path = savePathTxt->currentText(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - save_path = save_path.replace("\\", "/"); + save_path.replace("\\", "/"); #endif save_path = misc::expandPath(save_path); qDebug("Save path is %s", qPrintable(save_path)); @@ -751,7 +751,7 @@ void torrentAdditionDialog::updateSavePathCurrentText() { if(!root_folder_or_file_name.isEmpty()) item_path += root_folder_or_file_name; #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - item_path = item_path.replace("/", "\\"); + item_path.replace("/", "\\"); #endif savePathTxt->setItemText(i, item_path); } @@ -812,7 +812,7 @@ void torrentAdditionDialog::loadSavePathHistory() { if(QDir(sp) != QDir(defaultSavePath)) { QString dsp = sp; #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - dsp = dsp.replace("/", "\\"); + dsp.replace("/", "\\"); #endif path_history << sp; savePathTxt->addItem(dsp); diff --git a/src/torrentcreator/torrentcreatordlg.cpp b/src/torrentcreator/torrentcreatordlg.cpp index d28a7d054..d68118798 100644 --- a/src/torrentcreator/torrentcreatordlg.cpp +++ b/src/torrentcreator/torrentcreatordlg.cpp @@ -74,7 +74,7 @@ void TorrentCreatorDlg::on_addFolder_button_clicked(){ if(!dir.isEmpty()) { settings.setValue("CreateTorrent/last_add_path", dir); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - dir = dir.replace("/", "\\"); + dir.replace("/", "\\"); #endif textInputPath->setText(dir); // Update piece size @@ -90,7 +90,7 @@ void TorrentCreatorDlg::on_addFile_button_clicked(){ if(!file.isEmpty()) { settings.setValue("CreateTorrent/last_add_path", misc::removeLastPathPart(file)); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) - file = file.replace("/", "\\"); + file.replace("/", "\\"); #endif textInputPath->setText(file); // Update piece size