VehicleTemplateExportDialog::VehicleTemplateExportDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::VehicleTemplateExportDialog), m_autopilotConnected(false)
{
    ui->setupUi(this);
    connect(ui->ImportButton, SIGNAL(clicked()), this, SLOT(importImage()));
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    m_uavoManager = pm->getObject<UAVObjectManager>();
    ui->Photo->setScene(new QGraphicsScene(this));
    ui->Type->setText(setupVehicleType());
    ui->selectionWidget->setTemplateInfo(m_type, m_subType);

    connect(ui->Name, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
    connect(ui->Owner, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
    connect(ui->ForumNick, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
    connect(ui->Size, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));
    connect(ui->Weight, SIGNAL(textChanged(QString)), this, SLOT(updateStatus()));

    connect(ui->exportBtn, SIGNAL(clicked()), this, SLOT(exportTemplate()));
    connect(ui->saveAsBtn, SIGNAL(clicked()), this, SLOT(saveAsTemplate()));
    connect(ui->importBtn, SIGNAL(clicked()), this, SLOT(importTemplate()));
    connect(ui->cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
    connect(ui->cancelBtn_2, SIGNAL(clicked()), this, SLOT(reject()));

    TelemetryManager *telemManager = pm->getObject<TelemetryManager>();
    if (telemManager->isConnected()) {
        onAutoPilotConnect();
    } else {
        onAutoPilotDisconnect();
    }

    connect(telemManager, SIGNAL(connected()), this, SLOT(onAutoPilotConnect()));
    connect(telemManager, SIGNAL(disconnected()), this, SLOT(onAutoPilotDisconnect()));
}
UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
{
    m_config = new Ui_UploaderWidget();
    m_config->setupUi(this);
    currentStep = IAP_STATE_READY;
    resetOnly=false;
    dfu = NULL;
    m_timer = 0;
    m_progress = 0;

    // Listen to autopilot connection events
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
    connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
    connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));

    connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(goToBootloader()));
    connect(m_config->resetButton, SIGNAL(clicked()), this, SLOT(systemReset()));
    connect(m_config->bootButton, SIGNAL(clicked()), this, SLOT(systemBoot()));
    connect(m_config->rescueButton, SIGNAL(clicked()), this, SLOT(systemRescue()));

    getSerialPorts();

    QIcon rbi;
    rbi.addFile(QString(":uploader/images/view-refresh.svg"));
    m_config->refreshPorts->setIcon(rbi);

    connect(m_config->refreshPorts, SIGNAL(clicked()), this, SLOT(getSerialPorts()));

    // And check whether by any chance we are not already connected
    if (telMngr->isConnected())
        onAutopilotConnect();


}
UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
{
    m_config    = new Ui_UploaderWidget();
    m_config->setupUi(this);
    m_currentIAPStep = IAP_STATE_READY;
    m_resetOnly = false;
    m_dfu = NULL;
    m_autoUpdateClosing = false;

    // Listen to autopilot connection events
    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    TelemetryManager *telMngr = pm->getObject<TelemetryManager>();
    connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
    connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));

    Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
    connect(cm, SIGNAL(deviceConnected(QIODevice *)), this, SLOT(onPhysicalHWConnect()));

    connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(systemHalt()));
    connect(m_config->resetButton, SIGNAL(clicked()), this, SLOT(systemReset()));
    connect(m_config->bootButton, SIGNAL(clicked()), this, SLOT(systemBoot()));
    connect(m_config->safeBootButton, SIGNAL(clicked()), this, SLOT(systemSafeBoot()));
    connect(m_config->eraseBootButton, SIGNAL(clicked()), this, SLOT(systemEraseBoot()));
    connect(m_config->rescueButton, SIGNAL(clicked()), this, SLOT(systemRescue()));

    getSerialPorts();

    connect(m_config->autoUpdateButton, SIGNAL(clicked()), this, SLOT(startAutoUpdate()));
    connect(m_config->autoUpdateEraseButton, SIGNAL(clicked()), this, SLOT(startAutoUpdateErase()));
    connect(m_config->autoUpdateOkButton, SIGNAL(clicked()), this, SLOT(closeAutoUpdate()));
    m_config->autoUpdateButton->setEnabled(autoUpdateCapable());
    m_config->autoUpdateEraseButton->setEnabled(autoUpdateCapable());
    m_config->autoUpdateGroupBox->setVisible(false);

    m_config->refreshPorts->setIcon(QIcon(":uploader/images/view-refresh.svg"));

    bootButtonsSetEnable(false);

    connect(m_config->refreshPorts, SIGNAL(clicked()), this, SLOT(getSerialPorts()));

    connect(m_config->pbHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
    // And check whether by any chance we are not already connected
    if (telMngr->isConnected()) {
        onAutopilotConnect();
    }
}
Пример #4
0
bool ConfigPlugin::initialize(const QStringList& args, QString *errMsg)
{
   Q_UNUSED(args);
   Q_UNUSED(errMsg);
  cf = new ConfigGadgetFactory(this);
  addAutoReleasedObject(cf);

  // Add Menu entry to erase all settings
  Core::ActionManager* am = Core::ICore::instance()->actionManager();
  Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_TOOLS);

  // Command to erase all settings from the board
  cmd = am->registerAction(new QAction(this),
                                          "ConfigPlugin.EraseAll",
                                          QList<int>() <<
                                          Core::Constants::C_GLOBAL_ID);
  cmd->action()->setText(tr("Erase all settings from board..."));

  ac->menu()->addSeparator();
  ac->appendGroup("Utilities");
  ac->addAction(cmd, "Utilities");

  connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(eraseAllSettings()));

  // *********************
  // Listen to autopilot connection events
  ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
  TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
  connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
  connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));

  // And check whether by any chance we are not already connected
  if (telMngr->isConnected())
      onAutopilotConnect();

   return true;
}
Пример #5
0
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
{
    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    stackWidget = new MyTabbedStackWidget(this, true, true);
    stackWidget->setIconSize(64);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(stackWidget);
    setLayout(layout);

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();

    QWidget *widget;
    QIcon *icon;

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new DefaultConfigWidget(this, tr("Hardware"));
    stackWidget->insertTab(ConfigGadgetWidget::Hardware, widget, *icon, QString("Hardware"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigVehicleTypeWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::Aircraft, widget, *icon, QString("Vehicle"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigInputWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::Input, widget, *icon, QString("Input"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigOutputWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::Output, widget, *icon, QString("Output"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new DefaultConfigWidget(this, tr("Attitude"));
    stackWidget->insertTab(ConfigGadgetWidget::Sensors, widget, *icon, QString("Attitude"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigStabilizationWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::Stabilization, widget, *icon, QString("Stabilization"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigCameraStabilizationWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::CameraStabilization, widget, *icon, QString("Gimbal"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new ConfigTxPIDWidget(this);
    static_cast<ConfigTaskWidget *>(widget)->bind();
    stackWidget->insertTab(ConfigGadgetWidget::TxPid, widget, *icon, QString("TxPID"));

    icon   = new QIcon();
    icon->addFile(":/configgadget/images/pipx-normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/pipx-selected.png", QSize(), QIcon::Selected, QIcon::Off);
    widget = new DefaultConfigWidget(this, tr("OPLink Configuration"));
    stackWidget->insertTab(ConfigGadgetWidget::OPLink, widget, *icon, QString("OPLink"));

    stackWidget->setCurrentIndex(ConfigGadgetWidget::Hardware);

    // connect to autopilot connection events
    TelemetryManager *tm = pm->getObject<TelemetryManager>();
    connect(tm, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
    connect(tm, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
    // check if we are already connected
    if (tm->isConnected()) {
        onAutopilotConnect();
    }

    // connect to oplink manager
    OPLinkManager *om = pm->getObject<OPLinkManager>();
    connect(om, SIGNAL(connected()), this, SLOT(onOPLinkConnect()));
    connect(om, SIGNAL(disconnected()), this, SLOT(onOPLinkDisconnect()));
    // check if we are already connected
    if (om->isConnected()) {
        onOPLinkConnect();
    }

    help = 0;
    connect(stackWidget, SIGNAL(currentAboutToShow(int, bool *)), this, SLOT(tabAboutToChange(int, bool *)));
}
Пример #6
0
ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
{
    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

    ftw = new MyTabbedStackWidget(this, true, true);
    ftw->setIconSize(64);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(ftw);
    setLayout(layout);

    // *********************
    QWidget *qwd;

    QIcon *icon = new QIcon();
    icon->addFile(":/configgadget/images/hardware_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/hardware_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new DefaultHwSettingsWidget(this);
    ftw->insertTab(ConfigGadgetWidget::hardware, qwd, *icon, QString("Hardware"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/vehicle_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/vehicle_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigVehicleTypeWidget(this);
    ftw->insertTab(ConfigGadgetWidget::aircraft, qwd, *icon, QString("Vehicle"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/input_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/input_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigInputWidget(this);
    ftw->insertTab(ConfigGadgetWidget::input, qwd, *icon, QString("Input"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/output_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/output_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigOutputWidget(this);
    ftw->insertTab(ConfigGadgetWidget::output, qwd, *icon, QString("Output"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/ins_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/ins_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new DefaultAttitudeWidget(this);
    ftw->insertTab(ConfigGadgetWidget::sensors, qwd, *icon, QString("INS"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/stabilization_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/stabilization_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigStabilizationWidget(this);
    ftw->insertTab(ConfigGadgetWidget::stabilization, qwd, *icon, QString("Stabilization"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/autotune_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/autotune_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigAutotuneWidget(this);
    ftw->insertTab(ConfigGadgetWidget::autotune, qwd, *icon, QString("Autotune"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/camstab_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/camstab_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigCameraStabilizationWidget(this);
    ftw->insertTab(ConfigGadgetWidget::camerastabilization, qwd, *icon, QString("Camera Stab"));

    icon = new QIcon();
    icon->addFile(":/configgadget/images/txpid_normal.png", QSize(), QIcon::Normal, QIcon::Off);
    icon->addFile(":/configgadget/images/txpid_selected.png", QSize(), QIcon::Selected, QIcon::Off);
    qwd = new ConfigTxPIDWidget(this);
    ftw->insertTab(ConfigGadgetWidget::txpid, qwd, *icon, QString("TxPID"));

    ftw->setCurrentIndex(ConfigGadgetWidget::hardware);
    // *********************
    // Listen to autopilot connection events

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
    connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
    connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));

    // And check whether by any chance we are not already connected
    if (telMngr->isConnected()) {
        onAutopilotConnect();    
    }

    help = 0;
    connect(ftw,SIGNAL(currentAboutToShow(int,bool*)),this,SLOT(tabAboutToChange(int,bool*)));//,Qt::BlockingQueuedConnection);

    // Connect to the PipXStatus object updates
    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    pipxStatusObj = dynamic_cast<UAVDataObject*>(objManager->getObject("PipXStatus"));
    if (pipxStatusObj != NULL ) {
        connect(pipxStatusObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updatePipXStatus(UAVObject*)));
    } else {