The Battle for Wesnoth  1.17.0-dev
game_cache_options.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2021
3  by Iris Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
19 
20 namespace gui2
21 {
22 class label;
23 class button;
24 namespace dialogs
25 {
26 
27 /**
28  * @ingroup GUIWindowDefinitionWML
29  *
30  * A Preferences subdialog including a report on the location and size of the game's WML cache,
31  * buttons to copy its path to clipboard or browse to it, and the possibility of clearing stale files from the cache or purging it entirely.
32  * Key |Type |Mandatory|Description
33  * ------------------|--------------|---------|-----------
34  * path | text_box |yes |Cache dir path.
35  * copy | @ref button |yes |Copies the cache path to clipboard.
36  * browse | @ref button |yes |Browses to the cache path using the platform's file management application.
37  * size | @ref label |yes |Current total size of the cache dir's contents.
38  * clean | @ref button |yes |Cleans the cache, erasing stale files not used by the Wesnoth version presently running the dialog.
39  * purge | @ref button |yes |Purges the cache in its entirety.
40  */
42 {
43 public:
44  /** Constructor. */
46 
47  /**
48  * The display function.
49  *
50  * See @ref modal_dialog for more information.
51  */
53 
54 private:
55  std::string cache_path_;
56 
60 
61  void clean_cache_callback();
62  bool clean_cache();
63 
64  void purge_cache_callback();
65  bool purge_cache();
66 
68 
69  void browse_cache_callback();
70 
72 
73  virtual const std::string& window_id() const override;
74 
75  virtual void pre_show(window& window) override;
76 
77  virtual void post_show(window& window) override;
78 };
79 
80 } // namespace dialogs
81 } // namespace gui2
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
std::string cache_path_
The display function.
A label displays a text, the text can be wrapped but no scrollbars are provided.
Definition: label.hpp:57
Generic file dialog.
Definition: field-fwd.hpp:23
std::string label
What to show in the filter&#39;s drop-down list.
Definition: manager.cpp:217
Various uncategorised dialogs.
A Preferences subdialog including a report on the location and size of the game&#39;s WML cache...
Abstract base class for all modal dialogs.
virtual const std::string & window_id() const override
The id of the window to build.
Simple push button.
Definition: button.hpp:36
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65
virtual void pre_show(window &window) override
Actions to be taken before showing the window.