Revision 7cb84a4d
Added by david.sorber over 2 years ago
| src/main.cc | ||
|---|---|---|
|
#endif
|
||
|
|
||
|
const std::string APP_NAME("pwmgr");
|
||
|
const std::string VERSION("v0.1.1");
|
||
|
const std::string VERSION("v0.1.2");
|
||
|
const std::string DEFAULT_FILEPATH("/home/dsorber/Documents/chicken_soup/chicken_soup.txt.enc");
|
||
|
|
||
|
const std::string BOLD{"\033[1m"};
|
||
| ... | ... | |
|
|
||
|
#define ERROR_MSG BOLD << RED << "ERROR: " << ENDC
|
||
|
|
||
|
|
||
|
Catalog catalog;
|
||
|
|
||
|
const char* STR_EMPTY = "";
|
||
|
const char* STR_LOADING = "Loading...";
|
||
|
|
||
|
static ImGuiInputTextFlags MULTILINE_TEXT_FLAGS =
|
||
|
ImGuiInputTextFlags_AllowTabInput | ImGuiInputTextFlags_ReadOnly;
|
||
| ... | ... | |
|
bool done = false;
|
||
|
bool dataLoaded = false;
|
||
|
bool loading = false;
|
||
|
bool showOptionsWin = false;
|
||
|
char filterBuffer[128]{};
|
||
|
char filePathBuffer[BUFFER_SIZE]{};
|
||
|
std::memcpy(filePathBuffer, DEFAULT_FILEPATH.data(), DEFAULT_FILEPATH.size());
|
||
|
const char* statusText = STR_EMPTY;
|
||
|
|
||
|
char passwdBuffer[BUFFER_SIZE]{};
|
||
|
while (! done)
|
||
| ... | ... | |
|
if (ImGui::Button("Load"))
|
||
|
{
|
||
|
loading = true;
|
||
|
statusText = STR_LOADING;
|
||
|
}
|
||
|
ImGui::SameLine();
|
||
|
|
||
|
ImGui::Text(statusText);
|
||
|
|
||
|
if (loading)
|
||
|
{
|
||
|
ImGui::Text("Loading...");
|
||
|
|
||
|
|
||
|
// Load the catalog from the encrypted file
|
||
|
int rc = catalog.load(filePathBuffer,
|
||
| ... | ... | |
|
}
|
||
|
else
|
||
|
{
|
||
|
// Display error
|
||
|
// Display error to terminal and status
|
||
|
std::cerr << ERROR_MSG << Catalog::errToString(rc) << std::endl;
|
||
|
statusText = Catalog::errToString(rc);
|
||
|
}
|
||
|
|
||
|
loading = false;
|
||
|
}
|
||
|
|
||
|
}
|
||
Update catalog decode status message.