From 0aed0bf948a3fd770b2c63ad11b2b364d86900e4 Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 09:39:58 -0400 Subject: [PATCH 1/6] open in IDE --- projectGeneratorElectron/app.js | 29 ++++++++++++ projectGeneratorElectron/index.html | 4 +- projectGeneratorElectron/index.js | 69 ++++++++++++++++++++++++++--- 3 files changed, 93 insertions(+), 9 deletions(-) diff --git a/projectGeneratorElectron/app.js b/projectGeneratorElectron/app.js index 269e4dfe..9a558e42 100644 --- a/projectGeneratorElectron/app.js +++ b/projectGeneratorElectron/app.js @@ -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); }); @@ -480,6 +484,11 @@ function setup() { } }); + $("#IDEButton").on("click", function() { + launchInIDE(); + }); + + $("#verboseOption").checkbox(); $("#verboseOption").on("change", function() { if ($("#verboseOption").filter(":checked").length > 0) { @@ -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'); } @@ -913,3 +929,16 @@ function getRandomSketchName(){ ipc.send('getRandomSketchName', path ); } } + +function launchInIDE(){ + +console.log("sdfsadfasdf?"); + 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 ); +} + diff --git a/projectGeneratorElectron/index.html b/projectGeneratorElectron/index.html index bac0f683..ffd9b54d 100644 --- a/projectGeneratorElectron/index.html +++ b/projectGeneratorElectron/index.html @@ -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; } @@ -301,6 +300,7 @@

Sorry, I've got nothing to say...

+
Close
diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index c66528e3..9100d65a 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -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); @@ -571,15 +575,17 @@ ipc.on('update', function(event, arg) { 'Success!
' + 'Updating your project was successful! ' + update['updatePath'] + '

' + '
' + - '

' + '

' ); + + // event.sender.send('updateCompleted', true); } else { event.sender.send('consoleMessage', "" + wholeString + "
" + error.message); event.sender.send('sendUIMessage', 'Error...
' + 'There was a problem updating your project... ' + update['updatePath'] + '' + - '

' + '

' ); } }); @@ -665,7 +671,7 @@ ipc.on('generate', function(event, arg) { event.sender.send('sendUIMessage', 'Success!
' + 'Your can now find your project in ' + fullPath + '

' + - '

' + '

' ); event.sender.send('generateCompleted', true); } else if (error !== null) { @@ -684,7 +690,7 @@ ipc.on('generate', function(event, arg) { 'Error!
' + 'Error...
' + 'There was a problem generating your project... ' + fullPath + '' + - '

' + '

' ); @@ -770,6 +776,55 @@ 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){ + event.sender.send('projectLaunchCompleted', (error==null) ); + return; + }); + } + else { + // console.log('OSX project file not found!'); + // event.sender.send('projectLaunchCompleted', false ); + // return; + } + } + + // linux + else if( arg.platform == 'linux' || arg.platform == 'linux64' ){ + // xdg-open $DESTINATION_PATH + } + + // unknown platform + else { + console.log("Unsupported platform for Launch feature..."); + event.sender.send('projectLaunchCompleted', false ); + return; + } +}); + ipc.on('quit', function(event, arg) { app.quit(); }); From 169230db3ff10a77926a572d5f7dba4b67b8d43e Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 09:57:58 -0400 Subject: [PATCH 2/6] linux command line open project --- projectGeneratorElectron/index.js | 32 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index 9100d65a..8a2c4318 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -796,29 +796,25 @@ ipc.on('launchProjectinIDE', function(event, arg) { // // launch xcode if( arg.platform == 'osx' ){ - var osxPath = pathTemp.join(fullPath, arg['projectName'] + '.xcodeproj'); + 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){ - event.sender.send('projectLaunchCompleted', (error==null) ); - return; - }); + var exec = require('child_process').exec; + exec('open ' + osxPath, function callback(error, stdout, stderr){ + return; + }); } else { - // console.log('OSX project file not found!'); - // event.sender.send('projectLaunchCompleted', false ); - // return; + console.log('OSX project file not found!'); } - } - - // linux - else if( arg.platform == 'linux' || arg.platform == 'linux64' ){ - // xdg-open $DESTINATION_PATH - } - - // unknown platform - else { + } else if( arg.platform == 'linux' || arg.platform == 'linux64' ){ + var linuxPath = pathTemp.join(fullPath, arg['projectName'] + '.cbp'); + console.log( linuxPath ); + var exec = require('child_process').exec; + exec('xdg-open ' + linuxPath, function callback(error, stdout, stderr){ + return; + }); + } else { console.log("Unsupported platform for Launch feature..."); event.sender.send('projectLaunchCompleted', false ); return; From a5b6d8fe1c412e419983c23eff5c6e7e6f9de2f4 Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 10:01:06 -0400 Subject: [PATCH 3/6] windows open in IDE --- projectGeneratorElectron/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index 8a2c4318..466d8701 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -814,10 +814,13 @@ ipc.on('launchProjectinIDE', function(event, arg) { exec('xdg-open ' + linuxPath, function callback(error, stdout, stderr){ return; }); - } else { - console.log("Unsupported platform for Launch feature..."); - event.sender.send('projectLaunchCompleted', false ); - 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; + }); } }); From 429b1941b7f3f2438f8f53de616b3539ead0ef06 Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 10:11:24 -0400 Subject: [PATCH 4/6] added close modal on open ide --- projectGeneratorElectron/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projectGeneratorElectron/index.html b/projectGeneratorElectron/index.html index ffd9b54d..c35fb6f2 100644 --- a/projectGeneratorElectron/index.html +++ b/projectGeneratorElectron/index.html @@ -300,7 +300,7 @@

Sorry, I've got nothing to say...

- +
Close
From 3f6e59dd3a8d0e42f1821dc5a53d87df466dda9e Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 10:15:34 -0400 Subject: [PATCH 5/6] codeblocks becomes qtcreator --- projectGeneratorElectron/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projectGeneratorElectron/index.js b/projectGeneratorElectron/index.js index 466d8701..103f9171 100644 --- a/projectGeneratorElectron/index.js +++ b/projectGeneratorElectron/index.js @@ -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)" }; @@ -808,7 +808,7 @@ ipc.on('launchProjectinIDE', function(event, arg) { console.log('OSX project file not found!'); } } else if( arg.platform == 'linux' || arg.platform == 'linux64' ){ - var linuxPath = pathTemp.join(fullPath, arg['projectName'] + '.cbp'); + 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){ From ed6fe7369036c5cbbae2f7a2804ce4eac60564b1 Mon Sep 17 00:00:00 2001 From: zach lieberman Date: Thu, 29 Oct 2015 10:20:36 -0400 Subject: [PATCH 6/6] cleanup --- projectGeneratorElectron/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projectGeneratorElectron/app.js b/projectGeneratorElectron/app.js index 9a558e42..edead8c8 100644 --- a/projectGeneratorElectron/app.js +++ b/projectGeneratorElectron/app.js @@ -932,7 +932,6 @@ function getRandomSketchName(){ function launchInIDE(){ -console.log("sdfsadfasdf?"); var project = {}; project['projectName'] = $("#projectName").val(); project['projectPath'] = $("#projectPath").val();