Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman 2018-11-30 08:51:19 +01:00
commit 8a7e96a8f7
4 changed files with 57 additions and 9 deletions

View File

@ -4374,9 +4374,11 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines)
phaseRef = fParam[fourier.fPhaseRef-1].fValue;
}
fourier.fPhase.clear();
UInt_t idx;
for (UInt_t i=0; i<fourier.fPhaseParamNo.size(); i++) {
fourier.fPhase.push_back(fParam[fourier.fPhaseParamNo[i]-1].fValue+phaseRef);
if (fourier.fPhaseRef == fourier.fPhaseParamNo[i]) // reference phase
fourier.fPhase.push_back(fParam[fourier.fPhaseParamNo[i]-1].fValue);
else
fourier.fPhase.push_back(fParam[fourier.fPhaseParamNo[i]-1].fValue+phaseRef);
}
}
}

View File

@ -5,16 +5,20 @@ find_package(Qt5WebEngine QUIET)
find_package(Qt5WebKit QUIET)
set(qt_libs Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport)
set(Qt5NoWeb 0)
if (Qt5WebEngine_FOUND)
message("-- Qt5WebEngine is present.")
find_package(Qt5WebEngineWidgets QUIET CONFIG REQUIRED)
set(qt_libs ${qt_libs} Qt5::WebEngine Qt5::WebEngineWidgets)
# unset a potentially found Qt5Webkit
unset(Qt5WebKit_FOUND)
elseif (Qt5WebKit_FOUND)
message("-- Qt5WebKit is present.")
find_package(Qt5WebKitWidgets QUIET CONFIG REQUIRED)
set(qt_libs ${qt_libs} Qt5::WebKit Qt5::WebKitWidgets)
else (Qt5WebEngine_FOUND)
message("-- Neither Qt5WebEngine nor Qt5WebKit found.")
set(Qt5NoWeb 1)
endif (Qt5WebEngine_FOUND)
set(musredit_src
@ -116,6 +120,15 @@ else (APPLE)
)
endif (APPLE)
# set necessary tags depending if QtWebEngine, QtWebKit,
# or none of both are given
if (Qt5WebKit_FOUND)
target_compile_options(musredit
BEFORE PRIVATE
-DHAVE_QT_WEB_KIT
)
endif (Qt5WebKit_FOUND)
if (Qt5WebEngine_FOUND)
target_compile_options(musredit
BEFORE PRIVATE
@ -123,6 +136,13 @@ if (Qt5WebEngine_FOUND)
)
endif (Qt5WebEngine_FOUND)
if (Qt5NoWeb)
target_compile_options(musredit
BEFORE PRIVATE
-DHAVE_QT_NO_WEB
)
endif (Qt5NoWeb)
target_include_directories(musredit
BEFORE PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>

View File

@ -30,9 +30,13 @@
#include <QtWidgets>
#ifdef HAVE_QT_WEB_ENGINE
#include <QWebEngineView>
#else
#endif
#ifdef HAVE_QT_WEB_KIT
#include <QtWebKitWidgets>
#endif
#ifdef HAVE_QT_NO_WEB
#include <QPlainTextEdit>
#endif
#include <QNetworkProxyFactory>
#include <QtDebug>
@ -61,14 +65,24 @@ PHelp::PHelp(const QString &url, const bool isDarkTheme) :
#ifdef HAVE_QT_WEB_ENGINE
fView = new QWebEngineView(this);
#else
#endif
#ifdef HAVE_QT_WEB_KIT
fView = new QWebView(this);
#endif
#ifdef HAVE_QT_NO_WEB
fView = new QPlainTextEdit(this);
#endif
#ifndef HAVE_QT_NO_WEB
fView->load(QUrl(url));
connect(fView, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
connect(fView, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
connect(fView, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
connect(fView, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
#else
fView->setPlainText("Within the current setup there is NO Help available.");
fView->appendPlainText("The necessary Qt web libs where not found when setting up musredit.");
fView->setReadOnly(true);
#endif
fLocationEdit = new QLineEdit(this);
fLocationEdit->setSizePolicy(QSizePolicy::Expanding, fLocationEdit->sizePolicy().verticalPolicy());
@ -80,7 +94,8 @@ PHelp::PHelp(const QString &url, const bool isDarkTheme) :
toolBar->addAction(fView->pageAction(QWebEnginePage::Forward));
toolBar->addAction(fView->pageAction(QWebEnginePage::Reload));
toolBar->addAction(fView->pageAction(QWebEnginePage::Stop));
#else
#endif
#ifdef HAVE_QT_WEB_KIT
toolBar->addAction(fView->pageAction(QWebPage::Back));
toolBar->addAction(fView->pageAction(QWebPage::Forward));
toolBar->addAction(fView->pageAction(QWebPage::Reload));
@ -127,7 +142,9 @@ void PHelp::done()
*/
void PHelp::adjustLocation()
{
#ifndef HAVE_QT_NO_WEB
fLocationEdit->setText(fView->url().toString());
#endif
}
//---------------------------------------------------------------------------
@ -138,8 +155,10 @@ void PHelp::adjustLocation()
void PHelp::changeLocation()
{
QUrl url = QUrl(fLocationEdit->text());
#ifndef HAVE_QT_NO_WEB
fView->load(url);
fView->setFocus();
#endif
}
//---------------------------------------------------------------------------
@ -149,10 +168,12 @@ void PHelp::changeLocation()
*/
void PHelp::adjustTitle()
{
#ifndef HAVE_QT_NO_WEB
if (fProgress <= 0 || fProgress >= 100)
setWindowTitle(fView->title());
else
setWindowTitle(QString("%1 (%2%)").arg(fView->title()).arg(fProgress));
#endif
}
//---------------------------------------------------------------------------

View File

@ -34,7 +34,8 @@
#ifdef HAVE_QT_WEB_ENGINE
class QWebEngineView;
#else
#endif
#ifdef HAVE_QT_WEB_KIT
class QWebView;
#endif
QT_BEGIN_NAMESPACE
@ -66,8 +67,12 @@ class PHelp : public QMainWindow
bool fDarkTheme;
#ifdef HAVE_QT_WEB_ENGINE
QWebEngineView *fView; ///< web viewer
#else
#endif
#ifdef HAVE_QT_WEB_KIT
QWebView *fView; ///< web viewer
#endif
#ifdef HAVE_QT_NO_WEB
QPlainTextEdit *fView; ///< dialog stating that there is NO web viewer
#endif
QLineEdit *fLocationEdit; ///< url address line edit
int fProgress; ///< progress value (0-100) while loading an url