Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
jsoneditormain.cpp
Go to the documentation of this file.
1 #include "jsoneditormain.h"
2 #include "ui_jsoneditormain.h"
3 #include "jsontreemodel.h"
4 #include "addnodedlg.h"
5 #include "jsedit.h"
6 #include <QMessageBox>
7 #include <QInputDialog>
8 #include <QFileDialog>
9 //#include <QtGui>
10 // phth
11 #include <stdio.h>
12 #include <iostream>
13 // galaxis
14 #include <galaxis/Errors.hpp>
15 #include <utils/settings.hpp>
16 #include <utils/logger.hpp>
17 
18 using namespace galaxis::utils;
19 
21  QMainWindow(parent),
22  ui(new Ui::JsonEditorMain),
23  newInsertText(tr("Insert new data")),
24  treeViewColumnKey(tr("Node")),
25  treeViewColumnValue(tr("Value")),
26  treeViewColumnType(tr("Type"))
27 {
28  ui->setupUi(this);
29  connect(ui->menuCodeTools, SIGNAL(toggled(bool)), this, SLOT(toggleCodeToolbar(bool)));
30  connect(ui->menuFindTools, SIGNAL(toggled(bool)), this, SLOT(toggleFindToolbar(bool)));
31  connect(ui->menuFileTools, SIGNAL(toggled(bool)), this, SLOT(toggleFileToolbar(bool)));
32  connect(ui->menuEditTools, SIGNAL(toggled(bool)), this, SLOT(toggleEditToolbar(bool)));
33  connect(ui->menuRefresh, SIGNAL(triggered()), this, SLOT(refreshJsonTree()));
34  connect(ui->menuInsertNode, SIGNAL(triggered()), this, SLOT(insertTreeNode()));
35  connect(ui->menuInsertChild, SIGNAL(triggered()), this, SLOT(insertTreeChild()));
36  connect(ui->menuDeleteNode, SIGNAL(triggered()), this, SLOT(deleteTreeNode()));
37  connect(ui->jsonTree, SIGNAL(clicked(QModelIndex)), this, SLOT(updateActions()));
38  connect(ui->menuFormat, SIGNAL(triggered()), this, SLOT(formatCode()));
39  connect(ui->menuHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
40  connect(ui->jsonTree, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(dataEdit(QModelIndex)));
41 
42 
43 // connect(ui->menuNewFile, SIGNAL(triggered()), this, SLOT(newFile()));
44  connect(ui->menuOpenFile, SIGNAL(triggered()), this, SLOT(open()));
45  connect(ui->menuSaveFile, SIGNAL(triggered()), this, SLOT(save()));
46  connect(ui->menuSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
47 
48  JSHighlighter * highlight = new JSHighlighter(ui->jsonCode->document());
49 
50  setCurrentFile("");
51 
52  textEdit = ui->jsonCode;
53  connect(textEdit->document(), SIGNAL(contentsChanged()),
54  this, SLOT(documentWasModified()));
55  setUnifiedTitleAndToolBarOnMac(true);
56 /*
57  m_findDialog = new FindDialog(this);
58  m_findDialog->setModal(false);
59  m_findDialog->setTextEdit(textEdit);
60 
61  m_findReplaceDialog = new FindReplaceDialog(this);
62  m_findReplaceDialog->setModal(false);
63  m_findReplaceDialog->setTextEdit(textEdit);
64 
65  connect(ui->menuFind, SIGNAL(triggered()), m_findDialog, SLOT(show()));
66  connect(ui->menuReplace, SIGNAL(triggered()), m_findReplaceDialog, SLOT(show()));
67 */
68 // connect(ui->actionFindNext, SIGNAL(triggered()), m_findDialog, SLOT(findNext()));
69 // connect(ui->actionFindPrevious, SIGNAL(triggered()), m_findDialog, SLOT(findPrev()));
70 
71  readSettings();
72 }
73 
75 {
76  delete ui;
77 }
78 
80 {
81  QMainWindow::changeEvent(e);
82  switch (e->type()) {
83  case QEvent::LanguageChange:
84  ui->retranslateUi(this);
85  break;
86  default:
87  break;
88  }
89 }
90 
92 {
93  checked ? ui->codeToolBar->show() : ui->codeToolBar->hide();
94 }
95 
97 {
98  checked ? ui->editToolBar->show() : ui->editToolBar->hide();
99 }
100 
102 {
103  checked ? ui->fileToolBar->show() : ui->fileToolBar->hide();
104 }
105 
107 {
108  checked ? ui->findToolBar->show() : ui->findToolBar->hide();
109 }
110 
112 {
113  if (!ui->jsonCode->document()->isEmpty())
114  {
115  // QByteArray ss = ui->jsonCode->toPlainText().toLocal8Bit();
116  std::string json = ui->jsonCode->toPlainText().toStdString();
117 
118  jsonValue.clear();
119  jsonValue = nlohmann::json::parse(json);
120 
121 
122  QStringList headers;
124 
125 
126 
127  QAbstractItemModel *oldModel = ui->jsonTree->model();
128  if (oldModel != NULL)
129  oldModel->disconnect(SIGNAL(dataChanged(QModelIndex,QModelIndex)));
130 
131  JsonTreeModel *model = new JsonTreeModel(headers, jsonValue);
132  QItemSelectionModel *selectionModel = ui->jsonTree->selectionModel();
133  connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(treeViewDataChanged()));
134  ui->jsonTree->setModel(model);
135  ui->jsonTree->reset();
136  delete selectionModel;
137  delete oldModel;
138 
139 
140  ui->jsonTree->expandAll();
141 
142  for (int i = 0; i < ui->jsonTree->model()->columnCount(); i++)
143  ui->jsonTree->resizeColumnToContents(i);
144  }
145 }
146 
148 {
149  AddNodeDlg dlg;
150  if (dlg.exec() == QDialog::Accepted)
151  {
152  if(ui->jsonTree->selectionModel() == 0)
153  {
154  QMessageBox::warning(this,this->windowTitle(),"Adding a node to an empty tree is not supported.");
155  return;
156  }
157 
158  QModelIndex index = ui->jsonTree->selectionModel()->currentIndex();
159  QAbstractItemModel *model = ui->jsonTree->model();
160 
161  if (!model->insertRow(index.row()+1, index.parent()))
162  return;
163 
164  updateActions();
165 
166  /*
167  for (int column = 0; column < model->columnCount(index.parent()); ++column)
168  {
169  QModelIndex child = model->index(index.row()+1, column, index.parent());
170  model->setData(child, QVariant(newInsertText), Qt::EditRole);
171  }
172  */
173  QModelIndex child = model->index(index.row()+1, 0, index.parent());
174  model->setData(child, QVariant(dlg.getName()), Qt::EditRole);
175 
176  child = model->index(index.row()+1, 1, index.parent());
177  model->setData(child, QVariant(dlg.getValue()), Qt::EditRole);
178 
179  child = model->index(index.row()+1, 2, index.parent());
180  model->setData(child, QVariant(dlg.getType()), Qt::EditRole);
181  }
182 }
183 
185 {
186  AddNodeDlg dlg;
187  if (dlg.exec() == QDialog::Accepted)
188  {
189  QModelIndex index = ui->jsonTree->selectionModel()->currentIndex();
190  JsonTreeModel *model = (JsonTreeModel*)ui->jsonTree->model();
191 
192  if (index.column() != 0)
193  {
194  index = index.sibling(index.row(), 0);
195  }
196 
197  if (model->columnCount(index) == 0)
198  {
199  if (!model->insertColumn(0, index))
200  return;
201  }
202 
203  if (!model->insertRow(0, index))
204  return;
205 
206  /*
207  for (int column = 0; column < model->columnCount(index); column++)
208  {
209  QModelIndex child = model->index(0, column, index);
210  model->setData(child, QVariant(newInsertText), Qt::EditRole);
211  }
212  */
213 
214  QModelIndex child = model->index(0, 0, index);
215  model->setData(child, QVariant(dlg.getName()), Qt::EditRole);
216 
217  child = model->index(0, 1, index);
218  model->setData(child, QVariant(dlg.getValue()), Qt::EditRole);
219 
220  child = model->index(0, 2, index);
221  model->setData(child, QVariant(dlg.getType()), Qt::EditRole);
222 
223  ui->jsonTree->selectionModel()->setCurrentIndex(model->index(0, 0, index),
224  QItemSelectionModel::ClearAndSelect);
225  updateActions();
226  }
227 }
228 
230 {
231  QModelIndex index = ui->jsonTree->selectionModel()->currentIndex();
232  QAbstractItemModel *model = ui->jsonTree->model();
233  if (model->removeRow(index.row(), index.parent()))
234  updateActions();
235 }
236 
238  {
239  bool hasSelection = !ui->jsonTree->selectionModel()->selection().isEmpty();
240  ui->menuDeleteNode->setEnabled(hasSelection);
241 
242  bool hasCurrent = ui->jsonTree->selectionModel()->currentIndex().isValid();
243  ui->menuInsertNode->setEnabled(hasCurrent);
244  ui->menuInsertChild->setEnabled(hasCurrent);
245  }
246 
248 {
249  for (int i = 0; i < ui->jsonTree->model()->columnCount(); i++)
250  {
251  ui->jsonTree->resizeColumnToContents(i);
252  ui->jsonTree->setColumnWidth(i, ui->jsonTree->columnWidth(i) + 20);
253  }
254 }
255 
257 {
258  if (ui->jsonTree->model() != NULL)
259  {
260  ui->jsonCode->clear();
261 
262  QString codeText = "";
263  JsonTreeModel *model;
264  model = (JsonTreeModel*)ui->jsonTree->model();
265  codeText += treeFormat(model->getRootItem(), "", true);
266 
267  ui->jsonCode->setPlainText(codeText);
268  }
269 }
270 
271 QString JsonEditorMain::treeFormat(JsonTreeItem *treeItem, QString indent, bool noHeader)
272 {
273  QString resultStr;
274  QString objectKey = treeItem->data(0).toString();
275  QString objectValue = treeItem->data(1).toString();
276  QString objectType = treeItem->data(2).toString();
277 
278  if (noHeader)
279  {
280  resultStr = indent;
281  }
282  else
283  {
284  resultStr = indent + QString("\"") + objectKey + "\": ";
285  }
286 
287  if (objectType.compare(tr("object"), Qt::CaseInsensitive) == 0
288  || objectType.compare(treeViewColumnType, Qt::CaseInsensitive) == 0)
289  {
290  resultStr += "{\n";
291  JsonTreeItem *subObjectItem;
292  for (int i = 0; i < treeItem->childCount(); i++)
293  {
294  subObjectItem = treeItem->child(i);
295  resultStr += treeFormat(subObjectItem, indent + " ");
296  }
297  if(treeItem->childCount() > 0)
298  resultStr.remove(resultStr.length() - 2, 1);// remove trailing comma
299  resultStr += indent + "},\n";
300  }
301  else if (objectType.compare(tr("array"), Qt::CaseInsensitive) == 0)
302  {
303  resultStr += "[\n";
304  JsonTreeItem *subObjectItem;
305  for (int i = 0; i < treeItem->childCount(); i++)
306  {
307  subObjectItem = treeItem->child(i);
308  resultStr += treeFormat(subObjectItem, indent + " ", true);
309  }
310  if(treeItem->childCount() > 0)
311  resultStr.remove(resultStr.length() - 2, 1);// remove trailing comma
312  resultStr += indent + "],\n";
313  }
314  else
315  {
316  if (objectType.compare(tr("string"), Qt::CaseInsensitive) == 0 ||
317  objectType.compare(newInsertText, Qt::CaseInsensitive) == 0)
318  {
319  resultStr += "\"" + objectValue + "\",\n";
320  }
321  else
322  {
323  resultStr += objectValue + ",\n";
324  }
325  }
326 
327  return resultStr;
328 }
329 
331 {
332  QMessageBox::information(this, tr("Using Help"), tr(
333  "1 On the left side of the main interface to fill the JSON code \n"
334  "2 Click on the menu \" Generate code tree \", the right of the main interface will spanning tree \n"
335  "3 To insert or delete after the tree node or modify the value, click on the menu \" Generate Code \", will generate JSON code from the tree." ));
336 }
337 
338 void JsonEditorMain::dataEdit(QModelIndex editIndex)
339 {
340  QString vType = editIndex.sibling(editIndex.row(), 2).data(Qt::EditRole).toString();
341 
342  if (vType.compare(tr("object")) != 0
343  && vType.compare(tr("array")) != 0)
344  {
345  if (editIndex.column() >= 2)
346  {
347  QModelIndex newIndex = editIndex.sibling(editIndex.row(), 1);
348  ui->jsonTree->edit(newIndex);
349  }
350  }
351  else
352  {
353  QModelIndex newIndex = editIndex.sibling(editIndex.row(), 0);
354  ui->jsonTree->edit(newIndex);
355  }
356 }
357 
359 {
360  setWindowModified(textEdit->document()->isModified());
361 }
362 
363 void JsonEditorMain::closeEvent(QCloseEvent *event)
364 {
365  if (maybeSave()) {
366  writeSettings();
367  event->accept();
368  } else {
369  event->ignore();
370  }
371 }
372 
374 {
375  if (maybeSave()) {
376  QString fileName = QFileDialog::getOpenFileName(this,"Open Json File",lastFilePath);
377  if (!fileName.isEmpty())
378  {
379  QFileInfo info(fileName);
380  lastFilePath = info.absoluteDir().absolutePath();
381  loadFile(fileName);
382  }
383  }
384 
385  ui->menuRefresh->trigger();
386 }
387 
389 {
390  if (curFile.isEmpty()) {
391  return saveAs();
392  } else {
393  return saveFile(curFile);
394  }
395 }
396 
398 {
399  QFileDialog dialog(this);
400  dialog.setWindowModality(Qt::WindowModal);
401  dialog.setAcceptMode(QFileDialog::AcceptSave);
402  dialog.exec();
403  QStringList files = dialog.selectedFiles();
404 
405  if (files.isEmpty())
406  return false;
407 
408  return saveFile(files.at(0));
409 }
410 
412 {
413  QSettings settings;
414 // QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
415 // QSize size = settings.value("size", QSize(400, 400)).toSize();
416 // resize(size);
417 // move(pos);
418  this->restoreGeometry(settings.value("geometry").toByteArray());
419  lastFilePath = (settings.value("file_path").toString());
420  curFile = settings.value("last_opened_file").toString();
421  if(this->curFile.length() != 0)
422  {
423  loadFile(curFile);
424  ui->menuRefresh->trigger();
425  }
426 }
427 
429 {
430  QSettings settings;
431 // settings.setValue("pos", pos());
432 // settings.setValue("size", size());
433  settings.setValue("geometry", this->saveGeometry());
434  settings.setValue("file_path", lastFilePath);
435  settings.setValue("last_opened_file", this->curFile);
436 }
437 
439 {
440  if (ui->jsonCode->document()->isModified()) {
441  QMessageBox::StandardButton ret;
442  ret = QMessageBox::warning(this, this->windowTitle(),
443  tr("The document has been modified.\n"
444  "Do you want to save your changes?"),
445  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
446  if (ret == QMessageBox::Save)
447  return save();
448  else if (ret == QMessageBox::Cancel)
449  return false;
450  }
451  return true;
452 }
453 
454 void JsonEditorMain::loadFile(const QString &fileName)
455 {
456  QFile file(fileName);
457  if (!file.open(QFile::ReadOnly | QFile::Text)) {
458  QMessageBox::warning(this, this->windowTitle(),
459  tr("Cannot read file %1:\n%2.")
460  .arg(fileName)
461  .arg(file.errorString()));
462  return;
463  }
464 
465  QTextStream in(&file);
466 #ifndef QT_NO_CURSOR
467  QApplication::setOverrideCursor(Qt::WaitCursor);
468 #endif
469  textEdit->setPlainText(in.readAll());
470 #ifndef QT_NO_CURSOR
471  QApplication::restoreOverrideCursor();
472 #endif
473 
474  setCurrentFile(fileName);
475  statusBar()->showMessage(tr("File loaded"), 2000);
476 }
477 
478 bool JsonEditorMain::saveFile(const QString &fileName)
479 {
480  ui->menuFormat->trigger();
481 
482  QFile file(fileName);
483  QFileInfo info(fileName);
484  lastFilePath = info.absoluteDir().absolutePath();
485  if (!file.open(QFile::WriteOnly | QFile::Text)) {
486  QMessageBox::warning(this, this->windowTitle(),
487  tr("Cannot write file %1:\n%2.")
488  .arg(fileName)
489  .arg(file.errorString()));
490  return false;
491  }
492 
493  QTextStream out(&file);
494 #ifndef QT_NO_CURSOR
495  QApplication::setOverrideCursor(Qt::WaitCursor);
496 #endif
497  // hacky schmacky workaround because ',' is added at file ending!
498  auto content = textEdit->toPlainText();
499  content.remove(content.length() - 2, 2);
500  out << content;
501 #ifndef QT_NO_CURSOR
502  QApplication::restoreOverrideCursor();
503 #endif
504 
505  setCurrentFile(fileName);
506  statusBar()->showMessage(tr("File saved"), 2000);
507  return true;
508 }
509 
510 void JsonEditorMain::setCurrentFile(const QString &fileName)
511 {
512  curFile = fileName;
513  ui->jsonCode->document()->setModified(false);
514  setWindowModified(false);
515 
516  QString shownName = curFile;
517  if (curFile.isEmpty())
518  shownName = "untitled.json";
519  setWindowFilePath(shownName);
520 }
521 
522 QString JsonEditorMain::strippedName(const QString &fullFileName)
523 {
524  return QFileInfo(fullFileName).fileName();
525 }
526 
527 #ifdef COMPILE_WITH_ROS
528 // get parent ROS node "testSetupNode"
529 void JsonEditorMain::set_node(std::shared_ptr<testSetupNode> p_nodeSPtr) {
530  if(p_nodeSPtr == nullptr) {
532  } else {
533  m_nodeSPtr = p_nodeSPtr;
534  }
535 }
536 #endif
537 
539 {
540  std::shared_ptr<std::map<std::string, std::vector<rclcpp::Parameter>>> parameterMap = std::make_shared<std::map<std::string, std::vector<rclcpp::Parameter>>>();
541 
542  JsonTreeModel *model;
543  model = (JsonTreeModel*)ui->jsonTree->model();
544  if(model == nullptr) {
545  std::cout << "No file loaded. Abort sending." << std::endl;
546  return;
547  }
548 
549  JsonTreeItem *rootItem = model->getRootItem();
550  if(rootItem == nullptr) {
551  std::cout << "No file loaded. Abort sending." << std::endl;
552  return;
553  }
554 
555  QString objectType = rootItem->data(2).toString();
556 
557  if (objectType.compare(tr("object"), Qt::CaseInsensitive) == 0
558  || objectType.compare(treeViewColumnType, Qt::CaseInsensitive) == 0)
559  {
560  JsonTreeItem *nodeObjectItem;
561  JsonTreeItem *subsectionObjectItem;
562  JsonTreeItem *parameterObjectItem;
563 
564  for (int node_i = 0; node_i < rootItem->childCount(); node_i++)
565  {
566  nodeObjectItem = rootItem->child(node_i);
567  QString node_objectKey = nodeObjectItem->data(0).toString();
568  std::string node_objectKey_str = node_objectKey.toStdString().c_str();
569 
570  parameterMap->insert(std::make_pair(node_objectKey_str, std::vector<rclcpp::Parameter>()));
571 
572  for (int subsection_i = 0; subsection_i < nodeObjectItem->childCount(); subsection_i++)
573  {
574  subsectionObjectItem = nodeObjectItem->child(subsection_i);
575  QString subsection_objectKey = subsectionObjectItem->data(0).toString();
576  std::string subsection_objectKey_str = subsection_objectKey.toStdString().c_str();
577 
578  for (int parameter_i = 0; parameter_i < subsectionObjectItem->childCount(); parameter_i++)
579  {
580  parameterObjectItem = subsectionObjectItem->child(parameter_i);
581  QString parameter_objectKey = parameterObjectItem->data(0).toString();
582  std::string parameter_objectKey_str = parameter_objectKey.toStdString().c_str();
583 
584  QString parameter_objectType = parameterObjectItem->data(2).toString();
585  if(parameter_objectType == "unsigned integer") {
586  int parameter_objectValue_int = parameterObjectItem->data(1).toInt();
587  (*parameterMap)[node_objectKey_str].push_back(rclcpp::Parameter(subsection_objectKey_str + "." + parameter_objectKey_str, parameter_objectValue_int));
588  }
589  else if(parameter_objectType == "double") {
590  double parameter_objectValue_double = parameterObjectItem->data(1).toDouble();
591  (*parameterMap)[node_objectKey_str].push_back(rclcpp::Parameter(subsection_objectKey_str + "." + parameter_objectKey_str, parameter_objectValue_double));
592  }
593  else {
594  RCLCPP_ERROR(m_nodeSPtr->get_logger(), "[SYSTEM SETTINGS] Type of parameter %s %s.%s %s", node_objectKey.toLocal8Bit().data(), subsection_objectKey.toLocal8Bit().data(), parameter_objectKey.toLocal8Bit().data(), " is NOT valid (INT or FLOAT/DOUBLE). Skipping.");
595  }
596  }
597  }
598  }
599  }
600 
601  // send parameters to node
602  m_parameterMap = parameterMap;
603  std::thread(std::bind(&testSetupNode::send_settings_, m_nodeSPtr, m_parameterMap)).detach();
604 }
JsonEditorMain::changeEvent
void changeEvent(QEvent *e)
Definition: jsoneditormain.cpp:79
JsonEditorMain::treeFormat
QString treeFormat(JsonTreeItem *treeItem=NULL, QString indent="", bool noHeader=false)
Definition: jsoneditormain.cpp:271
JsonEditorMain::insertTreeChild
void insertTreeChild()
Definition: jsoneditormain.cpp:184
testSetupNode::send_settings_
bool send_settings_(std::shared_ptr< std::map< std::string, std::vector< rclcpp::Parameter >>> p_settingsGUIParameterMap)
Definition: testSetupNode.cpp:20
JsonEditorMain::insertTreeNode
void insertTreeNode()
Definition: jsoneditormain.cpp:147
AddNodeDlg::getType
QString getType()
Definition: addnodedlg.cpp:51
JsonEditorMain::lastFilePath
QString lastFilePath
Definition: jsoneditormain.h:64
AddNodeDlg::getName
QString getName()
Definition: addnodedlg.cpp:46
JsonEditorMain::refreshJsonTree
void refreshJsonTree()
Definition: jsoneditormain.cpp:111
JsonTreeModel::setData
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: jsontreemodel.cpp:153
JsonEditorMain::updateActions
void updateActions()
Definition: jsoneditormain.cpp:237
JSHighlighter
Definition: jsedit.h:121
json
nlohmann::json json
Definition: AutoPilotNode.hpp:21
AddNodeDlg::getValue
QString getValue()
Definition: addnodedlg.cpp:41
JsonEditorMain::documentWasModified
void documentWasModified()
Definition: jsoneditormain.cpp:358
settings.hpp
JsonEditorMain::readSettings
void readSettings()
Definition: jsoneditormain.cpp:411
JsonEditorMain::dataEdit
void dataEdit(QModelIndex editIndex)
Definition: jsoneditormain.cpp:338
galaxis::Errors::POINTER_ERROR
Definition: Errors.hpp:18
JsonEditorMain::deleteTreeNode
void deleteTreeNode()
Definition: jsoneditormain.cpp:229
JsonTreeItem::childCount
int childCount() const
Definition: jsontreeitem.cpp:21
JsonEditorMain::on_Send_clicked
void on_Send_clicked()
Definition: jsoneditormain.cpp:538
JsonEditorMain::formatCode
void formatCode()
Definition: jsoneditormain.cpp:256
JsonEditorMain::saveFile
bool saveFile(const QString &fileName)
Definition: jsoneditormain.cpp:478
JsonEditorMain::treeViewColumnType
const QString treeViewColumnType
Definition: jsoneditormain.h:52
Ui
Definition: addnodedlg.h:6
JsonEditorMain::toggleFindToolbar
void toggleFindToolbar(bool checked)
Definition: jsoneditormain.cpp:106
JsonTreeItem::child
JsonTreeItem * child(int number)
Definition: jsontreeitem.cpp:16
JsonEditorMain::showHelp
void showHelp()
Definition: jsoneditormain.cpp:330
JsonEditorMain::setCurrentFile
void setCurrentFile(const QString &fileName)
Definition: jsoneditormain.cpp:510
JsonEditorMain::strippedName
QString strippedName(const QString &fullFileName)
Definition: jsoneditormain.cpp:522
JsonEditorMain::saveAs
bool saveAs()
Definition: jsoneditormain.cpp:397
jsoneditormain.h
JsonEditorMain::~JsonEditorMain
~JsonEditorMain()
Definition: jsoneditormain.cpp:74
JsonEditorMain::open
void open()
Definition: jsoneditormain.cpp:373
JsonEditorMain::treeViewDataChanged
void treeViewDataChanged()
Definition: jsoneditormain.cpp:247
JsonEditorMain::maybeSave
bool maybeSave()
Definition: jsoneditormain.cpp:438
JsonEditorMain::save
bool save()
Definition: jsoneditormain.cpp:388
JsonEditorMain::toggleEditToolbar
void toggleEditToolbar(bool checked)
Definition: jsoneditormain.cpp:96
JsonEditorMain::JsonEditorMain
JsonEditorMain(QWidget *parent=0)
Definition: jsoneditormain.cpp:20
JsonEditorMain::toggleCodeToolbar
void toggleCodeToolbar(bool checked)
Definition: jsoneditormain.cpp:91
JsonEditorMain::ui
Ui::JsonEditorMain * ui
Definition: jsoneditormain.h:46
JsonTreeModel
Definition: jsontreemodel.h:13
JsonEditorMain::closeEvent
void closeEvent(QCloseEvent *event)
Definition: jsoneditormain.cpp:363
JsonEditorMain::textEdit
QTextEdit * textEdit
Definition: jsoneditormain.h:63
JsonEditorMain::m_parameterMap
std::shared_ptr< std::map< std::string, std::vector< rclcpp::Parameter > > > m_parameterMap
Definition: jsoneditormain.h:66
AddNodeDlg
Definition: addnodedlg.h:10
JsonEditorMain::treeViewColumnKey
const QString treeViewColumnKey
Definition: jsoneditormain.h:50
JsonTreeModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: jsontreemodel.cpp:25
JsonTreeModel::getRootItem
JsonTreeItem * getRootItem()
Definition: jsontreemodel.cpp:260
logger.hpp
JsonEditorMain
Definition: jsoneditormain.h:25
JsonEditorMain::loadFile
void loadFile(const QString &fileName)
Definition: jsoneditormain.cpp:454
JsonTreeItem::data
QVariant data(int column) const
Definition: jsontreeitem.cpp:39
JsonEditorMain::curFile
QString curFile
Definition: jsoneditormain.h:62
galaxis::utils
Definition: clock.hpp:5
JsonTreeModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: jsontreemodel.cpp:69
jsontreemodel.h
addnodedlg.h
JsonEditorMain::jsonValue
nlohmann::json jsonValue
Definition: jsoneditormain.h:47
JsonEditorMain::writeSettings
void writeSettings()
Definition: jsoneditormain.cpp:428
JsonEditorMain::toggleFileToolbar
void toggleFileToolbar(bool checked)
Definition: jsoneditormain.cpp:101
jsedit.h
JsonTreeItem
Definition: jsontreeitem.h:8
JsonEditorMain::treeViewColumnValue
const QString treeViewColumnValue
Definition: jsoneditormain.h:51
JsonEditorMain::newInsertText
const QString newInsertText
Definition: jsoneditormain.h:49
Errors.hpp