-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (56 loc) · 2.07 KB
/
main.cpp
File metadata and controls
67 lines (56 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <fmt/ranges.h>
#include <iostream>
#include "Passwords.h"
#include "Files.h"
#include "UserInterface.h"
bool launchingScreen() {
fmt::println("Wybierz opcje");
fmt::println("[1]: Wybrać istniejący plik");
fmt::println("[2]: Utworzyć plik w katalogu programu");
fmt::println("[3]: Zamknąć program");
auto action = int();
std::cin >> action;
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
if (action < 1 || action > 3) {
fmt::println("Wybrana niepoprawna komenda.");
return true;
}
switch(action){
case 3:
return false;
case 2:
fmt::println("========================");
File::createFile();
return true;
default:
fmt::println("========================");
auto filePath = std::string();
bool fileChosen = File::chooseFile(filePath);
if (fileChosen) {
fmt::println("========================");
UI::displayActionsForFile(filePath);
return true;
}
else
return true;
}
}
int main() {
fmt::println("============UWAGA============");
fmt::println("Program nie oferuje możliwości działania na hasłach, które zawierają\n"
"przecinki \',\'. Podczas próby wprowadzenia takiego hasło, zostaniesz\n"
"powiadomiony i poproszony o wybranie innego hasła.");
fmt::println("===========================");
fmt::println("W sytuacjach, gdy program oczekuje od Ciebie jednego słowa,\n"
"dokładnie jedno słowo zostanie wczytane. Jeżeli w takiej sytuacji wprowadzisz\n"
"więcej niż jedno słowo, inne słowa niż pierwsze będą ignorowane.");
fmt::println("==================================");
findCategories();
bool keepRunning = launchingScreen();
while (keepRunning)
keepRunning = launchingScreen();
saveCategories();
fmt::println("Program został zamknięty.");
return 0;
}