Skip to content

Commit

Permalink
Merge pull request #352 from openstudiocoalition/v1.2.0-rc2
Browse files Browse the repository at this point in the history
V1.2.0 rc2
  • Loading branch information
jmarrec authored May 28, 2021
2 parents 8596cbd + 0db6ff5 commit f10b850
Show file tree
Hide file tree
Showing 15 changed files with 1,182 additions and 987 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/app_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand All @@ -581,7 +584,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()
Expand Down Expand Up @@ -738,7 +741,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}")

Expand Down
3 changes: 2 additions & 1 deletion ConanInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
30 changes: 16 additions & 14 deletions src/openstudio_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,18 @@ 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})

list(APPEND QT_LIB_SYMLINKS "${LIB_MAJOR_MINOR_NAME}" "${LIB_MAJOR_NAME}")

add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_LOCATION} $<TARGET_FILE_DIR:${target_name}>/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_LOCATION_RESOLVED} $<TARGET_FILE_DIR:${target_name}>/
COMMAND ln -sf "${LIB_BASE_NAME}" "$<TARGET_FILE_DIR:${target_name}>/${LIB_MAJOR_MINOR_NAME}"
COMMAND ln -sf "${LIB_BASE_NAME}" "$<TARGET_FILE_DIR:${target_name}>/${LIB_MAJOR_NAME}"
COMMAND patchelf --set-rpath "$ORIGIN/." $<TARGET_FILE_DIR:${target_name}>/${LIB_BASE_NAME}
Expand Down Expand Up @@ -380,18 +383,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
Expand Down
33 changes: 25 additions & 8 deletions src/openstudio_lib/GeometryPreviewView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<OSDocument> m_document;

auto mainLayout = new QVBoxLayout;
setLayout(mainLayout);

Expand All @@ -102,27 +100,44 @@ 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);

// 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"; });
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);

// 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);
m_view->setContextMenuPolicy(Qt::NoContextMenu);

//mainLayout->addWidget(m_view, 10, Qt::AlignTop);
mainLayout->addWidget(m_view);

m_view->load(QUrl("qrc:///library/geometry_preview.html"));
QUrl previewURL("qrc:///library/geometry_preview.html");
m_view->load(previewURL);
}

PreviewWebView::~PreviewWebView() {
Expand All @@ -149,6 +164,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 {
Expand Down Expand Up @@ -202,6 +218,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");
Expand Down
2 changes: 1 addition & 1 deletion src/openstudio_lib/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
28 changes: 16 additions & 12 deletions src/openstudio_lib/ScheduleDayView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,25 @@ 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<std::string> 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<StringSetterOptionalStringReturn>(std::bind(&model::ScheduleDay::setName, &m_scheduleDay, std::placeholders::_1)));
lineEdit->setFixedWidth(200);

hLayout->addWidget(lineEdit);

hLayout->addStretch();

mainVLayout->addLayout(hLayout);

// Schedule Limits View

Expand Down
8 changes: 6 additions & 2 deletions src/openstudio_lib/ScheduleDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,19 @@ 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) {
return true;
}

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) {
Expand Down
17 changes: 10 additions & 7 deletions src/openstudio_lib/SchedulesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -1622,31 +1625,31 @@ 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<BoolSetter>(std::bind(&model::ScheduleRule::setApplySundayNoFail, &m_scheduleRule, std::placeholders::_1)));
weekHLayout->addWidget(m_sundayButton);

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<BoolSetter>(std::bind(&model::ScheduleRule::setApplyMondayNoFail, &m_scheduleRule, std::placeholders::_1)));
weekHLayout->addWidget(m_mondayButton);

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<BoolSetter>(std::bind(&model::ScheduleRule::setApplyTuesdayNoFail, &m_scheduleRule, std::placeholders::_1)));
weekHLayout->addWidget(m_tuesdayButton);

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),
Expand All @@ -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),
Expand All @@ -1664,15 +1667,15 @@ 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<BoolSetter>(std::bind(&model::ScheduleRule::setApplyFridayNoFail, &m_scheduleRule, std::placeholders::_1)));
weekHLayout->addWidget(m_fridayButton);

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),
Expand Down
16 changes: 9 additions & 7 deletions src/openstudio_lib/SchedulesView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class OSCheckBox;

class OSCheckBox2;

class OSGreyCheckBox2;

class OSLineEdit2;

class ScheduleDayView;
Expand Down Expand Up @@ -650,19 +652,19 @@ class ScheduleRuleView : public QWidget, public Nano::Observer

boost::optional<model::YearDescription> 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;

Expand Down
Loading

0 comments on commit f10b850

Please sign in to comment.