2015-10-27 00:31:35 -04:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
**
|
|
|
|
** This file is part of the QtCore module of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Fractorium.h"
|
|
|
|
#include "FractoriumCommon.h"
|
|
|
|
#include "QssTextEdit.h"
|
|
|
|
#include "qcssparser.h"
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The code in this file did not originate in Fractorium.
|
|
|
|
/// It was taken either in whole or in part from the source code
|
|
|
|
/// of Qt Creator. Their license applies.
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class QssDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A dialog for editing the stylesheet used in the application.
|
|
|
|
/// This is meant to be used in the following way:
|
|
|
|
/// On first run, no stylesheet is present/selected, so a basic style
|
|
|
|
/// is used on startup. This style differs slightly between Windows and Linux. See BaseStyle() for details.
|
|
|
|
/// If the user clicks Save as default or ok to exit the dialog, the text of this stylesheet will
|
|
|
|
/// be saved to the application settings folder in the file default.qss.
|
|
|
|
/// On all subsequent runs, the main window will detect the presence of default.qss and load it.
|
|
|
|
/// The user can load a different stylesheet from disk, such as dark.qss which comes with the installation.
|
|
|
|
/// They can save this back to disk (under a different name because dark.qss is made read only by the installer),
|
|
|
|
/// however it will not become the default until they explicitly click the Save as default button or click ok.
|
|
|
|
/// The other buttons Basic, Medium and Advanced produce an empty style sheet that gives access to various controls.
|
|
|
|
/// Basic: Just the base style.
|
|
|
|
/// Medium: Basic + every type of control in the application.
|
|
|
|
/// Advanced: Medium + the name of every individual control in the application. It is not intended that the user fill
|
|
|
|
/// out a custom style for every single control. Rather, it's to make them aware of the names of the controls in the
|
|
|
|
/// event they want to set some custom styling for a specific control.
|
|
|
|
/// For all practical purposes, the user will probably start with dark.qss, edit what they need and save to a new stylesheet,
|
|
|
|
// then set that one as the default.
|
|
|
|
/// </summary>
|
|
|
|
class QssDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit QssDialog(Fractorium* parent);
|
|
|
|
~QssDialog();
|
|
|
|
|
|
|
|
QString Text() const;
|
|
|
|
void SetText(const QString& t);
|
|
|
|
QList<QString> GetClassNames(bool includeObjectNames);
|
|
|
|
static bool IsStyleSheetValid(const QString& styleSheet);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
virtual void accept() override;
|
|
|
|
virtual void reject() override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void showEvent(QShowEvent* e) override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void SlotTextChanged();
|
|
|
|
void SlotAddColor(const QString& p);
|
|
|
|
void SlotAddGeom(const QString& p);
|
|
|
|
void SlotAddBorder(const QString& p);
|
|
|
|
void SlotSetTheme(const QString& s);
|
|
|
|
void SlotAddFont();
|
|
|
|
void SlotApplyCss();
|
|
|
|
|
|
|
|
void LoadButton_clicked();
|
|
|
|
void SaveButton_clicked();
|
|
|
|
void BasicButton_clicked();
|
|
|
|
void MediumButton_clicked();
|
|
|
|
void AdvancedButton_clicked();
|
|
|
|
|
|
|
|
private:
|
--User changes
-Add new variations: bubbleT3D, crob, hexaplay3D, hexcrop, hexes, hexnix3D, loonie2, loonie3, nBlur, octapol and synth.
-Allow for pre/post versions of dc_bubble, dc_cylinder and dc_linear whereas before they were omitted.
-When saving a file with multiple embers in it, detect if time values are all the same and if so, start them at zero and increment by 1 for each ember.
-Allow for numerous quality increases to be coalesced into one. It will pick up at the end of the current render.
-Show selection highlight on variations tree in response to mouse hover. This makes it easier to see for which variation or param the current mouse wheel action will apply.
-Make default temporal samples be 100, whereas before it was 1000 which was overkill.
-Require the shift key to be held with delete for deleting an ember to prevent it from triggering when the user enters delete in the edit box.
-This wasn't otherwise fixable without writing a lot more code.
--Bug fixes
-EmberGenome was crashing when generating a sequence from a source file with more than 2 embers in it.
-EmberGenome was improperly handling the first frame of a merge after the last frame of the loop.
-These bugs were due to a previous commit. Revert parts of that commit.
-Prevent a zoom value of less than 0 when reading from xml.
-Slight optimization of the crescents, and mask variations, if the compiler wasn't doing it already.
-Unique file naming was broken because it was looking for _# and the default names ended with -#.
-Disallow renaming of an ember in the library tree to an empty string.
-Severe bug that prevented some variations from being read correctly from params generated outside this program.
-Severe OpenCL randomization bug. The first x coordinates of the first points in the first kernel call of the first ember of a render since the OpenCL renderer object was created were not random and were mostly -1.
-Severe bug when populating xform selection distributions that could sometimes cause a crash due to roundoff error. Fix by using double.
-Limit the max number of variations in a random ember to MAX_CL_VARS, which is 8. This ensures they'll look the same on CPU and GPU.
-Prevent user from saving stylesheet to default.qss, it's a special reserved filename.
--Code changes
-Generalize using the running sum output point inside of a variation for all cases: pre, reg and post.
-Allow for array variables in variations where the address of each element is stored in m_Params.
-Qualify all math functions with std::
-No longer use our own Clamp() in OpenCL, instead use the standard clamp().
-Redesign how functions are used in the variations OpenCL code.
-Add tests to EmberTester to verify some of the new functionality.
-Place more const and override qualifiers on functions where appropriate.
-Add a global rand with a lock to be used very sparingly.
-Use a map instead of a vector for bad param names in Xml parsing.
-Prefix affine interpolation mode defines with "AFFINE_" to make their purpose more clear.
-Allow for variations that change state during iteration by sending a separate copy of the ember to each rendering thread.
-Implement this same functionality with a local struct in OpenCL. It's members are the total of all variables that need to change state within an ember.
-Add Contains() function to Utils.h.
-EmberRender: print names of kernels being printed with --dump_kernel option.
-Clean up EmberTester to handle some of the recent changes.
-Fix various casts.
-Replace % 2 with & 1, even though the compiler was likely doing this already.
-Add new file Variations06.h to accommodate new variations.
-General cleanup.
2015-11-22 17:15:07 -05:00
|
|
|
void SaveAsDefault();
|
2015-10-27 00:31:35 -04:00
|
|
|
void InsertCssProperty(const QString &name, const QString &value);
|
|
|
|
void SetupFileDialog();
|
|
|
|
QString OpenFile();
|
|
|
|
QString SaveFile();
|
|
|
|
|
|
|
|
QStyle* m_Theme;
|
|
|
|
QStyle* m_LastTheme;
|
|
|
|
QString m_LastStyle;
|
|
|
|
QAction* m_AddColorAction;
|
|
|
|
QAction* m_AddGeomAction;
|
|
|
|
QAction* m_AddBorderAction;
|
|
|
|
QAction* m_AddFontAction;
|
|
|
|
QAction* m_AddStyleAction;
|
|
|
|
QSignalMapper* m_ColorActionMapper;
|
|
|
|
QSignalMapper* m_GeomActionMapper;
|
|
|
|
QSignalMapper* m_BorderActionMapper;
|
|
|
|
QSignalMapper* m_StyleActionMapper;
|
|
|
|
QHash<QString, QString> m_ColorMap;
|
|
|
|
QHash<QString, QString> m_GeomMap;
|
|
|
|
QHash<QString, QString> m_BorderMap;
|
|
|
|
QHash<QString, QString> m_StyleMap;
|
|
|
|
QTimer* m_ApplyTimer;
|
|
|
|
Fractorium* m_Parent;
|
|
|
|
QFileDialog* m_FileDialog;
|
|
|
|
Ui::QssDialog *ui;
|
|
|
|
};
|