1 // Copyright (C) 2010-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author: Adrien Bruneton (CEA)
23 #include "PVViewer_Core.h"
24 #include "PVViewer_Behaviors.h"
25 #include "PLMainWindow.hxx"
27 #include <pqApplicationCore.h>
28 #include <pqSettings.h>
29 #include <pqParaViewBehaviors.h>
30 #include <pqServerResource.h>
31 #include <pqServerConnectReaction.h>
32 #include <pqServerDisconnectReaction.h>
34 int main(int argc, char ** argv)
36 std::cout << "Starting LightParaView ..." << std::endl;
38 std::cout << "Init Qt app ..." << std::endl;
39 QApplication qtapp(argc, argv);
40 QApplication::setApplicationName("LightPara");
42 std::cout << "Create Qt main window ..." << std::endl;
43 PLMainWindow * para_widget = new PLMainWindow();
45 std::cout << "Init appli core ..." << std::endl;
46 PVViewer_Core::ParaviewInitApp(para_widget, NULL);
48 std::cout << "Binding ParaView widget in QMainWindow ..." << std::endl;
49 para_widget->finishUISetup();
51 /* Install event filter */
52 // std::cout << "Install event filter ..." << std::endl;
53 // pqPVApplicationCore * plApp = PVViewer_Core::GetPVApplication();
54 // QApplication::instance()->installEventFilter(plApp);
56 std::cout << "Init behaviors ..." << std::endl;
57 PVViewer_Core::ParaviewInitBehaviors(true, para_widget);
59 //para_widget->updateActiveServer();
61 //std::cout << "Load config ..." << std::endl;
62 //PVViewer_Core::ParaviewLoadConfigurations(QString(":/LightPara/Configuration/"));
64 /* Inspired from ParaView source code:
65 * leave time for the GUI to update itself before displaying the main window: */
66 QApplication::instance()->processEvents();
69 // std::cout << "about to try to connect ...\n";
70 // const char * server_url = "cs://localhost";
71 // if (!pqServerConnectReaction::connectToServer(pqServerResource(server_url)))
73 // std::cerr << "Could not connect to requested server \""
74 // << server_url << "\". Creating default builtin connection.\n";
78 std::cout << "Show !" << std::endl;
80 int ret_code = qtapp.exec();
82 /* then disconnect and leave nicely */
83 //pqServerDisconnectReaction::disconnectFromServer();
85 std::cout << "Clean up ..." << std::endl;
86 PVViewer_Core::ParaviewCleanup();
90 std::cout << "Done." << std::endl;