|
1 | 1 | #if !defined(FRONTEND_FUNC_HPP)
|
2 | 2 | #define FRONTEND_FUNC_HPP
|
3 | 3 |
|
| 4 | +#include "ffmpeg_coder.hpp" |
4 | 5 | #include "rang.hpp"
|
5 |
| -#include <iostream> |
6 |
| -#include <vector> |
| 6 | +#include "s_lock.hpp" |
7 | 7 | #include "utils.hpp"
|
8 |
| -#include "ffmpeg_coder.hpp" |
9 | 8 | #include <fstream>
|
10 |
| -#include "s_lock.hpp" |
| 9 | +#include <iostream> |
| 10 | +#include <vector> |
11 | 11 |
|
12 |
| -//Functions |
13 |
| -void title() |
14 |
| -{ |
| 12 | +// Functions |
| 13 | +void title() { |
15 | 14 | decorateMe("FFMPEG Coder");
|
16 | 15 | }
|
17 | 16 |
|
18 |
| -void about() |
19 |
| -{ |
| 17 | +void about() { |
20 | 18 | clear_screen();
|
21 | 19 | std::string about_ffmpeg_coder;
|
22 | 20 | std::ifstream read_about("res/about.bin");
|
23 | 21 |
|
24 |
| - while (getline(read_about, about_ffmpeg_coder)) |
25 |
| - { |
| 22 | + while (getline(read_about, about_ffmpeg_coder)) { |
26 | 23 | std::cout << about_ffmpeg_coder;
|
27 | 24 | }
|
28 | 25 | }
|
29 | 26 |
|
30 |
| -void settings() |
31 |
| -{ |
| 27 | +void settings() { |
32 | 28 | int choice;
|
33 | 29 | clear_screen();
|
34 | 30 | std::vector<std::string> available_settings;
|
35 | 31 | available_settings.push_back("Startup-Lock");
|
| 32 | + available_settings.push_back("Quick Convert Settings"); |
36 | 33 | available_settings.push_back("Go Back");
|
37 | 34 |
|
38 |
| - std::cout<<rang::fg::blue<<rang::style::bold<<"NB: "<<rang::style::reset<<"This feature only works in windows now !\n\n"<<rang::fg::reset<<std::endl; |
39 |
| - for (int i = 0; i < available_settings.size(); i++) |
40 |
| - { |
| 35 | + std::cout << rang::fg::blue << rang::style::bold |
| 36 | + << "NB: " << rang::style::reset |
| 37 | + << "This feature only works in windows now !\n\n" |
| 38 | + << rang::fg::reset << std::endl; |
| 39 | + for (int i = 0; i < available_settings.size(); i++) { |
41 | 40 | std::cout << (i + 1) << ". " << available_settings[i] << std::endl;
|
42 | 41 | }
|
43 | 42 |
|
44 | 43 | std::cout << "\n\nGive your choice: ";
|
45 | 44 | std::cin >> choice;
|
46 | 45 |
|
47 |
| - switch (choice) |
48 |
| - { |
49 |
| - case 1: |
50 |
| - { |
| 46 | + switch (choice) { |
| 47 | + case 1: { |
51 | 48 | S_Lock slock;
|
52 | 49 | slock.showOptions();
|
53 | 50 | break;
|
54 | 51 | }
|
55 | 52 |
|
56 |
| - case 2: |
57 |
| - { |
58 |
| - break; |
| 53 | + case 2: { |
59 | 54 | }
|
60 | 55 |
|
61 |
| - default: |
62 |
| - std::cout << "Invalid choice !!"; |
| 56 | + case 3: { |
63 | 57 | break;
|
64 | 58 | }
|
| 59 | + |
| 60 | + default: std::cout << "Invalid choice !!"; break; |
| 61 | + } |
65 | 62 | }
|
66 | 63 |
|
67 |
| -//Home page of the tool |
68 |
| -void homepage() |
69 |
| -{ |
| 64 | +// Home page of the tool |
| 65 | +void homepage() { |
70 | 66 | using namespace std;
|
71 | 67 |
|
72 |
| - ffmpeg ffmpeg; //Creating ffmpeg object |
| 68 | + ffmpeg ffmpeg; // Creating ffmpeg object |
73 | 69 | int choice;
|
74 | 70 |
|
75 |
| - /* The char goBack variable is used for navigating to the main screen using the while loop */ |
| 71 | + /* The char goBack variable is used for navigating to the main screen using |
| 72 | + * the while loop */ |
76 | 73 | char goBack;
|
77 |
| - do |
78 |
| - { |
| 74 | + do { |
79 | 75 | clear_screen();
|
80 | 76 | title();
|
81 |
| - cout <<rang::style::dim << "Choose your option: "<< rang::style::reset << endl; |
| 77 | + cout << rang::style::dim << "Choose your option: " << rang::style::reset |
| 78 | + << endl; |
82 | 79 |
|
83 |
| - //Adding the options to the homepage menu (Main menu) |
| 80 | + // Adding the options to the homepage menu (Main menu) |
84 | 81 | vector<string> options;
|
85 | 82 | options.push_back("Make Codes");
|
86 | 83 | options.push_back("Quick Convert (mp4)");
|
87 | 84 | options.push_back("About");
|
88 | 85 | options.push_back("Settings");
|
89 | 86 | options.push_back("Exit");
|
90 | 87 |
|
91 |
| - //showing the options |
92 |
| - for (int i = 0; i < options.size(); i++) |
93 |
| - { |
| 88 | + // showing the options |
| 89 | + for (int i = 0; i < options.size(); i++) { |
94 | 90 | cout << (i + 1) << ". " << options[i] << endl;
|
95 | 91 | }
|
96 | 92 |
|
97 |
| - //taking choice input |
98 |
| - cout <<rang::bg::green<<rang::fg::black<<"\nYour choice: "<<rang::fg::reset<<rang::bg::reset; |
| 93 | + // taking choice input |
| 94 | + cout << rang::bg::green << rang::fg::black |
| 95 | + << "\nYour choice: " << rang::fg::reset << rang::bg::reset; |
99 | 96 | cin >> choice;
|
100 | 97 |
|
101 |
| - //Entering into selected option funcs |
102 |
| - if (choice == 1) |
103 |
| - { |
| 98 | + // Entering into selected option funcs |
| 99 | + if (choice == 1) { |
104 | 100 | clear_screen();
|
105 | 101 | ffmpeg.load_encodes();
|
106 | 102 | ffmpeg.show_encodes();
|
107 | 103 | ffmpeg.select_encodes();
|
108 | 104 | ffmpeg.selected_action();
|
109 |
| - } |
110 |
| - else if (choice == 2){ |
| 105 | + } else if (choice == 2) { |
111 | 106 | ffmpeg.quickConvert();
|
112 |
| - } |
113 |
| - else if (choice == 3) |
114 |
| - { |
| 107 | + } else if (choice == 3) { |
115 | 108 | about();
|
116 |
| - } |
117 |
| - else if (choice == 4) |
118 |
| - { |
| 109 | + } else if (choice == 4) { |
119 | 110 | settings();
|
120 |
| - } |
121 |
| - else if (choice == 5) |
122 |
| - { |
| 111 | + } else if (choice == 5) { |
123 | 112 | clear_screen();
|
124 | 113 | std::cout << "Exiting the program..............." << std::endl;
|
125 | 114 | exit(0);
|
126 |
| - } |
127 |
| - else |
128 |
| - { |
| 115 | + } else { |
129 | 116 | cout << "Invalid choice | Exiting...........";
|
130 | 117 | exit(0);
|
131 | 118 | }
|
|
0 commit comments