mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-06 03:39:50 +00:00
Remote library loading and saving correctly from settings. Phew.
This commit is contained in:
parent
d8a31e9f6d
commit
48c04fa7d1
@ -195,14 +195,13 @@ std::string WebSocketClient::EnqueueQuery(Query query) {
|
||||
}
|
||||
|
||||
void WebSocketClient::Connect(const std::string& host, short port, const std::string& password, bool ipv6) {
|
||||
std::unique_lock<decltype(this->mutex)> lock(this->mutex);
|
||||
this->Disconnect();
|
||||
auto newUri = "ws://" + host + ":" + std::to_string(port);
|
||||
if (newUri != this->uri ||
|
||||
password != this->password ||
|
||||
ipv6 != this->ipv6 ||
|
||||
this->state != State::Connected)
|
||||
{
|
||||
this->Disconnect();
|
||||
this->ipv6 = ipv6;
|
||||
this->uri = newUri;
|
||||
this->password = password;
|
||||
|
@ -137,16 +137,6 @@ void RemoteLibrarySettingsLayout::InitializeWindows() {
|
||||
this->ipv6Cb->SetFocusOrder(order++);
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::OnVisibilityChanged(bool visible) {
|
||||
LayoutBase::OnVisibilityChanged(visible);
|
||||
if (visible) {
|
||||
this->LoadPreferences();
|
||||
}
|
||||
else {
|
||||
this->SavePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::LoadPreferences() {
|
||||
auto host = prefs->GetString(core::prefs::keys::RemoteLibraryHostname, "127.0.0.1");
|
||||
auto wssPort = (short) prefs->GetInt(core::prefs::keys::RemoteLibraryWssPort, 7905);
|
||||
|
@ -48,15 +48,14 @@ namespace musik { namespace cube {
|
||||
|
||||
virtual ~RemoteLibrarySettingsLayout();
|
||||
|
||||
virtual void OnVisibilityChanged(bool visible);
|
||||
void LoadPreferences();
|
||||
void SavePreferences();
|
||||
|
||||
protected:
|
||||
virtual void OnLayout();
|
||||
|
||||
private:
|
||||
void InitializeWindows();
|
||||
void LoadPreferences();
|
||||
void SavePreferences();
|
||||
|
||||
musik::core::ILibraryPtr library;
|
||||
|
||||
|
@ -541,8 +541,12 @@ void SettingsLayout::OnVisibilityChanged(bool visible) {
|
||||
|
||||
if (visible) {
|
||||
this->LoadPreferences();
|
||||
this->remoteLibraryLayout->LoadPreferences();
|
||||
this->CheckShowFirstRunDialog();
|
||||
}
|
||||
else {
|
||||
this->remoteLibraryLayout->SavePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsLayout::OnAddedToParent(IWindow* parent) {
|
||||
|
@ -72,6 +72,7 @@ TextInput::TextInput(TextInput::Style style, IInput::InputMode inputMode)
|
||||
, inputMode(inputMode)
|
||||
, enterEnabled(true)
|
||||
, truncate(false) {
|
||||
this->SetFocusedContentColor(Color::TextFocused);
|
||||
if (style == StyleLine) {
|
||||
this->SetFrameVisible(false);
|
||||
}
|
||||
|
@ -796,6 +796,7 @@ xcopy "$(SolutionDir)src\3rdparty\bin\win\font\*.ttf" "$(TargetDir)fonts\" /Y /e
|
||||
<ClCompile Include="app\layout\NowPlayingLayout.cpp" />
|
||||
<ClCompile Include="app\layout\CategorySearchLayout.cpp" />
|
||||
<ClCompile Include="app\layout\MainLayout.cpp" />
|
||||
<ClCompile Include="app\layout\RemoteLibrarySettingsLayout.cpp" />
|
||||
<ClCompile Include="app\layout\SettingsLayout.cpp" />
|
||||
<ClCompile Include="app\layout\TrackSearchLayout.cpp" />
|
||||
<ClCompile Include="app\model\DirectoryAdapter.cpp" />
|
||||
@ -880,6 +881,7 @@ xcopy "$(SolutionDir)src\3rdparty\bin\win\font\*.ttf" "$(TargetDir)fonts\" /Y /e
|
||||
<ClInclude Include="app\layout\NowPlayingLayout.h" />
|
||||
<ClInclude Include="app\layout\CategorySearchLayout.h" />
|
||||
<ClInclude Include="app\layout\MainLayout.h" />
|
||||
<ClInclude Include="app\layout\RemoteLibrarySettingsLayout.h" />
|
||||
<ClInclude Include="app\layout\SettingsLayout.h" />
|
||||
<ClInclude Include="app\layout\TrackSearchLayout.h" />
|
||||
<ClInclude Include="app\model\DirectoryAdapter.h" />
|
||||
|
@ -201,6 +201,9 @@
|
||||
<ClCompile Include="app\overlay\SettingsOverlays.cpp">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\layout\RemoteLibrarySettingsLayout.cpp">
|
||||
<Filter>app\layout</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
@ -457,6 +460,9 @@
|
||||
<ClInclude Include="app\overlay\SettingsOverlays.h">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\layout\RemoteLibrarySettingsLayout.h">
|
||||
<Filter>app\layout</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="cursespp">
|
||||
|
Loading…
x
Reference in New Issue
Block a user