Skip to content

Commit

Permalink
Merge d6d67a0 into 3295700
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 12, 2020
2 parents 3295700 + d6d67a0 commit 9b56150
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 31 deletions.
14 changes: 11 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Note: the full list of Clang-Tidy checks can be found at
# https://clang.llvm.org/extra/clang-tidy/checks/list.html...
# Note #1: the full list of Clang-Tidy checks can be found at
# https://clang.llvm.org/extra/clang-tidy/checks/list.html...
# Note #2: performance-no-automatic-move shouldn't be disabled, but we have to
# due to an issue with Qt (see
# https://bugreports.qt.io/browse/QTBUG-85415)...
# Note #3: readability-redundant-access-specifiers shouldn't normally be
# disabled, but Clang-Tidy gets a bit confused with access specifiers
# like "public" vs. "public slots"...

---
Checks: >-
Expand Down Expand Up @@ -45,9 +51,11 @@ Checks: >-
-modernize-pass-by-value,
-modernize-use-trailing-return-type,
performance-*,
-performance-no-automatic-move,
readability-*,
-readability-isolate-declaration,
-readability-magic-numbers
-readability-magic-numbers,
-readability-redundant-access-specifiers
WarningsAsErrors: '*'
HeaderFilterRegex: '.*'
...
3 changes: 3 additions & 0 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ macro(configure_clang_and_clang_tidy TARGET_NAME)
# Note #2: besides C++98 compatibility, which we are not after, some
# warnings are disabled so that Qt-related files can be
# compiled without any problems...
# Note #3: no-anon-enum-enum-conversion is disabled so that we can
# safely use Type.h from Clang...

set(COMPILE_OPTIONS
-Weverything
-Wno-anon-enum-enum-conversion
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-documentation
Expand Down
8 changes: 4 additions & 4 deletions src/3rdparty/diff_match_patch/src/diff_match_patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,8 @@ class diff_match_patch {
int overlap_length1 = diff_commonOverlap(deletion, insertion);
int overlap_length2 = diff_commonOverlap(insertion, deletion);
if (overlap_length1 >= overlap_length2) {
if (overlap_length1 >= deletion.size() / 2.0 ||
overlap_length1 >= insertion.size() / 2.0) {
if (overlap_length1 >= double(deletion.size()) / 2.0 ||
overlap_length1 >= double(insertion.size()) / 2.0) {
// Overlap found. Insert an equality and trim the surrounding edits.
diffs.insert(cur_diff, Diff(EQUAL, insertion.substr(0, overlap_length1)));
prev_diff->text =
Expand All @@ -977,8 +977,8 @@ class diff_match_patch {
// no need to step past the new element.
}
} else {
if (overlap_length2 >= deletion.length() / 2.0 ||
overlap_length2 >= insertion.length() / 2.0) {
if (overlap_length2 >= double(deletion.length()) / 2.0 ||
overlap_length2 >= double(insertion.length()) / 2.0) {
// Reverse overlap found.
// Insert an equality and swap and trim the surrounding edits.
diffs.insert(cur_diff, Diff(EQUAL, deletion.substr(0, overlap_length2)));
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/datastoreinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ DataStoreImportData::DataStoreImportData(const QString &pFileName,
mNbOfVariables(pNbOfVariables),
mNbOfDataPoints(pNbOfDataPoints),
mRunSizes(pRunSizes),
mOneOverTotalProgress(1.0/pNbOfDataPoints)
mOneOverTotalProgress(1.0/double(pNbOfDataPoints))
{
// Initialise our hierarchy

Expand Down Expand Up @@ -767,7 +767,7 @@ double DataStoreImportData::progress()
{
// Increase and return our normalised progress

return (++mProgress)*mOneOverTotalProgress;
return double(++mProgress)*mOneOverTotalProgress;
}

//==============================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/miscellaneous/Core/src/corecliutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ QString sizeAsString(quint64 pSize, int pPrecision)
};

auto i = ulong(qFloor(log(pSize)/log(1024.0)));
double size = pSize/qPow(1024.0, i);
double size = double(pSize)/qPow(1024.0, double(i));
double scaling = qPow(10.0, pPrecision);

size = qRound(scaling*size)/scaling;
Expand Down
19 changes: 6 additions & 13 deletions src/plugins/miscellaneous/Core/src/coreguiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,22 +906,15 @@ QColor lockedColor(const QColor &pColor)
{
// Return the resulting locked version of the given colour

int red = pColor.red();
int green = pColor.green();
int blue = pColor.blue();

enum {
lockedRed = 255,
lockedGreen = 0,
lockedBlue = 0
};

static const double Alpha = 0.05;
static const double OneMinusAlpha = 1.0-Alpha;
static const double LockedRed = 255.0;
static const double LockedGreen = 0.0;
static const double LockedBlue = 0.0;

return { int(Alpha*lockedRed+OneMinusAlpha*red),
int(Alpha*lockedGreen+OneMinusAlpha*green),
int(Alpha*lockedBlue+OneMinusAlpha*blue) };
return { int(Alpha*LockedRed+OneMinusAlpha*pColor.red()),
int(Alpha*LockedGreen+OneMinusAlpha*pColor.green()),
int(Alpha*LockedBlue+OneMinusAlpha*pColor.blue()) };
}

//==============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ bool SimulationExperimentViewSimulationWidget::createSedmlFile(SEDMLSupport::Sed
double endingPoint = mSimulation->data()->endingPoint();
double pointInterval = mSimulation->data()->pointInterval();
auto nbOfPoints = quint64(ceil((endingPoint-startingPoint)/pointInterval));
bool needOneStepTask = !qFuzzyCompare((endingPoint-startingPoint)/nbOfPoints, pointInterval);
bool needOneStepTask = !qFuzzyCompare((endingPoint-startingPoint)/double(nbOfPoints), pointInterval);

libsedml::SedUniformTimeCourse *sedmlUniformTimeCourse = sedmlDocument->createUniformTimeCourse();

Expand All @@ -1827,7 +1827,7 @@ bool SimulationExperimentViewSimulationWidget::createSedmlFile(SEDMLSupport::Sed
sedmlUniformTimeCourse->setId(QString("simulation%1").arg(simulationNumber).toStdString());
sedmlUniformTimeCourse->setInitialTime(startingPoint);
sedmlUniformTimeCourse->setOutputStartTime(startingPoint);
sedmlUniformTimeCourse->setOutputEndTime(startingPoint+nbOfPoints*pointInterval);
sedmlUniformTimeCourse->setOutputEndTime(startingPoint+double(nbOfPoints)*pointInterval);
sedmlUniformTimeCourse->setNumberOfPoints(int(nbOfPoints));

addSedmlSimulation(sedmlDocument, sedmlModel, sedmlRepeatedTask,
Expand Down Expand Up @@ -3656,7 +3656,7 @@ void SimulationExperimentViewSimulationWidget::updateGui(bool pCheckVisibility)

// Make sure that our progress bar is up to date

mProgressBarWidget->setValue(mViewWidget->simulationResultsSize(mSimulation->fileName())/double(mSimulation->size()));
mProgressBarWidget->setValue(double(mViewWidget->simulationResultsSize(mSimulation->fileName()))/double(mSimulation->size()));
}

//==============================================================================
Expand Down Expand Up @@ -3814,7 +3814,7 @@ void SimulationExperimentViewSimulationWidget::updateSimulationResults(Simulatio

if (simulation == mSimulation) {
QString simulationFileName = mSimulation->fileName();
double simulationProgress = double(mViewWidget->simulationResultsSize(simulationFileName))/simulation->size();
double simulationProgress = double(mViewWidget->simulationResultsSize(simulationFileName))/double(simulation->size());

if ((pTask != Task::None) || visible) {
mProgressBarWidget->setValue(simulationProgress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,9 @@ void SimulationWorker::run()

// Determine our next point and compute our model up to it

++pointCounter;

odeSolver->solve(mCurrentPoint,
qMin(endingPoint,
startingPoint+pointCounter*pointInterval));
startingPoint+double(++pointCounter)*pointInterval));

// Make sure that no error occurred

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void EditorWidgetFindReplaceWidget::searchOptionChanged()
};

MagnifierIcon.paint(&dropDownPixmapPainter,
0, (IconSize-MagnifierIconHeight)/2,
0, (int(IconSize)-int(MagnifierIconHeight))/2,
IconSize, MagnifierIconHeight);
}

Expand Down

0 comments on commit 9b56150

Please sign in to comment.