Example #1
0
AffinityZoneEditor *AffinityZonesDock::createZoneFromName(const QString &zoneName)
{
    auto editor = new AffinityZoneEditor(this);
    _editorsTabs->addTab(editor, zoneName);
    if (zoneName == getSettings().value("AffinityZones/currentZone").toString()) _editorsTabs->setCurrentWidget(editor);

    //restore the settings from save -- even if this is a new panel with the same name as a previous one
    auto json = getSettings().value("AffinityZones/zones/"+zoneName).toString();
    if (not json.isEmpty()) try
    {
        Poco::JSON::Parser p; p.parse(json.toStdString());
        auto dataObj = p.getHandler()->asVar().extract<Poco::JSON::Object::Ptr>();
        editor->loadFromConfig(dataObj);
    }
    catch (const Poco::JSON::JSONException &ex)
    {
        poco_error_f2(Poco::Logger::get("PothosGui.AffinityZonesDock"), "Failed to load editor for zone '%s' -- %s", zoneName.toStdString(), ex.displayText());
    }

    //now connect the changed signal after initialization+restore changes
    connect(editor, SIGNAL(settingsChanged(void)), this, SLOT(handleZoneEditorChanged(void)));
    connect(editor, SIGNAL(settingsChanged(void)), _mapper, SLOT(map(void)));
    _mapper->setMapping(editor, zoneName);

    //when to update colors
    connect(editor, SIGNAL(settingsChanged(void)), this, SLOT(updateTabColors(void)));
    this->updateTabColors();

    return editor;
}
Example #2
0
ColorScheme::ColorScheme() : FileName() {
    //Each color has two names associated with it.  The KeyName is its
    //identification in the QMap, the *.colors file, and the config file.
    //The Name is what appears in the ViewOpsDialog ListBox.
    //In addition, we define default RGB strings for each item.
    //To add another color to the Palette, just add an entry for KeyName,
    //Name and Default here.

    appendItem("SkyColor",         i18n("Sky"),                    "#000000");
    appendItem("MessColor",        i18n("Messier Object"),         "#008f00");
    appendItem("NGCColor",         i18nc("New General Catalog object", "NGC Object"), "#006666");
    appendItem("ICColor",          i18nc("Index Catalog object", "IC Object"), "#382a7d");
    appendItem("HSTColor",
               i18nc("Object with extra attached URLs", "Object w/ Links"), "#930000");
    appendItem("SNameColor",       i18n("Star Name"),              "#577d7d");
    appendItem("DSNameColor",      i18n("Deep Sky Object Name"),   "#75759c");
    appendItem("PNameColor",       i18n("Planet Name"),            "#ac9800");
    appendItem("CNameColor",
               i18nc("Constellation Name", "Constell. Name"),      "#718488");
    appendItem("CLineColor",
               i18nc("Constellation Line", "Constell. Line"),      "#3d3d3d");
    appendItem("CBoundColor",
               i18nc("Constellation Boundary", "Constell. Boundary"), "#222f2f");
    appendItem("CBoundHighColor",
               i18nc("Highlighted Constellation Boundary", "Constell. Boundary Highlight"), "#445555");
    appendItem("MWColor",
               i18nc("refers to the band of stars in the sky due to the Galactic plane", "Milky Way"), "#0d1115");
    appendItem("EqColor",          i18n("Equator"),                "#909090");
    appendItem("EclColor",         i18n("Ecliptic"),               "#613d12");
    appendItem("HorzColor",        i18n("Horizon"),                "#091f14");
    appendItem("CompassColor",     i18n("Compass Labels"),         "#909055");
    appendItem("EquatorialGridColor", i18n("Equatorial Coordinate Grid"), "#445566");
    appendItem("HorizontalGridColor", i18n("Horizontal Coordinate Grid"), "#091f14");
    appendItem("BoxTextColor",     i18n("Info Box Text"),          "#d2dbef");
    appendItem("BoxGrabColor",     i18n("Info Box Selected"),      "#900000");
    appendItem("BoxBGColor",       i18n("Info Box Background"),    "#000000");
    appendItem("TargetColor",      i18n("Target Indicator"),       "#DD0000");
    appendItem("UserLabelColor",   i18n("User Labels"),            "#AAAAAA");
    appendItem("PlanetTrailColor", i18n("Planet Trails"),          "#993311");
    appendItem("AngularRuler",     i18n("Angular Distance Ruler"), "#445566");
    appendItem("ObsListColor",     i18n("Observing List Label"),   "#FF0000");
    appendItem("StarHopRouteColor", i18n("Star-Hop Route"),        "#00FFFF");
    appendItem("VisibleSatColor",  i18n("Visible Satellites"),     "#00FF00");
    appendItem("SatColor",         i18n("Satellites"),             "#FF0000");
    appendItem("SatLabelColor",    i18n("Satellites Labels"),      "#640000");
    appendItem("SupernovaColor",   i18n("Supernovae"),             "#FFA500");
    appendItem("ArtificialHorizonColor",   i18n("Artificial Horizon"),             "#C82828");
    appendItem("RAGuideError",     i18n("RA Guide Error"),         "#00FF00");
    appendItem("DEGuideError",     i18n("DEC Guide Error"),        "#00A5FF");
    appendItem("SolverFOVColor",     i18n("Solver FOV"),        "#FFFFFF");
    appendItem("FITSObjectLabelColor",     i18n("FITS Image Object Label"),        "#00FF00");

    //Load colors from config object
    loadFromConfig();

    //Default values for integer variables:
    StarColorMode = 0;
    StarColorIntensity = 4;
}
Example #3
0
void ConfigCache::ensureCacheValid()
{
    if (!cacheValidM)
    {
        loadFromConfig();
        cacheValidM = true;
    }
}
void SettingsConstraints::setProfile(const String & profile_name, const Poco::Util::AbstractConfiguration & config)
{
    String parent_profile = "profiles." + profile_name + ".profile";
    if (config.has(parent_profile))
        setProfile(parent_profile, config); // Inheritance of one profile from another.

    String path_to_constraints = "profiles." + profile_name + ".constraints";
    if (config.has(path_to_constraints))
        loadFromConfig(path_to_constraints, config);
}
Example #5
0
/**
 * Load the Menue Page form the Web
 */
void vLoadMenu(void)
{
	char* configLoad = loadFromConfig(IP_CONFIG_FILE, "DEFAULT_MENU_PAGE");

	vInitDisplay();

#if DEBUG_GRAPHIC
	printf("vLoadMenu: Display deleted\nLoad new Page\n");
#endif

	vLoadWebPage(configLoad, NULL);
	vPortFree(configLoad);
	xDisplayRoot.menue = false;
	vDrawElementsOnDisplay();
}
Example #6
0
//*****************************************************************************
//
//! Initializes the lwIP TCP/IP stack.
//!
//! \param pucMAC is a pointer to a six byte array containing the MAC
//! address to be used for the interface.
//! \param ulIPAddr is the IP address to be used (static).
//! \param ulNetMask is the network mask to be used (static).
//! \param ulGWAddr is the Gateway address to be used (static).
//! \param ulIPMode is the IP Address Mode.  \b IPADDR_USE_STATIC will force
//! static IP addressing to be used, \b IPADDR_USE_DHCP will force DHCP with
//! fallback to Link Local (Auto IP), while \b IPADDR_USE_AUTOIP will force
//! Link Local only.
//!
//! This function performs initialization of the lwIP TCP/IP stack for the
//! Stellaris Ethernet MAC, including DHCP and/or AutoIP, as configured.
//!
//! \return None.
//
//*****************************************************************************
void LWIPServiceTaskInit(void *pvParameters)
{
	struct ip_addr *ip_addr;
	struct ip_addr *net_mask;
	struct ip_addr *gw_addr;

	//struct ip_addr ip_addr_local;
	//struct ip_addr net_mask_local;

	char IPState = 0;

	char* configLoad;

	IP_CONFIG * ipCfg;

	printf("Initialisiere IP ");
	ipCfg = pvPortMalloc(sizeof(IP_CONFIG));

	configLoad = loadFromConfig(IP_CONFIG_FILE, "USE_DHCP");

#ifdef ENABLE_GRAPHIC
	vShowBootText("load ipconfig ...");
#endif

	printf("LWIPSTACK: LOAD CONFIG: (%s)\n", configLoad);
	if (configLoad == 0)
	{
		IPState = IPADDR_USE_AUTOIP;
	}
	else if (strcmp(configLoad, "true") == 0)
	{
		IPState = IPADDR_USE_DHCP;
	}
	else
	{
		IPState = IPADDR_USE_STATIC;
	}

	vPortFree(configLoad);

	// Start the TCP/IP thread & init stuff
	tcpip_init(NULL, NULL);

	vTaskDelay(100 / portTICK_RATE_MS);

	// Setup the network address values.
	if (IPState == IPADDR_USE_STATIC)
	{
		ip_addr = getAddresFromConfig("IP_ADDRESS");
		net_mask = getAddresFromConfig("IP_SUBNETMASK");
		gw_addr = getAddresFromConfig("IP_GATEWAY");
	}
#if LWIP_DHCP || LWIP_AUTOIP
	else
	{
		ip_addr = pvPortMalloc(sizeof(struct ip_addr));
		net_mask = pvPortMalloc(sizeof(struct ip_addr));
		gw_addr = pvPortMalloc(sizeof(struct ip_addr));
	}
#endif

	// Create, configure and add the Ethernet controller interface with
	// default settings.
	// WARNING: This must only be run after the OS has been started.
	// Typically this is the case, however, if not, you must place this
	// in a post-OS initialization
	// @SEE http://lwip.wikia.com/wiki/Initialization_using_tcpip.c

	printf("Starting NETIF ... \n");
#ifdef ENABLE_GRAPHIC
	vShowBootText("starting Network ...");
#endif
	netif_add(&lwip_netif, ip_addr, net_mask, gw_addr, NULL, ethernetif_init,
			tcpip_input);
	netif_set_default(&lwip_netif);

	printf("NETIF UP\n");

	// Start DHCP, if enabled.
#if LWIP_DHCP
	if (IPState == IPADDR_USE_DHCP)
	{
#ifdef ENABLE_GRAPHIC
		vShowBootText("waiting for DHCP ...");
#endif
		printf("Starte DHCP Client ...     ");
		if (dhcp_start(&lwip_netif) == ERR_OK)
		{
			printf("[ok]\n");
		}
		else
		{
			printf("[fail]\n");
		}
	}
#endif

	// Start AutoIP, if enabled and DHCP is not.
#if LWIP_AUTOIP
	if (IPState == IPADDR_USE_AUTOIP)
	{
		printf ("Setzte Auto IP (NICHT DHCP) ...\n");
		autoip_start(&lwip_netif);
	}
#endif

	if (IPState == IPADDR_USE_STATIC)
	{
		// Bring the interface up.
		netif_set_up(&lwip_netif);
	}
	vTaskDelay(1000 / portTICK_RATE_MS);

	while (0 == netif_is_up(&lwip_netif))
	{
		vTaskDelay(5000 / portTICK_RATE_MS);
		if (0 == netif_is_up(&lwip_netif))
		{
			dhcp_renew(&lwip_netif);
		}
	}

	printnetif(&lwip_netif);

	configLoad = loadFromConfig(IP_CONFIG_FILE, "IS_SERVER");
	if (strcmp(configLoad, "true") == 0)
	{
		/* Initialize HTTP, DNS, SNTP */
		printf("HTTPD Starten ...\n");
		httpd_init();
	}
	vPortFree(configLoad);

#if ENABLE_SNTP
	printf("SNTP Starten ...\n");
	sntp_init();
#endif

#if ENABLE_DNS
	printf("DNS Starten ...\n");
	dns_init();
#endif

#if ENABLE_NET_BIOS
	printf("NETBIOS Starten ...\n");
	netbios_init();
#endif

	printf("Dienste gestartet ...\n");

#ifdef ENABLE_GRAPHIC
	configLoad = loadFromConfig(IP_CONFIG_FILE, "IS_CLIENT");
	if (strcmp(configLoad, "true") == 0)
	{
		vShowBootText("loading menu ...");
		vLoadMenu();
	}
	else
	{
		vShowBootText("ready for requests ...");
	}
	vPortFree(configLoad);
#endif

	// Nothing else to do.  No point hanging around.
	while (1)
	{
		vTaskDelay(500 / portTICK_RATE_MS);
		if (EthernetPHYRead(ETH_BASE, PHY_MR1) & ETH_PHY_LINK_UP)
		{
			if (!(netif_is_up(&lwip_netif)))
			{
				// set link up flag
				netif_set_up(&lwip_netif);
#ifdef ENABLE_GRAPHIC
				vShowBootText("activate networkinterface ...");
				configLoad = loadFromConfig(IP_CONFIG_FILE, "IS_CLIENT");
				if (strcmp(configLoad, "true") == 0)
				{
					vShowBootText("loading menu ...");
					vLoadMenu();
				}
				else
				{
					vShowBootText("ready for requests ...");
				}
				vPortFree(configLoad);
#endif
				if (IPState == IPADDR_USE_DHCP)
				{
					printf("DHCP Adresse anfordern ...  ");
					if (dhcp_renew(&lwip_netif) == ERR_OK)
					{
						printf("[ok]\n");
						printnetif(&lwip_netif);
					}
					else
					{
						printf("[fail]\n");
					}
				}
			}
		}
		else
		{
			if (netif_is_up(&lwip_netif))
			{
#ifdef ENABLE_GRAPHIC
				vShowBootText("no networkconnection!!");
#endif
				printf("Deaktiviere Netzwerkinterface ...  ");
				netif_set_down(&lwip_netif);
			}
		}

	}
}