librime 1.2
Rime Input Method Engine, the core library
switcher_settings.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5// 2012-02-18 GONG Chen <chen.sst@gmail.com>
6//
7#ifndef RIME_SWITCHER_SETTINGS_H_
8#define RIME_SWITCHER_SETTINGS_H_
9
10#include "custom_settings.h"
11#include <rime/common.h>
12
13namespace rime {
14
15struct SchemaInfo {
16 string schema_id;
17 string name;
18 string version;
19 string author;
21 string file_path;
22};
23
25 public:
26 using SchemaList = vector<SchemaInfo>;
27 // a list of schema_ids
28 using Selection = vector<string>;
29
30 explicit SwitcherSettings(Deployer* deployer);
31 bool Load();
33 bool SetHotkeys(const string& hotkeys);
34
35 const SchemaList& available() const { return available_; }
36 const Selection& selection() const { return selection_; }
37 const string& hotkeys() const { return hotkeys_; }
38
39 private:
40 void GetAvailableSchemasFromDirectory(const path& dir);
41 void GetSelectedSchemasFromConfig();
42 void GetHotkeysFromConfig();
43
44 SchemaList available_;
45 Selection selection_;
46 string hotkeys_;
47};
48
49} // namespace rime
50
51#endif // RIME_SWITCHER_SETTINGS_H_
Definition algebra.cc:12
Definition common.h:84
Definition deployer.h:32
CustomSettings(Deployer *deployer, const string &config_id, const string &generator_id)
Definition custom_settings.cc:25
Definition switcher_settings.h:15
string file_path
Definition switcher_settings.h:21
string name
Definition switcher_settings.h:17
string description
Definition switcher_settings.h:20
string schema_id
Definition switcher_settings.h:16
string author
Definition switcher_settings.h:19
string version
Definition switcher_settings.h:18
const Selection & selection() const
Definition switcher_settings.h:36
bool Select(Selection selection)
Definition switcher_settings.cc:33
const SchemaList & available() const
Definition switcher_settings.h:35
vector< SchemaInfo > SchemaList
Definition switcher_settings.h:26
vector< string > Selection
Definition switcher_settings.h:28
bool SetHotkeys(const string &hotkeys)
Definition switcher_settings.cc:44
const string & hotkeys() const
Definition switcher_settings.h:37
SwitcherSettings(Deployer *deployer)
Definition switcher_settings.cc:18
bool Load()
Definition switcher_settings.cc:21