| 720 | } |
| 721 | |
| 722 | void |
| 723 | LayoutViewBase::update_title () |
| 724 | { |
| 725 | if (! m_title.empty ()) { |
| 726 | |
| 727 | if (m_title != m_current_title) { |
| 728 | m_current_title = m_title; |
| 729 | emit_title_changed (); |
| 730 | } |
| 731 | |
| 732 | } else if (cellviews () == 0) { |
| 733 | |
| 734 | static std::string empty_title = tl::to_string (tr ("<empty>")); |
| 735 | if (m_current_title != empty_title) { |
| 736 | m_current_title = empty_title; |
| 737 | emit_title_changed (); |
| 738 | } |
| 739 | |
| 740 | } else { |
| 741 | |
| 742 | int cv_index = active_cellview_index (); |
| 743 | if (cv_index < 0 || cv_index >= int (cellviews ())) { |
| 744 | cv_index = 0; |
| 745 | } |
| 746 | |
| 747 | const lay::CellView &cv0 = cellview (cv_index); |
| 748 | |
| 749 | std::string t; |
| 750 | |
| 751 | t += cv0->name (); |
| 752 | if (cv0->layout ().is_valid_cell_index (cv0.cell_index ())) { |
| 753 | t += " ["; |
| 754 | t += cv0->layout ().cell_name (cv0.cell_index ()); |
| 755 | t += "]"; |
| 756 | } |
| 757 | |
| 758 | if (cellviews () > 1) { |
| 759 | t += " ..."; |
| 760 | } |
| 761 | |
| 762 | if (t != m_current_title) { |
| 763 | m_current_title = t; |
| 764 | emit_title_changed (); |
| 765 | } |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | void |
| 770 | LayoutViewBase::set_title (const std::string &t) |
nothing calls this directly
no test coverage detected