Browse Source

Updated Web UI to reflect the autorun changes

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
73d0e2568a
  1. 6
      src/eventmanager.cpp
  2. 2
      src/httpconnection.cpp
  3. 30
      src/webui/preferences_content.html

6
src/eventmanager.cpp

@ -169,6 +169,10 @@ void EventManager::setGlobalPreferences(QVariantMap m) const { @@ -169,6 +169,10 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
Preferences::setMailNotificationEmail(m["mail_notification_email"].toString());
if(m.contains("mail_notification_smtp"))
Preferences::setMailNotificationSMTP(m["mail_notification_smtp"].toString());
if(m.contains("autorun_enabled"))
Preferences::setAutoRunEnabled(m["autorun_enabled"].toBool());
if(m.contains("autorun_program"))
Preferences::setAutoRunProgram(m["autorun_program"].toString());
if(m.contains("preallocate_all"))
Preferences::preAllocateAllFiles(m["preallocate_all"].toBool());
if(m.contains("queueing_enabled"))
@ -274,6 +278,8 @@ QVariantMap EventManager::getGlobalPreferences() const { @@ -274,6 +278,8 @@ QVariantMap EventManager::getGlobalPreferences() const {
data["mail_notification_enabled"] = Preferences::isMailNotificationEnabled();
data["mail_notification_email"] = Preferences::getMailNotificationEmail();
data["mail_notification_smtp"] = Preferences::getMailNotificationSMTP();
data["autorun_enabled"] = Preferences::isAutoRunEnabled();
data["autorun_program"] = Preferences::getAutoRunProgram();
data["preallocate_all"] = Preferences::preAllocateAllFiles();
data["queueing_enabled"] = Preferences::isQueueingSystemEnabled();
data["max_active_downloads"] = Preferences::getMaxActiveDownloads();

2
src/httpconnection.cpp

@ -109,7 +109,7 @@ QString HttpConnection::translateDocument(QString data) { @@ -109,7 +109,7 @@ QString HttpConnection::translateDocument(QString data) {
bool found = false;
do {
found = false;
QRegExp regex(QString::fromUtf8("_\\(([\\w\\s?!:\\/\\(\\),µ&\\-\\.]+)\\)"));
QRegExp regex(QString::fromUtf8("_\\(([\\w\\s?!:\\/\\(\\),%µ&\\-\\.]+)\\)"));
i = regex.indexIn(data, i);
if(i >= 0) {
//qDebug("Found translatable string: %s", regex.cap(1).toUtf8().data());

30
src/webui/preferences_content.html

@ -131,6 +131,14 @@ @@ -131,6 +131,14 @@
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(Run an external program on torrent completion)</b></legend>
<div style="padding-left: 30px;">
<input type="checkbox" id="autorun_checkbox" onclick="updateAutoRun();"/> _(Run an external program on torrent completion)<br/>
<input type="text" id="autorunProg_txt" style="width: 400px;"/><br/>
<i>_(Use %f to pass the torrent path in parameters)</i>
</div>
</fieldset>
<fieldset>
<legend><b>_(Torrent queueing)</b></legend>
<div style="padding-left: 30px;">
@ -377,6 +385,10 @@ @@ -377,6 +385,10 @@
mail_notification_enabled = 1;
var mail_notification_email = $('dest_email_txt').get('value');
var mail_notification_smtp = $('smtp_server_txt').get('value');
var autorun_enabled = 0;
if($defined($('autorun_checkbox').get('checked')) && $('autorun_checkbox').get('checked'))
autorun_enabled = 1;
var autorun_program = $('autorunProg_txt').get('value');
// IP Filter
var ip_filter_enabled = 0;
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked'))
@ -491,6 +503,8 @@ @@ -491,6 +503,8 @@
dict.set('mail_notification_enabled', mail_notification_enabled);
dict.set('mail_notification_email', mail_notification_email);
dict.set('mail_notification_smtp', mail_notification_smtp);
dict.set('autorun_enabled', autorun_enabled);
dict.set('autorun_program', autorun_program);
// IP Filter
dict.set('ip_filter_enabled', ip_filter_enabled);
dict.set('ip_filter_path', ip_filter_path);
@ -616,6 +630,14 @@ updateMailNotification = function() { @@ -616,6 +630,14 @@ updateMailNotification = function() {
}
}
updateAutoRun = function() {
if($defined($('autorun_checkbox').get('checked')) && $('autorun_checkbox').get('checked')) {
$('autorunProg_txt').removeProperty('disabled');
} else {
$('autorunProg_txt').set('disabled', 'true');
}
}
updateFilterSettings = function() {
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) {
$('ipfilter_text').removeProperty('disabled');
@ -872,6 +894,14 @@ loadPreferences = function() { @@ -872,6 +894,14 @@ loadPreferences = function() {
$('dest_email_txt').set('value', pref.mail_notification_email);
$('smtp_server_txt').set('value', pref.mail_notification_smtp);
updateMailNotification();
var autorun_enabled = pref.autorun_enabled;
if(autorun_enabled) {
$('autorun_checkbox').set('checked', 'checked');
} else {
$('autorun_checkbox').removeProperty('checked');
}
$('autorunProg_txt').set('value', pref.autorun_program);
updateAutoRun();
if(pref.preallocate_all) {
$('preallocateall_checkbox').set('checked', 'checked');
} else {

Loading…
Cancel
Save