)", nullptr, nullptr, nullptr); // Ignore errors.
sqlite3_exec(db, R"(
- CREATE TABLE IF NOT EXISTS match (match INTEGER PRIMARY KEY, description VARCHAR);
+ CREATE TABLE IF NOT EXISTS match (match INTEGER PRIMARY KEY, description VARCHAR, video_filename VARCHAR, gender_rule_a BOOLEAN DEFAULT false, gender_pull_rule BOOLEAN DEFAULT false);
)", nullptr, nullptr, nullptr); // Ignore errors.
sqlite3_exec(db, R"(
}
// Insert the new row into the database.
- ret = sqlite3_prepare_v2(db, "INSERT INTO match (description) VALUES (?)", -1, &stmt, 0);
+ ret = sqlite3_prepare_v2(db, "INSERT INTO match (description, gender_rule_a, gender_pull_rule) VALUES (?, COALESCE((SELECT gender_rule_a FROM match ORDER BY match DESC LIMIT 1),false), COALESCE((SELECT gender_pull_rule FROM match ORDER BY match DESC LIMIT 1),false))", -1, &stmt, 0);
if (ret != SQLITE_OK) {
fprintf(stderr, "INSERT prepare: %s\n", sqlite3_errmsg(db));
abort();
QApplication app(argc, argv);
sqlite3 *db = open_db("ultimate.db");
- // TODO: do this on-demand instead, from a menu
- export_to_json(db, "ultimate.json");
-
int requested_match = -1;
if (argc >= 2) {
requested_match = atoi(argv[1]);
}
MainWindow mainWindow(new EventsModel(db, match_id), new PlayersModel(db),
- new FormationsModel(db, true), new FormationsModel(db, false));
+ new FormationsModel(db, true), new FormationsModel(db, false),
+ db, match_id);
mainWindow.resize(QSize(1280, 720));
mainWindow.show();
- return app.exec();
+ int ret = app.exec();
+ return ret;
}