Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
QHyodaTool.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7#include "QHyodaX11Emacs.h"
8#include "QHyodaX11XtermLog.h"
9#include "QHyodaToolCell.h"
10#include "QHyodaToolMesh.h"
11#include "QHyodaToolMatrix.h"
12#include "QHyodaPapi.h"
13
14
15QHyodaTool::QHyodaTool(QSplitter *parent):QTabWidget(parent),
16 job(NULL),
17 mesh(NULL),
18 matrix(NULL),
19 cell(NULL),
20 xlog(NULL),
21 src(NULL),
22 papi(NULL)
23{
24 setObjectName(QString::fromUtf8("tools"));
25 setEnabled(true);
26 setTabsClosable(true);
27 setMovable(true);
28 setCurrentIndex(-1);
29 connect(this,SIGNAL(tabCloseRequested(int)),this,SLOT(tools_close_requested_slot(int)));
30 connect(this,SIGNAL(currentChanged(int)),this,SLOT(currentChanged(int)));
31}
32
33void QHyodaTool::currentChanged(int idx){
34 //qDebug() << "\33[7m[QHyodaTool::currentChanged] idx="<<idx<<"\33[m";
35 //setCurrentIndex(idx);
36}
37
38QHyodaTool::~QHyodaTool(void){
39 qDebug() << "[QHyodaTool::~QHyodaTool] "<< objectName();
40 delete mesh;
41 delete cell;
42 delete xlog;
43 delete matrix;
44 delete papi;
45}
46
47void QHyodaTool::setJob(QHyodaJob *thisJob){
48 job=thisJob;
49}
50
51void QHyodaTool::add_matrix(void){
52 addTab(matrix=new QHyodaToolMatrix(this),"Matrix");
53}
54
55void QHyodaTool::add_mesh(void){
56 mesh=new QHyodaToolMesh(this);
57 setCurrentIndex(addTab(mesh,"Mesh"));
58 job->meshButton->setEnabled(false);
59 qDebug() << "[QHyodaTool::add_mesh] \33[7mAdding variables:\33[m";
60 for(int i=0; i<job->arcane_variables_names->size(); ++i){
61 qDebug() << "[QHyodaTool::add_mesh] Adding variable "<<job->arcane_variables_names->at(i);
62 mesh->variablesComboBox->addItem(job->arcane_variables_names->at(i));
63 }
64 connect(mesh->variablesComboBox,SIGNAL(currentIndexChanged(int)),
65 this,SLOT(tools_variable_index_change(int)));
66}
67void QHyodaTool::tools_variable_index_change(int index){
68 qDebug() << "[QHyodaTool] tools_variable_index_change:"<<index;
69}
70
71void QHyodaTool::add_cell(void){
72 cell=new QHyodaToolCell(job, this);
73 setCurrentIndex(addTab(cell,"Cell"));
74 cell->setRange(job->data->mesh_total_nb_cell);
75 job->cellButton->setEnabled(false);
76}
77
78void QHyodaTool::add_log(void){
79 xlog=new QHyodaX11XtermLog(job,this,"Log");
80 setCurrentIndex(addTab(xlog,"Log"));
81 //job->logButton->setEnabled(true);
82}
83
84void QHyodaTool::add_src(void){
85 /*QString daemonIdStr("src");
86 QHyodaX11Emacs *emacs=new QHyodaX11Emacs(this, daemonIdStr);
87 int idx=addTab(emacs, "Src");
88 emacs->launchEmacsInWindow(widget(idx), NULL);
89 setCurrentIndex(idx);
90 job->srcButton->setEnabled(false);*/
91}
92
93void QHyodaTool::add_papi(void){
94 papi=new QHyodaPapi(this);
95 setCurrentIndex(addTab(papi,"Papi"));
96}
97
98void QHyodaTool::tools_close_requested_slot(int index){
99 qDebug() << "[QHyodaTool::tools_close_requested_slot]";
100 if (tabText(index)=="Mesh"){
101 mesh->close();
102 job->meshButton->setEnabled(true);
103 }
104 if (tabText(index)=="Cell"){
105 cell->close();
106 job->cellButton->setEnabled(true);
107 }
108 if (tabText(index)=="Log"){
109 if (xlog) xlog->close();
110 job->logButton->setEnabled(true);
111 }
112 if (tabText(index)=="Src")
113 job->srcButton->setEnabled(true);
114
115 if (tabText(index)=="Papi")
116 job->papiButton->setEnabled(true);
117
118 removeTab(index);
119
120 if (count()==0) hide();
121}