Added:
trunk/config_files/PlasmaGenerator.xml
trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.cpp
trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.h
trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.cpp
trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.h
Modified:
trunk/Makefile.in
trunk/configure.ac
trunk/src/PlasmaGenerator/project_files/PlasmaGenerator.pro
trunk/src/PlasmaGenerator/resource_files/app_icon.png
trunk/src/PlasmaGenerator/resource_files/defaults.xml
trunk/src/PlasmaGenerator/src/ConfigManager.cpp
trunk/src/PlasmaGenerator/src/ConfigManager.h
trunk/src/PlasmaGenerator/src/PlasmaGenerator.cpp
trunk/src/PlasmaGenerator/src/PlasmaGenerator.h
trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.cpp
trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.h
trunk/src/PlasmaGenerator/src/PlasmaGeneratorMain.cpp
trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.cpp
trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.h
trunk/src/PlasmaGenerator/src/project_specific_extern_defs.h
trunk/src/common/2d_bgnd_w_lens/ConfigManager.cpp
Log:
PlasmaGenerator is essentially done. Need to write help, add into the
windows installer and projects, and give 'er a thorough once-over.
Modified: trunk/Makefile.in
==============================================================================
--- trunk/Makefile.in (original)
+++ trunk/Makefile.in Sun Mar 8 18:35:05 2009
@@ -84,6 +84,11 @@
-o Makefile.AcidRain_glut && \
$(MAKE) -f Makefile.AcidRain_glut
+bin/PlasmaGenerator : src/PlasmaGenerator/project_files/PlasmaGenerator.pro
+ cd $(srcdir)/src/PlasmaGenerator/project_files/ && $(QMAKE)
PlasmaGenerator.pro \
+ -o Makefile.PlasmaGenerator && \
+ $(MAKE) -f Makefile.PlasmaGenerator
+
doc :
cd doc; $(MAKE)
@@ -92,12 +97,14 @@
-rm bin/PlasmaLenz bin/PlasmaLenz_glut
-rm bin/Crawlies bin/Crawlies_glut
-rm bin/AcidRain bin/AcidRain_glut
+ -rm bin/PlasmaGenerator
-cd $(srcdir)/src/PlasmaLenz/project_files/ && $(MAKE) -f
Makefile.PlasmaLenz_scr clean
-cd $(srcdir)/src/PlasmaLenz/project_files/ && $(MAKE) -f
Makefile.PlasmaLenz_glut clean
-cd $(srcdir)/src/Crawlies/project_files/ && $(MAKE) -f
Makefile.Crawlies_scr clean
-cd $(srcdir)/src/Crawlies/project_files/ && $(MAKE) -f
Makefile.Crawlies_glut clean
-cd $(srcdir)/src/AcidRain/project_files/ && $(MAKE) -f
Makefile.AcidRain_scr clean
-cd $(srcdir)/src/AcidRain/project_files/ && $(MAKE) -f
Makefile.AcidRain_glut clean
+ -cd $(srcdir)/src/PlasmaGenerator/project_files/ && $(MAKE) -f
Makefile.PlasmaGenerator clean
-cd doc; $(MAKE) -f Makefile clean
distclean:
@@ -111,6 +118,7 @@
-cd $(srcdir)/src/Crawlies/project_files/ && $(MAKE) -f
Makefile.Crawlies_glut distclean
-cd $(srcdir)/src/AcidRain/project_files/ && $(MAKE) -f
Makefile.AcidRain_scr distclean
-cd $(srcdir)/src/AcidRain/project_files/ && $(MAKE) -f
Makefile.AcidRain_glut distclean
+ -cd $(srcdir)/src/PlasmaGenerator/project_files/ && $(MAKE) -f
Makefile.PlasmaGenerator distclean
-cd doc; $(MAKE) -f Makefile distclean
-rm -rf autom4te.cache
-rm Makefile
Added: trunk/config_files/PlasmaGenerator.xml
==============================================================================
--- (empty file)
+++ trunk/config_files/PlasmaGenerator.xml Sun Mar 8 18:35:05 2009
@@ -0,0 +1,1005 @@
+<!DOCTYPE PlasmaGenerator_Configuration>
+<PlasmaGenerator_Configuration>
+ <IndexedPaletteProfile>
+ <name>RGB Highlights</name>
+ <width>120</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>128</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>1</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>128</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>7</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>8</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>40</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>128</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>41</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>44</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>128</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>47</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>48</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>80</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>128</blue>
+ <alpha>255</alpha>
+ <x_coordinate>81</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>84</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>128</blue>
+ <alpha>255</alpha>
+ <x_coordinate>87</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>88</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>Mono</name>
+ <width>128</width>
+ <height>128</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>16</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>32</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>48</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>64</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>80</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>96</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>2</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>4</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>66</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>68</x_coordinate>
+ <y_coordinate>112</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>Tuscan Right</name>
+ <width>320</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>182</red>
+ <green>66</green>
+ <blue>27</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>231</green>
+ <blue>134</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>109</red>
+ <green>114</green>
+ <blue>140</blue>
+ <alpha>255</alpha>
+ <x_coordinate>126</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>58</red>
+ <green>149</green>
+ <blue>76</blue>
+ <alpha>255</alpha>
+ <x_coordinate>185</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>106</red>
+ <green>63</green>
+ <blue>27</blue>
+ <alpha>255</alpha>
+ <x_coordinate>249</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>RGB Waves</name>
+ <width>192</width>
+ <height>1</height>
+ <interpolate_colors>Sinusoidal</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>31</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>94</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>158</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>The Gamut</name>
+ <width>128</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>15</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>32</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>48</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>64</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>80</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>96</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>112</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>Steel</name>
+ <width>60</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>196</blue>
+ <alpha>255</alpha>
+ <x_coordinate>9</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>128</red>
+ <green>196</green>
+ <blue>196</blue>
+ <alpha>255</alpha>
+ <x_coordinate>19</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>29</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>128</red>
+ <green>196</green>
+ <blue>196</blue>
+ <alpha>255</alpha>
+ <x_coordinate>39</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>196</blue>
+ <alpha>255</alpha>
+ <x_coordinate>49</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>Classic RGB Palette</name>
+ <width>192</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <IndexedPaletteProfile>
+ <name>Fade RGB to CMY Palette</name>
+ <width>192</width>
+ <height>96</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>15</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>15</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>15</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>31</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>31</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>31</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>47</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>47</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>47</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>63</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>63</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>63</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>79</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>79</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>79</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <PlasmaGeneratorProfile>
+ <name>Classic RGB Profile</name>
+ <palette>Classic RGB Palette</palette>
+ <coarseness>1</coarseness>
+ <clamp_color>true</clamp_color>
+ <tile_horizontal>false</tile_horizontal>
+ <tile_vertical>false</tile_vertical>
+ <height>1024</height>
+ <width>1024</width>
+ <target>Plasma.jpg</target>
+ <policy>ASK</policy>
+ </PlasmaGeneratorProfile>
+ <gpl_accepted>false</gpl_accepted>
+ <default_profile>Classic RGB Profile</default_profile>
+ <default_palette>Classic RGB Palette</default_palette>
+ <default_texture_width>256</default_texture_width>
+ <default_texture_height>256</default_texture_height>
+</PlasmaGenerator_Configuration>
+
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Sun Mar 8 18:35:05 2009
@@ -115,6 +115,18 @@
[man_targets="$man_targets AcidRain/man_page/AcidRain.1"]
fi
+AC_ARG_ENABLE([plasmagenerator],
[AC_HELP_STRING([--enable-plasmagenerator],
+ [build PlasmaGenerator utility default=no])],
+ [enable_plasmagenerator=$enableval],
+ [enable_plasmagenerator=no])
+
+if test "$enable_plasmagenerator" == "yes";
+ then
+ [qt_targets="$qt_targets PlasmaGenerator"]
+ [data_targets="$data_targets PlasmaGenerator.xml"]
+ [man_targets="$man_targets PlasmaGenerator/man_page/PlasmaGenerator.1"]
+fi
+
AC_SUBST(bintrg, $qt_targets)
AC_SUBST(datatrg, $data_targets)
AC_SUBST(mantrg, $man_targets)
Modified: trunk/src/PlasmaGenerator/project_files/PlasmaGenerator.pro
==============================================================================
--- trunk/src/PlasmaGenerator/project_files/PlasmaGenerator.pro (original)
+++ trunk/src/PlasmaGenerator/project_files/PlasmaGenerator.pro Sun Mar 8
18:35:05 2009
@@ -14,8 +14,15 @@
INCLUDEPATH = $$COMMON_PATH $$SOURCE_PATH $$RESOURCE_PATH
-SOURCES = PlasmaGenerator.cpp
-SOURCES += ConfigManager.cpp PlasmaGeneratorDialog.cpp
+SOURCES = $$SOURCE_PATH/PlasmaGenerator.cpp
+SOURCES += $$SOURCE_PATH/PlasmaGeneratorMain.cpp
+SOURCES += $$SOURCE_PATH/PlasmaGeneratorProfile.cpp
+SOURCES += $$SOURCE_PATH/ConfigManager.cpp
+SOURCES += $$SOURCE_PATH/PlasmaGeneratorDialog.cpp
+SOURCES += $$SOURCE_PATH/project_specific_externs.cpp
+SOURCES += $$SOURCE_PATH/PlasmaGeneratorPaletteEditor.cpp
+SOURCES += $$SOURCE_PATH/PlasmaGeneratorPaletteSelectWidget.cpp
+
SOURCES += $$COMMON_PATH/core/win_misc_funcs.cpp
SOURCES += $$COMMON_PATH/IndexedPalette/IndexedPalette.cpp
@@ -34,8 +41,13 @@
SOURCES += $$COMMON_PATH/utility/AboutDialog.cpp
-HEADERS = ConfigManager.h
-HEADERS += PlasmaGeneratorDialog.h
+HEADERS = $$SOURCE_PATH/ConfigManager.h
+HEADERS += $$SOURCE_PATH/PlasmaGenerator.h
+HEADERS += $$SOURCE_PATH/PlasmaGeneratorProfile.h
+HEADERS += $$SOURCE_PATH/PlasmaGeneratorDialog.h
+HEADERS += $$SOURCE_PATH/PlasmaGeneratorPaletteEditor.h
+HEADERS += $$SOURCE_PATH/PlasmaGeneratorPaletteSelectWidget.h
+
HEADERS += $$COMMON_PATH/core/win_misc_funcs.h
HEADERS += $$COMMON_PATH/IndexedPalette/IndexedPalette.h
Modified: trunk/src/PlasmaGenerator/resource_files/app_icon.png
==============================================================================
Binary files. No diff available.
Modified: trunk/src/PlasmaGenerator/resource_files/defaults.xml
==============================================================================
--- trunk/src/PlasmaGenerator/resource_files/defaults.xml (original)
+++ trunk/src/PlasmaGenerator/resource_files/defaults.xml Sun Mar 8
18:35:05 2009
@@ -1,111 +1,59 @@
-<!DOCTYPE PlasmaLenz_Configuration>
-<PlasmaLenz_Configuration>
- <BackgroundProfile>
- <type>PlasmaFractalBackground</type>
- <name>Classic RGB Profile</name>
- <coarseness>4.5</coarseness>
- <steps_per_tick>2048</steps_per_tick>
- <anmiate_palette>true</anmiate_palette>
- <palette_x_speed>1</palette_x_speed>
- <palette_y_speed>1</palette_y_speed>
- <clamp_color>true</clamp_color>
- <palette>Classic RGB Palette</palette>
- </BackgroundProfile>
- <IndexedPaletteProfile>
- <name>Classic RGB Palette</name>
- <width>192</width>
- <height>1</height>
- <interpolate_colors>Linear</interpolate_colors>
- <wrap_colors>true</wrap_colors>
- <default_color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </default_color>
- <color_list>
- <color_entry>
- <red>255</red>
- <green>0</green>
- <blue>0</blue>
- <alpha>255</alpha>
- <x_coordinate>0</x_coordinate>
- <y_coordinate>0</y_coordinate>
- </color_entry>
- <color_entry>
- <red>0</red>
- <green>255</green>
- <blue>0</blue>
- <alpha>255</alpha>
- <x_coordinate>63</x_coordinate>
- <y_coordinate>0</y_coordinate>
- </color_entry>
- <color_entry>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- <alpha>255</alpha>
- <x_coordinate>127</x_coordinate>
- <y_coordinate>0</y_coordinate>
- </color_entry>
- </color_list>
- </IndexedPaletteProfile>
- <LensProfile>
- <type>SphericalLensProfile</type>
- <name>Sphere</name>
- <palette_name>Default Lens Palette</palette_name>
- <outline_width>2</outline_width>
- <random_tint>false</random_tint>
- <use_primary_tint>false</use_primary_tint>
- <primary_tint_is_complement>false</primary_tint_is_complement>
- <use_outline_tint>false</use_outline_tint>
- <outline_tint_is_complement>true</outline_tint_is_complement>
- <min_speed>2</min_speed>
- <max_speed>6</max_speed>
- <random_speed>true</random_speed>
- <min_angle>0.785398</min_angle>
- <max_angle>2.35619</max_angle>
- <random_angle>true</random_angle>
- <random_side>true</random_side>
- <side_types>
- <side_entry>
- <side>Bottom</side>
- <location>0</location>
- </side_entry>
- <side_entry>
- <side>Top</side>
- <location>1</location>
- </side_entry>
- <side_entry>
- <side>Left</side>
- <location>2</location>
- </side_entry>
- <side_entry>
- <side>Right</side>
- <location>3</location>
- </side_entry>
- </side_types>
- <min_radius>0.075</min_radius>
- <max_radius>0.15</max_radius>
- <distortion_factor>0.75</distortion_factor>
- <random_size>true</random_size>
- <instances_max>5</instances_max>
- </LensProfile>
- <MasterProfile>
- <name>Classic RGB</name>
- <width>1024</width>
- <height>1024</height>
- <timer_millis>50</timer_millis>
- <background_profile>Classic RGB Profile</background_profile>
- <lens_profile>Sphere</lens_profile>
- </MasterProfile>
- <random_master_profiles>false</random_master_profiles>
- <gpl_accepted>false</gpl_accepted>
- <master_profile_history_size>3</master_profile_history_size>
- <selected_master_profile_list>
- <selected_entry>
- <name>Classic RGB</name>
- <location>0</location>
- </selected_entry>
- </selected_master_profile_list>
-</PlasmaLenz_Configuration>
-
+<!DOCTYPE PlasmaGenerator_Configuration>
+<PlasmaGenerator_Configuration>
+ <IndexedPaletteProfile>
+ <name>Classic RGB Palette</name>
+ <width>192</width>
+ <height>1</height>
+ <interpolate_colors>Linear</interpolate_colors>
+ <wrap_colors>true</wrap_colors>
+ <default_color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </default_color>
+ <color_list>
+ <color_entry>
+ <red>255</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>0</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ <alpha>255</alpha>
+ <x_coordinate>63</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ <color_entry>
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ <alpha>255</alpha>
+ <x_coordinate>127</x_coordinate>
+ <y_coordinate>0</y_coordinate>
+ </color_entry>
+ </color_list>
+ </IndexedPaletteProfile>
+ <PlasmaGeneratorProfile>
+ <name>Classic RGB Profile</name>
+ <palette>Classic RGB Palette</palette>
+ <coarseness>1</coarseness>
+ <clamp_color>true</clamp_color>
+ <tile_horizontal>false</tile_horizontal>
+ <tile_vertical>false</tile_vertical>
+ <height>1024</height>
+ <width>1024</width>
+ <target>Plasma.jpg</target>
+ <policy>ASK</policy>
+ </PlasmaGeneratorProfile>
+ <gpl_accepted>false</gpl_accepted>
+ <default_profile>Classic RGB Profile</default_profile>
+ <default_palette>Classic RGB Palette</default_palette>
+ <default_texture_width>256</default_texture_width>
+ <default_texture_height>256</default_texture_height>
+</PlasmaGenerator_Configuration>
+
Modified: trunk/src/PlasmaGenerator/src/ConfigManager.cpp
==============================================================================
--- trunk/src/PlasmaGenerator/src/ConfigManager.cpp (original)
+++ trunk/src/PlasmaGenerator/src/ConfigManager.cpp Sun Mar 8 18:35:05 2009
@@ -24,9 +24,6 @@
#include <iostream>
using namespace std;
-// debug
-//#include <QMessageBox>
-//#include "lens_engine/SphericalLensProfile.h"
#include <QCoreApplication>
#include <QApplication>
@@ -45,24 +42,6 @@
//Constructor and deconstructor
ConfigManager::ConfigManager() {
-
- //specify the plugins path. plugins should have been installed
- //by the lib package. the libs need to be added to the system path.
- //first check in HKEY_CURRENT_USER. If not there, check
HKEY_LOCAL_MACHINE.
- /*
- QString getExternalDefaultConfigFile();
- QString getExternalDefaultConfigPath();
- QString rootPath = readRegString(QString("Software\\Phej"),
- QString("Lib Install Base Path"), false);
- if(rootPath == "") {
- rootPath = readRegString(QString("Software\\Phej"),
- QString("Lib Install Base Path"), true);
- }
-
- QString libPath = rootPath + QString("\\Qt-4.2.2\\plugins\\");
- QCoreApplication::addLibraryPath(libPath);
- */
-
_bGPLAccepted = false;
}
@@ -167,7 +146,7 @@
while(!tempNode.isNull()) {
IndexedPaletteProfile* tempProfile =
IndexedPaletteProfile::load(tempNode);
//if non-NULL, add it to the hash of palette profiles
- if(tempProfile != NULL) {
+ if(tempProfile != NULL && !tempProfile->getName().isEmpty()) {
_paletteHash.insert(tempProfile->getName(), tempProfile);
}
tempNode =
tempNode.nextSiblingElement(IndexedPaletteProfile::getXMLTagName());
@@ -180,7 +159,7 @@
PlasmaGeneratorProfile* tempProfile =
PlasmaGeneratorProfile::load(tempNode);
//if non-NULL, add it to the hash of palette profiles
- if(tempProfile != NULL) {
+ if(tempProfile != NULL && !tempProfile->getName().isEmpty()) {
_profiles.insert(tempProfile->getName(), tempProfile);
}
tempNode = tempNode.
@@ -257,6 +236,11 @@
_defaultProfile = tempElem.text();
}
+ tempElem = node.firstChildElement("default_palette");
+ if(!tempElem.isNull()) {
+ _defaultPalette = tempElem.text();
+ }
+
tempElem = node.firstChildElement("default_texture_width");
if(!tempElem.isNull()) {
_defWidth = tempElem.text().toInt();
@@ -286,6 +270,12 @@
tempElem.appendChild(tempNode);
root->appendChild(tempElem);
+ // default palette
+ tempNode = doc->createTextNode(_defaultPalette);
+ tempElem = doc->createElement("default_palette");
+ tempElem.appendChild(tempNode);
+ root->appendChild(tempElem);
+
// default texture width
tempStr.setNum(_defWidth);
tempNode = doc->createTextNode(tempStr);
@@ -315,11 +305,11 @@
}
}
-int ConfigManager::getTextureWidth() {
+int ConfigManager::getDefaultWidth() {
return _defWidth;
}
-int ConfigManager::getTextureHeight() {
+int ConfigManager::getDefaultHeight() {
return _defHeight;
}
@@ -333,6 +323,29 @@
}
/**
+ * Gets the default palette name.
+ */
+QString ConfigManager::getDefaultPalette() {
+ if(!doesPaletteExist(_defaultPalette)) {
+ QList<QString> keys = _paletteHash.keys();
+ if(!keys.empty()) {
+ _defaultPalette = keys.at(0);
+ } else {
+ _defaultPalette = "";
+ }
+ }
+ return _defaultPalette;
+}
+
+/**
+ * Sets the default palette name.
+ */
+void ConfigManager::setDefaultPalette(QString paletteName) {
+ _defaultPalette = paletteName;
+
+}
+
+/**
* Returns a list of the names of the palettes currently in the palette
hash.
*/
QStringList ConfigManager::getPaletteNames() {
@@ -462,6 +475,7 @@
_defaultProfile = profileName;
}
+
/**
* Gets the list of all PlasmaGeneratorProfiles.
*/
@@ -481,7 +495,7 @@
*/
void ConfigManager::addProfile(PlasmaGeneratorProfile& profile) {
//check for preexisting profile name.
- if(!doesProfileExist(profile.getName())) {
+ if(!doesProfileExist(profile.getName()) && profile.getName() !=
QString("")) {
//if not, create a new profile off of the heap to add to the hash.
PlasmaGeneratorProfile* newProfile = new PlasmaGeneratorProfile();
*newProfile = profile;
@@ -511,7 +525,8 @@
//first, check to see if the new profile name is already in the list and
that
//it isn't the same as the old name. If so, fail.
QString newProfileName = newProfile.getName();
- if(oldProfileName != newProfileName && doesProfileExist(newProfileName))
{
+ if(oldProfileName != newProfileName && doesProfileExist(newProfileName)
&&
+ newProfileName != QString("")) {
return false;
}
@@ -593,3 +608,20 @@
return true;
}
+/**
+ * Retrieves an initialized PlasmaGenerator object for the specified
+ * profile. Note: genPlasma will not have been called. Returns NULL
+ * if the profile doesn't exist.
+ */
+PlasmaGenerator* ConfigManager::getGenerator(QString profileName) {
+
+ // if the profile doesn't exist, pop out
+ if(!doesProfileExist(profileName)) {
+ return NULL;
+ }
+
+ PlasmaGeneratorProfile profile = getProfile(profileName);
+
+ // get the generator and generate a plasma!
+ return profile.getGenerator(&_paletteHash);
+}
Modified: trunk/src/PlasmaGenerator/src/ConfigManager.h
==============================================================================
--- trunk/src/PlasmaGenerator/src/ConfigManager.h (original)
+++ trunk/src/PlasmaGenerator/src/ConfigManager.h Sun Mar 8 18:35:05 2009
@@ -78,10 +78,10 @@
//*** End Timer Related ***
- //*** Begin Screen Related ***
- int getTextureWidth();
- int getTextureHeight();
- //*** End Screen Related
+ //*** Begin Default Related ***
+ int getDefaultWidth();
+ int getDefaultHeight();
+ //*** End Default Related
//*** Begin PlasmaGeneratorProfile Related ***
@@ -133,6 +133,16 @@
//*** Begin Palette Related ***
/**
+ * Gets the default palette name.
+ */
+ QString getDefaultPalette();
+
+ /**
+ * Sets the default palette name.
+ */
+ void setDefaultPalette(QString paletteName);
+
+ /**
* Returns a list of the names of the palettes currently
* in the palette hash.
*/
@@ -178,10 +188,6 @@
bool getGPLAccepted();
void setGPLAccepted(bool bAccepted);
- //creates a new ConfigManager object that only contains the specified
configuration.
- //it is intended for to be used in generating the preview widget.
- // ConfigManager* createPreview(int width = 64, int height = 64,
LensProfile* lensProfile = NULL, BackgroundProfile* backgroundProfile =
NULL, int timerMillis = 50);
-
/**
* Gets the human-readable name of the program.
*/
@@ -195,6 +201,13 @@
bool GeneratePlasmaFile(QString profileName, QString outFileName,
bool bOverwriteOverride, bool bOverwrite);
+ /**
+ * Retrieves an initialized PlasmaGenerator object for the specified
+ * profile. Note: genPlasma will not have been called. Returns NULL
+ * if the profile doesn't exist.
+ */
+ PlasmaGenerator* getGenerator(QString profileName);
+
//*** End Misc ***
protected:
@@ -213,6 +226,7 @@
QString _defaultProfile;
QHash<QString, IndexedPaletteProfile*> _paletteHash;
+ QString _defaultPalette;
bool _bGPLAccepted;
Modified: trunk/src/PlasmaGenerator/src/PlasmaGenerator.cpp
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGenerator.cpp (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGenerator.cpp Sun Mar 8 18:35:05
2009
@@ -163,7 +163,7 @@
// calculate the number of steps
float totalNumSteps = (_height*_width /
- PLASMAGENERATOR_NUM_ITERS_PER_CALC) + _height;
+ (3*PLASMAGENERATOR_NUM_ITERS_PER_CALC)) + _height;
float currStep = 0;
// initialize the PlasmaAlgorithm, then step through each calc
@@ -199,6 +199,9 @@
emit progressUpdated((int)(currStep*100.0/totalNumSteps));
}
+ // emit 100%
+ emit progressUpdated(100);
+
// clean up
delete [] field;
field = NULL;
@@ -234,5 +237,5 @@
}
// save
- _img.save(targFileName);
+ return _img.save(targFileName);
}
Modified: trunk/src/PlasmaGenerator/src/PlasmaGenerator.h
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGenerator.h (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGenerator.h Sun Mar 8 18:35:05 2009
@@ -38,7 +38,7 @@
#include "IndexedPalette/IndexedPalette.h"
#include "plasma/PlasmaAlgorithm.h"
-#define PLASMAGENERATOR_NUM_ITERS_PER_CALC 2000
+#define PLASMAGENERATOR_NUM_ITERS_PER_CALC 500
class PlasmaGenerator : public QObject {
Modified: trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.cpp
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.cpp (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.cpp Sun Mar 8
18:35:05 2009
@@ -22,509 +22,1245 @@
*
*/
+// debug
+//#include <iostream>
+//using namespace std;
+//end debug
+
#include <QMessageBox>
+#include <QInputDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QGroupBox>
-#include <QCheckBox>
-#include <QColorDialog>
-#include <QColor>
-#include <QPixmap>
-#include <QImage>
-
-#include <QProgressDialog>
-#include <QApplication>
-
-#include <QString>
+#include <QFileDialog>
+#include <QDir>
+#include <QImageWriter>
+#include <QByteArray>
+#include <QList>
+#include <QStringList>
+#include "IndexedPalette/IndexedPaletteProfile.h"
#include "IndexedPalette/IndexedPaletteDialog.h"
-//#include "IndexedPaletteEditorRawWidget.h"
-#include "IndexedPalette/IndexedPaletteEditorTableWidget.h"
#include "utility/HelpDialog.h"
+#include "utility/ImportExportDialog.h"
+
+#include "PlasmaGeneratorDialog.h"
+#include "PlasmaGeneratorPaletteEditor.h"
-IndexedPaletteDialog::IndexedPaletteDialog(IndexedPaletteProfile*
palProfile, QWidget* parent, Qt::WindowFlags f) {
- QDialog(parent, f);
- _windowTitle = tr("Palette Editor");
- setWindowTitle(_windowTitle);
- setWindowModality(Qt::WindowModal);
- QIcon icon(":/app_icon.png");
- setWindowIcon(icon);
-
- _colorScrollWidget = NULL;
- _colorWidget = NULL;
- _prgDlg = NULL;
- _linearButton = NULL;
- _sineButton = NULL;
- _prgCount = 0;
-
- if(palProfile == NULL) {
- _palProfile.setHeight(16);
- _palProfile.setWidth(16);
- _origPalProfile = _palProfile;
- } else {
- _palProfile = *palProfile;
- _origPalProfile = *palProfile;
- }
-
- _prgDlg = new QProgressDialog("Please wait...", 0, 0,
_palProfile.getHeight()*3+2);
- _prgCount = 0;
-
- //_colorWidget = new IndexedPaletteEditorRawWidget();
- //_colorWidget = new IndexedPaletteEditorListWidget();
- _colorWidget = new IndexedPaletteEditorTableWidget();
- QObject::connect(_colorWidget, SIGNAL(colorChanged(int, int, QRgb*)),
this, SLOT(colorChanged(int, int, QRgb*)));
- populateColorWidget();
-
- //hide();
- QWidget* tempWidget = NULL;
- QPushButton* tempButton = NULL;
- QVBoxLayout* mainLayout = new QVBoxLayout();
- QString tempToolTip;
-
- //top region
- QHBoxLayout* topRegion = new QHBoxLayout();
-
- QVBoxLayout* topLeftPane = new QVBoxLayout();
-
- //name section and change default color
- QHBoxLayout* nameRegion = new QHBoxLayout();
- tempToolTip = tr("The name of the palette.");
- QLabel* tmpLabel = new QLabel(tr("Palette Name:"));
- tmpLabel->setToolTip(tempToolTip);
- nameRegion->addWidget(tmpLabel);
- tmpLabel = NULL;
-
- _nameEdit = new QLineEdit(_palProfile.getName());
- _nameEdit->setToolTip(tempToolTip);
- nameRegion->addWidget(_nameEdit);
-
- tempButton = new QPushButton(tr("Default Color"));
- tempButton->setDefault(false);
- tempButton->setAutoDefault(false);
- tempToolTip = tr("The default color is used for all undefined colors,
unless interpolation is enabled.");
- tempButton->setToolTip(tempToolTip);
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(defaultColorClicked(bool)));
- nameRegion->addWidget(tempButton);
- tempButton = NULL;
-
- tempWidget = new QWidget();
- tempWidget->setLayout(nameRegion);
- topLeftPane->addWidget(tempWidget);
- tempWidget = NULL;
-
- //dimensions
- QHBoxLayout* dimsRegion = new QHBoxLayout();
-
- tmpLabel = new QLabel(tr("Dimensions:"));
- tempToolTip = tr("The height and width of the palette in colors.");
- tmpLabel->setToolTip(tempToolTip);
- dimsRegion->addWidget(tmpLabel);
-
- dimsRegion->addStretch(0);
-
- tempToolTip = tr("The width of the palette.");
- tmpLabel = new QLabel(tr("Width"));
- tmpLabel->setToolTip(tempToolTip);
- dimsRegion->addWidget(tmpLabel);
-
- _xDimBox = new QSpinBox();
- _xDimBox->setRange(1,1024);
- _xDimBox->setSingleStep(1);
- _xDimBox->setValue(_palProfile.getWidth());
- _xDimBox->setToolTip(tempToolTip);
- dimsRegion->addWidget(_xDimBox);
-
- dimsRegion->addStretch(0);
-
- tempToolTip = tr("The height of the palette.");
- tmpLabel = new QLabel(tr("Height"));
- tmpLabel->setToolTip(tempToolTip);
- dimsRegion->addWidget(tmpLabel);
-
- _yDimBox = new QSpinBox();
- _yDimBox->setRange(1,1024);
- _yDimBox->setSingleStep(1);
- _yDimBox->setValue(_palProfile.getHeight());
- _yDimBox->setToolTip(tempToolTip);
- dimsRegion->addWidget(_yDimBox);
-
- tempButton = new QPushButton(tr("Resize"));
- tempButton->setDefault(false);
- tempButton->setAutoDefault(false);
- tempToolTip = tr("Changes the dimensions of the palette. If the new
dimensions are smaller than")+"\n"
- +tr("the current dimensions, colors may be lost!");
- tempButton->setToolTip(tempToolTip);
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(resizeClicked(bool)));
- dimsRegion->addWidget(tempButton);
- tempButton = NULL;
-
- tempWidget = new QWidget();
- tempWidget->setLayout(dimsRegion);
- topLeftPane->addWidget(tempWidget);
- tempWidget = NULL;
-
- tempWidget = new QWidget();
- tempWidget->setLayout(topLeftPane);
- topRegion->addWidget(tempWidget);
- tempWidget = NULL;
-
- //interp colors region
- QGroupBox* interpBox = new QGroupBox(tr("Interpolate Colors"));
- interpBox->setCheckable(true);
- _lastInterpType = _palProfile.getInterpolateColors();
- interpBox->setChecked(_lastInterpType != none);
- tempToolTip = tr("When enabled, interpolation will be used to determine
undefined colors.");
- interpBox->setToolTip(tempToolTip);
- QObject::connect(interpBox, SIGNAL(clicked(bool)), this,
SLOT(interpClicked(bool)));
-
- //QHBoxLayout* interpBoxLayout = new QHBoxLayout();
- QVBoxLayout* interpBoxLayout = new QVBoxLayout();
-
- _linearButton = new QRadioButton(tr("Linear"));
- _linearButton->setChecked(_lastInterpType == linear);
- tempToolTip = tr("Use linear interpolation.");
- _linearButton->setToolTip(tempToolTip);
- interpBoxLayout->addWidget(_linearButton);
- QObject::connect(_linearButton, SIGNAL(toggled(bool)), this,
SLOT(linearClicked(bool)));
+PlasmaGeneratorDialog::PlasmaGeneratorDialog(ConfigManager* manager,
QWidget* parent, Qt::WindowFlags f) {
+ _windowTitle = "Plasma Generation Utility";
+ setWindowTitle(_windowTitle);
+ QIcon icon(":/app_icon.png");
+ setWindowIcon(icon);
+
+ _coarsenessAdjust = 100.0;
+
+ // nullify pointers
+ _fileEdit = NULL;
+ _nameBox = NULL;
+ _palName = NULL;
+ _xDimBox = NULL;
+ _yDimBox = NULL;
+ _tileVertBox = NULL;
+ _tileHorizBox = NULL;
+ _coarsenessBox = NULL;
+ _clampColorBox = NULL;
+ _alwaysBox = NULL;
+ _neverBox = NULL;
+ _askBox = NULL;
+ _previewScrollWidget = NULL;
+ _previewLabel = NULL;
+ _previewPixmap = NULL;
+ _prgDialog = NULL;
+ _gplDialog = NULL;
+ _plasma = NULL;
+
+ // set up
+ _manager = manager;
+ _gplDialog = new GPLDialog(_manager->getGPLAccepted());
+ if(_gplDialog == NULL) {
+ return;
+ }
+ _prgDialog = new QProgressDialog(tr("Plasma Generation Progress"), 0, 0,
100);
+ if(_prgDialog == NULL) {
+ return;
+ }
+
+ // lock out while setting up.
+ _bDontUpdateDisplay = true;
+
+
+ QWidget* tmpWidget = NULL;
+ QPushButton* tmpButton = NULL;
+ QLabel* tmpLabel = NULL;
+ QVBoxLayout* tmpV = NULL;
+ QHBoxLayout* tmpH = NULL;
+ QHBoxLayout* tmpH2 = NULL;
+ QHBoxLayout* tmpH3 = NULL;
+ QGroupBox* tmpGroup = NULL;
+ QString tmpTip;
+
+ QVBoxLayout* mainLayout = new QVBoxLayout();
+ if(mainLayout == NULL) {
+ return;
+ }
+
+ // set up name box region
+ _nameBox = new QComboBox();
+ if(_nameBox == NULL) {
+ return;
+ }
+ _nameBox->addItems(_manager->getAvailableProfiles());
+ _nameBox->setEditable(false);
+ QObject::connect(_nameBox, SIGNAL(currentIndexChanged(QString)), this,
SLOT(profileChanged(QString)));
+
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+ tmpTip = QString(tr("Name of the currently selected profile."));
+ tmpLabel = new QLabel("Profile Name: ");
+ tmpLabel->setToolTip(tmpTip);
+ tmpH->addWidget(tmpLabel);
+ _nameBox->setToolTip(tmpTip);
+ tmpH->addWidget(_nameBox);
+ tmpLabel = NULL;
+
+ tmpH->addStretch(0);
+
+ _defaultButton = new QPushButton(tr("Set Default"));
+ _defaultButton->setDefault(false);
+ _defaultButton->setAutoDefault(false);
+ if(_defaultButton == NULL) {
+ return;
+ }
+ _defaultButton->setToolTip(tr("Sets this profile as the default
profile."));
+ QObject::connect(_defaultButton, SIGNAL(clicked(bool)), this,
SLOT(setDefaultClicked(bool)));
+ tmpH->addWidget(_defaultButton);
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ // profile management region
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+
+ tmpButton = new QPushButton(tr("New"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Creates a new profile."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(newProfileClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("Rename"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Renames this profile."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(renameProfileClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("Copy"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Copies the currently selected profile."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(copyProfileClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("Delete"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Deletes this profile."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(deleteProfileClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ // palette selection & import/export region
+ _palName = new QComboBox();
+ if(_palName == NULL) {
+ return;
+ }
+ _palName->addItems(_manager->getPaletteNames());
+ _palName->setEditable(false);
+
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+ tmpTip = QString(tr("Name of the currently selected palette."));
+ tmpLabel = new QLabel("Palette: ");
+ tmpLabel->setToolTip(tmpTip);
+ tmpH->addWidget(tmpLabel);
+ _palName->setToolTip(tmpTip);
+ tmpH->addWidget(_palName);
+ tmpLabel = NULL;
+
+ tmpButton = new QPushButton(tr("Manage Palettes"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Click here to add, edit, or delete
palettes."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(managePalettesClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpH->addStretch(0);
+
+ tmpButton = new QPushButton(tr("Import"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Click here to import palettes and profiles."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(importClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("Export"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Click here to export palettes and profiles."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(exportClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ // dimensions and tiling controls
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+
+ // dimensions
+ tmpGroup = new QGroupBox("Dimensions");
+ if(tmpGroup == NULL) {
+ return;
+ }
+ tmpTip = QString(tr("Plasma dimensions"));
+ tmpGroup->setToolTip(tmpTip);
+
+ tmpH3 = new QHBoxLayout();
+ if(tmpH3 == NULL) {
+ return;
+ }
+
+ tmpH2 = new QHBoxLayout();
+ if(tmpH2 == NULL) {
+ return;
+ }
+ tmpLabel = new QLabel(tr("Width"));
+ if(tmpLabel == NULL) {
+ return;
+ }
+ tmpLabel->setToolTip(tmpTip);
+ tmpH2->addWidget(tmpLabel);
+
+ _xDimBox = new QSpinBox();
+ if(_xDimBox == NULL) {
+ return;
+ }
+ _xDimBox->setToolTip(tmpTip);
+ _xDimBox->setMinimum(16);
+ _xDimBox->setMaximum(1024*1024);
+ _xDimBox->setSingleStep(1);
+ tmpH2->addWidget(_xDimBox);
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH2);
+ tmpH3->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH2 = NULL;
+
+ tmpH2 = new QHBoxLayout();
+ if(tmpH2 == NULL) {
+ return;
+ }
+ tmpLabel = new QLabel(tr("Height"));
+ if(tmpLabel == NULL) {
+ return;
+ }
+ tmpLabel->setToolTip(tmpTip);
+ tmpH2->addWidget(tmpLabel);
+
+ _yDimBox = new QSpinBox();
+ if(_yDimBox == NULL) {
+ return;
+ }
+ _yDimBox->setToolTip(tmpTip);
+ _yDimBox->setMinimum(16);
+ _yDimBox->setMaximum(1024*1024);
+ _yDimBox->setSingleStep(1);
+ tmpH2->addWidget(_yDimBox);
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH2);
+ tmpH3->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH2 = NULL;
+
+ tmpGroup->setLayout(tmpH3);
+ tmpH3 = NULL;
+ tmpH->addWidget(tmpGroup);
+ tmpGroup = NULL;
+
+ tmpH->addStretch(0);
+
+ tmpGroup = new QGroupBox("Tiling");
+ if(tmpGroup == NULL) {
+ return;
+ }
+ tmpTip = QString(tr("Generate a plasma that can be tiled on the
horizontal and/or vertical axes"));
+ tmpGroup->setToolTip(tmpTip);
+
+ tmpH3 = new QHBoxLayout();
+ if(tmpH3 == NULL) {
+ return;
+ }
+
+ _tileVertBox = new QCheckBox(tr("Vertical"));
+ if(_tileVertBox == NULL) {
+ return;
+ }
+ _tileVertBox->setToolTip(tmpTip);
+ _tileVertBox->setTristate(false);
+ tmpH3->addWidget(_tileVertBox);
+
+ _tileHorizBox = new QCheckBox(tr("Horizontal"));
+ if(_tileHorizBox == NULL) {
+ return;
+ }
+ _tileHorizBox->setToolTip(tmpTip);
+ _tileHorizBox->setTristate(false);
+ tmpH3->addWidget(_tileHorizBox);
+
+ tmpGroup->setLayout(tmpH3);
+ tmpH3 = NULL;
+ tmpH->addWidget(tmpGroup);
+ tmpGroup = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ // coarseness adjust and clamp color box
+ tmpGroup = new QGroupBox(tr("Field Generation"));
+ if(tmpGroup == NULL)
+ return;
+
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+
+ tmpLabel = new QLabel(tr("Less Volatile"));
+ tmpTip = tr("This quantity determines how coarse or volatile the fractal
is. More volatile, the more variation.");
+ tmpLabel->setToolTip(tmpTip);
+ tmpH->addWidget(tmpLabel);
+
+ _coarsenessBox = new QSlider(Qt::Horizontal);
+ _coarsenessBox->setTickInterval(0.10*_coarsenessAdjust);
+ //_coarsenessBox->setTickPosition(QSlider::TicksBelow);
+ _coarsenessBox->setMinimum(0.01*_coarsenessAdjust);
+ _coarsenessBox->setMaximum(6.00*_coarsenessAdjust);
+ _coarsenessBox->setToolTip(tmpTip);
+ tmpH->addWidget(_coarsenessBox);
+
+ tmpLabel = new QLabel(tr("More Volatile"));
+ tmpLabel->setToolTip(tmpTip);
+ tmpH->addWidget(tmpLabel);
- _sineButton = new QRadioButton(tr("Sinusoidal"));
- _sineButton->setChecked(_lastInterpType == sine);
- tempToolTip = tr("Use sin(t) interpolation.");
- _sineButton->setToolTip(tempToolTip);
- interpBoxLayout->addWidget(_sineButton);
- QObject::connect(_sineButton, SIGNAL(toggled(bool)), this,
SLOT(sineClicked(bool)));
-
- QCheckBox* wrapBox = new QCheckBox(tr("Wrap Colors"));
- wrapBox->setCheckable(true);
- wrapBox->setChecked(_palProfile.getWrapColors());
- tempToolTip = tr("When endpoint colors are not defined, the interpolator
will \"wrap around\" when checked.");
- wrapBox->setToolTip(tempToolTip);
- QObject::connect(wrapBox, SIGNAL(clicked(bool)), this,
SLOT(wrapClicked(bool)));
- interpBoxLayout->addWidget(wrapBox);
- interpBox->setLayout(interpBoxLayout);
-
- topRegion->addWidget(interpBox);
-
- tempWidget = new QWidget();
- tempWidget->setLayout(topRegion);
- mainLayout->addWidget(tempWidget);
- tempWidget = NULL;
-
- //draw grid of entry buttons
- //_colorScrollWidget = new QScrollArea();
-
- //_colorScrollWidget->setWidget(_colorWidget);
- //mainLayout->addWidget(_colorScrollWidget);
- mainLayout->addWidget(_colorWidget->getWidget());
-
- //preview area
- tempToolTip = tr("This view shows how the will palette look when in
use.");
- tmpLabel = new QLabel("Preview:");
- tmpLabel->setToolTip(tempToolTip);
- mainLayout->addWidget(tmpLabel);
- tmpLabel = NULL;
-
- _previewZoom = 4;
- _previewLabel = new QLabel();
- _previewLabel->setToolTip(tempToolTip);
- _previewLabel->setPixmap(_previewPixmap);
- updatePreviewIcon();
-
- QScrollArea* previewScrollArea = new QScrollArea();
- previewScrollArea->setWidget(_previewLabel);
- previewScrollArea->setToolTip(tempToolTip);
- mainLayout->addWidget(previewScrollArea);
+ tmpH->addStretch(0);
+
+ _clampColorBox = new QCheckBox(tr("Clamp color on overflow"));
+ if(_clampColorBox == NULL) {
+ return;
+ }
+ _clampColorBox->setToolTip(tr("When the plasma algorithm generates an
invalid color index, it will clamp")+"\n"
+ +tr("to the nearest valid color if checked, or wrap around if
unchecked."));
+ tmpH->addWidget(_clampColorBox);
+
+ tmpGroup->setLayout(tmpH);
+ mainLayout->addWidget(tmpGroup);
+ tmpH = NULL;
+ tmpGroup = NULL;
+
+ // preview region
+ _previewScrollWidget = new QScrollArea();
+ if(_previewScrollWidget == NULL) {
+ return;
+ }
+ _previewScrollWidget->setToolTip(tr("Plasma preview area."));
+ _previewLabel = new QLabel();
+ if(_previewLabel == NULL) {
+ return;
+ }
+ _previewLabel->setPixmap(_previewPixmap);
+ _previewLabel->setToolTip(_previewScrollWidget->toolTip());
+ _previewScrollWidget->setWidget(_previewLabel);
+ mainLayout->addWidget(_previewScrollWidget);
+
+ // overwrite policy & generate region
+ tmpH2 = new QHBoxLayout();
+ if(tmpH2 == NULL) {
+ return;
+ }
+
+ tmpGroup = new QGroupBox("Overwrite Policy");
+ if(tmpGroup == NULL) {
+ return;
+ }
+ tmpTip = QString(tr("File overwrite policy. If a file with the name
below already exists, should PlasmaGenerator replace the file: always,
never, or ask. Note that ask defaults to never in command-line mode."));
+ tmpGroup->setToolTip(tmpTip);
+
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+
+ _alwaysBox = new QRadioButton(tr("Always"));
+ if(_alwaysBox == NULL) {
+ return;
+ }
+ tmpH->addWidget(_alwaysBox);
+
+ _neverBox = new QRadioButton(tr("Never"));
+ if(_neverBox == NULL) {
+ return;
+ }
+ tmpH->addWidget(_neverBox);
+
+ _askBox = new QRadioButton(tr("Ask"));
+ if(_askBox == NULL) {
+ return;
+ }
+ tmpH->addWidget(_askBox);
+
+ tmpGroup->setLayout(tmpH);
+ tmpH2->addWidget(tmpGroup);
+ tmpGroup = NULL;
+ tmpH = NULL;
+
+ tmpH2->addStretch(0);
+
+ tmpButton = new QPushButton(tr("Generate"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Generates a new plasma"));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(generateClicked(bool)));
+ tmpH2->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH2);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH2 = NULL;
+
+ // save to file region
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+
+ _fileEdit = new QLineEdit();
+ if(_fileEdit == NULL) {
+ return;
+ }
+ _fileEdit->setToolTip(tr("Filename to save plasma image to."));
+ _fileEdit->setReadOnly(false);
+ _fileEdit->setDragEnabled(true);
+ tmpH->addWidget(_fileEdit);
+
+ tmpButton = new QPushButton(tr("Browse"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Browse for file to export image to."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(browseClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("&Save"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ tmpButton->setToolTip(tr("Saves the current plasma image to disk."));
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(saveClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ // buttons at bottom
+ tmpH = new QHBoxLayout();
+ if(tmpH == NULL) {
+ return;
+ }
+ tmpButton = new QPushButton(tr("&Help"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(helpClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpH->addStretch(0);
+
+ tmpButton = new QPushButton(tr("&Apply"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(applyClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("&OK"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(okClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton->setDefault(true);
+ tmpButton->setAutoDefault(true);
+ tmpButton = NULL;
+
+ tmpButton = new QPushButton(tr("&Cancel"));
+ if(tmpButton == NULL) {
+ return;
+ }
+ QObject::connect(tmpButton, SIGNAL(clicked(bool)), this,
SLOT(cancelClicked(bool)));
+ tmpH->addWidget(tmpButton);
+ tmpButton = NULL;
+
+ tmpWidget = new QWidget();
+ tmpWidget->setLayout(tmpH);
+ mainLayout->addWidget(tmpWidget);
+ tmpWidget = NULL;
+ tmpH = NULL;
+
+ setLayout(mainLayout);
+
+ // generate the filter list of supported file formats
+ QList<QByteArray> list = QImageWriter::supportedImageFormats();
+ QStringList uniqueList;
+ QString ext;
+ int i;
+ for(i=0; i<list.size();i++) {
+ ext = list.at(i);
+ if(!uniqueList.contains(QString(ext), Qt::CaseInsensitive)) {
+ uniqueList.append(ext.toUpper());
+ }
+ }
+ int listSize = uniqueList.size();
+ for(i=0; i<listSize;i++) {
+ ext = uniqueList.at(i);
+ _fileFormatFilter.append(ext);
+ _fileFormatFilter.append(" Files (*.");
+ _fileFormatFilter.append(ext.toLower());
+ _fileFormatFilter.append(" *.");
+ _fileFormatFilter.append(ext);
+ _fileFormatFilter.append(")");
+ if(i < listSize-1) {
+ _fileFormatFilter.append(";;");
+ }
+ }
+
+ // choose default filter
+ if(uniqueList.contains(QString("JPG"))) {
+ _selFilter = QString("JPG Files (*.jpg *.JPG)");
+ } else if(uniqueList.contains(QString("PNG"))) {
+ _selFilter = QString("PNG Files (*.png *.PNG)");
+ } else if(uniqueList.contains(QString("BMP"))) {
+ _selFilter = QString("BMP Files (*.bmp *.BMP)");
+ }
+
+ // last thing is to update the data with the default profile.
+ _bDontUpdateDisplay = false;
+
_nameBox->setCurrentIndex(_nameBox->findText(_manager->getDefaultProfile()));
+ updateDisplay();
+}
+
+PlasmaGeneratorDialog::~PlasmaGeneratorDialog() {
+ _manager = NULL;
+
+ if(_gplDialog != NULL) {
+ delete _gplDialog;
+ _gplDialog = NULL;
+ }
+ // widgets should get deleted automatically when the main layout gets
+ // deleted...
+ /*
+ if(_fileEdit != NULL) {
+ delete _fileEdit;
+ _fileEdit = NULL;
+ }
+ if(_nameBox != NULL) {
+ delete _nameBox;
+ _nameBox = NULL;
+ }
+ if(_palName != NULL) {
+ delete _palName;
+ _palName = NULL;
+ }
+ if(_xDimBox != NULL) {
+ delete _xDimBox;
+ _xDimBox = NULL;
+ }
+ if(_yDimBox != NULL) {
+ delete _yDimBox;
+ _yDimBox = NULL;
+ }
+ if(_tileVertBox != NULL) {
+ delete _tileVertBox;
+ _tileVertBox = NULL;
+ }
+ if(_tileHorizBox != NULL) {
+ delete _tileHorizBox;
+ _tileHorizBox = NULL;
+ }
+ if(_alwaysBox != NULL) {
+ delete _alwaysBox;
+ _alwaysBox = NULL;
+ }
+ if(_askBox != NULL) {
+ delete _askBox;
+ _askBox = NULL;
+ }
+ if(_neverBox != NULL) {
+ delete _neverBox;
+ _neverBox = NULL;
+ }
+ if(_previewScrollWidget != NULL) {
+ delete _previewScrollWidget;
+ _previewScrollWidget = NULL;
+ }
+ if(_previewLabel != NULL) {
+ delete _previewLabel;
+ _previewLabel = NULL;
+ }
+ if(_previewPixmap != NULL) {
+ delete _previewPixmap;
+ _previewPixmap = NULL;
+ }
+ */
+ if(_prgDialog != NULL) {
+ delete _prgDialog;
+ _prgDialog = NULL;
+ }
+ if(_plasma != NULL) {
+ delete _plasma;
+ _plasma = NULL;
+ }
+}
+
+void PlasmaGeneratorDialog::applyClicked(bool checked) {
+ // update and save
+ updateProfile();
+ _manager->save();
+}
+
+void PlasmaGeneratorDialog::okClicked(bool checked) {
+ // update profile in config manager and save
+ updateProfile();
+ _manager->save();
+ accept();
+}
+
+void PlasmaGeneratorDialog::cancelClicked(bool checked) {
+ reject();
+}
+
+void PlasmaGeneratorDialog::helpClicked(bool checked) {
+ HelpDialog* dlg = new HelpDialog("qrc:/help/index.html");
+ if(dlg != NULL) {
+ dlg->exec();
+ delete dlg;
+ dlg = NULL;
+ }
+}
+
+void PlasmaGeneratorDialog::managePalettesClicked(bool checked) {
+ PlasmaGeneratorPaletteEditor* dlg =
+ new PlasmaGeneratorPaletteEditor(_manager, this);
+ dlg->exec();
+
+ //clean up
+ delete dlg;
+ dlg = NULL;
+
+ // refresh names
+ _palName->clear();
+ _palName->addItems(_manager->getPaletteNames());
+ updateDisplay();
+}
+
+void PlasmaGeneratorDialog::setDefaultClicked(bool checked) {
+ _bDefault = true;
+ _defaultButton->setEnabled(false);
+}
+
+void PlasmaGeneratorDialog::newProfileClicked(bool checked) {
+ // prompt for name from user
+ bool bOk;
+ bool bDone = false;
+ QString tmpName;
+
+ while(!bDone) {
+
+ tmpName = QInputDialog::getText(this, tr("Create New Profile"),
+ tr("Please enter a new profile name:"),
+ QLineEdit::Normal, tr("New Profile"),
+ &bOk);
+ if(!bOk) {
+ return;
+ }
+
+ if(tmpName.isEmpty()) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("Please enter a valid profile name."),
+ QMessageBox::Ok);
+ } else if(_manager->doesProfileExist(tmpName)) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("There is already a profile named '")+
+ tmpName+tr("'. Please choose a new name."),
+ QMessageBox::Ok);
+ } else {
+ bDone = true;
+ }
+ }
+
+ // set defaults
+ PlasmaGeneratorProfile profile;
+ profile.setWidth(_manager->getDefaultWidth());
+ profile.setHeight(_manager->getDefaultHeight());
+ profile.setPaletteName(_manager->getDefaultPalette());
+ profile.setName(tmpName);
+ _manager->addProfile(profile);
+ _nameBox->addItem(tmpName);
+ _nameBox->setCurrentIndex(_nameBox->findText(tmpName));
+}
+
+void PlasmaGeneratorDialog::renameProfileClicked(bool checked) {
+ // prompt for name from user
+ bool bOk;
+ bool bDone = false;
+ QString tmpName;
+ QString oldName = _currentProfile;
+
+ updateProfile();
+
+ while(!bDone) {
+
+ tmpName = QInputDialog::getText(this, tr("Rename Profile"),
+ tr("Please enter a new profile name:"),
+ QLineEdit::Normal, _currentProfile,
+ &bOk);
+ if(!bOk) {
+ return;
+ }
+
+ if(tmpName.isEmpty()) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("Please enter a valid profile name."),
+ QMessageBox::Ok);
+ } else if(_manager->doesProfileExist(tmpName)) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("There is already a profile named '")+
+ tmpName+tr("'. Please choose a new name."),
+ QMessageBox::Ok);
+ } else {
+ bDone = true;
+ }
+ }
+
+ if(tmpName == _currentProfile) {
+ return;
+ }
+
+ PlasmaGeneratorProfile profile = _manager->getProfile(oldName);
+ profile.setName(tmpName);
+ _manager->replaceProfile(oldName, profile);
+ _currentProfile = tmpName;
+ _nameBox->removeItem(_nameBox->findText(oldName));
+ _nameBox->addItem(tmpName);
+ _nameBox->setCurrentIndex(_nameBox->findText(tmpName));
+}
+
+void PlasmaGeneratorDialog::copyProfileClicked(bool checked) {
+ // prompt for name from user
+ bool bOk;
+ bool bDone = false;
+ QString tmpName;
+
+ updateProfile();
+
+ while(!bDone) {
+
+ tmpName = QInputDialog::getText(this, tr("Copy Profile"),
+ tr("Please enter a new profile name:"),
+ QLineEdit::Normal, _currentProfile,
+ &bOk);
+ if(!bOk) {
+ return;
+ }
+
+ if(tmpName.isEmpty()) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("Please enter a valid profile name."),
+ QMessageBox::Ok);
+ } else if(_manager->doesProfileExist(tmpName)) {
+ QMessageBox::information(this, tr("Profile Name"),
+ tr("There is already a profile named '")+
+ tmpName+tr("'. Please choose a new name."),
+ QMessageBox::Ok);
+ } else {
+ bDone = true;
+ }
+ }
+
+ PlasmaGeneratorProfile profile = _manager->getProfile(_currentProfile);
+ profile.setName(tmpName);
+ _manager->addProfile(profile);
+ _nameBox->addItem(tmpName);
+ _nameBox->setCurrentIndex(_nameBox->findText(tmpName));
+}
- //Revert, OK, and Cancel buttons
- QHBoxLayout* botButtonsLayout = new QHBoxLayout();
+void PlasmaGeneratorDialog::deleteProfileClicked(bool checked) {
+ QString oldName = _currentProfile;
+ _currentProfile = QString("");
+ _manager->removeProfile(oldName);
+ _nameBox->removeItem(_nameBox->findText(oldName));
+ _nameBox->setCurrentIndex(0);
+}
+
+void PlasmaGeneratorDialog::profileChanged(const QString& newProfile) {
+ updateDisplay();
+}
+
+void PlasmaGeneratorDialog::generateClicked(bool checked) {
+ updateProfile();
+ if(_plasma != NULL) {
+ delete _plasma;
+ _plasma = NULL;
+ }
+
+ // create a generator and connect it to the progress dialog
+ _plasma = _manager->getGenerator(_currentProfile);
+ if(_plasma == NULL) {
+ return;
+ }
+ QObject::connect(_plasma, SIGNAL(progressUpdated(int)), _prgDialog,
SLOT(setValue(int)));
+ _prgDialog->show();
+ if(!_plasma->genPlasma()) {
+ _prgDialog->hide();
+ // error!
+ QMessageBox::critical(this, _windowTitle, tr("Error generating
plasma!"), QMessageBox::Ok);
+ delete _plasma;
+ _plasma = NULL;
+ return;
+ }
+ _prgDialog->hide();
+
+ _previewPixmap = QPixmap::fromImage(_plasma->getPlasma());
+ QString tmpTip = _previewScrollWidget->toolTip();
+ //_previewPixmap.setToolTip(tmpTip);
+ _previewLabel = new QLabel();
+ if(_previewLabel == NULL) {
+ QMessageBox::critical(this, _windowTitle, tr("Error generating
plasma!"), QMessageBox::Ok);
+ delete _plasma;
+ _plasma = NULL;
+ return;
+ }
+ _previewLabel->setPixmap(_previewPixmap);
+ _previewScrollWidget->setWidget(_previewLabel);
+}
+
+void PlasmaGeneratorDialog::saveClicked(bool checked) {
+ updateProfile();
+
+ // make sure there is something in the filename field.
+ QString filename = _fileEdit->text();
+ if(filename.isEmpty()) {
+ QMessageBox::warning(this, tr("Save Plasma"), tr("Please specify a
target filename."), QMessageBox::Ok);
+
+ return;
+ }
+
+ // check to see if there is a current plasma object. If not, generate
one.
+ if(_plasma == NULL) {
+ generateClicked(false);
+ }
+
+ bool bOverwrite = false;
+ // if the overwrite policy is ask, check to see if the file exists first.
+ // otherwise, set bOverwrite to the appropriate value.
+ switch(_manager->getProfile(_currentProfile).getOverwritePolicy()) {
+ case ALWAYS:
+ bOverwrite = true;
+ break;
+ case NEVER:
+ bOverwrite = false;
+ break;
+ default:
+ // check for file
+ if(QFile(filename).exists()) {
+ int ret = QMessageBox::question(this, tr("Save Plasma"), filename+
+ tr(" already exists. Overwrite?"),
+ QMessageBox::Yes | QMessageBox::No |
+ QMessageBox::Cancel);
+ switch(ret) {
+ case QMessageBox::Yes:
+ bOverwrite = true;
+ break;
+ case QMessageBox::No:
+ bOverwrite = false;
+ break;
+ default:
+ return;
+ }
+ } else {
+ bOverwrite = false;
+ }
+ }
+
+ // now attempt to save to the specified filename
+ _plasma->savePlasma(filename, bOverwrite);
+}
+
+void PlasmaGeneratorDialog::browseClicked(bool checked) {
+ // no need to confirm overwrite. This will happen with the save button.
+ QString path = QFileDialog::getSaveFileName(this, tr("Save Plasma to
File"),
+ QDir::homePath(),
+ _fileFormatFilter, &_selFilter,
+ QFileDialog::DontConfirmOverwrite
+ );
+ if(!path.isEmpty()) {
+ _fileEdit->setText(path);
+ }
+}
+
+void PlasmaGeneratorDialog::importClicked(bool checked) {
+ ImportExportDialog dlg(true);
+
+ // get file name to import from
+ QString filename = QFileDialog::getOpenFileName(this, tr("Import
Settings From File"), QDir::homePath(),
+ tr("Settings Files (*.xml)"));
+
+ if(filename.isEmpty())
+ return;
- tempButton = new QPushButton(tr("&Help"));
- tempButton->setDefault(false);
- tempButton->setAutoDefault(false);
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(helpClicked(bool)));
- botButtonsLayout->addWidget(tempButton);
- tempButton = NULL;
-
- tempButton = new QPushButton(tr("&Revert"));
- tempButton->setEnabled(false);
- tempButton->setDefault(false);
- tempButton->setAutoDefault(false);
- tempToolTip = tr("Undoes all changes made since the dialog box opened.");
- tempButton->setToolTip(tempToolTip);
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(revertClicked(bool)));
- botButtonsLayout->addWidget(tempButton);
- tempButton = NULL;
-
- botButtonsLayout->addStretch(0);
-
- tempButton = new QPushButton(tr("&OK"));
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(okClicked(bool)));
- tempButton->setDefault(true);
- tempButton->setAutoDefault(true);
- botButtonsLayout->addWidget(tempButton);
- tempButton = NULL;
-
- tempButton = new QPushButton(tr("&Cancel"));
- tempButton->setDefault(false);
- tempButton->setAutoDefault(false);
- QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(cancelClicked(bool)));
- botButtonsLayout->addWidget(tempButton);
- tempButton = NULL;
-
- tempWidget = new QWidget();
- tempWidget->setLayout(botButtonsLayout);
- mainLayout->addWidget(tempWidget);
- tempWidget = NULL;
-
- setLayout(mainLayout);
-
- //show();
-
- //clean up progress dialog
- if(_prgDlg != NULL) {
- delete _prgDlg;
- _prgDlg = NULL;
- _prgCount = 0;
- }
-
-}
-
-IndexedPaletteDialog::~IndexedPaletteDialog() {
-
- //all widgets should get destroyed by the layout.
- _colorScrollWidget = NULL;
- _colorWidget = NULL;
- _nameEdit = NULL;
- _previewLabel = NULL;
- _prgDlg = NULL;
- _xDimBox = NULL;
- _yDimBox = NULL;
-
- /*
- if(_colorScrollWidget != NULL) {
- delete _colorScrollWidget;
- _colorScrollWidget = NULL;
- }
+ // create a temporary config manager and load
+ // it with data from the import file.
+ ConfigManager* tmpMgr = new ConfigManager();
+ if(tmpMgr == NULL)
+ return;
+ tmpMgr->importFromFile(filename, false);
+
+ // populate dialog box
+ QStringList profiles = tmpMgr->getAvailableProfiles();
+ dlg.addSubItems("Configuration Profiles", profiles, true);
+
+ QStringList palettes = tmpMgr->getPaletteNames();
+ dlg.addSubItems("Palettes", palettes, true);
+
+ // show dialog and get lists of checked items
+ if(dlg.exec() == QDialog::Rejected) {
+ delete tmpMgr;
+ tmpMgr = NULL;
+ return;
+ }
+ profiles = dlg.getSubItems("Configuration Profiles", true);
+ palettes = dlg.getSubItems("Palettes", true);
+
+ // first, add in the palettes, since they don't
+ // have any dependencies
+ for(int i = 0; i<palettes.size(); i++) {
+ IndexedPaletteProfile tmpPal =
tmpMgr->getPaletteProfile(palettes.at(i));
+ _manager->addPalette(tmpPal);
+ }
+
+ // now go through the PlasmaGeneratorProfiles, adding palettes it
requires
+ for(int i = 0; i<profiles.size(); i++) {
+ PlasmaGeneratorProfile tmpProfile = tmpMgr->getProfile(profiles.at(i));
+ // make sure the profile doesn't exist, so that we don't
+ // unnecessarily copy the palettes. No need to check the
+ // palettes, because the add routine should take care of it.
+ if(!_manager->doesProfileExist(tmpProfile.getName())) {
+ IndexedPaletteProfile tmpPal =
tmpMgr->getPaletteProfile(tmpProfile.getPaletteName());
+ _manager->addPalette(tmpPal);
+ _manager->addProfile(tmpProfile);
+ }
+ }
+
+ _bDontUpdateDisplay = true;
+ _palName->clear();
+ _palName->addItems(_manager->getPaletteNames());
+ _nameBox->clear();
+ _nameBox->addItems(_manager->getAvailableProfiles());
+ _nameBox->setCurrentIndex(_nameBox->findText(_currentProfile));
+ _bDontUpdateDisplay = false;
+ updateDisplay();
+}
+
+void PlasmaGeneratorDialog::exportClicked(bool checked) {
+ ImportExportDialog dlg(false);
+
+ // populate dialog box
+ QStringList profiles = _manager->getAvailableProfiles();
+ dlg.addSubItems("Configuration Profiles", profiles, true);
+
+ QStringList palettes = _manager->getPaletteNames();
+ dlg.addSubItems("Palettes", palettes, true);
+
+ // show dialog and get lists of checked items
+ if(dlg.exec() == 0)
+ return;
+ profiles = dlg.getSubItems("Configuration Profiles", true);
+ palettes = dlg.getSubItems("Palettes", true);
+
+ // get file name to export to
+ QString filename = QFileDialog::getSaveFileName(this, tr("Export
Settings to File"), QDir::homePath(),
+ tr("Settings Files (*.xml)"));
+
+ if(filename.isEmpty())
+ return;
- if(_colorWidget != NULL) {
- delete _colorWidget;
- _colorWidget = NULL;
- }
-
- if(_nameEdit != NULL) {
- delete _nameEdit;
- _nameEdit = NULL;
- }
-
- if(_previewLabel != NULL) {
- delete _previewLabel;
- _previewLabel = NULL;
- }
-
- if(_prgDlg != NULL) {
- delete _prgDlg;
- _prgDlg = NULL;
- }
-
- if(_xDimBox != NULL) {
- delete _xDimBox;
- _xDimBox = NULL;
- }
-
- if(_yDimBox != NULL) {
- delete _yDimBox;
- _yDimBox = NULL;
- }
- */
-}
-
-//returns the modified palette.
-IndexedPaletteProfile IndexedPaletteDialog::getPalette(void) {
- return _palProfile;
-}
-
-void IndexedPaletteDialog::okClicked(bool checked) {
- QString param = _nameEdit->text();
- _palProfile.setName(param);
- emit paletteUpdated();
- accept();
-}
-
-void IndexedPaletteDialog::cancelClicked(bool checked) {
- _palProfile = _origPalProfile;
- reject();
-}
-
-void IndexedPaletteDialog::revertClicked(bool checked) {
- _palProfile = _origPalProfile;
- _palProfile.setHeight(_palProfile.getHeight()*2);
- _palProfile.setWidth(_palProfile.getWidth()*2);
- _nameEdit->setText(_palProfile.getName());
-
- /*
- if(_colorWidget != NULL)
- delete _colorWidget;
- //_colorWidget = new IndexedPaletteEditorRawWidget();
- if(_colorScrollWidget != NULL)
- _colorScrollWidget->setWidget(_colorWidget);
- QObject::connect(_colorWidget, SIGNAL(colorChanged(int, int, QRgb)),
this, SLOT(colorChanged(int, int, QRgb)));
- */
- populateColorWidget();
-
- updatePreviewIcon();
-}
-
-void IndexedPaletteDialog::colorChanged(int x, int y, QRgb* color) {
- if(color == NULL) {
- _palProfile.deleteColor(x,y);
- } else {
- _palProfile.setColor(x, y, *color);
- }
- updatePreviewIcon();
-}
-
-void IndexedPaletteDialog::populateColorWidget(void) {
- int height = _palProfile.getHeight();
- int width = _palProfile.getWidth();
-
- _colorWidget->setProgressDialog(_prgDlg);
- _colorWidget->changeSize(width, height);
- _colorWidget->setProgressDialog(NULL);
-
- for(int y=0; y<height; y++) {
- for(int x=0; x<width;x++) {
- if(_palProfile.isColorDefined(x,y)) {
- QRgb tmpColor = _palProfile.getColor(x, y);
- _colorWidget->setColor(x, y, tmpColor);
- }
- }
- stepProgress();
- }
-}
-
-void IndexedPaletteDialog::defaultColorClicked(bool checked) {
- bool bOk = false;
-
- QRgb newColor = QColorDialog::getRgba(_palProfile.getDefaultColor(),
&bOk, this);
- if(bOk) {
- _palProfile.setDefaultColor(newColor);
- updatePreviewIcon();
- }
-}
-
-void IndexedPaletteDialog::interpClicked(bool checked) {
- _palProfile.setInterpolateColors(checked ? _lastInterpType : none);
- updatePreviewIcon();
-}
-void IndexedPaletteDialog::linearClicked(bool checked) {
- if(checked) {
- _lastInterpType = linear;
- _palProfile.setInterpolateColors(_lastInterpType);
- updatePreviewIcon();
- }
-}
-
-void IndexedPaletteDialog::sineClicked(bool checked) {
- if(checked) {
- _lastInterpType = sine;
- _palProfile.setInterpolateColors(_lastInterpType);
- updatePreviewIcon();
- }
-}
-
-void IndexedPaletteDialog::wrapClicked(bool checked) {
- _palProfile.setWrapColors(checked);
- updatePreviewIcon();
-}
-
-//updates the preview icon
-void IndexedPaletteDialog::updatePreviewIcon(void) {
- //create the palette.
- IndexedPalette* tmpPal = _palProfile.createPalette();
-
- int width = _palProfile.getWidth();
- int height = _palProfile.getHeight();
-
- //check to see if the progress dialog box pointer is null. If so,
- //create a new one.
- bool bISetPrgDlg = false;
- if(_prgDlg == NULL) {
- _prgDlg = new QProgressDialog("Populating...", 0, 0, height);
- _prgCount = 0;
- bISetPrgDlg = true;
- }
-
- //go through the palette and for each color add a pixel in the
- //image
- QImage tmpImage(width*_previewZoom, height*_previewZoom,
QImage::Format_ARGB32);
-
- for(int y=0; y<height; y++) {
- for(int x=0; x<width; x++) {
- int buff[4];
- tmpPal->getColor(x, y, &buff[0], 4);
- QRgb tmpColor = qRgba(buff[0], buff[1], buff[2], 255);
- for(int i=0;i<_previewZoom;i++) {
- for(int j=0;j<_previewZoom;j++) {
- tmpImage.setPixel(x*_previewZoom+i,y*_previewZoom+j,tmpColor);
- }
- }
- }
- stepProgress();
- }
- _previewPixmap = QPixmap::fromImage(tmpImage);
- _previewLabel->clear();
- _previewLabel->resize(width*_previewZoom, height*_previewZoom);
- _previewLabel->setPixmap(_previewPixmap);
-
- //_previewLabel->setPixmap(QPixmap::fromImage(tmpImage));
-
- delete tmpPal;
- tmpPal = NULL;
-
- //if we created the progress dialog, clean up
- if(bISetPrgDlg && _prgDlg != NULL) {
- delete _prgDlg;
- _prgDlg = NULL;
- _prgCount = 0;
- }
-}
-
-//steps the progress dialog
-void IndexedPaletteDialog::stepProgress() {
- if(_prgDlg != NULL) {
- _prgDlg->setValue(++_prgCount);
- QApplication::processEvents();
- }
-}
-
-void IndexedPaletteDialog::resizeClicked(bool checked) {
-
- int width = _xDimBox->value();
- int height = _yDimBox->value();
-
- if(width > 0 && height > 0) {
- _prgDlg = new QProgressDialog("Please wait...", 0, 0, height*3+2);
- _prgCount = 0;
-
- _palProfile.setHeight(height);
- _palProfile.setWidth(width);
-
- populateColorWidget();
- updatePreviewIcon();
- //_colorScrollWidget->resize(width, height);
-
- delete _prgDlg;
- _prgDlg = NULL;
- }
-}
-void IndexedPaletteDialog::helpClicked(bool checked) {
-// QMessageBox::information(this, _windowTitle, "Not implemented yet.",
QMessageBox::Ok);
- HelpDialog* dlg = new HelpDialog("qrc:/help/IndexedPaletteDialog.html");
- if(dlg != NULL) {
- dlg->exec();
- delete dlg;
- dlg = NULL;
- }
+ // now create a temporary config manager that
+ // contains only the profiles that we want. Be sure to grab
+ // all miscellaneous profiles that the MasterProfile
+ // (including the IndexedPaletteProfiles).
+ ConfigManager* tmpMgr = new ConfigManager();
+ if(tmpMgr == NULL)
+ return;
+
+ // first, add in the palettes, since they don't
+ // have any dependencies
+ for(int i = 0; i<palettes.size(); i++) {
+ IndexedPaletteProfile tmpPal =
_manager->getPaletteProfile(palettes.at(i));
+ tmpMgr->addPalette(tmpPal);
+ }
+
+ // now go through the MasterProfiles, adding sub profiles
+ // it requires (including IndexedPaletteProfiles).
+ for(int i = 0; i<profiles.size(); i++) {
+ PlasmaGeneratorProfile tmpProfile =
_manager->getProfile(profiles.at(i));
+ IndexedPaletteProfile tmpPal =
_manager->getPaletteProfile(tmpProfile.getPaletteName());
+ tmpMgr->addPalette(tmpPal);
+ tmpMgr->addProfile(tmpProfile);
+ }
+
+ // save!
+ tmpMgr->exportToFile(filename, false);
+ delete tmpMgr;
+ tmpMgr = NULL;
+}
+
+/**
+ * Updates the profile info in the config manager.
+ */
+void PlasmaGeneratorDialog::updateProfile() {
+ // sanity check
+ if(_manager == NULL) {
+ return;
+ }
+ if(_nameBox == NULL) {
+ return;
+ }
+ if(_fileEdit == NULL) {
+ return;
+ }
+ if(_palName == NULL) {
+ return;
+ }
+ if(_xDimBox == NULL) {
+ return;
+ }
+ if(_yDimBox == NULL) {
+ return;
+ }
+ if(_tileVertBox == NULL) {
+ return;
+ }
+ if(_tileHorizBox == NULL) {
+ return;
+ }
+ if(_coarsenessBox == NULL) {
+ return;
+ }
+ if(_clampColorBox == NULL) {
+ return;
+ }
+ if(_alwaysBox == NULL) {
+ return;
+ }
+ if(_askBox == NULL) {
+ return;
+ }
+ if(_neverBox == NULL) {
+ return;
+ }
+
+ // stuff data into a temporary profile;
+ PlasmaGeneratorProfile profile;
+
+ profile.setName(_currentProfile);
+ profile.setPaletteName(_palName->currentText());
+ profile.setHeight(_yDimBox->value());
+ profile.setWidth(_xDimBox->value());
+
profile.setCoarseness(((float)_coarsenessBox->value())/_coarsenessAdjust);
+ profile.setClampColorIndex(_clampColorBox->isChecked());
+ profile.setFileTarget(_fileEdit->text());
+ if(_alwaysBox->isChecked()) {
+ profile.setOverwritePolicy(ALWAYS);
+ } else if(_neverBox->isChecked()) {
+ profile.setOverwritePolicy(NEVER);
+ } else {
+ profile.setOverwritePolicy(ASK);
+ }
+ profile.setTileVertical(_tileVertBox->isChecked());
+ profile.setTileHorizontal(_tileHorizBox->isChecked());
+
+ _manager->replaceProfile(_currentProfile, profile);
+ if(_bDefault) {
+ _manager->setDefaultProfile(profile.getName());
+ }
}
+
+/**
+ * Updates all widgets with the currently selected profile.
+ */
+void PlasmaGeneratorDialog::updateDisplay() {
+ // we're locked out...
+ if(_bDontUpdateDisplay) {
+ return;
+ }
+ // sanity check
+ if(_manager == NULL) {
+ return;
+ }
+ if(_nameBox == NULL) {
+ return;
+ }
+ if(_fileEdit == NULL) {
+ return;
+ }
+ if(_palName == NULL) {
+ return;
+ }
+ if(_xDimBox == NULL) {
+ return;
+ }
+ if(_yDimBox == NULL) {
+ return;
+ }
+ if(_tileVertBox == NULL) {
+ return;
+ }
+ if(_tileHorizBox == NULL) {
+ return;
+ }
+ if(_coarsenessBox == NULL) {
+ return;
+ }
+ if(_clampColorBox == NULL) {
+ return;
+ }
+ if(_alwaysBox == NULL) {
+ return;
+ }
+ if(_askBox == NULL) {
+ return;
+ }
+ if(_neverBox == NULL) {
+ return;
+ }
+ if(_defaultButton == NULL) {
+ return;
+ }
+ if(_previewScrollWidget == NULL) {
+ return;
+ }
+ // check to see if profile has changed
+ if( _currentProfile != _nameBox->currentText()) {
+ updateProfile();
+ _currentProfile = _nameBox->currentText();
+ }
+
+ _bDefault = (_manager->getDefaultProfile() == _currentProfile);
+
+ // get a copy of the profile
+ PlasmaGeneratorProfile profile;
+ profile = _manager->getProfile(_currentProfile);
+
+ // update fields
+ _fileEdit->setText(profile.getFileTarget());
+ _palName->setCurrentIndex(_palName->findText(profile.getPaletteName()));
+ _xDimBox->setValue(profile.getWidth());
+ _yDimBox->setValue(profile.getHeight());
+ _tileVertBox->setChecked(profile.getTileVertical());
+ _tileHorizBox->setChecked(profile.getTileHorizontal());
+ _coarsenessBox->setValue(profile.getCoarseness()*_coarsenessAdjust);
+ _clampColorBox->setChecked(profile.getClampColorIndex());
+ switch(profile.getOverwritePolicy()) {
+ case ALWAYS:
+ _alwaysBox->setChecked(true);
+ break;
+ case NEVER:
+ _neverBox->setChecked(true);
+ break;
+ default:
+ _askBox->setChecked(true);
+ }
+ QLabel* tmpLabel =
+ new QLabel(tr("Press 'Generate' to generate a new plasma."));
+ if(tmpLabel == NULL) {
+ return;
+ }
+ _previewScrollWidget->setWidget(tmpLabel);
+ tmpLabel = NULL;
+
+ _defaultButton->setEnabled(!_bDefault);
+}
+
+/**
+ * Displays the GPL license dialog.
+ */
+void PlasmaGeneratorDialog::showGPLDialog(void) {
+ _gplDialog->exec();
+ _manager->setGPLAccepted(_gplDialog->isAccepted());
+ if(_manager->getGPLAccepted()) {
+ _manager->save();
+ }
+}
+
Modified: trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.h
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.h (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorDialog.h Sun Mar 8
18:35:05 2009
@@ -29,78 +29,113 @@
#ifndef __PLASMAGENERATORDIALOG_H__
#define __PLASMAGENERATORDIALOG_H__
+#include <QString>
#include <QDialog>
#include <QLineEdit>
#include <QScrollArea>
#include <QLabel>
#include <QSpinBox>
+#include <QComboBox>
+#include <QRadioButton>
+#include <QCheckBox>
+#include <QLabel>
+#include <QPixmap>
+#include <QSlider>
+#include <QProgressDialog>
-#include "IndexedPalette/IndexedPaletteProfile.h"
-#include "IndexedPalette/IndexedPaletteEditorWidget.h"
+#include "gpl_related/gpldialog.h"
-class PlasmaGeneratorDialog : public QDialog {
+#include "ConfigManager.h"
+#include "PlasmaGenerator.h"
- Q_OBJECT
+class PlasmaGeneratorDialog : public QDialog {
+ Q_OBJECT
+
public:
- PlasmaGeneratorDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
- ~PlasmaGeneratorDialog();
+ PlasmaGeneratorDialog(ConfigManager* manager, QWidget* parent = 0,
Qt::WindowFlags f = 0);
+ ~PlasmaGeneratorDialog();
- //returns the modified palette.
- IndexedPaletteProfile getPalette(void);
+ /**
+ * Displays the GPL license dialog.
+ */
+ void showGPLDialog(void);
public slots:
- void okClicked(bool checked = false);
- void cancelClicked(bool checked = false);
- void revertClicked(bool checked = false);
- void helpClicked(bool checked = false);
-
- void colorChanged(int x, int y, QRgb* color);
- void defaultColorClicked(bool checked = false);
- void resizeClicked(bool checked = false);
- void interpClicked(bool checked = false);
- void linearClicked(bool checked = false);
- void sineClicked(bool checked = false);
- void wrapClicked(bool checked = false);
+ void applyClicked(bool checked = false);
+ void okClicked(bool checked = false);
+ void cancelClicked(bool checked = false);
+ void helpClicked(bool checked = false);
+
+ void managePalettesClicked(bool checked = false);
+
+ void setDefaultClicked(bool checked = false);
+ void newProfileClicked(bool checked = false);
+ void copyProfileClicked(bool checked = false);
+ void renameProfileClicked(bool checked = false);
+ void deleteProfileClicked(bool checked = false);
+ void profileChanged(const QString& newProfile);
+
+ void generateClicked(bool checked = false);
+ void saveClicked(bool checked = false);
+ void browseClicked(bool checked = false);
-signals:
- void paletteUpdated(void);
+ void importClicked(bool checked = false);
+ void exportClicked(bool checked = false);
private:
- //populates the widget based on _palProfile.
- //Steps the dialog box _palProfile.getHeight()*2+2 number of times.
- void populateColorWidget(void);
+ /**
+ * Updates the profile info in the config manager.
+ */
+ void updateProfile();
+
+ /**
+ * Updates all widgets with the currently selected profile.
+ */
+ void updateDisplay();
+
+ QString _windowTitle;
+
+ QLineEdit* _fileEdit;
+ QComboBox* _nameBox;
+ QComboBox* _palName;
+
+ QSpinBox* _xDimBox;
+ QSpinBox* _yDimBox;
+
+ QCheckBox* _tileVertBox;
+ QCheckBox* _tileHorizBox;
+
+ QRadioButton* _alwaysBox;
+ QRadioButton* _askBox;
+ QRadioButton* _neverBox;
- //updates the preview icon
- //Steps the dialog box _palProfile.getHeight() number of times.
- void updatePreviewIcon(void);
+ QPushButton* _defaultButton;
- //steps the progress dialog
- void stepProgress();
+ QSlider* _coarsenessBox;
+ float _coarsenessAdjust;
+ QCheckBox* _clampColorBox;
- IndexedPaletteProfile _palProfile;
- IndexedPaletteProfile _origPalProfile;
+ QScrollArea* _previewScrollWidget;
+ QLabel* _previewLabel;
+ QPixmap _previewPixmap;
- QScrollArea* _colorScrollWidget;
- IndexedPaletteEditorWidget* _colorWidget;
+ QProgressDialog* _prgDialog;
- QLineEdit* _nameEdit;
+ ConfigManager* _manager;
- QLabel* _previewLabel;
- QPixmap _previewPixmap;
- int _previewZoom;
+ bool _bDefault;
+ bool _bDontUpdateDisplay;
+ QString _currentProfile;
- QProgressDialog* _prgDlg;
- int _prgCount;
+ QString _fileFormatFilter;
+ QString _selFilter;
- QSpinBox* _xDimBox;
- QSpinBox* _yDimBox;
+ PlasmaGenerator* _plasma;
- QRadioButton* _linearButton;
- QRadioButton* _sineButton;
- InterpType _lastInterpType;
- QString _windowTitle;
+ GPLDialog* _gplDialog;
+
};
Modified: trunk/src/PlasmaGenerator/src/PlasmaGeneratorMain.cpp
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGeneratorMain.cpp (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorMain.cpp Sun Mar 8
18:35:05 2009
@@ -34,7 +34,7 @@
#include "ConfigManager.h"
#include "project_specific_extern_defs.h"
-//#include "PlasmaGeneratorDialog.h"
+#include "PlasmaGeneratorDialog.h"
int doHelp(QString* appName, QApplication *app) {
cout<<getAppFullName().toStdString()<<" v. "<<
@@ -115,20 +115,13 @@
//load configuration
ConfigManager manager;
manager.load();
- /*
+
//set up the dialog
- PlasmaGeneratorDialog* dlg = new PlasmaGeneratorDialog();
+ PlasmaGeneratorDialog* dlg = new PlasmaGeneratorDialog(&manager);
if(dlg == NULL) {
return -1;
}
- dlg->setManager(&manager);
-
- //so that ok/cancel buttons work.
- QObject::connect(dlg, SIGNAL(dialogFinished()), app, SLOT(quit()));
-
- dlg->setup();
-
//make sure that the GPL has been accepted.
if(!manager.getGPLAccepted()) {
dlg->showGPLDialog();
@@ -142,7 +135,7 @@
//run the dialog box
app->exec();
- */
+
return 0;
}
Added: trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.cpp
==============================================================================
--- (empty file)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.cpp Sun Mar
8 18:35:05 2009
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2008 Jeff Backus.
+ *
+ * Licensed under the GNU General Public License, Version 2.0
(the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Additionally, this code makes heavy use of the Qt libraries from
+ * Trolltech. These libraries are released under the GNU
+ * General Public License, Version 2.0, as well. Please contact
+ * Trolltech for more information.
+ *
+ * http://trolltech.com/
+ *
+ */
+
+#include <QWidget>
+#include <QPushButton>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QListWidgetItem>
+#include <QMessageBox>
+#include <QInputDialog>
+
+#include "PlasmaGeneratorPaletteEditor.h"
+
+PlasmaGeneratorPaletteEditor::PlasmaGeneratorPaletteEditor(ConfigManager*
confMgr, QWidget* parent, Qt::WindowFlags f) {
+ QDialog(parent, f);
+ _windowTitle = tr("Palette Editor");
+ setWindowTitle(_windowTitle);
+ setWindowModality(Qt::WindowModal);
+ QIcon icon(":/app_icon.png");
+ setWindowIcon(icon);
+
+ _listWidget = NULL;
+ _confMgr = confMgr;
+ _palDlg = NULL;
+
+ //populate dialog box
+ QWidget* tempWidget = NULL;
+ QPushButton* tempButton = NULL;
+ QHBoxLayout* tempLayout = NULL;
+
+ QVBoxLayout* mainLayout = new QVBoxLayout();
+
+ _listWidget = new PlasmaGeneratorPaletteSelectWidget(confMgr);
+ mainLayout->addWidget(_listWidget);
+
+ tempLayout = new QHBoxLayout();
+
+ tempLayout->addStretch(0);
+
+ tempButton = new QPushButton(tr("&Close"));
+ tempButton->setDefault(true);
+ QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(closeClicked(bool)));
+ tempLayout->addWidget(tempButton);
+ tempButton = NULL;
+
+ tempLayout->addStretch(0);
+
+ tempWidget = new QWidget();
+ tempWidget->setLayout(tempLayout);
+ tempLayout = NULL;
+
+ mainLayout->addWidget(tempWidget);
+ tempWidget = NULL;
+
+ setLayout(mainLayout);
+}
+PlasmaGeneratorPaletteEditor::~PlasmaGeneratorPaletteEditor() {
+
+ //the layout should delete the object.
+ _listWidget = NULL;
+
+ if(_palDlg != NULL) {
+ delete _palDlg;
+ _palDlg = NULL;
+ }
+
+ _confMgr = NULL;
+}
+
+void PlasmaGeneratorPaletteEditor::closeClicked(bool checked) {
+ accept();
+}
Added: trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.h
==============================================================================
--- (empty file)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteEditor.h Sun Mar 8
18:35:05 2009
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2008 Jeff Backus.
+ *
+ * Licensed under the GNU General Public License, Version 2.0
(the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Additionally, this code makes heavy use of the Qt libraries from
+ * Trolltech. These libraries are released under the GNU
+ * General Public License, Version 2.0, as well. Please contact
+ * Trolltech for more information.
+ *
+ * http://trolltech.com/
+ *
+ */
+
+/**
+ * This class represents a dialog box that allows the user to
add/edit/delete
+ * all available palettes. Utilizes IndexedPaletteDialog for actual
+ * modification of the palettes. Does not have the ability to undo!
+ */
+
+#ifndef __PLASMAGENERATORPALETTEEDITOR_H__
+#define __PLASMAGENERATORPALETTEEDITOR_H__
+
+#include <QDialog>
+
+#include "IndexedPalette/IndexedPaletteDialog.h"
+#include "ConfigManager.h"
+#include "PlasmaGeneratorPaletteSelectWidget.h"
+
+class PlasmaGeneratorPaletteEditor : public QDialog {
+
+ Q_OBJECT
+
+ public:
+ PlasmaGeneratorPaletteEditor(ConfigManager* confMgr = NULL, QWidget*
parent = 0, Qt::WindowFlags f = 0);
+ ~PlasmaGeneratorPaletteEditor();
+
+ public slots:
+ void closeClicked(bool checked = false);
+
+ private:
+
+ PlasmaGeneratorPaletteSelectWidget* _listWidget;
+
+ IndexedPaletteDialog* _palDlg;
+
+ QString _palOldName;
+
+ ConfigManager* _confMgr;
+ QString _windowTitle;
+};
+
+#endif
Added: trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.cpp
==============================================================================
--- (empty file)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.cpp
Sun Mar 8 18:35:05 2009
@@ -0,0 +1,325 @@
+/**
+ * Copyright (c) 2008 Jeff Backus.
+ *
+ * Licensed under the GNU General Public License, Version 2.0
(the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Additionally, this code makes heavy use of the Qt libraries from
+ * Trolltech. These libraries are released under the GNU
+ * General Public License, Version 2.0, as well. Please contact
+ * Trolltech for more information.
+ *
+ * http://trolltech.com/
+ *
+ */
+
+// begin debug
+//#include <iostream>
+//using namespace std;
+//end debug
+
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QListWidgetItem>
+
+#include <QMessageBox>
+#include <QInputDialog>
+
+#include "PlasmaGeneratorPaletteSelectWidget.h"
+#include "IndexedPalette/IndexedPaletteDialog.h"
+
+PlasmaGeneratorPaletteSelectWidget::PlasmaGeneratorPaletteSelectWidget(ConfigManager*
confMgr,
QWidget* parent, Qt::WindowFlags f) {
+ QWidget(parent, f);
+
+ _palDlg = NULL;
+
+ _confMgr = confMgr;
+
+ QWidget* tempWidget = NULL;
+ QPushButton* tempButton = NULL;
+ QVBoxLayout* mainLayout = new QVBoxLayout();
+
+ _list = new QListWidget();
+ _list->setSelectionMode(QAbstractItemView::SingleSelection);
+ _list->setToolTip(tr("This is the list of available palette profiles."));
+ mainLayout->addWidget(_list);
+
+ QHBoxLayout* bkgndBtnLayout = new QHBoxLayout();
+ tempButton = new QPushButton(tr("New"));
+ tempButton->setToolTip(tr("Create a new palette from scratch."));
+ QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(addClicked(bool)));
+ bkgndBtnLayout->addWidget(tempButton);
+ tempButton = NULL;
+
+ tempButton = new QPushButton(tr("Duplicate"));
+ tempButton->setToolTip(tr("Create a new palette by copying the currently
selected palette."));
+ QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(copyClicked(bool)));
+ bkgndBtnLayout->addWidget(tempButton);
+ tempButton = NULL;
+
+ tempButton = new QPushButton(tr("Edit"));
+ tempButton->setToolTip(tr("Edit the currently selected palette."));
+ QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(editClicked(bool)));
+ bkgndBtnLayout->addWidget(tempButton);
+ tempButton = NULL;
+
+ tempButton = new QPushButton(tr("Delete"));
+ tempButton->setToolTip(tr("Permanently remove the currently selected
palette."));
+ QObject::connect(tempButton, SIGNAL(clicked(bool)), this,
SLOT(removeClicked(bool)));
+ bkgndBtnLayout->addWidget(tempButton);
+ tempButton = NULL;
+
+ tempWidget = new QWidget();
+ tempWidget->setLayout(bkgndBtnLayout);
+ mainLayout->addWidget(tempWidget);
+ tempWidget = NULL;
+
+ setLayout(mainLayout);
+
+ populateBox();
+}
+
+PlasmaGeneratorPaletteSelectWidget::~PlasmaGeneratorPaletteSelectWidget() {
+ _confMgr = NULL;
+
+ //should get deleted when the layout gets deleted
+ _list = NULL;
+
+ if(_palDlg != NULL) {
+ delete _palDlg;
+ _palDlg = NULL;
+ }
+}
+
+/**
+ * Retrieves the name of the currently selected Palette.
+ */
+QString PlasmaGeneratorPaletteSelectWidget::getCurrentPaletteName() {
+ QListWidgetItem* tmp = _list->currentItem();
+ if(tmp != NULL) {
+ return tmp->text();
+ }
+
+ return QString("");
+}
+
+/**
+ * Sets the currently selected Palette.
+ */
+void PlasmaGeneratorPaletteSelectWidget::setCurrentPalette(QString name) {
+ int index = findItem(name);
+ if(index >= 0) {
+ _list->setCurrentRow(index);
+ }
+}
+
+void PlasmaGeneratorPaletteSelectWidget::addClicked(bool checked) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ editPalette(QString(""), false);
+}
+
+void PlasmaGeneratorPaletteSelectWidget::copyClicked(bool checked) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ int row = _list->currentRow();
+ QListWidgetItem* tmp = _list->item(row);
+ if(tmp != NULL) {
+ QString selected = tmp->text();
+
+ //check to see if the selected palette exists...
+ if(_confMgr->doesPaletteExist(selected)) {
+
+ //open up a QInputDialog object to prompt for a new name.
+ bool bCopy = false;
+ bool bDone = false;
+ QString newName;
+ while(!bDone) {
+ bool bOk = false;
+ newName = QInputDialog::getText(this, 0,
+ tr("Please enter a name for new copy of '")+selected+tr("':"),
QLineEdit::Normal,
+ selected, &bOk);
+
+ if(!bOk) {
+ bDone = true;
+ } else {
+ if(newName == "") {
+ QMessageBox::warning(this, 0, "Please enter a valid name.",
QMessageBox::Ok);
+ } else {
+ if(_confMgr->doesPaletteExist(newName)) {
+ //name already exists. give the user a warning dialog box
+ QString message(tr("A palette with name '"));
+ message += newName;
+ message += "' already exists. Please choose a new name.";
+ QMessageBox::warning(this, 0, message, QMessageBox::Ok);
+ } else {
+ bDone = true;
+ bCopy = true;
+ }
+ }
+ }
+ }
+ //if the user hit ok and the name is not empty, copy!
+ if(bCopy) {
+ IndexedPaletteProfile newPal = _confMgr->getPaletteProfile(selected);
+ newPal.setName(newName);
+ _confMgr->addPalette(newPal);
+ _list->addItem(newName);
+ }
+ }
+ }
+ tmp = NULL;
+}
+
+void PlasmaGeneratorPaletteSelectWidget::editClicked(bool checked) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ int row = _list->currentRow();
+ QListWidgetItem* tmp = _list->item(row);
+ if(tmp != NULL) {
+ QString selected = tmp->text();
+
+ //check for existence and edit if so
+ if(_confMgr->doesPaletteExist(selected)) {
+ editPalette(selected, true);
+ }
+ }
+ tmp = NULL;
+}
+
+void PlasmaGeneratorPaletteSelectWidget::removeClicked(bool checked) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ int row = _list->currentRow();
+ QListWidgetItem* tmp = _list->takeItem(row);
+ if(tmp != NULL) {
+ QString selected = tmp->text();
+ //attempt to remove the selected item.
+ _confMgr->removePalette(selected);
+ }
+ //delete the list widget item.
+ delete tmp;
+ tmp = NULL;
+}
+
+//populates the list box
+void PlasmaGeneratorPaletteSelectWidget::populateBox(void) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ //Palette list
+ _list->clear();
+ _list->addItems(_confMgr->getPaletteNames());
+}
+
+//searches the list for the specified string, returning its index, or -1.
+int PlasmaGeneratorPaletteSelectWidget::findItem(QString name) {
+ if(_list == NULL)
+ return -1;
+
+ int count = _list->count();
+ int i = 0;
+ while(i<count) {
+ QListWidgetItem* tmp = _list->item(i);
+ if(tmp != NULL && tmp->text() == name) {
+ return i;
+ }
+ i++;
+ }
+
+ return -1;
+}
+
+//attempts to edit the specified palette.
+void PlasmaGeneratorPaletteSelectWidget::editPalette(const QString&
palName, bool bReplace) {
+ if(_confMgr == NULL || _list == NULL)
+ return;
+
+ QString oldPalName = palName;
+
+ bool bDone = false;
+ bool bFirstPass = true;
+
+ IndexedPaletteDialog* palDlg = NULL;
+ IndexedPaletteProfile tmpProfile;
+ if(bReplace) {
+ tmpProfile = _confMgr->getPaletteProfile(palName);
+ }
+
+ while(!bDone) {
+ // display the palette editor dialog using either a new
+ // object or the one requested for edit.
+ if(bFirstPass && !bReplace) {
+ palDlg = new IndexedPaletteDialog(NULL,this);
+ } else {
+ palDlg = new IndexedPaletteDialog(&tmpProfile,this);
+ }
+ bFirstPass = false;
+ if(palDlg != NULL) {
+ // if the user clicked ok, then try to update the palette
+ if(palDlg->exec() == QDialog::Accepted) {
+ tmpProfile = palDlg->getPalette();
+
+ // check the name to make sure it is valid and not
+ // already in the list.
+ QString newName = tmpProfile.getName();
+ if(newName == "") {
+ //give the user a warning dialog box
+ QMessageBox::warning(this, 0, "Please enter a valid name.",
QMessageBox::Ok);
+ } else if(oldPalName != newName && _confMgr->doesPaletteExist(newName)) {
+ //give the user a warning dialog box
+ QString message(tr("A palette with name '"));
+ message += newName;
+ message += "' already exists. Please choose a new name.";
+ QMessageBox::warning(this, 0, message, QMessageBox::Ok);
+ } else {
+ // name is valid, so try to insert or replace based on bReplace
+ if(bReplace) {
+ _confMgr->replacePalette(oldPalName, tmpProfile);
+ } else {
+ _confMgr->addPalette(tmpProfile);
+ }
+
+ // if we are replacing, remove old name first, then
+ // insert the new name.
+ //if(oldPalName != "" && oldPalName != newName) {
+ if(oldPalName != newName) {
+ int i=0;
+ int count = _list->count();
+ QListWidgetItem* tmpItem = _list->item(0);
+ while(tmpItem != NULL && tmpItem->text() != oldPalName && i < count) {
+ i++;
+ tmpItem = _list->item(i);
+ }
+ if(tmpItem != NULL && tmpItem->text() == oldPalName) {
+ _list->takeItem(i);
+ }
+ _list->addItem(newName);
+ }
+ bDone = true;
+ }
+ } else {
+ bDone = true;
+ }
+ //clean up
+ delete _palDlg;
+ _palDlg = NULL;
+ } else {
+ bDone = true;
+ }
+ }
+}
Added: trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.h
==============================================================================
--- (empty file)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorPaletteSelectWidget.h Sun
Mar 8 18:35:05 2009
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2008 Jeff Backus.
+ *
+ * Licensed under the GNU General Public License, Version 2.0
(the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Additionally, this code makes heavy use of the Qt libraries from
+ * Trolltech. These libraries are released under the GNU
+ * General Public License, Version 2.0, as well. Please contact
+ * Trolltech for more information.
+ *
+ * http://trolltech.com/
+ *
+ */
+
+/**
+ * This widget contains a selection box as well as buttons to add, edit,
duplicate, and delete palettes.
+ */
+
+#ifndef __PLASMAGENERATORPALETTESELECTWIDGET_H__
+#define __PLASMAGENERATORPALETTESELECTWIDGET_H__
+
+#include <QWidget>
+#include <QString>
+#include <QListWidget>
+
+#include "ConfigManager.h"
+#include "IndexedPalette/IndexedPaletteProfile.h"
+#include "IndexedPalette/IndexedPaletteDialog.h"
+
+class PlasmaGeneratorPaletteSelectWidget : public QWidget {
+
+ Q_OBJECT
+
+ public:
+ PlasmaGeneratorPaletteSelectWidget(ConfigManager* _confMgr = NULL,
QWidget* parent = 0, Qt::WindowFlags f = 0);
+ ~PlasmaGeneratorPaletteSelectWidget();
+
+ /**
+ * Retrieves the name of the currently selected palette.
+ */
+ QString getCurrentPaletteName();
+
+ /**
+ * Sets the currently selected palette.
+ */
+ void setCurrentPalette(QString name);
+
+ public slots:
+
+ void addClicked(bool checked = false);
+ void copyClicked(bool checked = false);
+ void editClicked(bool checked = false);
+ void removeClicked(bool checked = false);
+
+ signals:
+ void selectionChanged(QString newName);
+
+ private:
+ //populates the list box
+ void populateBox(void);
+
+ //searches the list for the specified string, returning its index, or -1.
+ int findItem(QString name);
+
+ //attempts to edit the specified palette.
+ void editPalette(const QString& palName, bool bReplace = false);
+
+ ConfigManager* _confMgr;
+
+ QListWidget* _list;
+
+ IndexedPaletteDialog* _palDlg;
+ QString _palOldName;
+};
+#endif
Modified: trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.cpp
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.cpp (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.cpp Sun Mar 8
18:35:05 2009
@@ -30,8 +30,6 @@
#include <QtXml/QDomElement>
#include <QtXml/QDomText>
-//#include "../../common/utility/misc_funcs.h"
-
#include "utility/misc_funcs.h"
#include "PlasmaGeneratorProfile.h"
@@ -54,7 +52,8 @@
}
-/* Attempts to load this background profile object from the
+/**
+ * Attempts to load this background profile object from the
* specified QDomNode.
*/
PlasmaGeneratorProfile* PlasmaGeneratorProfile::load(QDomNode &node) {
@@ -142,7 +141,7 @@
}
-/*
+/**
* Returns a QDomNode object that represents this profile.
*/
QDomNode PlasmaGeneratorProfile::save(QDomDocument* doc) {
@@ -226,7 +225,7 @@
return retVal;
}
-/*
+/**
* Creates and returns a new PlasmaGenerator object. Does not
* generate the plasma.
*/
@@ -268,18 +267,18 @@
return retVal;
}
-/*
+/**
* get/set palette name.
*/
QString PlasmaGeneratorProfile::getPaletteName() {
return _palName;
}
-void PlasmaGeneratorProfile::setPaletteName(QString paletteName) {
+void PlasmaGeneratorProfile::setPaletteName(const QString paletteName) {
_palName = paletteName;
}
-/*
+/**
* get/set coarseness.
*/
float PlasmaGeneratorProfile::getCoarseness() {
@@ -287,10 +286,41 @@
}
void PlasmaGeneratorProfile::setCoarseness(float coarseness) {
- _coarseness = coarseness;
+ if(_coarseness > 0.0){
+ _coarseness = coarseness;
+ }
+}
+
+/**
+ * Gets the height
+ */
+int PlasmaGeneratorProfile::getHeight() {
+ return _height;
+}
+/**
+ * Sets the height
+ */
+void PlasmaGeneratorProfile::setHeight(int height) {
+ if(0 < height && height < 1024*1024) {
+ _height = height;
+ }
+}
+/**
+ * Gets the width.
+ */
+int PlasmaGeneratorProfile::getWidth() {
+ return _width;
+}
+/**
+ * Sets the width.
+ */
+void PlasmaGeneratorProfile::setWidth(int width) {
+ if(0 < width && width < 1024*1024) {
+ _width = width;
+ }
}
-/*
+/**
* Get/set clamp color index.
*/
bool PlasmaGeneratorProfile::getClampColorIndex() {
@@ -301,7 +331,7 @@
_bClampColorIndex = bClampColorIndex;
}
-/*
+/**
* Overloaded assignment operator
*/
PlasmaGeneratorProfile&
PlasmaGeneratorProfile::operator=(PlasmaGeneratorProfile& other) {
@@ -319,7 +349,7 @@
return *this;
}
-/*
+/**
* Creates a new object with this object's settings.
*/
PlasmaGeneratorProfile* PlasmaGeneratorProfile::clone() {
@@ -334,7 +364,7 @@
* Called whenever palette names change
*/
void PlasmaGeneratorProfile::paletteNameChanged(QString oldName,
- QString newName) {
+ QString newName) {
// if the palette name matches the old name, change the name.
if(_palName == oldName) {
_palName = newName;
@@ -366,6 +396,31 @@
}
/**
+ * Gets whether to tile vertically.
+ */
+bool PlasmaGeneratorProfile::getTileVertical() {
+ return _bTileVertical;
+}
+/**
+ * Sets whether to tile vertically.
+ */
+void PlasmaGeneratorProfile::setTileVertical(bool bVert) {
+ _bTileVertical = bVert;
+}
+/**
+ * Gets whether to tile horizontally.
+ */
+bool PlasmaGeneratorProfile::getTileHorizontal() {
+ return _bTileHorizontal;
+}
+/**
+ * Sets whether to tile horizontally.
+ */
+void PlasmaGeneratorProfile::setTileHorizontal(bool bHoriz) {
+ _bTileHorizontal = bHoriz;
+}
+
+/**
* Gets file overwrite policy.
*/
PlasmaGeneratorOverwritePolicy
PlasmaGeneratorProfile::getOverwritePolicy() {
@@ -380,17 +435,17 @@
}
-/*
+/**
* Get/set the name of this profile.
*/
-void PlasmaGeneratorProfile::setName(QString &name) {
+void PlasmaGeneratorProfile::setName(const QString &name) {
_name = name;
}
QString PlasmaGeneratorProfile::getName() {
return _name;
}
-/*
+/**
* Returns the tag name used by Dom elements for all
* subclasses of BackgroundProfile.
*/
Modified: trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.h
==============================================================================
--- trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.h (original)
+++ trunk/src/PlasmaGenerator/src/PlasmaGeneratorProfile.h Sun Mar 8
18:35:05 2009
@@ -48,46 +48,64 @@
PlasmaGeneratorProfile();
~PlasmaGeneratorProfile();
- /* Attempts to load this profile object from the
+ /**
+ * Attempts to load this profile object from the
* specified QDomNode.
*/
static PlasmaGeneratorProfile* load(QDomNode &node);
- /*
+ /**
* Returns a QDomNode object that represents this profile.
*/
QDomNode save(QDomDocument* doc);
- /*
+ /**
* Creates and returns a new PlasmaGenerator object. Does not
* generate the plasma.
*/
PlasmaGenerator* getGenerator(QHash<QString, IndexedPaletteProfile*>*
palHash);
- /*
+ /**
* get/set palette name.
*/
QString getPaletteName();
- void setPaletteName(QString paletteName);
+ void setPaletteName(const QString paletteName);
- /*
+ /**
* get/set coarseness.
*/
float getCoarseness();
void setCoarseness(float coarseness);
- /*
+ /**
+ * Gets the height
+ */
+ int getHeight();
+ /**
+ * Sets the height
+ */
+ void setHeight(int height);
+ /**
+ * Gets the width.
+ */
+ int getWidth();
+ /**
+ * Sets the width.
+ */
+ void setWidth(int width);
+
+ /**
* Get/set clamp color index.
*/
bool getClampColorIndex();
void setClampColorIndex(bool bClampColorIndex);
- /*
+ /**
* Overloaded assignment operator.
*/
PlasmaGeneratorProfile& operator=(PlasmaGeneratorProfile& other);
- /*
+ /**
* Creates a new object with this object's settings.
*/
PlasmaGeneratorProfile* clone();
@@ -113,6 +131,24 @@
void setFileTarget(QString filename);
/**
+ * Gets whether to tile vertically.
+ */
+ bool getTileVertical();
+ /**
+ * Sets whether to tile vertically.
+ */
+ void setTileVertical(bool bVert);
+ /**
+ * Gets whether to tile horizontally.
+ */
+ bool getTileHorizontal();
+ /**
+ * Sets whether to tile horizontally.
+ */
+ void setTileHorizontal(bool bHoriz);
+
+
+ /**
* Gets file overwrite policy.
*/
PlasmaGeneratorOverwritePolicy getOverwritePolicy();
@@ -122,13 +158,13 @@
*/
void setOverwritePolicy(PlasmaGeneratorOverwritePolicy policy);
- /*
+ /**
* Get/set the name of this profile.
*/
- void setName(QString &name);
+ void setName(const QString &name);
QString getName();
- /*
+ /**
* Returns the tag name used by Dom elements for all
* subclasses of BackgroundProfile.
*/
Modified: trunk/src/PlasmaGenerator/src/project_specific_extern_defs.h
==============================================================================
--- trunk/src/PlasmaGenerator/src/project_specific_extern_defs.h (original)
+++ trunk/src/PlasmaGenerator/src/project_specific_extern_defs.h Sun Mar 8
18:35:05 2009
@@ -35,25 +35,6 @@
#include <QString>
-//#include "2d_bgnd_w_lens/BackgroundProfile.h"
-//#include "2d_bgnd_w_lens/lens_engine/LensProfile.h"
-
-/**
- * This function will create an array that contains the profiles
- * for allowable backgrounds and sets numProfiles to indicate
- * the number of profiles in the array. If there is a problem,
- * numProfiles will be set to 0 and NULL will be returned.
- */
-//extern BackgroundProfile** getBackgroundTypes(int* numProfiles);
-
-/**
- * This function will create an array that contains the profiles
- * for allowable lenses and sets numProfiles to indicate
- * the number of profiles in the array. If there is a problem,
- * numProfiles will be set to 0 and NULL will be returned.
- */
-//extern LensProfile** getLensTypes(int* numProfiles);
-
/**
* This function returns the string used to create the path for
* the settings file. It is also used to define the XML
Modified: trunk/src/common/2d_bgnd_w_lens/ConfigManager.cpp
==============================================================================
--- trunk/src/common/2d_bgnd_w_lens/ConfigManager.cpp (original)
+++ trunk/src/common/2d_bgnd_w_lens/ConfigManager.cpp Sun Mar 8 18:35:05
2009
@@ -186,7 +186,7 @@
delete tmpPtr;
tmpPtr = NULL;
}
- keys = _lensHash.keys();
+ keys = _profiles.keys();
for(int i=0; i<keys.size();i++) {
MasterProfile* tmpPtr = _profiles.take(keys.at(i));
delete tmpPtr;