Browse Source

Added "Export .torrent files to..." feature to the Web UI

Fix Scan dir preferences in Web UI
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
e24e7578f2
  1. 4
      src/eventmanager.cpp
  2. 32
      src/webui/preferences_content.html

4
src/eventmanager.cpp

@ -131,6 +131,8 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setTempPath(m["temp_path"].toString()); Preferences::setTempPath(m["temp_path"].toString());
if(m.contains("scan_dir")) if(m.contains("scan_dir"))
Preferences::setScanDir(m["scan_dir"].toString()); Preferences::setScanDir(m["scan_dir"].toString());
if(m.contains("export_dir"))
Preferences::setExportDir(m["export_dir"].toString());
if(m.contains("preallocate_all")) if(m.contains("preallocate_all"))
Preferences::preAllocateAllFiles(m["preallocate_all"].toBool()); Preferences::preAllocateAllFiles(m["preallocate_all"].toBool());
if(m.contains("queueing_enabled")) if(m.contains("queueing_enabled"))
@ -229,6 +231,8 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["temp_path"] = Preferences::getTempPath(); data["temp_path"] = Preferences::getTempPath();
data["scan_dir_enabled"] = Preferences::isDirScanEnabled(); data["scan_dir_enabled"] = Preferences::isDirScanEnabled();
data["scan_dir"] = Preferences::getScanDir(); data["scan_dir"] = Preferences::getScanDir();
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
data["export_dir"] = Preferences::getExportDir();
data["preallocate_all"] = Preferences::preAllocateAllFiles(); data["preallocate_all"] = Preferences::preAllocateAllFiles();
data["queueing_enabled"] = Preferences::isQueueingSystemEnabled(); data["queueing_enabled"] = Preferences::isQueueingSystemEnabled();
data["max_active_downloads"] = Preferences::getMaxActiveDownloads(); data["max_active_downloads"] = Preferences::getMaxActiveDownloads();

32
src/webui/preferences_content.html

@ -106,6 +106,12 @@
<tr> <tr>
<td style="vertical-align: bottom; text-align: right;"></td><td><input type="text" id="scandir_text"/></td> <td style="vertical-align: bottom; text-align: right;"></td><td><input type="text" id="scandir_text"/></td>
</tr> </tr>
<tr>
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();"/></td><td>_(Copy .torrent files to:)</td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;"></td><td><input type="text" id="exportdir_text"/></td>
</tr>
<tr id="appendexttr"> <tr id="appendexttr">
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="appendext_checkbox"/></td><td>_(Append .!qB extension to incomplete files)</td> <td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="appendext_checkbox"/></td><td>_(Append .!qB extension to incomplete files)</td>
</tr> </tr>
@ -340,6 +346,12 @@
var scandir_path = ''; var scandir_path = '';
if(scandir_enabled) if(scandir_enabled)
scandir_path = $('scandir_text').get('value'); scandir_path = $('scandir_text').get('value');
var exportdir_enabled = 0;
if($defined($('exportdir_checkbox').get('checked')) && $('exportdir_checkbox').get('checked'))
exportdir_enabled = 1;
var exportdir_path = '';
if(exportdir_enabled)
exportdir_path = $('exportdir_text').get('value');
var preallocate_all = 0; var preallocate_all = 0;
if($defined($('preallocateall_checkbox').get('checked')) && $('preallocateall_checkbox').get('checked')) if($defined($('preallocateall_checkbox').get('checked')) && $('preallocateall_checkbox').get('checked'))
preallocate_all = 1; preallocate_all = 1;
@ -456,6 +468,7 @@
dict.set('temp_path_enabled', temp_path_enabled); dict.set('temp_path_enabled', temp_path_enabled);
dict.set('temp_path', temp_path); dict.set('temp_path', temp_path);
dict.set('scan_dir', scandir_path); dict.set('scan_dir', scandir_path);
dict.set('export_dir', exportdir_path);
dict.set('preallocate_all', preallocate_all); dict.set('preallocate_all', preallocate_all);
if(!$('appendexttr').hasClass('invisible')) { if(!$('appendexttr').hasClass('invisible')) {
dict.set('incomplete_files_ext', incomplete_files_ext); dict.set('incomplete_files_ext', incomplete_files_ext);
@ -592,6 +605,14 @@ updateScanDirEnabled = function() {
} }
} }
updateExportDirEnabled = function() {
if($defined($('exportdir_checkbox').get('checked')) && $('exportdir_checkbox').get('checked')) {
$('exportdir_text').removeProperty('disabled');
} else {
$('exportdir_text').set('disabled', 'true');
}
}
updateQueueingSystem = function() { updateQueueingSystem = function() {
if($defined($('queueing_checkbox').get('checked')) && $('queueing_checkbox').get('checked')) { if($defined($('queueing_checkbox').get('checked')) && $('queueing_checkbox').get('checked')) {
$('max_active_dl_value').removeProperty('disabled'); $('max_active_dl_value').removeProperty('disabled');
@ -775,10 +796,21 @@ loadPreferences = function() {
var scan_dir_enabled = pref.scan_dir_enabled; var scan_dir_enabled = pref.scan_dir_enabled;
if(scan_dir_enabled) { if(scan_dir_enabled) {
$('scandir_text').set('value', pref.scan_dir); $('scandir_text').set('value', pref.scan_dir);
$('scandir_checkbox').set('checked', 'checked');
} else { } else {
$('scandir_text').set('value', ''); $('scandir_text').set('value', '');
$('scandir_checkbox').removeProperty('checked');
} }
updateScanDirEnabled(); updateScanDirEnabled();
var export_dir_enabled = pref.export_dir_enabled;
if(export_dir_enabled) {
$('exportdir_text').set('value', pref.export_dir);
$('exportdir_checkbox').set('checked', 'checked');
} else {
$('exportdir_text').set('value', '');
$('exportdir_checkbox').removeProperty('checked');
}
updateExportDirEnabled();
if(pref.preallocate_all) { if(pref.preallocate_all) {
$('preallocateall_checkbox').set('checked', 'checked'); $('preallocateall_checkbox').set('checked', 'checked');
} else { } else {

Loading…
Cancel
Save