Skip to content

Commit cba93af

Browse files
authored
Fixed some issues with reloading a changed CellML file.
2 parents dae06c0 + ffc8d62 commit cba93af

File tree

10 files changed

+62
-58
lines changed

10 files changed

+62
-58
lines changed

.github/workflows/cd.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
matrix:
1515
include:
1616
- name: Windows
17-
os: windows-2019
17+
os: windows-2022
1818
- name: Linux
1919
os: ubuntu-22.04
2020
- name: macOS
@@ -40,6 +40,9 @@ jobs:
4040
run: echo -n $EV_CERTIFICATE_BASE64 | base64 -d > EVCertificate.pfx
4141
- name: Install CMake and Ninja
4242
uses: lukka/get-cmake@latest
43+
- name: Configure MSVC
44+
if: ${{ runner.os == 'Windows' }}
45+
uses: ilammy/msvc-dev-cmd@v1
4346
- name: Install Python
4447
uses: actions/setup-python@v5
4548
with:

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
matrix:
1515
include:
1616
- name: Build and test (Windows release)
17-
os: windows-2019
17+
os: windows-2022
1818
mode: Release
1919
- name: Build (Windows debug)
20-
os: windows-2019
20+
os: windows-2022
2121
mode: Debug
2222
- name: Build and test (Linux release)
2323
os: ubuntu-22.04
@@ -41,6 +41,9 @@ jobs:
4141
uses: actions/checkout@v4
4242
- name: Install CMake and Ninja
4343
uses: lukka/get-cmake@latest
44+
- name: Configure MSVC
45+
if: ${{ runner.os == 'Windows' }}
46+
uses: ilammy/msvc-dev-cmd@v1
4447
- name: Install Python
4548
uses: actions/setup-python@v5
4649
with:
@@ -73,7 +76,7 @@ jobs:
7376
matrix:
7477
include:
7578
- name: Documentation (Windows)
76-
os: windows-2019
79+
os: windows-2022
7780
- name: Documentation (Linux)
7881
os: ubuntu-22.04
7982
- name: Documentation (macOS)

CMakeLists.txt

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ if(WIN32)
8181
list(GET CMAKE_CXX_COMPILER_VERSION_LIST 1 CMAKE_CXX_COMPILER_VERSION_MINOR)
8282

8383
if( NOT( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"
84-
AND "${CMAKE_C_COMPILER_VERSION_MAJOR}" STREQUAL "19")
84+
AND "${CMAKE_C_COMPILER_VERSION_MAJOR}" STREQUAL "19"
85+
AND "${CMAKE_C_COMPILER_VERSION_MINOR}" STREQUAL "44")
8586
OR NOT( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"
86-
AND "${CMAKE_CXX_COMPILER_VERSION_MAJOR}" STREQUAL "19"))
87-
message(FATAL_ERROR "${CMAKE_PROJECT_NAME} can only be built using MSVC 2017, 2019 or 2022 on Windows...")
87+
AND "${CMAKE_CXX_COMPILER_VERSION_MAJOR}" STREQUAL "19"
88+
AND "${CMAKE_CXX_COMPILER_VERSION_MINOR}" STREQUAL "44"))
89+
message(FATAL_ERROR "${CMAKE_PROJECT_NAME} can only be built using MSVC 2022 on Windows...")
8890
endif()
8991
elseif(APPLE)
9092
if( NOT( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"
@@ -527,7 +529,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "" CACHE STRING "" FORCE)
527529
set(CMAKE_CXX_FLAGS_DEBUG "" CACHE STRING "" FORCE)
528530

529531
if(WIN32)
530-
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /WX /GR /EHsc")
532+
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /WX /GR /EHsc /wd4996")
531533
# Note: MSVC has a /Wall flag, but it results in MSVC being very pedantic,
532534
# so instead we use what MSVC recommends for production code, which is
533535
# /W3 and which is also what CMake uses by default...
@@ -920,16 +922,16 @@ if(USE_PREBUILT_QTWEBKIT_PACKAGE)
920922
# Determine the location of the MSVC runtime libraries
921923

922924
if(WIN32)
923-
if(EXISTS "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community")
925+
if(EXISTS "C:/Program Files/Microsoft Visual Studio/2022/Community")
924926
set(MSVC_EDITION Community)
925927
else()
926928
set(MSVC_EDITION Enterprise)
927929
endif()
928930

929931
if(RELEASE_MODE)
930-
set(MSVC_DIR "C:/Program Files (x86)/Microsoft Visual Studio/2019/${MSVC_EDITION}/VC/Redist/MSVC/14.29.30133/x64/Microsoft.VC142.CRT")
932+
set(MSVC_DIR "C:/Program Files/Microsoft Visual Studio/2022/${MSVC_EDITION}/VC/Redist/MSVC/14.44.35112/x64/Microsoft.VC143.CRT")
931933
else()
932-
set(MSVC_DIR "C:/Program Files (x86)/Microsoft Visual Studio/2019/${MSVC_EDITION}/VC/Redist/MSVC/14.29.30133/debug_nonredist/x64/Microsoft.VC142.DebugCRT")
934+
set(MSVC_DIR "C:/Program Files/Microsoft Visual Studio/2022/${MSVC_EDITION}/VC/Redist/MSVC/14.44.35112/debug_nonredist/x64/Microsoft.VC143.DebugCRT")
933935
endif()
934936
endif()
935937

@@ -1263,10 +1265,10 @@ else()
12631265
add_dependencies(${WINDOWS_CLI_COPY} ${WINDOWS_CLI_PROJECT_NAME})
12641266

12651267
# Additional files required by OpenCOR
1266-
# Note #1: these files may or not be needed in order to test OpenCOR
1267-
# locally. It all depends on the way the user's computer is set
1268-
# up. So, by copying them over, we are sure that the
1269-
# release/debug version of OpenCOR will work fine...
1268+
# Note: these files may or not be needed in order to test OpenCOR
1269+
# locally. It all depends on the way the user's computer is set
1270+
# up. So, by copying them over, we are sure that the release/debug
1271+
# version of OpenCOR will work fine...
12701272
# Note #2: the second set of additional files is needed in case OpenCOR
12711273
# is to be run on a non-up-to-date copy of Windows 7...
12721274

@@ -1276,7 +1278,7 @@ else()
12761278
${MSVC_DIR}/vcruntime140_1${DEBUG_TAG}.dll
12771279
)
12781280

1279-
set(REMOTE_DEBUGGER_DIR "C:/Program Files (x86)/Microsoft Visual Studio/2019/${MSVC_EDITION}/Common7/IDE/Remote Debugger/x64")
1281+
set(REMOTE_DEBUGGER_DIR "C:/Program Files/Microsoft Visual Studio/2022/${MSVC_EDITION}/Common7/IDE/Remote Debugger/x64")
12801282

12811283
list(APPEND ADDITIONAL_FILES
12821284
${REMOTE_DEBUGGER_DIR}/api-ms-win-core-file-l1-2-0.dll

package.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ IF !ExitCode! EQU 0 (
2121
set VSCMD_ARG_HOST_ARCH=x64
2222
set VSCMD_ARG_TGT_ARCH=x64
2323

24-
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\winsdk.bat" (
25-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\winsdk.bat"
24+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\vsdevcmd\core\winsdk.bat" (
25+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\vsdevcmd\core\winsdk.bat"
2626
) ELSE (
27-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\vsdevcmd\core\winsdk.bat"
27+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\vsdevcmd\core\winsdk.bat"
2828
)
2929

3030
"!WindowsSdkVerBinPath!\x64\signtool.exe" sign /tr http://timestamp.globalsign.com/tsa/r6advanced1 /fd SHA256 /td SHA256 /f !EvCertificate! !AppDir!build\OpenCOR.com

scripts/genericci.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ IF EXIST !AppDir!build (
3333

3434
TITLE Building and testing the !version! version of OpenCOR using !Generator!...
3535

36-
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
37-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
36+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
37+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
3838
) ELSE (
39-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
39+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
4040
)
4141

4242
CD !AppDir!build

scripts/genericmake.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ IF EXIST !AppDir!build (
3737

3838
TITLE Building OpenCOR!TitleTests! using !Generator!...
3939

40-
IF EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" (
41-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
40+
IF EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
41+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
4242
) ELSE (
43-
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
43+
CALL "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
4444
)
4545

4646
SET OrigDir=!CD!

src/plugins/miscellaneous/Core/src/propertyeditorwidget.cpp

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,21 +2032,13 @@ void PropertyEditorWidget::checkCheckState(QStandardItem *pItem)
20322032

20332033
//==============================================================================
20342034

2035-
void PropertyEditorWidget::updateFocusProxy()
2036-
{
2037-
// Set our property's editor as our focus proxy
2038-
2039-
setFocusProxy(mPropertyEditor);
2040-
}
2041-
2042-
//==============================================================================
2043-
20442035
void PropertyEditorWidget::editorOpened(QWidget *pEditor)
20452036
{
20462037
// Keep track of some information about the property
20472038

20482039
mProperty = currentProperty();
20492040
mPropertyEditor = pEditor;
2041+
mOldPropertyValue = mProperty->value();
20502042

20512043
// We are starting the editing of a property, so make sure that if we are to
20522044
// edit a list item, then its original value gets properly set
@@ -2066,19 +2058,13 @@ void PropertyEditorWidget::editorOpened(QWidget *pEditor)
20662058
}
20672059
}
20682060

2069-
// Next, we need to use the property's editor as our focus proxy and make
2070-
// sure that it immediately gets the focus
2071-
// Note #1: if we were not to immediately give the focus to our editor, then
2072-
// the central widget would give the focus to the previously
2073-
// focused widget (see CentralWidget::updateGui()), which is
2074-
// clearly not what we want...
2075-
// Note #2: starting with Qt 5.12.5, we can't immediately set the property's
2076-
// editor as our focus proxy (!?). This will indeed crash OpenCOR!
2077-
// So, instead, we set it through a single shot...
2061+
// Next, we need to make sure that it immediately gets the focus
2062+
// Note: if we were not to immediately give the focus to our editor, then
2063+
// the central widget would give the focus to the previously focused
2064+
// widget (see CentralWidget::updateGui()), which is clearly not what
2065+
// we want...
20782066

20792067
pEditor->setFocus();
2080-
2081-
QTimer::singleShot(0, this, &PropertyEditorWidget::updateFocusProxy);
20822068
}
20832069

20842070
//==============================================================================
@@ -2103,15 +2089,9 @@ void PropertyEditorWidget::editorClosed()
21032089

21042090
if ( (mProperty->type() != Property::Type::List)
21052091
&& (mProperty->type() != Property::Type::Boolean)) {
2106-
mProperty->setValue(mProperty->value(), true);
2092+
mProperty->setValue(mProperty->value(), true, mOldPropertyValue != mProperty->value());
21072093
}
21082094

2109-
// Reset our focus proxy and make sure that we get the focus (see
2110-
// editorOpened() above for the reason)
2111-
2112-
setFocusProxy(nullptr);
2113-
setFocus();
2114-
21152095
// Reset some information about the property
21162096

21172097
mProperty = nullptr;

src/plugins/miscellaneous/Core/src/propertyeditorwidget.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ class CORE_EXPORT PropertyEditorWidget : public TreeViewWidget
444444
Properties mProperties;
445445
Properties mAllProperties;
446446

447+
QString mOldPropertyValue;
447448
Property *mProperty = nullptr;
448449
QWidget *mPropertyEditor = nullptr;
449450

@@ -472,8 +473,6 @@ private slots:
472473

473474
void checkCheckState(QStandardItem *pItem);
474475

475-
void updateFocusProxy();
476-
477476
void editorOpened(QWidget *pEditor);
478477
void editorClosed();
479478

src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,10 @@ static const char *OutputBrLn = "<br/>\n";
900900

901901
void SimulationExperimentViewSimulationWidget::initialize(bool pReloading)
902902
{
903+
// Keep track of the fact that we are reloading ourselves
904+
905+
mReloading = pReloading;
906+
903907
// In the case of a SED-ML file and of a COMBINE archive, we will need
904908
// to further initialise ourselves, to customise graph panels, etc. (see
905909
// furtherInitialize()), so we ask our central widget to show its busy
@@ -2735,6 +2739,10 @@ void SimulationExperimentViewSimulationWidget::finalFurtherInitialize()
27352739
mGraphPanelsWidgetSizes = mContentsWidget->graphPanelsWidget()->sizes();
27362740

27372741
checkGraphPanelsAndGraphs();
2742+
2743+
// If we were reloading ourselves, then we can now reset mReloading to false
2744+
2745+
mReloading = false;
27382746
}
27392747

27402748
//==============================================================================
@@ -3257,11 +3265,13 @@ void SimulationExperimentViewSimulationWidget::simulationResultsReset()
32573265
// Note: see clearSimulationResults() for the reason behind temporarily
32583266
// disabling updates...
32593267

3260-
setUpdatesEnabled(false);
3261-
updateSimulationMode();
3268+
QTimer::singleShot(0, this, [this]() {
3269+
setUpdatesEnabled(false);
3270+
updateSimulationMode();
32623271

3263-
mViewWidget->checkSimulationResults(mSimulation->fileName(), Task::ResetRuns);
3264-
setUpdatesEnabled(true);
3272+
mViewWidget->checkSimulationResults(mSimulation->fileName(), Task::ResetRuns);
3273+
setUpdatesEnabled(true);
3274+
});
32653275
}
32663276

32673277
//==============================================================================
@@ -3774,6 +3784,12 @@ void SimulationExperimentViewSimulationWidget::updateSimulationResults(Simulatio
37743784
int pSimulationRun,
37753785
Task pTask)
37763786
{
3787+
// Don't update our simulation results if we are reloading ourselves
3788+
3789+
if (mReloading) {
3790+
return;
3791+
}
3792+
37773793
// Update our simulation results
37783794

37793795
SimulationSupport::Simulation *simulation = pSimulationWidget->simulation();

src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class SimulationExperimentViewSimulationWidget : public Core::Widget
204204

205205
Core::ProgressBarWidget *mProgressBarWidget;
206206

207+
bool mReloading = false;
207208
int mProgress = -1;
208209
bool mLockedDevelopmentMode = false;
209210

0 commit comments

Comments
 (0)