-add CBouquetManager writenames menu

This commit is contained in:
Janus
2014-11-03 14:16:53 +01:00
committed by Jacek Jendrzej
parent 04be550075
commit 93d62fd11a
9 changed files with 56 additions and 5 deletions

View File

@@ -655,7 +655,27 @@ int CScanSetup::showScanMenu()
mc->setHint("", LOCALE_MENU_HINT_SCAN_BOUQUET);
settings->addItem(mc);
//bouquet write_names selection
const short SCANTS_BOUQUET_WRITENAMES_COUNT = 4;
const CMenuOptionChooser::keyval SCANTS_BOUQUET_WRITENAMES[SCANTS_BOUQUET_WRITENAMES_COUNT] =
{
{ CBouquetManager::BWN_NEVER , LOCALE_SCANTS_BOUQUET_WRITENAMES_NEVER },
{ CBouquetManager::BWN_UBOUQUETS , LOCALE_SCANTS_BOUQUET_WRITENAMES_UBOUQUETS },
{ CBouquetManager::BWN_BOUQUETS , LOCALE_SCANTS_BOUQUET_WRITENAMES_BOUQUETS },
{ CBouquetManager::BWN_EVER , LOCALE_SCANTS_BOUQUET_WRITENAMES_EVER }
};
int tmp_writeChannelsNames = zapitCfg.writeChannelsNames;
mc = new CMenuOptionChooser(LOCALE_SCANTS_BOUQUET_WRITENAMES, (int *)&zapitCfg.writeChannelsNames, SCANTS_BOUQUET_WRITENAMES, SCANTS_BOUQUET_WRITENAMES_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++), "", true);
mc->setHint("", LOCALE_MENU_HINT_SCAN_BOUQUET_WRITENAMES);
settings->addItem(mc);
int res = settings->exec(NULL, "");
//set write_names if changed
if(zapitCfg.writeChannelsNames != tmp_writeChannelsNames){
CZapit::getInstance()->SetConfig(&zapitCfg);
g_Zapit->saveBouquets();
}
delete satOnOff;
delete settings;

View File

@@ -1230,6 +1230,7 @@ typedef enum
LOCALE_MENU_HINT_SCAN_AUTOALL,
LOCALE_MENU_HINT_SCAN_AUTOALL_SELECT,
LOCALE_MENU_HINT_SCAN_BOUQUET,
LOCALE_MENU_HINT_SCAN_BOUQUET_WRITENAMES,
LOCALE_MENU_HINT_SCAN_BW,
LOCALE_MENU_HINT_SCAN_CABLE,
LOCALE_MENU_HINT_SCAN_CABLE_SIMPLE,
@@ -2022,6 +2023,11 @@ typedef enum
LOCALE_SCANTS_BOUQUET_LEAVE,
LOCALE_SCANTS_BOUQUET_SATELLITE,
LOCALE_SCANTS_BOUQUET_UPDATE,
LOCALE_SCANTS_BOUQUET_WRITENAMES,
LOCALE_SCANTS_BOUQUET_WRITENAMES_BOUQUETS,
LOCALE_SCANTS_BOUQUET_WRITENAMES_EVER,
LOCALE_SCANTS_BOUQUET_WRITENAMES_NEVER,
LOCALE_SCANTS_BOUQUET_WRITENAMES_UBOUQUETS,
LOCALE_SCANTS_CHANNEL,
LOCALE_SCANTS_FAILED,
LOCALE_SCANTS_FINISHED,

View File

@@ -1230,6 +1230,7 @@ const char * locale_real_names[] =
"menu.hint_scan_autoall",
"menu.hint_scan_autoall_select",
"menu.hint_scan_bouquet",
"menu.hint_scan_bouquet_writenames",
"menu.hint_scan_bw",
"menu.hint_scan_cable",
"menu.hint_scan_cable_simple",
@@ -2022,6 +2023,11 @@ const char * locale_real_names[] =
"scants.bouquet_leave",
"scants.bouquet_satellite",
"scants.bouquet_update",
"scants.bouquet_writenames",
"scants.bouquet_writenames_bouquets",
"scants.bouquet_writenames_ever",
"scants.bouquet_writenames_never",
"scants.bouquet_writenames_ubouquets",
"scants.channel",
"scants.failed",
"scants.finished",

View File

@@ -132,6 +132,13 @@ class CBouquetManager
void sortBouquets(void);
void setBouquetLock(const unsigned int id, bool state);
void setBouquetLock(CZapitBouquet* bouquet, bool state);
//bouquet writeChannelsNames selection options
enum{
BWN_NEVER,
BWN_UBOUQUETS,
BWN_BOUQUETS,
BWN_EVER
};
};
/*

View File

@@ -268,7 +268,7 @@ void CBouquetManager::saveBouquets(void)
perror(BOUQUETS_XML);
return;
}
fprintf(bouq_fd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zapit>\n");
fprintf(bouq_fd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zapit api=\"4\">\n");
for (unsigned int i = 0; i < Bouquets.size(); i++) {
if (Bouquets[i] != remainChannels) {
DBG("save Bouquets: name %s user: %d\n", Bouquets[i]->Name.c_str(), Bouquets[i]->bUser);
@@ -293,7 +293,7 @@ void CBouquetManager::saveUBouquets(void)
perror(BOUQUETS_XML);
return;
}
fprintf(ubouq_fd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zapit>\n");
fprintf(ubouq_fd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<zapit api=\"4\">\n");
for (unsigned int i = 0; i < Bouquets.size(); i++) {
if (Bouquets[i] != remainChannels) {
if(Bouquets[i]->bUser) {

View File

@@ -365,11 +365,11 @@ void CZapitChannel::dumpBouquetXml(FILE * fd, bool bUser)
// service names
if (bUser || !url.empty()) {
if ((write_names & 0x01) ==0x01)
if ((write_names & CBouquetManager::BWN_UBOUQUETS) == CBouquetManager::BWN_UBOUQUETS)
fprintf(fd, " n=\"%s\"", convert_UTF8_To_UTF8_XML(name.c_str()).c_str());
}
else {
if ((write_names & 0x02) == 0x02)
if ((write_names & CBouquetManager::BWN_BOUQUETS) == CBouquetManager::BWN_BOUQUETS)
fprintf(fd, " n=\"%s\"", convert_UTF8_To_UTF8_XML(name.c_str()).c_str());
}

View File

@@ -299,7 +299,7 @@ void CZapit::LoadSettings()
voltageOff = configfile.getBool("voltageOff", 0);
#endif
config.saveLastChannel = configfile.getBool("saveLastChannel", true);
config.writeChannelsNames = configfile.getInt32("writeChannelsNames", 3);
config.writeChannelsNames = configfile.getInt32("writeChannelsNames", CBouquetManager::BWN_EVER );
/* FIXME Channels renum should be done for all channels atm. TODO*/
//config.makeRemainingChannelsBouquet = configfile.getBool("makeRemainingChannelsBouquet", 1);
config.makeRemainingChannelsBouquet = 1;