From 68b4a9baaf6ffa0f6cd2d40aac3ca01df25b313a Mon Sep 17 00:00:00 2001 From: XXX Date: Sat, 15 May 2021 18:56:22 -0600 Subject: [PATCH 01/22] Ctrl+Shift+S maps to Save As for all platforms, fixes #315 --- src/openstudio_lib/MainMenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openstudio_lib/MainMenu.cpp b/src/openstudio_lib/MainMenu.cpp index a0312f3ac..bcd3ddde5 100644 --- a/src/openstudio_lib/MainMenu.cpp +++ b/src/openstudio_lib/MainMenu.cpp @@ -77,7 +77,7 @@ MainMenu::MainMenu(bool isIP, bool isPlugin, QWidget* parent) : QMenuBar(parent) connect(action, &QAction::triggered, this, &MainMenu::saveFileClicked); action = new QAction(tr("Save &As"), this); - action->setShortcut(QKeySequence(QKeySequence::SaveAs)); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S)); m_fileMenu->addAction(action); connect(action, &QAction::triggered, this, &MainMenu::saveAsFileClicked); From 66e986c181781898c80e9a0e9d43b08ec07b1b9c Mon Sep 17 00:00:00 2001 From: XXX Date: Sun, 16 May 2021 00:49:18 -0600 Subject: [PATCH 02/22] Allow editing Schedule Day Name, fixes #286 --- src/openstudio_lib/ScheduleDayView.cpp | 28 ++--- src/openstudio_lib/SchedulesView.cpp | 17 +-- src/openstudio_lib/SchedulesView.hpp | 16 +-- src/shared_gui_components/OSCheckBox.cpp | 126 +++++++++++------------ src/shared_gui_components/OSCheckBox.hpp | 34 +++--- 5 files changed, 115 insertions(+), 106 deletions(-) diff --git a/src/openstudio_lib/ScheduleDayView.cpp b/src/openstudio_lib/ScheduleDayView.cpp index 29eb9f108..81c74836c 100644 --- a/src/openstudio_lib/ScheduleDayView.cpp +++ b/src/openstudio_lib/ScheduleDayView.cpp @@ -128,22 +128,26 @@ ScheduleDayView::ScheduleDayView(bool isIP, const model::ScheduleDay& scheduleDa setLayout(mainVLayout); - // Name + // Schedule Day Name - //label = new QLabel("Name:"); - //label->setObjectName("H2"); - //mainVLayout->addWidget(label); + auto hLayout = new QHBoxLayout(); + hLayout->setContentsMargins(MARGINLEFT, 0, 0, 0); + hLayout->setSpacing(10); - //QString name; - //boost::optional optionalString = scheduleDay.name(); - //if(optionalString){ - // name = optionalString->c_str(); - //} - //QLineEdit * lineEdit = new QLineEdit(name); - //lineEdit->setReadOnly(true); + auto label = new QLabel("Schedule Day Name:"); + hLayout->addWidget(label); - //mainVLayout->addWidget(lineEdit); + auto lineEdit = new OSLineEdit2(); + lineEdit->bind(m_scheduleDay, OptionalStringGetter(std::bind(&model::ScheduleDay::name, &m_scheduleDay, true)), + boost::optional(std::bind(&model::ScheduleDay::setName, &m_scheduleDay, std::placeholders::_1))); + lineEdit->setFixedWidth(200); + hLayout->addWidget(lineEdit); + + hLayout->addStretch(); + + mainVLayout->addLayout(hLayout); + // Schedule Limits View m_scheduleLimitsView = new ScheduleLimitsView(isIP, currentScheduleTypeLimits, this); diff --git a/src/openstudio_lib/SchedulesView.cpp b/src/openstudio_lib/SchedulesView.cpp index 2be2390f1..d179764dd 100644 --- a/src/openstudio_lib/SchedulesView.cpp +++ b/src/openstudio_lib/SchedulesView.cpp @@ -1587,6 +1587,9 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul nameHLayout->addSpacing(10); + auto label = new QLabel("Schedule Rule Name:"); + nameHLayout->addWidget(label); + m_nameEditField = new OSLineEdit2(); m_nameEditField->bind( @@ -1622,7 +1625,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addStretch(); - m_sundayButton = new OSCheckBox2(); + m_sundayButton = new OSGreyCheckBox2(); m_sundayButton->setText("S"); m_sundayButton->bind(m_scheduleRule, std::bind(&model::ScheduleRule::applySunday, &m_scheduleRule), boost::optional(std::bind(&model::ScheduleRule::setApplySundayNoFail, &m_scheduleRule, std::placeholders::_1))); @@ -1630,7 +1633,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_mondayButton = new OSCheckBox2(); + m_mondayButton = new OSGreyCheckBox2(); m_mondayButton->setText("M"); m_mondayButton->bind(m_scheduleRule, std::bind(&model::ScheduleRule::applyMonday, &m_scheduleRule), boost::optional(std::bind(&model::ScheduleRule::setApplyMondayNoFail, &m_scheduleRule, std::placeholders::_1))); @@ -1638,7 +1641,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_tuesdayButton = new OSCheckBox2(); + m_tuesdayButton = new OSGreyCheckBox2(); m_tuesdayButton->setText("T"); m_tuesdayButton->bind(m_scheduleRule, std::bind(&model::ScheduleRule::applyTuesday, &m_scheduleRule), boost::optional(std::bind(&model::ScheduleRule::setApplyTuesdayNoFail, &m_scheduleRule, std::placeholders::_1))); @@ -1646,7 +1649,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_wednesdayButton = new OSCheckBox2(); + m_wednesdayButton = new OSGreyCheckBox2(); m_wednesdayButton->setText("W"); m_wednesdayButton->bind( m_scheduleRule, std::bind(&model::ScheduleRule::applyWednesday, &m_scheduleRule), @@ -1655,7 +1658,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_thursdayButton = new OSCheckBox2(); + m_thursdayButton = new OSGreyCheckBox2(); m_thursdayButton->setText("T"); m_thursdayButton->bind( m_scheduleRule, std::bind(&model::ScheduleRule::applyThursday, &m_scheduleRule), @@ -1664,7 +1667,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_fridayButton = new OSCheckBox2(); + m_fridayButton = new OSGreyCheckBox2(); m_fridayButton->setText("F"); m_fridayButton->bind(m_scheduleRule, std::bind(&model::ScheduleRule::applyFriday, &m_scheduleRule), boost::optional(std::bind(&model::ScheduleRule::setApplyFridayNoFail, &m_scheduleRule, std::placeholders::_1))); @@ -1672,7 +1675,7 @@ ScheduleRuleView::ScheduleRuleView(bool isIP, const model::ScheduleRule& schedul weekHLayout->addSpacing(10); - m_saturdayButton = new OSCheckBox2(); + m_saturdayButton = new OSGreyCheckBox2(); m_saturdayButton->setText("S"); m_saturdayButton->bind( m_scheduleRule, std::bind(&model::ScheduleRule::applySaturday, &m_scheduleRule), diff --git a/src/openstudio_lib/SchedulesView.hpp b/src/openstudio_lib/SchedulesView.hpp index c459b1c9d..188f78bd9 100644 --- a/src/openstudio_lib/SchedulesView.hpp +++ b/src/openstudio_lib/SchedulesView.hpp @@ -110,6 +110,8 @@ class OSCheckBox; class OSCheckBox2; +class OSGreyCheckBox2; + class OSLineEdit2; class ScheduleDayView; @@ -650,19 +652,19 @@ class ScheduleRuleView : public QWidget, public Nano::Observer boost::optional m_yearDescription; - OSCheckBox2* m_sundayButton; + OSGreyCheckBox2* m_sundayButton; - OSCheckBox2* m_mondayButton; + OSGreyCheckBox2* m_mondayButton; - OSCheckBox2* m_tuesdayButton; + OSGreyCheckBox2* m_tuesdayButton; - OSCheckBox2* m_wednesdayButton; + OSGreyCheckBox2* m_wednesdayButton; - OSCheckBox2* m_thursdayButton; + OSGreyCheckBox2* m_thursdayButton; - OSCheckBox2* m_fridayButton; + OSGreyCheckBox2* m_fridayButton; - OSCheckBox2* m_saturdayButton; + OSGreyCheckBox2* m_saturdayButton; OSLineEdit2* m_nameEditField; diff --git a/src/shared_gui_components/OSCheckBox.cpp b/src/shared_gui_components/OSCheckBox.cpp index 18ded5557..7bee2dc99 100644 --- a/src/shared_gui_components/OSCheckBox.cpp +++ b/src/shared_gui_components/OSCheckBox.cpp @@ -378,68 +378,68 @@ void OSCheckBox2::updateStyle() { } } -// OSCheckBox::OSCheckBox( QWidget * parent ) -// : QPushButton(parent) -// { -// setObjectName("StandardGrayButton"); -// this->setAcceptDrops(false); - -// this->setCheckable(true); - -// setEnabled(false); -// } - -// void OSCheckBox::bind(model::ModelObject & modelObject, const char * property) -// { -// m_modelObject = modelObject; - -// m_property = property; - -// setEnabled(true); - -// m_modelObject->getImpl().get()->openstudio::model::detail::ModelObject_Impl::onChange.connect(this); - -// m_modelObject->getImpl().get()->openstudio::model::detail::ModelObject_Impl::onRemoveFromWorkspace.connect(this); - -// connect(this, &OSCheckBox::toggled, this, &OSCheckBox::onToggled); -// bool checked = m_modelObject->getImpl()->property(m_property.c_str()).toBool(); - -// this->setChecked(checked); -// } - -// void OSCheckBox::unbind() -// { -// if (m_modelObject){ -// this->disconnect(m_modelObject->getImpl().get()); -// m_modelObject.reset(); -// m_property = ""; -// setEnabled(false); -// } -// } - -// void OSCheckBox::onToggled(bool checked) -// { -// if( m_modelObject ) -// { -// m_modelObject->getImpl()->setProperty(m_property.c_str(),checked); -// } -// } - -// void OSCheckBox::onModelObjectChange() -// { -// if( m_modelObject ) -// { -// bool checked = m_modelObject->getImpl()->property(m_property.c_str()).toBool(); - -// this->setChecked(checked); -// } -// } - -// void OSCheckBox::onModelObjectRemove(const Handle& handle) -// { -// m_modelObject.reset(); -// m_property = ""; -// setEnabled(false); -// } +OSGreyCheckBox2::OSGreyCheckBox2(QWidget* parent) : QPushButton(parent) { + setObjectName("StandardGrayButton"); + this->setAcceptDrops(false); + this->setCheckable(true); + setEnabled(false); +} + +void OSGreyCheckBox2::bind(const model::ModelObject& modelObject, BoolGetter get, boost::optional set) { + m_modelObject = modelObject; + m_get = get; + m_set = set; + + setEnabled(true); + + m_modelObject->getImpl() + .get() + ->onChange.connect( + this); + + m_modelObject->getImpl() + .get() + ->onRemoveFromWorkspace.connect(this); + + connect(this, &OSGreyCheckBox2::toggled, this, &OSGreyCheckBox2::onToggled); + bool checked = (*m_get)(); + + this->setChecked(checked); +} + +void OSGreyCheckBox2::unbind() +{ + if (m_modelObject) { + m_modelObject->getImpl() + .get() + ->onChange.disconnect( + this); + m_modelObject->getImpl() + .get() + ->onRemoveFromWorkspace.disconnect(this); + + m_get.reset(); + m_set.reset(); + setEnabled(false); + } +} + +void OSGreyCheckBox2::onToggled(bool checked) { + if (m_modelObject && m_set) { + if ((*m_get)() != checked) { + (*m_set)(checked); + } + } +} + +void OSGreyCheckBox2::onModelObjectChange() { + if (m_modelObject) { + this->setChecked((*m_get)()); + } +} + +void OSGreyCheckBox2::onModelObjectRemove(const Handle& handle) { + unbind(); +} } // namespace openstudio diff --git a/src/shared_gui_components/OSCheckBox.hpp b/src/shared_gui_components/OSCheckBox.hpp index ad94e98cc..bf98ad8e5 100644 --- a/src/shared_gui_components/OSCheckBox.hpp +++ b/src/shared_gui_components/OSCheckBox.hpp @@ -163,33 +163,33 @@ class OSCheckBox2 : public QPushButton, public Nano::Observer bool m_locked = false; }; -// class OSCheckBox : public QPushButton, public Nano::Observer { -// Q_OBJECT - -// public: - -// OSCheckBox(QWidget * parent = nullptr); +class OSGreyCheckBox2 : public QPushButton, public Nano::Observer +{ + Q_OBJECT -// virtual ~OSCheckBox() {} + public: + OSGreyCheckBox2(QWidget* parent = nullptr); -// void bind(model::ModelObject & modelObject, const char * property); + virtual ~OSGreyCheckBox2() {} -// void unbind(); + void bind(const model::ModelObject& modelObject, BoolGetter get, boost::optional set = boost::none); -// private slots: + void unbind(); -// void onToggled(bool checked); + private slots: -// void onModelObjectChange(); + void onToggled(bool checked); -// void onModelObjectRemove(const Handle& handle); + void onModelObjectChange(); -// private: + void onModelObjectRemove(const Handle& handle); -// boost::optional m_modelObject; + private: -// std::string m_property; -// }; + boost::optional m_modelObject; + boost::optional m_get; + boost::optional m_set; +}; } // namespace openstudio From 596cc09f1e45beeebd579289f56953df4c78adb4 Mon Sep 17 00:00:00 2001 From: XXX Date: Sun, 16 May 2021 00:50:15 -0600 Subject: [PATCH 03/22] Clang format --- src/openstudio_lib/ScheduleDayView.cpp | 4 ++-- src/shared_gui_components/OSCheckBox.cpp | 9 +++------ src/shared_gui_components/OSCheckBox.hpp | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/openstudio_lib/ScheduleDayView.cpp b/src/openstudio_lib/ScheduleDayView.cpp index 81c74836c..2ed357d19 100644 --- a/src/openstudio_lib/ScheduleDayView.cpp +++ b/src/openstudio_lib/ScheduleDayView.cpp @@ -139,7 +139,7 @@ ScheduleDayView::ScheduleDayView(bool isIP, const model::ScheduleDay& scheduleDa auto lineEdit = new OSLineEdit2(); lineEdit->bind(m_scheduleDay, OptionalStringGetter(std::bind(&model::ScheduleDay::name, &m_scheduleDay, true)), - boost::optional(std::bind(&model::ScheduleDay::setName, &m_scheduleDay, std::placeholders::_1))); + boost::optional(std::bind(&model::ScheduleDay::setName, &m_scheduleDay, std::placeholders::_1))); lineEdit->setFixedWidth(200); hLayout->addWidget(lineEdit); @@ -147,7 +147,7 @@ ScheduleDayView::ScheduleDayView(bool isIP, const model::ScheduleDay& scheduleDa hLayout->addStretch(); mainVLayout->addLayout(hLayout); - + // Schedule Limits View m_scheduleLimitsView = new ScheduleLimitsView(isIP, currentScheduleTypeLimits, this); diff --git a/src/shared_gui_components/OSCheckBox.cpp b/src/shared_gui_components/OSCheckBox.cpp index 7bee2dc99..1d88c5d2f 100644 --- a/src/shared_gui_components/OSCheckBox.cpp +++ b/src/shared_gui_components/OSCheckBox.cpp @@ -394,8 +394,7 @@ void OSGreyCheckBox2::bind(const model::ModelObject& modelObject, BoolGetter get m_modelObject->getImpl() .get() - ->onChange.connect( - this); + ->onChange.connect(this); m_modelObject->getImpl() .get() @@ -407,13 +406,11 @@ void OSGreyCheckBox2::bind(const model::ModelObject& modelObject, BoolGetter get this->setChecked(checked); } -void OSGreyCheckBox2::unbind() -{ +void OSGreyCheckBox2::unbind() { if (m_modelObject) { m_modelObject->getImpl() .get() - ->onChange.disconnect( - this); + ->onChange.disconnect(this); m_modelObject->getImpl() .get() ->onRemoveFromWorkspace.disconnect(this); diff --git a/src/shared_gui_components/OSCheckBox.hpp b/src/shared_gui_components/OSCheckBox.hpp index bf98ad8e5..3d5b3531c 100644 --- a/src/shared_gui_components/OSCheckBox.hpp +++ b/src/shared_gui_components/OSCheckBox.hpp @@ -185,7 +185,6 @@ class OSGreyCheckBox2 : public QPushButton, public Nano::Observer void onModelObjectRemove(const Handle& handle); private: - boost::optional m_modelObject; boost::optional m_get; boost::optional m_set; From aa845ed7ebb43ecc5046a8440584e5e3e9fd8456 Mon Sep 17 00:00:00 2001 From: XXX Date: Sun, 16 May 2021 17:03:15 -0600 Subject: [PATCH 04/22] Add tooltips to OSComboBox2, fix bug hiding some ScheduleTypeLimits, show non-strict matches for ZoneAirContaminantBalance Outdoor Carbon Dioxide schedule Fixes #268 --- src/openstudio_lib/ScheduleDialog.cpp | 8 ++++-- src/openstudio_lib/SimSettingsView.cpp | 31 ++++++++++++++++++++++-- src/shared_gui_components/OSComboBox.cpp | 12 ++++++--- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/openstudio_lib/ScheduleDialog.cpp b/src/openstudio_lib/ScheduleDialog.cpp index 2e08415ed..2ac55a5f7 100644 --- a/src/openstudio_lib/ScheduleDialog.cpp +++ b/src/openstudio_lib/ScheduleDialog.cpp @@ -61,7 +61,9 @@ struct ScheduleTypeCompare } if (lhs.lowerLimitValue && rhs.lowerLimitValue) { - return lhs.lowerLimitValue.get() < rhs.lowerLimitValue.get(); + if (lhs.lowerLimitValue.get() != rhs.lowerLimitValue.get()) { + return lhs.lowerLimitValue.get() < rhs.lowerLimitValue.get(); + } } else if (lhs.lowerLimitValue) { return false; } else if (rhs.lowerLimitValue) { @@ -69,7 +71,9 @@ struct ScheduleTypeCompare } if (lhs.upperLimitValue && rhs.upperLimitValue) { - return lhs.upperLimitValue.get() < rhs.upperLimitValue.get(); + if (lhs.upperLimitValue.get() != rhs.upperLimitValue.get()) { + return lhs.upperLimitValue.get() < rhs.upperLimitValue.get(); + } } else if (lhs.upperLimitValue) { return false; } else if (rhs.upperLimitValue) { diff --git a/src/openstudio_lib/SimSettingsView.cpp b/src/openstudio_lib/SimSettingsView.cpp index 587196749..f2615bc0e 100644 --- a/src/openstudio_lib/SimSettingsView.cpp +++ b/src/openstudio_lib/SimSettingsView.cpp @@ -84,6 +84,8 @@ #include #include #include +#include +#include #include #include @@ -1660,8 +1662,33 @@ void SimSettingsView::attachZoneAirContaminantBalance() { */ std::function(model::ZoneAirContaminantBalance*)> choices_lambda = [](model::ZoneAirContaminantBalance* t_z) { - std::vector results = - openstudio::model::getCompatibleSchedules(t_z->model(), "ZoneAirContaminantBalance", "Outdoor Carbon Dioxide"); + // openstudio::model::getCompatibleSchedules uses stringent checking, allow non-stringent checking here + //std::vector results = + // openstudio::model::getCompatibleSchedules(t_z->model(), "ZoneAirContaminantBalance", "Outdoor Carbon Dioxide"); + + model::Model model = t_z->model(); + model::ScheduleType scheduleType = model::ScheduleTypeRegistry::instance().getScheduleType("ZoneAirContaminantBalance", "Outdoor Carbon Dioxide"); + + bool isStringent = false; + model::ScheduleTypeLimitsVector okTypes; + for (const model::ScheduleTypeLimits& candidate : model.getConcreteModelObjects()) { + if (isCompatible(scheduleType, candidate, isStringent)) { + okTypes.push_back(candidate); + } + } + + model::ScheduleVector results; + for (const model::Schedule& candidate : model.getModelObjects()) { + if (model::OptionalScheduleTypeLimits candidateType = candidate.scheduleTypeLimits()) { + if (std::find(okTypes.begin(), okTypes.end(), *candidateType) != okTypes.end()) { + results.push_back(candidate); + } + } else { + // by default, keep all non-typed schedules + results.push_back(candidate); + } + } + return openstudio::sortByObjectName(results); }; diff --git a/src/shared_gui_components/OSComboBox.cpp b/src/shared_gui_components/OSComboBox.cpp index bfd5062f0..3046b5bb8 100644 --- a/src/shared_gui_components/OSComboBox.cpp +++ b/src/shared_gui_components/OSComboBox.cpp @@ -306,7 +306,9 @@ void OSComboBox2::onChoicesRefreshTrigger() { clear(); for (const auto& value : m_values) { - addItem(QString::fromStdString(value)); + QString qvalue = QString::fromStdString(value); + addItem(qvalue); + setItemData(count() - 1, qvalue, Qt::ToolTipRole); } // re-initialize @@ -394,7 +396,9 @@ void OSComboBox2::completeBind() { this->blockSignals(true); for (const auto& value : m_values) { - addItem(QString::fromStdString(value)); + QString qvalue = QString::fromStdString(value); + addItem(qvalue); + setItemData(count() - 1, qvalue, Qt::ToolTipRole); } // initialize @@ -410,7 +414,9 @@ void OSComboBox2::completeBind() { // populate choices for (int i = 0; i < m_dataSource->numberOfItems(); i++) { - this->addItem(m_dataSource->valueAt(i)); + QString qvalue = m_dataSource->valueAt(i); + addItem(qvalue); + setItemData(count() - 1, qvalue, Qt::ToolTipRole); } // initialize From 8828029d38b6c3afc151db10f0c676d1081816d0 Mon Sep 17 00:00:00 2001 From: XXX Date: Sun, 16 May 2021 17:03:51 -0600 Subject: [PATCH 05/22] Clang format --- src/openstudio_lib/SimSettingsView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openstudio_lib/SimSettingsView.cpp b/src/openstudio_lib/SimSettingsView.cpp index f2615bc0e..674e4112d 100644 --- a/src/openstudio_lib/SimSettingsView.cpp +++ b/src/openstudio_lib/SimSettingsView.cpp @@ -1668,7 +1668,7 @@ void SimSettingsView::attachZoneAirContaminantBalance() { model::Model model = t_z->model(); model::ScheduleType scheduleType = model::ScheduleTypeRegistry::instance().getScheduleType("ZoneAirContaminantBalance", "Outdoor Carbon Dioxide"); - + bool isStringent = false; model::ScheduleTypeLimitsVector okTypes; for (const model::ScheduleTypeLimits& candidate : model.getConcreteModelObjects()) { From c0bbe5511a448897b030a641a6d64987cb3f610a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 25 May 2021 17:26:22 +0200 Subject: [PATCH 06/22] This overrides the member variable, it has nothing to do here --- src/openstudio_lib/GeometryPreviewView.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/openstudio_lib/GeometryPreviewView.cpp b/src/openstudio_lib/GeometryPreviewView.cpp index cc47b1d5e..2ed1db335 100644 --- a/src/openstudio_lib/GeometryPreviewView.cpp +++ b/src/openstudio_lib/GeometryPreviewView.cpp @@ -74,8 +74,6 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ m_document = app->currentDocument(); OS_ASSERT(m_document); - std::shared_ptr m_document; - auto mainLayout = new QVBoxLayout; setLayout(mainLayout); From fb2630c194aa84ab3b5500fca427c5fb78d4f30a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 25 May 2021 17:26:37 +0200 Subject: [PATCH 07/22] Add debug messages to the console --- src/openstudio_lib/GeometryPreviewView.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/openstudio_lib/GeometryPreviewView.cpp b/src/openstudio_lib/GeometryPreviewView.cpp index 2ed1db335..cb24444e9 100644 --- a/src/openstudio_lib/GeometryPreviewView.cpp +++ b/src/openstudio_lib/GeometryPreviewView.cpp @@ -100,19 +100,29 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ m_refreshBtn->setVisible(true); m_view = new QWebEngineView(this); - m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true); - m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::SpatialNavigationEnabled, true); - m_page = new OSWebEnginePage(this); m_view->setPage(m_page); // note, view does not take ownership of page + connect(m_view, &QWebEngineView::loadFinished, this, &PreviewWebView::onLoadFinished); - //connect(m_view, &QWebEngineView::loadProgress, this, &PreviewWebView::onLoadProgress); - //connect(m_view, &QWebEngineView::loadStarted, this, &PreviewWebView::onLoadStarted); connect(m_view, &QWebEngineView::renderProcessTerminated, this, &PreviewWebView::onRenderProcessTerminated); + constexpr bool isDebug_= true; + if (isDebug_) { + connect(m_view, &QWebEngineView::loadStarted, this, [](){ qDebug() << "Loading started"; }); + connect(m_view, &QWebEngineView::loadProgress, this, [](int progress) { qDebug() << "PreviewWebView::onLoadProgress: " << progress; }); // &PreviewWebView::onLoadProgress); + connect(m_page, &QWebEnginePage::loadStarted, this, []() { qDebug() << "Page Loading Started"; }); + connect(m_page, &QWebEnginePage::loadProgress, this, [](int progress) { qDebug() << "Page Loading Progress: " << progress; }); + connect(m_page, &QWebEnginePage::loadFinished, this, [](bool ok) { qDebug() << "Page Loading Finished: " << ok; }); + } + + // Qt 5.8 and higher m_view->settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, true); + + m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true); + m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::SpatialNavigationEnabled, true); + // Force QWebEngineView to fill the rest of the space m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_view->setContextMenuPolicy(Qt::NoContextMenu); @@ -147,6 +157,7 @@ void PreviewWebView::onUnitSystemChange(bool t_isIP) { void PreviewWebView::onLoadFinished(bool ok) { QString title = m_view->title(); + qDebug() << "onLoadFinished, ok=" << ok << ", title=" << title; if (ok) { m_progressBar->setValue(10); } else { @@ -200,6 +211,7 @@ void PreviewWebView::onJavaScriptFinished(const QVariant& v) { } void PreviewWebView::onRenderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode) { + qDebug() << "RenderProcessTerminationStatus: terminationStatus= " << terminationStatus << "exitCode=" << exitCode; m_progressBar->setValue(100); m_progressBar->setStyleSheet("QProgressBar::chunk {background-color: #FF0000;}"); m_progressBar->setFormat("Error"); From e6a6cce2b4b7b2726f4fd15ca6ca3c5b7e883cae Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 25 May 2021 19:05:50 +0200 Subject: [PATCH 08/22] Fix #95 - Workaround: read the content of the HTML file and call QWebEngineView::setHtml... --- src/openstudio_lib/GeometryPreviewView.cpp | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/openstudio_lib/GeometryPreviewView.cpp b/src/openstudio_lib/GeometryPreviewView.cpp index cb24444e9..27767c3a0 100644 --- a/src/openstudio_lib/GeometryPreviewView.cpp +++ b/src/openstudio_lib/GeometryPreviewView.cpp @@ -123,6 +123,14 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true); m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::SpatialNavigationEnabled, true); + /* + m_view->settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, true); + m_view->settings()->setAttribute(QWebEngineSettings::AllowGeolocationOnInsecureOrigins, true); + m_view->settings()->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, true); + + m_view->settings()->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes); + */ + // Force QWebEngineView to fill the rest of the space m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_view->setContextMenuPolicy(Qt::NoContextMenu); @@ -130,7 +138,36 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ //mainLayout->addWidget(m_view, 10, Qt::AlignTop); mainLayout->addWidget(m_view); - m_view->load(QUrl("qrc:///library/geometry_preview.html")); + if (isDebug_) { + QDir root_embedded(":/library"); + for (const auto l: root_embedded.entryList()) { + // Debug: "geometry_preview.html" ((null):0, (null)) + qDebug() << l; + } + } + + /* + // This works on Windows, macOS, Ubuntu1804, fails on Ubuntu 20.04 + QUrl previewURL("qrc:/library/geometry_preview.html"); + // QUrl previewURL("qrc://library/geometry_preview.html"); // => Warning: QResource '/geometry_preview.html' not found or is empty ((null):0, (null)) + // QUrl previewURL("qrc:///library/geometry_preview.html"); + m_view->load(previewURL); + + // Local FileSystem: This works on Ubuntu 20.04 as well.... + QUrl previewURL("file:///home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/library/geometry_preview.html"); + m_view->load(previewURL); + qDebug() << "Loading previewURL=" << previewURL; + */ + + QFile htmlFile(":/library/geometry_preview.html"); + if (htmlFile.open(QFile::ReadOnly | QFile::Text)) { + QTextStream in(&htmlFile); + QString htmlContent = in.readAll(); + m_view->setHtml(htmlContent); + } else { + qDebug() << "Error opening htmlFile=" << htmlFile; + } + } PreviewWebView::~PreviewWebView() { From be8c955ac0165a9462e5abd940f34ab301aa4925 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 26 May 2021 13:10:47 +0200 Subject: [PATCH 09/22] Bump threeJS to r98. https://raw.githubusercontent.com/mrdoob/three.js/r98/build/three.min.js geez... sooooo, I realized that loading the r71 from a CDN worked... Then I tried to upgrade threeJS from r71 (current) to r128 (latest). Can't do, too many things are gone. I managed to make r98 work... It's the last release with ObjectLoader working. see https://github.com/mrdoob/three.js/wiki/Migration-Guide#r98--r99: > JSONLoader has been removed from core. It is now located in examples/js/loaders/deprecated/LegacyJSONLoader.js. > Removed Geometry support from ObjectLoader. You have to include LegacyJSONLoader if you still want to load geometry data of type Geometry. then I manually did the equivalent of a git bisect r79 fails, r80 works diffing the three.js (not minified) is kinda pointless, nothing matches. The migration guide is empty for r77 to r80.. https://github.com/mrdoob/three.js/wiki/Migration-Guide#r76--r77 So anyways, bumping to r98 fixes the Ubuntu 20.04 problem. --- src/openstudio_lib/GeometryPreviewView.cpp | 51 +- .../library/geometry_preview.html | 1806 +++++++++-------- 2 files changed, 978 insertions(+), 879 deletions(-) diff --git a/src/openstudio_lib/GeometryPreviewView.cpp b/src/openstudio_lib/GeometryPreviewView.cpp index 27767c3a0..be8640e53 100644 --- a/src/openstudio_lib/GeometryPreviewView.cpp +++ b/src/openstudio_lib/GeometryPreviewView.cpp @@ -107,8 +107,9 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ connect(m_view, &QWebEngineView::loadFinished, this, &PreviewWebView::onLoadFinished); connect(m_view, &QWebEngineView::renderProcessTerminated, this, &PreviewWebView::onRenderProcessTerminated); - constexpr bool isDebug_= true; - if (isDebug_) { + // Debug: switch to true. if false, code isn't even compiled since if-constexpr is used + constexpr bool isDebug_= false; + if constexpr (isDebug_) { connect(m_view, &QWebEngineView::loadStarted, this, [](){ qDebug() << "Loading started"; }); connect(m_view, &QWebEngineView::loadProgress, this, [](int progress) { qDebug() << "PreviewWebView::onLoadProgress: " << progress; }); // &PreviewWebView::onLoadProgress); connect(m_page, &QWebEnginePage::loadStarted, this, []() { qDebug() << "Page Loading Started"; }); @@ -123,13 +124,11 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::LocalContentCanAccessRemoteUrls, true); m_view->settings()->setAttribute(QWebEngineSettings::WebAttribute::SpatialNavigationEnabled, true); - /* - m_view->settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, true); - m_view->settings()->setAttribute(QWebEngineSettings::AllowGeolocationOnInsecureOrigins, true); - m_view->settings()->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, true); - - m_view->settings()->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes); - */ + // These aren't needed + //m_view->settings()->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard, true); + //m_view->settings()->setAttribute(QWebEngineSettings::AllowGeolocationOnInsecureOrigins, true); + //m_view->settings()->setAttribute(QWebEngineSettings::AllowWindowActivationFromJavaScript, true); + //m_view->settings()->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes); // Force QWebEngineView to fill the rest of the space m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -138,36 +137,8 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ //mainLayout->addWidget(m_view, 10, Qt::AlignTop); mainLayout->addWidget(m_view); - if (isDebug_) { - QDir root_embedded(":/library"); - for (const auto l: root_embedded.entryList()) { - // Debug: "geometry_preview.html" ((null):0, (null)) - qDebug() << l; - } - } - - /* - // This works on Windows, macOS, Ubuntu1804, fails on Ubuntu 20.04 - QUrl previewURL("qrc:/library/geometry_preview.html"); - // QUrl previewURL("qrc://library/geometry_preview.html"); // => Warning: QResource '/geometry_preview.html' not found or is empty ((null):0, (null)) - // QUrl previewURL("qrc:///library/geometry_preview.html"); - m_view->load(previewURL); - - // Local FileSystem: This works on Ubuntu 20.04 as well.... - QUrl previewURL("file:///home/julien/Software/Others/OpenStudioApplication/src/openstudio_lib/library/geometry_preview.html"); + QUrl previewURL("qrc:///library/geometry_preview.html"); m_view->load(previewURL); - qDebug() << "Loading previewURL=" << previewURL; - */ - - QFile htmlFile(":/library/geometry_preview.html"); - if (htmlFile.open(QFile::ReadOnly | QFile::Text)) { - QTextStream in(&htmlFile); - QString htmlContent = in.readAll(); - m_view->setHtml(htmlContent); - } else { - qDebug() << "Error opening htmlFile=" << htmlFile; - } - } PreviewWebView::~PreviewWebView() { @@ -194,7 +165,7 @@ void PreviewWebView::onUnitSystemChange(bool t_isIP) { void PreviewWebView::onLoadFinished(bool ok) { QString title = m_view->title(); - qDebug() << "onLoadFinished, ok=" << ok << ", title=" << title; + // qDebug() << "onLoadFinished, ok=" << ok << ", title=" << title; if (ok) { m_progressBar->setValue(10); } else { @@ -248,7 +219,7 @@ void PreviewWebView::onJavaScriptFinished(const QVariant& v) { } void PreviewWebView::onRenderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode) { - qDebug() << "RenderProcessTerminationStatus: terminationStatus= " << terminationStatus << "exitCode=" << exitCode; + // qDebug() << "RenderProcessTerminationStatus: terminationStatus= " << terminationStatus << "exitCode=" << exitCode; m_progressBar->setValue(100); m_progressBar->setStyleSheet("QProgressBar::chunk {background-color: #FF0000;}"); m_progressBar->setFormat("Error"); diff --git a/src/openstudio_lib/library/geometry_preview.html b/src/openstudio_lib/library/geometry_preview.html index 647c2a9c2..e05cecac9 100644 --- a/src/openstudio_lib/library/geometry_preview.html +++ b/src/openstudio_lib/library/geometry_preview.html @@ -4,841 +4,971 @@ <%=title%> - - \ No newline at end of file + From ee969925f35c31ed1a7916e49378c10ed5bf3919 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 26 May 2021 13:22:24 +0200 Subject: [PATCH 10/22] Update some deprecated/refactored THREE stuff so the console isn't getting warnings --- src/openstudio_lib/library/geometry_preview.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openstudio_lib/library/geometry_preview.html b/src/openstudio_lib/library/geometry_preview.html index e05cecac9..01ade848a 100644 --- a/src/openstudio_lib/library/geometry_preview.html +++ b/src/openstudio_lib/library/geometry_preview.html @@ -2261,8 +2261,8 @@ clearColor: 0xffffff }); renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMapEnabled = true; - renderer.shadowMapSoft = true; + renderer.shadowMap.enabled = true; + renderer.shadowMap.soft = true; document.body.appendChild(renderer.domElement); scene = new THREE.Scene(); @@ -2352,7 +2352,7 @@ back_objects = {}; object_edges = {}; scene_objects.forEach(function(object) { - edges = new THREE.EdgesHelper( object, 0x000000 ); + edges = new THREE.LineSegments( new THREE.EdgesGeometry( object.geometry ), new THREE.LineBasicMaterial( { color: 0x000000 } ) ); scene.add(edges); edge = scene.children[scene.children.length-1]; scene_edges.push(edge); From abcabd4cb0a2144b81e74212b19cc2dde1f04797 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 26 May 2021 13:22:59 +0200 Subject: [PATCH 11/22] clang format [chore] --- src/openstudio_lib/GeometryPreviewView.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/openstudio_lib/GeometryPreviewView.cpp b/src/openstudio_lib/GeometryPreviewView.cpp index be8640e53..ff44d2127 100644 --- a/src/openstudio_lib/GeometryPreviewView.cpp +++ b/src/openstudio_lib/GeometryPreviewView.cpp @@ -103,21 +103,20 @@ PreviewWebView::PreviewWebView(bool isIP, const model::Model& model, QWidget* t_ m_page = new OSWebEnginePage(this); m_view->setPage(m_page); // note, view does not take ownership of page - connect(m_view, &QWebEngineView::loadFinished, this, &PreviewWebView::onLoadFinished); connect(m_view, &QWebEngineView::renderProcessTerminated, this, &PreviewWebView::onRenderProcessTerminated); // Debug: switch to true. if false, code isn't even compiled since if-constexpr is used - constexpr bool isDebug_= false; + constexpr bool isDebug_ = false; if constexpr (isDebug_) { - connect(m_view, &QWebEngineView::loadStarted, this, [](){ qDebug() << "Loading started"; }); - connect(m_view, &QWebEngineView::loadProgress, this, [](int progress) { qDebug() << "PreviewWebView::onLoadProgress: " << progress; }); // &PreviewWebView::onLoadProgress); + connect(m_view, &QWebEngineView::loadStarted, this, []() { qDebug() << "Loading started"; }); + connect(m_view, &QWebEngineView::loadProgress, this, + [](int progress) { qDebug() << "PreviewWebView::onLoadProgress: " << progress; }); // &PreviewWebView::onLoadProgress); connect(m_page, &QWebEnginePage::loadStarted, this, []() { qDebug() << "Page Loading Started"; }); connect(m_page, &QWebEnginePage::loadProgress, this, [](int progress) { qDebug() << "Page Loading Progress: " << progress; }); connect(m_page, &QWebEnginePage::loadFinished, this, [](bool ok) { qDebug() << "Page Loading Finished: " << ok; }); } - // Qt 5.8 and higher m_view->settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, true); From cbef3ab7fed38fa01b507871e05a61feaea213c6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Wed, 26 May 2021 15:32:31 +0200 Subject: [PATCH 12/22] Need to update the workflow to match. --- .github/workflows/app_build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/app_build.yml b/.github/workflows/app_build.yml index 659322cd6..f409371cb 100644 --- a/.github/workflows/app_build.yml +++ b/.github/workflows/app_build.yml @@ -608,5 +608,6 @@ jobs: shell: bash run: | ls OpenStudioApplication-* - /bin/rm OpenStudioApplication-*${{ env.PLATFORM_NAME }}* + /bin/rm OpenStudioApplication-*${{ env.COMPRESSED_EXT }} || true + /bin/rm OpenStudioApplication-*${{ env.BINARY_EXT }} || true ls OpenStudioApplication-* || true From 7e13e75a887be3416bd16db335337ea592b7ed78 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 10:59:59 +0200 Subject: [PATCH 13/22] Minimal fix for #345 --- src/openstudio_app/CMakeLists.txt | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/openstudio_app/CMakeLists.txt b/src/openstudio_app/CMakeLists.txt index 8253fc771..e004d537c 100644 --- a/src/openstudio_app/CMakeLists.txt +++ b/src/openstudio_app/CMakeLists.txt @@ -380,18 +380,17 @@ if( APPLE ) list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/5/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess") endif() -if(WIN32 OR APPLE) - install(CODE " - # APPS might be a symbolic link which does not work with fixup_bundle - # expand APPS to a real path - get_filename_component(APPS_EXPANDED ${APPS} REALPATH) - include(BundleUtilities) - # This file defines some libs we are excluding. Some like concrt140.dll are installed already via InstallRequiredSystemLibraries - include(\"${CMAKE_SOURCE_DIR}/CMake/FixupBundleOverrides.cmake\") - fixup_bundle(\"\${APPS_EXPANDED}\" \"${QTPLUGINS}\" \"${DIRS}\") - " COMPONENT "OpenStudioApp" - ) -endif() +# This does some "magic" **including on Linux** (cf #345) (On linux it will install in ./bin/ the libopenstudio.so, and libicu* stuff) +install(CODE " + # APPS might be a symbolic link which does not work with fixup_bundle + # expand APPS to a real path + get_filename_component(APPS_EXPANDED ${APPS} REALPATH) + include(BundleUtilities) + # This file defines some libs we are excluding. Some like concrt140.dll are installed already via InstallRequiredSystemLibraries + include(\"${CMAKE_SOURCE_DIR}/CMake/FixupBundleOverrides.cmake\") + fixup_bundle(\"\${APPS_EXPANDED}\" \"${QTPLUGINS}\" \"${DIRS}\") + " COMPONENT "OpenStudioApp" +) set(${target_name}_test_src test/OpenStudioAppFixture.hpp From 720cadbdcafc918c90b2db4e61c0eee64ec91d9d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 11:22:44 +0200 Subject: [PATCH 14/22] Fix #346 - Remove ./lib folder altogether --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3663661b9..c9819c7a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,7 +256,7 @@ endif() if(UNIX AND NOT APPLE) # the RPATH to be used when installing - set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") + set(CMAKE_INSTALL_RPATH "$ORIGIN") endif() option(BUILD_PACKAGE "Build package" OFF) @@ -738,7 +738,8 @@ install(DIRECTORY "${openstudio_ROOT_DIR}/Radiance" DESTINATION "." COMPONENT "O install(DIRECTORY "${openstudio_ROOT_DIR}/Ruby" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) install(DIRECTORY "${openstudio_ROOT_DIR}/EnergyPlus" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) install(DIRECTORY "${openstudio_ROOT_DIR}/Examples" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) -install(DIRECTORY "${openstudio_ROOT_DIR}/lib" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) +# I don't see any point shipping libopenstudiolib in `lib/` when it's already installed in ./bin/ via fixup_bundle +#install(DIRECTORY "${openstudio_ROOT_DIR}/lib" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) install(PROGRAMS ${os_cli_location} DESTINATION bin COMPONENT "CLI" RENAME "${os_cli_install_name}") From a4a6be8ecd4808eb94a71cf0e1021fbf9dadae16 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 13:41:19 +0200 Subject: [PATCH 15/22] Cannot find libQt5XcbQpa https://github.com/openstudiocoalition/OpenStudioApplication/issues/95#issuecomment-849542178 reverts part of https://github.com/openstudiocoalition/OpenStudioApplication/commit/35e36e010366003ce11e7ecd30a4d13b75349bf2#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR570 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e838cee0..af194fa6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -570,7 +570,7 @@ if(NOT APPLE) list(APPEND QT_PLUGINS Qt5::QXcbIntegrationPlugin) # This one doesn't end up in bin/platforms/, but in bin/xcbglintegrations/ so do not append, will be treated separately # list(APPEND QT_PLUGINS Qt5::QXcbGlxIntegrationPlugin) - find_library(QT_QXCBQPA NAMES libQt5XcbQpa.so PATHS "${QT_INSTALL_DIR}/lib" NO_DEFAULT_PATH) + find_library(QT_QXCBQPA NAMES libQt5XcbQpa.so.${QT_VERSION} PATHS "${QT_INSTALL_DIR}/lib" NO_DEFAULT_PATH) list(APPEND QT_EXTRA_LIBS ${QT_QXCBQPA}) endif() From 40ef3cec24277ae157400f989e9518fb96a5c170 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 15:22:21 +0200 Subject: [PATCH 16/22] Stop conan UPDATE it's unecessary now and wastes time --- ConanInstall.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ConanInstall.cmake b/ConanInstall.cmake index 4d2a7010e..d80e1d9c1 100644 --- a/ConanInstall.cmake +++ b/ConanInstall.cmake @@ -98,7 +98,8 @@ if(NOT CONAN_OPENSTUDIO_ALREADY_RUN) BUILD ${CONAN_BUILD} # Passes `-u, --update` to conan install: Check updates exist from upstream remotes # That and build=outdated should ensure we track the right - UPDATE + # Now that we pin dependencies, there is no point looking upstream really, so we'll save valuable configuration time by not doing it + # UPDATE ) set(CONAN_OPENSTUDIO_ALREADY_RUN TRUE) From 56f74b9b8e276336f131449e91d59c874588522d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 15:22:36 +0200 Subject: [PATCH 17/22] Install QmlModels too --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65fc38b24..115844c58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -564,6 +564,9 @@ if(NOT APPLE) find_package(Qt5Qml ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH) list(APPEND QT_WEB_LIBS Qt5::Qml) + find_package(Qt5QmlModels ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH) + list(APPEND QT_WEB_LIBS Qt5::QmlModels) + find_package(Qt5Positioning ${QT_VERSION} REQUIRED PATHS ${QT_INSTALL_DIR} NO_DEFAULT_PATH) list(APPEND QT_WEB_LIBS Qt5::Positioning) From bce64630cd409ace96f453d3a74f4e9a8696aabb Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 27 May 2021 15:36:37 +0200 Subject: [PATCH 18/22] Protect againsts cases where we picked up a .so when we expected a .so.X.Y.Z cf a4a6be8ecd4808eb94a71cf0e1021fbf9dadae16 --- src/openstudio_app/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/openstudio_app/CMakeLists.txt b/src/openstudio_app/CMakeLists.txt index e004d537c..bdfffc1af 100644 --- a/src/openstudio_app/CMakeLists.txt +++ b/src/openstudio_app/CMakeLists.txt @@ -190,7 +190,10 @@ elseif( UNIX ) endforeach() foreach(LIB_LOCATION ${QT_LIB_LOCATIONS} ${QT_EXTRA_LIBS}) - get_filename_component(LIB_BASE_NAME ${LIB_LOCATION} NAME) + # In case we grabed "xx.so", it'll be resolved to "xx.so.X.Y.Z" as we expect + get_filename_component(LIB_LOCATION_RESOLVED "${LIB_LOCATION}" REALPATH) + + get_filename_component(LIB_BASE_NAME ${LIB_LOCATION_RESOLVED} NAME) string(REGEX REPLACE "\\.[^.]*$" "" LIB_MAJOR_MINOR_NAME ${LIB_BASE_NAME}) string(REGEX REPLACE "\\.[^.]*$" "" LIB_MAJOR_NAME ${LIB_MAJOR_MINOR_NAME}) @@ -198,7 +201,7 @@ elseif( UNIX ) add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_LOCATION} $/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_LOCATION_RESOLVED} $/ COMMAND ln -sf "${LIB_BASE_NAME}" "$/${LIB_MAJOR_MINOR_NAME}" COMMAND ln -sf "${LIB_BASE_NAME}" "$/${LIB_MAJOR_NAME}" COMMAND patchelf --set-rpath "$ORIGIN/." $/${LIB_BASE_NAME} From bd9cd2be7c401e8c290aab1a014ab650804c6f41 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Thu, 27 May 2021 22:53:39 -0600 Subject: [PATCH 19/22] Use a secret cache key, changing should invalidate cache --- .github/workflows/app_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app_build.yml b/.github/workflows/app_build.yml index 659322cd6..9ababda55 100644 --- a/.github/workflows/app_build.yml +++ b/.github/workflows/app_build.yml @@ -295,7 +295,7 @@ jobs: uses: actions/cache@v2 with: path: build/ - key: ${{ matrix.os }}-build-cache + key: ${{ matrix.os }}-build-cache-${{ secrets.CACHE_KEY }} - name: Did restoring the build-cache work? No # If the build cache wasn't found in the cache From 2305750786eb9dcbec682c8b9c5b0b05de8cd06b Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Thu, 27 May 2021 22:55:54 -0600 Subject: [PATCH 20/22] Add cache key to other caches --- .github/workflows/app_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/app_build.yml b/.github/workflows/app_build.yml index 9ababda55..51833ac9c 100644 --- a/.github/workflows/app_build.yml +++ b/.github/workflows/app_build.yml @@ -322,7 +322,7 @@ jobs: uses: actions/cache@v2 with: path: OpenStudio-${{ env.OS_SDK_VERSION }} - key: OpenStudio-SDK-${{ matrix.os }}-${{ env.OS_SDK_VERSION }} + key: OpenStudio-SDK-${{ matrix.os }}-${{ env.OS_SDK_VERSION }}-${{ secrets.CACHE_KEY }} - name: Did restoring the build-cache or OpenStudioSDK cache work? Yes # If it wasn't found in the cache @@ -384,7 +384,7 @@ jobs: # with: # path: | # ~/.conan - # key: ${{ matrix.os }}-conan-cache-${{ env.CONAN_INSTALL_MD5 }} + # key: ${{ matrix.os }}-conan-cache-${{ env.CONAN_INSTALL_MD5 }}-${{ secrets.CACHE_KEY }} - name: Did restoring the conan-cache work? No # If the SDK wasn't found in the cache From c3a787886f855f75610b0bb498e697716e2f75bf Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 28 May 2021 09:02:49 +0200 Subject: [PATCH 21/22] Empty commit From 6ae44ab5935955346ed16ee73a1c90a493af0c06 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 28 May 2021 09:04:50 +0200 Subject: [PATCH 22/22] empty commit for merged