Beispiel #1
0
bool Settings::load(const char* settingsFile)
{
	GKeyFile* keyfile;
	GKeyFileFlags flags;
	GError* error = 0;

	keyfile = g_key_file_new();
	if(!keyfile)
		return false;
	flags = GKeyFileFlags( G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS);

	if( !g_key_file_load_from_file( keyfile, settingsFile, flags, &error ) )
	{
		g_key_file_free( keyfile );
		if (error) g_error_free(error);
		return false;
	}

	KEY_BOOLEAN("Debug","turnOnNovacomAtStart",m_turnNovacomOnAtStartup);
	KEY_BOOLEAN("Debug","saveLastBackedUpTempDb",m_saveLastBackedUpTempDb);
	KEY_BOOLEAN("Debug","saveLastRestoredTempDb",m_saveLastRestoredTempDb);
	KEY_STRING("Debug","logLevel",m_logLevel);

	KEY_BOOLEAN("ImageService","useComPalmImage2",m_useComPalmImage2);
	KEY_STRING("ImageService","comPalmImage2Binary",m_comPalmImage2BinaryFile);

    KEY_INTEGER("General", "schemaValidationOption", schemaValidationOption);

	g_key_file_free( keyfile );
	return true;
}
void DynamicsSettings::readSettings(const char* filePath)
{
    QString alphaTrAnimTypeName;
    GKeyFile* keyfile = g_key_file_new();

    if (!g_key_file_load_from_file(keyfile, filePath,
                                   G_KEY_FILE_NONE, NULL)) {
        goto Done;
    }

    KEY_UINTEGER("Animations","IconReorderIconMoveAnimTime",iconReorderIconMoveAnimTime);
    KEY_CURVE("Animations","IconReorderIconMoveAnimCurve",iconReorderIconMoveAnimCurve);

    KEY_UINTEGER("UserControl","IconReorderSampleRate",iconReorderSampleRate);
    if (iconReorderSampleRate == 0)
    {
        iconReorderSampleRate = 1;
    }

    KEY_BOOLEAN("Animations","AlwaysWaitForIconReorderAnimToFinish",alwaysWaitForIconReorderAnimToFinish);
    KEY_BOOLEAN("Animations","TrackedIconUseDistanceBasedAnimTime",iconReorderTrackedIconUseDistanceBasedAnimTime);
    KEY_UINTEGER("Animations","TrackedIconMinAnimTime",iconReorderTrackedIconMinAnimTime);

    KEY_BOOLEAN("Animations","UseAnimationForAlphaTrackedIconCancel",alphaIconMoveTrackedIconUseAnimation);
    KEY_QSTRING("Animations","AlphaTrackedIconCancelAnimationType",alphaTrAnimTypeName);
    if (!alphaTrAnimTypeName.isEmpty())
    {
        alphaIconMoveTrackedIconAnimType = animName2Type(alphaTrAnimTypeName);
    }
    KEY_UINTEGER("UserControl","PageScrollUnderIconMoveDelayMs",pageScrollDelayMs);
    KEY_UINTEGER("UserControl","PageVerticalAutoScrollAmountPx",pageScrollAmount);
    KEY_UINTEGER("Animations","PageVerticalAutoScrollAnimTime",pageScrollAnimTime);

    KEY_QREAL("IconRender","IconInstallModeOpacity",iconInstallModeOpacity);

    KEY_UINTEGER("Animations","AppInfoDialogFadeInAnimTime",appInfoDialogFadeInTime);
    KEY_UINTEGER("Animations","AppInfoDialogFadeOutAnimTime",appInfoDialogFadeOutTime);

    KEY_UINTEGER("UserControl","IconFeedbackTimeout", launchFeedbackTimeout);

    KEY_UINTEGER("UserControl","MaxVelocityForSampling",maxVelocityForSampling);
    KEY_UINTEGER("UserControl","VelocityTimeNormalizationUnit",timeNormalizationUnit);
    KEY_UINTEGER("UserControl","VelocityDistanceMagFactor",distanceMagFactor);

    KEY_UINTEGER("UserControl","PagePanForIconMoveDelayMs",pagePanForIconMoveDelayMs);
Done:

    if (keyfile) {
        g_key_file_free(keyfile);
    }
}
void StaticElementSettings::readSettings(const char* filePath)
{
    GKeyFile* keyfile = g_key_file_new();
    qint32 v = INT_MIN;
    qreal vf = 0.0;
	if (!g_key_file_load_from_file(keyfile, filePath,
								   G_KEY_FILE_NONE, NULL)) {
		goto Done;
	}


	KEY_BOOLEAN("HorizontalLabeledDivider",		"UseAlignmentGeom",
													horizLabeledDivider_useAlignmentGeom);
	KEY_UINTEGER("HorizontalLabeledDivider",	"AlignmentAbsoluteGeomSizeHeightPx",
													horizLabeledDivider_alignmentHeightPx);

Done:

	if (keyfile) {
		g_key_file_free(keyfile);
	}
}
void IconGeometrySettings::readSettings(const char* filePath)
{
    GKeyFile* keyfile = g_key_file_new();
    qint32 v = INT_MIN;
    qreal vf = 0.0;
	if (!g_key_file_load_from_file(keyfile, filePath,
								   G_KEY_FILE_NONE, NULL)) {
		goto Done;
	}

	KEY_BOOLEAN("Main","UseAbsoluteGeom",useAbsoluteGeom);
	KEYS_SIZE("Main","AbsoluteGeomSizeWidthPx",
								"AbsoluteGeomSizeHeightPx",
								absoluteGeomSizePx);

	KEY_BOOLEAN("Main","UseAbsoluteFrameGeom",useAbsoluteFrameGeom);
	KEYS_SIZE("Main",		"FrameAbsoluteGeomSizeWidthPx",
							"FrameAbsoluteGeomSizeHeightPx",
							frameBoxAbsoluteGeomSizePx);
	KEYS_SIZEF("Main",		"FrameBoxHorizontalProportionToTotalGeom",
							"FrameBoxVerticalProportionToTotalGeom",
							frameBoxProportionToGeom);

	KEY_BOOLEAN("Main","UseAbsoluteMainIconGeom",useAbsoluteMainIconGeom);
	KEYS_SIZE("Main",		"MainIconAbsoluteGeomSizeWidthPx",
							"MainIconAbsoluteGeomSizeHeightPx",
							mainIconBoxAbsoluteGeomSizePx);
	KEYS_SIZEF("Main",		"MainIconBoxHorizontalProportionToTotalGeom",
							"MainIconBoxVerticalProportionToTotalGeom",
							mainIconBoxProportionToGeom);

	KEY_BOOLEAN("Main","UseAlignmentGeom",useAlignmentGeom);
	KEYS_SIZE("Main",		"AlignmentAbsoluteGeomSizeWidthPx",
								"AlignmentAbsoluteGeomSizeHeightPx",
								alignmentGeomSizePx);

	KEY_BOOLEAN("Main","UseAbsoluteRemoveDeleteDecoratorGeom",useAbsoluteRemoveDeleteDecoratorGeom);
	KEYS_SIZE("Main",		"RemoveDeleteDecoratorBoxAbsoluteGeomWidthPx",
							"RemoveDeleteDecoratorBoxAbsoluteGeomHeightPx",
							removeDeleteDecoratorBoxAbsoluteGeomSizePx);
	KEYS_SIZEF("Main",		"RemoveDeleteDecoratorBoxHorizontalProportionToTotalGeom",
							"RemoveDeleteDecoratorBoxVerticalProportionToTotalGeom",
							removeDeleteDecoratorBoxProportionToGeom);
	KEY_BOOLEAN("Main","UseAbsoluteRemoveDeleteDecoratorOffsetFromGeomOrigin",useAbsoluteRemoveDeleteDecoratorOffsetFromGeomOrigin);
	KEYS_POINT("Main", "RemoveDeleteDecoratorHorizontalOffsetFromGeomOrigin",
					   "RemoveDeleteDecoratorVerticalOffsetFromGeomOrigin",
					   removeDeleteDecoratorOffsetFromGeomOriginPx);

	KEY_BOOLEAN("Main","UseAbsoluteInstallStatusDecoratorGeom",useAbsoluteInstallStatusDecoratorGeom);
	KEYS_SIZE("Main",		"InstallStatusDecoratorBoxAbsoluteGeomWidthPx",
							"InstallStatusDecoratorBoxAbsoluteGeomHeightPx",
							installStatusDecoratorBoxAbsoluteGeomSizePx);
	KEYS_SIZEF("Main",		"InstallStatusDecoratorBoxHorizontalProportionToTotalGeom",
							"InstallStatusDecoratorBoxVerticalProportionToTotalGeom",
							installStatusDecoratorBoxProportionToGeom);
	KEY_BOOLEAN("Main","UseAbsoluteInstallStatusDecoratorOffsetFromGeomOrigin",useAbsoluteInstallStatusDecoratorOffsetFromGeomOrigin);
	KEYS_POINT("Main", "InstallStatusDecoratorHorizontalOffsetFromGeomOrigin",
					   "InstallStatusDecoratorVerticalOffsetFromGeomOrigin",
					   installStatusDecoratorOffsetFromGeomOriginPx);

	KEY_BOOLEAN("Label",	"UseAbsoluteLabelBoxGeom",useAbsoluteLabelBoxGeom);
	KEYS_SIZE("Label",		"LabelBoxAbsoluteGeomWidthPx",
							"LabelBoxAbsoluteGeomHeightPx",
							labelBoxAbsoluteGeomSizePx);
	KEYS_SIZEF("Label",		"LabelBoxHorizontalProportionToTotalGeom",
							"LabelBoxVerticalProportionToTotalGeom",
							labelBoxProportionToGeom);

	KEY_UINTEGER("Label","LabelVerticalSpacingFromMainIcon",labelVerticalSpacingPx);

	KEY_UINTEGER("Label","FontSizePx",labelFontSizePx);
	KEY_COLOR("Label","FontColor",labelFontColor);
	KEY_BOOLEAN("Label","FontUsesBold",labelFontEmbolden);

	KEYS_SIZE("Decorators",	"EdgeOffsetHorizontalPx",
							"EdgeOffsetVerticalPx",
							decoratorEdgeOffsetPx);

	KEYS_POINT("Main","MainIconHorizontalOffsetFromGeomOriginPx",
					"MainIconVerticalOffsetFromGeomOriginPx",
					mainIconOffsetFromGeomOriginPx);

	KEYS_POINT("Main","FrameHorizontalOffsetFromGeomOriginPx",
					 "FrameVerticalOffsetFromGeomOriginPx",
					 frameOffsetFromGeomOriginPx);

Done:

	if (keyfile) {
		g_key_file_free(keyfile);
	}
}
Beispiel #5
0
void Settings::load(const char* settingsFile)
{
	GKeyFile* keyfile;
	GKeyFileFlags flags;
	GError* error = 0;

	keyfile = g_key_file_new();
	if(!keyfile)
		return;
	flags = GKeyFileFlags( G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS);

	if( !g_key_file_load_from_file( keyfile, settingsFile, flags, &error ) )
	{
		g_key_file_free( keyfile );
		if (error) g_error_free(error);
		return ;
	}

	// Fill in with the macros above.
	KEY_STRING("General","ApplicationPath", lunaAppsPath );					// apps path can now be multiple paths, separated by :  (setenv PATH style)
	KEY_STRING("General","AppInstallBase", appInstallBase);	// due to all the churn surrounding moving of apps around, this is now a conf option
	KEY_STRING("General","AppInstallRelative", appInstallRelative);	// due to all the churn surrounding moving of apps around, this is now a conf option
//	KEY_STRING("General","PackageInstallBase", packageInstallBase);

	KEY_STRING("General","PackageInstallRelative", packageInstallRelative);

	KEY_STRING("General","DownloadPathMedia",downloadPathMedia);
	//validate path, reset to default if necessary
	if (!validateDownloadPath(downloadPathMedia)) {
		downloadPathMedia = "/media/internal/downloads";
	}

	KEY_STRING("General","AppInstallTemp",appInstallerTmp);

	KEY_STRING("General","SystemPath", lunaSystemPath );
	KEY_STRING("General","AppLauncherPath", lunaAppLauncherPath );
	KEY_STRING("General","SystemResourcesPath", lunaSystemResourcesPath );
	KEY_STRING("General","SystemLocalePath", lunaSystemLocalePath );
	KEY_STRING("General","PresetLaunchPointsPath",lunaPresetLaunchPointsPath);
	KEY_STRING("General","LaunchPointsPath", lunaLaunchPointsPath);
	KEY_STRING("General", "PreferencesPath", lunaPrefsPath);
	KEY_STRING("General","UiComponentsPath", lunaQmlUiComponentsPath );
	KEY_BOOLEAN("General", "ShowReticle", showReticle);

	KEY_INTEGER("General", "NotificationSoundDuration", notificationSoundDuration);

	KEY_INTEGER( "CoreNavi", "ThrobberBrightnessInLight", ledPulseMaxBrightness);
	KEY_INTEGER( "CoreNavi", "ThrobberBrightnessInDark", ledPulseDarkBrightness);
	KEY_BOOLEAN( "CoreNavi", "EnableLightBar", lightbarEnabled);
	KEY_INTEGER( "CoreNavi", "CoreNaviBrightnessScaler", coreNaviScaler);
	KEY_INTEGER( "CoreNavi", "GestureAnimationSpeedInMs", gestureAnimationSpeed);
    KEY_INTEGER( "CoreNavi", "HomeDoubleClickDuration", homeDoubleClickDuration);

	KEY_INTEGER( "Display", "BrightnessOutdoorScale", backlightOutdoorScale);
	KEY_INTEGER( "Display", "BrightnessDimScale", backlightDimScale);
	KEY_INTEGER( "Display", "BrightnessDarkScale", backlightDarkScale);

	KEY_BOOLEAN( "Display", "EnableALS", enableAls);
	KEY_BOOLEAN( "Display", "TurnOffAccelerometerWhenDimmed", turnOffAccelWhenDimmed);
	KEY_BOOLEAN( "Display", "DisableLocking", disableLocking);
	KEY_INTEGER( "Display", "LockScreenTimeoutMs", lockScreenTimeout);

	KEY_INTEGER( "Memory", "CardLimit", cardLimit );
	KEY_INTEGER( "General","DisplayWidth",displayWidth);
	KEY_INTEGER( "General","DisplayHeight",displayHeight);
	KEY_INTEGER( "General","DisplayNumBuffers", displayNumBuffers);
	KEY_INTEGER("General", "MaxPenMoveFreq", maxPenMoveFreq);
	KEY_INTEGER("General",  "MaxPaintLoad", maxPaintLoad);
	KEY_INTEGER("General", "MaxGestureChangeFreq", maxGestureChangeFreq);
	KEY_INTEGER("General", "MaxTouchChangeFreq", maxTouchChangeFreq);
	KEY_BOOLEAN( "Debug", "WatchPenEvents", debug_trackInputEvents );
	KEY_BOOLEAN( "Debug", "EnableDebugModeByDefault", debug_enabled );
	KEY_BOOLEAN( "Debug", "PiranhaDrawColoredOutlines", debug_piranhaDrawColoredOutlines);
	KEY_BOOLEAN( "Debug", "PiranhaDisplayFps", debug_piranhaDisplayFps);
	KEY_BOOLEAN( "Debug", "ShowGestures", debug_showGestures);

	KEY_BOOLEAN( "Debug", "DoVerboseCrashLogging", debug_doVerboseCrashLogging);
	KEY_BOOLEAN( "Debug", "LoopInCrashHandler", debug_loopInCrashHandler);
	KEY_INTEGER( "Debug", "AppInstallerCleaner",debug_appInstallerCleaner );
	KEY_STRING( "General", "CmdResourceHandlers", lunaCmdHandlerPath );
	KEY_STRING( "General", "CmdResourceHandlersActiveCopy", lunaCmdHandlerSavedPath);
	KEY_STRING( "Fonts", "Banner", fontBanner );
	KEY_STRING( "Fonts", "ActiveBanner", fontActiveBanner );
	KEY_STRING( "Fonts", "LockWindow", fontLockWindow );
	KEY_STRING( "Fonts", "DockMode", fontDockMode );
	KEY_STRING( "Fonts", "Quicklaunch", fontQuicklaunch );
	KEY_STRING( "Fonts", "StatusBar", fontStatusBar );
	KEY_STRING( "Fonts", "KeyboardKeys", fontKeyboardKeys );
	KEY_STRING( "Fonts", "StatusBar", fontStatusBar );

	KEY_INTEGER("TouchEvents", "TapRadiusMax", tapRadius);
	KEY_INTEGER("TouchEvents", "TapRadiusMin", tapRadiusMin);
	KEY_INTEGER("TouchEvents", "TapRadiusShrinkPerc", tapRadiusShrinkPercent);
	KEY_INTEGER("TouchEvents", "TapRadiusShrinkGranMs", tapRadiusShrinkGranMs);
    KEY_BOOLEAN("TouchEvents", "EnableForWebApps", enableTouchEventsForWebApps);

	tapRadiusSquared = tapRadius * tapRadius;

	KEY_INTEGER("TouchEvents", "DoubleClickDuration", tapDoubleClickDuration);
	// Clamp to sensible values
	if (tapDoubleClickDuration < 50)
		tapDoubleClickDuration = 50;
	else if (tapDoubleClickDuration > 2000)
		tapDoubleClickDuration = 2000;

	KEY_INTEGER("VTrackBall", "PixelsPerMoveH", h_trackball_pixels_per_move );
	KEY_INTEGER("VTrackBall", "PixelsPerMoveV", v_trackball_pixels_per_move );
	KEY_INTEGER("VTrackBall", "AccelRateH1", h_accel_rate1 );
	KEY_INTEGER("VTrackBall", "AccelRateV1", v_accel_rate1 );
	KEY_INTEGER("VTrackBall", "AccelConstH1", h_accel_const1 );
	KEY_INTEGER("VTrackBall", "AccelConstV1", v_accel_const1 );
	KEY_INTEGER("VTrackBall", "AccelRateH2", h_accel_rate2 );
	KEY_INTEGER("VTrackBall", "AccelRateV2", v_accel_rate2 );
	KEY_INTEGER("VTrackBall", "AccelConstH2", h_accel_const2 );
	KEY_INTEGER("VTrackBall", "AccelConstV2", v_accel_const2 );

	KEY_STRING("General", "QuickLaunchDefaultPositions", quicklaunchDefaultPositions );
#if defined(TARGET_DESKTOP)
	//If we don't have a home directory, we'll set it to /tmp. Otherwise, this does nothing.
	setenv("HOME", "/tmp", 0);
        const std::string homeFolder = getenv("HOME");
	quicklaunchUserPositions = homeFolder + "/.user-dock-positions.json";
#endif
	KEY_STRING("General", "QuickLaunchUserPositions", quicklaunchUserPositions );
	KEY_INTEGER( "General", "StatusBarTitleMaxWidth", statusBarTitleMaxWidth);

	KEY_BOOLEAN( "DockMode", "DockModePrelaunchAllApps", dockModePrelaunchAllApps);
	KEY_BOOLEAN( "DockMode", "DockModeCloseAppOnMinimize", dockModeCloseOnMinimize);
	KEY_BOOLEAN( "DockMode", "DockModeCloseAppsOnExit", dockModeCloseOnExit);
	KEY_INTEGER( "DockMode", "DockModeMaxApps", dockModeMaxApps);
	KEY_INTEGER( "DockMode", "DockModeNightBrightness", dockModeNightBrightness);
	KEY_INTEGER( "DockMode", "DockModeMenuHeight", dockModeMenuHeight);
	KEY_STRING("DockMode", "DockModeDefaultPositions", quicklaunchDefaultPositions );
#if defined(TARGET_DESKTOP)
	dockModeUserPositions = homeFolder + "/.user-dock-mode-launcher-positions.json";
#endif
	KEY_STRING("DockMode", "DockModeUserPositions", quicklaunchUserPositions );

	KEY_BOOLEAN( "VirtualKeyboard", "VirtualKeyboardEnabled", virtualKeyboardEnabled);

	KEY_BOOLEAN( "VirtualCoreNavi", "VirtualCoreNaviEnabled", virtualCoreNaviEnabled);
	KEY_INTEGER( "VirtualCoreNavi", "VirtualCoreNaviHeight", virtualCoreNaviHeight);

	KEY_DOUBLE("Launcher", "CardSideScrollSwipeThreshold", launcherSideSwipeThreshold);
	KEY_BOOLEAN("Launcher", "UseOGLHardwareAntialias", launcherUsesHwAA);
	KEY_INTEGER("Launcher", "LauncherItemRowSpacingAdjust",launcherRowSpacingAdjust);
	KEY_INTEGER("Launcher", "LauncherLabelWidthAdjust",launcherLabelWidthAdjust);
	KEY_INTEGER("Launcher", "LauncherLabelXPadding",launcherLabelXPadding);
	KEY_DOUBLE("Launcher","LauncherIconReorderPositionThreshold",launcherIconReorderPositionThreshold);

	KEY_BOOLEAN("UI", "DisplayUiRotates", displayUiRotates);
	KEY_BOOLEAN("UI", "TabletUi", tabletUi);
	KEY_INTEGER("UI", "HomeButtonOrientationAngle", homeButtonOrientationAngle);
	KEY_INTEGER("UI", "EmuModeOrientationAngle", emuModeOrientationAngle);
	KEY_INTEGER("UI", "PositiveSpaceTopPadding", positiveSpaceTopPadding);
	KEY_INTEGER("UI", "PositiveSpaceBottomPadding", positiveSpaceBottomPadding);
	KEY_DOUBLE("UI", "MaximumNegativeSpaceHeightRatio", maximumNegativeSpaceHeightRatio);
	KEY_DOUBLE("UI", "ActiveCardWindowRatio", activeCardWindowRatio);
	KEY_DOUBLE("UI", "NonActiveCardWindowRatio", nonActiveCardWindowRatio);
	KEY_DOUBLE("UI", "GhostCardFinalRatio", ghostCardFinalRatio);
	KEY_INTEGER("UI", "CardGroupRotFactor", cardGroupRotFactor);
	KEY_INTEGER("UI", "GapBetweenCardGroups", gapBetweenCardGroups);
	KEY_INTEGER("UI", "OverlayNotificationsHeight", overlayNotificationsHeight);
	KEY_INTEGER("UI", "SplashIconSize", splashIconSize);
	KEY_BOOLEAN("UI", "EnableSplashBackgrounds", enableSplashBackgrounds);
	KEY_BOOLEAN("UI", "AtlasEnabled", atlasEnabled);

	KEY_INTEGER("UI", "EmulatedCardWidth", emulatedCardWidth);
	KEY_INTEGER("UI", "EmulatedCardHeight", emulatedCardHeight);
	KEY_INTEGER("UI", "ModalWindowWidth", modalWindowWidth);
	KEY_INTEGER("UI", "ModalWindowHeight", modalWindowHeight);

	KEY_DOUBLE("UI", "CardGroupingXDistanceFactor", cardGroupingXDistanceFactor);
    KEY_DOUBLE("UI", "CardDimmPercentage", cardDimmPercentage);

	KEY_INTEGER("UI", "AtlasMemThreshold", atlasMemThreshold);
	KEY_BOOLEAN("Debug", "LauncherAtlasStatistics", launcherAtlasStatistics);
	KEY_BOOLEAN("Debug", "DumpLauncherAtlas", launcherDumpAtlas);
	if (forceSoftwareRendering) {
		atlasEnabled = false;
		launcherAtlasStatistics = false;
	} else if (atlasEnabled && atlasMemThreshold > 0 && MeasureTotalRAM() < atlasMemThreshold * 1024) {
		g_message("Atlas disabled because physical memory below %dMB threshold\n", atlasMemThreshold);
		atlasEnabled = false;
	}

	KEY_INTEGER("DownloadManager", "MaxQueueLength", maxDownloadManagerQueueLength);
	KEY_INTEGER("DownloadManager", "MaxConcurrent", maxDownloadManagerConcurrent);
	KEY_INTEGER("DownloadManager", "MaxRecvSpeed", maxDownloadManagerRecvSpeed);

	KEY_STRING( "Demo", "GestureRepeaterIp", cesGestureRepeaterIp );
	KEY_INTEGER( "Demo", "GestureRepeaterPort", cesGestureRepeaterPort );
	KEY_BOOLEAN( "Demo", "EnableGestureRepeater", enableGestureRepeater );

	KEY_BOOLEAN( "Demo", "DemoMode", demoMode );

	KEY_BOOLEAN( "Debug", "ShowAppStats", showAppStats );

	KEY_BOOLEAN( "General", "CollectUseStats", collectUseStats );

	KEY_BOOLEAN( "General" , "UsePartialKeywordMatchForAppSearch",usePartialKeywordAppSearch);
	KEY_BOOLEAN( "General" , "ScanCalculatesAppSizes",scanCalculatesAppSizes);

	KEY_INTEGER("KeepAlive", "MaxParked", maxNumParkedApps );

	KEY_INTEGER("CpuShare", "UiMainLow", uiMainCpuShareLow);
	KEY_INTEGER("CpuShare", "UiOtherLow", uiOtherCpuShareLow);
	KEY_INTEGER("CpuShare", "JavaLow", javaCpuShareLow);
	KEY_INTEGER("CpuShare", "WebLow", webCpuShareLow);
	KEY_INTEGER("CpuShare", "GameLow", gameCpuShareLow);
	KEY_INTEGER("CpuShare", "Default", cpuShareDefault);

	KEY_BOOLEAN("AllowTurboMode", "General", allowTurboMode);

	KEY_STRING( "General", "WifiInterfaceName", wifiInterfaceName );
	KEY_STRING( "General", "WanInterfaceName", wanInterfaceName );

	KEY_BOOLEAN( "Memory", "CanRestartHeadlessApps", canRestartHeadlessApps );
	KEY_BOOLEAN( "Debug", "PerformanceLogs", perfTesting);

    KEY_INTEGER("General", "schemaValidationOption", schemaValidationOption);


	// apps to launch at boot time

	gchar** appsToLaunchAtBootStr =   g_key_file_get_string_list(keyfile, "LaunchAtBoot",
																 "Applications", NULL, NULL);
	if (appsToLaunchAtBootStr) {

		int index = 0;
		appsToLaunchAtBoot.clear();
		while (appsToLaunchAtBootStr[index]) {
			appsToLaunchAtBoot.insert(appsToLaunchAtBootStr[index]);
			SETTINGS_TRACE("App to launch at boot time: %s\n", appsToLaunchAtBootStr[index]);
			++index;
		}

		g_strfreev(appsToLaunchAtBootStr);
	}

	// apps to keep alive
	gchar** appsToKeepAliveStr =   g_key_file_get_string_list(keyfile, "KeepAlive",
																 "Applications", NULL, NULL);
	if (appsToKeepAliveStr) {

		int index = 0;
		appsToKeepAlive.clear();
		while (appsToKeepAliveStr[index]) {
			appsToKeepAlive.insert(appsToKeepAliveStr[index]);
			SETTINGS_TRACE("App to keep alive: %s\n", appsToKeepAliveStr[index]);
			++index;
		}

		g_strfreev(appsToKeepAliveStr);
	}

	// apps to keep alive forever (pinned)
	gchar** appsToKeepAliveForeverStr =   g_key_file_get_string_list(keyfile, "KeepAliveUntilMemPressure",
																 "Applications", NULL, NULL);
	if (appsToKeepAliveForeverStr) {

		int index = 0;
		appsToKeepAliveUntilMemPressure.clear();
		while (appsToKeepAliveForeverStr[index]) {
			appsToKeepAliveUntilMemPressure.insert(appsToKeepAliveForeverStr[index]);
			SETTINGS_TRACE("App to keep alive until memory pressure: %s\n", appsToKeepAliveForeverStr[index]);
			++index;
		}

		g_strfreev(appsToKeepAliveForeverStr);
	}

	// apps to allow under low memory conditions
	gchar** appsToAllowInLowMemoryStr = g_key_file_get_string_list(keyfile, "Memory",
																   "AppsToAllowInLowMemory", NULL, NULL);
	if (appsToAllowInLowMemoryStr) {

		int index = 0;
		appsToAllowInLowMemory.clear();
		while (appsToAllowInLowMemoryStr[index]) {
			appsToAllowInLowMemory.insert(appsToAllowInLowMemoryStr[index]);
			g_message("App to allow in Low memory: %s", appsToAllowInLowMemoryStr[index]);
			++index;
		}

		g_strfreev(appsToAllowInLowMemoryStr);
	}

	// apps with accelerated compositing disabled
	gchar** appsToDisableAccelCompositingStr = g_key_file_get_string_list(keyfile, "AccelCompositingDisabled",
											"Applications", NULL, NULL);
	if (appsToDisableAccelCompositingStr) {
		int index = 0;
		appsToDisableAccelCompositing.clear();
		while (appsToDisableAccelCompositingStr[index]) {
			appsToDisableAccelCompositing.insert(appsToDisableAccelCompositingStr[index]);
			SETTINGS_TRACE("App with accelerated compositing disabled: %s\n", appsToDisableAccelCompositingStr[index]);
			++index;
		}

		g_strfreev(appsToDisableAccelCompositingStr);
	}

	// SUC apps that have special launch privs
	gchar** sucAppsList =   g_key_file_get_string_list(keyfile, "SUCApps",
			"Applications", NULL, NULL);
	if (sucAppsList) {

		int index = 0;
		sucApps.clear();
		while (sucAppsList[index]) {
			sucApps.insert(sucAppsList[index]);
			SETTINGS_TRACE("SUC App with special launch priviledge: %s\n", sucAppsList[index]);
			++index;
		}

		g_strfreev(sucAppsList);
	}

	// ...

	g_key_file_free( keyfile );

	// sanity check on the homeButtonOrientationAngle value:

	if(homeButtonOrientationAngle >= 360)
		homeButtonOrientationAngle = homeButtonOrientationAngle%360;

	if(homeButtonOrientationAngle < -90)
		homeButtonOrientationAngle += 360;

	if((homeButtonOrientationAngle != 0) && (homeButtonOrientationAngle != 90) &&
	   (homeButtonOrientationAngle != 180) && (homeButtonOrientationAngle != 270) &&
	   (homeButtonOrientationAngle != -90))
		homeButtonOrientationAngle = 0;

	// sanity check on the emuModeOrientationAngle value:

	if(emuModeOrientationAngle >= 360)
		emuModeOrientationAngle = emuModeOrientationAngle%360;

	if(emuModeOrientationAngle < -90)
		emuModeOrientationAngle += 360;

	if((emuModeOrientationAngle != 0) && (emuModeOrientationAngle != 90) &&
	   (emuModeOrientationAngle != 180) && (emuModeOrientationAngle != 270) &&
	   (emuModeOrientationAngle != -90))
		emuModeOrientationAngle = 0;

}
Beispiel #6
0
void LayoutSettings::load(const char* settingsFile)
{
	GKeyFile* keyfile;
	GKeyFileFlags flags;
	GError* error = 0;

	keyfile = g_key_file_new();
	if(!keyfile)
		return;
	flags = GKeyFileFlags( G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS);

	if( !g_key_file_load_from_file( keyfile, settingsFile, flags, &error ) )
	{
		g_key_file_free( keyfile );
		if (error) g_error_free(error);
		return ;
	}

	KEYS_SIZEF("Main", "launcherWidthPctScreenRelative","launcherHeighPctScreenRelative",launcherSizePctScreenRelative);
	KEY_INTEGER("Main","centerUiVerticalOffset",centerUiVerticalOffset);
	KEY_INTEGER("Main","searchPillWidth",searchPillWidth);
	KEY_INTEGER("Main","searchPillInnerIconRightOffset",searchPillInnerIconRightOffset);
	KEY_INTEGER("Main","searchPillTopOffsetFromStatusBar",searchPillTopOffsetFromStatusBar);
	KEYS_POINT("Main","searchPillInnerTextHorizAdjust","searchPillInnerTextVertAdjust",searchPillInnerTextAdjust);
	KEY_BOOLEAN("Main","openglHatesOddNumbers",openglHatesOddNumbers);

	KEY_BOOLEAN("Tabs","tabBarUseAbsoluteSize",tabBarUseAbsoluteSize);
	KEYS_SIZEF("Tabs", "tabBarWidthPctLauncherRelative","tabBarHeightPctLauncherRelative",tabBarSizePctLauncherRelative);
	KEY_INTEGER("Tabs","tabBarHeightAbsolute",tabBarHeightAbsolute);
	KEY_INTEGER("Tabs","tabBarTabFontSizePx",tabBarTabFontSizePx);
	KEY_BOOLEAN("Tabs","tabBarTabFontEmbolden",tabBarTabFontEmbolden);
	KEY_COLOR("Tabs","tabBarSelectedTabFontColor",tabBarSelectedTabFontColor);
	KEY_COLOR("Tabs","tabBarUnSelectedTabFontColor",tabBarUnSelectedTabFontColor);
	KEY_INTEGER("Tabs","tabTextVerticalPosAdjust",tabTextVerticalPosAdjust);

	KEY_INTEGER("DoneButton","doneButtonFontSizePx",doneButtonFontSizePx);
	KEY_BOOLEAN("DoneButton","doneButtonFontEmbolden",doneButtonFontEmbolden);
	KEY_COLOR("DoneButton","doneButtonFontColor",doneButtonFontColor);
	KEY_INTEGER("DoneButton","doneButtonTextVerticalPosAdjust",doneButtonTextVerticalPosAdjust);
	KEYS_POINT("DoneButton",
			"doneButtonHorizontalPositionAdjustPx",
			"doneButtonVerticalPositionAdjustPx",
			doneButtonPositionAdjust);
	KEYS_SIZEF("Pages","pageWidthPctLauncherRelative","pageHeightPctLauncherRelative",pageSizePctLauncherRelative);
	KEY_BOOLEAN("Pages","autoPageSize",autoPageSize);

	KEYS_SIZE("Pages","pageLeftBorderActivationSizePx","pageRightBorderActivationSizePx",pageHorizontalBorderActivationAreaSizePx);
	KEYS_SIZE("Pages","pageTopActivationSizePx","pageBottomActivationSizePx",pageVerticalBorderActivationAreaSizePx);

	KEY_INTEGER("Pages","pageTopBorderActivationTimeoutMs",pageTopBorderActivationTimeoutMs);
	KEY_INTEGER("Pages","pageBottomBorderActivationTimeoutMs",pageBottomBorderActivationTimeoutMs);
	KEY_INTEGER("Pages","pageLeftBorderActivationTimeoutMs",pageLeftBorderActivationTimeoutMs);
	KEY_INTEGER("Pages","pageRightBorderActivationTimeoutMs",pageRightBorderActivationTimeoutMs);

	KEY_BOOLEAN("QuickLaunch","quickLaunchBarUseAbsoluteSize",quickLaunchBarUseAbsoluteSize);
	KEYS_SIZEF("QuickLaunch","quickLaunchBarWidthPctScreenRelative","quickLaunchBarHeightPctScreenRelative",quickLaunchBarSizePctScreenRelative);
	KEY_INTEGER("QuickLaunch","quickLaunchBarHeightAbsolute",quickLaunchBarHeightAbsolute);
	KEYS_POINT("QuickLaunch","quickLaunchBarLauncherAccessButtonHorizontalOffsetPx",
							"quickLaunchBarLauncherAccessButtonVerticalOffsetPx",
							quickLaunchBarLauncherAccessButtonOffsetPx);
	KEYS_POINT("QuickLaunch","quickLaunchItemAreaHorizontalOffsetPx",
							"quickLaunchItemAreaVerticalOffsetPx",
							quickLaunchItemAreaOffsetPx);
	KEY_INTEGER("QuickLaunch","quickLaunchMaxItems",quickLaunchMaxItems);

	KEYS_POINT("Icons","iconVisibleLocationHorizontalOffsetPx","iconVisibleLocationVerticalOffsetPx",iconVisibleLocationOffsetPx);

	g_key_file_free( keyfile );
}
void OperationalSettings::readSettings(const char* filePath)
{
    GKeyFile* keyfile = g_key_file_new();
    qint32 v = INT_MIN;
    qreal vf = 0.0;
	if (!g_key_file_load_from_file(keyfile, filePath,
								   G_KEY_FILE_NONE, NULL)) {
		goto Done;
	}

	KEY_QSTRING("Main","StartOnPageDesignated",startOnPageDesignated);
	KEY_QSTRING("Main","ReturnToPageDesignatedOnHide",returnToDesignatorOnHide);
	KEY_QSTRING("Main","SavedPagesDirectory",savedPagesDirectory);
	KEY_QSTRING("Main","AppBlacklistFilepath",appBlacklistFilepath);
	KEY_BOOLEAN("Main","ForceFavoritesToAllContent",forceFavoritesToAllContent);
	KEY_BOOLEAN("Main","UseAllContentInsteadOfEmptyFavorites",useAllContentInsteadOfEmptyFavorites);
	KEY_BOOLEAN("Main","ForceSaveOnHide",forceSaveOnHide);
	KEY_BOOLEAN("Main","UsePreciseTimeForMasterFilename",usePreciseTimeForMasterSaveFileName);
	KEY_BOOLEAN("Main","UseSingleMasterFilename",useSingleMasterSaveFileName);
	KEY_BOOLEAN("Main","UseApplicationManagerHiddenFlag",useApplicationManagerHiddenFlag);
	KEY_BOOLEAN("Main","UseStagedRendering",useStagedRendering);
	KEY_QSTRING("Main","AppKeywordsToPageDesignatorMapFilepath",appKeywordsToPageDesignatorMapFilepath);
	KEY_BOOLEAN("Main","UseSingleQuicklaunchSaveFilename",useSingleQuicklaunchSaveFileName);
	KEY_UINTEGER("Main","FavoritesPageIndex",favoritesPageIndex);
	KEY_UINTEGER("Main","InstalledAppsPageIndex",installedAppsPageIndex);
	KEY_QSTRING("Main","AppCatalogAppId",appCatalogAppId);
	KEY_UINTEGER("Main","SettingsPageIndex",settingsPageIndex);
	KEY_QSTRING("Main","SettingsAppCategoryDesignator",settingsAppCategoryDesignator);
	KEY_UINTEGER("Main","SystemAppsPageIndex",systemAppsPageIndex);
	KEY_BOOLEAN("Main","PreferAppKeywordsForAppPlacement",preferAppKeywordsForAppPlacement);
	KEY_BOOLEAN("Main","UseDynamicMultiPageInitialConfigurator",useDynamicMultiPageInitialConfigurator);
	KEY_BOOLEAN("Main","AllowedToLaunchInReorderMode",allowedToLaunchInReorderMode);
	KEY_BOOLEAN("Main","IgnoreLegacyCustomizationFiles",ignoreLegacyCustomizationFiles);
	KEY_BOOLEAN("Main","SafeLauncherBoot",safeLauncherBoot);
	KEY_QSTRING("Debug","LogDirPath",logDirPath);
	KEY_QSTRING("Debug","ArchiverExeFilename",archiverExeFilename);

	verify();
Done:

	if (keyfile) {
		g_key_file_free(keyfile);
	}
}