mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-19 06:40:34 +00:00
RemoteLibrarySettingsLayout has been blocked out, but is not functional.
This commit is contained in:
parent
20f2b08a67
commit
cf522a5bb9
@ -40,15 +40,28 @@
|
||||
#include <cursespp/Colors.h>
|
||||
#include <core/support/PreferenceKeys.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace musik;
|
||||
using namespace musik::core;
|
||||
using namespace musik::core::sdk;
|
||||
using namespace musik::cube;
|
||||
using namespace cursespp;
|
||||
|
||||
static inline size_t longestStringLength(const std::vector<std::string>&& keys) {
|
||||
size_t max = 0;
|
||||
for (auto& str: keys) {
|
||||
size_t len = u8cols(_TSTR(str));
|
||||
max = len > max ? len : max;
|
||||
}
|
||||
return max;
|
||||
}
|
||||
|
||||
RemoteLibrarySettingsLayout::RemoteLibrarySettingsLayout(musik::core::ILibraryPtr library)
|
||||
: LayoutBase()
|
||||
, library(library) {
|
||||
this->prefs = Preferences::ForComponent(core::prefs::components::Settings);
|
||||
this->SetFocusMode(FocusModeTerminating);
|
||||
this->InitializeWindows();
|
||||
}
|
||||
@ -57,17 +70,55 @@ RemoteLibrarySettingsLayout::~RemoteLibrarySettingsLayout() {
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::OnLayout() {
|
||||
size_t labelWidth = longestStringLength({
|
||||
"settings_library_type_remote_hostname",
|
||||
"settings_library_type_remote_port",
|
||||
"settings_library_type_remote_password"
|
||||
});
|
||||
|
||||
int cx = this->GetWidth();
|
||||
int inputWidth = std::min((int) 32, (int) (cx - labelWidth - 1));
|
||||
int y = 0;
|
||||
this->hostLabel->MoveAndResize(0, y, labelWidth, 1);
|
||||
this->hostInput->MoveAndResize(labelWidth + 1, y++, inputWidth, 1);
|
||||
this->portLabel->MoveAndResize(0, y, labelWidth, 1);
|
||||
this->portInput->MoveAndResize(labelWidth + 1, y++, 5, 1);
|
||||
this->pwLabel->MoveAndResize(0, y, labelWidth, 1);
|
||||
this->pwInput->MoveAndResize(labelWidth + 1, y++, inputWidth, 1);
|
||||
this->ipv6Cb->MoveAndResize(0, y++, cx, 1);
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::InitializeWindows() {
|
||||
this->SetFrameVisible(false);
|
||||
|
||||
// int order = 0;
|
||||
// this->browseList->SetFocusOrder(order++);
|
||||
// this->addedPathsList->SetFocusOrder(order++);
|
||||
this->hostLabel.reset(new TextLabel());
|
||||
this->hostLabel->SetText(_TSTR("settings_library_type_remote_hostname"), text::AlignRight);
|
||||
this->hostInput.reset(new TextInput(TextInput::StyleLine));
|
||||
|
||||
// this->AddWindow(this->browseList);
|
||||
// this->AddWindow(this->addedPathsList);
|
||||
this->portLabel.reset(new TextLabel());
|
||||
this->portLabel->SetText(_TSTR("settings_library_type_remote_port"), text::AlignRight);
|
||||
this->portInput.reset(new TextInput(TextInput::StyleLine));
|
||||
|
||||
this->pwLabel.reset(new TextLabel());
|
||||
this->pwLabel->SetText(_TSTR("settings_library_type_remote_password"), text::AlignRight);
|
||||
this->pwInput.reset(new TextInput(TextInput::StyleLine));
|
||||
|
||||
this->ipv6Cb.reset(new Checkbox());
|
||||
this->ipv6Cb->SetText(_TSTR("settings_server_use_ipv6"));
|
||||
|
||||
this->AddWindow(this->hostLabel);
|
||||
this->AddWindow(this->hostInput);
|
||||
this->AddWindow(this->portLabel);
|
||||
this->AddWindow(this->portInput);
|
||||
this->AddWindow(this->pwLabel);
|
||||
this->AddWindow(this->pwInput);
|
||||
this->AddWindow(this->ipv6Cb);
|
||||
|
||||
int order = 0;
|
||||
this->hostInput->SetFocusOrder(order++);
|
||||
this->portInput->SetFocusOrder(order++);
|
||||
this->pwInput->SetFocusOrder(order++);
|
||||
this->ipv6Cb->SetFocusOrder(order++);
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::OnVisibilityChanged(bool visible) {
|
||||
@ -75,7 +126,13 @@ void RemoteLibrarySettingsLayout::OnVisibilityChanged(bool visible) {
|
||||
if (visible) {
|
||||
this->LoadPreferences();
|
||||
}
|
||||
else {
|
||||
this->SavePreferences();
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::LoadPreferences() {
|
||||
}
|
||||
|
||||
void RemoteLibrarySettingsLayout::SavePreferences() {
|
||||
}
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include <cursespp/LayoutBase.h>
|
||||
#include <cursespp/TextLabel.h>
|
||||
#include <cursespp/TextInput.h>
|
||||
#include <cursespp/Checkbox.h>
|
||||
#include <core/library/ILibrary.h>
|
||||
#include <core/support/Preferences.h>
|
||||
|
||||
@ -54,9 +56,13 @@ namespace musik { namespace cube {
|
||||
private:
|
||||
void InitializeWindows();
|
||||
void LoadPreferences();
|
||||
void SavePreferences();
|
||||
|
||||
musik::core::ILibraryPtr library;
|
||||
|
||||
std::shared_ptr<musik::core::Preferences> prefs;
|
||||
std::shared_ptr<cursespp::TextLabel> portLabel, hostLabel, pwLabel;
|
||||
std::shared_ptr<cursespp::TextInput> portInput, hostInput, pwInput;
|
||||
std::shared_ptr<cursespp::Checkbox> ipv6Cb;
|
||||
};
|
||||
} }
|
||||
|
@ -334,7 +334,7 @@ void SettingsLayout::OnLayout() {
|
||||
}
|
||||
else {
|
||||
this->localLibraryLayout->Hide();
|
||||
this->remoteLibraryLayout->MoveAndResize(2, 3, cx - 4, 5);
|
||||
this->remoteLibraryLayout->MoveAndResize(2, 3, cx - 4, 4);
|
||||
libraryLayout = this->remoteLibraryLayout;
|
||||
}
|
||||
libraryLayout->Show();
|
||||
|
@ -108,9 +108,9 @@
|
||||
"settings_library_type": "library type: ",
|
||||
"settings_library_type_local": "local",
|
||||
"settings_library_type_remote": "remote",
|
||||
"settings_library_type_remote_hostname": "hostname",
|
||||
"settings_library_type_remote_port": "port",
|
||||
"settings_library_type_remote_password": "password",
|
||||
"settings_library_type_remote_hostname": "hostname:",
|
||||
"settings_library_type_remote_port": "port:",
|
||||
"settings_library_type_remote_password": "password:",
|
||||
"settings_library_type_overlay_title": "library type",
|
||||
|
||||
"settings_preamp": "preamp and replaygain",
|
||||
|
Loading…
x
Reference in New Issue
Block a user