bool DbInterface::saveUserShows(const NextShows::ShowInfosList &shows) { qDebug() << Q_FUNC_INFO; QSqlDatabase db = QSqlDatabase::database(DBCONNECTION); QSqlQuery query(db); bool status = true; // Get all the show IDs from the DB QList<int> dbId; query.prepare("SELECT idT_Shows FROM T_Shows"); if (!query.exec()) { qCritical() << query.lastQuery() << "\n" << query.lastError(); return false; // Something went wrong... } while (query.next()) { dbId << query.value(0).toInt(); } // Start transaction qDebug() << "Begin DB transaction"; QSqlDatabase::database(DBCONNECTION).transaction(); QList<int> usrId; foreach(NextShows::ShowInfos_t show, shows) { usrId << show.showid; if(!dbId.contains(show.showid)) { // New show, add it! qDebug() << "Add show:" << QString::number(show.showid); if (!saveShow(show)) { qCritical() << "Error when saving show:" << show.name; status = false; break; // Exit foreach } } }
int gui::TreeWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateActions((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 1: updateActions(); break; case 2: clickedTree((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 3: { string _r = ObtType((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< string*>(_a[0]) = _r; } break; case 4: insertChild(); break; case 5: { bool _r = insertColumn((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 6: { bool _r = insertColumn(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 7: insertRow(); break; case 8: { bool _r = removeColumn((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 9: { bool _r = removeColumn(); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 10: removeRow(); break; case 11: editObject(); break; case 12: saveShow(); break; case 13: loadShow(); break; case 14: setOrbitmode(); break; case 15: setRollmode(); break; case 16: setDollymode(); break; case 17: setPanymode(); break; case 18: setCalibration(); break; case 19: quit(); break; default: ; } _id -= 20; } return _id; }