From 73d0e2568aa0dbcf8dc9e3ce9e6e05894deaeef4 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 20 Aug 2010 14:02:40 +0000 Subject: [PATCH] Updated Web UI to reflect the autorun changes --- src/eventmanager.cpp | 6 ++++++ src/httpconnection.cpp | 2 +- src/webui/preferences_content.html | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/eventmanager.cpp b/src/eventmanager.cpp index 845e2aaf1..7a2a649a4 100644 --- a/src/eventmanager.cpp +++ b/src/eventmanager.cpp @@ -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 { 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(); diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 0acb7aa39..99acfd855 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -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()); diff --git a/src/webui/preferences_content.html b/src/webui/preferences_content.html index 70a8fa6e6..444fedf64 100644 --- a/src/webui/preferences_content.html +++ b/src/webui/preferences_content.html @@ -131,6 +131,14 @@ +
+ _(Run an external program on torrent completion) +
+ _(Run an external program on torrent completion)
+
+_(Use %f to pass the torrent path in parameters) +
+
_(Torrent queueing)
@@ -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 @@ 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() { } } +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() { $('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 {