<commit_before>/*
 * Controller.h
 *
 *  Created on: 16 Apr 2016
 *      Author: jeremy
 */

#ifndef SOURCE_CONTROLLERS_MAINCONTROLLER_H_
#define SOURCE_CONTROLLERS_MAINCONTROLLER_H_


#include "MetronomeController.h"
#include "KitController.h"
#include "ConfigController.h"
#include "CoachController.h"

#include <libexadrums/Api/eXaDrums.hpp>

#include <gtkmm/builder.h>
#include <gtkmm/button.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/aboutdialog.h>
#include <gtkmm/window.h>

#include <string>
#include <memory>
#include <functional>

#include <cstdlib>


namespace Controllers
{

	class MainController
	{

	public:

		MainController();
		virtual ~MainController();

		void Create(Glib::RefPtr<Gtk::Builder>& builder, const std::string& mf, const std::function<void()>& quit, bool isRoot);
		bool ReebootRequired() const { return configController->IsImportConfig(); }

	private:

		// Signals methods
		// Dialogs
		void ShowAboutDialog();
		void HideAboutDialog(int responseId);

		bool isCreated = false;

		std::shared_ptr<eXaDrumsApi::eXaDrums> drumKit;
		Glib::RefPtr<Gtk::Builder> builder;

		// Controllers
		std::unique_ptr<MetronomeController> metronomeController;
		std::unique_ptr<CoachController> coachController;
		std::unique_ptr<KitController> kitController;
		std::unique_ptr<ConfigController> configController;

		// Buttons
		Gtk::Button* aboutButton = nullptr;
		Gtk::Button* rhythmCoachPrefButton = nullptr;
<commit_msg>Bug fix: segfault on config reset without starting<commit_after>/*
 * Controller.h
 *
 *  Created on: 16 Apr 2016
 *      Author: jeremy
 */

#ifndef SOURCE_CONTROLLERS_MAINCONTROLLER_H_
#define SOURCE_CONTROLLERS_MAINCONTROLLER_H_


#include "MetronomeController.h"
#include "KitController.h"
#include "ConfigController.h"
#include "CoachController.h"

#include <libexadrums/Api/eXaDrums.hpp>

#include <gtkmm/builder.h>
#include <gtkmm/button.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/aboutdialog.h>
#include <gtkmm/window.h>

#include <string>
#include <memory>
#include <functional>

#include <cstdlib>


namespace Controllers
{

	class MainController
	{

	public:

		MainController();
		virtual ~MainController();

		void Create(Glib::RefPtr<Gtk::Builder>& builder, const std::string& mf, const std::function<void()>& quit, bool isRoot);
		bool ReebootRequired() const 
		{
			if(configController != nullptr)
				return configController->IsImportConfig(); 
			
			return false;
		}

	private:

		// Signals methods
		// Dialogs
		void ShowAboutDialog();
		void HideAboutDialog(int responseId);

		bool isCreated = false;

		std::shared_ptr<eXaDrumsApi::eXaDrums> drumKit;
		Glib::RefPtr<Gtk::Builder> builder;

		// Controllers
		std::unique_ptr<MetronomeController> metronomeController;
		std::unique_ptr<CoachController> coachController;
		std::unique_ptr<KitController> kitController;
		std::unique_ptr<ConfigController> configController;

		// Buttons
		Gtk::Button* aboutButton = nullptr;
		Gtk::Button* rhythmCoachPrefButton = nullptr;

{'fraction_non_alphanumeric': 0.12038576654472896, 'fraction_numerical': 0.0039906883937479215, 'mean_word_length': 5.5249457700650755, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 41, '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': '3849742', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1011, 'n_words': 205}