Commit fc6eb559 authored by Johnny Jazeix's avatar Johnny Jazeix

Ajout d'un fichier configure et suppression du makefile (donc faut faire

un configure avant). Rapt du thread parce qu'il parait qu'il fait tout 
buguer ^^
parent b6a8e19c
#!/bin/sh
relpath=`dirname $0`
relpath=`(cd "$relpath"; /bin/pwd)`
WHICH=`which which 2>/dev/null`
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
makefile="Makefile"
# find a make command
if [ -z "$MAKE" ]; then
MAKE=
for mk in gmake make; do
if "$WHICH" $mk >/dev/null 2>&1; then
MAKE=`$WHICH $mk`
break
fi
done
if [ -z "$MAKE" ]; then
echo >&2 "You don't seem to have 'make' or 'gmake' in your PATH."
echo >&2 "Cannot proceed."
exit 1
fi
fi
# Creates the makefile
cat > "$makefile" <<EOF
########################################################################
## ##
## This file was autogenerated by configure, all changes will be lost ##
## ##
################### It has by done for ViTE project ####################
## ##
########################################################################
all:
EOF
if "$WHICH" qmake-qt4 >/dev/null 2>&1 ; then
cat >> "$makefile" <<EOF
cd ./src && qmake-qt4 -makefile -o Makefile src.pro && make
EOF
elif "$WHICH" qmake >/dev/null 2>&1 ; then
cat >>"$makefile" <<EOF
cd ./src && qmake -makefile -o Makefile src.pro && make
EOF
elif "$WHICH" qmake >/dev/null 2>&1 ; then # Mac -> configure with UNAME_SYSTEM
cat <<EOF
cd ./src && qmake -spec macx-g++ -makefile -o Makefile src.pro && make
EOF
fi
cat >>"$makefile" <<EOF
@echo " "
@echo "Compilation completed! File created in 'bin' folder."
@echo " "
......@@ -24,3 +75,11 @@ clean:
# @echo " "
# @echo "Built and compiled! (release)"
# @echo " "
EOF
# basename erase the path of acces of the command
MAKE=`basename $MAKE`
echo ViTE is now configured for building. Just run \'$MAKE\'.
......@@ -6,20 +6,12 @@ void Progress_bar_thread::init(Parser *p, Interface_console *i){
}
void Progress_bar_thread::run() {
_file_size = _parser->get_total_size_of_file();
int loaded = 0;
while(1) {
loaded = _parser->get_size_loaded()*100/_file_size + 1;
loaded = _parser->get_size_loaded() + 1;
msleep(500); // We wait 500 ms
QApplication::processEvents();
_interface_console->get_progress_dialog();//->setValue(loaded);
_interface_console->get_progress_dialog()->setValue(loaded);
_interface_console->get_progress_dialog()->update();
QApplication::processEvents();
_interface_console->update_progress_bar(loaded);
}
}
......@@ -106,31 +106,28 @@ bool Interface_console::draw_trace(const string & filename, const int format){
{
DrawTrace<Render_opengl> drawing_ogl;
// Init of the thread
Progress_bar_thread thread;
thread.init(&parser, this);
_progress_dialog = new QProgressDialog("Parsing", "Cancel", 0, 100, _main_window);
_progress_dialog->show();
thread.start();
// // Init of the thread
// Progress_bar_thread thread;
// thread.init(&parser, this);
// _progress_dialog = new QProgressDialog("Parsing", "Cancel", 0, 100, _main_window);
// _progress_dialog->show();
// thread.start();
try{
parser.parse(filename, trace);
}
catch (const string &error) {
thread.terminate();
Error::print_numbers();
Error::flush_in_file("log.txt");
// thread.terminate();
// delete _progress_dialog;
*Message::get_instance() << "Reason : " << error << Message::ende;
QApplication::restoreOverrideCursor();
delete _progress_dialog;
return false;
}
thread.terminate();
delete _progress_dialog;
// thread.terminate();
// delete _progress_dialog;
drawing_ogl.build(_render_opengl, &trace);
_render_opengl->build();
_render_opengl->updateGL();
......@@ -235,7 +232,7 @@ int Interface_console::get_state(int argc, char** argv){
i ++;
if(i < argc) {
_file_opened = argv[i];
state |= _STATE_OPEN_FILE;
state = _STATE_OPEN_FILE;
}
else {
cerr << "no filename to open" << endl;
......@@ -352,7 +349,7 @@ int Interface_console::get_state(int argc, char** argv){
}
else{ // This is a file to open
_file_opened = argv[i];
state |= _STATE_OPEN_FILE;
state = _STATE_OPEN_FILE;
}
}
return state;
......@@ -390,7 +387,6 @@ void Interface_console::extract_times(const char *name) {
void Interface_console::launch_action(int state, void* arg){
switch(state) {
case _STATE_DISPLAY_HELP :
......@@ -592,3 +588,8 @@ const QString* Interface_console::get_runenv() const{
QProgressDialog *Interface_console::get_progress_dialog(){
return _progress_dialog;
}
void Interface_console::update_progress_bar(int loaded){
_progress_dialog->setValue(loaded);
_progress_dialog->update();
}
......@@ -374,6 +374,9 @@ public:
*/
QProgressDialog *get_progress_dialog();
public slots:
void update_progress_bar(int loaded);
};
......
......@@ -200,9 +200,9 @@ std::string *TokenSource::read_token() {
const int TokenSource::get_size_loaded() {
#ifdef WIN32
return _file.tellg();
return _file.tellg()/_filesize;
#else
std::cerr<<(int)((_cursor*100.0)/_filesize)<<"%"<<endl;
return 42;//Temporary!!
//std::cerr<<(int)((_cursor*100.0)/_filesize)<<"%"<<endl;
return (_cursor*100)/_filesize;
#endif
}
No preview for this file type
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