diff --git a/src/layui/layui/MarkerBrowserPage.ui b/src/layui/layui/MarkerBrowserPage.ui index 07bbf0344..18afcbe7f 100644 --- a/src/layui/layui/MarkerBrowserPage.ui +++ b/src/layui/layui/MarkerBrowserPage.ui @@ -62,7 +62,7 @@ ... - + :/run_16px.png:/run_16px.png @@ -480,27 +480,6 @@ 6 - - - - Info - - - - - - - Add snapshot - - - Photo - - - - :/photo_16px.png:/photo_16px.png - - - @@ -515,40 +494,6 @@ - - - - - - - - - - - Set or reset flag - - - Flag - - - QToolButton::MenuButtonPopup - - - - - - - Important - - - Imp - - - - :/important_16px.png:/important_16px.png - - - @@ -566,6 +511,54 @@ p, li { white-space: pre-wrap; } + + + + Set or reset flag + + + Flag + + + QToolButton::MenuButtonPopup + + + + + + + Add snapshot + + + Photo + + + + :/photo_16px.png:/photo_16px.png + + + + + + + Important + + + Imp + + + + :/important_16px.png:/important_16px.png + + + + + + + + + + @@ -612,6 +605,63 @@ p, li { white-space: pre-wrap; } + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Info + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + list shapes + + + + + + diff --git a/src/layui/layui/rdbMarkerBrowser.cc b/src/layui/layui/rdbMarkerBrowser.cc index 12a2a6919..e7bc8e8e3 100644 --- a/src/layui/layui/rdbMarkerBrowser.cc +++ b/src/layui/layui/rdbMarkerBrowser.cc @@ -42,6 +42,7 @@ namespace rdb std::string cfg_rdb_context_mode ("rdb-context-mode"); std::string cfg_rdb_show_all ("rdb-show-all"); +std::string cfg_rdb_list_shapes ("rdb-list-shapes"); std::string cfg_rdb_window_state ("rdb-window-state-v2"); // v2: 0.24++ std::string cfg_rdb_window_mode ("rdb-window-mode"); std::string cfg_rdb_window_dim ("rdb-window-dim"); diff --git a/src/layui/layui/rdbMarkerBrowserDialog.cc b/src/layui/layui/rdbMarkerBrowserDialog.cc index 082a7310a..6855ddd25 100644 --- a/src/layui/layui/rdbMarkerBrowserDialog.cc +++ b/src/layui/layui/rdbMarkerBrowserDialog.cc @@ -48,6 +48,7 @@ namespace rdb extern std::string cfg_rdb_context_mode; extern std::string cfg_rdb_show_all; +extern std::string cfg_rdb_list_shapes; extern std::string cfg_rdb_window_state; extern std::string cfg_rdb_window_mode; extern std::string cfg_rdb_window_dim; @@ -445,6 +446,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu bool need_update = false; bool taken = true; bool show_all = mp_ui->browser_frame->show_all (); + bool list_shapes = mp_ui->browser_frame->list_shapes (); if (name == cfg_rdb_context_mode) { @@ -452,6 +454,10 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu MarkerBrowserContextModeConverter ().from_string (value, context); need_update = lay::test_and_set (m_context, context); + } else if (name == cfg_rdb_list_shapes) { + + tl::from_string (value, list_shapes); + } else if (name == cfg_rdb_show_all) { tl::from_string (value, show_all); @@ -540,6 +546,7 @@ MarkerBrowserDialog::configure (const std::string &name, const std::string &valu } mp_ui->browser_frame->show_all (show_all); + mp_ui->browser_frame->list_shapes (list_shapes); return taken; } diff --git a/src/layui/layui/rdbMarkerBrowserPage.cc b/src/layui/layui/rdbMarkerBrowserPage.cc index f81e77bd9..822d19572 100644 --- a/src/layui/layui/rdbMarkerBrowserPage.cc +++ b/src/layui/layui/rdbMarkerBrowserPage.cc @@ -44,6 +44,7 @@ namespace rdb { extern std::string cfg_rdb_show_all; +extern std::string cfg_rdb_list_shapes; struct FlagDescriptor { @@ -1447,6 +1448,7 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/) m_update_needed (false), mp_database (0), m_show_all (true), + m_list_shapes (true), mp_view (0), m_cv_index (0), m_num_items (0), @@ -1504,6 +1506,8 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/) markers_list->header ()->setSortIndicatorShown (true); markers_list->header ()->setMinimumSectionSize (24); + list_shapes_cb->setChecked (m_list_shapes); + connect (markers_list, SIGNAL (doubleClicked (const QModelIndex &)), this, SLOT (marker_double_clicked (const QModelIndex &))); connect (dir_up_pb, SIGNAL (clicked ()), this, SLOT (dir_up_clicked ())); @@ -1519,6 +1523,7 @@ MarkerBrowserPage::MarkerBrowserPage (QWidget * /*parent*/) connect (cat_filter, SIGNAL (textEdited (const QString &)), this, SLOT (filter_changed ())); connect (cell_filter, SIGNAL (textEdited (const QString &)), this, SLOT (filter_changed ())); connect (rerun_button, SIGNAL (pressed ()), this, SLOT (rerun_button_pressed ())); + connect (list_shapes_cb, SIGNAL (clicked ()), this, SLOT (list_shapes_clicked ())); m_show_all_action = new QAction (QObject::tr ("Show All"), this); m_show_all_action->setCheckable (true); @@ -1674,7 +1679,20 @@ MarkerBrowserPage::show_all (bool f) } } -void +void +MarkerBrowserPage::list_shapes (bool f) +{ + if (f != m_list_shapes) { + + m_list_shapes = f; + list_shapes_cb->setChecked (f); + + update_info_text (); + + } +} + +void MarkerBrowserPage::set_rdb (rdb::Database *database) { if (database != mp_database) { @@ -1975,7 +1993,7 @@ MarkerBrowserPage::update_info_text () for (rdb::Values::const_iterator v = item->values ().begin (); v != item->values ().end (); ++v) { - if (v->get () != 0) { + if (v->get () != 0 && (m_list_shapes || ! v->get ()->is_shape ())) { if (v->tag_id () != 0) { const rdb::Tag &tag = mp_database->tags ().tag (v->tag_id ()); @@ -2851,7 +2869,15 @@ MarkerBrowserPage::show_all_clicked () } } -void +void +MarkerBrowserPage::list_shapes_clicked () +{ + if (mp_plugin_root) { + mp_plugin_root->config_set (cfg_rdb_list_shapes, tl::to_string (list_shapes_cb->isChecked ())); + } +} + +void MarkerBrowserPage::unwaive_all () { if (! mp_database) { diff --git a/src/layui/layui/rdbMarkerBrowserPage.h b/src/layui/layui/rdbMarkerBrowserPage.h index c2e11dd11..68832f04c 100644 --- a/src/layui/layui/rdbMarkerBrowserPage.h +++ b/src/layui/layui/rdbMarkerBrowserPage.h @@ -103,6 +103,21 @@ public: */ void show_all (bool f); + /** + * @brief Gets a value indicating whether to list the shapes in the info panel + */ + bool list_shapes () const + { + return m_list_shapes; + } + + /** + * @brief Sets a value indicating whether to list the shapes in the info panel + * + * If this property is set to false, shapes will not be listed in the info panel. + */ + void list_shapes (bool f); + /** * @brief Update the contents * @@ -176,6 +191,7 @@ public slots: void waive (); void unwaive (); void show_all_clicked (); + void list_shapes_clicked (); void info_anchor_clicked (const QUrl &link); void filter_changed (); @@ -184,6 +200,7 @@ private: bool m_update_needed; rdb::Database *mp_database; bool m_show_all; + bool m_list_shapes; QAction *m_show_all_action; lay::LayoutViewBase *mp_view; unsigned int m_cv_index; diff --git a/src/rdb/rdb/rdb.cc b/src/rdb/rdb/rdb.cc index eab2428a0..0c38bba86 100644 --- a/src/rdb/rdb/rdb.cc +++ b/src/rdb/rdb/rdb.cc @@ -156,6 +156,49 @@ template <> RDB_PUBLIC std::string Value::to_display_string () const return to_string (); } +// is_shape implementations + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return false; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return false; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + +template <> RDB_PUBLIC bool Value::is_shape () const +{ + return true; +} + + bool ValueBase::compare (const ValueBase *a, const ValueBase *b) { // compare is the intrinsic compare of equal type and type index for different types. diff --git a/src/rdb/rdb/rdb.h b/src/rdb/rdb/rdb.h index ac9535627..f27f257ae 100644 --- a/src/rdb/rdb/rdb.h +++ b/src/rdb/rdb/rdb.h @@ -438,6 +438,8 @@ public: virtual std::string to_display_string () const = 0; + virtual bool is_shape () const = 0; + virtual ValueBase *clone () const = 0; virtual int type_index () const = 0; @@ -508,6 +510,8 @@ public: return m_value < static_cast *> (other)->m_value; } + bool is_shape () const; + std::string to_string () const; std::string to_display_string () const;