diff --git a/GUI/coregui/Views/Components/SampleDesigner/GroupProperty.cpp b/GUI/coregui/Models/GroupProperty.cpp similarity index 100% rename from GUI/coregui/Views/Components/SampleDesigner/GroupProperty.cpp rename to GUI/coregui/Models/GroupProperty.cpp diff --git a/GUI/coregui/Views/Components/SampleDesigner/GroupProperty.h b/GUI/coregui/Models/GroupProperty.h similarity index 100% rename from GUI/coregui/Views/Components/SampleDesigner/GroupProperty.h rename to GUI/coregui/Models/GroupProperty.h diff --git a/GUI/coregui/Models/JobQueueModel.cpp b/GUI/coregui/Models/JobQueueModel.cpp index b9991a78119eb003851740c60b7f370c8efe1530..1c070204163636a977f36b488189b21cfcf3d72d 100644 --- a/GUI/coregui/Models/JobQueueModel.cpp +++ b/GUI/coregui/Models/JobQueueModel.cpp @@ -2,7 +2,7 @@ #include "JobItem.h" #include "JobQueueItem.h" #include "JobRunner.h" -#include "mainwindow_constants.h" +//#include "mainwindow_constants.h" #include "Exceptions.h" #include "GUIHelpers.h" #include <QMimeData> @@ -125,7 +125,7 @@ bool JobQueueModel::removeRows(int position, int rows, const QModelIndex &/* par QStringList JobQueueModel::mimeTypes() const { - return QStringList() << Constants::MIME_JOBQUEUE; + return QStringList() << JobQueueXML::MimeType; } @@ -140,7 +140,7 @@ QMimeData *JobQueueModel::mimeData(const QModelIndexList &indices) const QByteArray encodedData; QDataStream dataStream(&encodedData, QIODevice::WriteOnly); dataStream << item->getIdentifier(); - mimeData->setData(Constants::MIME_JOBQUEUE, encodedData); + mimeData->setData(JobQueueXML::MimeType, encodedData); return mimeData; } @@ -151,7 +151,7 @@ bool JobQueueModel::dropMimeData(const QMimeData *data, Qt::DropAction action, if (action == Qt::IgnoreAction) return true; - if(!data->hasFormat(Constants::MIME_JOBQUEUE) || column>0) + if(!data->hasFormat(JobQueueXML::MimeType) || column>0) return false; int beginRow; @@ -162,7 +162,7 @@ bool JobQueueModel::dropMimeData(const QMimeData *data, Qt::DropAction action, else beginRow = rowCount(QModelIndex()); - QByteArray encodedData = data->data(Constants::MIME_JOBQUEUE); + QByteArray encodedData = data->data(JobQueueXML::MimeType); QDataStream dataStream(&encodedData, QIODevice::ReadOnly); QString identifier; dataStream >> identifier; diff --git a/GUI/coregui/Models/JobQueueModel.h b/GUI/coregui/Models/JobQueueModel.h index e1b13f67062cd315e4758cb0385a6be624fbe847..65f81884d80db59cee3dfacbea46c9743f74cbc3 100644 --- a/GUI/coregui/Models/JobQueueModel.h +++ b/GUI/coregui/Models/JobQueueModel.h @@ -39,6 +39,7 @@ namespace JobQueueXML const QString OutputDataInterpolatedAttribute("Interpolated"); const QString OutputDataXtitleAttribute("Xtitle"); const QString OutputDataYtitleAttribute("Ytitle"); + const QString MimeType("application/org.bornagainproject.jobqueue"); } diff --git a/GUI/coregui/Models/MaterialModel.cpp b/GUI/coregui/Models/MaterialModel.cpp index 0e8e75775dfd052cfbc7083c493955dd767b9790..be761a0c5a98238a6baa3effcfe6a8e72a55a912 100644 --- a/GUI/coregui/Models/MaterialModel.cpp +++ b/GUI/coregui/Models/MaterialModel.cpp @@ -1,7 +1,7 @@ #include "MaterialModel.h" #include "MaterialItem.h" #include "GUIHelpers.h" -#include "DesignerHelper.h" +//#include "DesignerHelper.h" #include <QFile> #include <QXmlStreamWriter> #include <QDebug> diff --git a/GUI/coregui/Models/ParameterizedItem.cpp b/GUI/coregui/Models/ParameterizedItem.cpp index 4a9ac7ef71e26234bc1426899a8741935cccd4c8..05b686990e8ef958543fc2725e8d6c9a29068417 100644 --- a/GUI/coregui/Models/ParameterizedItem.cpp +++ b/GUI/coregui/Models/ParameterizedItem.cpp @@ -18,11 +18,11 @@ #include "GroupProperty.h" #include "MaterialEditor.h" #include "GUIHelpers.h" +#include "PropertyVariantManager.h" #include <QEvent> #include <QDynamicPropertyChangeEvent> #include <QDebug> #include <QMetaEnum> -#include <PropertyVariantManager.h> const QString ParameterizedItem::P_NAME = "Name"; @@ -114,6 +114,7 @@ ParameterizedItem *ParameterizedItem::createPropertyItem(QString name) QByteArray name_byte_array = name.toUtf8(); QVariant val = property(name_byte_array.constData()); if (val.userType() == PropertyVariantManager::groupTypeId()) { + //if (val.userType() == qMetaTypeId<GroupProperty>()) { GroupProperty group_prop = val.value<GroupProperty>(); result = group_prop.createCorrespondingItem( group_prop.getValue()); diff --git a/GUI/coregui/Views/FitView.cpp b/GUI/coregui/Views/FitView.cpp deleted file mode 100644 index b50f64e426ece50faddb1341d386534d591ddc6b..0000000000000000000000000000000000000000 --- a/GUI/coregui/Views/FitView.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include "FitView.h" -#include "rootcanvas.h" - -//#include "TCanvas.h" -//#include "TH2D.h" -//#include "TRandom.h" -#include "QVBoxLayout" - -FitView::FitView(QWidget *parent) - : QWidget(parent) - , m_customPlot(0) -{ - - m_customPlot = new QCustomPlot(this); - m_customPlot->setObjectName(QString::fromUtf8("customPlot")); - - - -// RootCanvas *canvas = new RootCanvas(this); -// canvas->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - -// canvas->cd(); -// TH2D *h2 = new TH2D("hpxpy","py vs px",100,-2,2,100,-2,2); -// for(size_t i=0; i<500000; ++i) { -// double px, py; -// gRandom->Rannor(px, py); -// h2->Fill(px,py); -// } -// h2->Draw("CONT4 Z"); -// canvas->Update(); - - - -// // generate some data: -// QVector<double> x(101), y(101); // initialize with entries 0..100 -// for (int i=0; i<101; ++i) -// { -// x[i] = i/50.0 - 1; // x goes from -1 to 1 -// y[i] = x[i]*x[i]; // let's plot a quadratic function -// } -// // create graph and assign data to it: -// m_customPlot->addGraph(); -// m_customPlot->graph(0)->setData(x, y); -// // give the axes some labels: -// m_customPlot->xAxis->setLabel("x"); -// m_customPlot->yAxis->setLabel("y"); -// // set axes ranges, so we see all data: -// m_customPlot->xAxis->setRange(-1, 1); -// m_customPlot->yAxis->setRange(0, 1); - - - m_customPlot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); // this will also allow rescaling the color scale by dragging/zooming - m_customPlot->axisRect()->setupFullAxesBox(true); - m_customPlot->xAxis->setLabel("x"); - m_customPlot->yAxis->setLabel("y"); - - // set up the QCPColorMap: - QCPColorMap *colorMap = new QCPColorMap(m_customPlot->xAxis, m_customPlot->yAxis); - m_customPlot->addPlottable(colorMap); - int nx = 200; - int ny = 200; - colorMap->data()->setSize(nx, ny); // we want the color map to have nx * ny data points - colorMap->data()->setRange(QCPRange(-4, 4), QCPRange(-4, 4)); // and span the coordinate range -4..4 in both key (x) and value (y) dimensions - // now we assign some data, by accessing the QCPColorMapData instance of the color map: - double x, y, z; - for (int xIndex=0; xIndex<nx; ++xIndex) - { - for (int yIndex=0; yIndex<ny; ++yIndex) - { - colorMap->data()->cellToCoord(xIndex, yIndex, &x, &y); - double r = 3*qSqrt(x*x+y*y)+1e-2; - z = 2*x*(qCos(r+2)/r-qSin(r+2)/r); // the B field strength of dipole radiation (modulo physical constants) - colorMap->data()->setCell(xIndex, yIndex, z); - } - } - - // add a color scale: - QCPColorScale *colorScale = new QCPColorScale(m_customPlot); - m_customPlot->plotLayout()->addElement(0, 1, colorScale); // add it to the right of the main axis rect - colorScale->setType(QCPAxis::atRight); // scale shall be vertical bar with tick/axis labels right (actually atRight is already the default) - colorMap->setColorScale(colorScale); // associate the color map with the color scale - colorScale->axis()->setLabel("Magnetic Field Strength"); - - // set the color gradient of the color map to one of the presets: - colorMap->setGradient(QCPColorGradient::gpPolar); - // we could have also created a QCPColorGradient instance and added own colors to - // the gradient, see the documentation of QCPColorGradient for what's possible. - - // rescale the data dimension (color) such that all data points lie in the span visualized by the color gradient: - colorMap->rescaleDataRange(); - - // make sure the axis rect and color scale synchronize their bottom and top margins (so they line up): - QCPMarginGroup *marginGroup = new QCPMarginGroup(m_customPlot); - m_customPlot->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup); - colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup); - - // rescale the key (x) and value (y) axes so the whole color map is visible: - m_customPlot->rescaleAxes(); - - - - - - QVBoxLayout *mainLayout = new QVBoxLayout; - //mainLayout->addWidget(canvas); - mainLayout->addWidget(m_customPlot); - setLayout(mainLayout); - -} - - diff --git a/GUI/coregui/Views/FitView.h b/GUI/coregui/Views/FitView.h deleted file mode 100644 index b7f88a5d2b7e37a5619a1bcff9184fef0d4473a8..0000000000000000000000000000000000000000 --- a/GUI/coregui/Views/FitView.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef FITMANAGER_H -#define FITMANAGER_H - -#include <QWidget> -#include "qcustomplot.h" - -class FitView : public QWidget -{ - Q_OBJECT - -public: - FitView(QWidget *parent = 0); - virtual ~FitView(){} - - QCustomPlot *m_customPlot; -}; - - -#endif // FITMANAGER_H diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 00a688c9197cbaa7290608208f1d0c5ea82816e8..5569d6f4db0c7e083cb779fb72958eabe444614a 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -7,7 +7,6 @@ #include "PyScriptView.h" #include "InstrumentView.h" #include "SimulationView.h" -#include "FitView.h" #include "JobQueueView.h" #include "TestView.h" #include "MaterialEditorWidget.h" @@ -40,6 +39,9 @@ #include <QApplication> #include <QStatusBar> +#include <QSettings> +#include <QCloseEvent> +#include <QDebug> MainWindow::MainWindow(QWidget *parent) : Manhattan::FancyMainWindow(parent) @@ -49,7 +51,6 @@ MainWindow::MainWindow(QWidget *parent) , m_sampleView(0) , m_scriptView(0) , m_simulationView(0) - , m_fitView(0) , m_jobQueueView(0) , m_progressBar(0) , m_actionManager(0) @@ -100,7 +101,6 @@ MainWindow::MainWindow(QWidget *parent) m_scriptView = new PyScriptView(mp_sim_data_model); m_simulationView = new SimulationView(mp_sim_data_model); m_simulationView->setJobQueueModel(m_jobQueueModel); - m_fitView = new FitView(); m_jobQueueView = new JobQueueView(m_jobQueueModel); m_tabWidget->insertTab(WelcomeTab, m_welcomeView, QIcon(":/images/main_home.png"), "Welcome"); @@ -108,7 +108,6 @@ MainWindow::MainWindow(QWidget *parent) m_tabWidget->insertTab(SampleTab, m_sampleView, QIcon(":/images/main_sample.png"), "Sample"); //m_tabWidget->insertTab(3, m_scriptView, QIcon(":/images/mode_script.png"), "Python scripts"); m_tabWidget->insertTab(SimulationTab, m_simulationView, QIcon(":/images/main_simulation.png"), "Simulation"); - //m_tabWidget->insertTab(6, m_fitView, QIcon(":/images/mode_fit.png"), "Fit"); m_tabWidget->insertTab(JobTab, m_jobQueueView, QIcon(":/images/main_jobqueue.png"), "Jobs"); m_tabWidget->setCurrentIndex(WelcomeTab); diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index f28c13d503a7386adf4b8795133375cf292fc1d3..c37a5ea15c99aaf07f823ec4f9b5695027970ef4 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -18,7 +18,6 @@ class SampleView; class PyScriptView; class SimulationView; class JobView; -class FitView; class JobQueueView; class SimulationDataModel; class Instrument; @@ -71,7 +70,6 @@ private: SampleView *m_sampleView; PyScriptView *m_scriptView; SimulationView *m_simulationView; - FitView * m_fitView; JobQueueView * m_jobQueueView; Manhattan::ProgressBar *m_progressBar; diff --git a/GUI/coregui/utils/customcanvas.cpp b/GUI/coregui/utils/customcanvas.cpp deleted file mode 100644 index b347570b11585b6b3d179d9ea04d1c5c072287f2..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/customcanvas.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "customcanvas.h" -#include "QVBoxLayout" - -CustomCanvas::CustomCanvas(QWidget *parent) - : ICanvas(parent) - , m_data(0) -{ - - m_customPlot = new QCustomPlot(this); - m_customPlot->setObjectName(QString::fromUtf8("customPlot")); - - QVBoxLayout *mainLayout = new QVBoxLayout; - //mainLayout->addWidget(canvas); - mainLayout->addWidget(m_customPlot); - setLayout(mainLayout); - -} - - -void CustomCanvas::Draw(const OutputData<double> *data) -{ - Q_ASSERT(data); - - if(data->getRank() != 2) { - throw NullPointerException("CustomCanvas::Draw() -> Error. Zero pointer to the data to draw"); - } - - if(data == m_data) return; - m_data = data; - - m_customPlot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); // this will also allow rescaling the color scale by dragging/zooming - m_customPlot->axisRect()->setupFullAxesBox(true); - m_customPlot->xAxis->setLabel("x"); - m_customPlot->yAxis->setLabel("y"); - - const IAxis *axis_x = data->getAxis(0); - const IAxis *axis_y = data->getAxis(1); - - // set up the QCPColorMap: - QCPColorMap *colorMap = new QCPColorMap(m_customPlot->xAxis, m_customPlot->yAxis); - m_customPlot->addPlottable(colorMap); - - int nx = axis_x->getSize(); - int ny = axis_y->getSize(); - colorMap->data()->setSize(nx, ny); // we want the color map to have nx * ny data points - colorMap->data()->setRange(QCPRange(axis_x->getMin(), axis_x->getMax()), QCPRange(axis_y->getMin(), axis_y->getMax())); // and span the coordinate range -4..4 in both key (x) and value (y) dimensions - - - OutputData<double>::const_iterator it = data->begin(); - while (it != data->end()) { - std::vector<int> indices = - data->toCoordinates(it.getIndex()); - - colorMap->data()->setCell(indices[0], indices[1], *it); - ++it; - } - - - // add a color scale: - QCPColorScale *colorScale = new QCPColorScale(m_customPlot); - m_customPlot->plotLayout()->addElement(0, 1, colorScale); // add it to the right of the main axis rect - - colorScale->setDataScaleType(QCPAxis::stLogarithmic); - - colorScale->setType(QCPAxis::atRight); // scale shall be vertical bar with tick/axis labels right (actually atRight is already the default) - colorMap->setColorScale(colorScale); // associate the color map with the color scale - colorScale->axis()->setLabel("Magnetic Field Strength"); - - // set the color gradient of the color map to one of the presets: - colorMap->setGradient(QCPColorGradient::gpPolar); - // we could have also created a QCPColorGradient instance and added own colors to - // the gradient, see the documentation of QCPColorGradient for what's possible. - - // rescale the data dimension (color) such that all data points lie in the span visualized by the color gradient: - colorMap->rescaleDataRange(); - - // make sure the axis rect and color scale synchronize their bottom and top margins (so they line up): - QCPMarginGroup *marginGroup = new QCPMarginGroup(m_customPlot); - m_customPlot->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup); - colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup); - - // rescale the key (x) and value (y) axes so the whole color map is visible: - m_customPlot->rescaleAxes(); -} diff --git a/GUI/coregui/utils/customcanvas.h b/GUI/coregui/utils/customcanvas.h deleted file mode 100644 index d7500222e730b64f7b471e979302bad88f73e1da..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/customcanvas.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CUSTOMCANVAS_H -#define CUSTOMCANVAS_H - -#include <QWidget> -#include "qcustomplot.h" -#include "OutputData.h" - -class ICanvas: public QWidget -{ - Q_OBJECT - -public: - explicit ICanvas(QWidget *parent = 0) : QWidget(parent){} - virtual ~ICanvas(){} - virtual void Draw(const OutputData<double> *){} -}; - - -class CustomCanvas : public ICanvas -{ - Q_OBJECT - -public: - explicit CustomCanvas(QWidget *parent = 0); - virtual ~CustomCanvas(){} - - virtual void Draw(const OutputData<double> *data); - -private: - QCustomPlot *m_customPlot; - const OutputData<double> *m_data; - -}; - - -#endif - diff --git a/GUI/coregui/mainwindow/hostosinfo.h b/GUI/coregui/utils/hostosinfo.h similarity index 100% rename from GUI/coregui/mainwindow/hostosinfo.h rename to GUI/coregui/utils/hostosinfo.h diff --git a/GUI/coregui/utils/rootcanvas.cpp b/GUI/coregui/utils/rootcanvas.cpp deleted file mode 100644 index 649ec48d25ba68deeb7f4bd3f85ff5b2c59cb55d..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/rootcanvas.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "rootcanvas.h" - -/* - -#include "TQtWidget.h" -#include "TObject.h" -#include "TCanvas.h" - -#include <QEvent> -#include <QMenu> -#include <QMouseEvent> -#include <QVBoxLayout> -#include <QStatusBar> -#include <QLabel> - -#include <iostream> - - -bool RCEventHandler::eventFilter(QObject *obj, QEvent *event) -{ - // given hadnler doesn nothing for right mouse button event simply passing it to parent widget - if (event->type() == QEvent::ContextMenu) { - QMouseEvent *mouseEvent = static_cast<QMouseEvent*> (event); - send_rightButtonClicked(mouseEvent->globalPos()); - return true; - } else { - return QObject::eventFilter(obj, event); - } -} - - -RootCanvas::RootCanvas(QWidget *parent) - : QWidget(parent) - , m_show_info(false) -{ - - setMinimumSize(512, 512); - - m_qtroot_widget = new TQtWidget(this,"qt-canvas"); - m_qtroot_widget->EnableSignalEvents(kMousePressEvent); - m_qtroot_widget->EnableSignalEvents(kMouseMoveEvent); - //m_qtroot_widget->setAttribute(Qt::WA_TransparentForMouseEvents); - - //m_status_bar = new QStatusBar(this); - // m_status_bar->setSizeGripEnabled(false); -// m_status_bar->showMessage("HelloWorld"); - m_status_bar = new QLabel(this); - m_status_bar->setVisible(m_show_info); - m_status_bar->setText("Hello World"); - -// QLabel label; - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(m_qtroot_widget); - layout->addWidget(m_status_bar); - setLayout(layout); - -// installEventFilter(this); - - //RCEventHandler *evHandler = new RCEventHandler(this); - // installing handler to root widget to skip right mouse button events - //m_qtroot_widget->installEventFilter(evHandler); - //connect(evHandler, SIGNAL(send_rightButtonClicked(const QPoint&)), this, SLOT(rightButtonClicked(const QPoint&))); - //connect(evHandler, SIGNAL(send_rightButtonClicked(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&))); - - setContextMenuPolicy(Qt::CustomContextMenu); - m_qtroot_widget->setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&))); - connect(m_qtroot_widget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&))); - - connect(m_qtroot_widget, SIGNAL(RootEventProcessed(TObject *,unsigned int, TCanvas *)), this,SLOT(CanvasEvent(TObject *, unsigned int, TCanvas *))); - -} - - -// show context menu for root canvas -void RootCanvas::ShowContextMenu(const QPoint& pos) -{ - QPoint globalPos = this->mapToGlobal(pos); - - QString ResetActionName("Reset"); - QString StatusBarActionName("Show status bar"); - if(m_show_info) StatusBarActionName = "Hide status bar"; - - QMenu myMenu; - myMenu.addAction(ResetActionName); - myMenu.addAction(StatusBarActionName); - - QAction* selectedItem = myMenu.exec(globalPos); - if (selectedItem) { - if( selectedItem->text() == ResetActionName ) { - std::cout << "AAA " << "reset was choosen" << std::endl; - } else if( selectedItem->text() == StatusBarActionName ) { - std::cout << "AAA " << "hide status bar was" << std::endl; - m_show_info =! m_show_info; - m_status_bar->setVisible(m_show_info); - } - } - // otherwise nothing was choosen - -} - - -// simple cd inside ROOT canvas -void RootCanvas::cd() -{ - m_qtroot_widget->GetCanvas()->cd(); -} - -// redraw ROOT canvas -void RootCanvas::Update() -{ - m_qtroot_widget->GetCanvas()->Modified(); - m_qtroot_widget->GetCanvas()->Update(); -} - - -// print ROOT canvas object info in status bar -void RootCanvas::CanvasEvent(TObject *object,unsigned int event,TCanvas *canvas) -{ - assert(object); - (void)event; - (void)canvas; - TQtWidget *tipped = (TQtWidget *)sender(); - const char *objectInfo = object->GetObjectInfo( tipped->GetEventX(),tipped->GetEventY() ); - //m_status_bar->showMessage(objectInfo); - m_status_bar->setText(objectInfo); - } - - -//void RootCanvas::rightButtonClicked(const QPoint &pos) -//{ -// (void)pos; -//} - - -//bool RootCanvas::eventFilter(QObject *obj, QEvent *event) -//{ -// if(event->type() == QEvent::ContextMenu) { -// QMouseEvent *mouseEvent = static_cast<QMouseEvent*> (event); -// QMenu *menu = new QMenu(this); - -// menu->addAction(new QAction("New",this)); -// menu->addAction(new QAction("Edit",this)); -// menu->addAction(new QAction("Delete",this)); -// menu->exec(mouseEvent->globalPos()); -// //menu->exec(mouseEvent->pos()); -// return false; -// } else { -// return QWidget::eventFilter(obj, event); -// } -//} - - -*/ diff --git a/GUI/coregui/utils/rootcanvas.h b/GUI/coregui/utils/rootcanvas.h deleted file mode 100644 index a40d197de86a9b418fcd7d293d40eb32911eb30c..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/rootcanvas.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef ROOTCANVAS_H -#define ROOTCANVAS_H - - -/* - -#include <QWidget> - -class QObject; -class QEvent; -class TQtWidget; -class QPoint; -class QStatusBar; -class TObject; -class TCanvas; -class QLabel; - - - -// ---------------------------------------------------------------------------- -// Handles right mouse events -// ---------------------------------------------------------------------------- -class RCEventHandler : public QObject -{ -Q_OBJECT -public: - explicit RCEventHandler(QObject *parent = 0) : QObject(parent) {} - -protected: - bool eventFilter(QObject *obj, QEvent *event); - -signals: - void send_rightButtonClicked(const QPoint &p); - -}; - - -// ---------------------------------------------------------------------------- -// Wrapper around root canvas widget -// ---------------------------------------------------------------------------- -class RootCanvas : public QWidget -{ - Q_OBJECT - -public: - explicit RootCanvas(QWidget *parent = 0); - virtual ~RootCanvas(){} - - void cd(); - void Update(); - -public slots: -// void rightButtonClicked(const QPoint &pos); - void ShowContextMenu(const QPoint& pos); - void CanvasEvent(TObject *obj,unsigned int event,TCanvas *); - - -private: -// bool eventFilter(QObject *, QEvent *); - - TQtWidget *m_qtroot_widget; - //QStatusBar *m_status_bar; - QLabel *m_status_bar; - - bool m_show_info; - -}; - - -*/ - -#endif // ROOTCANVAS_H diff --git a/Tests/FunctionalTests/CMakeLists.txt b/Tests/FunctionalTests/CMakeLists.txt index 15a832d95bddb82cc71580e8031b02a4918b0134..421f6080e45c9b3c2df30575e87f63b5a3d8180e 100644 --- a/Tests/FunctionalTests/CMakeLists.txt +++ b/Tests/FunctionalTests/CMakeLists.txt @@ -18,15 +18,15 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/T #file(COPY ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit DESTINATION ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit) #COPY_IF_DIFFERENT( ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit ${SRC_FILES} IncludeTargets "Includes") -#if(BORNAGAIN_GUI) -# add_subdirectory(TestGUI) -#endif() - -add_subdirectory(TestCore) -add_subdirectory(TestFit) -if(BORNAGAIN_PYTHON) - add_subdirectory(TestPyCore) - add_subdirectory(TestPyFit) +if(BORNAGAIN_GUI) + add_subdirectory(TestGUI) endif() +#add_subdirectory(TestCore) +#add_subdirectory(TestFit) +#if(BORNAGAIN_PYTHON) +# add_subdirectory(TestPyCore) +# add_subdirectory(TestPyFit) +#endif() + diff --git a/Tests/FunctionalTests/TestGUI/CMakeLists.txt b/Tests/FunctionalTests/TestGUI/CMakeLists.txt index c83c2f9b62793d338964e360ef87a17d43934c44..00217d02355ee37e2ffb8d6bae0b4abd21ce5633 100644 --- a/Tests/FunctionalTests/TestGUI/CMakeLists.txt +++ b/Tests/FunctionalTests/TestGUI/CMakeLists.txt @@ -1,28 +1,8 @@ # CMakeLists.txt file for building and running TestGUI functional tests -set(list_of_tests - "GUIExample01" -) - -# for some reason these flags doesn't propagated here by SetUpWindows.cmake -if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc ") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHsc ") -endif() - -include_directories( - ${Boost_INCLUDE_DIRS} - ${BornAgainCore_INCLUDE_DIRS} - ${BornAgainFit_INCLUDE_DIRS} - ${EIGEN3_INCLUDE_DIR} - ${GSL_INCLUDE_DIR} -) - find_package(Qt5Widgets REQUIRED) -foreach(_test ${list_of_tests}) - BORNAGAIN_EXECUTABLE(${_test} LOCATIONS ${_test} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainFit_LIBRARY} ${BornAgainCore_LIBRARY}) - BORNAGAIN_ADD_TEST(${_test}) -endforeach() +message("YYY ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}") +#add_subdirectory(GUIExample01) diff --git a/Tests/FunctionalTests/TestGUI/GUIExample01/CMakeLists.txt b/Tests/FunctionalTests/TestGUI/GUIExample01/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d48644def8bc5b577a2d844d8a919806c13fafcd --- /dev/null +++ b/Tests/FunctionalTests/TestGUI/GUIExample01/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) + +if(POLICY CMP0020) +cmake_policy(SET CMP0020 NEW) +endif() + +set(executable_name GUIExample01) + +# --- source and include files --- +set(include_dirs +# ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow + ${CMAKE_SOURCE_DIR}/GUI/coregui/utils + ${CMAKE_SOURCE_DIR}/GUI/coregui/Models +# ${CMAKE_CURRENT_SOURCE_DIR}/Views +# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/widgetbox +# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/SampleDesigner +# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/JobQueueWidgets +# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/OutputDataWidgets + ${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor +# ${CMAKE_CURRENT_SOURCE_DIR}/Views/Components/InstrumentWidgets +) +include_directories(${include_dirs}) + +file(GLOB source_files + "*.cpp" + "${CMAKE_SOURCE_DIR}/GUI/coregui/utils/*.cpp" + "${CMAKE_SOURCE_DIR}/GUI/coregui/Models/*.cpp" +# "Views/*.cpp" +# "Views/Components/SampleDesigner/*.cpp" +# "Views/Components/JobQueueWidgets/*.cpp" +# "Views/Components/OutputDataWidgets/*.cpp" + "${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor/*.cpp" +# "Views/Components/InstrumentWidgets/*.cpp" +) + +#set(source_widgetbox +# "Views/Components/widgetbox/widgetboxcategorylistview.cpp" +# "Views/Components/widgetbox/widgetboxtreewidget.cpp" +# "Views/Components/widgetbox/widgetbox.cpp" +# "Views/Components/widgetbox/widgetbox_dnditem.cpp" +#) +#list(APPEND source_files ${source_widgetbox}) + +file(GLOB include_files +# "mainwindow/*.h" + "${CMAKE_SOURCE_DIR}/GUI/coregui/utils/*.h" + "${CMAKE_SOURCE_DIR}/GUI/coregui/Models/*.h" +# "Views/*.h" +# "Views/Components/SampleDesigner/*.h" +# "Views/Components/JobQueueWidgets/*.h" +# "Views/Components/OutputDataWidgets/*.h" + "${CMAKE_SOURCE_DIR}/GUI/coregui/Views/Components/MaterialEditor/*.h" +# "Views/Components/InstrumentWidgets/*.h" +) + +#set(include_widgetbox +# "Views/Components/widgetbox/widgetboxcategorylistview.h" +# "Views/Components/widgetbox/widgetboxtreewidget.h" +# "Views/Components/widgetbox/widgetbox.h" +# "Views/Components/widgetbox/widgetbox_dnditem.h" +# "Views/Components/widgetbox/widgetbox_global.h" +#) +#list(APPEND include_files ${include_widgetbox}) + + +#set(resource_files +# "coregui.qrc" +## "qttools/qtpropertybrowser/qtpropertybrowser.qrc" +# "Views/Components/SampleDesigner/SampleDesigner.qrc" +# "Views/Components/widgetbox/widgetbox.qrc" +#) + +message("XXX 1.1 ${executable_name} ${source_files} ${include_files}") + +set(CMAKE_AUTOMOC ON) +qt5_add_resources(RC_SRCS ${resource_files}) +add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x040900) + +#add_executable(${executable_name} ${source_files} ${RC_SRCS} ${include_files}) +add_executable(${executable_name} ${source_files} ${include_files}) + +qt5_use_modules(${executable_name} Widgets Core Gui Script Designer PrintSupport) + +# --- dependencies --- +include_directories( +# ${qcustomplot_INCLUDE_DIRS} + ${qtpropertybrowser_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${BornAgainCore_INCLUDE_DIRS} + ${BornAgainFit_INCLUDE_DIRS} +# ${ManhattanStyle_INCLUDE_DIRS} + ${EIGEN3_INCLUDE_DIR} + ${PYTHON_INCLUDE_DIRS} +) + + +target_link_libraries(${executable_name} +# ${ManhattanStyle_LIBRARY} +# ${qcustomplot_LIBRARY} + ${qtpropertybrowser_LIBRARY} + ${PYTHON_LIBRARY} + ${Boost_LIBRARIES} + ${BornAgainCore_LIBRARY} + ${BornAgainFit_LIBRARY} +) +