Match names everywhere

This commit is contained in:
mateoconlechuga
2017-09-01 20:06:59 -06:00
parent ae3e989314
commit 9d155f325b
3 changed files with 20 additions and 20 deletions

View File

@@ -1,34 +1,34 @@
#include "shift_alpha_lock_view.h"
AlphaLockView::AlphaLockView() :
ShiftAlphaLockView::ShiftAlphaLockView() :
View(),
m_modifierView(KDText::FontSize::Small, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
m_shiftAlphaView(KDText::FontSize::Small, I18n::Message::Default, 1.0f, 0.5f, KDColorWhite, Palette::YellowDark),
m_status(Ion::Events::ShiftAlphaStatus::Default)
{
}
void AlphaLockView::drawRect(KDContext * ctx, KDRect rect) const {
void ShiftAlphaLockView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), Palette::YellowDark);
}
bool AlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
bool ShiftAlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
if (status != m_status) {
m_status = status;
switch (m_status) {
case Ion::Events::ShiftAlphaStatus::Alpha:
case Ion::Events::ShiftAlphaStatus::AlphaLock:
case Ion::Events::ShiftAlphaStatus::AlphaLockShift:
m_modifierView.setMessage(I18n::Message::Alpha);
m_shiftAlphaView.setMessage(I18n::Message::Alpha);
break;
case Ion::Events::ShiftAlphaStatus::ShiftAlpha:
case Ion::Events::ShiftAlphaStatus::ShiftAlphaLock:
m_modifierView.setMessage(I18n::Message::CapitalAlpha);
m_shiftAlphaView.setMessage(I18n::Message::CapitalAlpha);
break;
case Ion::Events::ShiftAlphaStatus::Shift:
m_modifierView.setMessage(I18n::Message::Shift);
m_shiftAlphaView.setMessage(I18n::Message::Shift);
break;
case Ion::Events::ShiftAlphaStatus::Default:
m_modifierView.setMessage(I18n::Message::Default);
m_shiftAlphaView.setMessage(I18n::Message::Default);
break;
}
markRectAsDirty(bounds());
@@ -37,14 +37,14 @@ bool AlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
return false;
}
KDSize AlphaLockView::minimalSizeForOptimalDisplay() const {
KDSize ShiftAlphaLockView::minimalSizeForOptimalDisplay() const {
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();
KDCoordinate height = lockSize.height() > modifierSize.height() ? lockSize.height() : modifierSize.height();
return KDSize(modifierSize.width() + lockSize.width() + k_lockRightMargin, height);
}
int AlphaLockView::numberOfSubviews() const {
int ShiftAlphaLockView::numberOfSubviews() const {
switch (m_status) {
case Ion::Events::ShiftAlphaStatus::Alpha:
case Ion::Events::ShiftAlphaStatus::Shift:
@@ -59,16 +59,16 @@ int AlphaLockView::numberOfSubviews() const {
}
}
View * AlphaLockView::subviewAtIndex(int index) {
View * ShiftAlphaLockView::subviewAtIndex(int index) {
if (index == 0) {
return &m_modifierView;
return &m_shiftAlphaView;
}
return &m_lockView;
}
void AlphaLockView::layoutSubviews() {
void ShiftAlphaLockView::layoutSubviews() {
KDSize modifierSize = KDText::stringSize(I18n::translate(I18n::Message::Alpha), KDText::FontSize::Small);
m_modifierView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize));
m_shiftAlphaView.setFrame(KDRect(bounds().width() - modifierSize.width(), (bounds().height()- modifierSize.height())/2, modifierSize));
KDSize lockSize = m_lockView.minimalSizeForOptimalDisplay();
m_lockView.setFrame(KDRect(bounds().width() - modifierSize.width() - lockSize.width() - k_lockRightMargin, (bounds().height()- lockSize.height())/2, lockSize));

View File

@@ -1,13 +1,13 @@
#ifndef APPS_ALPHA_LOCK_VIEW_H
#define APPS_ALPHA_LOCK_VIEW_H
#ifndef APPS_SHIFT_ALPHA_LOCK_VIEW_H
#define APPS_SHIFT_ALPHA_LOCK_VIEW_H
#include <escher.h>
#include "lock_view.h"
#include "i18n.h"
class AlphaLockView : public View {
class ShiftAlphaLockView : public View {
public:
AlphaLockView();
ShiftAlphaLockView();
void drawRect(KDContext * ctx, KDRect rect) const override;
bool setStatus(Ion::Events::ShiftAlphaStatus status);
KDSize minimalSizeForOptimalDisplay() const override;
@@ -17,7 +17,7 @@ private:
void layoutSubviews() override;
View * subviewAtIndex(int index) override;
LockView m_lockView;
MessageTextView m_modifierView;
MessageTextView m_shiftAlphaView;
Ion::Events::ShiftAlphaStatus m_status;
};

View File

@@ -29,7 +29,7 @@ private:
View * subviewAtIndex(int index) override;
MessageTextView m_titleView;
BatteryView m_batteryView;
AlphaLockView m_alphaLockView;
ShiftAlphaLockView m_alphaLockView;
BufferTextView m_preferenceView;
ImageView m_examModeIconView;
};