* improved appended firmware detection [devinacker]
* added dynamic rate control support to ALSA and PulseAudio drivers [RedDwarf]
* added option to use native file dialogs
This commit is contained in:
byuu
2020-02-23 20:23:25 +09:00
parent c13745d753
commit d2211d8818
63 changed files with 1091 additions and 1154 deletions

View File

@@ -12,8 +12,8 @@ auto AboutDialog::setAlignment(sWindow relativeTo, Alignment alignment) -> type&
return *this;
}
auto AboutDialog::setAuthor(const string& author) -> type& {
state.author = author;
auto AboutDialog::setCopyright(const string& copyright) -> type& {
state.copyright = copyright;
return *this;
}
@@ -64,7 +64,7 @@ auto AboutDialog::show() -> void {
nameLabel.setText(state.name ? state.name : Application::name());
nameLabel.setVisible((bool)state.name && !(bool)state.logo);
Canvas logoCanvas{&layout, Size{~0, 0}};
Canvas logoCanvas{&layout, Size{~0, 0}, 5_sy};
logoCanvas.setCollapsible();
if(state.logo) {
image logo{state.logo};
@@ -95,19 +95,19 @@ auto AboutDialog::show() -> void {
versionValue.setText(state.version);
if(!state.version) versionLayout.setVisible(false);
HorizontalLayout authorLayout{&layout, Size{~0, 0}, 0};
authorLayout.setCollapsible();
Label authorLabel{&authorLayout, Size{~0, 0}, 3_sx};
authorLabel.setAlignment(1.0);
authorLabel.setFont(Font().setBold());
authorLabel.setForegroundColor({0, 0, 0});
authorLabel.setText("Author:");
Label authorValue{&authorLayout, Size{~0, 0}};
authorValue.setAlignment(0.0);
authorValue.setFont(Font().setBold());
authorValue.setForegroundColor({0, 0, 0});
authorValue.setText(state.author);
if(!state.author) authorLayout.setVisible(false);
HorizontalLayout copyrightLayout{&layout, Size{~0, 0}, 0};
copyrightLayout.setCollapsible();
Label copyrightLabel{&copyrightLayout, Size{~0, 0}, 3_sx};
copyrightLabel.setAlignment(1.0);
copyrightLabel.setFont(Font().setBold());
copyrightLabel.setForegroundColor({0, 0, 0});
copyrightLabel.setText("Copyright:");
Label copyrightValue{&copyrightLayout, Size{~0, 0}};
copyrightValue.setAlignment(0.0);
copyrightValue.setFont(Font().setBold());
copyrightValue.setForegroundColor({0, 0, 0});
copyrightValue.setText(state.copyright);
if(!state.copyright) copyrightLayout.setVisible(false);
HorizontalLayout licenseLayout{&layout, Size{~0, 0}, 0};
licenseLayout.setCollapsible();
@@ -151,7 +151,7 @@ auto AboutDialog::show() -> void {
window.setTitle({"About ", state.name ? state.name : Application::name(), " ..."});
window.setBackgroundColor({255, 255, 240});
window.setSize({max(360_sx, layout.minimumSize().width()), layout.minimumSize().height()});
window.setSize({max(320_sx, layout.minimumSize().width()), layout.minimumSize().height()});
window.setResizable(false);
window.setAlignment(state.relativeTo, state.alignment);
window.setDismissable();

View File

@@ -5,7 +5,7 @@ struct AboutDialog {
auto setAlignment(Alignment = Alignment::Center) -> type&;
auto setAlignment(sWindow relativeTo, Alignment = Alignment::Center) -> type&;
auto setAuthor(const string& author = "") -> type&;
auto setCopyright(const string& copyright = "") -> type&;
auto setDescription(const string& description = "") -> type&;
auto setLicense(const string& license = "") -> type&;
auto setLogo(const image& logo = {}) -> type&;
@@ -17,7 +17,7 @@ struct AboutDialog {
private:
struct State {
Alignment alignment = Alignment::Center;
string author;
string copyright;
string description;
string license;
image logo;

View File

@@ -241,12 +241,8 @@ auto BrowserDialogWindow::run() -> BrowserDialog::Response {
return (void)window.setModal(false);
}
if(state.action == "openObject" && isObject(name)) {
if(isMatch(name)) {
response.selected.append({state.path, name});
return (void)window.setModal(false);
} else if(isFolder(name)) {
return setPath({state.path, name});
}
response.selected.append({state.path, name});
return (void)window.setModal(false);
}
if(state.action == "saveFile") return accept();
setPath(state.path, name);
@@ -417,6 +413,18 @@ auto BrowserDialogWindow::setPath(string path, const string& contains) -> void {
BrowserDialog::BrowserDialog() {
}
auto BrowserDialog::alignment() const -> Alignment {
return state.alignment;
}
auto BrowserDialog::alignmentWindow() const -> Window {
return state.relativeTo;
}
auto BrowserDialog::filters() const -> vector<string> {
return state.filters;
}
auto BrowserDialog::openFile() -> string {
state.action = "openFile";
if(!state.title) state.title = "Open File";
@@ -449,6 +457,10 @@ auto BrowserDialog::option() -> string {
return response.option;
}
auto BrowserDialog::path() const -> string {
return state.path;
}
auto BrowserDialog::saveFile() -> string {
state.action = "saveFile";
if(!state.title) state.title = "Save File";
@@ -504,6 +516,10 @@ auto BrowserDialog::setTitle(const string& title) -> type& {
return *this;
}
auto BrowserDialog::title() const -> string {
return state.title;
}
auto BrowserDialog::_run() -> vector<string> {
if(!state.path) state.path = Path::user();
response = BrowserDialogWindow(state).run();

View File

@@ -6,11 +6,15 @@ struct BrowserDialog {
using type = BrowserDialog;
BrowserDialog();
auto alignment() const -> Alignment;
auto alignmentWindow() const -> Window;
auto filters() const -> vector<string>;
auto openFile() -> string; //one existing file
auto openFiles() -> vector<string>; //any existing files
auto openFolder() -> string; //one existing folder
auto openObject() -> string; //one existing file or folder
auto option() -> string;
auto path() const -> string;
auto saveFile() -> string; //one file
auto selected() -> vector<string>;
auto selectFolder() -> string; //one existing folder
@@ -21,6 +25,7 @@ struct BrowserDialog {
auto setOptions(const vector<string>& options = {}) -> type&;
auto setPath(const string& path = "") -> type&;
auto setTitle(const string& title = "") -> type&;
auto title() const -> string;
private:
struct State {