Skip to content
Snippets Groups Projects
Commit aec33552 authored by roangel's avatar roangel
Browse files

different tries to fix the crash, apparently removing tabs is creating this crash

parent ef5fafa6
No related branches found
No related tags found
No related merge requests found
......@@ -63,8 +63,13 @@ int MainGUIWindow::getTabIndexFromName(QString name)
void MainGUIWindow::doNumCrazyFlyZonesChanged(int n)
{
// FIXME: when we load CF Zones from database, more than one at a time. Change way of updating tabs!
// Maybe remove everything and create new ones always?
// tabs number management, maybe do it in a different way so we dont have to remove and add everything?
// first check if size of tabs is greater than size of vector or viceversa. Have we removed or added a zone?
qDebug("tabWidgetCount : %d", ui->tabWidget->count());
if(ui->tabWidget->count() > scene->crazyfly_zones.size())
{
......@@ -98,6 +103,77 @@ void MainGUIWindow::doNumCrazyFlyZonesChanged(int n)
ui->tabWidget->insertTab(n, widget, qstr);
connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
}
// for(int ind = 0; ind < ui->tabWidget->count(); ind++)
// {
// QString qstr = "CrazyFly ";
// qstr.append(QString::number(ind+1));
// int found_index = getTabIndexFromName(qstr);
// if(found_index != -1)
// {
// ui->tabWidget->removeTab(found_index);
// }
// if(cf_linker->isCFZoneLinked(ind))
// {
// cf_linker->unlink_cf_zone(ind);
// }
// }
// else
// {
// for(int i = 0; i < ui->tabWidget->count(); i++)
// {
// int CF_index = scene->crazyfly_zones[i]->getIndex();
// QString qstr = "CrazyFly ";
// qstr.append(QString::number(CF_index + 1));
// int found_index = getTabIndexFromName(qstr);
// if(found_index != -1)
// {
// ui->tabWidget->removeTab(found_index);
// }
// // now unlink it from table also:
// #ifdef CATKIN_MAKE
// if(cf_linker->isCFZoneLinked(n))
// {
// cf_linker->unlink_cf_zone(n);
// }
// #endif
// // ROS_INFO("inside first for loop");
// // ui->tabWidget->removeTab(i);
// // ROS_INFO("removed tab");
// // delete ui->tabWidget->widget(i);
// // ROS_INFO("deleted widget");
// }
// }
// while(ui->tabWidget->count() > 0)
// {
// ui->tabWidget->removeTab(0);
// }
// unlink all?
// cf_linker->clear_all_links();
// for(int i = 0; i < scene->crazyfly_zones.size(); i++)
// {
// ROS_INFO("inside for loop");
// QString qstr = "CrazyFly ";
// int CF_index = scene->crazyfly_zones[i]->getIndex();
// qstr.append(QString::number(CF_index + 1));
// crazyFlyZoneTab* widget = new crazyFlyZoneTab(CF_index);
// ui->tabWidget->insertTab(CF_index, widget, qstr);
// // ui->tabWidget->addTab(widget, qstr);
// ROS_INFO("Added tab");
// connect(widget, SIGNAL(centerButtonClickedSignal(int)), this, SLOT(centerViewIndex(int)));
// }
// for (int i = 0; i < n; i++)
// {
// QString qstr = "CrazyFly ";
......@@ -836,6 +912,7 @@ int MainGUIWindow::read_database_from_file(CrazyflieDB &read_db)
void MainGUIWindow::on_load_from_DB_button_clicked()
{
CrazyflieDB tmp_db;
if(read_database_from_file(tmp_db) == 0)
{
ROS_INFO_STREAM("database:\n" << tmp_db);
......@@ -853,6 +930,7 @@ void MainGUIWindow::on_load_from_DB_button_clicked()
std::string cf_name = m_data_base.crazyflieEntries[i].crazyflieContext.crazyflieName;
std::string radio_address = m_data_base.crazyflieEntries[i].crazyflieContext.crazyflieAddress;
int cf_zone_index = m_data_base.crazyflieEntries[i].crazyflieContext.localArea.crazyfly_zone_index;
// we should first create the cf zones that are in the database?
bool cf_zone_exists;
qreal width = m_data_base.crazyflieEntries[i].crazyflieContext.localArea.xmax - m_data_base.crazyflieEntries[i].crazyflieContext.localArea.xmin;
......
1,CF2,123,0,0.04,0.24,-0.2,1.14,1.81,2
1,CF1,123,0,0.65,-0.22,-0.2,5.04,2.02,2
2,CF2,1234,1,3.26,-2.78,-0.2,7.3,-1.65,2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment