Skip to content

Commit

Permalink
enh - tag bs & slots
Browse files Browse the repository at this point in the history
  • Loading branch information
w3irDv committed Sep 14, 2024
1 parent 98540cd commit 5e2b190
Show file tree
Hide file tree
Showing 16 changed files with 406 additions and 75 deletions.
4 changes: 4 additions & 0 deletions include/ApplicationState.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class ApplicationState {
SUBSTATE_RETURN,
};

enum eSubstateCalled {
NONE
};

virtual void render() = 0;
virtual eSubState update(Input *input) = 0;
};
20 changes: 12 additions & 8 deletions include/BackupSetList.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,19 @@ class BackupSetList {
void sort(bool sortAscending = false);
static bool getSortAscending() { return sortAscending;};
std::string at(int i);
std::string serialIdAt(int i);
std::string serialIdStretchedAt(int i);
std::string tagAt(int i);
std::string getSerialIdAt(int i);
std::string getStretchedSerialIdAt(int i);
std::string getTagAt(int i);
void setTagBSVAt(int i, const std::string & tag);
void setTagBSAt(int i, const std::string & tag);
void add(std::string entryPath,std::string serialId,std::string tag);

int getLen() { return this->entries;};
int getEnhLen() { return this->enhEntries;};
int getSizeView() { return this->entriesView;};
int getSize() { return this->entries;};

void filter();
void filter(BSMetadata filterDef);
void resetTagRange();
BSMetadataValues *getBSMetadataValues() {return &bsMetadataValues; };

static const std::string ROOT_BS;
Expand All @@ -101,13 +104,14 @@ class BackupSetList {

private:
static bool sortAscending;
std::vector<BackupSetItemView> backupSets;
std::vector<BackupSetItem> backupSetsEnh;
std::vector<BackupSetItemView> backupSetsView;
std::vector<BackupSetItem> backupSets;
std::vector<std::string> serialIds;
std::vector<std::string> tags;
std::vector<int> v2b;
BSMetadataValues bsMetadataValues;
int entriesView;
int entries;
int enhEntries;
std::string backupSetListRoot;
static std::string backupSetSubPath;
static std::string backupSetEntry;
Expand Down
8 changes: 5 additions & 3 deletions include/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ class Metadata {

bool read();
bool write();
std::string simpleFormat();
std::string get();
bool set(const std::string &date,bool isUSB);
static std::string thisConsoleSerialId;
static std::string unknownSerialId;
std::string getDate() { return Date;}
std::string getTag() { return tag;}
std::string getSerialId() { return serialId;}
std::string getDate() { return Date;};
std::string getTag() { return tag;};
void setTag(std::string tag_) { this->tag = tag_;};
std::string getSerialId() { return serialId;};

private:
uint32_t highID;
Expand Down
9 changes: 9 additions & 0 deletions include/menu/BackupSetListState.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@ class BackupSetListState : public ApplicationState {
STATE_BACKUPSET_MENU,
STATE_DO_SUBSTATE,
};
enum eSubstateCalled {
NONE,
STATE_BACKUPSET_FILTER,
STATE_KEYBOARD
};

void render() override;
ApplicationState::eSubState update(Input *input) override;

private:
std::unique_ptr<ApplicationState> subState{};
eState state = STATE_BACKUPSET_MENU;
eSubstateCalled substateCalled = NONE;

bool sortAscending;

static int cursorPos;
static int scroll;

std::string backupSetListRoot;

std::string tag;
std::string newTag;
};
31 changes: 31 additions & 0 deletions include/menu/KeyboardState.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once

#include <ApplicationState.h>
#include <memory>
#include <utils/InputUtils.h>
#include <utils/KeyboardUtils.h>

class KeyboardState : public ApplicationState {
public:
KeyboardState(std::string & input) : input(input) {
this->keyboard = std::make_unique<Keyboard>();
}
enum eState {
STATE_KEYBOARD,
STATE_DO_SUBSTATE,
};

void render() override;
ApplicationState::eSubState update(Input *input) override;

private:
std::unique_ptr<ApplicationState> subState{};
eState state = STATE_KEYBOARD;

std::unique_ptr<Keyboard> keyboard;

int entrycount = 4;
int cursorPosX = 0;
int cursorPosY = 0;
std::string & input;
};
1 change: 1 addition & 0 deletions include/menu/MainMenuState.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class MainMenuState : public ApplicationState {

void render() override;
ApplicationState::eSubState update(Input *input) override;
std::string tag;

private:
std::unique_ptr<ApplicationState> subState{};
Expand Down
11 changes: 11 additions & 0 deletions include/menu/TitleOptionsState.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ class TitleOptionsState : public ApplicationState {
STATE_DO_SUBSTATE,
};

enum eSubstateCalled {
NONE,
STATE_BACKUPSET_MENU,
STATE_KEYBOARD
};

void render() override;
ApplicationState::eSubState update(Input *input) override;

private:
std::unique_ptr<ApplicationState> subState{};
eState state = STATE_TITLE_OPTIONS;

eSubstateCalled substateCalled = NONE;

Title title;
Task task;

Expand All @@ -47,4 +55,7 @@ class TitleOptionsState : public ApplicationState {
uint8_t slot = 0;
int cursorPos = 0;
int entrycount;

std::string tag;
std::string newTag;
};
41 changes: 41 additions & 0 deletions include/utils/KeyboardUtils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma once

#include <string>
#include <vector>

class Keyboard {
public:
friend class KeyboardState;
void render();
int kbLeft();
int kbRight();
int kbUp();
int kbDown();
void kbKeyPressed();
void shiftPressed();
void delPressed();
std::string input;
Keyboard() : row(2),column(5) {
keysNormal = {"`1234567890-=",
"qwertyuiop[]|",
"asdfghjkl;' ",
"zxcvbnm ,./ "};
keysShift = { "~!@#$%^&*()_+",
"QWERTYUIOP{}\\",
"ASDFGHJKL:\" ",
"ZXCVBNM <> "};
currentKeyboard = keysNormal;
setCurrentKey();
}
void setCurrentKey() { currentKey = currentKeyboard[row].substr(column,1); }
private:
std::vector<std::string> keysNormal;
std::vector<std::string> keysShift;
std::vector<std::string> currentKeyboard;
std::string prevKeys;
std::string currentKey;
std::string nextKeys;
int row;
int column;

};
2 changes: 1 addition & 1 deletion languages/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"\ue000: Apply Filter \uE002: Reset Filters \ue001: Back": "\ue000: Apply Filter \uE002: Reset Filters \ue001: Back",
"BackupSets": "BackupSets",
"BackupSets (filter applied)": "BackupSets (filter applied)",
"\ue000: Select BS \ue046: Wipe BS \ue003: Filter List \ue001: Back": "\ue000: Select BS \ue046: Wipe BS \ue002: Filter List \ue001: Back",
"\ue000: Select BS \ue046: Wipe BS \ue003: Filter List \ue001: Back": "\ue000: Select BS \ue046: Wipe BS \ue003: Filter List \ue001: Back",
"\ue000: Select BackupSet \ue003: Filter List \ue001: Back": "\ue000: Select BackupSet \ue002: Filter List \ue001: Back",
"Batch Backup": "Batch Backup",
"Backup": "Backup",
Expand Down
Loading

0 comments on commit 5e2b190

Please sign in to comment.