mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-30 02:50:05 +00:00
Projucer: add feature download & install live-build engine (including checks for supported OS versions)
This commit is contained in:
parent
42b8156cf6
commit
a0350e4ee6
13 changed files with 411 additions and 97 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include "jucer_Module.h"
|
||||
#include "../Application/jucer_MainWindow.h"
|
||||
#include "../Application/jucer_Application.h"
|
||||
#include "../Application/jucer_DownloadCompileEngineThread.h"
|
||||
#include "../Code Editor/jucer_SourceCodeEditor.h"
|
||||
#include "../Utility/jucer_FilePathPropertyComponent.h"
|
||||
#include "jucer_TreeItemTypes.h"
|
||||
|
|
@ -330,6 +331,7 @@ void ProjectContentComponent::rebuildProjectTabs()
|
|||
resized();
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
struct BuildTabComponent : public ConcertinaPanel
|
||||
{
|
||||
|
|
@ -355,7 +357,8 @@ struct ProjucerDisabledComp : public Component,
|
|||
private Button::Listener
|
||||
{
|
||||
ProjucerDisabledComp (String message, bool loggedIn, bool showSubscribeButton,
|
||||
bool showSignInButton, bool showSwitchAccountButton)
|
||||
bool showSignInButton, bool showSwitchAccountButton,
|
||||
bool showDownloadButton)
|
||||
: isLoggedIn (loggedIn)
|
||||
{
|
||||
infoLabel.setColour (Label::textColourId, findColour (mainBackgroundColourId).contrasting (0.7f));
|
||||
|
|
@ -383,6 +386,13 @@ struct ProjucerDisabledComp : public Component,
|
|||
addAndMakeVisible (*switchAccountButton);
|
||||
switchAccountButton->addListener (this);
|
||||
}
|
||||
|
||||
if (showDownloadButton)
|
||||
{
|
||||
downloadButton = new TextButton (String ("Download live-build engine"));
|
||||
addAndMakeVisible (*downloadButton);
|
||||
downloadButton->addListener (this);
|
||||
}
|
||||
}
|
||||
|
||||
void resized() override
|
||||
|
|
@ -417,6 +427,13 @@ struct ProjucerDisabledComp : public Component,
|
|||
{
|
||||
switchAccountButton->setSize (buttonWidth, buttonHeight);
|
||||
switchAccountButton->setCentrePosition (buttonCenterX, buttonCenterY);
|
||||
buttonCenterY += itemDistance + buttonHeight;
|
||||
}
|
||||
|
||||
if (downloadButton.get() != nullptr)
|
||||
{
|
||||
downloadButton->setSize (buttonWidth, buttonHeight);
|
||||
downloadButton->setCentrePosition (buttonCenterX, buttonCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -434,6 +451,26 @@ struct ProjucerDisabledComp : public Component,
|
|||
{
|
||||
ProjucerApplication::getApp().showLoginForm();
|
||||
}
|
||||
else if (btn == downloadButton.get())
|
||||
{
|
||||
if (DownloadCompileEngineThread::downloadAndInstall())
|
||||
{
|
||||
if (! ProjucerLicenses::getInstance()->retryLoadDll())
|
||||
{
|
||||
AlertWindow::showMessageBox(AlertWindow::WarningIcon,
|
||||
"Download and install",
|
||||
"Loading the live-build engine failed");
|
||||
return;
|
||||
}
|
||||
|
||||
// async!
|
||||
ProjucerApplication::getApp().showLoginForm();
|
||||
|
||||
// if sign in successful project tabs update, otherwise they were not
|
||||
auto parent = findParentComponentOfClass<ProjectContentComponent>();
|
||||
parent->rebuildProjectTabs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isLoggedIn;
|
||||
|
|
@ -443,6 +480,7 @@ private:
|
|||
ScopedPointer<TextButton> subscribeButton;
|
||||
ScopedPointer<TextButton> signInButton;
|
||||
ScopedPointer<TextButton> switchAccountButton;
|
||||
ScopedPointer<TextButton> downloadButton;
|
||||
};
|
||||
|
||||
struct EnableBuildComp : public Component
|
||||
|
|
@ -476,11 +514,6 @@ struct EnableBuildComp : public Component
|
|||
//==============================================================================
|
||||
Component* ProjectContentComponent::createBuildTab (CompileEngineChildProcess* child)
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
ignoreUnused (child);
|
||||
return new ProjucerDisabledComp ("Linux support is still under development - "
|
||||
"please check for updates at www.juce.com!", false, false, false, false);
|
||||
#else
|
||||
if (child != nullptr)
|
||||
{
|
||||
child->crashHandler = [this] (const String& m) { this->handleCrash (m); };
|
||||
|
|
@ -489,31 +522,61 @@ Component* ProjectContentComponent::createBuildTab (CompileEngineChildProcess* c
|
|||
}
|
||||
|
||||
jassert (project != nullptr);
|
||||
|
||||
const auto osType = SystemStats::getOperatingSystemType();
|
||||
const bool isMac = (osType & SystemStats::MacOSX) != 0;
|
||||
const bool isWin = (osType & SystemStats::Windows) != 0;
|
||||
const bool isLinux = (osType & SystemStats::Linux) != 0;
|
||||
|
||||
if (! isMac && ! isWin && ! isLinux)
|
||||
return createDisabledBuildTabInfoOnly (
|
||||
"Live-build features are not supported on your system.\n\n"
|
||||
"Please check supported platforms at www.juce.com!");
|
||||
|
||||
if (isLinux)
|
||||
return createDisabledBuildTabInfoOnly (
|
||||
"Live-build features for Linux are under development.\n\n"
|
||||
"Please check for updates at www.juce.com!");
|
||||
|
||||
if (isMac)
|
||||
if (osType < SystemStats::MacOSX_10_9)
|
||||
return createDisabledBuildTabInfoOnly (
|
||||
"Live-build features are available only on MacOSX 10.9 or higher.");
|
||||
|
||||
if (isWin)
|
||||
if (! SystemStats::isOperatingSystem64Bit() || osType < SystemStats::Windows8_0)
|
||||
return createDisabledBuildTabInfoOnly (
|
||||
"Live-build features are available only on 64-Bit Windows 8 or higher.");
|
||||
|
||||
const auto& unlockStatus = *ProjucerLicenses::getInstance();
|
||||
|
||||
if (unlockStatus.hasLiveCodingLicence())
|
||||
{
|
||||
jassert (unlockStatus.isLoggedIn());
|
||||
jassert (unlockStatus.isDLLPresent());
|
||||
return new EnableBuildComp();
|
||||
}
|
||||
if (! unlockStatus.hasLiveCodingLicence())
|
||||
return createDisabledBuildTabSubscribe(unlockStatus.isLoggedIn(),
|
||||
unlockStatus.isDLLPresent());
|
||||
|
||||
return createDisabledBuildTab(unlockStatus.isLoggedIn(),
|
||||
unlockStatus.isDLLPresent());
|
||||
#endif
|
||||
jassert (unlockStatus.isLoggedIn());
|
||||
jassert (unlockStatus.isDLLPresent());
|
||||
return new EnableBuildComp();
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
Component* ProjectContentComponent::createDisabledBuildTab(bool loggedIn, bool dllPresent) {
|
||||
Component* ProjectContentComponent::createDisabledBuildTabSubscribe(bool loggedIn, bool dllPresent)
|
||||
{
|
||||
bool showSubscribeButton = true;
|
||||
bool showSignInButton = dllPresent && ! loggedIn;
|
||||
bool showSwitchAccountButton = dllPresent && loggedIn;
|
||||
bool showDownloadButton = ! dllPresent;
|
||||
|
||||
return new ProjucerDisabledComp (
|
||||
"Subscribe to JUCE Pro or Indie to use the Projucer's live-build features:",
|
||||
loggedIn, showSubscribeButton, showSignInButton, showSwitchAccountButton);
|
||||
loggedIn, showSubscribeButton, showSignInButton, showSwitchAccountButton, showDownloadButton);
|
||||
}
|
||||
|
||||
Component* ProjectContentComponent::createDisabledBuildTabInfoOnly(const char* message)
|
||||
{
|
||||
return new ProjucerDisabledComp (message, false, false, false, false, false);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
BuildTabComponent* findBuildTab (const TabbedComponent& tabs)
|
||||
{
|
||||
return dynamic_cast<BuildTabComponent*> (tabs.getTabContentComponent (2));
|
||||
|
|
@ -1527,7 +1590,7 @@ void ProjectContentComponent::handleMissingSystemHeaders()
|
|||
createProjectTabs();
|
||||
|
||||
bool isLoggedIn = ProjucerLicenses::getInstance()->isLoggedIn();
|
||||
ProjucerDisabledComp* buildTab = new ProjucerDisabledComp (tabMessage, isLoggedIn, false, false, false);
|
||||
ProjucerDisabledComp* buildTab = new ProjucerDisabledComp (tabMessage, isLoggedIn, false, false, false, false);
|
||||
|
||||
treeViewTabs.addTab ("Build", Colours::transparentBlack, buildTab, true);
|
||||
showBuildTab();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue