diff --git a/projectGeneratorElectron/app.js b/projectGeneratorElectron/app.js index 269e4dfe..edead8c8 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,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 ); +} + diff --git a/projectGeneratorElectron/index.html b/projectGeneratorElectron/index.html index bac0f683..c35fb6f2 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..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)" }; @@ -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,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(); });