MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / varSaveSelected

Method varSaveSelected

gui/qt/mainwindow.cpp:2007–2034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2005}
2006
2007void MainWindow::varSaveSelected() {
2008 QVector<calc_var_t> selectedVars;
2009 QStringList fileNames;
2010 for (int currRow = 0; currRow < ui->emuVarView->model()->rowCount(); currRow++) {
2011 QModelIndex nameIndex = ui->emuVarView->model()->index(currRow, VarTableModel::VAR_NAME_COL);
2012 if (nameIndex.data(Qt::CheckStateRole) == Qt::Checked) {
2013 selectedVars.append(nameIndex.data(Qt::UserRole).value<calc_var_t>());
2014 }
2015 }
2016 if (selectedVars.size() < 2) {
2017 QMessageBox::warning(this, MSG_WARNING, tr("Select at least two files to group"));
2018 } else {
2019 fileNames = varDialog(QFileDialog::AcceptSave, tr("TI Group (*.8cg);;All Files (*.*)"), QStringLiteral("8cg"));
2020 if (fileNames.size() == 1) {
2021 varReceive([this, fileName = std::move(fileNames.first()), selectedVars = std::move(selectedVars)](bool isBlocked) {
2022 int status = emu_receive_variable(fileName.toUtf8(), selectedVars.constData(), selectedVars.size());
2023 if (isBlocked) {
2024 emu.unblock();
2025 }
2026 if (status != LINK_GOOD) {
2027 QMessageBox::critical(this, MSG_ERROR, tr("Transfer error, see console for information:\nFile: ") + fileName);
2028 } else {
2029 QMessageBox::information(this, MSG_INFORMATION, tr("Transfer completed successfully."));
2030 }
2031 });
2032 }
2033 }
2034}
2035
2036void MainWindow::varSaveSelectedFiles() {
2037 QFileDialog dialog(this);

Callers

nothing calls this directly

Calls 4

emu_receive_variableFunction · 0.85
rowCountMethod · 0.80
unblockMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected