Add savaToFile option

This commit is contained in:
2026-02-04 13:18:54 +01:00
parent e99bd33985
commit 45f73c721e
2 changed files with 24 additions and 18 deletions

View File

@@ -28,6 +28,7 @@ public:
private:
bool showSelection;
bool showStats;
bool saveToFile;
sqlite3 *db;
sqlite3_stmt *get_gen_num;
std::vector<int64_t> ids;

View File

@@ -110,7 +110,7 @@ void Vapp::update()
stageOfDrawing = DrawingStage::save;
break;
case DrawingStage::save:
drawToFile();
if(saveToFile) drawToFile();
stageOfDrawing = DrawingStage::done;
break;
case DrawingStage::done:
@@ -140,6 +140,10 @@ void Vapp::draw()
{
setUpTable();
}
if(ImGui::MenuItem("Save to File", nullptr, saveToFile, true))
{
saveToFile = !saveToFile;
}
ImGui::EndMainMenuBar();
}
@@ -335,10 +339,10 @@ void Vapp::setUpTable()
}
sql::reset(get_gen_stmt);
if(saveToFile)
{
int64_t id = ids[selected_id_index];
char buff[50];
sprintf(buff, "%ld.txt", id);
const char* buff = TextFormat("%ld.txt", id);
std::ofstream file(buff);
file << "| index | euclidean_distance | cosine_similarity | cosine_similarity_int | hamming_distance | levenshtein_distance | dot_minmax |\n";
@@ -356,6 +360,7 @@ void Vapp::setUpTable()
file << "\n";
}
}
}
sql::finalize(get_gen_stmt);
}