From aacdc1a4b71c198fff66478c450094d9dfa127d4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 27 Apr 2024 23:36:48 +0200 Subject: [PATCH] Info feature for marker browser --- src/layui/layui/MarkerBrowserDialog.ui | 8 +++++ src/layui/layui/rdbMarkerBrowserDialog.cc | 42 ++++++++++++++++++++++- src/layui/layui/rdbMarkerBrowserDialog.h | 1 + 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/layui/layui/MarkerBrowserDialog.ui b/src/layui/layui/MarkerBrowserDialog.ui index 7aee07fe1..65a398b74 100644 --- a/src/layui/layui/MarkerBrowserDialog.ui +++ b/src/layui/layui/MarkerBrowserDialog.ui @@ -360,6 +360,14 @@ to load a marker database QAction::NoRole + + + Info + + + QAction::NoRole + + diff --git a/src/layui/layui/rdbMarkerBrowserDialog.cc b/src/layui/layui/rdbMarkerBrowserDialog.cc index b94829ed8..6f7fb1f14 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.cc +++ b/src/layui/layui/rdbMarkerBrowserDialog.cc @@ -33,6 +33,7 @@ #include "layConverters.h" #include "layQtTools.h" #include "layConfigurationDialog.h" +#include "layBrowserDialog.h" #include "dbLayoutUtils.h" #include "dbRecursiveShapeIterator.h" #include "dbStream.h" @@ -89,6 +90,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView connect (mp_ui->saveas_action, SIGNAL (triggered ()), this, SLOT (saveas_clicked ())); connect (mp_ui->export_action, SIGNAL (triggered ()), this, SLOT (export_clicked ())); connect (mp_ui->reload_action, SIGNAL (triggered ()), this, SLOT (reload_clicked ())); + connect (mp_ui->info_action, SIGNAL (triggered ()), this, SLOT (info_clicked ())); connect (mp_ui->unload_action, SIGNAL (triggered ()), this, SLOT (unload_clicked ())); connect (mp_ui->unload_all_action, SIGNAL (triggered ()), this, SLOT (unload_all_clicked ())); @@ -102,6 +104,7 @@ MarkerBrowserDialog::MarkerBrowserDialog (lay::Dispatcher *root, lay::LayoutView sep1->setSeparator (true); mp_ui->file_menu->addAction (sep1); mp_ui->file_menu->addAction (mp_ui->reload_action); + mp_ui->file_menu->addAction (mp_ui->info_action); QAction *sep2 = new QAction (mp_ui->file_menu); sep2->setSeparator (true); mp_ui->file_menu->addAction (sep2); @@ -420,6 +423,42 @@ BEGIN_PROTECTED END_PROTECTED } +void +MarkerBrowserDialog::info_clicked () +{ + rdb::Database *rdb = 0; + if (m_rdb_index < int (view ()->num_rdbs ()) && m_rdb_index >= 0) { + rdb = view ()->get_rdb (m_rdb_index); + } + if (! rdb) { + return; + } + + std::string html; + html = "\n"; + html += "

" + tl::escaped_to_html (rdb->name ()) + "

\n"; + if (! rdb->description ().empty ()) { + html += "" + tl::to_string (tr ("Description: ")) + "" + tl::escaped_to_html (tl::escape_string (rdb->description ())) + "
\n"; + } + if (! rdb->filename ().empty ()) { + html += "" + tl::to_string (tr ("File: ")) + "" + tl::escaped_to_html (rdb->filename ()) + "
\n"; + } + if (! rdb->original_file ().empty ()) { + html += "" + tl::to_string (tr ("Original File: ")) + "" + tl::escaped_to_html (rdb->original_file ()) + "
\n"; + } + if (! rdb->top_cell_name ().empty ()) { + html += "" + tl::to_string (tr ("Top Cell: ")) + "" + tl::escaped_to_html (rdb->top_cell_name ()) + "
\n"; + } + if (! rdb->generator ().empty ()) { + html += "" + tl::to_string (tr ("Generator: ")) + "" + tl::escaped_to_html (rdb->generator ()) + "
\n"; + } + html += ""; + + std::unique_ptr info_dialog (new lay::BrowserDialog (this, html)); + info_dialog->setWindowTitle (QObject::tr ("Marker Database Info")); + info_dialog->exec (); +} + void MarkerBrowserDialog::reload_clicked () { @@ -619,7 +658,7 @@ MarkerBrowserDialog::rdbs_changed () std::string text = rdb->name (); if (! rdb->description ().empty ()) { text += " ("; - text += rdb->description (); + text += tl::escape_string (rdb->description ()); text += ")"; } if (! rdb->filename ().empty () && rdb->name () != rdb->filename ()) { @@ -725,6 +764,7 @@ MarkerBrowserDialog::update_content () mp_ui->unload_action->setEnabled (rdb != 0); mp_ui->unload_all_action->setEnabled (rdb != 0); mp_ui->reload_action->setEnabled (rdb != 0); + mp_ui->info_action->setEnabled (rdb != 0); mp_ui->browser_frame->enable_updates (false); // Avoid building the internal lists several times ... mp_ui->browser_frame->set_rdb (0); // force update diff --git a/src/layui/layui/rdbMarkerBrowserDialog.h b/src/layui/layui/rdbMarkerBrowserDialog.h index a42005566..3d651b3fb 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.h +++ b/src/layui/layui/rdbMarkerBrowserDialog.h @@ -74,6 +74,7 @@ private: public slots: void cv_index_changed (int); void rdb_index_changed (int); + void info_clicked (); void save_clicked (); void saveas_clicked (); void export_clicked ();