Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

Origin commit data
------------------
Branch: ni/coolstream
Commit: af5ead9f3f
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-02-26 (Tue, 26 Feb 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2013-02-26 11:17:18 +04:00
4 changed files with 29 additions and 8 deletions

View File

@@ -91,20 +91,22 @@ bool CConfigFile::loadConfig(const std::string & filename)
bool CConfigFile::saveConfig(const char * const filename) bool CConfigFile::saveConfig(const char * const filename)
{ {
std::ofstream configFile(filename); std::fstream configFile(filename);
if (configFile != NULL) if (configFile != NULL)
{ {
std::cout << "[ConfigFile] saving " << filename << std::endl;
for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it) for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it)
{ {
configFile << it->first << "=" << it->second << std::endl; configFile << it->first << "=" << it->second << std::endl;
} }
configFile.sync();
configFile.close(); configFile.close();
sync();
chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
modifiedFlag = false;
return true; return true;
} }
else else
@@ -387,6 +389,9 @@ void CConfigFile::setString(const std::string & key, const std::string & val)
void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int32_t> vec) void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int32_t> vec)
{ {
bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
unknownKeyQueryedFlag = false;
std::string oldVal = getString(key);
std::stringstream s; std::stringstream s;
for (std::vector<int32_t>::const_iterator it = vec.begin(); ; ) for (std::vector<int32_t>::const_iterator it = vec.begin(); ; )
@@ -399,21 +404,35 @@ void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int3
break; break;
s << delimiter; s << delimiter;
} }
s >> configData[key]; if (oldVal != s.str() || unknownKeyQueryedFlag)
{
modifiedFlag = true;
configData[key] = s.str();
}
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
} }
void CConfigFile::setStringVector(const std::string & key, const std::vector<std::string> vec) void CConfigFile::setStringVector(const std::string & key, const std::vector<std::string> vec)
{ {
configData[key] = ""; bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
unknownKeyQueryedFlag = false;
std::string oldVal = getString(key);
std::string newVal = "";
for (std::vector<std::string>::const_iterator it = vec.begin(); ; ) for (std::vector<std::string>::const_iterator it = vec.begin(); ; )
{ {
if (it == vec.end()) if (it == vec.end())
break; break;
configData[key] += *it; newVal += *it;
++it; ++it;
if (it == vec.end()) if (it == vec.end())
break; break;
configData[key] += delimiter; newVal += delimiter;
} }
if (oldVal != newVal || unknownKeyQueryedFlag)
{
modifiedFlag = true;
configData[key] = newVal;
}
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
} }

View File

@@ -2158,6 +2158,7 @@ void CChannelList::paint_events(int index)
evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS);
evt.eventID = 0; evt.eventID = 0;
evt.startTime = 0;
evtlist.push_back(evt); evtlist.push_back(evt);
} }
@@ -2218,6 +2219,7 @@ void CChannelList::readEvents(const t_channel_id channel_id)
CChannelEvent evt; CChannelEvent evt;
evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS);
evt.eventID = 0; evt.eventID = 0;
evt.startTime = 0;
evtlist.push_back(evt); evtlist.push_back(evt);
} }
else else

View File

@@ -106,6 +106,7 @@ void CInfoViewerBB::Init()
for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) { for (int i = 0; i < CInfoViewerBB::BUTTON_MAX; i++) {
tmp_bbButtonInfoText[i] = ""; tmp_bbButtonInfoText[i] = "";
bbButtonInfo[i].x = -1;
} }
// get HDD info in a separate thread // get HDD info in a separate thread

View File

@@ -263,8 +263,7 @@ void CFEManager::saveSettings(bool write)
sprintf(cfg_key, "fe%d_satellites", fe->fenumber); sprintf(cfg_key, "fe%d_satellites", fe->fenumber);
configfile.setInt32Vector(cfg_key, satList); configfile.setInt32Vector(cfg_key, satList);
} }
//setInt32Vector dont set modified flag ! if (write && configfile.getModifiedFlag()) {
if (write /*&& configfile.getModifiedFlag()*/) {
config_exist = configfile.saveConfig(FECONFIGFILE); config_exist = configfile.saveConfig(FECONFIGFILE);
//configfile.setModifiedFlag(false); //configfile.setModifiedFlag(false);
} }