2015-08-21 11:29:53 +00:00
|
|
|
ScanDialog::ScanDialog() {
|
|
|
|
scanDialog = this;
|
|
|
|
|
|
|
|
onClose(&Application::quit);
|
|
|
|
layout.setMargin(5);
|
|
|
|
pathEdit.onActivate([&] { refresh(); });
|
2016-01-07 08:14:33 +00:00
|
|
|
refreshButton.setIcon(Icon::Action::Refresh).setBordered(false).onActivate([&] {
|
2015-11-19 09:27:56 +00:00
|
|
|
pathEdit.setText(settings["icarus/Path"].text());
|
2015-08-21 11:29:53 +00:00
|
|
|
refresh();
|
|
|
|
});
|
2016-01-07 08:14:33 +00:00
|
|
|
homeButton.setIcon(Icon::Go::Home).setBordered(false).onActivate([&] {
|
2016-05-16 09:51:12 +00:00
|
|
|
pathEdit.setText(Path::user());
|
2015-08-21 11:29:53 +00:00
|
|
|
refresh();
|
|
|
|
});
|
2016-01-07 08:14:33 +00:00
|
|
|
upButton.setIcon(Icon::Go::Up).setBordered(false).onActivate([&] {
|
Update to v099r16 release (public beta).
byuu says:
Changelog:
- hiro: BrowserDialog can navigate up to drive selection on Windows
- nall: (file,path,dir,base,prefix,suffix)name =>
Location::(file,path,dir,base,prefix,suffix)
- higan/tomoko: rename audio filter label from "Sinc" to "IIR - Biquad"
- higan/tomoko: allow loading files via icarus on the command-line
once again
- higan/tomoko: (begrudging) quick hack to fix presentation window focus
on startup
- higan/audio: don't divide output audio volume by number of streams
- processor/r65816: fix a regression in (read,write)DB; fixes Taz-Mania
- fixed compilation regressions on Windows and Linux
I'm happy with where we are at with code cleanups and stability, so I'd
like to release v100. But even though I'm not assigning any special
significance to this version, we should probably test it more thoroughly
first.
2016-07-04 11:53:24 +00:00
|
|
|
pathEdit.setText(Location::dir(settings["icarus/Path"].text()));
|
2015-08-21 11:29:53 +00:00
|
|
|
refresh();
|
|
|
|
});
|
|
|
|
scanList.onActivate([&] { activate(); });
|
|
|
|
selectAllButton.setText("Select All").onActivate([&] {
|
2015-10-03 06:25:39 +00:00
|
|
|
for(auto& item : scanList.items()) {
|
2016-05-04 10:07:13 +00:00
|
|
|
if(item.checkable()) item.setChecked(true);
|
2015-10-03 06:25:39 +00:00
|
|
|
}
|
2015-08-21 11:29:53 +00:00
|
|
|
});
|
|
|
|
unselectAllButton.setText("Unselect All").onActivate([&] {
|
2015-10-03 06:25:39 +00:00
|
|
|
for(auto& item : scanList.items()) {
|
2016-05-04 10:07:13 +00:00
|
|
|
if(item.checkable()) item.setChecked(false);
|
2015-10-03 06:25:39 +00:00
|
|
|
}
|
2015-08-21 11:29:53 +00:00
|
|
|
});
|
2015-11-19 09:27:56 +00:00
|
|
|
settingsButton.setText("Settings ...").onActivate([&] {
|
|
|
|
settingsDialog->setCentered(*this);
|
|
|
|
settingsDialog->setVisible();
|
|
|
|
settingsDialog->setFocused();
|
2015-08-21 11:29:53 +00:00
|
|
|
});
|
|
|
|
importButton.setText("Import ...").onActivate([&] { import(); });
|
|
|
|
|
|
|
|
setTitle("icarus");
|
|
|
|
setSize({800, 480});
|
|
|
|
setCentered();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::show() -> void {
|
|
|
|
setVisible();
|
2015-11-19 09:27:56 +00:00
|
|
|
pathEdit.setText(settings["icarus/Path"].text());
|
2015-08-21 11:29:53 +00:00
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::refresh() -> void {
|
|
|
|
scanList.reset();
|
|
|
|
|
2016-05-16 09:51:12 +00:00
|
|
|
auto pathname = pathEdit.text().transform("\\", "/").trimRight("/").append("/");
|
2015-08-21 11:29:53 +00:00
|
|
|
if(!directory::exists(pathname)) return;
|
|
|
|
|
2015-11-19 09:27:56 +00:00
|
|
|
settings["icarus/Path"].setValue(pathname);
|
|
|
|
pathEdit.setText(pathname);
|
2015-08-21 11:29:53 +00:00
|
|
|
auto contents = directory::icontents(pathname);
|
|
|
|
|
|
|
|
for(auto& name : contents) {
|
|
|
|
if(!name.endsWith("/")) continue;
|
Update to v099r16 release (public beta).
byuu says:
Changelog:
- hiro: BrowserDialog can navigate up to drive selection on Windows
- nall: (file,path,dir,base,prefix,suffix)name =>
Location::(file,path,dir,base,prefix,suffix)
- higan/tomoko: rename audio filter label from "Sinc" to "IIR - Biquad"
- higan/tomoko: allow loading files via icarus on the command-line
once again
- higan/tomoko: (begrudging) quick hack to fix presentation window focus
on startup
- higan/audio: don't divide output audio volume by number of streams
- processor/r65816: fix a regression in (read,write)DB; fixes Taz-Mania
- fixed compilation regressions on Windows and Linux
I'm happy with where we are at with code cleanups and stability, so I'd
like to release v100. But even though I'm not assigning any special
significance to this version, we should probably test it more thoroughly
first.
2016-07-04 11:53:24 +00:00
|
|
|
if(gamePakType(Location::suffix(name))) continue;
|
2016-05-16 09:51:12 +00:00
|
|
|
scanList.append(ListViewItem().setIcon(Icon::Emblem::Folder).setText(name.trimRight("/")));
|
2015-08-21 11:29:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for(auto& name : contents) {
|
|
|
|
if(name.endsWith("/")) continue;
|
Update to v099r16 release (public beta).
byuu says:
Changelog:
- hiro: BrowserDialog can navigate up to drive selection on Windows
- nall: (file,path,dir,base,prefix,suffix)name =>
Location::(file,path,dir,base,prefix,suffix)
- higan/tomoko: rename audio filter label from "Sinc" to "IIR - Biquad"
- higan/tomoko: allow loading files via icarus on the command-line
once again
- higan/tomoko: (begrudging) quick hack to fix presentation window focus
on startup
- higan/audio: don't divide output audio volume by number of streams
- processor/r65816: fix a regression in (read,write)DB; fixes Taz-Mania
- fixed compilation regressions on Windows and Linux
I'm happy with where we are at with code cleanups and stability, so I'd
like to release v100. But even though I'm not assigning any special
significance to this version, we should probably test it more thoroughly
first.
2016-07-04 11:53:24 +00:00
|
|
|
if(!gameRomType(Location::suffix(name).downcase())) continue;
|
2016-05-04 10:07:13 +00:00
|
|
|
scanList.append(ListViewItem().setCheckable().setIcon(Icon::Emblem::File).setText(name));
|
2015-08-21 11:29:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Application::processEvents();
|
|
|
|
scanList.setFocused();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::activate() -> void {
|
|
|
|
if(auto item = scanList.selected()) {
|
2016-05-04 10:07:13 +00:00
|
|
|
string location{settings["icarus/Path"].text(), item.text()};
|
Update to v099r16 release (public beta).
byuu says:
Changelog:
- hiro: BrowserDialog can navigate up to drive selection on Windows
- nall: (file,path,dir,base,prefix,suffix)name =>
Location::(file,path,dir,base,prefix,suffix)
- higan/tomoko: rename audio filter label from "Sinc" to "IIR - Biquad"
- higan/tomoko: allow loading files via icarus on the command-line
once again
- higan/tomoko: (begrudging) quick hack to fix presentation window focus
on startup
- higan/audio: don't divide output audio volume by number of streams
- processor/r65816: fix a regression in (read,write)DB; fixes Taz-Mania
- fixed compilation regressions on Windows and Linux
I'm happy with where we are at with code cleanups and stability, so I'd
like to release v100. But even though I'm not assigning any special
significance to this version, we should probably test it more thoroughly
first.
2016-07-04 11:53:24 +00:00
|
|
|
if(directory::exists(location) && !gamePakType(Location::suffix(location))) {
|
2015-08-21 11:29:53 +00:00
|
|
|
pathEdit.setText(location);
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::import() -> void {
|
2016-07-01 11:58:12 +00:00
|
|
|
string_vector filenames;
|
2015-08-21 11:29:53 +00:00
|
|
|
for(auto& item : scanList.items()) {
|
2016-05-04 10:07:13 +00:00
|
|
|
if(item.checked()) {
|
|
|
|
filenames.append(string{settings["icarus/Path"].text(), item.text()});
|
2015-08-21 11:29:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!filenames) {
|
|
|
|
MessageDialog().setParent(*this).setText("Nothing selected to import.").error();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
setVisible(false);
|
|
|
|
importDialog->run(filenames);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::gamePakType(const string& type) -> bool {
|
|
|
|
return type == ".sys"
|
|
|
|
|| type == ".fc"
|
|
|
|
|| type == ".sfc"
|
|
|
|
|| type == ".gb"
|
|
|
|
|| type == ".gbc"
|
|
|
|
|| type == ".gba"
|
|
|
|
|| type == ".bs"
|
|
|
|
|| type == ".st";
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ScanDialog::gameRomType(const string& type) -> bool {
|
|
|
|
return type == ".zip"
|
|
|
|
|| type == ".fc" || type == ".nes"
|
|
|
|
|| type == ".sfc" || type == ".smc"
|
|
|
|
|| type == ".gb"
|
|
|
|
|| type == ".gbc"
|
|
|
|
|| type == ".gba"
|
|
|
|
|| type == ".bs"
|
|
|
|
|| type == ".st";
|
|
|
|
}
|