From 940a7230e310f7a7f5002bbc06a4e3653be6c087 Mon Sep 17 00:00:00 2001 From: dfochi Date: Fri, 20 May 2016 20:16:28 +0000 Subject: [PATCH] Added view mode in Cross References - included Folio Field git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4491 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/projectconfigpages.cpp | 4 +- sources/properties/xrefproperties.cpp | 10 +++++ sources/properties/xrefproperties.h | 9 ++++ sources/qetgraphicsitem/crossrefitem.cpp | 10 ++++- sources/ui/titleblockpropertieswidget.ui | 38 +++++++++------- sources/ui/xrefpropertieswidget.cpp | 10 +++++ sources/ui/xrefpropertieswidget.ui | 55 ++++++++++++++++++++---- 7 files changed, 108 insertions(+), 28 deletions(-) diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 3544143a4..29a9c7125 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -331,7 +331,7 @@ void ProjectAutoNumConfigPage::initLayout() { //Auto Numbering Tab tab_widget->addTab(autoNumbering_tab_widget,tr ("Folio Auto Numbering")); - tab_widget->resize(440,590); + tab_widget->resize(455,590); } /** @@ -514,7 +514,7 @@ void ProjectAutoNumConfigPage::tabChanged(int i){ tab_widget->resize(470,tab_widget->height()); } else { - tab_widget->resize(440,tab_widget->height()); + tab_widget->resize(455,tab_widget->height()); } } } diff --git a/sources/properties/xrefproperties.cpp b/sources/properties/xrefproperties.cpp index 6c054d663..4630404f7 100644 --- a/sources/properties/xrefproperties.cpp +++ b/sources/properties/xrefproperties.cpp @@ -27,6 +27,7 @@ XRefProperties::XRefProperties() m_show_power_ctc = true; m_display = Cross; m_snap_to = Bottom; + m_view_mode = Index; m_prefix_keys << "power" << "delay" << "switch"; } @@ -40,6 +41,8 @@ void XRefProperties::toSettings(QSettings &settings, const QString prefix) const settings.setValue(prefix + "showpowerctc", m_show_power_ctc); QString display = m_display == Cross? "cross" : "contacts"; settings.setValue(prefix + "displayhas", display); + QString view_mode = m_view_mode == Index? "index" : "foliolabel"; + settings.setValue(prefix + "viewmode", view_mode); QString snap = m_snap_to == Bottom? "bottom" : "label"; settings.setValue(prefix + "snapto", snap); foreach (QString key, m_prefix.keys()) { @@ -57,6 +60,8 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi m_show_power_ctc = settings.value(prefix + "showpowerctc", false).toBool(); QString display = settings.value(prefix + "displayhas", "cross").toString(); display == "cross"? m_display = Cross : m_display = Contacts; + QString view_mode = settings.value(prefix + "viewmode", "index").toString(); + view_mode == "index"? m_view_mode = Index : m_view_mode = FolioLabel; QString snap = settings.value(prefix + "snapto", "label").toString(); snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label; foreach (QString key, m_prefix_keys) { @@ -73,6 +78,8 @@ void XRefProperties::toXml(QDomElement &xml_element) const { xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false"); QString display = m_display == Cross? "cross" : "contacts"; xml_element.setAttribute("displayhas", display); + QString view_mode = m_view_mode == Index? "index" : "foliolabel"; + xml_element.setAttribute("viewmode", view_mode); QString snap = m_snap_to == Bottom? "bottom" : "label"; xml_element.setAttribute("snapto", snap); foreach (QString key, m_prefix.keys()) { @@ -89,6 +96,8 @@ void XRefProperties::fromXml(const QDomElement &xml_element) { m_show_power_ctc = xml_element.attribute("showpowerctc") == "true"; QString display = xml_element.attribute("displayhas", "cross"); display == "cross"? m_display = Cross : m_display = Contacts; + QString view_mode = xml_element.attribute("viewmode", "index"); + view_mode == "index"? m_view_mode = Index : m_view_mode = FolioLabel; QString snap = xml_element.attribute("snapto", "label"); snap == "bottom"? m_snap_to = Bottom : m_snap_to = Label; foreach (QString key, m_prefix_keys) { @@ -125,6 +134,7 @@ QHash XRefProperties::defaultProperties() bool XRefProperties::operator ==(const XRefProperties &xrp) const{ return (m_show_power_ctc == xrp.m_show_power_ctc && m_display == xrp.m_display && + m_view_mode == xrp.m_view_mode && m_snap_to == xrp.m_snap_to && m_prefix == xrp.m_prefix); } diff --git a/sources/properties/xrefproperties.h b/sources/properties/xrefproperties.h index 2ea0ae982..51a3b7e05 100644 --- a/sources/properties/xrefproperties.h +++ b/sources/properties/xrefproperties.h @@ -35,6 +35,11 @@ class XRefProperties : public PropertiesInterface Contacts }; + enum ViewMode { + Index, + FolioLabel + }; + enum SnapTo { Bottom, Label @@ -56,6 +61,9 @@ class XRefProperties : public PropertiesInterface void setDisplayHas (const DisplayHas dh) {m_display = dh;} DisplayHas displayHas () const {return m_display;} + void setViewMode (const ViewMode vm) {m_view_mode = vm;} + ViewMode viewMode () const {return m_view_mode;} + void setSnapTo (const SnapTo st) {m_snap_to = st;} SnapTo snapTo () const {return m_snap_to;} @@ -65,6 +73,7 @@ class XRefProperties : public PropertiesInterface private: bool m_show_power_ctc; DisplayHas m_display; + ViewMode m_view_mode; SnapTo m_snap_to; QHash m_prefix; QStringList m_prefix_keys; diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index e5dae493a..204ceaa21 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -89,8 +89,16 @@ QPainterPath CrossRefItem::shape() const{ * if @add_prefix is true, prefix (for power and delay contact) is added to the poistion text. */ QString CrossRefItem::elementPositionText(const Element *elmt, const bool &add_prefix) const{ + QString txt; - txt += QString::number(elmt->diagram()->folioIndex() + 1); + XRefProperties::ViewMode vw = m_properties.viewMode(); + if (vw == XRefProperties::Index) + { + txt += QString::number(elmt->diagram()->folioIndex() + 1); + } + else if (vw == XRefProperties::FolioLabel){ + txt += elmt->diagram()->border_and_titleblock.folio(); + } txt += "-"; txt += elmt->diagram()->convertPosition(elmt -> scenePos()).toString(); if (add_prefix) { diff --git a/sources/ui/titleblockpropertieswidget.ui b/sources/ui/titleblockpropertieswidget.ui index 2a3f53d0b..f0016aaac 100644 --- a/sources/ui/titleblockpropertieswidget.ui +++ b/sources/ui/titleblockpropertieswidget.ui @@ -289,7 +289,7 @@ - + 0 0 @@ -299,7 +299,7 @@ - + 0 0 @@ -323,6 +323,12 @@ + + + 0 + 0 + + Page Num: @@ -344,23 +350,23 @@ Vous pouvez définir ici vos propres associations noms/valeurs pour que le cartouche en tienne compte. Exemple : associer le nom "volta" et la valeur "1745" remplacera %{volta} par 1745 dans le cartouche. - - - true - - - - + + + true + + + + + + + + - - - - - - - + + + diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index f3b6f0d87..45a655366 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -110,6 +110,8 @@ void XRefPropertiesWidget::saveProperties(int index) { if (ui->m_display_has_cross_rb->isChecked()) xrp.setDisplayHas(XRefProperties::Cross); else if (ui->m_display_has_contacts_rb->isChecked()) xrp.setDisplayHas(XRefProperties::Contacts); + if (ui->m_display_folio_index_rb->isChecked()) xrp.setViewMode (XRefProperties::Index); + else if (ui->m_display_folio_label_rb->isChecked()) xrp.setViewMode (XRefProperties::FolioLabel); if (ui->m_snap_to_cb->itemData(ui->m_snap_to_cb->currentIndex()).toString() == "bottom") xrp.setSnapTo(XRefProperties::Bottom); else xrp.setSnapTo(XRefProperties::Label); @@ -137,6 +139,14 @@ void XRefPropertiesWidget::updateDisplay() { ui->m_display_has_contacts_rb->setChecked(true); } + XRefProperties::ViewMode vw = xrp.viewMode(); + if (vw == XRefProperties::Index) { + ui->m_display_folio_index_rb->setChecked(true); + } + else if (vw == XRefProperties::FolioLabel) { + ui->m_display_folio_label_rb->setChecked(true); + } + if (xrp.snapTo() == XRefProperties::Bottom) ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("bottom")); else ui->m_snap_to_cb->setCurrentIndex(ui->m_snap_to_cb->findData("label")); diff --git a/sources/ui/xrefpropertieswidget.ui b/sources/ui/xrefpropertieswidget.ui index 08bb4c8b1..b44b756e8 100644 --- a/sources/ui/xrefpropertieswidget.ui +++ b/sources/ui/xrefpropertieswidget.ui @@ -49,19 +49,56 @@ - + - - - Afficher en croix - - + + + + + Afficher en contacts + + + + + + + Afficher en croix + + + + + + + + - - - Afficher en contacts + + + View Mode + + + + + View Folio Label + + + true + + + + + + + View Folio Index + + + true + + + +