librime: switcher_settings.h Source File

| 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
15 struct SchemaInfo {
16 string schema_id;
17 string name;
18 string version;
19 string author;
20 string description;
21 string file_path;
22};
23
24 class SwitcherSettings : public CustomSettings {
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();
32 bool Select(Selection selection);
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_
custom_settings.h
common.h
rime
Definition algebra.cc:12
rime::path
Definition common.h:84
rime::Deployer
Definition deployer.h:32
rime::CustomSettings::CustomSettings
CustomSettings(Deployer *deployer, const string &config_id, const string &generator_id)
Definition custom_settings.cc:25
rime::SchemaInfo
Definition switcher_settings.h:15
rime::SchemaInfo::file_path
string file_path
Definition switcher_settings.h:21
rime::SchemaInfo::name
string name
Definition switcher_settings.h:17
rime::SchemaInfo::description
string description
Definition switcher_settings.h:20
rime::SchemaInfo::schema_id
string schema_id
Definition switcher_settings.h:16
rime::SchemaInfo::author
string author
Definition switcher_settings.h:19
rime::SchemaInfo::version
string version
Definition switcher_settings.h:18
rime::SwitcherSettings::selection
const Selection & selection() const
Definition switcher_settings.h:36
rime::SwitcherSettings::Select
bool Select(Selection selection)
Definition switcher_settings.cc:33
rime::SwitcherSettings::available
const SchemaList & available() const
Definition switcher_settings.h:35
rime::SwitcherSettings::SchemaList
vector< SchemaInfo > SchemaList
Definition switcher_settings.h:26
rime::SwitcherSettings::Selection
vector< string > Selection
Definition switcher_settings.h:28
rime::SwitcherSettings::SetHotkeys
bool SetHotkeys(const string &hotkeys)
Definition switcher_settings.cc:44
rime::SwitcherSettings::hotkeys
const string & hotkeys() const
Definition switcher_settings.h:37
rime::SwitcherSettings::SwitcherSettings
SwitcherSettings(Deployer *deployer)
Definition switcher_settings.cc:18
rime::SwitcherSettings::Load
bool Load()
Definition switcher_settings.cc:21