Kitlist  1.1.0
yamlconfig.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of Kitlist, a program to maintain a simple list
4  of items and assign items to one or more categories.
5 
6  Copyright (C) 2008-2021 Frank Dean
7 
8  Kitlist is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  Kitlist is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Kitlist. If not, see <http://www.gnu.org/licenses/>.
20 
21 */
22 #ifndef YAML_CONFIG_H
23 #define YAML_CONFIG_H 1
24 #include <deque>
25 #include <glibmm/i18n.h>
26 #include <glibmm/ustring.h>
27 #include <iostream>
28 #include <string>
29 #include <config.h>
30 
32 const std::string DEFAULT_PAGE_TITLE = _("Kitlist");
33 
35 const gint DEFAULT_MAX_RECENT_FILES = 4;
36 
37 #ifndef GCONF
38 
55 class YamlConfig {
56 private:
57 
60 
65  Glib::ustring m_current_filename;
66 
72  Glib::ustring m_debug_log_filename;
73 
75  Glib::ustring m_page_title;
76 
77  Glib::ustring get_config_filename();
78 
80  std::deque<Glib::ustring> m_mru_file_history;
81 public:
82  YamlConfig();
83 
85  ~YamlConfig() { save(); };
86 
87  void load();
88 
89  void save();
90 
93  Glib::ustring get_current_filename() { return m_current_filename; };
94 
98  void set_current_filename(Glib::ustring filename) { m_current_filename = filename; };
99 
102  Glib::ustring get_page_title() { return m_page_title; };
103 
109  void set_page_title(Glib::ustring title) { m_page_title = title; };
110 
111  void add_recent_filename(Glib::ustring filename);
112 
116  std::deque<Glib::ustring> get_recent_filenames() { return m_mru_file_history; };
117 
120  Glib::ustring get_debug_log_filename() { return m_debug_log_filename; };
121 };
122 
123 #endif // GCONF
124 #endif // YAML_CONFIG_H
Glib::ustring m_debug_log_filename
The name of the log file to write debug information to.
Definition: yamlconfig.hpp:72
Glib::ustring get_debug_log_filename()
the name of the debug log file.
Definition: yamlconfig.hpp:120
Glib::ustring get_config_filename()
Definition: yamlconfig.cpp:129
Glib::ustring m_current_filename
The current filename.
Definition: yamlconfig.hpp:65
Maintains the application&#39;s configuration parameters in a YAML formatted file.
Definition: yamlconfig.hpp:55
void add_recent_filename(Glib::ustring filename)
Adds a filename to the list of recently used filenames.
Definition: yamlconfig.cpp:141
std::deque< Glib::ustring > m_mru_file_history
The history list of most recently used filenames.
Definition: yamlconfig.hpp:80
Glib::ustring get_current_filename()
The current filename.
Definition: yamlconfig.hpp:93
void set_current_filename(Glib::ustring filename)
Sets the current filename.
Definition: yamlconfig.hpp:98
gint m_max_recent_files
The list of recently used files for the recent files menu.
Definition: yamlconfig.hpp:59
const std::string DEFAULT_PAGE_TITLE
The default page title for printing.
Definition: yamlconfig.hpp:32
Glib::ustring get_page_title()
The page title to use for printing or creating a PDF.
Definition: yamlconfig.hpp:102
void set_page_title(Glib::ustring title)
Set the page title.
Definition: yamlconfig.hpp:109
const gint DEFAULT_MAX_RECENT_FILES
The maximum number of recent files to maintain.
Definition: yamlconfig.hpp:35
void load()
Loads the configuration file.
Definition: yamlconfig.cpp:60
std::deque< Glib::ustring > get_recent_filenames()
The history list of recent filenames.
Definition: yamlconfig.hpp:116
~YamlConfig()
Also saves the configuration on program exit.
Definition: yamlconfig.hpp:85
Glib::ustring m_page_title
The title to use when printing a page or creating a PDF.
Definition: yamlconfig.hpp:75
void save()
Saves the current configuration.
Definition: yamlconfig.cpp:104

Copyright 2008-2021 Frank Dean