mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Several fixes to the merge request
This commit is contained in:
parent
c25f51e866
commit
7bd19f7696
@ -229,14 +229,6 @@ public:
|
|||||||
setValue("Preferences/Downloads/AppendLabel", b);
|
setValue("Preferences/Downloads/AppendLabel", b);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rememberLastLocation() const {
|
|
||||||
return value(QString::fromUtf8("Preferences/Downloads/RememberLastLocation"), false).toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setRememberLastLocation(bool b) {
|
|
||||||
setValue("Preferences/Downloads/RememberLastLocation", b);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString lastLocationPath() const {
|
QString lastLocationPath() const {
|
||||||
return value(QString::fromUtf8("Preferences/Downloads/LastLocationPath"), QString()).toString();
|
return value(QString::fromUtf8("Preferences/Downloads/LastLocationPath"), QString()).toString();
|
||||||
}
|
}
|
||||||
|
@ -87,18 +87,8 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
|
|||||||
// Important: as a default, it inserts at the bottom which is not desirable
|
// Important: as a default, it inserts at the bottom which is not desirable
|
||||||
savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent);
|
savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent);
|
||||||
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
|
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
|
||||||
QString lastLocation = pref.lastLocationPath();
|
defaultSavePath = pref.getSavePath();
|
||||||
checkLastFolder->setChecked(pref.rememberLastLocation());
|
//In case of the LastLocationPath doesn't exist anymore, empty the string
|
||||||
//lastLocation will always have '/' as separator since it is saved in
|
|
||||||
//::on_OkButton_clicked() after the conversion is done.
|
|
||||||
if (pref.rememberLastLocation() && !lastLocation.isEmpty() && QFile(lastLocation).exists())
|
|
||||||
defaultSavePath = lastLocation;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
defaultSavePath = pref.getSavePath();
|
|
||||||
//In case of the LastLocationPath doesn't exist anymore, empty the string
|
|
||||||
pref.setLastLocationPath(QString());
|
|
||||||
}
|
|
||||||
|
|
||||||
appendLabelToSavePath = pref.appendTorrentLabel();
|
appendLabelToSavePath = pref.appendTorrentLabel();
|
||||||
QString display_path = defaultSavePath.replace("\\", "/");
|
QString display_path = defaultSavePath.replace("\\", "/");
|
||||||
@ -613,6 +603,7 @@ void torrentAdditionDialog::savePiecesPriorities(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void torrentAdditionDialog::on_OkButton_clicked(){
|
void torrentAdditionDialog::on_OkButton_clicked(){
|
||||||
|
Preferences pref;
|
||||||
qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER";
|
qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER";
|
||||||
if(savePathTxt->currentText().trimmed().isEmpty()){
|
if(savePathTxt->currentText().trimmed().isEmpty()){
|
||||||
QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path"));
|
QMessageBox::critical(0, tr("Empty save path"), tr("Please enter a save path"));
|
||||||
@ -691,6 +682,11 @@ void torrentAdditionDialog::on_OkButton_clicked(){
|
|||||||
}
|
}
|
||||||
// Save path history
|
// Save path history
|
||||||
saveTruncatedPathHistory();
|
saveTruncatedPathHistory();
|
||||||
|
|
||||||
|
// Set as default save path if necessary
|
||||||
|
if (checkLastFolder->isChecked())
|
||||||
|
pref.setSavePath(getCurrentTruncatedSavePath());
|
||||||
|
|
||||||
// Check if savePath exists
|
// Check if savePath exists
|
||||||
if(!savePath.exists()){
|
if(!savePath.exists()){
|
||||||
if(!savePath.mkpath(savePath.path())){
|
if(!savePath.mkpath(savePath.path())){
|
||||||
@ -698,14 +694,7 @@ void torrentAdditionDialog::on_OkButton_clicked(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Save last location path
|
|
||||||
{//limit the scope of pref
|
|
||||||
Preferences pref;
|
|
||||||
bool isChecked = checkLastFolder->isChecked();
|
|
||||||
if (pref.rememberLastLocation() != isChecked) pref.setRememberLastLocation(isChecked);
|
|
||||||
if (pref.rememberLastLocation() && save_path != pref.lastLocationPath())
|
|
||||||
pref.setLastLocationPath(save_path);
|
|
||||||
}
|
|
||||||
// save filtered files
|
// save filtered files
|
||||||
if(!is_magnet && t->num_files() > 1)
|
if(!is_magnet && t->num_files() > 1)
|
||||||
savePiecesPriorities();
|
savePiecesPriorities();
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="savePathLbl">
|
<widget class="QLabel" name="savePathLbl">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
@ -43,23 +43,34 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="savePathTxt">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<widget class="QComboBox" name="savePathTxt">
|
||||||
<horstretch>0</horstretch>
|
<property name="sizePolicy">
|
||||||
<verstretch>0</verstretch>
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
</sizepolicy>
|
<horstretch>0</horstretch>
|
||||||
</property>
|
<verstretch>0</verstretch>
|
||||||
<property name="editable">
|
</sizepolicy>
|
||||||
<bool>true</bool>
|
</property>
|
||||||
</property>
|
<property name="editable">
|
||||||
</widget>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="browseButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="1">
|
||||||
<widget class="QToolButton" name="browseButton">
|
<widget class="QCheckBox" name="checkLastFolder">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>Set as default save path</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -281,13 +292,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkLastFolder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Remember last used folder</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user