Skip to content

Commit

Permalink
Latest changes TBVExchanger plugin 1.1.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Gijsen committed Dec 18, 2015
1 parent c856e2a commit 5218fc2
Show file tree
Hide file tree
Showing 14 changed files with 1,312 additions and 301 deletions.
675 changes: 675 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions README
@@ -0,0 +1,29 @@
----------------------------------
TBVExchanger, a BrainStim plugin
----------------------------------

The BrainStim Project page is located at:
<http://github.com/svengijsen/BrainStim>

This plugins documentation is located at:
<http://svengijsen.github.io/TBVExchanger/>

and can be downloaded from:
<http://github.com/svengijsen/TBVExchanger/releases>

This plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.




29 changes: 14 additions & 15 deletions defines.h
Expand Up @@ -17,20 +17,20 @@
//


#ifndef TBVExchangerDEFINES_H
#define TBVExchangerDEFINES_H
#ifndef TBVEXCHANGERDEFINES_H
#define TBVEXCHANGERDEFINES_H
#include "maindefines.h"

//Only edit the below!
#define PLUGIN_FILE_VERSION_STRING_MAJOR 1
#define PLUGIN_FILE_VERSION_STRING_MINOR 0
#define PLUGIN_FILE_VERSION_STRING_REVISION 0
#define PLUGIN_FILE_VERSION_STRING_BUILD 1
#define PLUGIN_PRODUCT_VERSION_STRING_MAJOR 1
#define PLUGIN_PRODUCT_VERSION_STRING_MINOR 0
#define PLUGIN_PRODUCT_VERSION_STRING_REVISION 0
#define PLUGIN_PRODUCT_VERSION_STRING_BUILD 1
#define PLUGIN_LEGAL_COPYRIGHT "Copyright (C) 2015"

#define PLUGIN_FILE_VERSION_STRING_MAJOR 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_FILE_VERSION_STRING_MINOR 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_FILE_VERSION_STRING_REVISION 0 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_FILE_VERSION_STRING_BUILD 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_PRODUCT_VERSION_STRING_MAJOR 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_PRODUCT_VERSION_STRING_MINOR 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_PRODUCT_VERSION_STRING_REVISION 0 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_PRODUCT_VERSION_STRING_BUILD 1 //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_LEGAL_COPYRIGHT "Copyright (C) 2016" //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
#define PLUGIN_AUTHOR_NAME "Sven Gijsen"
#define PLUGIN_AUTHOR_EMAIL "sven.gijsen@maastrichtuniversity.nl"
#define PLUGIN_COMPANY_NAME "MBIC, Maastricht Brain Imaging Center"
Expand All @@ -43,13 +43,12 @@
#define PLUGIN_FULL_NAME PLUGIN_INTERNAL_NAME "(v" PLUGIN_FILE_VERSION_STRING ")"
#define PLUGIN_FILE_DESCRIPTION "BrainStim Plugin that makes communication to Turbo Brain Voyager possible"
#define PLUGIN_INFORMATION PLUGIN_INTERNAL_NAME " Plugin(v" PLUGIN_FILE_VERSION_STRING ")"
#define PLUGIN_MAIN_PROGRAM_MINIMAL_VERSION "1.0.0.1"
#define PLUGIN_MAIN_PROGRAM_MINIMAL_VERSION "1.1.0.1" //Please do not edit this line manually, see PluginBinaryVersioning.qs (151216133215).
//Only edit until here!


#define PLUGIN_FILE_VERSION_STRING VERSION_STRING_INTERMEDIATE(PLUGIN_FILE_VERSION_STRING_MAJOR,PLUGIN_FILE_VERSION_STRING_MINOR,PLUGIN_FILE_VERSION_STRING_REVISION,PLUGIN_FILE_VERSION_STRING_BUILD)
#define PLUGIN_PRODUCT_VERSION_STRING VERSION_STRING_INTERMEDIATE(PLUGIN_PRODUCT_VERSION_STRING_MAJOR,PLUGIN_PRODUCT_VERSION_STRING_MINOR,PLUGIN_PRODUCT_VERSION_STRING_REVISION,PLUGIN_PRODUCT_VERSION_STRING_BUILD)
#endif // TBVExchangerDEFINES_H
#endif // TBVEXCHANGERDEFINES_H



Expand Down
221 changes: 221 additions & 0 deletions scripts/PluginBinaryVersioning.qs
@@ -0,0 +1,221 @@
var sScriptPath = BrainStim.getActiveDocumentFileLocation() + "/";
var dAppRootDir = new QDir(sScriptPath + "../");
var sSourcePath = dAppRootDir.absolutePath() + "/";
var sDestPath = sSourcePath;
var sSourceList = new CreateArray();
var sDestList = new CreateArray();

////////////////////////////////////////////////////////////////////////////
//Changes below here...
////////////////////////////////////////////////////////////////////////////
var sCopyrightString = "\"Copyright (C) 2016\"";

var sFileVersionMajor = 1;
var sFileVersionMinor = 1;
var sFileVersionRevision = 0;
var sFileVersionBuild = 1;

var sProductVersionMajor = 1;
var sProductVersionMinor = 1;
var sProductVersionRevision = 0;
var sProductVersionBuild = 1;

var sMinimalBrainStimVersion = "\"1.1.0.1\"";

sSourceList.push(sSourcePath + "defines.h");
sDestList.push(sDestPath + "defines.h");//0
//sSourceList.push(sSourcePath + "x.h");
//sDestList.push(sDestPath + "x.h");//1
//BrainStim.openFiles("",sSourceList);
///////////////////////Till here////////////////////////////////////////////

function tr(s) { return s; }

function CreateTimeStamp(sTime)
{
var sep = "";
var sTempTime = (sTime.getFullYear()-2000) + sep + (sTime.getMonth()+1) + sep + sTime.getDate() + sep + sTime.getHours() + sep + sTime.getMinutes() + sep + sTime.getSeconds();
Log(sTempTime);
return sTempTime;
}

function CreateArray(length)
{
var a = new Array(length || 0);
if (arguments.length > 1)
{
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < length; i++)
{
a[i] = CreateArray.apply(this, args);
}
}
return a;
}

QByteArray.prototype.toString = function()
{
ts = new QTextStream( this, QIODevice.ReadOnly );
return ts.readAll();
}

function quotedString(sValue)
{
return "\"" + sValue + "\"";
}

function CreateNewContent(strTemplate,changeSetArray)
{
var arrLines = strTemplate.split(/\r?\n|\r/);
Log(" - Number of lines: " + arrLines.length);
var nStartIndex = 0;
var sSearchval = "";
for(var nChanges=0;nChanges<changeSetArray[0].length;nChanges++)//For all changes
{
sSearchval = changeSetArray[0][nChanges];
for(var nLines=0;nLines<arrLines.length;nLines++)//For all lines
{
if (arrLines[nLines].indexOf(sSearchval, nStartIndex) != -1)
{
Log(" - Value(\"" + sSearchval + "\") found @ line:" + nLines);
arrLines[nLines] = changeSetArray[1][nChanges];
//Log(arrLines[nLines]);
}
}
}
strTemplate = arrLines.join("\n");
return strTemplate;
}

function ProcessInFiles(strTemplate, strDestination, changeSetArr)
{
var templateFile = new QFile(strTemplate);
templateFile.open(QIODevice.OpenMode(QIODevice.ReadOnly) || QIODevice.OpenMode(QIODevice.Text));
var inStream = new QTextStream(templateFile);
var inData = new String();
inData = inStream.readAll();
templateFile.close();
///////////////////////////////////////////////////////////////////////////////////////
var outputFile = new QFile(strDestination);
outputFile.open(QIODevice.OpenMode(QIODevice.WriteOnly) || QIODevice.OpenMode(QIODevice.Text));
var outStream = new QTextStream(outputFile);
inData = CreateNewContent(inData,changeSetArr);
var outData = new QByteArray(inData);// or 'text'
outputFile.write(outData);
outputFile.close();
templateFile = null;
inStream = null;
inData = null;
outputFile = null;
outStream = null;
outData = null;
return true;
}

function getFileName()
{
var options = 0;
//options |= QFileDialog.DontUseNativeDialog;
var selectedFilter;
//( parent, caption, dir, filter, selectedFilter, options)
var fileName = QFileDialog.getOpenFileName(this,
tr("QFileDialog::getOpenFileName()"),
sScriptPath,
tr("JavaScript Files (*.js)"),
selectedFilter,
QFileDialog.Options(options));
if (fileName.length != 0)
return fileName;
else
return "";
}

function CleanupScript()
{
jsConfigurationFile = null;
sTimeObject = null;
CreateTimeStamp = null;
tmpString = null;
changeSet= null;
ProcessInFiles = null;
QByteArray.prototype.toString =null;
CreateNewContent = null;
CreateArray = null;
sSourceList = null;
getFileName = null;
CleanupScript = null;
tr = null;
BrainStimInfo = null;
quotedString = null;
dAppRootDir = null;
Log("\nScript ended");
BrainStim.cleanupScript();
}

var tmpString = new String();
var sTimeObject = new Date();
var nFiles = sSourceList.length;
var changeSet;
var sComment = " //Please do not edit this line manually, see PluginBinaryVersioning.qs (" + CreateTimeStamp(sTimeObject) + ").";
var bDoProcess = true;
var nChangeCounter;

if(bDoProcess)
{
Log("Total " + nFiles + " file(s).");
for(var nFileCounter=0;nFileCounter<nFiles;nFileCounter++)
{
changeSet = CreateArray(nFiles,2,0);
nChangeCounter = 0;
bDoProcess = false;
if(nFileCounter == 0)//"defines.h"
{
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_FILE_VERSION_STRING_MAJOR";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sFileVersionMajor + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_FILE_VERSION_STRING_MINOR";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sFileVersionMinor + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_FILE_VERSION_STRING_REVISION";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sFileVersionRevision + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_FILE_VERSION_STRING_BUILD";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sFileVersionBuild + sComment;
nChangeCounter++;

changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_PRODUCT_VERSION_STRING_MAJOR";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sProductVersionMajor + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_PRODUCT_VERSION_STRING_MINOR";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sProductVersionMinor + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_PRODUCT_VERSION_STRING_REVISION";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sProductVersionRevision + sComment;
nChangeCounter++;
changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_PRODUCT_VERSION_STRING_BUILD";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sProductVersionBuild + sComment;
nChangeCounter++;

changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_LEGAL_COPYRIGHT";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sCopyrightString + sComment;
nChangeCounter++;

changeSet[nFileCounter][0][nChangeCounter] = "#define PLUGIN_MAIN_PROGRAM_MINIMAL_VERSION";
changeSet[nFileCounter][1][nChangeCounter] = changeSet[nFileCounter][0][nChangeCounter] + "\t" + sMinimalBrainStimVersion + sComment;
nChangeCounter++;

bDoProcess = true;
}
else
{
bDoProcess = false;
}

if(bDoProcess)
{
Log("\n- File: " + sSourceList[nFileCounter]);
ProcessInFiles(sSourceList[nFileCounter],sDestList[nFileCounter],changeSet[nFileCounter]);
}
}
}
CleanupScript();

0 comments on commit 5218fc2

Please sign in to comment.