"Fossies" - the Fresh Open Source Software Archive

Member "mathmod-branches-r508-trunk/main.cpp" (8 Mar 2021, 4982 Bytes) of package /linux/misc/mathmod-11.0-source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "main.cpp" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 10.1_vs_11.0.

    1 /***************************************************************************
    2  *   Copyright (C) 2021 by Abderrahman Taha                                *
    3  *                                                                         *
    4  *                                                                         *
    5  *   This program is free software; you can redistribute it and/or modify  *
    6  *   it under the terms of the GNU General Public License as published by  *
    7  *   the Free Software Foundation; either version 2 of the License, or     *
    8  *   (at your option) any later version.                                   *
    9  *                                                                         *
   10  *   This program is distributed in the hope that it will be useful,       *
   11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
   12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
   13  *   GNU General Public License for more details.                          *
   14  *                                                                         *
   15  *   You should have received a copy of the GNU General Public License     *
   16  *   along with this program; if not, write to the                         *
   17  *   Free Software Foundation, Inc.,                                       *
   18  *   51 Franklin Street, Fifth Floor,Boston, MA 02110-1301 USA             *
   19  ***************************************************************************/
   20 
   21 #include "json_parser/parisodef.h"
   22 #include "ui_modules/drawingoptions.h"
   23 #include "ui_modules/mathmod.h"
   24 #include "ui_modules/parametersoptions.h"
   25 #include <QApplication>
   26 #include <QTextStream>
   27 #include <QGuiApplication>
   28 #include <QSurfaceFormat>
   29 #include <QOpenGLContext>
   30 #ifdef Q_WS_X11
   31 #include <X11/Xlib.h>
   32 #endif
   33 
   34 int main(int argc, char *argv[])
   35 {
   36     // QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
   37     QApplication app(argc, argv);
   38 
   39     QSurfaceFormat fmt;
   40     fmt.setDepthBufferSize(24);
   41     QSurfaceFormat::setDefaultFormat(fmt);
   42     // Request OpenGL 3.3 core or OpenGL ES 3.0.
   43     if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
   44         qDebug("Requesting 3.3 core context");
   45         //app.setVersion(3, 3);
   46         //fmt.setProfile(QSurfaceFormat::CoreProfile);
   47     } else {
   48         qDebug("Requesting 3.0 context");
   49         //fmt.setVersion(3, 0);
   50     }
   51 
   52     Parametersoptions Parameters;
   53     Parameters.MainApp = &app;
   54     Parameters.LoadConfig(app, argc, argv);
   55     // Creation of the two most important objects:
   56     MathMod mm(nullptr, uint(Parameters.Threads[0]),
   57                uint(Parameters.InitParGrid), uint(Parameters.InitIsoGrid),
   58                uint(Parameters.CalculFactor[0]), uint(Parameters.CalculFactor[1]),
   59                uint(Parameters.CalculFactor[2]));
   60     DrawingOptions drawingopt;
   61     // save references:
   62     drawingopt.Parameters = &Parameters;
   63     drawingopt.MathmodRef = &mm;
   64     mm.Parent = &drawingopt;
   65     mm.Xgrid = mm.Ygrid = mm.Zgrid=uint(Parameters.InitIsoGrid);
   66     mm.Ugrid = mm.Vgrid = uint(Parameters.InitParGrid);
   67     // GUI update:
   68     drawingopt.UpdateGui(argc);
   69     if (drawingopt.IsolistItemRef != nullptr)
   70         drawingopt.ui.ObjectClasse->expandItem(drawingopt.IsolistItemRef);
   71     QObject::connect(drawingopt.MathmodRef->IsoObjet->masterthread,
   72                      SIGNAL(mySignal(int)), drawingopt.ui.progressBar,
   73                      SLOT(setValue(int)));
   74     QObject::connect(drawingopt.MathmodRef->ParObjet->masterthread,
   75                      SIGNAL(mySignal(int)), drawingopt.ui.progressBar,
   76                      SLOT(setValue(int)));
   77     QObject::connect(drawingopt.MathmodRef->IsoObjet,
   78                      SIGNAL(ErrorSignal(int)), &drawingopt,
   79                      SLOT(MemoryErrorMsg(int)));
   80     QObject::connect(drawingopt.MathmodRef->ParObjet,
   81                      SIGNAL(ErrorSignal(int)), &drawingopt,
   82                      SLOT(MemoryErrorMsg(int)));
   83     QObject::connect(drawingopt.MathmodRef->IsoObjet,
   84                      SIGNAL(UpdateMessageSignal(QString)),
   85                      drawingopt.ui.Messagetext, SLOT(setText(QString)));
   86     QObject::connect(drawingopt.MathmodRef->ParObjet,
   87                      SIGNAL(UpdateMessageSignal(QString)),
   88                      drawingopt.ui.Messagetext, SLOT(setText(QString)));
   89     QObject::connect(drawingopt.MathmodRef->ParObjet,
   90                      SIGNAL(finished()), drawingopt.MathmodRef,
   91                      SLOT(UpdateGL()), Qt::UniqueConnection);
   92     QObject::connect(drawingopt.MathmodRef->IsoObjet,
   93                      SIGNAL(finished()), drawingopt.MathmodRef,
   94                      SLOT(UpdateGL()), Qt::UniqueConnection);
   95     QObject::connect(drawingopt.Parameters->ui.ApplypushButton, SIGNAL(clicked()),
   96                      &drawingopt, SLOT(ApplypushButton_clicked()));
   97     drawingopt.show();
   98     mm.show();
   99     drawingopt.raise();
  100     mm.LoadShadersFiles();
  101     drawingopt.on_choice_activated(Parameters.model);
  102     return app.exec();
  103 }