Cruft removal.

This commit is contained in:
casey langen 2023-04-20 11:44:39 -07:00
parent f017955fe6
commit bbd137bbf9
2 changed files with 1 additions and 42 deletions

View File

@ -168,8 +168,6 @@ SettingsLayout::SettingsLayout(
, indexer(library->Indexer())
, playback(playback) {
this->prefs = Preferences::ForComponent(core::prefs::components::Settings);
this->piggyClient = PiggyWebSocketClient::Instance(&MessageQueue());
this->piggyClient->StateChanged.connect(this, &SettingsLayout::OnPiggyClientStateChange);
this->UpdateServerAvailability();
this->InitializeWindows();
}
@ -178,18 +176,6 @@ SettingsLayout::~SettingsLayout() {
updateCheck.Cancel();
}
void SettingsLayout::OnPiggyClientStateChange(
PiggyWebSocketClient* client,
PiggyWebSocketClient::State newState,
PiggyWebSocketClient::State oldState)
{
/* trigger a redraw on the main thread */
using State = PiggyWebSocketClient::State;
if (newState == State::Connected || newState == State::Disconnected) {
this->Post(core::message::EnvironmentUpdated);
}
}
void SettingsLayout::OnCheckboxChanged(cursespp::Checkbox* cb, bool checked) {
if (cb == syncOnStartupCheckbox.get()) {
this->prefs->SetBool(core::prefs::keys::SyncOnStartup, checked);
@ -587,13 +573,6 @@ void SettingsLayout::OnRemovedFromParent(IWindow* parent) {
MessageQueue().UnregisterForBroadcasts(this);
}
void SettingsLayout::ProcessMessage(musik::core::runtime::IMessage &message) {
LayoutBase::ProcessMessage(message);
if (message.Type() == core::message::EnvironmentUpdated) {
this->LoadPreferences();
}
}
void SettingsLayout::LoadPreferences() {
this->syncOnStartupCheckbox->SetChecked(this->prefs->GetBool(core::prefs::keys::SyncOnStartup, true));
this->removeCheckbox->SetChecked(this->prefs->GetBool(core::prefs::keys::RemoveMissingFiles, true));
@ -664,16 +643,7 @@ void SettingsLayout::LoadPreferences() {
this->remoteLibraryLayout->LoadPreferences();
/* version, status */
std::string piggyStatus = "";
if (this->piggyAvailable) {
if (this->piggyClient->ConnectionState() == PiggyWebSocketClient::State::Connected) {
piggyStatus = " (oo)";
}
else {
piggyStatus = " (..)";
}
}
std::string version = u8fmt("%s %s%s", MUSIKCUBE_VERSION, MUSIKCUBE_VERSION_COMMIT_HASH, piggyStatus.c_str());
std::string version = u8fmt("%s %s", MUSIKCUBE_VERSION, MUSIKCUBE_VERSION_COMMIT_HASH);
this->appVersion->SetText(u8fmt(_TSTR("console_version"), version.c_str()));
this->Layout();
@ -681,5 +651,4 @@ void SettingsLayout::LoadPreferences() {
void SettingsLayout::UpdateServerAvailability() {
this->serverAvailable = !!ServerOverlay::FindServerPlugin().get();
this->piggyAvailable = this->prefs->GetBool(core::prefs::keys::PiggyEnabled, false);
}

View File

@ -49,7 +49,6 @@
#include <musikcore/audio/PlaybackService.h>
#include <musikcore/audio/MasterTransport.h>
#include <musikcore/library/MasterLibrary.h>
#include <musikcore/net/PiggyWebSocketClient.h>
#include <musikcore/support/Preferences.h>
#include <app/window/TrackListView.h>
@ -69,7 +68,6 @@ namespace musik { namespace cube {
{
public:
using MasterLibraryPtr = std::shared_ptr<musik::core::library::MasterLibrary>;
using PiggyWebSocketClient = musik::core::net::PiggyWebSocketClient;
DELETE_COPY_AND_ASSIGNMENT_DEFAULTS(SettingsLayout)
@ -84,7 +82,6 @@ namespace musik { namespace cube {
void OnVisibilityChanged(bool visible) override;
void OnAddedToParent(IWindow* parent) override;
void OnRemovedFromParent(IWindow* parent) override;
void ProcessMessage(musik::core::runtime::IMessage &message) override;
void OnLayout() override;
/* ITopLevelLayout */
@ -112,11 +109,6 @@ namespace musik { namespace cube {
void OnLastFmDropdownActivate(cursespp::TextLabel* label);
void OnAdvancedSettingsActivate(cursespp::TextLabel* label);
void OnPiggyClientStateChange(
PiggyWebSocketClient* client,
PiggyWebSocketClient::State newState,
PiggyWebSocketClient::State oldState);
cursespp::App& app;
MasterLibraryPtr library;
musik::core::IIndexer* indexer;
@ -150,10 +142,8 @@ namespace musik { namespace cube {
std::shared_ptr<LocalLibrarySettingsLayout> localLibraryLayout;
std::shared_ptr<RemoteLibrarySettingsLayout> remoteLibraryLayout;
std::shared_ptr<PiggyWebSocketClient> piggyClient;
UpdateCheck updateCheck;
bool serverAvailable = false;
bool piggyAvailable = false;
};
} }