-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get UI text by ID rather than magic strings
- Loading branch information
Showing
4 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "ui_text.h" | ||
#include <unordered_map> | ||
|
||
std::string eps::uiText(eps::TextID item) { | ||
static std::unordered_map<TextID, std::string> dictionary { | ||
{TextID::EXTENSION_ERROR_TITLE, "ADM Extension Error"}, | ||
{TextID::CONTEXT_MENU, "ADM"}, | ||
{TextID::EXPLODE_ACTION_PREFIX, "Explode using "}, | ||
{TextID::EXPLODE_ERROR_TITLE, "ADM: Explode to Takes"}, | ||
{TextID::EXPLODE_ERROR_DESCRIPTION, "Please select a source before running this action."}, | ||
{TextID::CREATE_PROJECT_MENU, "Create project from ADM file"}, | ||
{TextID::CREATE_PROJECT_ACTION_PREFIX, "Create from ADM using "}, | ||
{TextID::CREATE_PROJECT_FILE_PROMPT, "ADM File to Open"}, | ||
{TextID::CREATE_PROJECT_ERROR_TITLE, "Import ADM file in to current project"}, | ||
{TextID::CREATE_PROJECT_ERROR_DESCRIPTION, "Error: This file can not be imported."}, | ||
{TextID::IMPORT_MENU, "ADM File to Import"}, | ||
{TextID::IMPORT_ACTION_PREFIX, "Import ADM file using "}, | ||
{TextID::IMPORT_ERROR_TITLE, "Error: This file can not be imported."}, | ||
{TextID::IMPORT_ERROR_DESCRIPTION, "ADM Import"} | ||
}; | ||
assert(dictionary.find(item) != dictionary.end()); | ||
return(dictionary.find(item) == dictionary.end()) ? "" : dictionary[item]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
namespace eps { | ||
|
||
enum class TextID { | ||
EXTENSION_ERROR_TITLE, | ||
CONTEXT_MENU, | ||
EXPLODE_ACTION_PREFIX, | ||
EXPLODE_ERROR_TITLE, | ||
EXPLODE_ERROR_DESCRIPTION, | ||
CREATE_PROJECT_ACTION_PREFIX, | ||
CREATE_PROJECT_MENU, | ||
CREATE_PROJECT_FILE_PROMPT, | ||
CREATE_PROJECT_ERROR_TITLE, | ||
CREATE_PROJECT_ERROR_DESCRIPTION, | ||
IMPORT_MENU, | ||
IMPORT_ACTION_PREFIX, | ||
IMPORT_FILE_PROMPT, | ||
IMPORT_ERROR_TITLE, | ||
IMPORT_ERROR_DESCRIPTION | ||
}; | ||
|
||
std::string uiText(TextID item); | ||
} |