Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cdb0d249 authored by Jule Marcoueille's avatar Jule Marcoueille
Browse files

Portalibilisation du multifenetrage retravaillée pour utiliser des string.

parent 960430bf
No related branches found
No related tags found
No related merge requests found
...@@ -31,14 +31,8 @@ Interface_console::Interface_console(int argc, char ** argv){ ...@@ -31,14 +31,8 @@ Interface_console::Interface_console(int argc, char ** argv){
QString current_path; QString current_path;
app = new QApplication(argc, argv);/* create the Qt application */ app = new QApplication(argc, argv);/* create the Qt application */
current_path = QDir::currentPath();
_run_env[0] = new char[current_path.length()+1]; _run_env[0] = QDir::currentPath();
if (!strcpy(_run_env[0], current_path.toStdString().c_str())) {
cerr << "Error : in " << __FILE__ << " at line " << __LINE__ << "." << endl;
cerr << "Reason : Copy of the current path directory failed." << endl;
exit(EXIT_FAILURE);
}
_run_env[1] = argv[0]; _run_env[1] = argv[0];
...@@ -76,7 +70,7 @@ Interface_console::~Interface_console(){ ...@@ -76,7 +70,7 @@ Interface_console::~Interface_console(){
/* Qt desallocates _main_window and _render_opengl automatically */ /* Qt desallocates _main_window and _render_opengl automatically */
free(_run_env[0]); //free(_run_env[0]);
} }
...@@ -421,6 +415,6 @@ void Interface_console::set_path_to_export(const string& path){ ...@@ -421,6 +415,6 @@ void Interface_console::set_path_to_export(const string& path){
_path_to_export = path; _path_to_export = path;
} }
char const* const* Interface_console::get_runenv() const{ const QString* Interface_console::get_runenv() const{
return _run_env; return _run_env;
} }
...@@ -110,12 +110,6 @@ public: ...@@ -110,12 +110,6 @@ public:
*/ */
static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 10; static const int _STATE_LAUNCH_GRAPHICAL_INTERFACE = 10;
/*!
* \brief The size max (hoped) for the current directory name.
* Used for opening a new window with a new trace.
*/
static const int _CURRENT_DIR_SIZE = 256;
/*! /*!
* \brief Launch an action according to the argument state value. * \brief Launch an action according to the argument state value.
* \arg state : an integer corresponding to a kind of action which must be executed. * \arg state : an integer corresponding to a kind of action which must be executed.
...@@ -158,7 +152,7 @@ protected: ...@@ -158,7 +152,7 @@ protected:
/*! /*!
*\brief This attributes contains the launching current directory (_run_env[0]) and the first argument of the running command (_run_env[1]). *\brief This attributes contains the launching current directory (_run_env[0]) and the first argument of the running command (_run_env[1]).
*/ */
char* _run_env[2]; QString _run_env[2];
/*! /*!
*\brief If a file must be opened, this attributes contains its path. *\brief If a file must be opened, this attributes contains its path.
...@@ -271,7 +265,7 @@ protected: ...@@ -271,7 +265,7 @@ protected:
* \brief Get the _run_env matrix. * \brief Get the _run_env matrix.
* *
*/ */
char const* const* get_runenv() const; const QString* get_runenv() const;
/*********************************** /***********************************
......
...@@ -192,21 +192,21 @@ void Interface_graphic::on_open_triggered(){ ...@@ -192,21 +192,21 @@ void Interface_graphic::on_open_triggered(){
if (!filename.isEmpty()){ if (!filename.isEmpty()){
if (_is_rendering_trace == true){/* Realease the previous trace */ if (_is_rendering_trace == true){ /* open a new process */
QStringList arguments = (QStringList() << filename); QStringList arguments = (QStringList() << filename);
QString program; QString* program;
char const* const* run_env = _core->get_runenv(); const QString* run_env = _core->get_runenv();
QString start_directory = run_env[0]; QDir::setCurrent(run_env[0]);
QDir::setCurrent(start_directory); QString run_cmd = run_env[1];
if (run_env[1][0] == '.') if (run_cmd.startsWith("."))
program = QString(run_env[0])+QString(run_env[1]+sizeof(char)); program = new QString(run_env[0]+(run_cmd.remove(0,1)));
else else
program = QString(run_env[1]); program = new QString(run_cmd);
QProcess * new_process = new QProcess(); QProcess * new_process = new QProcess();
new_process->startDetached(program, arguments); new_process->startDetached(*program, arguments);
} }
else{ else{
opening_file(filename.toStdString()); opening_file(filename.toStdString());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment