Commit 86a45c0d authored by Johnny Jazeix's avatar Johnny Jazeix

Modification de la barre d'avancement (textuelle toujours)

parent 80433525
......@@ -6,54 +6,18 @@ void Progress_bar_thread::init(Parser *p, Interface_console *i){
}
void Progress_bar_thread::run() {
int loaded = 0;
int current_color = VIOLET;
int number_of_color = 7;
color("47");
while(loaded < 95) {
while(loaded < 99) {
loaded = _parser->get_size_loaded();
sleep(1); // We wait 1 second
QApplication::processEvents();
char text[3];
std::cout << "Loading of the trace : " ;
// Choice of the color to do a rainbow ^^, because it is useless
if(loaded < 100 / number_of_color){
current_color = RED;
}
else if(loaded < 200 / number_of_color){
current_color = ORANGE;
}
else if(loaded < 300 / number_of_color){
current_color = YELLOW;
}
else if(loaded < 400 / number_of_color){
current_color = GREEN;
}
else if(loaded < 500 / number_of_color){
current_color = CYAN;
}
else if(loaded < 600 / number_of_color){
current_color = BLUE;
}
else {
current_color = VIOLET;
}
sprintf(text, "%2d", current_color);
color(text);
std::cout << loaded << "%" << std::endl;
// Reinit of the color
color("0");
color("47");
color("30");
std::cout << "Loading of the trace : " << loaded << "%" << std::endl;
//_interface_console->update_progress_bar(loaded);
}
color("0");
((ParserPaje *)_parser)->reinit_cursor();
}
......@@ -6,30 +6,6 @@
#include "interface_console.hpp"
#include <iostream>
/*
* \def couleur
* \param couleur
* \brief print in the console in color ^^
* useless and temporary
* Color Texte Arrière-plan
* Noir 30 40
* Rouge 31 41
* Vert 32 42
* Jaune 33 43
* Bleu 34 44
* Magenta 35 45
* Cyan 36 46
* Blanc 37 47
*/
#define color(param) printf("\033[%sm",param)
#define RED 30
#define ORANGE 31
#define YELLOW 33
#define GREEN 32
#define CYAN 36
#define BLUE 34
#define VIOLET 35
/*!
* \class Progress_bar_thread
* \brief Contains the progress bar while loading of a trace
......
......@@ -58,8 +58,6 @@ void ParserPaje::parse(string filename, Trace &trace){
Error::print_numbers();
Error::flush_in_file("log.txt");
TokenSource::reinit_cursor();
delete parserdefinition;
delete parserevent;
}
......@@ -74,3 +72,7 @@ int ParserPaje::get_size_loaded() const{
return (TokenSource::get_size_loaded());
}
void ParserPaje::reinit_cursor() {
TokenSource::reinit_cursor();
}
......@@ -57,6 +57,14 @@ public:
*/
int get_size_loaded() const;
/*!
* \fn reinit_cursor()
* \brief reinitialize the cursor of TokenSource
* Useful for the thread of advancement.
*/
void reinit_cursor();
};
#endif // PARSERPAJE_HPP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment