##// END OF EJS Templates
variable time is now set to range graphe displayed when it is displayed...
variable time is now set to range graphe displayed when it is displayed in it

File last commit:

r308:d6942e8f24d6
r314:85f427f84e81
Show More
MainWindow.cpp
259 lines | 9.6 KiB | text/x-c | CppLexer
Initialisation de l'application multithread avec le spimpl....
r21 /*------------------------------------------------------------------------------
Refactoring of app module to avoir vera++ warning and to dispatch sources files in the corrects paths
r54 -- This file is a part of the SciQLop Software
-- Copyright (C) 2017, Plasma Physics Laboratory - CNRS
Initialisation de l'application multithread avec le spimpl....
r21 --
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-------------------------------------------------------------------------------*/
/*-- Author : Alexis Jeandet
-- Mail : alexis.jeandet@member.fsf.org
----------------------------------------------------------------------------*/
Refactoring of app module to avoir vera++ warning and to dispatch sources files in the corrects paths
r54 #include "MainWindow.h"
#include "ui_MainWindow.h"
Alexandre Leroux
Connects data source widget to data source controller
r84
#include <DataSource/DataSourceController.h>
#include <DataSource/DataSourceWidget.h>
Add button on the SidePane widgets to open left or right inspectors
r101 #include <SidePane/SqpSidePane.h>
Alexandre Leroux
Connects data source widget to data source controller
r84 #include <SqpApplication.h>
add TimeWidget connection
r192 #include <Time/TimeController.h>
Modificaiton of the sidepane :...
r133 #include <TimeWidget/TimeWidget.h>
Alexandre Leroux
Creates the slot to display the created variable in the Visualization widget...
r175 #include <Variable/Variable.h>
Temporal parameters of the selected variables can be updated using the...
r304 #include <Variable/VariableController.h>
Alexandre Leroux
Creates the slot to display the created variable in the Visualization widget...
r175 #include <Visualization/VisualizationController.h>
Alexandre Leroux
Connects data source widget to data source controller
r84
Initialisation de l'application multithread avec le spimpl....
r21 #include <QAction>
#include <QDate>
#include <QDateTime>
#include <QDir>
#include <QFileDialog>
Add button on the SidePane widgets to open left or right inspectors
r101 #include <QToolBar>
Factorisation of the lambda connected to the side pane button
r138 #include <QToolButton>
Add button on the SidePane widgets to open left or right inspectors
r101 #include <memory.h>
comment omp.h to ensure the compilation from the command line
r29 //#include <omp.h>
Initialisation de l'application multithread avec le spimpl....
r21 //#include <network/filedownloader.h>
//#include <qlopdatabase.h>
//#include <qlopsettings.h>
//#include <qlopgui.h>
//#include <spacedata.h>
//#include "qlopcore.h"
//#include "qlopcodecmanager.h"
//#include "cdfcodec.h"
//#include "amdatxtcodec.h"
//#include <qlopplotmanager.h>
Add button on the SidePane widgets to open left or right inspectors
r101
#include "iostream"
Q_LOGGING_CATEGORY(LOG_MainWindow, "MainWindow")
PRC: add tr on text...
r102 namespace {
const auto LEFTMAININSPECTORWIDGETSPLITTERINDEX = 0;
const auto LEFTINSPECTORSIDEPANESPLITTERINDEX = 1;
const auto VIEWPLITTERINDEX = 2;
const auto RIGHTINSPECTORSIDEPANESPLITTERINDEX = 3;
const auto RIGHTMAININSPECTORWIDGETSPLITTERINDEX = 4;
}
Add button on the SidePane widgets to open left or right inspectors
r101 class MainWindow::MainWindowPrivate {
public:
QSize m_LastOpenLeftInspectorSize;
QSize m_LastOpenRightInspectorSize;
};
MainWindow::MainWindow(QWidget *parent)
: QMainWindow{parent},
m_Ui{new Ui::MainWindow},
impl{spimpl::make_unique_impl<MainWindowPrivate>()}
Initialisation de l'application multithread avec le spimpl....
r21 {
Refactoring of app module to avoir vera++ warning and to dispatch sources files in the corrects paths
r54 m_Ui->setupUi(this);
Add skelleton of the gui
r56
PRC: add tr on text...
r102 m_Ui->splitter->setCollapsible(LEFTINSPECTORSIDEPANESPLITTERINDEX, false);
m_Ui->splitter->setCollapsible(RIGHTINSPECTORSIDEPANESPLITTERINDEX, false);
Add button on the SidePane widgets to open left or right inspectors
r101
Modificaiton of the sidepane :...
r133
auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane();
Correction MR
r139 auto openLeftInspectorAction = new QAction{QIcon{
":/icones/previous.png",
},
tr("Show/hide the left inspector"), this};
Modificaiton of the sidepane :...
r133
Correction MR
r139 auto spacerLeftTop = new QWidget{};
Modificaiton of the sidepane :...
r133 spacerLeftTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Correction MR
r139 auto spacerLeftBottom = new QWidget{};
Modificaiton of the sidepane :...
r133 spacerLeftBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
leftSidePane->addWidget(spacerLeftTop);
leftSidePane->addAction(openLeftInspectorAction);
leftSidePane->addWidget(spacerLeftBottom);
auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane();
Correction MR
r139 auto openRightInspectorAction = new QAction{QIcon{
":/icones/next.png",
},
tr("Show/hide the right inspector"), this};
Modificaiton of the sidepane :...
r133
Correction MR
r139 auto spacerRightTop = new QWidget{};
Modificaiton of the sidepane :...
r133 spacerRightTop->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Correction MR
r139 auto spacerRightBottom = new QWidget{};
Modificaiton of the sidepane :...
r133 spacerRightBottom->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
rightSidePane->addWidget(spacerRightTop);
rightSidePane->addAction(openRightInspectorAction);
rightSidePane->addWidget(spacerRightBottom);
openLeftInspectorAction->setCheckable(true);
openRightInspectorAction->setCheckable(true);
Factorisation of the lambda connected to the side pane button
r138 auto openInspector = [this](bool checked, bool right, auto action) {
Modificaiton of the sidepane :...
r133
Factorisation of the lambda connected to the side pane button
r138 action->setIcon(QIcon{(checked xor right) ? ":/icones/next.png" : ":/icones/previous.png"});
Modificaiton of the sidepane :...
r133
Factorisation of the lambda connected to the side pane button
r138 auto &lastInspectorSize
= right ? impl->m_LastOpenRightInspectorSize : impl->m_LastOpenLeftInspectorSize;
auto nextInspectorSize = right ? m_Ui->rightMainInspectorWidget->size()
: m_Ui->leftMainInspectorWidget->size();
Add button on the SidePane widgets to open left or right inspectors
r101
// Update of the last opened geometry
if (checked) {
Factorisation of the lambda connected to the side pane button
r138 lastInspectorSize = nextInspectorSize;
Add button on the SidePane widgets to open left or right inspectors
r101 }
Factorisation of the lambda connected to the side pane button
r138 auto startSize = lastInspectorSize;
Add button on the SidePane widgets to open left or right inspectors
r101 auto endSize = startSize;
endSize.setWidth(0);
Factorisation of the lambda connected to the side pane button
r138 auto splitterInspectorIndex
= right ? RIGHTMAININSPECTORWIDGETSPLITTERINDEX : LEFTMAININSPECTORWIDGETSPLITTERINDEX;
PRC: add tr on text...
r102 auto currentSizes = m_Ui->splitter->sizes();
Add button on the SidePane widgets to open left or right inspectors
r101 if (checked) {
// adjust sizes individually here, e.g.
Factorisation of the lambda connected to the side pane button
r138 currentSizes[splitterInspectorIndex] -= lastInspectorSize.width();
currentSizes[VIEWPLITTERINDEX] += lastInspectorSize.width();
Add button on the SidePane widgets to open left or right inspectors
r101 m_Ui->splitter->setSizes(currentSizes);
}
else {
// adjust sizes individually here, e.g.
Factorisation of the lambda connected to the side pane button
r138 currentSizes[splitterInspectorIndex] += lastInspectorSize.width();
currentSizes[VIEWPLITTERINDEX] -= lastInspectorSize.width();
Add button on the SidePane widgets to open left or right inspectors
r101 m_Ui->splitter->setSizes(currentSizes);
}
};
Modificaiton of the sidepane :...
r133
Factorisation of the lambda connected to the side pane button
r138 connect(openLeftInspectorAction, &QAction::triggered,
[openInspector, openLeftInspectorAction](bool checked) {
openInspector(checked, false, openLeftInspectorAction);
Modificaiton of the sidepane :...
r133 });
Factorisation of the lambda connected to the side pane button
r138 connect(openRightInspectorAction, &QAction::triggered,
[openInspector, openRightInspectorAction](bool checked) {
openInspector(checked, true, openRightInspectorAction);
Modificaiton of the sidepane :...
r133 });
Add button on the SidePane widgets to open left or right inspectors
r101
PRC: add tr on text...
r102 this->menuBar()->addAction(tr("File"));
auto mainToolBar = this->addToolBar(QStringLiteral("MainToolBar"));
Modificaiton of the sidepane :...
r133
add TimeWidget connection
r192 auto timeWidget = new TimeWidget{};
mainToolBar->addWidget(timeWidget);
Alexandre Leroux
Connects data source widget to data source controller
r84
// Widgets / controllers connections
add TimeWidget connection
r192
// DataSource
Alexandre Leroux
Change signal/slot signature for data source
r92 connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem *)),
m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem *)));
Alexandre Leroux
Connects data source widget to data source controller
r84
add TimeWidget connection
r192 // Time
connect(timeWidget, SIGNAL(timeUpdated(SqpDateTime)), &sqpApp->timeController(),
SLOT(onTimeToUpdate(SqpDateTime)));
Temporal parameters of the selected variables can be updated using the...
r304 connect(&sqpApp->timeController(), SIGNAL(timeUpdated(SqpDateTime)),
&sqpApp->variableController(), SLOT(onDateTimeOnSelection(SqpDateTime)));
Alexandre Leroux
Connects variable widget to visualization widget...
r249 // Widgets / widgets connections
// For the following connections, we use DirectConnection to allow each widget that can
// potentially attach a menu to the variable's menu to do so before this menu is displayed.
// The order of connections is also important, since it determines the order in which each
// widget will attach its menu
Alexandre Leroux
Changes signal to pass a list of variables...
r288 connect(
m_Ui->variableInspectorWidget,
SIGNAL(tableMenuAboutToBeDisplayed(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
m_Ui->view, SLOT(attachVariableMenu(QMenu *, const QVector<std::shared_ptr<Variable> > &)),
Qt::DirectConnection);
Alexandre Leroux
Creates the slot to display the created variable in the Visualization widget...
r175
Initialisation de l'application multithread avec le spimpl....
r21 /* QLopGUI::registerMenuBar(menuBar());
this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
this->m_progressWidget = new QWidget();
this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
this->m_progressWidget->setLayout(this->m_progressLayout);
this->m_progressWidget->setWindowModality(Qt::WindowModal);
m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
for(int i=0;i<OMP_THREADS;i++)
{
this->m_progress.append(new QProgressBar(this->m_progressWidget));
this->m_progress.last()->setMinimum(0);
this->m_progress.last()->setMaximum(100);
this->m_progressLayout->addWidget(this->m_progress.last());
this->m_progressWidget->hide();
this->m_progressThreadIds[i] = -1;
}
this->m_progressWidget->setWindowTitle("Loading File");
const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
<< QLopCore::self()
<< QLopPlotManager::self()
<< QLopCodecManager::self()
<< FileDownloader::self()
<< QLopDataBase::self()
<< SpaceData::self();
CDFCodec::registerToManager();
AMDATXTCodec::registerToManager();
for(int i=0;i<ServicesToLoad.count();i++)
{
qDebug()<<ServicesToLoad.at(i)->serviceName();
ServicesToLoad.at(i)->initialize(); //must be called before getGUI
QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
if(wdgt)
{
wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
}
PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
}*/
}
MainWindow::~MainWindow()
{
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
Refactoring of app module to avoir vera++ warning and to dispatch sources files in the corrects paths
r54 m_Ui->retranslateUi(this);
Initialisation de l'application multithread avec le spimpl....
r21 break;
default:
break;
}
}