GUI: fix recent file regression
This commit is contained in:
parent
f7a9b3fca9
commit
45783e7797
|
@ -6689,6 +6689,14 @@ bool FurnaceGUI::init() {
|
||||||
syncSettings();
|
syncSettings();
|
||||||
syncTutorial();
|
syncTutorial();
|
||||||
|
|
||||||
|
recentFile.clear();
|
||||||
|
for (int i=0; i<settings.maxRecentFile; i++) {
|
||||||
|
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
||||||
|
if (!r.empty()) {
|
||||||
|
recentFile.push_back(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!settings.persistFadeOut) {
|
if (!settings.persistFadeOut) {
|
||||||
audioExportOptions.loops=settings.exportLoops;
|
audioExportOptions.loops=settings.exportLoops;
|
||||||
audioExportOptions.fadeOut=settings.exportFadeOut;
|
audioExportOptions.fadeOut=settings.exportFadeOut;
|
||||||
|
@ -7271,14 +7279,6 @@ void FurnaceGUI::syncState() {
|
||||||
xyOscThickness=e->getConfFloat("xyOscThickness",2.0f);
|
xyOscThickness=e->getConfFloat("xyOscThickness",2.0f);
|
||||||
|
|
||||||
cvHiScore=e->getConfInt("cvHiScore",25000);
|
cvHiScore=e->getConfInt("cvHiScore",25000);
|
||||||
|
|
||||||
recentFile.clear();
|
|
||||||
for (int i=0; i<settings.maxRecentFile; i++) {
|
|
||||||
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
|
||||||
if (!r.empty()) {
|
|
||||||
recentFile.push_back(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::commitState(DivConfig& conf) {
|
void FurnaceGUI::commitState(DivConfig& conf) {
|
||||||
|
|
|
@ -2806,6 +2806,8 @@ class FurnaceGUI {
|
||||||
void resetColors();
|
void resetColors();
|
||||||
void resetKeybinds();
|
void resetKeybinds();
|
||||||
|
|
||||||
|
void purgeBackups(int year, int month, int day);
|
||||||
|
|
||||||
void readConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL);
|
void readConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL);
|
||||||
void writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL);
|
void writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups=GUI_SETTINGS_ALL);
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,10 @@ String stripName(String what) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::purgeBackups(int year, int month, int day) {
|
||||||
|
refreshBackups=true;
|
||||||
|
}
|
||||||
|
|
||||||
void FurnaceGUI::promptKey(int which) {
|
void FurnaceGUI::promptKey(int which) {
|
||||||
bindSetTarget=which;
|
bindSetTarget=which;
|
||||||
bindSetActive=true;
|
bindSetActive=true;
|
||||||
|
@ -4030,14 +4034,16 @@ void FurnaceGUI::drawSettings() {
|
||||||
CONFIG_SUBSECTION("Backup Management");
|
CONFIG_SUBSECTION("Backup Management");
|
||||||
bool purgeDateChanged=false;
|
bool purgeDateChanged=false;
|
||||||
|
|
||||||
ImGui::Text("Delete before (year/month/day):");
|
ImGui::AlignTextToFramePadding();
|
||||||
ImGui::SetNextItemWidth(80.0f*dpiScale);
|
ImGui::Text("Purge before:");
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(60.0f*dpiScale);
|
||||||
if (ImGui::InputInt("##PYear",&purgeYear,0,0)) purgeDateChanged=true;
|
if (ImGui::InputInt("##PYear",&purgeYear,0,0)) purgeDateChanged=true;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(60.0f*dpiScale);
|
ImGui::SetNextItemWidth(40.0f*dpiScale);
|
||||||
if (ImGui::InputInt("##PMonth",&purgeMonth,0,0)) purgeDateChanged=true;
|
if (ImGui::InputInt("##PMonth",&purgeMonth,0,0)) purgeDateChanged=true;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(60.0f*dpiScale);
|
ImGui::SetNextItemWidth(40.0f*dpiScale);
|
||||||
if (ImGui::InputInt("##PDay",&purgeDay,0,0)) purgeDateChanged=true;
|
if (ImGui::InputInt("##PDay",&purgeDay,0,0)) purgeDateChanged=true;
|
||||||
|
|
||||||
if (purgeDateChanged) {
|
if (purgeDateChanged) {
|
||||||
|
@ -4103,11 +4109,12 @@ void FurnaceGUI::drawSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Button("Go##PDate");
|
if (ImGui::Button("Go##PDate")) {
|
||||||
|
purgeBackups(purgeYear,purgeMonth,purgeDay);
|
||||||
ImGui::Button("Delete all");
|
}
|
||||||
|
|
||||||
backupEntryLock.lock();
|
backupEntryLock.lock();
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
if (totalBackupSize>=(1ULL<<50ULL)) {
|
if (totalBackupSize>=(1ULL<<50ULL)) {
|
||||||
ImGui::Text("%" PRIu64 "PB used",totalBackupSize>>50);
|
ImGui::Text("%" PRIu64 "PB used",totalBackupSize>>50);
|
||||||
} else if (totalBackupSize>=(1ULL<<40ULL)) {
|
} else if (totalBackupSize>=(1ULL<<40ULL)) {
|
||||||
|
@ -4122,6 +4129,16 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImGui::Text("%" PRIu64 " bytes used",totalBackupSize);
|
ImGui::Text("%" PRIu64 " bytes used",totalBackupSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
if (ImGui::Button("Refresh")) {
|
||||||
|
refreshBackups=true;
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Delete all")) {
|
||||||
|
purgeBackups(0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTable("BackupList",3,ImGuiTableFlags_ScrollY|ImGuiTableFlags_Borders)) {
|
if (ImGui::BeginTable("BackupList",3,ImGuiTableFlags_ScrollY|ImGuiTableFlags_Borders)) {
|
||||||
ImGui::TableSetupColumn("Name",ImGuiTableColumnFlags_WidthStretch,0.6f);
|
ImGui::TableSetupColumn("Name",ImGuiTableColumnFlags_WidthStretch,0.6f);
|
||||||
ImGui::TableSetupColumn("Size",ImGuiTableColumnFlags_WidthStretch,0.15f);
|
ImGui::TableSetupColumn("Size",ImGuiTableColumnFlags_WidthStretch,0.15f);
|
||||||
|
@ -4156,9 +4173,11 @@ void FurnaceGUI::drawSettings() {
|
||||||
backupEntryLock.unlock();
|
backupEntryLock.unlock();
|
||||||
if (refreshBackups) {
|
if (refreshBackups) {
|
||||||
refreshBackups=false;
|
refreshBackups=false;
|
||||||
|
if (backupEntryTask.valid()) backupEntryTask.get();
|
||||||
backupEntryTask=std::async(std::launch::async,[this]() -> bool {
|
backupEntryTask=std::async(std::launch::async,[this]() -> bool {
|
||||||
backupEntryLock.lock();
|
backupEntryLock.lock();
|
||||||
backupEntries.clear();
|
backupEntries.clear();
|
||||||
|
totalBackupSize=0;
|
||||||
backupEntryLock.unlock();
|
backupEntryLock.unlock();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -5665,6 +5684,14 @@ bool FurnaceGUI::importConfig(String path) {
|
||||||
syncState();
|
syncState();
|
||||||
syncSettings();
|
syncSettings();
|
||||||
commitSettings();
|
commitSettings();
|
||||||
|
|
||||||
|
recentFile.clear();
|
||||||
|
for (int i=0; i<settings.maxRecentFile; i++) {
|
||||||
|
String r=e->getConfString(fmt::sprintf("recentFile%d",i),"");
|
||||||
|
if (!r.empty()) {
|
||||||
|
recentFile.push_back(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue