Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linux issue with DocumentWindow #91

Merged
merged 5 commits into from Aug 30, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -79,6 +79,7 @@ target_compile_definitions(pluginval PRIVATE
JUCE_DISPLAY_SPLASH_SCREEN=0
JUCE_MODAL_LOOPS_PERMITTED=1
JUCE_REPORT_APP_USAGE=0
JUCE_GUI_BASICS_INCLUDE_XHEADERS=1
VERSION="${CURRENT_VERSION}")

target_link_libraries(pluginval PRIVATE
Expand All @@ -90,4 +91,4 @@ target_link_libraries(pluginval PRIVATE
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(pluginval PRIVATE
-static-libstdc++)
endif()
endif()
32 changes: 16 additions & 16 deletions Source/MainComponent.h
Expand Up @@ -21,18 +21,18 @@
juce::PropertiesFile& getAppPreferences();

//==============================================================================
struct ConnectionStatus : public juce::Component,
struct ConnectionState : public juce::Component,
private juce::ChangeListener,
private Validator::Listener
{
ConnectionStatus (Validator& v)
ConnectionState (Validator& v)
: validator (v)
{
validator.addListener (this);
validator.addChangeListener (this);
}

~ConnectionStatus() override
~ConnectionState() override
{
validator.removeListener (this);
validator.removeChangeListener (this);
Expand All @@ -43,12 +43,12 @@ struct ConnectionStatus : public juce::Component,
auto r = getLocalBounds().toFloat();

g.setColour ([this] {
switch (status)
switch (state)
{
case Status::disconnected: return juce::Colours::darkred;
case Status::validating: return juce::Colours::orange;
case Status::connected:
case Status::complete: return juce::Colours::lightgreen;
case State::disconnected: return juce::Colours::darkred;
case State::validating: return juce::Colours::orange;
case State::connected:
case State::complete: return juce::Colours::lightgreen;
}

return juce::Colours::darkred;
Expand All @@ -60,7 +60,7 @@ struct ConnectionStatus : public juce::Component,
}

private:
enum class Status
enum class State
{
disconnected,
connected,
Expand All @@ -69,22 +69,22 @@ struct ConnectionStatus : public juce::Component,
};

Validator& validator;
std::atomic<Status> status { Status::disconnected };
std::atomic<State> state { State::disconnected };

void setStatus (Status newStatus)
void setState (State newStatus)
{
status = newStatus;
state = newStatus;
juce::MessageManager::callAsync ([sp = SafePointer<Component> (this)] () mutable { if (sp != nullptr) sp->repaint(); });
}

void changeListenerCallback (juce::ChangeBroadcaster*) override
{
setStatus (validator.isConnected() ? Status::connected : Status::disconnected);
setState (validator.isConnected() ? State::connected : State::disconnected);
}

void validationStarted (const juce::String&) override
{
setStatus (Status::validating);
setState (State::validating);
}

void logMessage (const juce::String&) override
Expand All @@ -97,7 +97,7 @@ struct ConnectionStatus : public juce::Component,

void allItemsComplete() override
{
setStatus (Status::complete);
setState (State::complete);
}
};

Expand Down Expand Up @@ -245,7 +245,7 @@ class MainComponent : public juce::Component,
clearButton { "Clear Log" }, saveButton { "Save Log" }, optionsButton { "Options" };
juce::Slider strictnessSlider;
juce::Label strictnessLabel { {}, "Strictness Level" };
ConnectionStatus connectionStatus { validator };
ConnectionState connectionStatus { validator };

void savePluginList();

Expand Down