Skip to content

Commit

Permalink
Some fixes...
Browse files Browse the repository at this point in the history
  • Loading branch information
alanspencer committed Aug 20, 2023
1 parent d4ea170 commit 38b1a28
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ Makefile

SPIERS.pro.user
*/.DS_Store
SPIERSview/.DS_Store
SPIERSview/.DS_Store
3 changes: 2 additions & 1 deletion SPIERSalign/SPIERSalign.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ QT = gui core network widgets

CONFIG += qt \
release \
warn_on
warn_on \
sdk_no_version_check

RESOURCES += align.qrc \
../SPIERScommon/commonresources.qrc
Expand Down
4 changes: 2 additions & 2 deletions SPIERSalign/src/mainwindowimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ void MainWindowImpl::markersLockToggled()
{
markersLocked = 1;
markerList->clearSelection();
setEnabled(false);
//setEnabled(false);
mThickness->setEnabled(false);
mSize->setEnabled(false);
addMarker->setEnabled(false);
Expand All @@ -738,7 +738,7 @@ void MainWindowImpl::markersLockToggled()
else
{
markersLocked = 0;
setEnabled(true);
//setEnabled(true);
mThickness->setEnabled(true);
mSize->setEnabled(true);
addMarker->setEnabled(true);
Expand Down
2 changes: 1 addition & 1 deletion SPIERSalign/src/mainwindowimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MainWindowImpl : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
MainWindowImpl( QWidget *parent = nullptr, Qt::WindowFlags f = nullptr );
MainWindowImpl( QWidget *parent = nullptr, Qt::WindowFlags f = {} );
~MainWindowImpl();

void LogText(QString text);
Expand Down
3 changes: 2 additions & 1 deletion SPIERScommon/src/darkstyletheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "darkstyletheme.h"
#include <QScreen>
#include <QRect>
#include <QDesktopWidget>

Expand Down Expand Up @@ -93,7 +94,7 @@ void DarkStyleTheme::polish(QApplication *app)
{
if (!app) return;

QRect screenGeometry = QApplication::desktop()->screenGeometry();
QRect screenGeometry = QApplication::primaryScreen()->geometry();
if (screenGeometry.width() > 1920)
{
//ARTS - Increase font size for better reading,
Expand Down
6 changes: 4 additions & 2 deletions SPIERSedit/SPIERSedit.pro
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ QT += core \
network \
widgets

CONFIG += warn_on \
qt \
CONFIG += qt \
release \
warn_on \
thread \
sdk_no_version_check

RESOURCES = SPIERSedit.qrc \
../SPIERScommon/commonresources.qrc
Expand Down
23 changes: 9 additions & 14 deletions SPIERSedit/src/findpolynomialimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "fileio.h"
#include <math.h>
#include <QDebug>
#include <QElapsedTimer>
#include <QRandomGenerator>

//these variables can be used for stashing /unstashing
double k; // the integer part of the thing
Expand Down Expand Up @@ -60,7 +62,7 @@ int findpolynomialImpl::MeasurePolyFitness()
int rand255()
{
// gives random number in short range (ignore the 255!)
return static_cast<int>(qrand() * 2);
return static_cast<int>(QRandomGenerator::global()->generate() * 2);
}

double findpolynomialImpl::PolyTweak(double val)
Expand Down Expand Up @@ -178,27 +180,22 @@ int findpolynomialImpl::BreedPoly(int gens)

double findpolynomialImpl::CalcScale()
{


//work out scaling factor - find largest and / or smallest values from sample array
int n;
double maxval;
double r;
Segment *seg = Segments[CurrentSegment];

maxval = 0;

for (n = 0; n < Sample.count(); n += seg->PolySparse)
{
r = CalcPoly(Sample[n].r, Sample[n].g, Sample[n].b, seg);
if (r < 0) r = 0 - r; //do abs
r = abs(CalcPoly(Sample[n].r, Sample[n].g, Sample[n].b, seg));
if (r > maxval) maxval = r;
}
//maxval is now biggest
maxval /= 128;

return maxval;

}

//New QT stuff
Expand Down Expand Up @@ -255,8 +252,6 @@ void findpolynomialImpl::UnStashPoly()
seg->PolyBlueConsts[i] = BlueConsts[i];
}



//And a translated VB function
void findpolynomialImpl::Breed()
{
Expand Down Expand Up @@ -359,8 +354,8 @@ void findpolynomialImpl::Breed()

double findpolynomialImpl::polyrand()
{
double polyrand = pow(2.0, ((static_cast<double>(qrand()) / static_cast<double>(RAND_MAX) * 16.0) - 8.0));
if ((qrand() > (RAND_MAX / 2))) return 0 - polyrand;
double polyrand = pow(2.0, ((static_cast<double>(QRandomGenerator::global()->generate()) / QRandomGenerator::global()->generate() * 16.0) - 8.0));
if (((new QRandomGenerator)->generateDouble() > (RAND_MAX / 2))) return 0 - polyrand;
else return polyrand;
}

Expand All @@ -376,7 +371,7 @@ void findpolynomialImpl::RandomizePoly(int s, int o)
Segments[s]->PolyBlueConsts[n] = polyrand();
}
Segments[s]->PolyOrder = o;
Segments[s]->PolyKall = (qrand() / RAND_MAX) * 200 - 100;
Segments[s]->PolyKall = (QRandomGenerator::global()->generate() / RAND_MAX) * 200 - 100;
Segments[s]->PolyScale = 10000000;

//report
Expand Down Expand Up @@ -406,8 +401,8 @@ void findpolynomialImpl::find()

//first step - set up the sample
WriteAllData(CurrentFile);
QTime t;
t.start();
//QElapsedTimer t;
//t.start();

for (int i = 0; i < FileCount; i++)
if (mainwin->SliceSelectorList->item(i)->isSelected())
Expand Down
3 changes: 2 additions & 1 deletion SPIERSutility/SPIERSversion/SPIERSversion.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ QT += network xml gui core widgets

CONFIG += qt \
release \
warn_on
warn_on \
sdk_no_version_check

#RESOURCES = version.qrc \
RESOURCES = ../../SPIERScommon/commonresources.qrc
Expand Down
Binary file modified SPIERSview/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions SPIERSview/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ void logMessageOutput(QtMsgType type, const QMessageLogContext &context, const Q
QFile outFile(path);
outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream log(&outFile);
log << txt << endl;
log << txt << Qt::endl;

// Now print to stout too
QTextStream console(stdout);
console << txt << endl;
console << txt << Qt::endl;
}
else
{
// Print to stout only
QTextStream console(stdout);
console << txt << endl;
console << txt << Qt::endl;
}
}

Expand Down

0 comments on commit 38b1a28

Please sign in to comment.