void MainWindow::versionChecked(const QString &version, const QString &message) { pNewTracker->deleteLater(); if (version == "-1") { ErrorHandler::handleError("This tracker is not valid.", message); stopAnimation(); return; } // TODO: Refactor the addTracker(...) call to take a Backend object // directly QMap<QString, QString> info; info["id"] = "-1"; info["url"] = pNewTracker->url(); info["name"] = pNewTracker->name(); info["type"] = pNewTracker->type(); info["username"] = pNewTracker->username(); info["password"] = pNewTracker->password(); info["last_sync"] = "1970-01-01T12:13:14"; info["version"] = version; addTracker(info); }
// Signal called after the autodetector is finished void MainWindow::finishedDetecting(QMap<QString, QString> data) { qDebug() << "Finished detecting"; Autodetector *detector = qobject_cast<Autodetector*>(sender()); stopAnimation(); if (pDetectorProgress->wasCanceled()) return; QString type = data["type"]; if (type == "Unknown") { ErrorHandler::handleError("Couldn't detect tracker type.", ""); delete detector; return; } else if (type == "Google") { // Google Code Hosting support will have to wait until we sort out how to handle their tag // system in the UI QMessageBox box; box.setText(tr("Sorry, Google Project Hosting is not yet supported.")); box.exec(); delete detector; return; } else if (type == "Launchpad") { QMessageBox box; box.setText(tr("Entomologist no longer support Launchpad.")); box.exec(); delete detector; return; // Launchpad uses a non-standard HTTP method ("PATCH") to update bugs. Support for custom HTTP commands is // only available in Qt 4.7+, so we must disable that functionality in older versions. #if QT_VERSION < 0x040700 box.setText(tr("Launchpad support will be read-only.")); box.setDetailedText(tr("Entomologist was compiled against an older version of Qt, probably because you're running an older distribution. " "In order to have write-access to Launchpad, you'll need a binary compiled to use Qt 4.7 or higher")); box.exec(); #endif // If the user managed to enter a password into the Add Tracker dialog, we want to discard // it, as Launchpad uses OAuth, and we store the OAuth token and secret in the // password field. It's hacky, I know. data["password"] = ""; } delete detector; addTracker(data); }
void UTracker::update(cv::Mat ref) { if(!ConfigManager::getConfigManager().get<bool>(ConfigManager::FULL_TRACKING)) return; cv::Mat tmp; ref.copyTo(tmp); DataManager dm = DataManager::getDataManager(); for(auto t=dm.people.begin(); t!=dm.people.end(); t++) { if(t->second.trackCount <= 0){ DataManager::getDataManager().people[t->first].trackCount++; addTracker(t->first, ref); } try { rectangle(tmp, t->second._roid.tl(), t->second._roid.br(), cv::Scalar(0,255,0), 2,8,0); } catch(cv::Exception e) { } } _method->update(ref); display(ConfigManager::VIEW_TRACKING_RESULT,tmp); }
// Loads cached trackers from the database void MainWindow::loadTrackers() { QSqlTableModel model; model.setTable("trackers"); model.select(); for(int i = 0; i < model.rowCount(); ++i) { QSqlRecord record = model.record(i); QMap<QString, QString> info; info["id"] = record.value(0).toString(); info["type"] = record.value(1).toString(); info["name"] = record.value(2).toString(); info["url"] = record.value(3).toString(); info["username"] = record.value(4).toString(); info["password"] = record.value(5).toString(); info["last_sync"] = record.value(6).toString(); info["version"] = record.value(7).toString(); info["monitored_components"] = record.value(8).toString(); info["auto_cache_comments"] = record.value(9).toString(); addTracker(info); } }