mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 04:54:18 +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);
|
||||
}
|
||||
|
||||
bool rememberLastLocation() const {
|
||||
return value(QString::fromUtf8("Preferences/Downloads/RememberLastLocation"), false).toBool();
|
||||
}
|
||||
|
||||
void setRememberLastLocation(bool b) {
|
||||
setValue("Preferences/Downloads/RememberLastLocation", b);
|
||||
}
|
||||
|
||||
QString lastLocationPath() const {
|
||||
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
|
||||
savePathTxt->setInsertPolicy(QComboBox::InsertAtCurrent);
|
||||
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
|
||||
QString lastLocation = pref.lastLocationPath();
|
||||
checkLastFolder->setChecked(pref.rememberLastLocation());
|
||||
//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());
|
||||
}
|
||||
defaultSavePath = pref.getSavePath();
|
||||
//In case of the LastLocationPath doesn't exist anymore, empty the string
|
||||
|
||||
appendLabelToSavePath = pref.appendTorrentLabel();
|
||||
QString display_path = defaultSavePath.replace("\\", "/");
|
||||
@ -613,6 +603,7 @@ void torrentAdditionDialog::savePiecesPriorities(){
|
||||
}
|
||||
|
||||
void torrentAdditionDialog::on_OkButton_clicked(){
|
||||
Preferences pref;
|
||||
qDebug() << "void torrentAdditionDialog::on_OkButton_clicked() - ENTER";
|
||||
if(savePathTxt->currentText().trimmed().isEmpty()){
|
||||
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
|
||||
saveTruncatedPathHistory();
|
||||
|
||||
// Set as default save path if necessary
|
||||
if (checkLastFolder->isChecked())
|
||||
pref.setSavePath(getCurrentTruncatedSavePath());
|
||||
|
||||
// Check if savePath exists
|
||||
if(!savePath.exists()){
|
||||
if(!savePath.mkpath(savePath.path())){
|
||||
@ -698,14 +694,7 @@ void torrentAdditionDialog::on_OkButton_clicked(){
|
||||
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
|
||||
if(!is_magnet && t->num_files() > 1)
|
||||
savePiecesPriorities();
|
||||
|
@ -29,8 +29,8 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="savePathLbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
@ -43,23 +43,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="savePathTxt">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QComboBox" name="savePathTxt">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="browseButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="browseButton">
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="checkLastFolder">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>Set as default save path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -281,13 +292,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkLastFolder">
|
||||
<property name="text">
|
||||
<string>Remember last used folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
|
Loading…
x
Reference in New Issue
Block a user