##// END OF EJS Templates
Spec file ready for rpm packaging....
Spec file ready for rpm packaging. Added automaic name generation for cassini toolbox/export function. Started QLopDataBase viewer.

File last commit:

r13:c0cb4ee23d25 default
r13:c0cb4ee23d25 default
Show More
mainwindow.cpp
146 lines | 4.3 KiB | text/x-c | CppLexer
/*------------------------------------------------------------------------------
-- This file is a part of the QLop Software
-- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
--
-- 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
----------------------------------------------------------------------------*/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QDir>
#include "qcustomplot.h"
#include <omp.h>
#include <QAction>
#include <downloadhistory.h>
#include <QDateTime>
#include <QDate>
#include <filedownloader.h>
#include <cassinitools.h>
#include <qlopplots.h>
const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
<<FileDownloader::self()
<<CassiniTools::self()
<< QLopPlots::self();
MainWindow::MainWindow(int OMP_THREADS, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
this->OMP_THREADS = OMP_THREADS;
ui->setupUi(this);
this->setWindowIcon(QIcon(":img/QLop.svg"));
// QLopPlots::getPlot()->setXaxisTickLabelType(QCPAxis::ltDateTime);
// QLopPlots::getPlot()->setXaxisDateTimeFormat("hh:mm:ss.zzz");
this->progressWidget = new QWidget();
this->progressLayout = new QVBoxLayout(this->progressWidget);
this->progressWidget->setLayout(this->progressLayout);
this->progressWidget->setWindowModality(Qt::WindowModal);
progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
for(int i=0;i<OMP_THREADS;i++)
{
this->progress.append(new QProgressBar(this->progressWidget));
this->progress.last()->setMinimum(0);
this->progress.last()->setMaximum(100);
this->progressLayout->addWidget(this->progress.last());
this->progressWidget->hide();
this->progressThreadIds[i] = -1;
}
this->progressWidget->setWindowTitle("Loading File");
for(int i=0;i<ServicesToLoad.count();i++)
{
qDebug()<<ServicesToLoad.at(i)->serviceName();
QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
}
}
MainWindow::~MainWindow()
{
delete ui;
}
//QString MainWindow::getFilePath(const QString &name)
//{
//// for(int i=0;i<this->folderViews.count();i++)
//// {
//// if(folderViews.at(i)->isDraging(name))
//// return folderViews.at(i)->currentFolder();
//// }
// return "";
//}
void MainWindow::updateProgress(int threadId, int percentProgress)
{
bool updated=false;
for(int i=0;i<OMP_THREADS;i++)
{
if(progressThreadIds[i]==threadId)
{
if(threadId<this->progress.count())
{
this->progress.at(i)->setValue(percentProgress);
updated=true;
}
}
}
if(Q_UNLIKELY(updated==false))
{
for(int i=0;i<OMP_THREADS;i++)
{
if(progressThreadIds[i]==-1)
{
progressThreadIds[i] = threadId;
updateProgress(threadId,percentProgress);
return;
}
}
}
}
void MainWindow::askGlobalRescan()
{
// for(int i=0;i<this->folderViews.count();i++)
// {
// this->folderViews.at(i)->refreshFolder();
// }
}
void MainWindow::showThemisIndexViewer()
{
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}