Commit cdb0d249 authored by Jule Marcoueille's avatar Jule Marcoueille

Portalibilisation du multifenetrage retravaillée pour utiliser des string.

parent 960430bf
......@@ -31,14 +31,8 @@ Interface_console::Interface_console(int argc, char ** argv){
QString current_path;
app = new QApplication(argc, argv);/* create the Qt application */
current_path = QDir::currentPath();
_run_env[0] = new char[current_path.length()+1];
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[0] = QDir::currentPath();
_run_env[1] = argv[0];
......@@ -76,7 +70,7 @@ Interface_console::~Interface_console(){
/* 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){
_path_to_export = path;
}
char const* const* Interface_console::get_runenv() const{
const QString* Interface_console::get_runenv() const{
return _run_env;
}
......@@ -110,12 +110,6 @@ public:
*/
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.
* \arg state : an integer corresponding to a kind of action which must be executed.
......@@ -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]).
*/
char* _run_env[2];
QString _run_env[2];
/*!
*\brief If a file must be opened, this attributes contains its path.
......@@ -271,7 +265,7 @@ protected:
* \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(){
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);
QString program;
char const* const* run_env = _core->get_runenv();
QString start_directory = run_env[0];
QDir::setCurrent(start_directory);
QString* program;
const QString* run_env = _core->get_runenv();
QDir::setCurrent(run_env[0]);
QString run_cmd = run_env[1];
if (run_env[1][0] == '.')
program = QString(run_env[0])+QString(run_env[1]+sizeof(char));
if (run_cmd.startsWith("."))
program = new QString(run_env[0]+(run_cmd.remove(0,1)));
else
program = QString(run_env[1]);
program = new QString(run_cmd);
QProcess * new_process = new QProcess();
new_process->startDetached(program, arguments);
new_process->startDetached(*program, arguments);
}
else{
opening_file(filename.toStdString());
......
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