Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2022-09-05 15:23:27 +02:00
commit 02f7c459c5
6 changed files with 34 additions and 8 deletions

View File

@ -39,6 +39,8 @@
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QTextStream> #include <QTextStream>
#include <QPixmap> #include <QPixmap>
#include <QGuiApplication>
#include <QScreen>
#include <QDebug> #include <QDebug>
@ -175,6 +177,12 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
height = 20*fParamVec.size(); height = 20*fParamVec.size();
else else
height = 900; height = 900;
// make sure that the minimal height is not larger than the screen resolution height
QScreen *screen = QGuiApplication::primaryScreen();
int hh = screen->geometry().height();
if (height > hh)
height = hh - 70;
setMinimumSize(400, height); setMinimumSize(400, height);
// populate dialog // populate dialog

View File

@ -103,7 +103,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
/** /**
* <p>returns the msr2data relavant parameters from the GUI. * <p>returns the msr2data relevant parameters from the GUI.
*/ */
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam() PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{ {

View File

@ -61,6 +61,7 @@
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QDesktopServices> #include <QDesktopServices>
#include <QUrl> #include <QUrl>
#include <QRegExp>
#include <QtDebug> #include <QtDebug>
@ -2287,7 +2288,11 @@ void PTextEdit::musrMsr2Data()
// parameter export list // parameter export list
if (!fMsr2DataParam->paramList.isEmpty()) { if (!fMsr2DataParam->paramList.isEmpty()) {
cmd.append("paramList"); cmd.append("paramList");
QStringList list = fMsr2DataParam->paramList.split(' '); #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
QStringList list = fMsr2DataParam->paramList.split(QRegExp("[(\\s|,|;)]"), QString::SkipEmptyParts);
#else
QStringList list = fMsr2DataParam->paramList.split(QRegExp("[(\\s|,|;)]"), Qt::SkipEmptyParts);
#endif
for (int i=0; i<list.size(); i++) for (int i=0; i<list.size(); i++)
cmd.append(list[i]); cmd.append(list[i]);
} }
@ -2859,13 +2864,16 @@ void PTextEdit::musrSwapMsrMlog()
return; return;
} }
if (QMessageBox::information(this, "INFO",
QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName),
QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
return;
// check if the file needs to be saved // check if the file needs to be saved
if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first
fileSave(); fileSave();
} }
QMessageBox::information(nullptr, "INFO", QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName));
// swap files // swap files
// copy currentFile -> tempFile // copy currentFile -> tempFile

View File

@ -39,6 +39,8 @@
#include <QDoubleValidator> #include <QDoubleValidator>
#include <QTextStream> #include <QTextStream>
#include <QPixmap> #include <QPixmap>
#include <QGuiApplication>
#include <QScreen>
#include <QDebug> #include <QDebug>
@ -175,6 +177,11 @@ PMusrStep::PMusrStep(const char *fln, QWidget *parent) :
height = 20*fParamVec.size(); height = 20*fParamVec.size();
else else
height = 900; height = 900;
// make sure that the minimal height is not larger than the screen resolution height
QScreen *screen = QGuiApplication::primaryScreen();
int hh = screen->geometry().height();
if (height > hh)
height = hh - 70;
setMinimumSize(400, height); setMinimumSize(400, height);
// populate dialog // populate dialog

View File

@ -103,7 +103,7 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
/** /**
* <p>returns the msr2data relavant parameters from the GUI. * <p>returns the msr2data relevant parameters from the GUI.
*/ */
PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam() PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
{ {

View File

@ -2288,7 +2288,7 @@ void PTextEdit::musrMsr2Data()
// parameter export list // parameter export list
if (!fMsr2DataParam->paramList.isEmpty()) { if (!fMsr2DataParam->paramList.isEmpty()) {
cmd.append("paramList"); cmd.append("paramList");
QStringList list = fMsr2DataParam->paramList.split(' '); QStringList list = fMsr2DataParam->paramList.split(QRegExp("[(\\s|,|;)]"), Qt::SkipEmptyParts);
for (int i=0; i<list.size(); i++) for (int i=0; i<list.size(); i++)
cmd.append(list[i]); cmd.append(list[i]);
} }
@ -2848,13 +2848,16 @@ void PTextEdit::musrSwapMsrMlog()
return; return;
} }
if (QMessageBox::information(this, "INFO",
QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName),
QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
return;
// check if the file needs to be saved // check if the file needs to be saved
if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first if (fTabWidget->tabText(fTabWidget->currentIndex()).indexOf("*") > 0) { // needs to be saved first
fileSave(); fileSave();
} }
QMessageBox::information(nullptr, "INFO", QString("Will now swap files: %1 <-> %2").arg(currentFileName).arg(swapFileName));
// swap files // swap files
// copy currentFile -> tempFile // copy currentFile -> tempFile