Skip to content

Commit

Permalink
Merge pull request #17 from vetlewi/master
Browse files Browse the repository at this point in the history
Version 1.4.0
  • Loading branch information
vetlewi authored Jul 19, 2023
2 parents b7c8940 + c2e02f2 commit df4dc07
Show file tree
Hide file tree
Showing 12 changed files with 1,085 additions and 172 deletions.
206 changes: 206 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*

*_qmlcache.qrc

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# gitignore for Qt Creator like IDE for pure C/C++ project without Qt
#
# Reference: http://doc.qt.io/qtcreator/creator-project-generic.html



# Qt Creator autogenerated files


# A listing of all the files included in the project
*.files

# Include directories
*.includes

# Project configuration settings like predefined Macros
*.config

# Qt Creator settings
*.creator

# User project settings
*.creator.user*

# Qt Creator backups
*.autosave

# Flags for Clang Code Model
*.cxxflags
*.cflags

# Gitignore for various small files that are generated
#
#
build


# End of https://mrkandreev.name/snippets/gitignore-generator/#C,Qt,C++,macOS,QtCreator
4 changes: 2 additions & 2 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ RCC_DIR = $$BUILDDIR/app
UI_DIR = $$BUILDDIR/app

macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QMAKE_CXXFLAGS += -std=c++11 -O3
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
QMAKE_CXXFLAGS += -std=c++20 -O3
LIBS += -dead_strip #-stdlib=libc++
ICON = ../resources/media/Qkinz.icns
}
Expand Down
2 changes: 1 addition & 1 deletion resources/text/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<body>

<p>
<b>Qkinz v1.3.0</b>, Copyright (C) 2015-2016 University of Oslo.
<b>Qkinz v1.4.0</b>, Copyright (C) 2015-2023 University of Oslo.
</p>
<p>
This program is free software: you can redistribute it and/or modify
Expand Down
24 changes: 24 additions & 0 deletions src/gui/forms/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,30 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="LayoutManualInc">
<item>
<widget class="QLabel" name="incAngleLabel">
<property name="text">
<string>Incident angle:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="incAngleInput">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down
8 changes: 6 additions & 2 deletions src/gui/include/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class MainWindow : public QMainWindow
~MainWindow();

signals:
void operate(const double &Angle, const bool &p, const bool &d, const bool &t, const bool &h3, const bool &a);
//void operate(const double &Angle, const bool &p, const bool &d, const bool &t, const bool &h3, const bool &a);
void operate(const double &Angle, const double &incAngle, const bool &p, const bool &d, const bool &t, const bool &h3, const bool &a);
void runBatchFile(QString batchfile);

public slots:
Expand Down Expand Up @@ -135,8 +136,11 @@ private slots:
//! Show the about QCustomPlot dialog.
void on_actionAbout_QCustomPlot_triggered();

//! Strip number SpinButton is clicked.
void strip_changed(int);

//! Angle ratio button is toggled.
void on_toggle_Angle(bool);
void toggle_Angle(bool);

private:
//! The ui of the window.
Expand Down
46 changes: 41 additions & 5 deletions src/gui/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ MainWindow::MainWindow(QWidget *parent)
connect(setTelescope_form, SIGNAL(DoRefresh()), this, SLOT(Refresh()));

connect(ui->actionClose, SIGNAL(triggered(bool)), this, SLOT(close()));

connect(ui->manAngle, SIGNAL(toggled(bool)), this, SLOT(on_toggle_Angle(bool)));
connect(ui->StripNumbr, SIGNAL(valueChanged(int)), this, SLOT(strip_changed(int)));
connect(ui->FwdAngRButton, SIGNAL(toggled(bool)), this, SLOT(toggle_Angle(bool)));
connect(ui->BwdAngRButton, SIGNAL(toggled(bool)), this, SLOT(toggle_Angle(bool)));
connect(ui->manAngle, SIGNAL(toggled(bool)), this, SLOT(toggle_Angle(bool)));

// Setting default values. Should be done from saved file?
theBeam.A = 1;
Expand Down Expand Up @@ -134,6 +136,13 @@ MainWindow::MainWindow(QWidget *parent)

ui->StripNumbr->setEnabled(true);
ui->manAngleInput->setEnabled(false);
ui->incAngleInput->setEnabled(false);
double incAngle = ui->StripNumbr->value() * 2 - 7;
double angle = 47 + incAngle;
if ( ui->BwdAngRButton->isChecked() )
angle = 180. - angle;
ui->manAngleInput->setValue(angle);
ui->incAngleInput->setValue(fabs(incAngle));

Refresh();
}
Expand Down Expand Up @@ -173,6 +182,14 @@ void MainWindow::Reset_All()
theTelescope.Absorber.unit = um;
ui->StripNumbr->setEnabled(true);
ui->manAngleInput->setEnabled(false);
ui->incAngleInput->setEnabled(false);

double incAngle = ui->StripNumbr->value() * 2 - 7;
double angle = 47 + incAngle;
if ( ui->BwdAngRButton->isChecked() )
angle = 180. - angle;
ui->manAngleInput->setValue(angle);
ui->incAngleInput->setValue(fabs(incAngle));

RemoveAllGraphs();
Refresh();
Expand Down Expand Up @@ -356,17 +373,20 @@ void MainWindow::run()
RemoveAllGraphs();
table.Reset();
double angle;
double incAngle;

if (ui->manAngle->isChecked()){
angle = ui->manAngleInput->value()*PI/180.;
incAngle = ui->incAngleInput->value()*PI/180.;
} else {
angle = (ui->StripNumbr->value()*2 + 40)*PI/180;
incAngle = (2*ui->StripNumbr->value() - 7)*PI/180;
angle = 47.0*PI/180 + incAngle;
if (ui->BwdAngRButton->isChecked()){
angle = PI - angle;
}
}

emit operate(angle, ui->protons->isChecked(), ui->deutrons->isChecked(), ui->tritons->isChecked(), ui->He3s->isChecked(), ui->alphas->isChecked());
emit operate(angle, incAngle, ui->protons->isChecked(), ui->deutrons->isChecked(), ui->tritons->isChecked(), ui->He3s->isChecked(), ui->alphas->isChecked());
}

void MainWindow::WorkFinished()
Expand Down Expand Up @@ -554,15 +574,31 @@ void MainWindow::on_actionAbout_QCustomPlot_triggered()
file.close();
}

void MainWindow::on_toggle_Angle(bool)
void MainWindow::strip_changed(int)
{
double incAngle = 2*ui->StripNumbr->value() - 7;
double angle = 47.0 - incAngle;
if ( ui->BwdAngRButton->isChecked() )
angle = 180. - angle;
ui->manAngleInput->setValue(angle);
ui->incAngleInput->setValue(fabs(incAngle));
}

void MainWindow::toggle_Angle(bool)
{
if (ui->manAngle->isChecked()){
ui->StripNumbr->setDisabled(true);
ui->manAngleInput->setEnabled(true);
ui->incAngleInput->setEnabled(true);
} else {
ui->StripNumbr->setEnabled(true);
ui->manAngleInput->setEnabled(false);
ui->incAngleInput->setEnabled(false);
}
if (ui->BwdAngRButton->isChecked()){
strip_changed(0);
}

}

// This is an early implementation.
Expand Down
2 changes: 1 addition & 1 deletion src/kinematics/src/CustomPower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static size_t count_line(std::istream &is)
std::istream::iostate state_backup = is.rdstate();
// clear state
is.clear();
std::istream::streampos pos_backup = is.tellg();
auto pos_backup = is.tellg();

is.seekg(0);
size_t line_cnt;
Expand Down
Loading

0 comments on commit df4dc07

Please sign in to comment.