<commit_before>/* DepotsSettings.cpp
 * Copyright 2016 <NAME>
 * All rights reserved. Distributed under the terms of the BSD License.
 */
#include "constants.h"
#include "DepotsSettings.h"

#include <FindDirectory.h>
#include <StringList.h>

#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "DepotsSettings"

const char* settingsFilename = "Depots_settings";


DepotsSettings::DepotsSettings()
{
	status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &fFilePath);
	if (status == B_OK) {
		status = fFilePath.Append(settingsFilename);
	}
	fInitStatus = status;
}


BRect
DepotsSettings::GetFrame()
{
	BMessage settings(_ReadFromFile());
	BRect frame;
	settings.FindRect(key_frame, &frame);
	return frame;
}


void
DepotsSettings::SetFrame(BRect frame)
{
	BMessage settings(_ReadFromFile());
	settings.RemoveData(key_frame);<commit_msg>Set default window frame when no settings found<commit_after>/* DepotsSettings.cpp
 * Copyright 2016 <NAME>
 * All rights reserved. Distributed under the terms of the BSD License.
 */
#include "constants.h"
#include "DepotsSettings.h"

#include <FindDirectory.h>
#include <StringList.h>

#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "DepotsSettings"

const char* settingsFilename = "Depots_settings";


DepotsSettings::DepotsSettings()
{
	status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &fFilePath);
	if (status == B_OK) {
		status = fFilePath.Append(settingsFilename);
	}
	fInitStatus = status;
}


BRect
DepotsSettings::GetFrame()
{
	BMessage settings(_ReadFromFile());
	BRect frame;
	status_t status = settings.FindRect(key_frame, &frame);
	// Set deafault off screen so it will center itself
	if(status != B_OK)
		frame.Set(-10, -10, 750, 300);
	return frame;
}


void
DepotsSettings::SetFrame(BRect frame)
{
	BMessage settings(_ReadFromFile());
	settings.RemoveData(key_frame);
{'fraction_non_alphanumeric': 0.11302475780409042, 'fraction_numerical': 0.00968783638320775, 'mean_word_length': 6.177606177606178, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '623995', 'n_tokens_mistral': 633, 'n_tokens_neox': 612, 'n_words': 145}