--User changes

-Add a button to swap the pre and post affine values for all selected xforms.

--Bug fixes
 -Remove the ability to change spinner values with +=-=, it was conflicting with other things and added no real value.
 -All file dialog opening in Linux would freeze. No longer using native file dialogs, they are broken.
 -Set default open path to the desktop if there is no settings file present, which will be the case on the first run.
 -Amphibole_Supergroup.ugr palette had an invalid character in two of the palette names.

--Code changes
 -Change some table header padding styles to work with new Qt. Qss reload is required.
 -Ensure the open folder path setting always has a valid string in it before opening a folder.
This commit is contained in:
Person
2018-09-30 14:20:02 -07:00
parent 02c3c3967b
commit c91866acc3
30 changed files with 237 additions and 93 deletions

View File

@ -37,7 +37,7 @@ static void sincos(float x, float* s, float* c)
namespace EmberNs
{
#define EMBER_VERSION "1.0.0.11"
#define EMBER_VERSION "1.0.0.12"
#define EPS6 T(1e-6)
#define EPS std::numeric_limits<T>::epsilon()//Apoplugin.h uses -20, but it's more mathematically correct to do it this way.
#define ISAAC_SIZE 4

View File

@ -58,7 +58,7 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Fractorium 1.0.0.11&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Fractorium 1.0.0.12&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;A Qt-based fractal flame editor which uses a C++ re-write of the flam3 algorithm named Ember and a GPU capable version named EmberCL which implements a portion of the cuburn algorithm in OpenCL.&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;http://fractorium.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;fractorium.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>

View File

@ -245,8 +245,14 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
setValue(value() - (ctrl ? m_Step * 10 : m_Step));
}
}
return true;
}
}
else if (dynamic_cast<QKeyEvent*>(e))
{
return true;
}
}
return QDoubleSpinBox::eventFilter(o, e);
@ -263,7 +269,7 @@ void DoubleSpinBox::keyPressEvent(QKeyEvent* ke)
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
if (ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Equal || ke->key() == Qt::Key_Up)
if (ke->key() == Qt::Key_Up)
{
if (shift)
{
@ -275,8 +281,10 @@ void DoubleSpinBox::keyPressEvent(QKeyEvent* ke)
setSingleStep(m_Step);
setValue(value() + (ctrl ? m_Step * 10 : m_Step));
}
ke->accept();
}
else if (ke->key() == Qt::Key_Minus || ke->key() == Qt::Key_Underscore || ke->key() == Qt::Key_Down)
else if (ke->key() == Qt::Key_Down)
{
if (shift)
{
@ -288,6 +296,8 @@ void DoubleSpinBox::keyPressEvent(QKeyEvent* ke)
setSingleStep(m_Step);
setValue(value() - (ctrl ? m_Step * 10 : m_Step));
}
ke->accept();
}
else
QDoubleSpinBox::keyPressEvent(ke);

View File

@ -398,37 +398,42 @@ bool Fractorium::eventFilter(QObject* o, QEvent* e)
}
else if (o == this)
{
unsigned int index = combo->currentIndex();
auto focusedctrl = dynamic_cast<QSpinBox*>(this->focusWidget());
if (ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Equal)
if (!focusedctrl)//Doesn't seem to matter, but just to be safe.
{
xfupcount++;
unsigned int index = combo->currentIndex();
if (xfupcount >= 3)
if (ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Equal)
{
xfupcount = 0;
combo->setCurrentIndex((index + 1) % combo->count());
//qDebug() << "global arrow plus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
xfupcount++;
if (xfupcount >= 3)
{
xfupcount = 0;
combo->setCurrentIndex((index + 1) % combo->count());
//qDebug() << "global arrow plus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
}
return true;
}
return true;
}
else if (ke->key() == Qt::Key_Minus || ke->key() == Qt::Key_Underscore)
{
xfdncount++;
if (xfdncount >= 3)
else if (ke->key() == Qt::Key_Minus || ke->key() == Qt::Key_Underscore)
{
xfdncount = 0;
xfdncount++;
if (index == 0)
index = combo->count();
if (xfdncount >= 3)
{
xfdncount = 0;
combo->setCurrentIndex((index - 1) % combo->count());
//qDebug() << "global arrow minus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
if (index == 0)
index = combo->count();
combo->setCurrentIndex((index - 1) % combo->count());
//qDebug() << "global arrow minus key press: " << ke->key() << " " << o->metaObject()->className() << " " << o->objectName();
}
return true;
}
return true;
}
}
}
@ -594,6 +599,7 @@ QStringList Fractorium::SetupOpenXmlDialog()
{
m_FileDialog = new QFileDialog(this);
m_FileDialog->setViewMode(QFileDialog::List);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
}
QStringList filenames;
@ -642,6 +648,7 @@ QString Fractorium::SetupSaveXmlDialog(const QString& defaultFilename)
{
m_FileDialog = new QFileDialog(this);
m_FileDialog->setViewMode(QFileDialog::List);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
}
QString filename;
@ -687,6 +694,7 @@ QString Fractorium::SetupSaveImageDialog(const QString& defaultFilename)
{
m_FileDialog = new QFileDialog(this);
m_FileDialog->setViewMode(QFileDialog::List);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
}
QString filename;
@ -702,7 +710,6 @@ QString Fractorium::SetupSaveImageDialog(const QString& defaultFilename)
m_FileDialog->selectFile(defaultFilename);
m_FileDialog->setFileMode(QFileDialog::AnyFile);
m_FileDialog->setOption(QFileDialog::ShowDirsOnly, false);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, false);
#ifdef _WIN32
m_FileDialog->setNameFilter(".bmp;;.jpg;;.png;;.exr");
#else
@ -738,6 +745,7 @@ QString Fractorium::SetupSaveFolderDialog()
{
m_FolderDialog = new QFileDialog(this);
m_FolderDialog->setViewMode(QFileDialog::List);
m_FolderDialog->setOption(QFileDialog::DontUseNativeDialog, true);
}
QString filename;
@ -893,6 +901,7 @@ void Fractorium::SetTabOrders()
w = SetTabOrder(this, w, ui.PreRandomButton);
w = SetTabOrder(this, w, ui.ShowPreAffineCurrentRadio);
w = SetTabOrder(this, w, ui.ShowPreAffineAllRadio);
w = SetTabOrder(this, w, ui.SwapAffinesButton);
w = SetTabOrder(this, w, ui.PostAffineGroupBox);
w = SetTabOrder(this, w, m_PostX1Spin);
w = SetTabOrder(this, w, m_PostX2Spin);

View File

@ -286,6 +286,7 @@ public slots:
void OnCopyAffineButtonClicked(bool checked);
void OnPasteAffineButtonClicked(bool checked);
void OnRandomAffineButtonClicked(bool checked);
void OnSwapAffinesButtonClicked(bool checked);
void OnAffineGroupBoxToggled(bool on);
void OnAffineDrawAllCurrentRadioButtonToggled(bool checked);

View File

@ -466,7 +466,7 @@
<string>Geometry</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignTop</set>
<set>AlignCenter</set>
</property>
</column>
</widget>
@ -547,7 +547,7 @@
<string>Iteration</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignTop</set>
<set>AlignCenter</set>
</property>
</column>
</widget>
@ -637,7 +637,7 @@
<string>Color</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignTop</set>
<set>AlignCenter</set>
</property>
</column>
</widget>
@ -734,7 +734,7 @@
<string>Filter</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignTop</set>
<set>AlignCenter</set>
</property>
</column>
</widget>
@ -1624,7 +1624,7 @@
<string>Animation</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignTop</set>
<set>AlignCenter</set>
</property>
</column>
</widget>
@ -3040,13 +3040,13 @@
</property>
<property name="minimumSize">
<size>
<width>58</width>
<width>62</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>58</width>
<width>62</width>
<height>24</height>
</size>
</property>
@ -3181,18 +3181,30 @@
<property name="text">
<string>Weight</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Name</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string/>
</property>
<property name="textAlignment">
<set>AlignLeading|AlignVCenter</set>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string/>
</property>
<property name="textAlignment">
<set>AlignLeading|AlignVCenter</set>
</property>
@ -4684,6 +4696,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="SwapAffinesButton">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Swap the values of the pre and post affines&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Swap</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="PostAffineGroupBox">
<property name="sizePolicy">

View File

@ -517,7 +517,10 @@ static QString BaseStyle()
"\tbackground-color: lightgray;\n"
"\tborder: none;\n"
"\tborder-bottom: 1px solid gray;\n"
"\tpadding: 4px;\n"
"\tpadding-left: 5px;\n"
"\tpadding-right: 0px;\n"
"\tpadding-top: 0px;\n"
"\tpadding-bottom: 0px;\n"
"\tfont: 8pt \"MS Shell Dlg 2\";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/\n"
"}\n"
"\n"
@ -527,7 +530,9 @@ static QString BaseStyle()
"\tbackground-color: lightgray;\n"
"\tborder: 0px solid darkgray;\n"
"\tborder-right: 1px solid gray;\n"
"\tpadding: 4px;\n"
"\tpadding-top: 0px;\n"
"\tpadding-bottom: 0px;\n"
"\tpadding-left: 3px;\n"
"\tfont: 8pt \"MS Shell Dlg 2\";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/\n"
"}\n"
"\n"
@ -537,7 +542,10 @@ static QString BaseStyle()
"\tbackground-color: rgb(53, 53, 53);\n"
"\tborder: 0px none darkgray;\n"
"\tborder-bottom: 1px solid rgb(53, 53, 53);\n"
"\tpadding: 4px;\n"
"\tpadding-left: 5px;\n"
"\tpadding-right: 0px;\n"
"\tpadding-top: 0px;\n"
"\tpadding-bottom: 0px;\n"
"\tfont: 8pt \"MS Shell Dlg 2\";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/\n"
"}\n"
"\n"
@ -547,7 +555,9 @@ static QString BaseStyle()
"\tbackground-color: rgb(53, 53, 53);\n"
"\tborder: 0px none darkgray;\n"
"\tborder-right: 0px solid rgb(53, 53, 53);\n"
"\tpadding: 4px;\n"
"\tpadding-top: 0px;\n"
"\tpadding-bottom: 0px;\n"
"\tpadding-left: 3px;\n"
"\tfont: 8pt \"MS Shell Dlg 2\";/*For some reason the font changes if you set any style. Set this to whatever font is the default on your system*/\n"
"}\n"
;

View File

@ -198,6 +198,7 @@ public:
virtual void PasteXformsAffine(bool pre) { }
virtual void RandomXformsAffine(bool pre) { }
virtual void FillBothAffines() { }
virtual void SwapAffines() { }
double LockedScale() { return m_LockedScale; }
double LockedX() { return m_LockedX; }
double LockedY() { return m_LockedY; }
@ -475,6 +476,7 @@ public:
virtual void PasteXformsAffine(bool pre) override;
virtual void RandomXformsAffine(bool pre) override;
virtual void FillBothAffines() override;
virtual void SwapAffines() override;
virtual void InitLockedScale() override;
void FillAffineWithXform(Xform<T>* xform, bool pre);
void ChangeLockedScale(T value);

View File

@ -85,9 +85,20 @@ void FractoriumSettings::EnsureDefaults()
)
FinalExt("png");
auto s = SaveFolder();
auto s = OpenFolder();
QDir dir(s);
if (s.isEmpty() || !dir.exists())
{
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DesktopLocation);
if (!paths.empty())
OpenFolder(paths[0]);
}
s = SaveFolder();
dir = QDir(s);
if (s.isEmpty() || !dir.exists())
{
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DesktopLocation);

View File

@ -95,6 +95,7 @@ void Fractorium::InitXformsAffineUI()
connect(ui.PostRandomButton, SIGNAL(clicked(bool)), this, SLOT(OnRandomAffineButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.PreAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
connect(ui.PostAffineGroupBox, SIGNAL(toggled(bool)), this, SLOT(OnAffineGroupBoxToggled(bool)), Qt::QueuedConnection);
connect(ui.SwapAffinesButton, SIGNAL(clicked(bool)), this, SLOT(OnSwapAffinesButtonClicked(bool)), Qt::QueuedConnection);
connect(ui.ShowPreAffineAllRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
connect(ui.ShowPreAffineCurrentRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
connect(ui.ShowPreAffineSelectedRadio, SIGNAL(toggled(bool)), this, SLOT(OnAffineDrawAllCurrentRadioButtonToggled(bool)), Qt::QueuedConnection);
@ -704,6 +705,27 @@ void Fractorium::OnAffineGroupBoxToggled(bool on)
ui.GLDisplay->update();
}
/// <summary>
/// Swap the values of the pre and post affines for the selected xforms.
/// </summary>
template <typename T>
void FractoriumEmberController<T>::SwapAffines()
{
UpdateXform([&](Xform<T>* xform, size_t xfindex, size_t selIndex)
{
auto pre = xform->m_Affine;
auto post = xform->m_Post;
xform->m_Affine = post;
xform->m_Post = pre;
}, eXformUpdate::UPDATE_SELECTED);
FillBothAffines();
}
void Fractorium::OnSwapAffinesButtonClicked(bool checked)
{
m_Controller->SwapAffines();
}
/// <summary>
/// Trigger a redraw which will show all, or only the current, circle affine transforms
/// based on which radio buttons are selected.

View File

@ -224,16 +224,25 @@
<property name="text">
<string>Use</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Primary</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Device</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
</widget>
</item>

View File

@ -510,6 +510,7 @@ QStringList PaletteEditor::SetupOpenImagesDialog()
m_FileDialog->setViewMode(QFileDialog::List);
m_FileDialog->setFileMode(QFileDialog::ExistingFile);
m_FileDialog->setAcceptMode(QFileDialog::AcceptOpen);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
#ifdef _WIN32
m_FileDialog->setNameFilter("Image Files (*.png *.jpg *.bmp)");
#else

View File

@ -636,8 +636,9 @@ void QssDialog::SetupFileDialog()
if (!m_FileDialog)
{
m_FileDialog = new QFileDialog(this);
m_FileDialog->setDirectory(m_Parent->m_SettingsPath);
m_FileDialog->setViewMode(QFileDialog::List);
m_FileDialog->setDirectory(m_Parent->m_SettingsPath);
m_FileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
}
#endif

View File

@ -242,6 +242,10 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
}
}
}
else if (dynamic_cast<QKeyEvent*>(e))
{
return true;
}
}
}
@ -259,7 +263,7 @@ void SpinBox::keyPressEvent(QKeyEvent* ke)
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
if (ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Equal || ke->key() == Qt::Key_Up)
if (ke->key() == Qt::Key_Up)
{
if (shift)
{
@ -271,8 +275,10 @@ void SpinBox::keyPressEvent(QKeyEvent* ke)
setSingleStep(m_Step);
setValue(value() + (ctrl ? m_Step * 10 : m_Step));
}
ke->accept();
}
else if (ke->key() == Qt::Key_Minus || ke->key() == Qt::Key_Underscore || ke->key() == Qt::Key_Down)
else if (ke->key() == Qt::Key_Down)
{
if (shift)
{
@ -284,6 +290,8 @@ void SpinBox::keyPressEvent(QKeyEvent* ke)
setSingleStep(m_Step);
setValue(value() - (ctrl ? m_Step * 10 : m_Step));
}
ke->accept();
}
else
QSpinBox::keyPressEvent(ke);