void StoredSettings::reload()
{
    propertyFiles.clear();
    propertyFiles.add (createPropsFile ("Introjucer"));

    ScopedPointer<XmlElement> projectDefaultsXml (propertyFiles.getFirst()->getXmlValue ("PROJECT_DEFAULT_SETTINGS"));

    if (projectDefaultsXml != nullptr)
        projectDefaults = ValueTree::fromXml (*projectDefaultsXml);

    // recent files...
    recentFiles.restoreFromString (getGlobalProperties().getValue ("recentFiles"));
    recentFiles.removeNonExistentFiles();

    ScopedPointer<XmlElement> xml (getGlobalProperties().getXmlValue ("editorColours"));

    if (xml == nullptr)
    {
        xml = XmlDocument::parse (BinaryData::colourscheme_dark_xml);
        jassert (xml != nullptr);
    }

    appearance.readFromXML (*xml);

    appearance.updateColourScheme();
    loadSwatchColours();
}
void StoredSettings::updateKeyMappings()
{
    getGlobalProperties().removeValue ("keyMappings");

    if (ApplicationCommandManager* commandManager = IntrojucerApp::getApp().commandManager)
    {
        const ScopedPointer<XmlElement> keys (commandManager->getKeyMappings()->createXml (true));

        if (keys != nullptr)
            getGlobalProperties().setValue ("keyMappings", keys);
    }
}
Exemplo n.º 3
0
void ProjucerApplication::showLoginFormAsyncIfNotTriedRecently()
{
    if (ProjucerLicences::getInstance()->isDLLPresent())
    {
        Time lastLoginAttempt (getGlobalProperties().getValue ("lastLoginAttemptTime").getIntValue() * (int64) 1000);

        if (Time::getCurrentTime().getDayOfMonth() != lastLoginAttempt.getDayOfMonth())
            startTimer (1000);
    }
    else
    {
        getGlobalProperties().removeValue ("lastLoginAttemptTime");
    }
}
Exemplo n.º 4
0
void StoredSettings::saveSwatchColours()
{
    PropertiesFile& props = getGlobalProperties();

    for (int i = 0; i < swatchColours.size(); ++i)
        props.setValue ("swatchColour" + String (i), swatchColours.getReference(i).toString());
}
Exemplo n.º 5
0
void ProjucerApplication::showLoginForm()
{
    if (ProjucerLicences::getInstance()->isDLLPresent())
    {
        jassert (MessageManager::getInstance()->isThisTheMessageThread());

        if (loginForm != nullptr)
            return;

        DialogWindow::LaunchOptions lo;

        lo.dialogTitle = "Log-in to Projucer";
        lo.dialogBackgroundColour = Colour (0xffdddddd);
        lo.content.setOwned (loginForm = new LoginForm());
        lo.escapeKeyTriggersCloseButton = true;
        lo.componentToCentreAround = nullptr;
        lo.escapeKeyTriggersCloseButton = true;
        lo.resizable = false;
        lo.useBottomRightCornerResizer = false;
        lo.useNativeTitleBar = true;

        lo.launchAsync();

        getGlobalProperties().setValue ("lastLoginAttemptTime",
                                        (int) (Time::getCurrentTime().toMilliseconds() / 1000));
    }
}
Exemplo n.º 6
0
void StoredSettings::setLastProjects (const Array<File>& files)
{
    StringArray s;
    for (int i = 0; i < files.size(); ++i)
        s.add (files.getReference(i).getFullPathName());

    getGlobalProperties().setValue ("lastProjects", s.joinIntoString ("|"));
}
Exemplo n.º 7
0
Array<File> StoredSettings::getLastProjects()
{
    StringArray s;
    s.addTokens (getGlobalProperties().getValue ("lastProjects"), "|", "");

    Array<File> f;
    for (int i = 0; i < s.size(); ++i)
        f.add (File (s[i]));

    return f;
}
Exemplo n.º 8
0
void MainWindow::restoreWindowPosition()
{
    String windowState;

    if (currentProject != nullptr)
        windowState = currentProject->getStoredProperties().getValue (getProjectWindowPosName());

    if (windowState.isEmpty())
        windowState = getGlobalProperties().getValue ("lastMainWindowPos");

    restoreWindowStateFromString (windowState);
}
Exemplo n.º 9
0
void ProjucerApplication::setCurrentEULAAccepted (bool hasBeenAccepted) const
{
    const String checksum (getEULAChecksumProperty());
    auto& globals = getGlobalProperties();

    if (hasBeenAccepted)
        globals.setValue (checksum, 1);
    else
        globals.removeValue (checksum);

    globals.saveIfNeeded();
}
Exemplo n.º 10
0
MainWindow::~MainWindow()
{
   #if ! JUCE_MAC
    setMenuBar (nullptr);
   #endif

    removeKeyListener (ProjucerApplication::getCommandManager().getKeyMappings());

    // save the current size and position to our settings file..
    getGlobalProperties().setValue ("lastMainWindowPos", getWindowStateAsString());

    clearContentComponent();
    currentProject = nullptr;
}
Exemplo n.º 11
0
//==============================================================================
MainWindow::MainWindow()
    : DocumentWindow (ProjucerApplication::getApp().getApplicationName(),
                      ProjucerApplication::getApp().lookAndFeel.getCurrentColourScheme()
                                                   .getUIColour (LookAndFeel_V4::ColourScheme::UIColour::windowBackground),
                      DocumentWindow::allButtons,
                      false)
{
    setUsingNativeTitleBar (true);

   #if ! JUCE_MAC
    setMenuBar (ProjucerApplication::getApp().getMenuModel());
   #endif

    createProjectContentCompIfNeeded();

    setResizable (true, false);
    centreWithSize (800, 600);

    ApplicationCommandManager& commandManager = ProjucerApplication::getCommandManager();

    // Register all the app commands..
    commandManager.registerAllCommandsForTarget (this);
    commandManager.registerAllCommandsForTarget (getProjectContentComponent());

    // update key mappings..
    {
        commandManager.getKeyMappings()->resetToDefaultMappings();

        ScopedPointer<XmlElement> keys (getGlobalProperties().getXmlValue ("keyMappings"));

        if (keys != nullptr)
            commandManager.getKeyMappings()->restoreFromXml (*keys);

        addKeyListener (commandManager.getKeyMappings());
    }

    // don't want the window to take focus when the title-bar is clicked..
    setWantsKeyboardFocus (false);

    getLookAndFeel().setColour (ColourSelector::backgroundColourId, Colours::transparentBlack);

    projectNameValue.addListener (this);

    setResizeLimits (600, 500, 32000, 32000);
}
Exemplo n.º 12
0
void StoredSettings::updateGlobalProps()
{
    PropertiesFile& props = getGlobalProperties();

    {
        const ScopedPointer<XmlElement> xml (appearance.settings.createXml());
        props.setValue ("editorColours", xml);
    }

    props.setValue ("recentFiles", recentFiles.toString());

    props.removeValue ("keyMappings");

    if (ApplicationCommandManager* commandManager = IntrojucerApp::getApp().commandManager)
    {
        const ScopedPointer <XmlElement> keys (commandManager->getKeyMappings()->createXml (true));

        if (keys != nullptr)
            props.setValue ("keyMappings", keys);
    }
}
Exemplo n.º 13
0
//==============================================================================
void StoredSettings::loadSwatchColours()
{
    swatchColours.clear();

    #define COL(col)  Colours::col,

    const Colour colours[] =
    {
        #include "jucer_Colours.h"
        Colours::transparentBlack
    };

    #undef COL

    const int numSwatchColours = 24;
    PropertiesFile& props = getGlobalProperties();

    for (int i = 0; i < numSwatchColours; ++i)
        swatchColours.add (Colour::fromString (props.getValue ("swatchColour" + String (i),
                                                               colours [2 + i].toString())));
}
Exemplo n.º 14
0
File AppearanceSettings::getSchemesFolder()
{
    File f (getGlobalProperties().getFile().getSiblingFile ("Schemes"));
    f.createDirectory();
    return f;
}
Exemplo n.º 15
0
bool ProjucerApplication::currentEULAHasBeenAcceptedPreviously() const
{
    return getGlobalProperties().getValue (getEULAChecksumProperty()).getIntValue() != 0;
}
void StoredSettings::updateAppearanceSettings()
{
    const ScopedPointer<XmlElement> xml (appearance.settings.createXml());
    getGlobalProperties().setValue ("editorColours", xml);
}
void StoredSettings::updateRecentFiles()
{
    getGlobalProperties().setValue ("recentFiles", recentFiles.toString());
}