File: dialog_mutation_parameters.h

package info (click to toggle)
evolvotron 0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,420 kB
  • ctags: 1,367
  • sloc: cpp: 10,462; python: 162; sh: 147; makefile: 9
file content (140 lines) | stat: -rw-r--r-- 4,296 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**************************************************************************/
/*  Copyright 2012 Tim Day                                                */
/*                                                                        */
/*  This file is part of Evolvotron                                       */
/*                                                                        */
/*  Evolvotron 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 3 of the License, or     */
/*  (at your option) any later version.                                   */
/*                                                                        */
/*  Evolvotron 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 Evolvotron.  If not, see <http://www.gnu.org/licenses/>.   */
/**************************************************************************/

/*! \file 
  \brief Interface for class DialogMutationParameters.
*/

#ifndef _dialog_mutation_parameters_h_
#define _dialog_mutation_parameters_h_

#include "mutation_parameters_qobject.h"

//! Provides an dialog box for controlling MutationParameters.
class DialogMutationParameters : public QDialog
{
 private:
  Q_OBJECT

  typedef QDialog Superclass;

 protected:
  //! Scale to spinbox's integer values.
  const int _scale;

  //! Owner of dialog (probably EvolvotronMain), used to access a statusbar.
  QMainWindow*const _parent;

  //! Instance of MutationParameters under dialog control.
  /*! NB it's fairly important no-one modifies this except through methods of this class
    (or another class responsible for another part), else GUI components will get out of sync
   */
  MutationParametersQObject*const _mutation_parameters;

  //! Tabs for base parameters and autocool
  QTabWidget* _tabs;

  //! Tab for base mutation parameter controls
  QWidget* _vbox_base_mutation;

  //! Grid for buttons;
  QWidget* _grid_buttons;

  //! Grid for base parameter control spinners
  QWidget* _grid_base_mutation;

  //! Group for autocool parameters
  QWidget* _vbox_autocool;

  //! Grid for autocool parameters
  QWidget* _grid_autocool;

  //! Label to show number of generations
  QLabel* _label_autocool_generations;

  //! Button to reheeat autocooling
  QPushButton* _button_autocool_reheat;

  //@{
  //! Button for quick adjustment of MutationParameters
  QPushButton* _button_reset;
  QPushButton* _button_cool;
  QPushButton* _button_heat;
  QPushButton* _button_shield;
  QPushButton* _button_irradiate;
  //@}

  //@{
  //! Spinners for detailed control of specific parameters
  QSpinBox* _spinbox_magnitude;
  QSpinBox* _spinbox_parameter_reset;
  QSpinBox* _spinbox_glitch;
  QSpinBox* _spinbox_shuffle;
  QSpinBox* _spinbox_insert;
  QSpinBox* _spinbox_substitute;
  QSpinBox* _spinbox_autocool_halflife;
  //@}

  //! Control autocooling
  QCheckBox* _checkbox_autocool_enable;

  //! Button to close dialog.
  QPushButton* _ok;

  //! Reload spinboxes from _mutation_parameters.
  void setup_from_mutation_parameters();

 public:
  //! Constructor.
  DialogMutationParameters(QMainWindow* parent,MutationParametersQObject* mp);

  //! Destructor.
  ~DialogMutationParameters();

 public slots:

  //@{
  //! Signalled by button.
  void reset();
  void heat();
  void cool();
  void irradiate();
  void shield();
  void reheat();
  //@}

  //! Signalled by checkbox.
  void changed_autocool_enable(int buttonstate);

  //@{
  //! Signalled by spinbox.
  void changed_magnitude(int v);
  void changed_parameter_reset(int v);
  void changed_glitch(int v);
  void changed_shuffle(int v);
  void changed_insert(int v);
  void changed_substitute(int v);
  void changed_autocool_halflife(int v);
  //@}

  //! Signalled by mutation parameters
  void mutation_parameters_changed();
};

#endif