C:/sources/c++/buddhabrot/buddhabrot/app.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2010 Pierre SCHWARTZ
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
00005 documentation files (the "Software"), to deal in the Software without restriction, including without 
00006 limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
00007 of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following 
00008 conditions: The above copyright notice and this permission notice shall be included in all copies or 
00009 substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00010 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
00011 PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00012 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
00013 OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
00014 */
00015 
00024 #ifndef H__APP_H
00025 #define H__APP_H
00026 
00027 #include <QtGui/QWidget>
00028 #include <QtGui/QImage>
00029 #include <QtGui/QProgressBar>
00030 #include <QtGui/QMainWindow>
00031 #include <QtGui/QPushButton>
00032 #include <QtGui/QSpinBox>
00033 #include <QtGui/QComboBox>
00034 #include <QtGui/QCheckBox>
00035 #include <QtGui/QSlider>
00036 #include <QtGui/QLineEdit>
00037 #include <QtGui/QStatusBar>
00038 
00039 #include "colormaker.h"
00040 #include "fractale.h"
00041 #include "zoomableimage.h"
00042 #include "networkinput.h"
00043 #include "triplex.h"
00044 
00051 class App : public QMainWindow{
00052         Q_OBJECT
00053 
00054         public:
00055                 App(QWidget *parent = 0);
00056                 ~App();
00057 
00058         // un signal pour avertir de l'avancement du calcul
00059         signals:
00060                 void processFinishing(int newValue);
00061 
00062         public slots :
00063                 
00064                 void s_colorate_darkBody();
00065                 void s_colorate_gray();
00066                 void s_colorate_full();
00067                 void s_generate();
00068                 void s_zoom(int, int);
00069                 void s_unzoom(int, int);
00070                 void s_render();
00071                 void s_changeFractale(int);
00072                 void s_displayPointsAleatoires(bool);
00073                 void s_enableNetwork(bool);
00074                 void s_deleteLastNetwork();
00075                 void s_addNetwork();
00076                 void s_receiveMessageFromNetwork(QString&);
00077 
00078                 void s_run_dynamic_coloration();
00079                 void s_displayRealCoordinates(int, int);
00080                 void s_saveConfig();
00081                 void s_loadConfig();
00082                 
00083                 void save();
00084                 void about();
00085 
00086                 void setMaxValue(long i){
00087                         maxValue = i;
00088                 }
00089                 void myEmitProcess(int i){
00090                         emit processFinishing(i);
00091                 }
00092 
00093         private:
00094                 // images de travail
00095                 QImage *coloredImage, *calculatedImage;
00096                 QVector<QVector<int> > threeDrendering;
00097                 QVector<QVector<triplex> > normalMap;
00098 
00099                 // zone de rendu
00100                 ZoomableImage *renderingImage;
00101 
00102                 //widgets classique pour l'UI
00103                 QProgressBar *bar;
00104                 QPushButton *calculateButton;
00105                 QSpinBox *iterations;
00106                 QComboBox *sizes, *fractalType;
00107 
00108                 // boutons de coloration
00109                 QPushButton *darkBodyBtn, *grayBtn, *fullBtn;
00110                 QCheckBox *showAnimation;
00111                 QWidget *colorationWidget;
00112                 QRectF currentWindow;
00113                 QList<QPushButton*> colorationButtons;
00114 
00115                 QMap<QString, fractale*> pluginFractales;
00116 
00117                 // docks
00118                 QDockWidget *dockColoration;
00119                 QDockWidget *windowDock;
00120                 QDockWidget *iterationsDock;
00121 
00122                 // type de rendu
00123                 QRadioButton *parPixel, *parPointsAleatoires;
00124                 QSpinBox *aleatoiresPoints;
00125 
00126                 // création de l'interface
00127                 void createActions();
00128                 void createMenu();      
00129                 void setCurrentWindow(QRectF&);
00130                 QAction *saveAct, *quitAct, *aboutAct, *saveConfigAct, *loadConfigAct;
00131 
00132                 // réseau
00133                 QList<NetworkInput*> networkAddresses;
00134                 QVBoxLayout *vbnetworkDock;
00135                 QPushButton *addNetwork;
00136                 QPushButton *clearNetwork;
00137                 QCheckBox *useNetwork;
00138                 bool isNetworkUsed;
00139 
00140                 QSize currentSize;
00141 
00146                 QStringList palettesListe;
00147                 long maxValue;
00148 
00149                 void applyStyle();
00150                 void buildUI();
00151                 void connectSignals();
00152                 void collectVectorialPalets();
00153                 void collectPluginFractales();
00154                 QStringList collectNetworkAgents();
00155                 void setNetworkList(QList<QString>&);
00156                 void enableColorationButtons(bool);
00157 
00158                 void colorate(colorMaker&);
00159                 void generateStartFractaleWindows();
00160                 void generateFractale(fractale&);
00161                 void generateBuddhaBrot();
00162                 void generateHexaMandelBrot();
00163                 void generateMandelBrot();
00164                 void generateNewton();
00165                 void generateTricorn();
00166                 void generateSharingan();
00167                 void generateBateauEnFeu();
00168                 void generatePlugged(QString&);
00169                 void generateJulia(std::complex<float>);        
00170                 void generateMandel3D();
00171 
00172                 void runLightning();
00173 
00174                 // zones de sélection variables, les noms doivent être réutilisables
00175                 QLineEdit *windowX1, *windowY1, *windowX2, *windowY2;
00176 
00177                 // barre d'état
00178                 QStatusBar *statusBar;
00179                 QLabel *statusBarLabel;
00180 };
00181 
00182 #endif

Generated on Fri Feb 26 21:07:52 2010 for BuddhaBrot by  doxygen 1.4.6-NO