New Omega App

This commit is contained in:
Quentin Guidée
2020-02-21 18:13:57 +01:00
parent 4d8a6488c4
commit a32e802cf4
16 changed files with 211 additions and 2 deletions

21
apps/omega/Makefile Normal file
View File

@@ -0,0 +1,21 @@
apps += Omega::App
app_headers += apps/omega/app.h
app_src += $(addprefix apps/omega/,\
app.cpp \
omega_controller.cpp \
omega_view.cpp \
)
app_images += apps/omega/omega_icon.png
i18n_files += $(addprefix apps/omega/,\
base.de.i18n\
base.en.i18n\
base.es.i18n\
base.fr.i18n\
base.pt.i18n\
base.hu.i18n\
)
$(eval $(call depends_on_image,apps/omega/app.cpp,apps/omega/omega_icon.png))

43
apps/omega/app.cpp Normal file
View File

@@ -0,0 +1,43 @@
#include "app.h"
#include "apps/apps_container.h"
#include "omega_icon.h"
#include "apps/i18n.h"
#include <assert.h>
namespace Omega {
I18n::Message App::Descriptor::name() {
return I18n::Message::OmegaApp;
}
I18n::Message App::Descriptor::upperName() {
return I18n::Message::OmegaAppCapital;
}
const Image * App::Descriptor::icon() {
return ImageStore::OmegaIcon;
}
App::Snapshot::Snapshot()
{
}
App * App::Snapshot::unpack(Container * container) {
return new App(this);
}
App::Descriptor * App::Snapshot::descriptor() {
static Descriptor descriptor;
return &descriptor;
}
void App::Snapshot::reset() {
}
App::App(Snapshot * snapshot) :
::App(snapshot, &m_omegaController),
m_omegaController(this)
{
}
}

31
apps/omega/app.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef OMEGA_APP_H
#define OMEGA_APP_H
#include <escher.h>
#include "omega_controller.h"
namespace Omega {
class App : public ::App {
public:
class Descriptor : public ::App::Descriptor {
public:
I18n::Message name() override;
I18n::Message upperName() override;
const Image * icon() override;
};
class Snapshot : public ::App::Snapshot {
public:
Snapshot();
App * unpack(Container * container) override;
void reset() override;
Descriptor * descriptor() override;
};
private:
App(Snapshot * snapshot);
OmegaController m_omegaController;
};
}
#endif

2
apps/omega/base.de.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

2
apps/omega/base.en.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

2
apps/omega/base.es.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

2
apps/omega/base.fr.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

2
apps/omega/base.hu.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

2
apps/omega/base.pt.i18n Normal file
View File

@@ -0,0 +1,2 @@
OmegaApp = "Omega"
OmegaAppCapital = "OMEGA"

View File

@@ -0,0 +1,25 @@
#include "omega_controller.h"
#include <assert.h>
namespace Omega {
OmegaController::OmegaController(Responder * parentResponder) :
ViewController(parentResponder)
{
}
View * OmegaController::view() {
return &m_omegaView;
}
void OmegaController::didBecomeFirstResponder() {
}
bool OmegaController::handleEvent(Ion::Events::Event event) {
/* if (event == Ion::Events::OK || event == Ion::Events::EXE) {
return true;
} */
return false;
}
}

View File

@@ -0,0 +1,21 @@
#ifndef APPS_OMEGA_CONTROLLER_H
#define APPS_OMEGA_CONTROLLER_H
#include <escher.h>
#include "omega_view.h"
namespace Omega {
class OmegaController : public ViewController {
public:
OmegaController(Responder * parentResponder);
View * view() override;
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
private:
OmegaView m_omegaView;
};
}
#endif

BIN
apps/omega/omega_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

34
apps/omega/omega_view.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include "omega_view.h"
#include "apps/i18n.h"
namespace Omega {
OmegaView::OmegaView() :
View(),
m_bufferTextView(KDFont::LargeFont, 0.5, 0.5, Palette::PrimaryText)
{
m_bufferTextView.setText(I18n::translate(I18n::Message::OmegaApp));
}
void OmegaView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(KDRect(0, 0, bounds().width(), bounds().height()), Palette::BackgroundApps);
}
void OmegaView::reload() {
markRectAsDirty(bounds());
}
int OmegaView::numberOfSubviews() const {
return 1;
}
View * OmegaView::subviewAtIndex(int index) {
assert(index == 0);
return &m_bufferTextView;
}
void OmegaView::layoutSubviews(bool force) {
m_bufferTextView.setFrame(KDRect(0, 0, bounds().width(), bounds().height()), force);
}
}

22
apps/omega/omega_view.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef APPS_OMEGA_VIEW_H
#define APPS_OMEGA_VIEW_H
#include <escher.h>
namespace Omega {
class OmegaView : public View {
public:
OmegaView();
void drawRect(KDContext * ctx, KDRect rect) const override;
void reload();
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
private:
void layoutSubviews(bool force = false) override;
BufferTextView m_bufferTextView;
};
}
#endif

View File

@@ -9,7 +9,7 @@ include build/platform.$(PLATFORM).mak
EPSILON_VERSION ?= 13.0.0
EPSILON_CUSTOM_VERSION ?= 1.20.0
# USERNAME ?= N/A
EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external
EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external omega
EPSILON_I18N ?= en fr es de pt hu
# EPSILON_I18N ?= en fr es de pt hu
EPSILON_GETOPT ?= 0

2
themes

Submodule themes updated: 9e1688dcbe...5e482b5f6d