add possibility to add Name,Url,Port, Username and Password if needed.

This commit is contained in:
TangoCash
2016-10-28 22:17:41 +02:00
committed by svenhoefer
parent 682b6f578e
commit 3776340268
9 changed files with 173 additions and 70 deletions

View File

@@ -459,14 +459,26 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.sleeptimer_min = configfile.getInt32("sleeptimer_min", 0);
g_settings.timer_remotebox_ip.clear();
int timer_remotebox_ip_count = configfile.getInt32("timer_remotebox_ip_count", 0);
if (timer_remotebox_ip_count) {
for (int i = 0; i < timer_remotebox_ip_count; i++) {
std::string k = "timer_remotebox_ip_" + to_string(i);
std::string timer_remotebox_ip = configfile.getString(k, "");
if (timer_remotebox_ip.empty())
int timer_remotebox_itemcount = configfile.getInt32("timer_remotebox_ip_count", 0);
if (timer_remotebox_itemcount) {
for (int i = 0; i < timer_remotebox_itemcount; i++) {
timer_remotebox_item timer_rb;
std::string k;
k = "timer_remotebox_ip_" + to_string(i);
timer_rb.rbaddress = configfile.getString(k, "");
if (timer_rb.rbaddress.empty())
continue;
g_settings.timer_remotebox_ip.push_back(timer_remotebox_ip);
k = "timer_remotebox_port_" + to_string(i);
timer_rb.port = configfile.getInt32(k, 80);
k = "timer_remotebox_user_" + to_string(i);
timer_rb.user = configfile.getString(k, "");
k = "timer_remotebox_pass_" + to_string(i);
timer_rb.pass = configfile.getString(k, "");
k = "timer_remotebox_rbname_" + to_string(i);
timer_rb.rbname = configfile.getString(k, "");
if (timer_rb.rbname.empty())
timer_rb.rbname = timer_rb.rbaddress;
g_settings.timer_remotebox_ip.push_back(timer_rb);
}
}
@@ -1056,11 +1068,20 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt32("shutdown_min" , g_settings.shutdown_min );
configfile.setInt32("sleeptimer_min", g_settings.sleeptimer_min);
int timer_remotebox_ip_count = 0;
for (std::list<std::string>::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) {
std::string k = "timer_remotebox_ip_" + to_string(timer_remotebox_ip_count);
configfile.setString(k, *it);
timer_remotebox_ip_count++;
int timer_remotebox_itemcount = 0;
for (std::vector<timer_remotebox_item>::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) {
std::string k;
k = "timer_remotebox_ip_" + to_string(timer_remotebox_itemcount);
configfile.setString(k, it->rbaddress);
k = "timer_remotebox_rbname_" + to_string(timer_remotebox_itemcount);
configfile.setString(k, it->rbname);
k = "timer_remotebox_user_" + to_string(timer_remotebox_itemcount);
configfile.setString(k, it->user);
k = "timer_remotebox_pass_" + to_string(timer_remotebox_itemcount);
configfile.setString(k, it->pass);
k = "timer_remotebox_port_" + to_string(timer_remotebox_itemcount);
configfile.setInt32(k, it->port);
timer_remotebox_itemcount++;
}
configfile.setInt32 ( "timer_remotebox_ip_count", g_settings.timer_remotebox_ip.size());