Skip to content

Commit

Permalink
work on isf editor
Browse files Browse the repository at this point in the history
re-enabled signing on mac release builds of the editor and its installer :: win release builds generate debug symbols :: input and pass names are colored using the "variable" color :: changed default/first-time syntax colors :: set window positions on first launch :: auto-updater asks to run once a week :: added an intentional crash when  the "save ui vals to default" button is clicked for testing :: finalized auto-updater URLs, will test with a build that doesn't have an intentional crash
  • Loading branch information
mrRay committed Jan 17, 2019
1 parent b20cca3 commit 798dcf4
Show file tree
Hide file tree
Showing 21 changed files with 280 additions and 68 deletions.
5 changes: 4 additions & 1 deletion VVGL/include/VVGL_Time.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ struct Timestamp {
}
//! Creates a new Timestamp expressed as the quotient of the two passed numbers (the number of frames divided by the number of seconds in which they occur)
Timestamp(const int & inFrameCount, const int & inSecondsCount) {
rawTime = time_point_cast<RawTSDuration>( DoubleTimeTime( DoubleTimeDuration( double(inFrameCount)/double(inSecondsCount) ) ) );
if (inSecondsCount == 0)
rawTime = time_point_cast<RawTSDuration>( DoubleTimeTime( DoubleTimeDuration( double(0.0) ) ) );
else
rawTime = time_point_cast<RawTSDuration>( DoubleTimeTime( DoubleTimeDuration( double(inFrameCount)/double(inSecondsCount) ) ) );
}


Expand Down
26 changes: 20 additions & 6 deletions examples/Qt/ISFEditor/ISFEditor_app/AutoUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QSettings>
#include <updater.h>

#include "VVGL.hpp"
Expand All @@ -28,7 +29,7 @@ AutoUpdater::AutoUpdater(QObject * inParent) :


#if defined(Q_OS_MAC)
qDebug() << "AutoUpdater built for mac";
//qDebug() << "AutoUpdater built for mac";
//QString tmpPath = QString("/Users/testadmin/Qt/MaintenanceTool.app");
#if defined(QT_DEBUG)
QDir macDir = QDir("/Applications/ISF Editor/maintenancetool.app/Contents/MacOS");
Expand All @@ -50,7 +51,7 @@ AutoUpdater::AutoUpdater(QObject * inParent) :
}
}
#elif defined(Q_OS_WIN)
qDebug() << "AutoUpdater built for win";
//qDebug() << "AutoUpdater built for win";
#if defined(QT_DEBUG)
QDir exeDir = QDir("C:/Program Files (x86)/ISF Editor");
#elif defined(QT_NO_DEBUG)
Expand All @@ -64,11 +65,12 @@ AutoUpdater::AutoUpdater(QObject * inParent) :
#else
// linux builds will fail to compile somewhere around here. not sure where Qt is installed, don't have one handy!
#endif
qDebug() << "making QtAutoUpdater with path to maintenance tool " << tmpPath;
//qDebug() << "making QtAutoUpdater with path to maintenance tool " << tmpPath;
_uc = new QtAutoUpdater::UpdateController(tmpPath, inParent);

QObject::connect(_uc, &QtAutoUpdater::UpdateController::runningChanged, [&](bool running) {
qDebug() << "Running changed:" << running;
Q_UNUSED(running);
//qDebug() << "Running changed:" << running;
if (_uc != nullptr) {
QtAutoUpdater::Updater *u = _uc->updater();
if (!u->exitedNormally()) {
Expand All @@ -85,8 +87,20 @@ AutoUpdater::AutoUpdater(QObject * inParent) :
_uc->setRunAsAdmin(true);
*/
#endif
// start the update check -> AskLevel to give the user maximum control
//_uc->start(QtAutoUpdater::UpdateController::AskLevel);
QSettings settings;
if (settings.contains("updateCheckDate")) {
QDate tmpDate = settings.value("updateCheckDate").toDate();
QDate nowDate = QDate::currentDate();
if (tmpDate.daysTo(nowDate) >= 7) {
settings.setValue("updateCheckDate", nowDate);
// start the update check -> AskLevel to give the user maximum control
_uc->start(QtAutoUpdater::UpdateController::AskLevel);
}
}
// else there's no update check date- insert one (don't check for an update immediately)
else {
settings.setValue("updateCheckDate", QDate::currentDate());
}
}
AutoUpdater::~AutoUpdater() {
qDebug() << __PRETTY_FUNCTION__;
Expand Down
86 changes: 81 additions & 5 deletions examples/Qt/ISFEditor/ISFEditor_app/DocWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <QDir>
#include <QFileDialog>
#include <QSettings>
#include <QScrollBar>
#include <QScreen>

#include "SimpleSourceCodeEditor.h"
#include "LoadingWindow.h"
Expand Down Expand Up @@ -121,6 +123,22 @@ void DocWindow::updateContentsFromISFController() {
//if (doc != nullptr)
// cout << "doc is " << *doc;

// create an array of the names of the doc's variables and passes
QStringList localVarStrings;
if (doc != nullptr) {
for (const ISFAttrRef & inputAttr : doc->inputs()) {
QString attrName = QString::fromStdString( inputAttr->name() );
localVarStrings.append(attrName);
}
for (const string & passName : doc->renderPasses()) {
if (passName.length() > 0) {
QString tmpStr = QString::fromStdString(passName);
localVarStrings.append(tmpStr);
}
}
}
qDebug() << "\tlocalVarStrings are " << localVarStrings;

lock_guard<recursive_mutex> lock(propLock);

// kill the save timer if it exists
Expand All @@ -136,6 +154,12 @@ void DocWindow::updateContentsFromISFController() {
VVDELETE(_vertFilePath);
VVDELETE(_vertFilePathContentsOnOpen);

// pass the local variable names to the text views displaying source code
ui->fragShaderEditor->setLocalVariableNames(localVarStrings);
ui->vertShaderEditor->setLocalVariableNames(localVarStrings);
ui->compiledFragShader->setLocalVariableNames(localVarStrings);
ui->compiledVertShader->setLocalVariableNames(localVarStrings);

if (doc != nullptr) {
// get the frag file path from the doc
_fragFilePath = new QString( QString::fromStdString(doc->path()) );
Expand Down Expand Up @@ -314,11 +338,15 @@ void DocWindow::updateContentsFromISFController() {
}
else {
ui->fragShaderEditor->setPlainText(QString(""));
ui->fragShaderEditor->setLocalVariableNames(QStringList());
ui->vertShaderEditor->setPlainText(QString(""));
ui->vertShaderEditor->setLocalVariableNames(QStringList());

ui->compilerErrorsTextWidget->setPlainText( "" );
ui->compiledFragShader->setPlainText( "" );
ui->compiledFragShader->setLocalVariableNames(QStringList());
ui->compiledVertShader->setPlainText( "" );
ui->compiledVertShader->setLocalVariableNames(QStringList());
ui->parsedJSON->setPlainText( "" );

ui->jsonGUIWidget->loadDocFromISFController();
Expand Down Expand Up @@ -504,29 +532,35 @@ void DocWindow::reloadColorsAndSyntaxFormats() {
QSettings settings;
QColor bgColor;
QColor txtColor;
QColor lineBGColor;
QColor selTxtColor;
QColor selBGColor;
QColor insertColor;

if (settings.contains("color_txt_txt"))
txtColor = settings.value("color_txt_txt").value<QColor>();
else
txtColor = Qt::black;
txtColor = QColor("#b4b4b4");

if (settings.contains("color_txt_linebg"))
lineBGColor = settings.value("color_txt_linebg").value<QColor>();
else
lineBGColor = QColor("#414141");

if (settings.contains("color_txt_bg"))
bgColor = settings.value("color_txt_bg").value<QColor>();
else
bgColor = Qt::white;
bgColor = QColor("#1a1a1a");

if (settings.contains("color_txt_seltxt"))
selTxtColor = settings.value("color_txt_seltxt").value<QColor>();
else
selTxtColor = Qt::magenta;
selTxtColor = QColor("#000000");

if (settings.contains("color_txt_selbg"))
selBGColor = settings.value("color_txt_selbg").value<QColor>();
else
selBGColor = Qt::darkGreen;
selBGColor = QColor("#ffff50");

//QString stylesheetString = "QPlainTextEdit {background-color:" + bgColor.name() + "; color:" + txtColor.name() + ";}";
QString stylesheetString = "QPlainTextEdit {";
Expand All @@ -547,30 +581,57 @@ void DocWindow::reloadColorsAndSyntaxFormats() {
palette.setColor(QPalette::Text, txtColor);
palette.setColor(QPalette::Highlight, selBGColor);
palette.setColor(QPalette::HighlightedText, selTxtColor);


QScrollBar *vScroll;
int vScrollVal = 0;

vScroll = ui->fragShaderEditor->verticalScrollBar();
if (vScroll != nullptr)
vScrollVal = vScroll->value();
ui->fragShaderEditor->loadSyntaxDefinitionDocument(tmpDoc);
ui->fragShaderEditor->setStyleSheet(stylesheetString);
ui->fragShaderEditor->setLineBGColor(lineBGColor);
//ui->fragShaderEditor->mergeCurrentCharFormat(fmt);
//ui->fragShaderEditor->setPalette(palette);
ui->fragShaderEditor->setPlainText(ui->fragShaderEditor->toPlainText());
if (vScroll != nullptr)
vScroll->setValue(vScrollVal);

vScroll = ui->vertShaderEditor->verticalScrollBar();
if (vScroll != nullptr)
vScrollVal = vScroll->value();
ui->vertShaderEditor->loadSyntaxDefinitionDocument(tmpDoc);
ui->vertShaderEditor->setStyleSheet(stylesheetString);
ui->vertShaderEditor->setLineBGColor(lineBGColor);
//ui->vertShaderEditor->mergeCurrentCharFormat(fmt);
//ui->vertShaderEditor->setPalette(palette);
ui->vertShaderEditor->setPlainText(ui->vertShaderEditor->toPlainText());
if (vScroll != nullptr)
vScroll->setValue(vScrollVal);

vScroll = ui->compiledVertShader->verticalScrollBar();
if (vScroll != nullptr)
vScrollVal = vScroll->value();
ui->compiledVertShader->loadSyntaxDefinitionDocument(tmpDoc);
ui->compiledVertShader->setStyleSheet(stylesheetString);
ui->compiledVertShader->setLineBGColor(lineBGColor);
//ui->compiledVertShader->mergeCurrentCharFormat(fmt);
//ui->compiledVertShader->setPalette(palette);
ui->compiledVertShader->setPlainText(ui->compiledVertShader->toPlainText());
if (vScroll != nullptr)
vScroll->setValue(vScrollVal);

vScroll = ui->compiledFragShader->verticalScrollBar();
if (vScroll != nullptr)
vScrollVal = vScroll->value();
ui->compiledFragShader->loadSyntaxDefinitionDocument(tmpDoc);
ui->compiledFragShader->setStyleSheet(stylesheetString);
ui->compiledFragShader->setLineBGColor(lineBGColor);
//ui->compiledFragShader->mergeCurrentCharFormat(fmt);
//ui->compiledFragShader->setPalette(palette);
ui->compiledFragShader->setPlainText(ui->compiledFragShader->toPlainText());
if (vScroll != nullptr)
vScroll->setValue(vScrollVal);
}
else
qDebug() << "ERR: couldn't open shader lang files, " << __PRETTY_FUNCTION__;
Expand Down Expand Up @@ -761,6 +822,21 @@ void DocWindow::showEvent(QShowEvent * event) {
if (settings.contains("DocWindowGeometry")) {
restoreGeometry(settings.value("DocWindowGeometry").toByteArray());
}
else {
//QWidget *window = window();
//if (window != nullptr) {
QRect winFrame = frameGeometry();
QRect contentFrame = geometry();
QPoint contentOffset = contentFrame.topRight() - winFrame.topRight();
QScreen *screen = QGuiApplication::screenAt(winFrame.center());
if (screen != nullptr) {
QRect screenFrame = screen->geometry();
winFrame.moveTopRight(screenFrame.topRight());
winFrame.translate(contentOffset.x(), contentOffset.y());
setGeometry(winFrame);
}
//}
}

// set myself as the parent window for the auto updater!
AutoUpdater *aa = GetGlobalAutoUpdater();
Expand Down
19 changes: 12 additions & 7 deletions examples/Qt/ISFEditor/ISFEditor_app/ISFEditor_app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ DEFINES += QT_DEPRECATED_WARNINGS

CONFIG += c++14

VERSION = 2.9.7-4
VERSION = 2.9.7-6
mac {
ICON = ISFEditorAppIcon.icns
}
Expand Down Expand Up @@ -492,20 +492,24 @@ mac {
QMAKE_POST_LINK += cp -vaRf $$_PRO_FILE_PWD_/Syphon/Syphon.framework $$framework_dir;
QMAKE_POST_LINK += cp -vaRf $$OUT_PWD/../fftreal/fftreal.framework $$framework_dir;

#QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/Syphon.framework";
#QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/fftreal.framework";
#QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/libVVGL.1.0.0.dylib";
#QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/libVVISF.1.0.0.dylib";
QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/Syphon.framework";
QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/fftreal.framework";
QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/libVVGL.1.0.0.dylib";
QMAKE_POST_LINK += codesign -f -s "KH97KZU7A7" "$$framework_dir/libVVISF.1.0.0.dylib";

#QMAKE_POST_LINK += macdeployqt $$OUT_PWD/$$TARGET\.app -codesign="KH97KZU7A7";
QMAKE_POST_LINK += macdeployqt $$OUT_PWD/$$TARGET\.app;
QMAKE_POST_LINK += macdeployqt $$OUT_PWD/$$TARGET\.app -codesign="KH97KZU7A7";
#QMAKE_POST_LINK += macdeployqt $$OUT_PWD/$$TARGET\.app;
}
}
win32 {
CONFIG(debug, debug|release) {
# intentionally blank, debug builds don't need any work (build & run works just fine)
}
else {
QMAKE_LFLAGS_RELEASE += /DEBUG
QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /OPT:REF

MY_DEPLOY_DIR = $$shell_quote($$shell_path("$${OUT_PWD}/release"))

QMAKE_POST_LINK += copy $$shell_quote($$shell_path($$OUT_PWD/../../VVGL/release/VVGL.dll)) $${MY_DEPLOY_DIR} $$escape_expand(\n)
Expand Down Expand Up @@ -566,6 +570,7 @@ win32 {
QMAKE_POST_LINK += DEL /F /Q $$shell_quote($$shell_path("$${PRO_DATA_PATH}/*.res")) $$escape_expand(\n)
QMAKE_POST_LINK += DEL /F /Q $$shell_quote($$shell_path("$${PRO_DATA_PATH}/*.lib")) $$escape_expand(\n)
QMAKE_POST_LINK += DEL /F /Q $$shell_quote($$shell_path("$${PRO_DATA_PATH}/*.exp")) $$escape_expand(\n)
QMAKE_POST_LINK += DEL /F /Q $$shell_quote($$shell_path("$${PRO_DATA_PATH}/*.pdb")) $$escape_expand(\n)


# delete the 'data' folder for the files, make the 'data' folder for the files again, copy the files from the repos into it
Expand Down
16 changes: 16 additions & 0 deletions examples/Qt/ISFEditor/ISFEditor_app/LoadingWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <QDir>
#include <QStandardItemModel>
#include <QAbstractEventDispatcher>
#include <QScreen>

#include "DocWindow.h"
#include "ISFController.h"
Expand Down Expand Up @@ -214,6 +215,21 @@ void LoadingWindow::showEvent(QShowEvent * event) {
if (settings.contains("LoadingWindowGeometry")) {
restoreGeometry(settings.value("LoadingWindowGeometry").toByteArray());
}
else {
QWidget *window = this->window();
if (window != nullptr) {
QRect winFrame = window->frameGeometry();
QRect contentFrame = window->geometry();
QPoint contentOffset = contentFrame.topLeft() - winFrame.topLeft();
QScreen *screen = QGuiApplication::screenAt(winFrame.center());
if (screen != nullptr) {
QRect screenFrame = screen->geometry();
winFrame.moveTopLeft(screenFrame.topLeft());
winFrame.translate(contentOffset.x(), contentOffset.y());
window->setGeometry(winFrame);
}
}
}
}
void LoadingWindow::appQuitEvent() {
qDebug() << __PRETTY_FUNCTION__;
Expand Down
13 changes: 13 additions & 0 deletions examples/Qt/ISFEditor/ISFEditor_app/OutputWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <QDebug>
#include <QSettings>
#include <QScreen>

#include "ISFPassTarget.hpp"
#include "ISFController.h"
Expand Down Expand Up @@ -48,6 +49,18 @@ OutputWindow::OutputWindow(QWidget *parent) :
if (settings.contains("OutputWindowGeometry")) {
restoreGeometry(settings.value("OutputWindowGeometry").toByteArray());
}
else {
QWidget *window = this->window();
if (window != nullptr) {
QRect winFrame = window->frameGeometry();
QScreen *screen = QGuiApplication::screenAt(winFrame.center());
if (screen != nullptr) {
QRect screenFrame = screen->geometry();
winFrame.moveBottomRight(screenFrame.bottomRight());
window->setGeometry(winFrame);
}
}
}

// tell the widget to draw a single frame. for some reason, GL widgets on os x don't have their internal sizes set properly when they draw their first frame.
//ui->bufferView->drawBuffer(nullptr);
Expand Down
5 changes: 3 additions & 2 deletions examples/Qt/ISFEditor/ISFEditor_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ int main(int argc, char *argv[])
//QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);

// let's set up some basic info about the app so QSettings will be easier to use
QCoreApplication::setOrganizationName("yourcompanyname");
QCoreApplication::setOrganizationDomain("com.yourcompanyname");
QCoreApplication::setOrganizationName("vidvox");
//QCoreApplication::setOrganizationDomain("com.vidvox");
QCoreApplication::setApplicationName("ISFEditor");

QSettings settings;
Expand All @@ -59,6 +59,7 @@ int main(int argc, char *argv[])
// make the auto updater (by default, its parent will be qApp)
//GetGlobalAutoUpdater();
AutoUpdater *aa = new AutoUpdater(&a);
Q_UNUSED(aa);

// make the main window, which has a GL view in it and will create the GL backend, and then finish launching.
MainWindow w;
Expand Down
Loading

0 comments on commit 798dcf4

Please sign in to comment.