Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions projectGeneratorElectron/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ ipc.on('selectAddons', function(arg) {
//-------------------------------------------
// allow main to send UI messages
ipc.on('sendUIMessage', function(arg) {

// check if it has "success" message:


displayModal(arg);
});

Expand Down Expand Up @@ -480,6 +484,11 @@ function setup() {
}
});

$("#IDEButton").on("click", function() {
launchInIDE();
});


$("#verboseOption").checkbox();
$("#verboseOption").on("change", function() {
if ($("#verboseOption").filter(":checked").length > 0) {
Expand Down Expand Up @@ -848,6 +857,13 @@ function displayModal(message) {
var shell = require('shell');
shell.openExternal( $(this).prop("href") );
});

if (message.indexOf("Success!") > -1){
$("#IDEButton").show();
} else {
$("#IDEButton").hide();
}

$("#uiModal").modal('show');
}

Expand Down Expand Up @@ -913,3 +929,15 @@ function getRandomSketchName(){
ipc.send('getRandomSketchName', path );
}
}

function launchInIDE(){

var project = {};
project['projectName'] = $("#projectName").val();
project['projectPath'] = $("#projectPath").val();
project['platform'] = defaultSettings['defaultPlatform']; // ignores OS selection
project['ofPath'] = $("#ofPath").val();

ipc.send('launchProjectinIDE', project );
}

4 changes: 2 additions & 2 deletions projectGeneratorElectron/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
font-family:Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
font-size: 9px;
white-space: pre;
word-wrap: normal;
overflow-x: scroll;
word-wrap: break-word;
}

</style>
Expand Down Expand Up @@ -301,6 +300,7 @@
<p>Sorry, I've got nothing to say...</p>
</div>
<div class="actions">
<div class="ui cancel button" id="IDEButton" style="display: none;">Open in IDE</div>
<div class="ui cancel button">Close</div>
</div>
</div>
Expand Down
72 changes: 63 additions & 9 deletions projectGeneratorElectron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ var platforms = {
"osx": "OS X (Xcode)",
"vs": "Windows (Visual Studio 2015)",
"ios": "iOS (Xcode)",
"linux": "Linux 32-bit (Code::Blocks)",
"linux64": "Linux 64-bit (Code::Blocks)",
"linux": "Linux 32-bit (qtCreator)",
"linux64": "Linux 64-bit (qtCreator)",
"linuxarmv6l": "Linux ARMv6 (Makefiles)",
"linuxarmv7l": "Linux ARMv7 (Makefiles)"
};
Expand Down Expand Up @@ -301,9 +301,13 @@ function parseAddonsAndUpdateSelect(arg) {
//path = require('path').resolve(__dirname, defaultOfPath + "/addons");
addons = getDirectories(arg + "/addons","ofx");

addons = addons.filter( function(addon) {
return addonsToSkip.indexOf(addon)==-1;
});
if (addons){
if (addons.length > 0){
addons = addons.filter( function(addon) {
return addonsToSkip.indexOf(addon)==-1;
});
}
}

console.log("Reloading the addons folder, these were found:");
console.log(addons);
Expand Down Expand Up @@ -571,15 +575,17 @@ ipc.on('update', function(event, arg) {
'<strong>Success!</strong><br>' +
'Updating your project was successful! <a href="file:///' + update['updatePath'] + '" class="monospace" data-toggle="external_target">' + update['updatePath'] + '</a><br><br>' +
'<button class="btn btn-default console-feature" onclick="$(\'#fullConsoleOutput\').toggle();">Show full log</button><br>' +
'<div id="fullConsoleOutput"><br><textarea class="selectable">' + stdout + '</textarea></div>'
'<div id="fullConsoleOutput"><br><textarea class="selectable">' + stdout + '\n\n\n(command used:' + wholeString + ')\n\n\n</textarea></div>'
);

//
event.sender.send('updateCompleted', true);
} else {
event.sender.send('consoleMessage', "<strong>" + wholeString + "</strong><br>" + error.message);
event.sender.send('sendUIMessage',
'<strong>Error...</strong><br>' +
'There was a problem updating your project... <span class="monospace">' + update['updatePath'] + '</span>' +
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + error.message + '</textarea></div>'
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + error.message + '\n\n\n(command used:' + wholeString + ')\n\n\n</textarea></div>'
);
}
});
Expand Down Expand Up @@ -665,7 +671,7 @@ ipc.on('generate', function(event, arg) {
event.sender.send('sendUIMessage',
'<strong>Success!</strong><br>' +
'Your can now find your project in <a href="file:///' + fullPath + '" data-toggle="external_target" class="monospace">' + fullPath + '</a><br><br>' +
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '</textarea></div>'
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '\n\n\n(command used: ' + wholeString + ')\n\n\n</textarea></div>'
);
event.sender.send('generateCompleted', true);
} else if (error !== null) {
Expand All @@ -684,7 +690,7 @@ ipc.on('generate', function(event, arg) {
'<strong>Error!</strong><br>' +
'<strong>Error...</strong><br>' +
'There was a problem generating your project... <span class="monospace">' + fullPath + '</span>' +
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '</textarea></div>'
'<div id="fullConsoleOutput" class="not-hidden"><br><textarea class="selectable">' + stdout + '\n\n\n(command used: ' + wholeString + ')\n\n\n</textarea></div>'

);

Expand Down Expand Up @@ -770,6 +776,54 @@ ipc.on('pickProjectImport', function(event, arg) {
});
});


ipc.on('launchProjectinIDE', function(event, arg) {

if( arg.platform != obj.defaultPlatform ){
event.sender.send('projectLaunchCompleted', false);
return;
}

var pathTemp = require('path');
var fsTemp = require('fs');
var fullPath = pathTemp.join(arg['projectPath'], arg['projectName']);

if( fsTemp.statSync(fullPath).isDirectory() == false ){
// project doesn't exist
event.sender.send('projectLaunchCompleted', false );
return;
}

// // launch xcode
if( arg.platform == 'osx' ){
var osxPath = pathTemp.join(fullPath, arg['projectName'] + '.xcodeproj');
console.log( osxPath );
if( fsTemp.statSync(osxPath).isDirectory() == true ){ // note: .xcodeproj is a folder, not a file
var exec = require('child_process').exec;
exec('open ' + osxPath, function callback(error, stdout, stderr){
return;
});
}
else {
console.log('OSX project file not found!');
}
} else if( arg.platform == 'linux' || arg.platform == 'linux64' ){
var linuxPath = pathTemp.join(fullPath, arg['projectName'] + '.qbs');
console.log( linuxPath );
var exec = require('child_process').exec;
exec('xdg-open ' + linuxPath, function callback(error, stdout, stderr){
return;
});
} else {
var windowsPath = pathTemp.join(fullPath, arg['projectName'] + '.sln');
console.log( windowsPath );
var exec = require('child_process').exec;
exec('start ' + windowsPath, function callback(error, stdout, stderr){
return;
});
}
});

ipc.on('quit', function(event, arg) {
app.quit();
});