diff --git a/Builds/CB/Ember.layout b/Builds/CB/Ember.layout index fd89704..9db164b 100644 --- a/Builds/CB/Ember.layout +++ b/Builds/CB/Ember.layout @@ -1,154 +1,9 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -156,14 +11,99 @@ + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -171,9 +111,34 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -181,4 +146,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Builds/CB/EmberCL.layout b/Builds/CB/EmberCL.layout index 6d66f54..6df0b4b 100644 --- a/Builds/CB/EmberCL.layout +++ b/Builds/CB/EmberCL.layout @@ -1,69 +1,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -71,4 +66,9 @@ + + + + + diff --git a/Builds/CB/EmberGenome.layout b/Builds/CB/EmberGenome.layout index 93cc027..52d025d 100644 --- a/Builds/CB/EmberGenome.layout +++ b/Builds/CB/EmberGenome.layout @@ -1,39 +1,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/Builds/CB/EmberRender.layout b/Builds/CB/EmberRender.layout index 091afe1..bbf5b64 100644 --- a/Builds/CB/EmberRender.layout +++ b/Builds/CB/EmberRender.layout @@ -6,14 +6,9 @@ - + - - - - - - + @@ -21,9 +16,14 @@ - + - + + + + + + @@ -31,9 +31,9 @@ - + - + diff --git a/Builds/QtCreator/Ember/Ember.pro b/Builds/QtCreator/Ember/Ember.pro index 7abfbd4..ed0b1ca 100644 --- a/Builds/QtCreator/Ember/Ember.pro +++ b/Builds/QtCreator/Ember/Ember.pro @@ -1,6 +1,7 @@ TEMPLATE = lib CONFIG += shared CONFIG += warn_off +CONFIG += precompile_header CONFIG -= app_bundle CONFIG -= qt VERSION = 0.1.4.7 @@ -13,6 +14,7 @@ LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2 INCLUDEPATH += /usr/include/glm INCLUDEPATH += /usr/include/tbb INCLUDEPATH += /usr/include/libxml2 +INCLUDEPATH += ../../../Source/Ember QMAKE_CXXFLAGS += -O2 QMAKE_CXXFLAGS += -march=k8 @@ -47,6 +49,8 @@ QMAKE_CXXFLAGS += -DBUILDING_EMBER QMAKE_LFLAGS += -s +PRECOMPILED_HEADER = ../../../Source/Ember/EmberPch.h + SOURCES += \ ../../../Source/Ember/Affine2D.cpp \ ../../../Source/Ember/DllMain.cpp \ diff --git a/Builds/QtCreator/EmberAnimate/EmberAnimate.pro b/Builds/QtCreator/EmberAnimate/EmberAnimate.pro new file mode 100644 index 0000000..97e2fa9 --- /dev/null +++ b/Builds/QtCreator/EmberAnimate/EmberAnimate.pro @@ -0,0 +1,77 @@ +TEMPLATE = app +CONFIG += console +CONFIG += warn_off +CONFIG += precompile_header +CONFIG -= app_bundle +CONFIG -= qt +VERSION = 0.1.4.7 + +DESTDIR = ../../../Bin + +LIBS += -L/usr/lib -lOpenCL +LIBS += -L/usr/lib -lGL +LIBS += -L/usr/lib -ljpeg +LIBS += -L/usr/lib -lpng +LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2 +LIBS += -L../../../Bin -lEmber +LIBS += -L../../../Bin -lEmberCL + +INCLUDEPATH += /usr/include/CL +INCLUDEPATH += /usr/include/GL +INCLUDEPATH += /usr/include/glm +INCLUDEPATH += /usr/include/tbb +INCLUDEPATH += /usr/include/libxml2 +INCLUDEPATH += ../../../Source/Ember +INCLUDEPATH += ../../../Source/EmberCL +INCLUDEPATH += ../../../Source/EmberCommon + +QMAKE_CXXFLAGS += -O2 +QMAKE_CXXFLAGS += -march=k8 +QMAKE_CXXFLAGS += -fPIC +QMAKE_CXXFLAGS += -fpermissive +QMAKE_CXXFLAGS += -fomit-frame-pointer +QMAKE_CXXFLAGS += -pedantic +QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CXXFLAGS += -Wnon-virtual-dtor +QMAKE_CXXFLAGS += -Wshadow +QMAKE_CXXFLAGS += -Winit-self +QMAKE_CXXFLAGS += -Wredundant-decls +QMAKE_CXXFLAGS += -Wcast-align +QMAKE_CXXFLAGS += -Winline +QMAKE_CXXFLAGS += -Wunreachable-code +QMAKE_CXXFLAGS += -Wmissing-include-dirs +QMAKE_CXXFLAGS += -Wswitch-enum +QMAKE_CXXFLAGS += -Wswitch-default +QMAKE_CXXFLAGS += -Wmain +QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant +QMAKE_CXXFLAGS += -Wfatal-errors +QMAKE_CXXFLAGS += -Wall -fpermissive +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -Wno-unused-parameter +QMAKE_CXXFLAGS += -Wno-unused-function +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -D_M_X64 +QMAKE_CXXFLAGS += -D_USRDLL +QMAKE_CXXFLAGS += -DNDEBUG +QMAKE_CXXFLAGS += -D_CONSOLE + +QMAKE_LFLAGS += -s + +PRECOMPILED_HEADER = ../../../Source/EmberCommon/EmberCommonPch.h + +SOURCES += \ + ../../../Source/EmberAnimate/EmberAnimate.cpp \ + ../../../Source/EmberCommon/EmberCommonPch.cpp + +include(deployment.pri) +qtcAddDeployment() + +HEADERS += \ + ../../../Source/EmberAnimate/EmberAnimate.h \ + ../../../Source/EmberCommon/EmberCommon.h \ + ../../../Source/EmberCommon/EmberCommonPch.h \ + ../../../Source/EmberCommon/EmberOptions.h \ + ../../../Source/EmberCommon/JpegUtils.h \ + ../../../Source/EmberCommon/SimpleGlob.h \ + ../../../Source/EmberCommon/SimpleOpt.h + diff --git a/Builds/QtCreator/EmberAnimate/deployment.pri b/Builds/QtCreator/EmberAnimate/deployment.pri new file mode 100644 index 0000000..5f1749f --- /dev/null +++ b/Builds/QtCreator/EmberAnimate/deployment.pri @@ -0,0 +1,191 @@ +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Android and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + greaterThan(QT_MAJOR_VERSION, 4) { + itemsources = $${item}.files + } else { + itemsources = $${item}.sources + } + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +android-no-sdk { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + target.path = /data/user/qt + + export(target.path) + INSTALLS += target +} else:android { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /assets/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + + export(target.path) + INSTALLS += target +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + target ~= s,\\\\\\.?\\\\,\\, + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:ios { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += mkdir -p \"$$target\" + copyCommand += && cp -r \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = echo Copying application data... && $$copyCommand + !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";" + QMAKE_POST_LINK += "$$copyCommand" + export(QMAKE_POST_LINK) + } +} else:unix { + maemo5 { + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps + } else:!isEmpty(MEEGO_VERSION_MAJOR) { + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps + } else { # Assumed to be a Desktop Unix + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + !isEmpty(target.path) { + installPrefix = $${target.path} + } else { + installPrefix = /opt/$${TARGET} + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + !isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile + } + + isEmpty(target.path) { + target.path = $${installPrefix}/bin + export(target.path) + } + INSTALLS += target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} + diff --git a/Builds/QtCreator/EmberCL/EmberCL.pro b/Builds/QtCreator/EmberCL/EmberCL.pro index 45037bb..961898e 100644 --- a/Builds/QtCreator/EmberCL/EmberCL.pro +++ b/Builds/QtCreator/EmberCL/EmberCL.pro @@ -1,6 +1,7 @@ TEMPLATE = lib CONFIG += shared CONFIG += warn_off +CONFIG += precompile_header CONFIG -= app_bundle CONFIG -= qt VERSION = 0.1.4.7 @@ -8,7 +9,7 @@ VERSION = 0.1.4.7 DESTDIR = ../../../Bin LIBS += -L/usr/lib -lOpenCL -LIBS += -L/usr/lib -lGL +#LIBS += -L/usr/lib -lGL INCLUDEPATH += /usr/include/CL INCLUDEPATH += /usr/include/GL @@ -46,10 +47,12 @@ QMAKE_CXXFLAGS += -D_M_X64 QMAKE_CXXFLAGS += -D_USRDLL QMAKE_CXXFLAGS += -DNDEBUG QMAKE_CXXFLAGS += -D_CONSOLE -QMAKE_CXXFLAGS += -DBUILDING_EMBER +QMAKE_CXXFLAGS += -BUILDING_EMBERCL QMAKE_LFLAGS += -s +PRECOMPILED_HEADER = ../../../Source/EmberCL/EmberCLPch.h + SOURCES += \ ../../../Source/EmberCL/DllMain.cpp \ ../../../Source/EmberCL/FinalAccumOpenCLKernelCreator.cpp \ diff --git a/Builds/QtCreator/EmberGenome/EmberGenome.pro b/Builds/QtCreator/EmberGenome/EmberGenome.pro new file mode 100644 index 0000000..dea4173 --- /dev/null +++ b/Builds/QtCreator/EmberGenome/EmberGenome.pro @@ -0,0 +1,77 @@ +TEMPLATE = app +CONFIG += console +CONFIG += warn_off +CONFIG += precompile_header +CONFIG -= app_bundle +CONFIG -= qt +VERSION = 0.1.4.7 + +DESTDIR = ../../../Bin + +LIBS += -L/usr/lib -lOpenCL +LIBS += -L/usr/lib -lGL +LIBS += -L/usr/lib -ljpeg +LIBS += -L/usr/lib -lpng +LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2 +LIBS += -L../../../Bin -lEmber +LIBS += -L../../../Bin -lEmberCL + +INCLUDEPATH += /usr/include/CL +INCLUDEPATH += /usr/include/GL +INCLUDEPATH += /usr/include/glm +INCLUDEPATH += /usr/include/tbb +INCLUDEPATH += /usr/include/libxml2 +INCLUDEPATH += ../../../Source/Ember +INCLUDEPATH += ../../../Source/EmberCL +INCLUDEPATH += ../../../Source/EmberCommon + +QMAKE_CXXFLAGS += -O2 +QMAKE_CXXFLAGS += -march=k8 +QMAKE_CXXFLAGS += -fPIC +QMAKE_CXXFLAGS += -fpermissive +QMAKE_CXXFLAGS += -fomit-frame-pointer +QMAKE_CXXFLAGS += -pedantic +QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CXXFLAGS += -Wnon-virtual-dtor +QMAKE_CXXFLAGS += -Wshadow +QMAKE_CXXFLAGS += -Winit-self +QMAKE_CXXFLAGS += -Wredundant-decls +QMAKE_CXXFLAGS += -Wcast-align +QMAKE_CXXFLAGS += -Winline +QMAKE_CXXFLAGS += -Wunreachable-code +QMAKE_CXXFLAGS += -Wmissing-include-dirs +QMAKE_CXXFLAGS += -Wswitch-enum +QMAKE_CXXFLAGS += -Wswitch-default +QMAKE_CXXFLAGS += -Wmain +QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant +QMAKE_CXXFLAGS += -Wfatal-errors +QMAKE_CXXFLAGS += -Wall -fpermissive +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -Wno-unused-parameter +QMAKE_CXXFLAGS += -Wno-unused-function +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -D_M_X64 +QMAKE_CXXFLAGS += -D_USRDLL +QMAKE_CXXFLAGS += -DNDEBUG +QMAKE_CXXFLAGS += -D_CONSOLE + +QMAKE_LFLAGS += -s + +PRECOMPILED_HEADER = ../../../Source/EmberCommon/EmberCommonPch.h + +SOURCES += \ + ../../../Source/EmberGenome/EmberGenome.cpp \ + ../../../Source/EmberCommon/EmberCommonPch.cpp + +include(deployment.pri) +qtcAddDeployment() + +HEADERS += \ + ../../../Source/EmberGenome/EmberGenome.h \ + ../../../Source/EmberCommon/EmberCommon.h \ + ../../../Source/EmberCommon/EmberCommonPch.h \ + ../../../Source/EmberCommon/EmberOptions.h \ + ../../../Source/EmberCommon/JpegUtils.h \ + ../../../Source/EmberCommon/SimpleGlob.h \ + ../../../Source/EmberCommon/SimpleOpt.h + diff --git a/Builds/QtCreator/EmberGenome/deployment.pri b/Builds/QtCreator/EmberGenome/deployment.pri new file mode 100644 index 0000000..5f1749f --- /dev/null +++ b/Builds/QtCreator/EmberGenome/deployment.pri @@ -0,0 +1,191 @@ +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Android and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + greaterThan(QT_MAJOR_VERSION, 4) { + itemsources = $${item}.files + } else { + itemsources = $${item}.sources + } + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +android-no-sdk { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + target.path = /data/user/qt + + export(target.path) + INSTALLS += target +} else:android { + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = /assets/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + x86 { + target.path = /libs/x86 + } else: armeabi-v7a { + target.path = /libs/armeabi-v7a + } else { + target.path = /libs/armeabi + } + + export(target.path) + INSTALLS += target +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + target ~= s,\\\\\\.?\\\\,\\, + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:ios { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += mkdir -p \"$$target\" + copyCommand += && cp -r \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = echo Copying application data... && $$copyCommand + !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";" + QMAKE_POST_LINK += "$$copyCommand" + export(QMAKE_POST_LINK) + } +} else:unix { + maemo5 { + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps + } else:!isEmpty(MEEGO_VERSION_MAJOR) { + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps + } else { # Assumed to be a Desktop Unix + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + targetFullPath ~= s,/\\.?/,/, + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + !isEmpty(target.path) { + installPrefix = $${target.path} + } else { + installPrefix = /opt/$${TARGET} + } + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + !isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile + } + + isEmpty(target.path) { + target.path = $${installPrefix}/bin + export(target.path) + } + INSTALLS += target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} + diff --git a/Builds/QtCreator/EmberRender/EmberRender.pro b/Builds/QtCreator/EmberRender/EmberRender.pro index 9632ac2..a0d08a9 100644 --- a/Builds/QtCreator/EmberRender/EmberRender.pro +++ b/Builds/QtCreator/EmberRender/EmberRender.pro @@ -1,6 +1,7 @@ TEMPLATE = app CONFIG += console CONFIG += warn_off +CONFIG += precompile_header CONFIG -= app_bundle CONFIG -= qt VERSION = 0.1.4.7 @@ -53,10 +54,11 @@ QMAKE_CXXFLAGS += -D_M_X64 QMAKE_CXXFLAGS += -D_USRDLL QMAKE_CXXFLAGS += -DNDEBUG QMAKE_CXXFLAGS += -D_CONSOLE -QMAKE_CXXFLAGS += -DBUILDING_EMBER QMAKE_LFLAGS += -s +PRECOMPILED_HEADER = ../../../Source/EmberCommon/EmberCommonPch.h + SOURCES += \ ../../../Source/EmberRender/EmberRender.cpp \ ../../../Source/EmberCommon/EmberCommonPch.cpp diff --git a/Builds/QtCreator/Fractorium/Fractorium.pro b/Builds/QtCreator/Fractorium/Fractorium.pro new file mode 100644 index 0000000..c5a9418 --- /dev/null +++ b/Builds/QtCreator/Fractorium/Fractorium.pro @@ -0,0 +1,135 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2014-12-09T21:18:06 +# +#------------------------------------------------- + +QT += core gui opengl concurrent + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = Fractorium +TEMPLATE = app +CONFIG += precompile_header +VERSION = 0.1.4.7 + +DESTDIR = ../../../Bin + +LIBS += -L/usr/lib -lOpenCL +#LIBS += -L/usr/lib -lGL +LIBS += -L/usr/lib -ljpeg +LIBS += -L/usr/lib -lpng +LIBS += -L/usr/lib -ltbb +LIBS += -L/usr/lib/x86_64-linux-gnu -lxml2 +LIBS += -L../../../Bin -lEmber +LIBS += -L../../../Bin -lEmberCL + +INCLUDEPATH += /usr/include/CL +INCLUDEPATH += /usr/include/GL +INCLUDEPATH += /usr/include/glm +INCLUDEPATH += /usr/include/tbb +INCLUDEPATH += /usr/include/libxml2 +INCLUDEPATH += ../../../Source/Ember +INCLUDEPATH += ../../../Source/EmberCL +INCLUDEPATH += ../../../Source/EmberCommon +INCLUDEPATH += ../../../Source/Fractorium + +QMAKE_CXXFLAGS += -O2 +QMAKE_CXXFLAGS += -march=k8 +QMAKE_CXXFLAGS += -fPIC +QMAKE_CXXFLAGS += -fpermissive +QMAKE_CXXFLAGS += -fomit-frame-pointer +QMAKE_CXXFLAGS += -pedantic +QMAKE_CXXFLAGS += -std=c++11 +QMAKE_CXXFLAGS += -Wnon-virtual-dtor +QMAKE_CXXFLAGS += -Wshadow +QMAKE_CXXFLAGS += -Winit-self +#QMAKE_CXXFLAGS += -Wredundant-decls +QMAKE_CXXFLAGS += -Wcast-align +#QMAKE_CXXFLAGS += -Winline +QMAKE_CXXFLAGS += -Wunreachable-code +QMAKE_CXXFLAGS += -Wmissing-include-dirs +#QMAKE_CXXFLAGS += -Wswitch-enum +#QMAKE_CXXFLAGS += -Wswitch-default +QMAKE_CXXFLAGS += -Wmain +#QMAKE_CXXFLAGS += -Wzero-as-null-pointer-constant +#QMAKE_CXXFLAGS += -Wfatal-errors +QMAKE_CXXFLAGS += -Wall -fpermissive +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -Wno-unused-variable +QMAKE_CXXFLAGS += -Wno-unused-parameter +QMAKE_CXXFLAGS += -Wno-unused-function +QMAKE_CXXFLAGS += -Wold-style-cast +QMAKE_CXXFLAGS += -D_M_X64 +QMAKE_CXXFLAGS += -D_USRDLL +QMAKE_CXXFLAGS += -DNDEBUG +QMAKE_CXXFLAGS += -D_CONSOLE + +QMAKE_LFLAGS += -s + +PRECOMPILED_HEADER = ../../../Source/Fractorium/FractoriumPch.h + +SOURCES += \ + ../../../Source/Fractorium/AboutDialog.cpp \ + ../../../Source/Fractorium/DoubleSpinBox.cpp \ + ../../../Source/Fractorium/FinalRenderDialog.cpp \ + ../../../Source/Fractorium/FinalRenderEmberController.cpp \ + ../../../Source/Fractorium/Fractorium.cpp \ + ../../../Source/Fractorium/FractoriumEmberController.cpp \ + ../../../Source/Fractorium/FractoriumInfo.cpp \ + ../../../Source/Fractorium/FractoriumLibrary.cpp \ + ../../../Source/Fractorium/FractoriumMenus.cpp \ + ../../../Source/Fractorium/FractoriumPalette.cpp \ + ../../../Source/Fractorium/FractoriumParams.cpp \ + ../../../Source/Fractorium/FractoriumPch.cpp \ + ../../../Source/Fractorium/FractoriumRender.cpp \ + ../../../Source/Fractorium/FractoriumSettings.cpp \ + ../../../Source/Fractorium/FractoriumToolbar.cpp \ + ../../../Source/Fractorium/FractoriumXforms.cpp \ + ../../../Source/Fractorium/FractoriumXformsAffine.cpp \ + ../../../Source/Fractorium/FractoriumXformsColor.cpp \ + ../../../Source/Fractorium/FractoriumXformsVariations.cpp \ + ../../../Source/Fractorium/FractoriumXformsXaos.cpp \ + ../../../Source/Fractorium/GLEmberController.cpp \ + ../../../Source/Fractorium/GLWidget.cpp \ + ../../../Source/Fractorium/Main.cpp \ + ../../../Source/Fractorium/OptionsDialog.cpp \ + ../../../Source/Fractorium/SpinBox.cpp + +HEADERS += \ + ../../../Source/Fractorium/AboutDialog.h \ + ../../../Source/Fractorium/DoubleSpinBox.h \ + ../../../Source/Fractorium/EmberFile.h \ + ../../../Source/Fractorium/EmberTreeWidgetItem.h \ + ../../../Source/Fractorium/FinalRenderDialog.h \ + ../../../Source/Fractorium/FinalRenderEmberController.h \ + ../../../Source/Fractorium/Fractorium.h \ + ../../../Source/Fractorium/FractoriumEmberController.h \ + ../../../Source/Fractorium/FractoriumPch.h \ + ../../../Source/Fractorium/FractoriumSettings.h \ + ../../../Source/Fractorium/GLEmberController.h \ + ../../../Source/Fractorium/GLWidget.h \ + ../../../Source/Fractorium/OptionsDialog.h \ + ../../../Source/Fractorium/resource.h \ + ../../../Source/Fractorium/SpinBox.h \ + ../../../Source/Fractorium/StealthComboBox.h \ + ../../../Source/Fractorium/TableWidget.h \ + ../../../Source/Fractorium/TwoButtonComboWidget.h \ + ../../../Source/Fractorium/VariationTreeWidgetItem.h \ + ../../../Source/EmberCommon/EmberCommon.h \ + ../../../Source/EmberCommon/JpegUtils.h \ + ../../../Source/EmberCommon/EmberCommonPch.h \ + ../../../Source/Fractorium/FractoriumCommon.h + +FORMS += \ + ../../../Source/Fractorium/AboutDialog.ui \ + ../../../Source/Fractorium/FinalRenderDialog.ui \ + ../../../Source/Fractorium/Fractorium.ui \ + ../../../Source/Fractorium/OptionsDialog.ui + +OTHER_FILES += \ + ../../../Source/Fractorium/Fractorium.aps \ + ../../../Source/Fractorium/Fractorium.rc + +RESOURCES += \ + ../../../Source/Fractorium/Fractorium.qrc diff --git a/Source/Ember/Affine2D.cpp b/Source/Ember/Affine2D.cpp index b2965cf..083f2a0 100644 --- a/Source/Ember/Affine2D.cpp +++ b/Source/Ember/Affine2D.cpp @@ -178,7 +178,7 @@ void Affine2D::Rotate(T angle) /// /// The vec2 describing how far to move in the x and y directions template -void Affine2D::Translate(v2T& v) +void Affine2D::Translate(const v2T& v) { O(O() + v); } @@ -188,7 +188,7 @@ void Affine2D::Translate(v2T& v) /// /// The vec2 describing how much to rotate and scale the X and Y components template -void Affine2D::RotateScaleXTo(v2T& v) +void Affine2D::RotateScaleXTo(const v2T& v) { Affine2D rs = CalcRotateScale(X(), v); @@ -201,7 +201,7 @@ void Affine2D::RotateScaleXTo(v2T& v) /// /// The vec2 describing how much to rotate and scale the X and Y components template -void Affine2D::RotateScaleYTo(v2T& v) +void Affine2D::RotateScaleYTo(const v2T& v) { Affine2D rs = CalcRotateScale(Y(), v); diff --git a/Source/Ember/Affine2D.h b/Source/Ember/Affine2D.h index d01a173..162d9b8 100644 --- a/Source/Ember/Affine2D.h +++ b/Source/Ember/Affine2D.h @@ -75,9 +75,9 @@ public: bool IsID() const; bool IsZero() const; void Rotate(T angle); - void Translate(v2T& v); - void RotateScaleXTo(v2T& v); - void RotateScaleYTo(v2T& v); + void Translate(const v2T& v); + void RotateScaleXTo(const v2T& v); + void RotateScaleYTo(const v2T& v); Affine2D Inverse() const; v2T TransformNormal(const v2T& v) const; v2T TransformVector(const v2T& v) const; diff --git a/Source/Ember/Ember.cpp b/Source/Ember/Ember.cpp index 60ad531..389d656 100644 --- a/Source/Ember/Ember.cpp +++ b/Source/Ember/Ember.cpp @@ -36,7 +36,7 @@ namespace EmberNs { bool Timing::m_TimingInit = false; -int Timing::m_ProcessorCount; +uint Timing::m_ProcessorCount; template<> unique_ptr> QTIsaac::GlobalRand = unique_ptr>(new QTIsaac()); #define EXPORTPREPOSTREGVAR(varName, T) \ diff --git a/Source/Ember/Timing.h b/Source/Ember/Timing.h index 9ab96b8..6033ce8 100644 --- a/Source/Ember/Timing.h +++ b/Source/Ember/Timing.h @@ -119,7 +119,7 @@ public: /// Return the number of cores in the system. /// /// The number of cores in the system - static int ProcessorCount() + static uint ProcessorCount() { Init(); return m_ProcessorCount; @@ -144,7 +144,7 @@ private: time_point m_BeginTime;//The start of the timing, set with Tic(). time_point m_EndTime;//The end of the timing, set with Toc(). static bool m_TimingInit;//Whether the performance info has bee queried. - static int m_ProcessorCount;//The number of cores on the system, set in Init(). + static uint m_ProcessorCount;//The number of cores on the system, set in Init(). }; /// diff --git a/Source/EmberCommon/JpegUtils.h b/Source/EmberCommon/JpegUtils.h index e07cb15..68787de 100644 --- a/Source/EmberCommon/JpegUtils.h +++ b/Source/EmberCommon/JpegUtils.h @@ -79,30 +79,30 @@ static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t he //Write comments to jpeg. if (enableComments) { - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(verString), (uint)strlen(verString)); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(verString), uint(strlen(verString))); if (nick != "") { snprintf_s(nickString, 64, "flam3_nickname: %s", nick.c_str()); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(nickString), (uint)strlen(nickString)); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(nickString), uint(strlen(nickString))); } if (url != "") { snprintf_s(urlString, 128, "flam3_url: %s", url.c_str()); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(urlString), (uint)strlen(urlString)); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(urlString), uint(strlen(urlString))); } if (id != "") { snprintf_s(idString, 128, "flam3_id: %s", id.c_str()); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(idString), (uint)strlen(idString)); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(idString), uint(strlen(idString))); } - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(bvString), (uint)strlen(bvString)); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(niString), (uint)strlen(niString)); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(rtString), (uint)strlen(rtString)); - jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(genomeString), (uint)strlen(genomeString)); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(bvString), uint(strlen(bvString))); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(niString), uint(strlen(niString))); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(rtString), uint(strlen(rtString))); + jpeg_write_marker(&info, JPEG_COM, reinterpret_cast(genomeString), uint(strlen(genomeString))); } for (i = 0; i < height; i++) diff --git a/Source/Fractorium/AboutDialog.cpp b/Source/Fractorium/AboutDialog.cpp index 9ac9678..b07dc88 100644 --- a/Source/Fractorium/AboutDialog.cpp +++ b/Source/Fractorium/AboutDialog.cpp @@ -5,10 +5,10 @@ /// Constructor that takes a parent widget and passes it to the base, then /// sets up the GUI. /// -/// The parent widget. Default: NULL. +/// The parent widget. Default: NULL. /// The window flags. Default: 0. -FractoriumAboutDialog::FractoriumAboutDialog(QWidget* parent, Qt::WindowFlags f) - : QDialog(parent, f) +FractoriumAboutDialog::FractoriumAboutDialog(QWidget* p, Qt::WindowFlags f) + : QDialog(p, f) { ui.setupUi(this); } diff --git a/Source/Fractorium/AboutDialog.h b/Source/Fractorium/AboutDialog.h index eed123b..3209d26 100644 --- a/Source/Fractorium/AboutDialog.h +++ b/Source/Fractorium/AboutDialog.h @@ -15,7 +15,7 @@ class FractoriumAboutDialog : public QDialog { Q_OBJECT public: - FractoriumAboutDialog(QWidget* parent = 0, Qt::WindowFlags f = 0); + FractoriumAboutDialog(QWidget* p = 0, Qt::WindowFlags f = 0); private: Ui::AboutDialog ui; diff --git a/Source/Fractorium/DoubleSpinBox.cpp b/Source/Fractorium/DoubleSpinBox.cpp index ec41eb5..d857744 100644 --- a/Source/Fractorium/DoubleSpinBox.cpp +++ b/Source/Fractorium/DoubleSpinBox.cpp @@ -7,11 +7,11 @@ /// and change its value using the mouse wheel without explicitly having to click /// inside of it. /// -/// The parent widget. Default: NULL. +/// The parent widget. Default: NULL. /// The height of the spin box. Default: 16. /// The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05. -DoubleSpinBox::DoubleSpinBox(QWidget* parent, int height, double step) - : QDoubleSpinBox(parent) +DoubleSpinBox::DoubleSpinBox(QWidget* p, int h, double step) + : QDoubleSpinBox(p) { m_Select = false; m_DoubleClick = false; @@ -23,8 +23,8 @@ DoubleSpinBox::DoubleSpinBox(QWidget* parent, int height, double step) setFrame(false); setButtonSymbols(QAbstractSpinBox::NoButtons); setFocusPolicy(Qt::StrongFocus); - setMinimumHeight(height);//setGeometry() has no effect, so must set both of these instead. - setMaximumHeight(height); + setMinimumHeight(h);//setGeometry() has no effect, so must set both of these instead. + setMaximumHeight(h); lineEdit()->installEventFilter(this); lineEdit()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); connect(this, SIGNAL(valueChanged(double)), this, SLOT(onSpinBoxValueChanged(double)), Qt::QueuedConnection); @@ -151,9 +151,9 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e) { //Take special action for shift to reduce the scroll amount. Control already //increases it automatically. - if (QWheelEvent* wheelEvent = dynamic_cast(e)) + if (QWheelEvent* we = dynamic_cast(e)) { - Qt::KeyboardModifiers mod = wheelEvent->modifiers(); + Qt::KeyboardModifiers mod = we->modifiers(); if (mod.testFlag(Qt::ShiftModifier)) setSingleStep(m_SmallStep); diff --git a/Source/Fractorium/DoubleSpinBox.h b/Source/Fractorium/DoubleSpinBox.h index de9b3c6..f4b8c4f 100644 --- a/Source/Fractorium/DoubleSpinBox.h +++ b/Source/Fractorium/DoubleSpinBox.h @@ -62,14 +62,14 @@ public: /// /// Constructor that passes agruments to the base and assigns the m_Param and m_Variation members. /// - /// The parent widget + /// The parent widget /// The widget item this spinner is contained in /// The variation this spinner is for /// The name of the parameter this is for - /// The height of the spin box. Default: 16. + /// The height of the spin box. Default: 16. /// The step used to increment/decrement the spin box when using the mouse wheel. Default: 0.05. - explicit VariationTreeDoubleSpinBox(QWidget* parent, VariationTreeWidgetItem* widgetItem, Variation* var, string param, int height = 16, double step = 0.05) - : DoubleSpinBox(parent, height, step) + explicit VariationTreeDoubleSpinBox(QWidget* p, VariationTreeWidgetItem* widgetItem, Variation* var, string param, int h = 16, double step = 0.05) + : DoubleSpinBox(p, h, step) { m_WidgetItem = widgetItem; m_Param = param; diff --git a/Source/Fractorium/EmberFile.h b/Source/Fractorium/EmberFile.h index cabbc55..488295c 100644 --- a/Source/Fractorium/EmberFile.h +++ b/Source/Fractorium/EmberFile.h @@ -1,6 +1,6 @@ #pragma once -#include "FractoriumPch.h" +#include "FractoriumCommon.h" /// /// EmberFile class. diff --git a/Source/Fractorium/EmberTreeWidgetItem.h b/Source/Fractorium/EmberTreeWidgetItem.h index e68aace..43946e6 100644 --- a/Source/Fractorium/EmberTreeWidgetItem.h +++ b/Source/Fractorium/EmberTreeWidgetItem.h @@ -18,9 +18,9 @@ public: /// Constructor that takes a pointer to a QTreeWidget as a parent widget. /// This is meant to be a root level item. /// - /// The parent widget of this item - explicit EmberTreeWidgetItemBase(QTreeWidget* parent = 0) - : QTreeWidgetItem(parent) + /// The parent widget of this item + explicit EmberTreeWidgetItemBase(QTreeWidget* p = 0) + : QTreeWidgetItem(p) { } @@ -28,9 +28,9 @@ public: /// Constructor that takes a pointer to a QTreeWidgetItem as a parent widget. /// This is meant to be the child of a root level item. /// - /// The parent widget of this item - explicit EmberTreeWidgetItemBase(QTreeWidgetItem* parent = 0) - : QTreeWidgetItem(parent) + /// The parent widget of this item + explicit EmberTreeWidgetItemBase(QTreeWidgetItem* p = 0) + : QTreeWidgetItem(p) { } @@ -68,9 +68,9 @@ public: /// This is meant to be a root level item. /// /// A pointer to the ember this item will represent - /// The parent widget of this item - explicit EmberTreeWidgetItem(Ember* ember, QTreeWidget* parent = 0) - : EmberTreeWidgetItemBase(parent) + /// The parent widget of this item + explicit EmberTreeWidgetItem(Ember* ember, QTreeWidget* p = 0) + : EmberTreeWidgetItemBase(p) { m_Ember = ember; } @@ -80,9 +80,9 @@ public: /// This is meant to be the child of a root level item. /// /// A pointer to the ember this item will represent - /// The parent widget of this item - explicit EmberTreeWidgetItem(Ember* ember, QTreeWidgetItem* parent = 0) - : EmberTreeWidgetItemBase(parent) + /// The parent widget of this item + explicit EmberTreeWidgetItem(Ember* ember, QTreeWidgetItem* p = 0) + : EmberTreeWidgetItemBase(p) { m_Ember = ember; } diff --git a/Source/Fractorium/FinalRenderDialog.cpp b/Source/Fractorium/FinalRenderDialog.cpp index cb9150a..0758b1c 100644 --- a/Source/Fractorium/FinalRenderDialog.cpp +++ b/Source/Fractorium/FinalRenderDialog.cpp @@ -8,10 +8,10 @@ /// This function contains the render function as a lambda. /// /// Pointer to the global settings object to use -/// The parent widget +/// The parent widget /// The window flags. Default: 0. -FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* settings, QWidget* parent, Qt::WindowFlags f) - : QDialog(parent, f) +FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* settings, QWidget* p, Qt::WindowFlags f) + : QDialog(p, f) { ui.setupUi(this); @@ -21,7 +21,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set QTableWidget* table = ui.FinalRenderParamsTable; QTableWidgetItem* item = NULL; - m_Fractorium = (Fractorium*)parent; + m_Fractorium = dynamic_cast(p); m_Settings = settings; ui.FinalRenderThreadCountSpin->setRange(1, Timing::ProcessorCount()); connect(ui.FinalRenderEarlyClipCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnEarlyClipCheckBoxStateChanged(int)), Qt::QueuedConnection); @@ -124,7 +124,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set m_SupersampleSpin->setValue(m_Settings->FinalSupersample()); m_StripsSpin->setValue(m_Settings->FinalStrips()); - Scale((eScaleType)m_Settings->FinalScale()); + Scale(eScaleType(m_Settings->FinalScale())); if (m_Settings->FinalExt() == "jpg") m_Tbcw->m_Combo->setCurrentIndex(0); @@ -139,7 +139,7 @@ FractoriumFinalRenderDialog::FractoriumFinalRenderDialog(FractoriumSettings* set QSize s = size(); int desktopHeight = qApp->desktop()->availableGeometry().height(); - s.setHeight(min(s.height(), (int)((double)desktopHeight * 0.90))); + s.setHeight(min(s.height(), int(double(desktopHeight * 0.90)))); setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, s, qApp->desktop()->availableGeometry())); QWidget* w = SetTabOrder(this, ui.FinalRenderEarlyClipCheckBox, ui.FinalRenderYAxisUpCheckBox); @@ -647,20 +647,18 @@ bool FractoriumFinalRenderDialog::CreateControllerFromGUI(bool createRenderer) int index = Current() - 1; #ifdef DO_DOUBLE - size_t size = Double() ? sizeof(double) : sizeof(float); + size_t elementSize = Double() ? sizeof(double) : sizeof(float); #else - size_t size = sizeof(float); + size_t elementSize = sizeof(float); #endif - - if (!m_Controller.get() || (m_Controller->SizeOfT() != size)) + + if (!m_Controller.get() || (m_Controller->SizeOfT() != elementSize)) { #ifdef DO_DOUBLE - size_t size = Double() ? sizeof(double) : sizeof(float); Ember ed; Ember orig; EmberFile efd; #else - size_t size = sizeof(float); Ember ed; Ember orig; EmberFile efd; @@ -711,8 +709,8 @@ bool FractoriumFinalRenderDialog::SetMemory() bool error = false; tuple p = m_Controller->SyncAndComputeMemory(); - ui.FinalRenderParamsTable->item(m_MemoryCellIndex, 1)->setText(ToString(get<1>(p))); - ui.FinalRenderParamsTable->item(m_ItersCellIndex, 1)->setText(ToString(get<2>(p))); + ui.FinalRenderParamsTable->item(m_MemoryCellIndex, 1)->setText(ToString(get<1>(p))); + ui.FinalRenderParamsTable->item(m_ItersCellIndex, 1)->setText(ToString(get<2>(p))); if (OpenCL()) { @@ -729,14 +727,14 @@ bool FractoriumFinalRenderDialog::SetMemory() if (histSize > maxAlloc) { - s = "Histogram/Accumulator memory size of " + ToString(histSize) + - " is greater than the max OpenCL allocation size of " + ToString(maxAlloc); + s = "Histogram/Accumulator memory size of " + ToString(histSize) + + " is greater than the max OpenCL allocation size of " + ToString(maxAlloc); } if (totalSize > totalAvail) { - s += "\n\nTotal required memory size of " + ToString(totalSize) + - " is greater than the max OpenCL available memory of " + ToString(totalAvail); + s += "\n\nTotal required memory size of " + ToString(totalSize) + + " is greater than the max OpenCL available memory of " + ToString(totalAvail); } if (!s.isEmpty()) diff --git a/Source/Fractorium/FinalRenderDialog.h b/Source/Fractorium/FinalRenderDialog.h index 1d9d4fe..17e6d76 100644 --- a/Source/Fractorium/FinalRenderDialog.h +++ b/Source/Fractorium/FinalRenderDialog.h @@ -12,6 +12,8 @@ /// class Fractorium;//Forward declaration since Fractorium uses this dialog. +class FinalRenderEmberControllerBase; +template class FinalRenderEmberController; /// /// The final render dialog is for when the user is satisfied with the parameters they've @@ -38,12 +40,13 @@ class FractoriumFinalRenderDialog : public QDialog friend Fractorium; friend FinalRenderEmberControllerBase; friend FinalRenderEmberController; + #ifdef DO_DOUBLE friend FinalRenderEmberController; #endif public: - FractoriumFinalRenderDialog(FractoriumSettings* settings, QWidget* parent, Qt::WindowFlags f = 0); + FractoriumFinalRenderDialog(FractoriumSettings* settings, QWidget* p, Qt::WindowFlags f = 0); bool EarlyClip(); bool YAxisUp(); bool Transparency(); diff --git a/Source/Fractorium/FinalRenderEmberController.cpp b/Source/Fractorium/FinalRenderEmberController.cpp index bf6f824..725321e 100644 --- a/Source/Fractorium/FinalRenderEmberController.cpp +++ b/Source/Fractorium/FinalRenderEmberController.cpp @@ -170,7 +170,7 @@ FinalRenderEmberController::FinalRenderEmberController(FractoriumFinalRenderD m_Renderer->YAxisUp(m_GuiState.m_YAxisUp); m_Renderer->ThreadCount(m_GuiState.m_ThreadCount); m_Renderer->Transparency(m_GuiState.m_Transparency); - m_Renderer->m_ProgressParameter = (void*)¤tStripForProgress; + m_Renderer->m_ProgressParameter = reinterpret_cast(¤tStripForProgress); if (path.endsWith(".png", Qt::CaseInsensitive) || m_Renderer->RendererType() == OPENCL_RENDERER)//This is creating the wrong thing.//TODO m_Renderer->NumChannels(4); @@ -399,7 +399,6 @@ template bool FinalRenderEmberController::CreateRenderer(eRendererType renderType, uint platform, uint device, bool shared) { bool ok = true; - vector errorReport; uint channels = m_FinalRenderDialog->Ext() == "png" ? 4 : 3; CancelRender(); @@ -465,10 +464,10 @@ template int FinalRenderEmberController::ProgressFunc(Ember& ember, void* foo, double fraction, int stage, double etaMs) { static int count = 0; - uint strip = *((uint*)m_Renderer->m_ProgressParameter); + uint strip = *(reinterpret_cast(m_Renderer->m_ProgressParameter)); double fracPerStrip = ceil(100.0 / m_GuiState.m_Strips); double stripsfrac = ceil(fracPerStrip * strip) + ceil(fraction / m_GuiState.m_Strips); - int intFract = (int)stripsfrac; + int intFract = int(stripsfrac); if (stage == 0) QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, intFract)); @@ -531,14 +530,14 @@ void FinalRenderEmberController::SyncCurrentToSizeSpinners(bool scale, bool s { if (scale) { - m_FinalRenderDialog->m_WidthScaleSpin->SetValueStealth((double)m_Ember->m_FinalRasW / m_Ember->m_OrigFinalRasW);//Work backward to determine the scale. - m_FinalRenderDialog->m_HeightScaleSpin->SetValueStealth((double)m_Ember->m_FinalRasH / m_Ember->m_OrigFinalRasH); + m_FinalRenderDialog->m_WidthScaleSpin->SetValueStealth(double(m_Ember->m_FinalRasW) / m_Ember->m_OrigFinalRasW);//Work backward to determine the scale. + m_FinalRenderDialog->m_HeightScaleSpin->SetValueStealth(double(m_Ember->m_FinalRasH) / m_Ember->m_OrigFinalRasH); } if (size) { - m_FinalRenderDialog->m_WidthScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasW) + ")"); - m_FinalRenderDialog->m_HeightScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasH) + ")"); + m_FinalRenderDialog->m_WidthScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasW) + ")"); + m_FinalRenderDialog->m_HeightScaleSpin->setSuffix(" (" + ToString(m_Ember->m_FinalRasH) + ")"); } } @@ -580,7 +579,7 @@ tuple FinalRenderEmberController::SyncAndComputeMemor [&](const string& s) { }, [&](const string& s) { }, [&](const string& s) { }); SyncGuiToEmbers(); - m_FinalRenderDialog->m_StripsSpin->setSuffix(" (" + ToString(strips) + ")"); + m_FinalRenderDialog->m_StripsSpin->setSuffix(" (" + ToString(strips) + ")"); m_Renderer->SetEmber(*m_Ember); m_Renderer->CreateSpatialFilter(b); m_Renderer->CreateTemporalFilter(b); @@ -640,8 +639,8 @@ void FinalRenderEmberController::RenderComplete(Ember& ember) { string renderTimeString = m_RenderTimer.Format(m_RenderTimer.Toc()), totalTimeString; QString status, filename = ComposePath(QString::fromStdString(ember.m_Name)); - QString itersString = ToString(m_Stats.m_Iters); - QString itersPerSecString = ToString(size_t(m_Stats.m_Iters / (m_Stats.m_IterMs / 1000.0))); + QString itersString = ToString(m_Stats.m_Iters); + QString itersPerSecString = ToString(size_t(m_Stats.m_Iters / (m_Stats.m_IterMs / 1000.0))); //Save whatever options were specified on the GUI to the settings. m_Settings->FinalEarlyClip(m_GuiState.m_EarlyClip); @@ -681,8 +680,8 @@ void FinalRenderEmberController::RenderComplete(Ember& ember) QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderIterationProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100));//Just to be safe. QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderFilteringProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100)); QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderAccumProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, 100)); - QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, int(((float)m_FinishedImageCount / (float)m_ImageCount) * 100))); - QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(const QString&, ToString(m_FinishedImageCount) + " / " + ToString(m_ImageCount))); + QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderTotalProgress, "setValue", Qt::QueuedConnection, Q_ARG(int, int((float(m_FinishedImageCount) / float(m_ImageCount)) * 100))); + QMetaObject::invokeMethod(m_FinalRenderDialog->ui.FinalRenderImageCountLabel, "setText", Qt::QueuedConnection, Q_ARG(const QString&, ToString(m_FinishedImageCount) + " / " + ToString(m_ImageCount))); status = "Pure render time: " + QString::fromStdString(renderTimeString); Output(status); @@ -733,3 +732,9 @@ void FinalRenderEmberController::SyncGuiToEmber(Ember& ember, size_t width ember.m_Quality = m_FinalRenderDialog->m_QualitySpin->value(); ember.m_Supersample = m_FinalRenderDialog->m_SupersampleSpin->value(); } + +template class FinalRenderEmberController; + +#ifdef DO_DOUBLE + template class FinalRenderEmberController; +#endif diff --git a/Source/Fractorium/FinalRenderEmberController.h b/Source/Fractorium/FinalRenderEmberController.h index 4ce9ad6..67e2ea6 100644 --- a/Source/Fractorium/FinalRenderEmberController.h +++ b/Source/Fractorium/FinalRenderEmberController.h @@ -13,6 +13,7 @@ /// class Fractorium; class FractoriumFinalRenderDialog; +//class FractoriumEmberControllerBase; /// /// Used to hold the options specified in the current state of the Gui for performing the final render. @@ -138,8 +139,3 @@ protected: unique_ptr> m_FinalPreviewRenderer; }; -template class FinalRenderEmberController; - -#ifdef DO_DOUBLE - template class FinalRenderEmberController; -#endif \ No newline at end of file diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index b42a61a..49c7f39 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -7,10 +7,11 @@ /// to the GUI widgets that are not possible to do through the designer. So if something /// is present here, it's safe to assume it can't be done in the designer. /// -Fractorium::Fractorium(QWidget* parent) - : QMainWindow(parent) +/// The parent widget of this item +Fractorium::Fractorium(QWidget* p) + : QMainWindow(p) { - int spinHeight = 20, iconSize = 9; + int spinHeight = 20, iconSize_ = 9; size_t i = 0; Timing t; ui.setupUi(this); @@ -58,13 +59,13 @@ Fractorium::Fractorium(QWidget* parent) for (i = 0; i < XFORM_COLOR_COUNT; i++) { - QPixmap pixmap(iconSize, iconSize); + QPixmap pixmap(iconSize_, iconSize_); pixmap.fill(m_XformComboColors[i]); m_XformComboIcons[i] = QIcon(pixmap); } - QPixmap pixmap(iconSize, iconSize); + QPixmap pixmap(iconSize_, iconSize_); pixmap.fill(m_FinalXformComboColor); m_FinalXformComboIcon = QIcon(pixmap); @@ -168,14 +169,14 @@ Fractorium::~Fractorium() /// /// Set the coordinate text in the status bar. /// -/// The raster x coordinate -/// The raster y coordinate +/// The raster x coordinate +/// The raster y coordinate /// The cartesian world x coordinate /// The cartesian world y coordinate -void Fractorium::SetCoordinateStatus(int x, int y, float worldX, float worldY) +void Fractorium::SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY) { //Use sprintf rather than allocating and concatenating 6 QStrings for efficiency since this is called on every mouse move. - sprintf_s(m_CoordinateString, 128, "Window: %4d, %4d World: %2.2f, %2.2f", x, y, worldX, worldY); + sprintf_s(m_CoordinateString, 128, "Window: %4d, %4d World: %2.2f, %2.2f", rasX, rasY, worldX, worldY); m_CoordinateStatusLabel->setText(QString(m_CoordinateString)); } @@ -711,3 +712,9 @@ int Fractorium::FlipDet(Affine2D& affine) // if (incRow) // row++; //} + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h index d99ab44..ecf0c39 100644 --- a/Source/Fractorium/Fractorium.h +++ b/Source/Fractorium/Fractorium.h @@ -1,6 +1,7 @@ #pragma once #include "ui_Fractorium.h" +#include "FractoriumCommon.h" #include "GLWidget.h" #include "EmberTreeWidgetItem.h" #include "VariationTreeWidgetItem.h" @@ -14,6 +15,17 @@ /// Fractorium class. /// +class GLWidget; +class FractoriumOptionsDialog; +class FractoriumFinalRenderDialog; +class FractoriumAboutDialog; +class GLEmberControllerBase; +class FractoriumEmberControllerBase; +class FinalRenderEmberControllerBase; +template class GLEmberController; +template class FractoriumEmberController; +template class FinalRenderEmberController; + /// /// Fractorium is the main window for the interactive renderer. The main viewable area /// is a derivation of QGLWidget named GLWidget. The design uses the concept of a controller @@ -55,23 +67,26 @@ class Fractorium : public QMainWindow friend FractoriumAboutDialog; friend GLEmberControllerBase; friend GLEmberController; - friend GLEmberController; friend FractoriumEmberControllerBase; friend FractoriumEmberController; - friend FractoriumEmberController; friend FinalRenderEmberControllerBase; friend FinalRenderEmberController; - friend FinalRenderEmberController; - + +#ifdef DO_DOUBLE + friend GLEmberController; + friend FractoriumEmberController; + friend FinalRenderEmberController; +#endif + public: - Fractorium(QWidget* parent = 0); + Fractorium(QWidget* p = 0); ~Fractorium(); //Geometry. void SetCenter(float x, float y); void SetRotation(double rot, bool stealth); void SetScale(double scale); - void SetCoordinateStatus(int x, int y, float worldX, float worldY); + void SetCoordinateStatus(int rasX, int rasY, float worldX, float worldY); //Xforms. void CurrentXform(uint i); @@ -236,7 +251,7 @@ public slots: void ShowCritical(const QString& title, const QString& text, bool invokeRequired = false); //Can't have a template function be a slot. - void SetLibraryTreeItemData(EmberTreeWidgetItemBase* item, vector& v, uint width, uint height); + void SetLibraryTreeItemData(EmberTreeWidgetItemBase* item, vector& v, uint w, uint h); public: //template//See below. @@ -290,7 +305,7 @@ private: //Info. void UpdateHistogramBounds(); - void ErrorReportToQTextEdit(vector& errors, QTextEdit* textEdit, bool clear = true); + void ErrorReportToQTextEdit(const vector& errors, QTextEdit* textEdit, bool clear = true); //Rendering/progress. bool CreateRendererFromOptions(); @@ -406,112 +421,5 @@ private: Ui::FractoriumClass ui; }; - -/// -/// Setup a spinner to be placed in a table cell. -/// Due to a serious compiler bug in MSVC, this must be declared as an outside function instead of a static member of Fractorium. -/// The reason is that the default arguments of type valType will not be interpreted correctly by the compiler. -/// If the bug is ever fixed, put it back as a static member function. -/// -/// The table the spinner belongs to -/// The receiver object -/// The row in the table where this spinner resides -/// The col in the table where this spinner resides -/// Double pointer to spin box which will hold the spinner upon exit -/// The height of the spinner -/// The minimum value of the spinner -/// The maximum value of the spinner -/// The step of the spinner -/// The signal the spinner emits -/// The slot to receive the signal -/// Whether to increment the row value -/// The default value for the spinner -/// When the spinner has a value of zero and is double clicked, assign this value -/// When the spinner has a value of non-zero and is double clicked, assign this value -template -static void SetupSpinner(QTableWidget* table, const QObject* receiver, int& row, int col, spinType*& spinBox, int height, valType min, valType max, valType step, const char* signal, const char* slot, bool incRow = true, valType val = 0, valType doubleClickZero = -999, valType doubleClickNonZero = -999) -{ - spinBox = new spinType(table, height, step); - spinBox->setRange(min, max); - spinBox->setValue(val); - - if (col >= 0) - table->setCellWidget(row, col, spinBox); - - if (string(signal) != "" && string(slot) != "") - receiver->connect(spinBox, signal, receiver, slot, Qt::QueuedConnection); - - if (doubleClickNonZero != -999 && doubleClickZero != -999) - { - spinBox->DoubleClick(true); - spinBox->DoubleClickZero((valType)doubleClickZero); - spinBox->DoubleClickNonZero((valType)doubleClickNonZero); - } - - if (incRow) - row++; -} - -/// -/// Wrapper around QWidget::setTabOrder() to return the second widget. -/// This makes it easy to chain multiple calls without having to retype -/// all of them if the order changes or if a new widget is inserted. -/// -/// The parent widget that w1 and w2 belong to -/// The widget to come first in the tab order -/// The widget to come second in the tab order -static QWidget* SetTabOrder(QWidget* parent, QWidget* w1, QWidget* w2) -{ - parent->setTabOrder(w1, w2); - return w2; -} - -/// -/// Wrapper around QLocale::system().toDouble(). -/// -/// The string to convert -/// Pointer to boolean which stores the success value of the conversion -/// The converted value if successful, else 0. -static double ToDouble(const QString &s, bool *ok) -{ - return QLocale::system().toDouble(s, ok); -} - -/// -/// Wrapper around QLocale::system().toString(). -/// -/// The value to convert -/// The string value if successful, else "". -template -static QString ToString(T val) -{ - return QLocale::system().toString(val); -} - -/// -/// Force a QString to end with the specified value. -/// -/// The string to append a suffix to -/// The suffix to append -/// The original string value if it already ended in e, else the original value appended with e. -template -static QString MakeEnd(const QString& s, T e) -{ - if (!s.endsWith(e)) - return s + e; - else - return s; -} - -/// -/// Check if a path is not empty and exists on the file system. -/// -/// The path to check -/// True if s was not empty and existed, else false. -static bool Exists(const QString& s) -{ - return s != "" && QDir(s).exists(); -} - //template void Fractorium::SetupSpinner (QTableWidget* table, const QObject* receiver, int& row, int col, SpinBox*& spinBox, int height, int min, int max, int step, const char* signal, const char* slot, bool incRow, int val, int doubleClickZero, int doubleClickNonZero); //template void Fractorium::SetupSpinner(QTableWidget* table, const QObject* receiver, int& row, int col, DoubleSpinBox*& spinBox, int height, double min, double max, double step, const char* signal, const char* slot, bool incRow, double val, double doubleClickZero, double doubleClickNonZero); diff --git a/Source/Fractorium/Fractorium.ui b/Source/Fractorium/Fractorium.ui index 88677b6..3d32f57 100644 --- a/Source/Fractorium/Fractorium.ui +++ b/Source/Fractorium/Fractorium.ui @@ -5837,7 +5837,7 @@ SpinBox GLWidget QWidget -
glwidget.h
+
GLWidget.h
1
diff --git a/Source/Fractorium/FractoriumCommon.h b/Source/Fractorium/FractoriumCommon.h new file mode 100644 index 0000000..ff8f80d --- /dev/null +++ b/Source/Fractorium/FractoriumCommon.h @@ -0,0 +1,113 @@ +#pragma once + +#include "FractoriumPch.h" + +/// +/// Fractorium global utility functions. +/// + +/// +/// Setup a spinner to be placed in a table cell. +/// Due to a serious compiler bug in MSVC, this must be declared as an outside function instead of a static member of Fractorium. +/// The reason is that the default arguments of type valType will not be interpreted correctly by the compiler. +/// If the bug is ever fixed, put it back as a static member function. +/// +/// The table the spinner belongs to +/// The receiver object +/// The row in the table where this spinner resides +/// The col in the table where this spinner resides +/// Double pointer to spin box which will hold the spinner upon exit +/// The height of the spinner +/// The minimum value of the spinner +/// The maximum value of the spinner +/// The step of the spinner +/// The signal the spinner emits +/// The slot to receive the signal +/// Whether to increment the row value +/// The default value for the spinner +/// When the spinner has a value of zero and is double clicked, assign this value +/// When the spinner has a value of non-zero and is double clicked, assign this value +template +static void SetupSpinner(QTableWidget* table, const QObject* receiver, int& row, int col, spinType*& spinBox, int height, valType min, valType max, valType step, const char* signal, const char* slot, bool incRow = true, valType val = 0, valType doubleClickZero = -999, valType doubleClickNonZero = -999) +{ + spinBox = new spinType(table, height, step); + spinBox->setRange(min, max); + spinBox->setValue(val); + + if (col >= 0) + table->setCellWidget(row, col, spinBox); + + if (string(signal) != "" && string(slot) != "") + receiver->connect(spinBox, signal, receiver, slot, Qt::QueuedConnection); + + if (doubleClickNonZero != -999 && doubleClickZero != -999) + { + spinBox->DoubleClick(true); + spinBox->DoubleClickZero(valType(doubleClickZero)); + spinBox->DoubleClickNonZero(valType(doubleClickNonZero)); + } + + if (incRow) + row++; +} + +/// +/// Wrapper around QWidget::setTabOrder() to return the second widget. +/// This makes it easy to chain multiple calls without having to retype +/// all of them if the order changes or if a new widget is inserted. +/// +/// The parent widget that w1 and w2 belong to +/// The widget to come first in the tab order +/// The widget to come second in the tab order +static QWidget* SetTabOrder(QWidget* p, QWidget* w1, QWidget* w2) +{ + p->setTabOrder(w1, w2); + return w2; +} + +/// +/// Wrapper around QLocale::system().toDouble(). +/// +/// The string to convert +/// Pointer to boolean which stores the success value of the conversion +/// The converted value if successful, else 0. +static double ToDouble(const QString &s, bool *ok) +{ + return QLocale::system().toDouble(s, ok); +} + +/// +/// Wrapper around QLocale::system().toString(). +/// +/// The value to convert +/// The string value if successful, else "". +template +static QString ToString(T val) +{ + return QLocale::system().toString(val); +} + +/// +/// Force a QString to end with the specified value. +/// +/// The string to append a suffix to +/// The suffix to append +/// The original string value if it already ended in e, else the original value appended with e. +template +static QString MakeEnd(const QString& s, T e) +{ + if (!s.endsWith(e)) + return s + e; + else + return s; +} + +/// +/// Check if a path is not empty and exists on the file system. +/// +/// The path to check +/// True if s was not empty and existed, else false. +static bool Exists(const QString& s) +{ + return s != "" && QDir(s).exists(); +} diff --git a/Source/Fractorium/FractoriumEmberController.cpp b/Source/Fractorium/FractoriumEmberController.cpp index 76b807a..10e79b7 100644 --- a/Source/Fractorium/FractoriumEmberController.cpp +++ b/Source/Fractorium/FractoriumEmberController.cpp @@ -92,7 +92,7 @@ FractoriumEmberController::FractoriumEmberController(Fractorium* fractorium) m_PreviewRun = true; m_PreviewRunning = true; - m_PreviewRenderer->ThreadCount(max(1, Timing::ProcessorCount() - 1));//Leave one processor free so the GUI can breathe. + m_PreviewRenderer->ThreadCount(max(1u, Timing::ProcessorCount() - 1));//Leave one processor free so the GUI can breathe. QTreeWidget* tree = m_Fractorium->ui.LibraryTree; if (QTreeWidgetItem* top = tree->topLevelItem(0)) @@ -116,7 +116,7 @@ FractoriumEmberController::FractoriumEmberController(Fractorium* fractorium) //This ensures the events are processed in order as each preview is updated, and that control does not return here //until the update is complete. QMetaObject::invokeMethod(m_Fractorium, "SetLibraryTreeItemData", Qt::BlockingQueuedConnection, - Q_ARG(EmberTreeWidgetItemBase*, (EmberTreeWidgetItemBase*)treeItem), + Q_ARG(EmberTreeWidgetItemBase*, dynamic_cast(treeItem)), Q_ARG(vector&, m_PreviewFinalImage), Q_ARG(uint, PREVIEW_SIZE), Q_ARG(uint, PREVIEW_SIZE)); @@ -260,4 +260,10 @@ void FractoriumEmberController::SetEmberPrivate(const Ember& ember, bool v m_Fractorium->FillXforms();//Must do this first because the palette setup in FillParamTablesAndPalette() uses the xforms combo. FillParamTablesAndPalette(); -} \ No newline at end of file +} + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h index 9bfd3df..35f50cf 100644 --- a/Source/Fractorium/FractoriumEmberController.h +++ b/Source/Fractorium/FractoriumEmberController.h @@ -456,8 +456,3 @@ private: std::function m_PreviewRenderFunc; }; -template class FractoriumEmberController; - -#ifdef DO_DOUBLE - template class FractoriumEmberController; -#endif \ No newline at end of file diff --git a/Source/Fractorium/FractoriumInfo.cpp b/Source/Fractorium/FractoriumInfo.cpp index 9bea892..c03badf 100644 --- a/Source/Fractorium/FractoriumInfo.cpp +++ b/Source/Fractorium/FractoriumInfo.cpp @@ -14,8 +14,8 @@ void Fractorium::UpdateHistogramBounds() sprintf_s(m_URString, 32, "UR: %3.3f, %3.3f", -r->LowerLeftX(), r->UpperRightY()); sprintf_s(m_LRString, 32, "LR: %3.3f, %3.3f", -r->LowerLeftX(), r->LowerLeftY()); sprintf_s(m_LLString, 32, "LL: %3.3f, %3.3f", r->LowerLeftX(), r->LowerLeftY()); - sprintf_s(m_WString, 16, "W: %4d" , r->SuperRasW()); - sprintf_s(m_HString, 16, "H: %4d" , r->SuperRasH()); + sprintf_s(m_WString, 16, "W: %4lu" , r->SuperRasW()); + sprintf_s(m_HString, 16, "H: %4lu" , r->SuperRasH()); ui.InfoBoundsLabelUL->setText(QString(m_ULString)); ui.InfoBoundsLabelUR->setText(QString(m_URString)); @@ -24,7 +24,7 @@ void Fractorium::UpdateHistogramBounds() ui.InfoBoundsLabelW->setText(QString(m_WString)); ui.InfoBoundsLabelH->setText(QString(m_HString)); - ui.InfoBoundsTable->item(0, 1)->setText(ToString(r->GutterWidth())); + ui.InfoBoundsTable->item(0, 1)->setText(ToString(r->GutterWidth())); if (r->GetDensityFilter()) { @@ -48,11 +48,11 @@ void Fractorium::UpdateHistogramBounds() /// The vector of error strings /// The QTextEdit to fill /// Clear if true, else don't. -void Fractorium::ErrorReportToQTextEdit(vector& errors, QTextEdit* textEdit, bool clear) +void Fractorium::ErrorReportToQTextEdit(const vector& errors, QTextEdit* textEdit, bool clear) { if (clear) QMetaObject::invokeMethod(textEdit, "clear", Qt::QueuedConnection); for (size_t i = 0; i < errors.size(); i++) QMetaObject::invokeMethod(textEdit, "append", Qt::QueuedConnection, Q_ARG(const QString&, QString::fromStdString(errors[i]) + "\n")); -} \ No newline at end of file +} diff --git a/Source/Fractorium/FractoriumLibrary.cpp b/Source/Fractorium/FractoriumLibrary.cpp index 0f31a7d..bb76feb 100644 --- a/Source/Fractorium/FractoriumLibrary.cpp +++ b/Source/Fractorium/FractoriumLibrary.cpp @@ -15,11 +15,11 @@ void Fractorium::InitLibraryUI() ///
/// The item double clicked on /// The vector holding the RGBA bitmap -/// The width of the bitmap -/// The height of the bitmap -void Fractorium::SetLibraryTreeItemData(EmberTreeWidgetItemBase* item, vector& v, uint width, uint height) +/// The width of the bitmap +/// The height of the bitmap +void Fractorium::SetLibraryTreeItemData(EmberTreeWidgetItemBase* item, vector& v, uint w, uint h) { - item->SetImage(v, width, height); + item->SetImage(v, w, h); } /// @@ -275,3 +275,9 @@ void FractoriumEmberController::StopPreviewRender() QCoreApplication::sendPostedEvents(m_Fractorium->ui.LibraryTree); QCoreApplication::flush(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumMenus.cpp b/Source/Fractorium/FractoriumMenus.cpp index 73b989e..91cda4d 100644 --- a/Source/Fractorium/FractoriumMenus.cpp +++ b/Source/Fractorium/FractoriumMenus.cpp @@ -191,7 +191,7 @@ void FractoriumEmberController::OpenAndPrepFiles(const QStringList& filenames //Also ensure it has a name. if (embers[i].m_Name == "" || embers[i].m_Name == "No name") - embers[i].m_Name = ToString(i).toStdString(); + embers[i].m_Name = ToString(i).toStdString(); embers[i].m_Quality = m_Fractorium->m_QualitySpin->value(); embers[i].m_Supersample = m_Fractorium->m_SupersampleSpin->value(); @@ -504,13 +504,13 @@ void FractoriumEmberController::PasteXmlAppend() for (i = 0; i < b.size(); i++) { - if ((uint)b[i] < 128u) + if (uint(b[i]) < 128u) s.push_back(b[i]); } b.clear(); StopPreviewRender(); - parser.Parse((byte*)s.c_str(), "", embers); + parser.Parse(reinterpret_cast(const_cast(s.c_str())), "", embers); errors = parser.ErrorReportString(); if (errors != "") @@ -527,7 +527,7 @@ void FractoriumEmberController::PasteXmlAppend() //Also ensure it has a name. if (embers[i].m_Name == "" || embers[i].m_Name == "No name") - embers[i].m_Name = ToString(embers[i].m_Index).toStdString(); + embers[i].m_Name = ToString(embers[i].m_Index).toStdString(); m_EmberFile.m_Embers.push_back(embers[i]);//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync. } @@ -559,14 +559,14 @@ void FractoriumEmberController::PasteXmlOver() for (i = 0; i < b.size(); i++) { - if ((uint)b[i] < 128u) + if (uint(b[i]) < 128u) s.push_back(b[i]); } b.clear(); StopPreviewRender(); m_EmberFile.m_Embers.clear();//Will invalidate the pointers contained in the EmberTreeWidgetItems, UpdateLibraryTree() will resync. - parser.Parse((byte*)s.c_str(), "", m_EmberFile.m_Embers); + parser.Parse(reinterpret_cast(const_cast(s.c_str())), "", m_EmberFile.m_Embers); errors = parser.ErrorReportString(); if (errors != "") @@ -583,7 +583,7 @@ void FractoriumEmberController::PasteXmlOver() //Also ensure it has a name. if (m_EmberFile.m_Embers[i].m_Name == "" || m_EmberFile.m_Embers[i].m_Name == "No name") - m_EmberFile.m_Embers[i].m_Name = ToString(m_EmberFile.m_Embers[i].m_Index).toStdString(); + m_EmberFile.m_Embers[i].m_Name = ToString(m_EmberFile.m_Embers[i].m_Index).toStdString(); } } else @@ -758,3 +758,9 @@ void Fractorium::OnActionAbout(bool checked) { m_AboutDialog->exec(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumPalette.cpp b/Source/Fractorium/FractoriumPalette.cpp index f9f5cac..5455da7 100644 --- a/Source/Fractorium/FractoriumPalette.cpp +++ b/Source/Fractorium/FractoriumPalette.cpp @@ -111,11 +111,11 @@ void FractoriumEmberController::ApplyPaletteToEmber() int i, rot = 0; uint blur = m_Fractorium->m_PaletteBlurSpin->value(); uint freq = m_Fractorium->m_PaletteFrequencySpin->value(); - double sat = (double)m_Fractorium->m_PaletteSaturationSpin->value() / 100.0; - double brightness = (double)m_Fractorium->m_PaletteBrightnessSpin->value() / 255.0; - double contrast = (double)(m_Fractorium->m_PaletteContrastSpin->value() > 0 ? (m_Fractorium->m_PaletteContrastSpin->value() * 2) : m_Fractorium->m_PaletteContrastSpin->value()) / 100.0; + double sat = double(m_Fractorium->m_PaletteSaturationSpin->value() / 100.0); + double brightness = double(m_Fractorium->m_PaletteBrightnessSpin->value() / 255.0); + double contrast = double(m_Fractorium->m_PaletteContrastSpin->value() > 0 ? (m_Fractorium->m_PaletteContrastSpin->value() * 2) : m_Fractorium->m_PaletteContrastSpin->value()) / 100.0; - m_Ember.m_Hue = (double)(m_Fractorium->m_PaletteHueSpin->value()) / 360.0;//This is the only palette adjustment value that gets saved with the ember, so just assign it here. + m_Ember.m_Hue = double(m_Fractorium->m_PaletteHueSpin->value()) / 360.0;//This is the only palette adjustment value that gets saved with the ember, so just assign it here. //Use the temp palette as the base and apply the adjustments gotten from the GUI and save the result in the ember palette. m_TempPalette.MakeAdjustedPalette(m_Ember.m_Palette, 0, m_Ember.m_Hue, sat, brightness, contrast, blur, freq); @@ -235,7 +235,7 @@ void Fractorium::OnPaletteRandomSelectButtonClicked(bool checked) uint i = 0; int rowCount = ui.PaletteListTable->rowCount() - 1; - while ((i = QTIsaac::GlobalRand->Rand(rowCount)) == m_PreviousPaletteRow); + while ((i = QTIsaac::GlobalRand->Rand(rowCount)) == uint(m_PreviousPaletteRow)); OnPaletteCellClicked(i, 1); } @@ -282,3 +282,9 @@ void Fractorium::ResetPaletteControls() m_PaletteBlurSpin->SetValueStealth(0); m_PaletteFrequencySpin->SetValueStealth(1); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumParams.cpp b/Source/Fractorium/FractoriumParams.cpp index aaf0c65..2e988f7 100644 --- a/Source/Fractorium/FractoriumParams.cpp +++ b/Source/Fractorium/FractoriumParams.cpp @@ -523,7 +523,7 @@ void FractoriumEmberController::FillParamTablesAndPalette() m_Fractorium->m_HighlightSpin->SetValueStealth(m_Ember.m_HighlightPower); m_Fractorium->m_ColorDialog->setCurrentColor(QColor(m_Ember.m_Background.r * 255, m_Ember.m_Background.g * 255, m_Ember.m_Background.b * 255)); m_Fractorium->ui.ColorTable->item(5, 1)->setBackgroundColor(m_Fractorium->m_ColorDialog->currentColor()); - m_Fractorium->m_PaletteModeCombo->SetCurrentIndexStealth((int)m_Ember.m_PaletteMode); + m_Fractorium->m_PaletteModeCombo->SetCurrentIndexStealth(int(m_Ember.m_PaletteMode)); m_Fractorium->m_WidthSpin->SetValueStealth(m_Ember.m_FinalRasW);//Geometry. m_Fractorium->m_HeightSpin->SetValueStealth(m_Ember.m_FinalRasH); m_Fractorium->m_CenterXSpin->SetValueStealth(m_Ember.m_CenterX); @@ -537,9 +537,9 @@ void FractoriumEmberController::FillParamTablesAndPalette() m_Fractorium->m_YawSpin->SetValueStealth(m_Ember.m_CamYaw * RAD_2_DEG_T); m_Fractorium->m_DepthBlurSpin->SetValueStealth(m_Ember.m_CamDepthBlur); m_Fractorium->m_SpatialFilterWidthSpin->SetValueStealth(m_Ember.m_SpatialFilterRadius);//Filter. - m_Fractorium->m_SpatialFilterTypeCombo->SetCurrentIndexStealth((int)m_Ember.m_SpatialFilterType); + m_Fractorium->m_SpatialFilterTypeCombo->SetCurrentIndexStealth(int(m_Ember.m_SpatialFilterType)); m_Fractorium->m_TemporalFilterWidthSpin->SetValueStealth(m_Ember.m_TemporalFilterWidth); - m_Fractorium->m_TemporalFilterTypeCombo->SetCurrentIndexStealth((int)m_Ember.m_TemporalFilterType); + m_Fractorium->m_TemporalFilterTypeCombo->SetCurrentIndexStealth(int(m_Ember.m_TemporalFilterType)); m_Fractorium->m_DEFilterMinRadiusSpin->SetValueStealth(m_Ember.m_MinRadDE); m_Fractorium->m_DEFilterMaxRadiusSpin->SetValueStealth(m_Ember.m_MaxRadDE); m_Fractorium->m_DECurveSpin->SetValueStealth(m_Ember.m_CurveDE); @@ -587,7 +587,7 @@ void FractoriumEmberController::ParamsToEmber(Ember& ember) ember.m_Background.r = color.red() / 255.0; ember.m_Background.g = color.green() / 255.0; ember.m_Background.b = color.blue() / 255.0; - ember.m_PaletteMode = (ePaletteMode)m_Fractorium->m_PaletteModeCombo->currentIndex(); + ember.m_PaletteMode = ePaletteMode(m_Fractorium->m_PaletteModeCombo->currentIndex()); ember.m_FinalRasW = m_Fractorium->m_WidthSpin->value();//Geometry. ember.m_FinalRasH = m_Fractorium->m_HeightSpin->value(); ember.m_CenterX = m_Fractorium->m_CenterXSpin->value(); @@ -601,9 +601,9 @@ void FractoriumEmberController::ParamsToEmber(Ember& ember) ember.m_CamYaw = m_Fractorium->m_YawSpin->value() * DEG_2_RAD_T; ember.m_CamDepthBlur = m_Fractorium->m_DepthBlurSpin->value(); ember.m_SpatialFilterRadius = m_Fractorium->m_SpatialFilterWidthSpin->value();//Filter. - ember.m_SpatialFilterType = (eSpatialFilterType)m_Fractorium->m_SpatialFilterTypeCombo->currentIndex(); + ember.m_SpatialFilterType = eSpatialFilterType(m_Fractorium->m_SpatialFilterTypeCombo->currentIndex()); ember.m_TemporalFilterWidth = m_Fractorium->m_TemporalFilterWidthSpin->value(); - ember.m_TemporalFilterType = (eTemporalFilterType)m_Fractorium->m_TemporalFilterTypeCombo->currentIndex(); + ember.m_TemporalFilterType = eTemporalFilterType(m_Fractorium->m_TemporalFilterTypeCombo->currentIndex()); ember.m_MinRadDE = m_Fractorium->m_DEFilterMinRadiusSpin->value(); ember.m_MaxRadDE = m_Fractorium->m_DEFilterMaxRadiusSpin->value(); ember.m_CurveDE = m_Fractorium->m_DECurveSpin->value(); @@ -612,8 +612,8 @@ void FractoriumEmberController::ParamsToEmber(Ember& ember) ember.m_Quality = m_Fractorium->m_QualitySpin->value(); ember.m_Supersample = m_Fractorium->m_SupersampleSpin->value(); ember.m_TemporalSamples = m_Fractorium->m_TemporalSamplesSpin->value(); - ember.m_AffineInterp = (eAffineInterp)m_Fractorium->m_AffineInterpTypeCombo->currentIndex(); - ember.m_Interp = (eInterp)m_Fractorium->m_InterpTypeCombo->currentIndex(); + ember.m_AffineInterp = eAffineInterp(m_Fractorium->m_AffineInterpTypeCombo->currentIndex()); + ember.m_Interp = eInterp(m_Fractorium->m_InterpTypeCombo->currentIndex()); ember.SyncSize(); } @@ -644,3 +644,9 @@ void Fractorium::SetScale(double scale) { m_ScaleSpin->setValue(scale); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumPch.h b/Source/Fractorium/FractoriumPch.h index 25747b4..d250744 100644 --- a/Source/Fractorium/FractoriumPch.h +++ b/Source/Fractorium/FractoriumPch.h @@ -1,18 +1,6 @@ -#pragma once - #define GL_GLEXT_PROTOTYPES #define GLM_FORCE_INLINE 1 -#include "Renderer.h" -#include "RendererCL.h" -#include "VariationList.h" -#include "OpenCLWrapper.h" -#include "XmlToEmber.h" -#include "EmberToXml.h" -#include "SheepTools.h" -#include "JpegUtils.h" -#include "EmberCommon.h" -#include #undef QT_OPENGL_ES_2//Make absolutely sure OpenGL ES is not used. #define QT_NO_OPENGL_ES_2 #include @@ -29,11 +17,23 @@ #include #include #include -#include +//#include +#include #include #include #include +#include "Renderer.h" +#include "RendererCL.h" +#include "VariationList.h" +#include "OpenCLWrapper.h" +#include "XmlToEmber.h" +#include "EmberToXml.h" +#include "SheepTools.h" +#include "JpegUtils.h" +#include "EmberCommon.h" +#include + #define GLM_FORCE_RADIANS #include "glm/glm.hpp" @@ -42,6 +42,10 @@ #define XFORM_COLOR_COUNT 14 +#ifndef WIN32 + #undef Bool +#endif + using namespace std; using namespace EmberNs; -using namespace EmberCLns; \ No newline at end of file +using namespace EmberCLns; diff --git a/Source/Fractorium/FractoriumRender.cpp b/Source/Fractorium/FractoriumRender.cpp index f4c3e74..90a6fdc 100644 --- a/Source/Fractorium/FractoriumRender.cpp +++ b/Source/Fractorium/FractoriumRender.cpp @@ -224,7 +224,7 @@ int FractoriumEmberController::ProgressFunc(Ember& ember, void* foo, doubl { QString status; - m_Fractorium->m_ProgressBar->setValue((int)fraction);//Only really applies to iter and filter, because final accum only gives progress 0 and 100. + m_Fractorium->m_ProgressBar->setValue(int(fraction));//Only really applies to iter and filter, because final accum only gives progress 0 and 100. if (stage == 0) status = "Iterating"; @@ -275,7 +275,7 @@ bool FractoriumEmberController::SyncSizes() gl->Allocate(); gl->SetViewport(); - if (m_Renderer->RendererType() == OPENCL_RENDERER && (rendererCL = (RendererCL*)m_Renderer.get())) + if (m_Renderer->RendererType() == OPENCL_RENDERER && (rendererCL = dynamic_cast*>(m_Renderer.get()))) rendererCL->SetOutputTexture(gl->OutputTexID()); changed = true; @@ -300,7 +300,7 @@ bool FractoriumEmberController::Render() eProcessAction action = CondenseAndClearProcessActions(); if (m_Renderer->RendererType() == OPENCL_RENDERER) - rendererCL = (RendererCL*)m_Renderer.get(); + rendererCL = dynamic_cast*>(m_Renderer.get()); //Force temporal samples to always be 1. Perhaps change later when animation is implemented. m_Ember.m_TemporalSamples = 1; @@ -378,8 +378,8 @@ bool FractoriumEmberController::Render() if (ProcessState() == ACCUM_DONE) { EmberStats stats = m_Renderer->Stats(); - QString iters = ToString(stats.m_Iters); - QString scaledQuality = ToString((uint)m_Renderer->ScaledQuality()); + QString iters = ToString(stats.m_Iters); + QString scaledQuality = ToString(uint(m_Renderer->ScaledQuality())); string renderTime = m_RenderElapsedTimer.Format(m_RenderElapsedTimer.Toc()); m_Fractorium->m_ProgressBar->setValue(100); @@ -391,8 +391,8 @@ bool FractoriumEmberController::Render() } else { - double percent = (double)stats.m_Badvals / (double)stats.m_Iters; - QString badVals = ToString(stats.m_Badvals); + double percent = double(stats.m_Badvals) / double(stats.m_Iters); + QString badVals = ToString(stats.m_Badvals); QString badPercent = QLocale::system().toString(percent * 100, 'f', 2); m_Fractorium->m_RenderStatusLabel->setText("Iters: " + iters + ". Scaled quality: " + scaledQuality + ". Bad values: " + badVals + " (" + badPercent + "%). Total time: " + QString::fromStdString(renderTime)); @@ -609,13 +609,13 @@ bool Fractorium::CreateControllerFromOptions() { bool ok = true; - size_t size = + size_t elementSize = #ifdef DO_DOUBLE m_Settings->Double() ? sizeof(double) : #endif sizeof(float); - if (!m_Controller.get() || (m_Controller->SizeOfT() != size)) + if (!m_Controller.get() || (m_Controller->SizeOfT() != elementSize)) { double hue = m_PaletteHueSpin->value(); double sat = m_PaletteSaturationSpin->value(); @@ -703,3 +703,9 @@ void Fractorium::IdleTimer() { m_Controller->Render(); } /// /// True if the ember controller and GL controllers are both not NULL, else false. bool Fractorium::ControllersOk() { return m_Controller.get() && m_Controller->GLController(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumSettings.cpp b/Source/Fractorium/FractoriumSettings.cpp index 28bcd15..769124f 100644 --- a/Source/Fractorium/FractoriumSettings.cpp +++ b/Source/Fractorium/FractoriumSettings.cpp @@ -5,9 +5,9 @@ /// Constructor that passes the parent to the base and sets up reasonable defaults /// if the settings file was not present or corrupted. /// -/// The parent widget -FractoriumSettings::FractoriumSettings(QObject* parent) - : QSettings(QSettings::IniFormat, QSettings::UserScope, "Fractorium", "Fractorium", parent) +/// The parent widget +FractoriumSettings::FractoriumSettings(QObject* p) + : QSettings(QSettings::IniFormat, QSettings::UserScope, "Fractorium", "Fractorium", p) { EnsureDefaults(); } @@ -39,7 +39,7 @@ void FractoriumSettings::EnsureDefaults() XmlSupersample(2); if (ThreadCount() == 0 || ThreadCount() > Timing::ProcessorCount()) - ThreadCount(max(1, Timing::ProcessorCount() - 1));//Default to one less to keep the UI responsive for first time users. + ThreadCount(max(1u, Timing::ProcessorCount() - 1));//Default to one less to keep the UI responsive for first time users. if (FinalThreadCount() == 0 || FinalThreadCount() > Timing::ProcessorCount()) FinalThreadCount(Timing::ProcessorCount()); diff --git a/Source/Fractorium/FractoriumSettings.h b/Source/Fractorium/FractoriumSettings.h index 07b08d2..4d276a8 100644 --- a/Source/Fractorium/FractoriumSettings.h +++ b/Source/Fractorium/FractoriumSettings.h @@ -66,7 +66,7 @@ class FractoriumSettings : public QSettings { Q_OBJECT public: - FractoriumSettings(QObject* parent); + FractoriumSettings(QObject* p); void EnsureDefaults(); bool EarlyClip(); diff --git a/Source/Fractorium/FractoriumXforms.cpp b/Source/Fractorium/FractoriumXforms.cpp index 535b604..1f04e5e 100644 --- a/Source/Fractorium/FractoriumXforms.cpp +++ b/Source/Fractorium/FractoriumXforms.cpp @@ -48,7 +48,7 @@ Xform* FractoriumEmberController::CurrentXform() /// The index to set the current xform to void Fractorium::CurrentXform(uint i) { - if (i < ui.CurrentXformCombo->count()) + if (i < uint(ui.CurrentXformCombo->count())) ui.CurrentXformCombo->setCurrentIndex(i); } @@ -305,7 +305,7 @@ void FractoriumEmberController::SetNormalizedWeightText(Xform* xform) m_Ember.CalcNormalizedWeights(m_NormalizedWeights); if (index != -1 && index < m_NormalizedWeights.size()) - m_Fractorium->m_XformWeightSpin->setSuffix(QString(" (") + QLocale::system().toString((double)m_NormalizedWeights[index], 'g', 3) + ")"); + m_Fractorium->m_XformWeightSpin->setSuffix(QString(" (") + QLocale::system().toString(double(m_NormalizedWeights[index]), 'g', 3) + ")"); } } @@ -332,7 +332,7 @@ void Fractorium::FillXforms() combo->blockSignals(true); combo->clear(); - for (i = 0; i < m_Controller->XformCount(); i++) + for (i = 0; i < int(m_Controller->XformCount()); i++) { combo->addItem(ToString(i + 1)); combo->setItemIcon(i, m_XformComboIcons[i % XFORM_COLOR_COUNT]); @@ -350,3 +350,9 @@ void Fractorium::FillXforms() OnSoloXformCheckBoxStateChanged(Qt::Unchecked); OnCurrentXformComboChanged(0);//Make sure the event gets called, because it won't if the zero index is already selected. } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumXformsAffine.cpp b/Source/Fractorium/FractoriumXformsAffine.cpp index 77defc7..5607f7b 100644 --- a/Source/Fractorium/FractoriumXformsAffine.cpp +++ b/Source/Fractorium/FractoriumXformsAffine.cpp @@ -509,4 +509,10 @@ void Fractorium::SetupAffineSpinner(QTableWidget* table, const QObject* receiver bool Fractorium::DrawAllPre() { return ui.ShowPreAffineAllRadio->isChecked(); } bool Fractorium::DrawAllPost() { return ui.ShowPostAffineAllRadio->isChecked(); } -bool Fractorium::LocalPivot() { return ui.LocalPivotRadio->isChecked(); } \ No newline at end of file +bool Fractorium::LocalPivot() { return ui.LocalPivotRadio->isChecked(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumXformsColor.cpp b/Source/Fractorium/FractoriumXformsColor.cpp index 915af6f..fb07581 100644 --- a/Source/Fractorium/FractoriumXformsColor.cpp +++ b/Source/Fractorium/FractoriumXformsColor.cpp @@ -68,7 +68,7 @@ void FractoriumEmberController::XformScrollColorIndexChanged(int d) { UpdateCurrentXform([&] (Xform* xform) { - m_Fractorium->m_XformColorIndexSpin->setValue(d / (double)m_Fractorium->ui.XformColorScroll->maximum());//Will trigger an update. + m_Fractorium->m_XformColorIndexSpin->setValue(d / double(m_Fractorium->ui.XformColorScroll->maximum()));//Will trigger an update. }, false); } @@ -163,7 +163,7 @@ void FractoriumEmberController::SetCurrentXformColorIndex(double d) entry.g *= 255; entry.b *= 255; - QRgb rgb = (uint)entry.r << 16 | (uint)entry.g << 8 | (uint)entry.b; + QRgb rgb = uint(entry.r) << 16 | uint(entry.g) << 8 | uint(entry.b); m_Fractorium->ui.XformColorIndexTable->item(0, 0)->setBackgroundColor(QColor::fromRgb(rgb)); }, false); } @@ -202,3 +202,9 @@ void FractoriumEmberControllerBase::SetPaletteRefTable(QPixmap* pixmap) m_Fractorium->m_PaletteRefItem->setData(Qt::DecorationRole, pixTemp.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); } } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumXformsVariations.cpp b/Source/Fractorium/FractoriumXformsVariations.cpp index a1824c3..018b928 100644 --- a/Source/Fractorium/FractoriumXformsVariations.cpp +++ b/Source/Fractorium/FractoriumXformsVariations.cpp @@ -115,7 +115,7 @@ void FractoriumEmberController::ClearVariationsTree() for (uint j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params. { - if (spinBox = dynamic_cast*>(tree->itemWidget(item->child(j), 1)))//Cast the child widget to the VariationTreeDoubleSpinBox type. + if ((spinBox = dynamic_cast*>(tree->itemWidget(item->child(j), 1))))//Cast the child widget to the VariationTreeDoubleSpinBox type. spinBox->SetValueStealth(0); } } @@ -247,12 +247,12 @@ void FractoriumEmberController::FillVariationTreeWithXform(Xform* xform) if (parVar) { - if (param = parVar->GetParam(s.c_str()))//Retrieve pointer to the param. + if ((param = parVar->GetParam(s.c_str())))//Retrieve pointer to the param. childSpinBox->SetValueStealth(*param); } else if (origParVar)//Parametric variation was not present in this xform, so set child values to defaults. { - if (param = origParVar->GetParam(s.c_str())) + if ((param = origParVar->GetParam(s.c_str()))) childSpinBox->SetValueStealth(*param); else childSpinBox->SetValueStealth(0);//Will most likely never happen, but just to be safe. @@ -293,7 +293,7 @@ void Fractorium::OnVariationsFilterLineEditTextChanged(const QString& text) tree->setUpdatesEnabled(false); - for (uint i = 0; i < tree->topLevelItemCount(); i++) + for (uint i = 0; i < uint(tree->topLevelItemCount()); i++) { QTreeWidgetItem* item = tree->topLevelItem(i); QString varName = item->text(0); @@ -314,3 +314,9 @@ void Fractorium::OnVariationsFilterClearButtonClicked(bool checked) { ui.VariationsFilterLineEdit->clear(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/FractoriumXformsXaos.cpp b/Source/Fractorium/FractoriumXformsXaos.cpp index e530b20..f0d07df 100644 --- a/Source/Fractorium/FractoriumXformsXaos.cpp +++ b/Source/Fractorium/FractoriumXformsXaos.cpp @@ -29,7 +29,7 @@ void FractoriumEmberController::FillXaosWithCurrentXform() if (m_Fractorium->ui.XaosToRadio->isChecked())//"To": Single xform, advance index. spinBox->SetValueStealth(currXform->Xaos(i)); else//"From": Advance xforms, single index. - if (currXform = m_Ember.GetXform(i)) + if ((currXform = m_Ember.GetXform(i))) spinBox->SetValueStealth(currXform->Xaos(m_Fractorium->ui.CurrentXformCombo->currentIndex())); //Fill in name column. @@ -57,15 +57,15 @@ QString FractoriumEmberController::MakeXaosNameString(uint i) if (xform) { - int i = m_Ember.GetXformIndex(xform) + 1;//GUI is 1 indexed to avoid confusing the user. + int indexPlus1 = m_Ember.GetXformIndex(xform) + 1;//GUI is 1 indexed to avoid confusing the user. int curr = m_Fractorium->ui.CurrentXformCombo->currentIndex() + 1; - if (i != -1) + if (indexPlus1 != -1) { if (m_Fractorium->ui.XaosToRadio->isChecked()) - name = QString("From ") + ToString(curr) + QString(" To ") + ToString(i); + name = QString("From ") + ToString(curr) + QString(" To ") + ToString(indexPlus1); else - name = QString("From ") + ToString(i) + QString(" To ") + ToString(curr); + name = QString("From ") + ToString(indexPlus1) + QString(" To ") + ToString(curr); //if (xform->m_Name != "") // name = name + " (" + QString::fromStdString(xform->m_Name) + ")"; @@ -103,7 +103,7 @@ void FractoriumEmberController::XaosChanged(DoubleSpinBox* sender) } else//"From": Advance xforms, single index. { - if (xform = m_Ember.GetXform(i))//Single = is intentional. + if ((xform = m_Ember.GetXform(i)))//Single = is intentional. xform->SetXaos(m_Fractorium->ui.CurrentXformCombo->currentIndex(), spinBox->value()); } @@ -137,10 +137,10 @@ void Fractorium::OnXaosFromToToggled(bool checked) void Fractorium::FillXaosTable() { int spinHeight = 20; - QWidget* w; + QWidget* w = nullptr; ui.XaosTable->setRowCount(m_Controller->XformCount());//This will grow or shrink the number of rows and call the destructor for previous DoubleSpinBoxes. - for (int i = 0; i < m_Controller->XformCount(); i++) + for (int i = 0; i < int(m_Controller->XformCount()); i++) { DoubleSpinBox* spinBox = new DoubleSpinBox(ui.XaosTable, spinHeight, 0.1); QTableWidgetItem* xformNameItem = new QTableWidgetItem(m_Controller->MakeXaosNameString(i)); @@ -199,14 +199,14 @@ void FractoriumEmberController::RandomXaos() { for (size_t i = 0; i < m_Ember.XformCount(); i++) { - if (Xform* xform = m_Ember.GetXform(i)) + if (Xform* localXform = m_Ember.GetXform(i)) { for (size_t j = 0; j < m_Ember.XformCount(); j++) { if (m_Rand.RandBit()) - xform->SetXaos(j, (T)m_Rand.RandBit()); + localXform->SetXaos(j, T(m_Rand.RandBit())); else - xform->SetXaos(j, m_Rand.Frand(0, 3)); + localXform->SetXaos(j, m_Rand.Frand(0, 3)); } } } @@ -216,4 +216,10 @@ void FractoriumEmberController::RandomXaos() FillXaosWithCurrentXform(); } -void Fractorium::OnRandomXaosButtonClicked(bool checked) { m_Controller->RandomXaos(); } \ No newline at end of file +void Fractorium::OnRandomXaosButtonClicked(bool checked) { m_Controller->RandomXaos(); } + +template class FractoriumEmberController; + +#ifdef DO_DOUBLE + template class FractoriumEmberController; +#endif diff --git a/Source/Fractorium/GLEmberController.cpp b/Source/Fractorium/GLEmberController.cpp index 90d8f75..dda71ca 100644 --- a/Source/Fractorium/GLEmberController.cpp +++ b/Source/Fractorium/GLEmberController.cpp @@ -72,7 +72,7 @@ T GLEmberController::CalcScale() { //Can't operate using world coords here because every time scale changes, the world bounds change. //So must instead calculate distance traveled based on window coords, which do not change outside of resize events. - v2T windowCenter((T)m_GL->width() / T(2), (T)m_GL->height() / T(2)); + v2T windowCenter(T(m_GL->width()) / T(2), T(m_GL->height()) / T(2)); v2T windowMousePosDistanceFromCenter(m_MousePos.x - windowCenter.x, m_MousePos.y - windowCenter.y); v2T windowMouseDownDistanceFromCenter(m_MouseDownPos.x - windowCenter.x, m_MouseDownPos.y - windowCenter.y); @@ -130,7 +130,7 @@ typename v3T GLEmberController::SnapToNormalizedAngle(v3T& vec, uint division for (uint i = 0; i < divisions; i++) { - theta = 2.0 * M_PI * (T)i / (T)divisions; + theta = 2.0 * M_PI * T(i) / T(divisions); c.x = cos(theta); c.y = sin(theta); rsq = glm::distance(vec, c); @@ -251,4 +251,10 @@ void GLEmberController::QueryMatrices(bool print) qDebug() << "Projection[" << i << "] = " << glm::value_ptr(m_Projection)[i] << endl; } } -} \ No newline at end of file +} + +template class GLEmberController; + +#ifdef DO_DOUBLE + template class GLEmberController; +#endif diff --git a/Source/Fractorium/GLEmberController.h b/Source/Fractorium/GLEmberController.h index 6f8f7b5..87534f2 100644 --- a/Source/Fractorium/GLEmberController.h +++ b/Source/Fractorium/GLEmberController.h @@ -54,8 +54,8 @@ public: virtual void DrawImage() { } virtual void DrawAffines(bool pre, bool post) { } virtual void ClearWindow() { } - virtual bool KeyPress(QKeyEvent* e); - virtual bool KeyRelease(QKeyEvent* e); + virtual bool KeyPress_(QKeyEvent* e); + virtual bool KeyRelease_(QKeyEvent* e); virtual void MousePress(QMouseEvent* e) { } virtual void MouseRelease(QMouseEvent* e) { } virtual void MouseMove(QMouseEvent* e) { } @@ -139,8 +139,3 @@ private: T GridStep; }; -template class GLEmberController; - -#ifdef DO_DOUBLE - template class GLEmberController; -#endif \ No newline at end of file diff --git a/Source/Fractorium/GLWidget.cpp b/Source/Fractorium/GLWidget.cpp index 8b6bbd5..7fbecdc 100644 --- a/Source/Fractorium/GLWidget.cpp +++ b/Source/Fractorium/GLWidget.cpp @@ -8,9 +8,9 @@ /// Constructor which passes parent widget to the base and initializes OpenGL profile. /// This will need to change in the future to implement all drawing as shader programs. /// -/// The parent widget -GLWidget::GLWidget(QWidget* parent) - : QGLWidget(QGLFormat(QGL::SampleBuffers), parent) +/// The parent widget +GLWidget::GLWidget(QWidget* p) + : QGLWidget(QGLFormat(QGL::SampleBuffers), p) { QGLFormat qglFormat; @@ -59,7 +59,7 @@ void GLWidget::DrawQuad() glBindTexture(GL_TEXTURE_2D, m_OutputTexID);//The texture to draw to. //Only draw if the dimensions match exactly. - if (m_TexWidth == width() && m_TexHeight == height() && ((m_TexWidth * m_TexHeight * 4) == finalImage->size())) + if (m_TexWidth == width() && m_TexHeight == height() && ((m_TexWidth * m_TexHeight * 4) == GLint(finalImage->size()))) { glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -363,7 +363,7 @@ void GLEmberController::DrawAffines(bool pre, bool post) /// Set drag modifiers based on key press. /// /// The event -bool GLEmberControllerBase::KeyPress(QKeyEvent* e) +bool GLEmberControllerBase::KeyPress_(QKeyEvent* e) { #ifdef OLDDRAG if (e->key() == Qt::Key_Shift) @@ -388,12 +388,12 @@ bool GLEmberControllerBase::KeyPress(QKeyEvent* e) } /// -/// Call controller KeyPress(). +/// Call controller KeyPress_(). /// /// The event void GLWidget::keyPressEvent(QKeyEvent* e) { - if (!GLController() || !GLController()->KeyPress(e)) + if (!GLController() || !GLController()->KeyPress_(e)) QGLWidget::keyPressEvent(e); update(); @@ -403,7 +403,7 @@ void GLWidget::keyPressEvent(QKeyEvent* e) /// Set drag modifiers based on key release. /// /// The event -bool GLEmberControllerBase::KeyRelease(QKeyEvent* e) +bool GLEmberControllerBase::KeyRelease_(QKeyEvent* e) { #ifdef OLDDRAG if (e->key() == Qt::Key_Shift) @@ -428,12 +428,12 @@ bool GLEmberControllerBase::KeyRelease(QKeyEvent* e) } /// -/// Call controller KeyRelease(). +/// Call controller KeyRelease_(). /// /// The event void GLWidget::keyReleaseEvent(QKeyEvent* e) { - if (!GLController() || !GLController()->KeyRelease(e)) + if (!GLController() || !GLController()->KeyRelease_(e)) QGLWidget::keyReleaseEvent(e); update(); @@ -598,7 +598,7 @@ void GLEmberController::MouseMove(QMouseEvent* e) m_MousePos = mouse; m_MouseWorldPos = WindowToWorld(mouseFlipped, false); - v3T mouseDelta = m_MouseWorldPos - m_MouseDownWorldPos;//Determine how far the mouse has moved in world cartesian coordinates. + //v3T mouseDelta = m_MouseWorldPos - m_MouseDownWorldPos;//Determine how far the mouse has moved in world cartesian coordinates. //Update status bar on main window, regardless of whether anything is being dragged. if (m_Fractorium->m_Controller->RenderTimerRunning()) @@ -752,8 +752,8 @@ void GLWidget::SetDimensions(int w, int h) bool GLWidget::Allocate(bool force) { bool alloc = false; - bool resize = force || m_TexWidth != width() || m_TexHeight != height(); - bool doIt = resize || m_OutputTexID == 0; + bool doResize = force || m_TexWidth != width() || m_TexHeight != height(); + bool doIt = doResize || m_OutputTexID == 0; if (doIt) { @@ -762,7 +762,7 @@ bool GLWidget::Allocate(bool force) glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - if (resize) + if (doResize) { glBindTexture(GL_TEXTURE_2D, m_OutputTexID); Deallocate(); @@ -814,7 +814,7 @@ void GLWidget::SetViewport() { if (m_Init && (m_ViewWidth != m_TexWidth || m_ViewHeight != m_TexHeight)) { - glViewport(0, 0, (GLint)m_TexWidth, (GLint)m_TexHeight); + glViewport(0, 0, GLint(m_TexWidth), GLint(m_TexHeight)); m_ViewWidth = m_TexWidth; m_ViewHeight = m_TexHeight; } @@ -863,16 +863,16 @@ void GLWidget::DrawGrid() { glColor4f(0.5f, 0.5f, 0.5f, 0.5f); - for (float x = xLow; x <= xHigh; x += GridStep) + for (float fx = xLow; fx <= xHigh; fx += GridStep) { - glVertex2f(x, yLow); - glVertex2f(x, yHigh); + glVertex2f(fx, yLow); + glVertex2f(fx, yHigh); } - for (float y = yLow; y < yHigh; y += GridStep) + for (float fy = yLow; fy < yHigh; fy += GridStep) { - glVertex2f(xLow, y); - glVertex2f(xHigh, y); + glVertex2f(xLow, fy); + glVertex2f(xHigh, fy); } } @@ -880,16 +880,16 @@ void GLWidget::DrawGrid() { glColor4f(0.5f, 0.5f, 0.5f, 1.0f); - for (float x = xLow; x <= xHigh; x += 1.0f) + for (float fx = xLow; fx <= xHigh; fx += 1.0f) { - glVertex2f(x, yLow); - glVertex2f(x, yHigh); + glVertex2f(fx, yLow); + glVertex2f(fx, yHigh); } - for (float y = yLow; y < yHigh; y += 1.0f) + for (float fy = yLow; fy < yHigh; fy += 1.0f) { - glVertex2f(xLow, y); - glVertex2f(xHigh, y); + glVertex2f(xLow, fy); + glVertex2f(xHigh, fy); } } @@ -1023,14 +1023,14 @@ void GLWidget::DrawAffineHelper(int index, bool selected, bool pre, bool final, { for (int i = 1; i <= 64; i++)//The circle. { - float theta = (float)M_PI * 2.0f * (float)(i % 64) / 64.0f; - float x = (float)cos(theta); - float y = (float)sin(theta); + float theta = float(M_PI) * 2.0f * float(i % 64) / 64.0f; + float fx = float(cos(theta)); + float fy = float(sin(theta)); glVertex2f(px, py); - glVertex2f(x, y); - px = x; - py = y; + glVertex2f(fx, fy); + px = fx; + py = fy; } } @@ -1445,3 +1445,9 @@ GLEmberControllerBase* GLWidget::GLController() return NULL; } + +template class GLEmberController; + +#ifdef DO_DOUBLE + template class GLEmberController; +#endif diff --git a/Source/Fractorium/GLWidget.h b/Source/Fractorium/GLWidget.h index ee63a08..bab7195 100644 --- a/Source/Fractorium/GLWidget.h +++ b/Source/Fractorium/GLWidget.h @@ -7,6 +7,9 @@ /// class Fractorium;//Forward declaration since Fractorium uses this widget. +class GLEmberControllerBase; +template class GLEmberController; +template class FractoriumEmberController; static const float GridStep = 1.0f / 8.0f; @@ -31,13 +34,16 @@ class GLWidget : public QGLWidget, protected QOpenGLFunctions_2_0//QOpenGLFuncti friend Fractorium; friend FractoriumEmberController; - friend FractoriumEmberController; friend GLEmberControllerBase; friend GLEmberController; + +#ifdef DO_DOUBLE friend GLEmberController; - + friend FractoriumEmberController; +#endif + public: - GLWidget(QWidget* parent); + GLWidget(QWidget* p); ~GLWidget(); void DrawQuad(); void SetMainWindow(Fractorium* f); diff --git a/Source/Fractorium/Main.cpp b/Source/Fractorium/Main.cpp index c8f32cb..2adfca5 100644 --- a/Source/Fractorium/Main.cpp +++ b/Source/Fractorium/Main.cpp @@ -24,8 +24,13 @@ int main(int argc, char *argv[]) //Required for large allocs, else GPU memory usage will be severely limited to small sizes. //This must be done in the application and not in the EmberCL DLL. +#ifdef WIN32 _putenv_s("GPU_MAX_ALLOC_PERCENT", "100"); +#else + putenv(const_cast("GPU_MAX_ALLOC_PERCENT=100")); +#endif Fractorium w; w.show(); return a.exec(); } + diff --git a/Source/Fractorium/OptionsDialog.cpp b/Source/Fractorium/OptionsDialog.cpp index f46b027..d423fe9 100644 --- a/Source/Fractorium/OptionsDialog.cpp +++ b/Source/Fractorium/OptionsDialog.cpp @@ -6,10 +6,10 @@ /// Constructor that takes a pointer to the settings object and the parent widget. /// /// A pointer to the settings object to use -/// The parent widget. Default: NULL. +/// The parent widget. Default: NULL. /// The window flags. Default: 0. -FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, QWidget* parent, Qt::WindowFlags f) - : QDialog(parent, f) +FractoriumOptionsDialog::FractoriumOptionsDialog(FractoriumSettings* settings, QWidget* p, Qt::WindowFlags f) + : QDialog(p, f) { int row = 0, spinHeight = 20; uint i; @@ -203,4 +203,4 @@ void FractoriumOptionsDialog::reject() m_NickEdit->setText(m_Settings->Nick()); QDialog::reject(); -} \ No newline at end of file +} diff --git a/Source/Fractorium/OptionsDialog.h b/Source/Fractorium/OptionsDialog.h index ceea506..1badfe8 100644 --- a/Source/Fractorium/OptionsDialog.h +++ b/Source/Fractorium/OptionsDialog.h @@ -24,7 +24,7 @@ class FractoriumOptionsDialog : public QDialog friend Fractorium; public: - FractoriumOptionsDialog(FractoriumSettings* settings, QWidget* parent = 0, Qt::WindowFlags f = 0); + FractoriumOptionsDialog(FractoriumSettings* settings, QWidget* p = 0, Qt::WindowFlags f = 0); public slots: void OnOpenCLCheckBoxStateChanged(int state); diff --git a/Source/Fractorium/SpinBox.cpp b/Source/Fractorium/SpinBox.cpp index 6e4177a..6e8ca10 100644 --- a/Source/Fractorium/SpinBox.cpp +++ b/Source/Fractorium/SpinBox.cpp @@ -7,11 +7,11 @@ /// and change its value using the mouse wheel without explicitly having to click /// inside of it. /// -/// The parent widget. Default: NULL. -/// The height of the spin box. Default: 16. +/// The parent widget. Default: NULL. +/// The height of the spin box. Default: 16. /// The step used to increment/decrement the spin box when using the mouse wheel. Default: 1. -SpinBox::SpinBox(QWidget* parent, int height, int step) - : QSpinBox(parent) +SpinBox::SpinBox(QWidget* p, int h, int step) + : QSpinBox(p) { m_Select = false; m_DoubleClick = false; @@ -23,8 +23,8 @@ SpinBox::SpinBox(QWidget* parent, int height, int step) setFrame(false); setButtonSymbols(QAbstractSpinBox::NoButtons); setFocusPolicy(Qt::StrongFocus); - setMinimumHeight(height);//setGeometry() has no effect, so set both of these instead. - setMaximumHeight(height); + setMinimumHeight(h);//setGeometry() has no effect, so set both of these instead. + setMaximumHeight(h); lineEdit()->installEventFilter(this); lineEdit()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); connect(this, SIGNAL(valueChanged(int)), this, SLOT(onSpinBoxValueChanged(int)), Qt::QueuedConnection); @@ -141,9 +141,9 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e) { //Take special action for shift to reduce the scroll amount. Control already //increases it automatically. - if (QWheelEvent* wheelEvent = dynamic_cast(e)) + if (QWheelEvent* wev = dynamic_cast(e)) { - Qt::KeyboardModifiers mod = wheelEvent->modifiers(); + Qt::KeyboardModifiers mod = wev->modifiers(); if (mod.testFlag(Qt::ShiftModifier)) setSingleStep(m_SmallStep); diff --git a/Source/Fractorium/SpinBox.h b/Source/Fractorium/SpinBox.h index 27087bb..ee6b146 100644 --- a/Source/Fractorium/SpinBox.h +++ b/Source/Fractorium/SpinBox.h @@ -16,7 +16,7 @@ class SpinBox : public QSpinBox Q_OBJECT public: - explicit SpinBox(QWidget* parent = 0, int height = 16, int step = 1); + explicit SpinBox(QWidget* p = 0, int height = 16, int step = 1); virtual ~SpinBox() { } void SetValueStealth(int d); void DoubleClick(bool b); diff --git a/Source/Fractorium/StealthComboBox.h b/Source/Fractorium/StealthComboBox.h index 1d25178..87123e2 100644 --- a/Source/Fractorium/StealthComboBox.h +++ b/Source/Fractorium/StealthComboBox.h @@ -15,13 +15,13 @@ class StealthComboBox : public QComboBox Q_OBJECT public: - explicit StealthComboBox(QWidget* parent = 0) : QComboBox(parent) { } + explicit StealthComboBox(QWidget* p = 0) : QComboBox(p) { } /// /// Set the current index of the combo box without triggering signals. /// /// The current index to set - void StealthComboBox::SetCurrentIndexStealth(int index) + void SetCurrentIndexStealth(int index) { blockSignals(true); setCurrentIndex(index); diff --git a/Source/Fractorium/TableWidget.h b/Source/Fractorium/TableWidget.h index 112eb4f..f0ae134 100644 --- a/Source/Fractorium/TableWidget.h +++ b/Source/Fractorium/TableWidget.h @@ -30,9 +30,9 @@ public: /// Constructor that passes the parent to the base and installs /// the event filter. /// - /// The parent widget - explicit TableWidget(QWidget* parent = 0) - : QTableWidget(parent) + /// The parent widget + explicit TableWidget(QWidget* p = 0) + : QTableWidget(p) { viewport()->installEventFilter(this); } @@ -54,4 +54,4 @@ protected: return QTableWidget::eventFilter(obj, e); } -}; \ No newline at end of file +}; diff --git a/Source/Fractorium/TwoButtonComboWidget.h b/Source/Fractorium/TwoButtonComboWidget.h index 75ae467..7537740 100644 --- a/Source/Fractorium/TwoButtonComboWidget.h +++ b/Source/Fractorium/TwoButtonComboWidget.h @@ -26,14 +26,14 @@ public: /// The width of the first button /// The width of the second button /// The height of both buttons - /// The parent widget - TwoButtonComboWidget(const QString& caption1, const QString& caption2, QStringList comboStrings, int w1, int w2, int h, QWidget* parent) - : QWidget(parent) + /// The parent widget + TwoButtonComboWidget(const QString& caption1, const QString& caption2, QStringList comboStrings, int w1, int w2, int h, QWidget* p) + : QWidget(p) { - QHBoxLayout* layout = new QHBoxLayout(this); - m_Button1 = new QPushButton(caption1, parent); - m_Button2 = new QPushButton(caption2, parent); - m_Combo = new QComboBox(parent); + QHBoxLayout* l = new QHBoxLayout(this); + m_Button1 = new QPushButton(caption1, p); + m_Button2 = new QPushButton(caption2, p); + m_Combo = new QComboBox(p); m_Combo->addItems(comboStrings); @@ -56,14 +56,14 @@ public: m_Combo->setMinimumHeight(h - 3); m_Combo->setMaximumHeight(h - 3); - layout->addWidget(m_Combo); - layout->addWidget(m_Button1); - layout->addWidget(m_Button2); - layout->setAlignment(Qt::AlignLeft); - layout->setMargin(0); - layout->setSpacing(2); + l->addWidget(m_Combo); + l->addWidget(m_Button1); + l->addWidget(m_Button2); + l->setAlignment(Qt::AlignLeft); + l->setMargin(0); + l->setSpacing(2); - setLayout(layout); + setLayout(l); } QPushButton* m_Button1; @@ -89,12 +89,12 @@ public: /// The caption of the button /// The width of the button /// The height of the button - /// The parent widget - SpinnerButtonWidget(DoubleSpinBox* spinBox, QString buttonCaption, int w, int h, QWidget* parent) - : QWidget(parent) + /// The parent widget + SpinnerButtonWidget(DoubleSpinBox* spinBox, QString buttonCaption, int w, int h, QWidget* p) + : QWidget(p) { - QHBoxLayout* layout = new QHBoxLayout(this); - m_Button = new QPushButton(buttonCaption, parent); + QHBoxLayout* l = new QHBoxLayout(this); + m_Button = new QPushButton(buttonCaption, p); m_SpinBox = spinBox; if (w != -1) @@ -106,13 +106,13 @@ public: m_Button->setMinimumHeight(h); m_Button->setMaximumHeight(h); - layout->addWidget(spinBox); - layout->addWidget(m_Button); - layout->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - layout->setMargin(0); - layout->setSpacing(0); + l->addWidget(spinBox); + l->addWidget(m_Button); + l->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + l->setMargin(0); + l->setSpacing(0); - setLayout(layout); + setLayout(l); } DoubleSpinBox* m_SpinBox; diff --git a/Source/Fractorium/TwoButtonWidget.cpp b/Source/Fractorium/TwoButtonWidget.cpp index f981c72..f5a4681 100644 --- a/Source/Fractorium/TwoButtonWidget.cpp +++ b/Source/Fractorium/TwoButtonWidget.cpp @@ -1,2 +1,2 @@ #include "FractoriumPch.h" -#include "TwoButtonWidget.h" +#include "TwoButtonComboWidget.h" diff --git a/Source/Fractorium/VariationTreeWidgetItem.h b/Source/Fractorium/VariationTreeWidgetItem.h index 7490854..370eb3f 100644 --- a/Source/Fractorium/VariationTreeWidgetItem.h +++ b/Source/Fractorium/VariationTreeWidgetItem.h @@ -22,9 +22,9 @@ public: /// and passes it to the base. /// /// The ID of the variation this widget will represent - /// The parent widget - VariationTreeWidgetItem(eVariationId id, QTreeWidget* parent = 0) - : QTreeWidgetItem(parent) + /// The parent widget + VariationTreeWidgetItem(eVariationId id, QTreeWidget* p = 0) + : QTreeWidgetItem(p) { m_Id = id; } @@ -35,9 +35,9 @@ public: /// This is used for making sub items for parametric variation parameters. /// /// The ID of the variation this widget will represent - /// The parent widget - VariationTreeWidgetItem(eVariationId id, QTreeWidgetItem* parent = 0) - : QTreeWidgetItem(parent) + /// The parent widget + VariationTreeWidgetItem(eVariationId id, QTreeWidgetItem* p = 0) + : QTreeWidgetItem(p) { m_Id = id; } @@ -61,11 +61,11 @@ private: QWidget* itemWidget1 = treeWidget()->itemWidget(const_cast*>(this), 1);//Get the widget for the second column. - if (spinBox1 = dynamic_cast*>(itemWidget1))//Cast the widget to the VariationTreeDoubleSpinBox type. + if ((spinBox1 = dynamic_cast*>(itemWidget1)))//Cast the widget to the VariationTreeDoubleSpinBox type. { QWidget* itemWidget2 = treeWidget()->itemWidget(const_cast(&other), 1);//Get the widget for the second column of the widget item passed in. - if (spinBox2 = dynamic_cast*>(itemWidget2))//Cast the widget to the VariationTreeDoubleSpinBox type. + if ((spinBox2 = dynamic_cast*>(itemWidget2)))//Cast the widget to the VariationTreeDoubleSpinBox type. { if (spinBox1->IsParam() || spinBox2->IsParam())//Do not sort params, their order will always remain the same. return false; @@ -93,4 +93,4 @@ private: } eVariationId m_Id; -}; \ No newline at end of file +};