Blame view

build1/epsilon-master/apps/global_preferences.cpp 1.48 KB
6663b6c9   adorian   projet complet av...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  #include "global_preferences.h"
  
  GlobalPreferences::GlobalPreferences() :
    m_language(I18n::Language::EN),
    m_examMode(ExamMode::Desactivate),
    m_showUpdatePopUp(true),
    m_brightnessLevel(Ion::Backlight::MaxBrightness)
  {
  }
  
  GlobalPreferences * GlobalPreferences::sharedGlobalPreferences() {
    static GlobalPreferences globalPreferences;
    return &globalPreferences;
  }
  
  I18n::Language GlobalPreferences::language() const {
    return m_language;
  }
  
  void GlobalPreferences::setLanguage(I18n::Language language) {
    if (language != m_language) {
      m_language = language;
    }
  }
  
  GlobalPreferences::ExamMode GlobalPreferences::examMode() const {
    return m_examMode;
  }
  
  void GlobalPreferences::setExamMode(ExamMode examMode) {
    if (examMode != m_examMode) {
      m_examMode = examMode;
    }
  }
  
  bool GlobalPreferences::showUpdatePopUp() const {
    return m_showUpdatePopUp;
  }
  
  void GlobalPreferences::setShowUpdatePopUp(bool showUpdatePopUp) {
    if (showUpdatePopUp != m_showUpdatePopUp) {
      m_showUpdatePopUp = showUpdatePopUp;
    }
  }
  
  int GlobalPreferences::brightnessLevel() const {
    return m_brightnessLevel;
  }
  
  void GlobalPreferences::setBrightnessLevel(int brightnessLevel) {
    if (m_brightnessLevel != brightnessLevel) {
      brightnessLevel = brightnessLevel < 0 ? 0 : brightnessLevel;
      brightnessLevel = brightnessLevel > Ion::Backlight::MaxBrightness ? Ion::Backlight::MaxBrightness : brightnessLevel;
      m_brightnessLevel = brightnessLevel;
      Ion::Backlight::setBrightness(m_brightnessLevel);
    }
  }