diff --git a/QLop.pro b/QLop.pro --- a/QLop.pro +++ b/QLop.pro @@ -25,10 +25,15 @@ INCLUDEPATH += src/QCustomPlot \ src/Core src/Core/Widgets \ src/Core/Widgets/PyWdgt -QMAKE_CXXFLAGS += -O5 -fopenmp -QMAKE_LFLAGS += -O5 -fopenmp -#QMAKE_CXXFLAGS += -O0 -fopenmp -#QMAKE_LFLAGS += -O0 -fopenmp +defined(QLOP_DEBUG,var){ + QMAKE_CXXFLAGS += -O0 -fopenmp + QMAKE_LFLAGS += -O0 -fopenmp +} +!defined(QLOP_DEBUG,var){ + QMAKE_CXXFLAGS += -O5 -fopenmp + QMAKE_LFLAGS += -O5 -fopenmp +} + SOURCES += src/main.cpp\ src/mainwindow.cpp \ @@ -59,7 +64,13 @@ SOURCES += src/main.cpp\ src/Core/qlopdatabase.cpp \ src/Core/Widgets/qlopdatabaseviewer.cpp \ src/Core/Widgets/qlopdatabaseviewermodel.cpp \ - src/Cassini/exptimetabledownloader.cpp + src/Cassini/exptimetabledownloader.cpp \ + src/Core/qlopsettings.cpp \ + src/Core/Widgets/filedowloadersettingsgui.cpp \ + src/Core/qlopgui.cpp \ + src/Core/Widgets/manualproxycfg_gui.cpp \ + src/Core/Widgets/qlopsettingsdialog.cpp \ + src/Cassini/cassinitoolssettingsgui.cpp HEADERS += src/mainwindow.h \ src/SocExplorerPlot.h \ @@ -91,7 +102,13 @@ HEADERS += src/mainwindow.h \ src/Core/qlopdatabase.h \ src/Core/Widgets/qlopdatabaseviewer.h \ src/Core/Widgets/qlopdatabaseviewermodel.h \ - src/Cassini/exptimetabledownloader.h + src/Cassini/exptimetabledownloader.h \ + src/Core/qlopsettings.h \ + src/Core/Widgets/filedowloadersettingsgui.h \ + src/Core/qlopgui.h \ + src/Core/Widgets/manualproxycfg_gui.h \ + src/Core/Widgets/qlopsettingsdialog.h \ + src/Cassini/cassinitoolssettingsgui.h FORMS += src/mainwindow.ui \ src/Core/Widgets/downloadhistory.ui \ @@ -100,7 +117,11 @@ FORMS += src/mainwindow.ui \ src/Cassini/cassiniindexfileviewer.ui \ src/Cassini/cassinitoolsgui.ui \ src/Core/Widgets/filebrowser.ui \ - src/Core/Widgets/qlopdatabaseviewer.ui + src/Core/Widgets/qlopdatabaseviewer.ui \ + src/Core/Widgets/filedowloadersettingsgui.ui \ + src/Core/Widgets/manualproxycfg_gui.ui \ + src/Core/Widgets/qlopsettingsdialog.ui \ + src/Cassini/cassinitoolssettingsgui.ui RESOURCES += \ resources/qlop.qrc diff --git a/resources/Gnome-emblem-downloads.svg b/resources/Gnome-emblem-downloads.svg new file mode 100644 --- /dev/null +++ b/resources/Gnome-emblem-downloads.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + + Download + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/cassini.gif b/resources/cassini.gif new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ecc80f3b3921f07308984392c2cc9fface524bd6 GIT binary patch literal 7557 zc$@)+9eUzNNk%v~VaNa|0pkDwiEUoMv!TtAF#G-Vw{Iz!j((S)wbs$cQ(Aim4J{5T zZ2$lNS5r_$I7KK&cK`qYEC2ui0LTC+0YC))aLGxly*TU5yZ>M)j@cm%XsWJk>%MR- z&vb3yc+LjFc_)cgAYsTIg1SK>kV4uLh34UQjN*VU?A4j$`DO-faY3aGdvCo&d<;Z(9zU}&(hA= z(h1Gk)7IYK;^XAy=I09C= zk0HHh_R*isUd_+~`c9ux0*wKuY9DvKqR68V!~lR}Uh&h%QHZw9ya-vz6BZ zro{Qu0fL_h3Lr30peWIzNQoXrDzs@(pa>jDg_+Q0L#j7Cl<2o z;4)?enr(X)O8~&==VsBOUYm(!>udn>@+e(Yad4jHC{xzd+eKva^n&Z|Sao;<M4;0|NyB+v4T0lEJLx1&r1)IKQcwWc zbp$~wzIbMvG{T93oF`dBX-4;;glM89ol23Y5l-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~dFzqs#RIe4TI!K8cLU#R6+U{xjwQ|R;$6n$wW~Rk4OE(zmiR>HSpQR- z?UUbwp6)^8!hQKWy*@eQ>>(ncPz>{+20Hh32X*60o}UsX5ydDVf6~BI0vmY21`3c| z7ntCEPJli5839usu^~}7;a`WcbI?;{;hHX zVw^yQ>|4qKoNz=WCQ*q?WMUJY_(Uj1QHoQfVilvfK3c6$i(BMk7rppJForQmpAusk z&3HyMrqMvlQezw4_(nLIF^h4eV;${S$2s0nk9*{!7xQSw189K?fea*QifE4mkii26 z7$iNm7=|n`QWbCkfC2y@g)jv29EF5JOE5J^Orl7Of1CmWqTm54B!H8%38W;WfTBxI zL6qWwf*4X6g)yvemWe3jCoO`aRlbr6j4Xfxsvw1j2ve3-D8MbDfXY#_u@$pKKmeSH zNkZ)Ml-eA?EMJjIYYxBw!JK9mW|_=i65=7`8~|MgIZJMeQkxGEB{Z@AC{08>q?z3e zCnkgW%~bAlnFFomKNDchaq7~XnC#~?V>tx{1fT&~aOV`z+09$p^OPzWfJX0xPj!A1 z0T+EGIejThlUj6_sU}rYD$;g9ViWneM zf11;k+q@=EyZO(K9<-*}T&Po{LDG%_;1%QqC_&@-)Rxw=p=&hLM9~?~U|m-@b!$vh@lYtlG5`X-M@-?V(prMD3U(EandBK*luluy?BFF*tvXn-4zr{R zH78KVnonzL^RKFisU!WG*QJV+s6qv4Wsf-kc_FhGDkY~+r!ZFryb^VyhCHPfYnn*g z&b5!xB;#&<`&&H@6}ZDCZXAVMT;wLVjK@`ObDew7-ac2l(`_Dgt$SUWB+?4oTreeView.svg Gnome-go-up.svg QLop.svg + Gnome-emblem-downloads.svg + cassini.gif QLop.png diff --git a/src/Cassini/cassinidatadownloader.ui b/src/Cassini/cassinidatadownloader.ui --- a/src/Cassini/cassinidatadownloader.ui +++ b/src/Cassini/cassinidatadownloader.ui @@ -55,7 +55,7 @@ - + QGroupBox { border: 1px solid gray; diff --git a/src/Cassini/cassinitools.cpp b/src/Cassini/cassinitools.cpp --- a/src/Cassini/cassinitools.cpp +++ b/src/Cassini/cassinitools.cpp @@ -27,10 +27,12 @@ #include #include #include +#include CassiniTools* CassiniTools::_self=NULL; QDockWidget* CassiniTools::m_gui=NULL; CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL; +CassiniToolsSettingsGUI* CassiniTools::m_SettingsGui=NULL; CassiniDataFile* CassiniTools::m_dataFile=NULL; int CassiniTools::m_defaultPlot=-1; int CassiniTools::m_fftPlot=-1; @@ -286,6 +288,8 @@ QDockWidget *CassiniTools::getGUI() m_CassiniToolsGUI = new CassiniToolsGUI(); m_gui->setWidget(m_CassiniToolsGUI); m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); + m_SettingsGui = new CassiniToolsSettingsGUI(); + QLopSettings::registerConfigEntry(this->m_SettingsGui,QIcon(":/img/cassini.gif"),"Cassini Tools"); } return m_gui; } diff --git a/src/Cassini/cassinitools.h b/src/Cassini/cassinitools.h --- a/src/Cassini/cassinitools.h +++ b/src/Cassini/cassinitools.h @@ -29,6 +29,7 @@ #include #include #include +#include class CassiniTools: public QLopService { @@ -37,6 +38,7 @@ private: static CassiniTools* _self; static QDockWidget* m_gui; static CassiniToolsGUI* m_CassiniToolsGUI; + static CassiniToolsSettingsGUI* m_SettingsGui; static CassiniDataFile* m_dataFile; static int m_defaultPlot,m_fftPlot; static SocExplorerPlotActions* ExportAction; diff --git a/src/Cassini/cassinitoolssettingsgui.cpp b/src/Cassini/cassinitoolssettingsgui.cpp new file mode 100644 --- /dev/null +++ b/src/Cassini/cassinitoolssettingsgui.cpp @@ -0,0 +1,26 @@ +#include "cassinitoolssettingsgui.h" +#include "ui_cassinitoolssettingsgui.h" + +CassiniToolsSettingsGUI::CassiniToolsSettingsGUI(QWidget *parent) : + QWidget(parent), + ui(new Ui::CassiniToolsSettingsGUI) +{ + ui->setupUi(this); +} + +CassiniToolsSettingsGUI::~CassiniToolsSettingsGUI() +{ + delete ui; +} + +void CassiniToolsSettingsGUI::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/Cassini/cassinitoolssettingsgui.h b/src/Cassini/cassinitoolssettingsgui.h new file mode 100644 --- /dev/null +++ b/src/Cassini/cassinitoolssettingsgui.h @@ -0,0 +1,25 @@ +#ifndef CASSINITOOLSSETTINGSGUI_H +#define CASSINITOOLSSETTINGSGUI_H + +#include + +namespace Ui { +class CassiniToolsSettingsGUI; +} + +class CassiniToolsSettingsGUI : public QWidget +{ + Q_OBJECT + +public: + explicit CassiniToolsSettingsGUI(QWidget *parent = 0); + ~CassiniToolsSettingsGUI(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::CassiniToolsSettingsGUI *ui; +}; + +#endif // CASSINITOOLSSETTINGSGUI_H diff --git a/src/Cassini/cassinitoolssettingsgui.ui b/src/Cassini/cassinitoolssettingsgui.ui new file mode 100644 --- /dev/null +++ b/src/Cassini/cassinitoolssettingsgui.ui @@ -0,0 +1,21 @@ + + + + + CassiniToolsSettingsGUI + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/src/Core/Widgets/filedowloadersettingsgui.cpp b/src/Core/Widgets/filedowloadersettingsgui.cpp new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/filedowloadersettingsgui.cpp @@ -0,0 +1,61 @@ +/*------------------------------------------------------------------------------ +-- 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 "filedowloadersettingsgui.h" +#include "ui_filedowloadersettingsgui.h" + +FileDowloaderSettingsGUI::FileDowloaderSettingsGUI(QWidget *parent) : + QWidget(parent), + ui(new Ui::FileDowloaderSettingsGUI) +{ + ui->setupUi(this); + this->manualProxyCFG_GUI = new ManualProxyCFG_GUI(); + lastWidget = NULL; + connect(this->ui->comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(proxyMethodChanged(QString))); +} + +FileDowloaderSettingsGUI::~FileDowloaderSettingsGUI() +{ + delete ui; +} + +void FileDowloaderSettingsGUI::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void FileDowloaderSettingsGUI::proxyMethodChanged(const QString &text) +{ + this->ui->gridLayout->removeWidget(this->lastWidget); + if(text=="manual") + { + this->ui->gridLayout->addWidget(this->manualProxyCFG_GUI,1,0,1,-1); + this->lastWidget = this->manualProxyCFG_GUI; + return; + } +} diff --git a/src/Core/Widgets/filedowloadersettingsgui.h b/src/Core/Widgets/filedowloadersettingsgui.h new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/filedowloadersettingsgui.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ +#ifndef FILEDOWLOADERSETTINGSGUI_H +#define FILEDOWLOADERSETTINGSGUI_H + +#include +#include "manualproxycfg_gui.h" + +namespace Ui { +class FileDowloaderSettingsGUI; +} + +class FileDowloaderSettingsGUI : public QWidget +{ + Q_OBJECT + +public: + explicit FileDowloaderSettingsGUI(QWidget *parent = 0); + ~FileDowloaderSettingsGUI(); + +protected: + void changeEvent(QEvent *e); + +private slots: + void proxyMethodChanged(const QString & text); +private: + ManualProxyCFG_GUI* manualProxyCFG_GUI; + Ui::FileDowloaderSettingsGUI *ui; + QWidget* lastWidget; +}; + +#endif // FILEDOWLOADERSETTINGSGUI_H diff --git a/src/Core/Widgets/filedowloadersettingsgui.ui b/src/Core/Widgets/filedowloadersettingsgui.ui new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/filedowloadersettingsgui.ui @@ -0,0 +1,74 @@ + + + FileDowloaderSettingsGUI + + + + 0 + 0 + 318 + 128 + + + + Form + + + + + + Default destination path + + + + + + + + + + Proxy server + + + + + + Method + + + Qt::AlignCenter + + + + + + + + none + + + + + system + + + + + manual + + + + + automatic + + + + + + + + + + + + diff --git a/src/Core/Widgets/manualproxycfg_gui.cpp b/src/Core/Widgets/manualproxycfg_gui.cpp new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/manualproxycfg_gui.cpp @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------------ +-- 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 "manualproxycfg_gui.h" +#include "ui_manualproxycfg_gui.h" + +ManualProxyCFG_GUI::ManualProxyCFG_GUI(QWidget *parent) : + QWidget(parent), + ui(new Ui::ManualProxyCFG_GUI) +{ + ui->setupUi(this); +} + +ManualProxyCFG_GUI::~ManualProxyCFG_GUI() +{ + delete ui; +} + +void ManualProxyCFG_GUI::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/Core/Widgets/manualproxycfg_gui.h b/src/Core/Widgets/manualproxycfg_gui.h new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/manualproxycfg_gui.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ +#ifndef MANUALPROXYCFG_GUI_H +#define MANUALPROXYCFG_GUI_H + +#include + +namespace Ui { +class ManualProxyCFG_GUI; +} + +class ManualProxyCFG_GUI : public QWidget +{ + Q_OBJECT + +public: + explicit ManualProxyCFG_GUI(QWidget *parent = 0); + ~ManualProxyCFG_GUI(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::ManualProxyCFG_GUI *ui; +}; + +#endif // MANUALPROXYCFG_GUI_H diff --git a/src/Core/Widgets/manualproxycfg_gui.ui b/src/Core/Widgets/manualproxycfg_gui.ui new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/manualproxycfg_gui.ui @@ -0,0 +1,109 @@ + + + ManualProxyCFG_GUI + + + + 0 + 0 + 423 + 207 + + + + Form + + + + + + HTTP proxy + + + + + + + + + + HTTPS proxy + + + + + + + + + + FTP proxy + + + + + + + + + + SOCKS proxy + + + + + + + + + + Ignore hosts + + + + + + + + 0 + 0 + + + + 000000 + + + + + + + 000000 + + + + + + + 000000 + + + + + + + 000000 + + + + + + + localhost, 127.0.0.0/8, ::1 + + + + + + + + diff --git a/src/Core/Widgets/qlopdatabaseviewer.cpp b/src/Core/Widgets/qlopdatabaseviewer.cpp --- a/src/Core/Widgets/qlopdatabaseviewer.cpp +++ b/src/Core/Widgets/qlopdatabaseviewer.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 "qlopdatabaseviewer.h" #include "ui_qlopdatabaseviewer.h" diff --git a/src/Core/Widgets/qlopdatabaseviewer.h b/src/Core/Widgets/qlopdatabaseviewer.h --- a/src/Core/Widgets/qlopdatabaseviewer.h +++ b/src/Core/Widgets/qlopdatabaseviewer.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ #ifndef QLOPDATABASEVIEWER_H #define QLOPDATABASEVIEWER_H diff --git a/src/Core/Widgets/qlopdatabaseviewer.ui b/src/Core/Widgets/qlopdatabaseviewer.ui --- a/src/Core/Widgets/qlopdatabaseviewer.ui +++ b/src/Core/Widgets/qlopdatabaseviewer.ui @@ -11,7 +11,7 @@ - DockWidget + Database Explorer diff --git a/src/Core/Widgets/qlopdatabaseviewermodel.cpp b/src/Core/Widgets/qlopdatabaseviewermodel.cpp --- a/src/Core/Widgets/qlopdatabaseviewermodel.cpp +++ b/src/Core/Widgets/qlopdatabaseviewermodel.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 "qlopdatabaseviewermodel.h" QLopDataBaseViewerModel::QLopDataBaseViewerModel(QObject *parent) diff --git a/src/Core/Widgets/qlopdatabaseviewermodel.h b/src/Core/Widgets/qlopdatabaseviewermodel.h --- a/src/Core/Widgets/qlopdatabaseviewermodel.h +++ b/src/Core/Widgets/qlopdatabaseviewermodel.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ #ifndef QLOPDATABASEVIEWERMODEL_H #define QLOPDATABASEVIEWERMODEL_H diff --git a/src/Core/Widgets/qlopsettingsdialog.cpp b/src/Core/Widgets/qlopsettingsdialog.cpp new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/qlopsettingsdialog.cpp @@ -0,0 +1,70 @@ +#include "qlopsettingsdialog.h" +#include "ui_qlopsettingsdialog.h" + +QLopSettingsDialog::QLopSettingsDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::QLopSettingsDialog) +{ + ui->setupUi(this); + connect(ui->contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); + ui->contentsWidget->setViewMode(QListView::IconMode); + ui->contentsWidget->setIconSize(QSize(96, 84)); + ui->contentsWidget->setMovement(QListView::Static); + ui->contentsWidget->setSpacing(12); +} + +QLopSettingsDialog::~QLopSettingsDialog() +{ + delete ui; +} + +void QLopSettingsDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + + +void QLopSettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) +{ + if (!current) + current = previous; + + ui->pagesWidget->setCurrentIndex(ui->contentsWidget->row(current)); +} + +bool QLopSettingsDialog::registerConfigEntry(QWidget *configEntry, QIcon icon, QString text) +{ + if(configEntry!=NULL) + { + ui->pagesWidget->addWidget(configEntry); + QListWidgetItem *configButton = new QListWidgetItem(ui->contentsWidget); + configButton->setIcon(icon); + configButton->setText(text); + configButton->setTextAlignment(Qt::AlignHCenter); + configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + return true; + } + return false; +} + +void QLopSettingsDialog::popConfigDialog(QWidget *selectedConfigEntry) +{ + if(selectedConfigEntry!=NULL) + { + for(int i=0;ipagesWidget->count();i++) + { + if(ui->pagesWidget->widget(i)==selectedConfigEntry) + { + ui->pagesWidget->setCurrentIndex(i); + } + } + } + this->show(); +} diff --git a/src/Core/Widgets/qlopsettingsdialog.h b/src/Core/Widgets/qlopsettingsdialog.h new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/qlopsettingsdialog.h @@ -0,0 +1,30 @@ +#ifndef QLOPSETTINGSDIALOG_H +#define QLOPSETTINGSDIALOG_H + +#include + +namespace Ui { +class QLopSettingsDialog; +} +#include + +class QLopSettingsDialog : public QDialog +{ + Q_OBJECT + +public: + explicit QLopSettingsDialog(QWidget *parent = 0); + ~QLopSettingsDialog(); + +public slots: + void changePage(QListWidgetItem *current, QListWidgetItem *previous); + bool registerConfigEntry(QWidget* configEntry, QIcon icon, QString text); + void popConfigDialog(QWidget* selectedConfigEntry=0); +protected: + void changeEvent(QEvent *e); + +private: + Ui::QLopSettingsDialog *ui; +}; + +#endif // QLOPSETTINGSDIALOG_H diff --git a/src/Core/Widgets/qlopsettingsdialog.ui b/src/Core/Widgets/qlopsettingsdialog.ui new file mode 100644 --- /dev/null +++ b/src/Core/Widgets/qlopsettingsdialog.ui @@ -0,0 +1,102 @@ + + + QLopSettingsDialog + + + + 0 + 0 + 534 + 379 + + + + Dialog + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + QLopSettingsDialog + accept() + + + 227 + 431 + + + 157 + 274 + + + + + buttonBox + rejected() + QLopSettingsDialog + reject() + + + 295 + 431 + + + 286 + 274 + + + + + diff --git a/src/Core/filedownloader.cpp b/src/Core/filedownloader.cpp --- a/src/Core/filedownloader.cpp +++ b/src/Core/filedownloader.cpp @@ -22,11 +22,14 @@ #include "filedownloader.h" #include +#include + FileDownloader* FileDownloader::_self=NULL; QNetworkAccessManager* FileDownloader::m_WebCtrl=NULL; QList* FileDownloader::m_pendingTasks=NULL; QDockWidget* FileDownloader::m_gui=NULL; DownLoadHistory* FileDownloader::m_DownLoadHistory=NULL; +FileDowloaderSettingsGUI* FileDownloader::m_SettingsGui=NULL; #define _INIT \ if(Q_UNLIKELY(_self==NULL))\ @@ -78,6 +81,8 @@ QDockWidget *FileDownloader::getGUI() m_gui=new QDockWidget("Download History"); m_gui->setWidget(m_DownLoadHistory); m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); + m_SettingsGui = new FileDowloaderSettingsGUI(); + QLopSettings::registerConfigEntry(this->m_SettingsGui,QIcon(":/img/Gnome-emblem-downloads.svg"),"Qlop Downloader"); } return (QDockWidget*) m_gui; } @@ -135,6 +140,11 @@ int FileDownloader::getTaskId() return -1; } +void FileDownloader::proxyConfig() +{ + +} + void FileDownloader::init(bool noGUI, QObject *parent) { if(Q_UNLIKELY(_self==NULL)) @@ -142,13 +152,22 @@ void FileDownloader::init(bool noGUI, QO _self=new FileDownloader(noGUI,parent); } } - +/*for gnome: + * + * gsettings list-recursively org.gnome.system.proxy + * gsettings get org.gnome.system.proxy.http host + * + * To detect desktop $XDG_CURRENT_DESKTOP + */ FileDownloader::FileDownloader(bool noGUI,QObject *parent) : QLopService(parent) { - QNetworkProxyQuery q(QUrl("http://www.google.com")); - q.setQueryType(QNetworkProxyQuery::UrlRequest); - q.setProtocolTag("http"); + QNetworkProxyQuery q(QUrl(QLatin1String("http://www.google.com"))); + //q.setQueryType(QNetworkProxyQuery::UrlRequest); + //q.setProtocolTag("http"); QList proxies = QNetworkProxyFactory::systemProxyForQuery(q); + foreach ( QNetworkProxy loopItem, proxies ) { + qDebug() << "proxyUsed:" << loopItem.hostName(); + } if( proxies.size() > 0 && proxies[0].type() != QNetworkProxy::NoProxy ) QNetworkProxy::setApplicationProxy(proxies[0]); else @@ -157,7 +176,6 @@ FileDownloader::FileDownloader(bool noGU m_pendingTasks = new QList(); m_noGui=noGUI; m_serviceName="FileDownloader"; - } FileDownloader::~FileDownloader() diff --git a/src/Core/filedownloader.h b/src/Core/filedownloader.h --- a/src/Core/filedownloader.h +++ b/src/Core/filedownloader.h @@ -33,6 +33,8 @@ #include #include #include +#include +#include class FileDownloader : public QLopService { @@ -43,6 +45,7 @@ private: static QList* m_pendingTasks; static DownLoadHistory* m_DownLoadHistory; static QDockWidget* m_gui; + static FileDowloaderSettingsGUI* m_SettingsGui; FileDownloader(bool noGUI=false,QObject *parent = 0); ~FileDownloader(); @@ -63,6 +66,7 @@ public slots: int download_file(QString fileUrl,const QString& name); private: int getTaskId(); + void proxyConfig(); }; #endif // FILEDOWNLOADER_H diff --git a/src/Core/qlopdatabase.cpp b/src/Core/qlopdatabase.cpp --- a/src/Core/qlopdatabase.cpp +++ b/src/Core/qlopdatabase.cpp @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 "qlopdatabase.h" #include @@ -35,7 +56,7 @@ QDockWidget *QLopDataBase::getGUI() void QLopDataBase::init(bool noGUI, QObject *parent) { - _self=new QLopDataBase(); + _self=new QLopDataBase(noGUI,parent); } const QString &QLopDataBase::serviceName() diff --git a/src/Core/qlopdatabase.h b/src/Core/qlopdatabase.h --- a/src/Core/qlopdatabase.h +++ b/src/Core/qlopdatabase.h @@ -1,3 +1,24 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ #ifndef QLOPDATABASE_H #define QLOPDATABASE_H diff --git a/src/Core/qlopgui.cpp b/src/Core/qlopgui.cpp new file mode 100644 --- /dev/null +++ b/src/Core/qlopgui.cpp @@ -0,0 +1,110 @@ +/*------------------------------------------------------------------------------ +-- 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 "qlopgui.h" +QLopGUI* QLopGUI::_self=NULL; +QDockWidget* QLopGUI::m_gui=NULL; +QMenuBar* QLopGUI::m_mainMenuBar=NULL; +QMenu* QLopGUI::m_fileMenu=NULL; +QMenu* QLopGUI::m_SettingsMenu=NULL; + +#define INIT() \ + if(Q_UNLIKELY(_self==NULL))\ + {\ + init();\ + } + +QLopGUI::QLopGUI(bool noGUI,QObject *parent) +{ + m_serviceName="QLopGUI"; + m_noGui=noGUI; +} + +QLopGUI::~QLopGUI() +{ + +} + +QDockWidget *QLopGUI::getGUI() +{ + return m_gui; +} + +void QLopGUI::init(bool noGUI, QObject *parent) +{ + _self=new QLopGUI(noGUI,parent); +} + +const QString &QLopGUI::serviceName() +{ + INIT(); + return m_serviceName; +} + +QLopGUI *QLopGUI::self() +{ + INIT(); + return _self; +} + +void QLopGUI::registerMenuBar(QMenuBar *menuBar) +{ + INIT(); + m_mainMenuBar = menuBar; + if(m_mainMenuBar) + { + m_fileMenu = m_mainMenuBar->addMenu(tr("File")); + m_SettingsMenu = m_mainMenuBar->addMenu(tr("Settings")); + } +} + +QMenu *QLopGUI::addMenu(const QString &title) +{ + INIT(); + if(m_mainMenuBar) + { + return m_mainMenuBar->addMenu(title); + } + return NULL; +} + +bool QLopGUI::addFileAction(QAction *action) +{ + INIT(); + if(m_fileMenu) + { + m_fileMenu->addAction(action); + return true; + } + return false; +} + +bool QLopGUI::addSettingsAction(QAction *action) +{ + INIT(); + if(m_SettingsMenu) + { + m_SettingsMenu->addAction(action); + return true; + } + return false; +} + diff --git a/src/Core/qlopgui.h b/src/Core/qlopgui.h new file mode 100644 --- /dev/null +++ b/src/Core/qlopgui.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ +#ifndef QLOPGUI_H +#define QLOPGUI_H + +#include +#include +#include +#include +#include + +class QLopGUI : public QLopService +{ + Q_OBJECT + static QDockWidget* m_gui; + QLopGUI(bool noGUI=false,QObject *parent = 0); + ~QLopGUI(); + static QLopGUI* _self; + static QMenuBar* m_mainMenuBar; + static QMenu* m_fileMenu; + static QMenu* m_SettingsMenu; +public: + QDockWidget* getGUI(); + static void init(bool noGUI=false,QObject *parent = 0); + const QString& serviceName(); + static QLopGUI* self(); + static void registerMenuBar(QMenuBar* menuBar); + static QMenu* addMenu(const QString & title); + static bool addFileAction(QAction * action); + static bool addSettingsAction(QAction * action); +}; + +#endif // QLOPGUI_H diff --git a/src/Core/qlopsettings.cpp b/src/Core/qlopsettings.cpp new file mode 100644 --- /dev/null +++ b/src/Core/qlopsettings.cpp @@ -0,0 +1,98 @@ +/*------------------------------------------------------------------------------ +-- 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 "qlopsettings.h" +#include +#include +#include + +QLopSettings* QLopSettings::_self=NULL; +QDockWidget* QLopSettings::m_gui=NULL; +QSettings* QLopSettings::m_settings=NULL; +QLopSettingsDialog* QLopSettings::m_configDialog=NULL; + +#define INIT() \ + if(Q_UNLIKELY(_self==NULL))\ + {\ + init();\ + } + +QLopSettings::QLopSettings(bool noGUI,QObject *parent) : QLopService(parent) +{ + m_serviceName="QLopSettings"; + m_settings = new QSettings(); + m_noGui=noGUI; + m_configDialog = new QLopSettingsDialog(); + QAction* trigerGUI = new QAction(tr("Settings"),this); + connect(trigerGUI,SIGNAL(triggered()),this,SLOT(popConfigDialog())); + QLopGUI::addSettingsAction(trigerGUI); +} + +QLopSettings::~QLopSettings() +{ + delete m_configDialog; + delete m_settings; +} + +QDockWidget *QLopSettings::getGUI() +{ + if(!m_noGui && (m_gui==NULL)) + { +// m_gui=new QLopDataBaseViewer(); +// m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); + } + return m_gui; +} + +void QLopSettings::init(bool noGUI, QObject *parent) +{ + _self=new QLopSettings(noGUI,parent); +} + +const QString &QLopSettings::serviceName() +{ + INIT(); + return m_serviceName; +} + +QLopSettings *QLopSettings::self() +{ + INIT(); + return _self; +} + +void QLopSettings::popConfigDialog(QWidget *selectedConfigEntry) +{ + INIT(); + m_configDialog->popConfigDialog(selectedConfigEntry); +} + +void QLopSettings::popConfigDialog() +{ + m_configDialog->popConfigDialog(NULL); +} + +bool QLopSettings::registerConfigEntry(QWidget *configEntry, QIcon icon, QString text) +{ + INIT(); + return m_configDialog->registerConfigEntry(configEntry, icon, text); +} + diff --git a/src/Core/qlopsettings.h b/src/Core/qlopsettings.h new file mode 100644 --- /dev/null +++ b/src/Core/qlopsettings.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------------ +-- 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 +----------------------------------------------------------------------------*/ +#ifndef QLOPSETTINGS_H +#define QLOPSETTINGS_H + +#include +#include +#include +#include +#include +#include + + +class QLopSettings : public QLopService +{ + Q_OBJECT + static QDockWidget* m_gui; + QLopSettings(bool noGUI=false,QObject *parent = 0); + ~QLopSettings(); + static QLopSettings* _self; + static QSettings* m_settings; + static QLopSettingsDialog* m_configDialog; +public: + QDockWidget* getGUI(); + static void init(bool noGUI=false,QObject *parent = 0); + const QString& serviceName(); + static QLopSettings* self(); + static void popConfigDialog(QWidget* selectedConfigEntry); + static bool registerConfigEntry(QWidget* configEntry,QIcon icon, QString text); +public slots: + void popConfigDialog(); +}; + +#endif // QLOPSETTINGS_H diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -45,6 +45,9 @@ int main(int argc, char *argv[]) } qRegisterMetaType("QListOfDataVector"); qRegisterMetaType("QLopDataList"); + QApplication::setOrganizationName("LPP"); + QApplication::setOrganizationDomain("lpp.fr"); + QApplication::setApplicationName("QLop"); MainWindow w(OMP_THREADS); w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,6 +33,9 @@ #include #include #include +#include +#include + const QListServicesToLoad=QList() <OMP_THREADS = OMP_THREADS; ui->setupUi(this); + QLopGUI::registerMenuBar(menuBar()); 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); @@ -80,19 +81,6 @@ MainWindow::~MainWindow() delete ui; } -//QString MainWindow::getFilePath(const QString &name) -//{ -//// for(int i=0;ifolderViews.count();i++) -//// { -//// if(folderViews.at(i)->isDraging(name)) -//// return folderViews.at(i)->currentFolder(); -//// } -// return ""; -//} - - - - void MainWindow::updateProgress(int threadId, int percentProgress) { bool updated=false; @@ -122,19 +110,6 @@ void MainWindow::updateProgress(int thre } -void MainWindow::askGlobalRescan() -{ -// for(int i=0;ifolderViews.count();i++) -// { -// this->folderViews.at(i)->refreshFolder(); -// } -} - -void MainWindow::showThemisIndexViewer() -{ - -} - void MainWindow::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); diff --git a/src/mainwindow.h b/src/mainwindow.h --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -34,6 +34,7 @@ #include "cassiniindexfileviewer.h" #include #include +#include namespace Ui { class MainWindow; @@ -46,11 +47,9 @@ class MainWindow : public QMainWindow public: explicit MainWindow(int OMP_THREADS,QWidget *parent = 0); ~MainWindow(); - QString getFilePath(const QString& name); public slots: void updateProgress(int threadId,int percentProgress); - void askGlobalRescan(); - void showThemisIndexViewer(); + protected: void changeEvent(QEvent *e); diff --git a/src/mainwindow.ui b/src/mainwindow.ui --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -42,19 +42,6 @@ 27 - - - tools - - - - Themis - - - - - -