Пример #1
0
      void
      onVehicleExternalControl(const IMC::VehicleState* vs)
      {
        (void)vs;

        if (blockedMode())
          return;

        changeMode(IMC::PlanControlState::PCS_BLOCKED,
                   DTR("vehicle in EXTERNAL mode"), false);
      }
//! [11]
void MainWindow::changeModel()
{
    delete completer;
    completer = new QCompleter(this);
    completer->setMaxVisibleItems(maxVisibleSpinBox->value());

    switch (modelCombo->currentIndex()) {
    default:
    case 0:
        { // Unsorted QDirModel
            QDirModel *dirModel = new QDirModel(completer);
            completer->setModel(dirModel);
            contentsLabel->setText(tr("Enter file path"));
        }
        break;
//! [11] //! [12]
    case 1:
        { // DirModel that shows full paths
            DirModel *dirModel = new DirModel(completer);
            completer->setModel(dirModel);
            contentsLabel->setText(tr("Enter file path"));
        }
        break;
//! [12] //! [13]
    case 2:
        { // Country List
            completer->setModel(modelFromFile(":/resources/countries.txt"));
            QTreeView *treeView = new QTreeView;
            completer->setPopup(treeView);
            treeView->setRootIsDecorated(false);
            treeView->header()->hide();
            treeView->header()->setStretchLastSection(false);
            treeView->header()->setResizeMode(0, QHeaderView::Stretch);
            treeView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
            contentsLabel->setText(tr("Enter name of your country"));
        }
        break;
//! [13] //! [14]
    case 3:
        { // Word list
            completer->setModel(modelFromFile(":/resources/wordlist.txt"));
            completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
            contentsLabel->setText(tr("Enter a word"));
        }
        break;
    }

    changeMode(modeCombo->currentIndex());
    changeCase(caseCombo->currentIndex());
    completer->setWrapAround(wrapCheckBox->isChecked());
    lineEdit->setCompleter(completer);
    connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool)));
}
Пример #3
0
void JabberBrowser::changeMode()
{
	if (m_client->getAllLevels()){
		if (m_list->firstChild())
			changeMode(m_list->firstChild());
	}else{
		if (m_list->firstChild())
			loadItem(m_list->firstChild());
		if (m_list->currentItem())
			loadItem(m_list->currentItem());
	}
}
Пример #4
0
      void
      onMain(void)
      {
        setInitialState();

        while (!stopping())
        {
          if (m_report_timer.overflow())
          {
            if (m_args.progress)
              reportProgress();

            dispatch(m_pcs);

            m_report_timer.reset();
          }

          double now = Clock::get();

          if ((getEntityState() == IMC::EntityState::ESTA_NORMAL) &&
              (now - m_last_vstate >= c_vs_timeout))
          {
            changeMode(IMC::PlanControlState::PCS_BLOCKED, DTR("vehicle state timeout"));
            m_last_vstate = now;
          }

          double delta = m_vc_reply_deadline < 0 ? 1 : m_vc_reply_deadline - now;

          if (delta > 0)
          {
            waitForMessages(std::min(1.0, delta));
            continue;
          }

          // handle reply timeout
          m_vc_reply_deadline = -1;

          changeMode(IMC::PlanControlState::PCS_READY, DTR("vehicle reply timeout"));
        }
      }
Пример #5
0
static int createRenderingContext(void) {
    HWND layer = HWND_NOTOPMOST;
    RECT r;
    int style = (vo_border && !vo_fs) ?
                (WS_OVERLAPPEDWINDOW | WS_SIZEBOX) : WS_POPUP;

    if (WinID >= 0)
        return 1;

    if (vo_fs || vo_ontop) layer = HWND_TOPMOST;
    if (vo_fs) {
        changeMode();
        while (ShowCursor(0) >= 0) /**/ ;
    } else {
        resetMode();
        while (ShowCursor(1) < 0) /**/ ;
    }
    updateScreenProperties();
    ShowWindow(vo_window, SW_HIDE);
    SetWindowLong(vo_window, GWL_STYLE, style);
    if (vo_fs) {
        prev_width = vo_dwidth;
        prev_height = vo_dheight;
        prev_x = vo_dx;
        prev_y = vo_dy;
        vo_dwidth = vo_screenwidth;
        vo_dheight = vo_screenheight;
        vo_dx = xinerama_x;
        vo_dy = xinerama_y;
    } else {
        // make sure there are no "stale" resize events
        // that would set vo_d* to wrong values
        vo_w32_check_events();
        vo_dwidth = prev_width;
        vo_dheight = prev_height;
        vo_dx = prev_x;
        vo_dy = prev_y;
        // HACK around what probably is a windows focus bug:
        // when pressing 'f' on the console, then 'f' again to
        // return to windowed mode, any input into the video
        // window is lost forever.
        SetFocus(vo_window);
    }
    r.left = vo_dx;
    r.right = r.left + vo_dwidth;
    r.top = vo_dy;
    r.bottom = r.top + vo_dheight;
    AdjustWindowRect(&r, style, 0);
    SetWindowPos(vo_window, layer, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_SHOWWINDOW);
    return 1;
}
Пример #6
0
      void
      onVehicleCalibration(const IMC::VehicleState* vs)
      {
        (void)vs;

        if (initMode())
          return;

        if (!blockedMode())
        {
          changeMode(IMC::PlanControlState::PCS_BLOCKED,
                     DTR("vehicle in CALIBRATION mode"), false);
        }
      }
Пример #7
0
      void
      consume(const IMC::VehicleState* vs)
      {
        if (getEntityState() == IMC::EntityState::ESTA_BOOT)
          return;

        m_last_vstate = Clock::get();

        switch (vs->op_mode)
        {
          case IMC::VehicleState::VS_SERVICE:
            onVehicleService(vs);
            break;
          case IMC::VehicleState::VS_CALIBRATION:
            onVehicleCalibration(vs);
            break;
          case IMC::VehicleState::VS_ERROR:
          case IMC::VehicleState::VS_BOOT:
            onVehicleError(vs);
            break;
          case IMC::VehicleState::VS_MANEUVER:
            onVehicleManeuver(vs);
            break;
          case IMC::VehicleState::VS_EXTERNAL:
            onVehicleExternalControl(vs);
            break;
        }

        // update calibration status
        if (m_plan != NULL && initMode())
        {
          m_plan->updateCalibration(vs);

          if (m_plan->isCalibrationDone())
          {
            if ((vs->op_mode == IMC::VehicleState::VS_CALIBRATION) &&
                !pendingReply())
            {
              IMC::PlanManeuver* pman = m_plan->loadStartManeuver();
              startManeuver(pman);
            }
          }
          else if (m_plan->hasCalibrationFailed())
          {
            onFailure(m_plan->getCalibrationInfo());
            m_reply.plan_id = m_spec.plan_id;
            changeMode(IMC::PlanControlState::PCS_READY, m_plan->getCalibrationInfo());
          }
        }
      }
Пример #8
0
void KeycodeConfig::pick(bool press, int row, int item)
{
    if ( !press ) {
        if ( item >= 0 ) {
            int k = row == 0 ? keys1[item] : keys2[item];
            int u = row == 0 ? ukeys1[item] : ukeys2[item];
            // more than key, uni as well
            if ( k )
                generateKey(u, k);
        }
        changeMode(0);
        updateRows(0,1);
    }
}
Пример #9
0
      //! Load a plan into the vehicle
      //! @param[in] plan_id name of the plan
      //! @param[in] arg argument which may either be a maneuver or a plan specification
      //! @param[in] plan_startup true if a plan will start right after
      //! @return true if plan is successfully loaded
      bool
      loadPlan(const std::string& plan_id, const IMC::Message* arg,
               bool plan_startup = false)
      {
        if ((initMode() && !plan_startup) || execMode())
        {
          onFailure(DTR("cannot load plan now"));
          return false;
        }

        std::string info;
        if (!parseArg(plan_id, arg, info))
        {
          changeMode(IMC::PlanControlState::PCS_READY,
                     DTR("plan load failed: ") + info);
          return false;
        }

        IMC::PlanStatistics ps;

        if (!parsePlan(plan_startup, ps))
        {
          changeMode(IMC::PlanControlState::PCS_READY,
                     DTR("plan parse failed: ") + m_reply.info);
          return false;
        }

        // reply with statistics
        m_reply.arg.set(ps);
        m_reply.plan_id = m_spec.plan_id;

        m_pcs.plan_id = m_spec.plan_id;

        onSuccess(DTR("plan loaded"), false);

        return true;
      }
Пример #10
0
void UBBoardPaletteManager::slot_changeMainMode(UBApplicationController::MainMode mainMode)
{
//    Board = 0, Internet, Document, Tutorial, ParaschoolEditor, WebDocument

    switch( mainMode )
    {
        case UBApplicationController::Board:
            {
                // call changeMode only when switch NOT from desktop mode
                if(!UBApplication::applicationController->isShowingDesktop())
                    changeMode(eUBDockPaletteWidget_BOARD);
            }
            break;

        case UBApplicationController::Tutorial:
            {
                if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
                    mKeyboardPalette->hide();
            }
            break;

        case UBApplicationController::Internet:
            changeMode(eUBDockPaletteWidget_WEB);
            break;

        case UBApplicationController::Document:
            changeMode(eUBDockPaletteWidget_DOCUMENT);
            break;

        default:
            {
                if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL)
                    mKeyboardPalette->hide();
            }
            break;
    }
}
Пример #11
0
void IhmPopup::result(QString text1,QString text2,QString listSource,int nbSource,int prCenPlagier)
{
    ui2 = new Ui::Resultat();
    ui2->setupUi(this);
    ui2->textBrowser->setText(text1);
    ui2->label_2->setText("<strong>"+QObject::tr("Nombres de sources")+": "+QString::number(nbSource)+"</strong>");
    ui2->label->setText("<strong>"+QObject::tr("Texte plagié à")+" "+QString::number(prCenPlagier)+"% </strong>");
    ui2->textBrowser_2->setText(listSource);
    m_text1=text1;
    m_text2=text2;
    m_idText = 1;
    QObject::connect(ui2->pushButton_2,SIGNAL(clicked()),this,SLOT(changeMode()));
    QObject::connect(ui2->pushButton,SIGNAL(clicked()),this,SLOT(clickExportHtml()));
    show();
}
Пример #12
0
void Quadcopter::stop()
{
	//moet nog worden aangepast zodra er een struct is voor de mid waarde.
	changeMode(FlightMode::ALTHOLD);
	sendRCMessage(
		(RCTrimValues.CHANNEL_ONE_LOW + RCTrimValues.CHANNEL_ONE_HIGH) / 2,
		(RCTrimValues.CHANNEL_TWO_LOW + RCTrimValues.CHANNEL_TWO_HIGH) / 2,
		(RCTrimValues.CHANNEL_THREE_LOW + RCTrimValues.CHANNEL_THREE_HIGH) / 2,
		(RCTrimValues.CHANNEL_FOUR_LOW + RCTrimValues.CHANNEL_FOUR_HIGH) / 2,
		(RCTrimValues.CHANNEL_FIVE_LOW + RCTrimValues.CHANNEL_FIVE_HIGH) / 2,
		(RCTrimValues.CHANNEL_SIX_LOW + RCTrimValues.CHANNEL_SIX_HIGH) / 2,
		(RCTrimValues.CHANNEL_SEVEN_LOW + RCTrimValues.CHANNEL_SEVEN_HIGH) / 2,
		(RCTrimValues.CHANNEL_EIGHT_LOW + RCTrimValues.CHANNEL_EIGHT_HIGH) / 2
		);
}
Пример #13
0
      //! Start a given plan
      //! @param[in] plan_id name of the plan to execute
      //! @param[in] spec plan specification message if any
      //! @param[in] flags plan control flags
      //! @return false if previously executing maneuver was not stopped
      bool
      startPlan(const std::string& plan_id, const IMC::Message* spec, uint16_t flags)
      {
        bool stopped = stopPlan(true);

        changeMode(IMC::PlanControlState::PCS_INITIALIZING,
                   DTR("plan initializing: ") + plan_id);

        if (!loadPlan(plan_id, spec, true))
          return stopped;

        changeLog(plan_id);

        // Flag the plan as starting
        if (initMode() || execMode())
        {
          if (!stopped)
            m_plan->planStopped();

          m_plan->planStarted();
        }

        dispatch(m_spec);

        if ((flags & IMC::PlanControl::FLG_CALIBRATE) &&
            m_args.do_calib)
        {
          if (!startCalibration())
            return stopped;
        }
        else
        {
          IMC::PlanManeuver* pman = m_plan->loadStartManeuver();
          startManeuver(pman);

          if (execMode())
          {
            onSuccess(m_last_event);
          }
          else
          {
            onFailure(m_last_event);
            return stopped;
          }
        }

        return true;
      }
Пример #14
0
void trata_rb()
{
	int x;	
	if (input(MODE) == 0)
	{
		changeMode(); 	
	}
	if (input(INC) == 0)
	{
		incClick(); 	
	}
	if (input(DEC) == 0)
	{
		decClick();	
	}
	x = input_b();
}
Пример #15
0
SRCR_BEGIN_NS

////////////////////////////////////////////////////////////////////////////
// クラス

//==========================================================================
// EnemyMode メソッド

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// 外部サービス

/*---------------------------------------------------------------------*//**
	歩行モードへ移行
**//*---------------------------------------------------------------------*/
void EnemyMode::toWalking()
{
	changeMode((s16)ACT_WALKING, false);
}
Пример #16
0
void CharStringConfig::pick(bool press, int row, int item)
{
    if ( row == 0 ) {
        if ( !press ) {
            if ( item>=0 ) {
                generateText(input);
            }
            input = "";
            changeMode(0);
            updateRows(0,1);
        }
    } else {
        if ( press && item >= 0 ) {
            input.append(chars[item]);
            updateRows(0,0);
        }
    }
}
Пример #17
0
/**
 * \\n
 * \date 01-May-2005\n
 * \brief Main SCR debug function
 *
 * Function Scope \e Public.\n
 * \param hScr - handle to the SCR object.\n
 * \param funcType - the specific debug function.\n
 * \param pParam - parameters for the debug function.\n
 */
void scrDebugFunction(TI_HANDLE hScr, TI_UINT32 funcType, void *pParam)
{
	switch (funcType) {
	case DBG_SCR_PRINT_HELP:
		printScrDbgFunctions();
		break;

	case DBG_SCR_CLIENT_REQUEST_SERVING_CHANNEL:
		requestAsClient(hScr, *((EScrClientId *) pParam),
				SCR_RESOURCE_SERVING_CHANNEL);
		break;

	case DBG_SCR_CLIENT_RELEASE_SERVING_CHANNEL:
		releaseAsClient(hScr, *((EScrClientId *) pParam),
				SCR_RESOURCE_SERVING_CHANNEL);
		break;

	case DBG_SCR_CLIENT_REQUEST_PERIODIC_SCAN:
		requestAsClient(hScr, *((EScrClientId *) pParam),
				SCR_RESOURCE_PERIODIC_SCAN);
		break;

	case DBG_SCR_CLIENT_RELEASE_PERIODIC_SCAN:
		releaseAsClient(hScr, *((EScrClientId *) pParam),
				SCR_RESOURCE_PERIODIC_SCAN);
		break;

	case DBG_SCR_SET_GROUP:
		changeGroup(hScr, *((EScrGroupId *) pParam));
		break;

	case DBG_SCR_PRINT_OBJECT:
		printSCRObject(hScr);
		break;

	case DBG_SCR_SET_MODE:
		changeMode(hScr, *((EScrModeId *) pParam));
		break;

	default:
		WLAN_OS_REPORT(("Invalid function type in SCR debug function: %d\n", funcType));
		break;
	}
}
void callKeyboardDownFunc(unsigned char key, int x, int y) {
    switch (key) {
        case ' ':
            /*g_currentObj = ((g_currentObj + getTotalNbObjects() + 1 + g_eventDirection) % (getTotalNbObjects() + 1));
            if(g_currentObj == getTotalNbObjects()) {
                g_currentObj = -1;
            }*/
            addToEventList(key);
            break;
        case 'h':
        case 'H':
            print_help();
            break;
        case 'm':
        case 'M':
            g_haltAnimation ^= 1;
            glutTimerFunc(10, animationTimer, 0);
            break;
        case 'o':
        case 'O':
            changeMode();
            break;
        case 'r':
        case 'R':
            reload_random_objects(MODELE_FILE_NAME);
            break;
        case 'l':
        case 'L':
            g_debugLights ^= 1;
            g_debugRepere ^= 1;
            break;
        case 'z':
        case 'Z':
        case 's':
        case 'S':
        case 'q':
        case 'Q':
        case 'd':
        case 'D':
            addToEventList(key);
            break;
    }
}
Пример #19
0
      void
      consume(const IMC::EntityActivationState* msg)
      {
        if (m_plan != NULL)
        {
          std::string id;

          try
          {
            id = resolveEntity(msg->getSourceEntity());
          }
          catch (...)
          {
            return;
          }

          if (!m_plan->onEntityActivationState(id, msg))
          {
            std::string error = String::str(DTR("failed to activate %s: %s"),
                                            id.c_str(), msg->error.c_str());

            if (m_args.actfail_abort)
            {
              onFailure(error);
              changeMode(IMC::PlanControlState::PCS_READY, error, false);
            }
            else
            {
              err("%s", error.c_str());
            }
          }
        }

        if (msg->getSourceEntity() == m_eid_imu)
        {
          if (msg->state == IMC::EntityActivationState::EAS_ACTIVE)
            m_imu_enabled = true;
          else
            m_imu_enabled = false;
        }
      }
Пример #20
0
DolphinFontRequester::DolphinFontRequester(QWidget* parent) :
    KHBox(parent),
    m_modeCombo(0),
    m_chooseFontButton(0),
    m_mode(SystemFont),
    m_customFont()
{
    setSpacing(KDialog::spacingHint());

    m_modeCombo = new KComboBox(this);
    m_modeCombo->addItem(i18nc("@item:inlistbox Font", "System Font"));
    m_modeCombo->addItem(i18nc("@item:inlistbox Font", "Custom Font"));
    connect(m_modeCombo, SIGNAL(activated(int)),
            this, SLOT(changeMode(int)));

    m_chooseFontButton = new QPushButton(i18nc("@action:button Choose font", "Choose..."), this);
    connect(m_chooseFontButton, SIGNAL(clicked()),
            this, SLOT(openFontDialog()));

    changeMode(m_modeCombo->currentIndex());
}
Пример #21
0
void PppoeWidget::clear()
{
    ui->lineEdit_username->clear();
    ui->lineEdit_password->clear();
    ui->comboBox_connection->setCurrentIndex(0);
    changeMode(ui->comboBox_connection->currentText());
    ui->spinBox_timeout->setValue(300);
    ui->spinBox_fail->setValue(5);
    ui->checkBox_route->setCheckState(Qt::Checked);
    ui->checkBox_dns->setCheckState(Qt::Checked);
    ui->lineEdit_unit->clear();
    ui->spinBox_lcpInterval->setValue(30);
    ui->spinBox_lcpFailure->setValue(4);
    ui->lineEdit_options->clear();
    ui->lineEdit_service->clear();
    ui->lineEdit_ac->clear();
    ui->lineEdit_session->clear();
    ui->lineEdit_mac->clear();
    ui->checkBox_ipv6->setCheckState(Qt::Unchecked);

    ui->pushButton_pppoeAdvanced->setChecked(false);;
    showAdvanced();
}
Пример #22
0
      void
      onVehicleError(const IMC::VehicleState* vs)
      {
        std::string err_ents = DTR("vehicle errors: ") + vs->error_ents;
        std::string edesc = vs->last_error_time < 0 ? err_ents : vs->last_error;

        if (execMode())
        {
          onFailure(edesc);
          m_reply.plan_id = m_spec.plan_id;
        }

        // there are new error entities
        if (edesc != m_last_event)
        {
          if (initMode())
          {
            onFailure(edesc);
            m_reply.plan_id = m_spec.plan_id;
          }

          changeMode(IMC::PlanControlState::PCS_BLOCKED, edesc, false);
        }
      }
Пример #23
0
void Quadcopter::land()
{
	changeMode(FlightMode::LAND);
}
Пример #24
0
}


void PppoeWidget::createFilter()
{
    // session mac
    ui->lineEdit_session->setInputMask(QString(">00000:hh:hh:hh:hh:hh:hh"));
    // mac
    ui->lineEdit_mac->setInputMask(QString(">hh:hh:hh:hh:hh:hh"));
}


void PppoeWidget::createActions()
{
    connect(ui->pushButton_pppoeAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
    connect(ui->comboBox_connection, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeMode(QString)));
    connect(ui->pushButton_options, SIGNAL(clicked(bool)), this, SLOT(selectOptionsFile()));
}


void PppoeWidget::changeMode(const QString currentText)
{
    ui->widget_timeout->setHidden(currentText == QString("persist"));
}


void PppoeWidget::selectOptionsFile()
{
    QString filename = QFileDialog::getOpenFileName(this,
                QApplication::translate("PppoeWidget", "Select options file"),
                QDir::currentPath(),
Пример #25
0
// Update the window title, position, size, and border style from vo_* values.
static int reinit_window_state(struct vo *vo)
{
    struct vo_w32_state *w32 = vo->w32;
    HWND layer = HWND_NOTOPMOST;
    RECT r;

    if (WinID >= 0)
        return 1;

    wchar_t *title = mp_from_utf8(NULL, vo_get_window_title(vo));
    SetWindowTextW(w32->window, title);
    talloc_free(title);

    bool toggle_fs = w32->current_fs != vo_fs;
    w32->current_fs = vo_fs;

    DWORD style = update_style(vo, GetWindowLong(w32->window, GWL_STYLE));

    if (vo_fs || vo->opts->vo_ontop)
        layer = HWND_TOPMOST;

    // xxx not sure if this can trigger any unwanted messages (WM_MOVE/WM_SIZE)
    if (vo_fs) {
        changeMode(vo);
        while (ShowCursor(0) >= 0) /**/ ;
    } else {
        resetMode(vo);
        while (ShowCursor(1) < 0) /**/ ;
    }
    updateScreenProperties(vo);

    if (vo_fs) {
        // Save window position and size when switching to fullscreen.
        if (toggle_fs) {
            w32->prev_width = vo->dwidth;
            w32->prev_height = vo->dheight;
            w32->prev_x = w32->window_x;
            w32->prev_y = w32->window_y;
            mp_msg(MSGT_VO, MSGL_V, "[vo] save window bounds: %d:%d:%d:%d\n",
                   w32->prev_x, w32->prev_y, w32->prev_width, w32->prev_height);
        }
        vo->dwidth = vo->opts->vo_screenwidth;
        vo->dheight = vo->opts->vo_screenheight;
        w32->window_x = xinerama_x;
        w32->window_y = xinerama_y;
    } else {
        if (toggle_fs) {
            // Restore window position and size when switching from fullscreen.
            mp_msg(MSGT_VO, MSGL_V, "[vo] restore window bounds: %d:%d:%d:%d\n",
                   w32->prev_x, w32->prev_y, w32->prev_width, w32->prev_height);
            vo->dwidth = w32->prev_width;
            vo->dheight = w32->prev_height;
            w32->window_x = w32->prev_x;
            w32->window_y = w32->prev_y;
        }
    }

    r.left = w32->window_x;
    r.right = r.left + vo->dwidth;
    r.top = w32->window_y;
    r.bottom = r.top + vo->dheight;

    SetWindowLong(w32->window, GWL_STYLE, style);
    add_window_borders(w32->window, &r);

    mp_msg(MSGT_VO, MSGL_V, "[vo] reset window bounds: %ld:%ld:%ld:%ld\n",
           r.left, r.top, r.right - r.left, r.bottom - r.top);

    SetWindowPos(w32->window, layer, r.left, r.top, r.right - r.left,
                 r.bottom - r.top, SWP_FRAMECHANGED);
    // For some reason, moving SWP_SHOWWINDOW to a second call works better
    // with wine: returning from fullscreen doesn't cause a bogus resize to
    // screen size.
    // It's not needed on Windows XP or wine with a virtual desktop.
    // It doesn't seem to have any negative effects.
    SetWindowPos(w32->window, NULL, 0, 0, 0, 0,
                 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);

    return 1;
}
Пример #26
0
//! [0]
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), completer(0), lineEdit(0)
{
    createMenu();

    completer = new TreeModelCompleter(this);
    completer->setModel(modelFromFile(":/resources/treemodel.txt"));
    completer->setSeparator(QLatin1String("."));
    QObject::connect(completer, SIGNAL(highlighted(QModelIndex)),
                     this, SLOT(highlight(QModelIndex)));

    QWidget *centralWidget = new QWidget;

    QLabel *modelLabel = new QLabel;
    modelLabel->setText(tr("Tree Model<br>(Double click items to edit)"));

    QLabel *modeLabel = new QLabel;
    modeLabel->setText(tr("Completion Mode"));
    modeCombo = new QComboBox;
    modeCombo->addItem(tr("Inline"));
    modeCombo->addItem(tr("Filtered Popup"));
    modeCombo->addItem(tr("Unfiltered Popup"));
    modeCombo->setCurrentIndex(1);

    QLabel *caseLabel = new QLabel;
    caseLabel->setText(tr("Case Sensitivity"));
    caseCombo = new QComboBox;
    caseCombo->addItem(tr("Case Insensitive"));
    caseCombo->addItem(tr("Case Sensitive"));
    caseCombo->setCurrentIndex(0);
//! [0]

//! [1]
    QLabel *separatorLabel = new QLabel;
    separatorLabel->setText(tr("Tree Separator"));

    QLineEdit *separatorLineEdit = new QLineEdit;
    separatorLineEdit->setText(completer->separator());
    connect(separatorLineEdit, SIGNAL(textChanged(QString)),
            completer, SLOT(setSeparator(QString)));

    QCheckBox *wrapCheckBox = new QCheckBox;
    wrapCheckBox->setText(tr("Wrap around completions"));
    wrapCheckBox->setChecked(completer->wrapAround());
    connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool)));

    contentsLabel = new QLabel;
    contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(separatorLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(updateContentsLabel(QString)));

    treeView = new QTreeView;
    treeView->setModel(completer->model());
    treeView->header()->hide();
    treeView->expandAll();
//! [1]

//! [2]
    connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int)));
    connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int)));

    lineEdit = new QLineEdit;
    lineEdit->setCompleter(completer);
//! [2]

//! [3]
    QGridLayout *layout = new QGridLayout;
    layout->addWidget(modelLabel, 0, 0); layout->addWidget(treeView, 0, 1);
    layout->addWidget(modeLabel, 1, 0);  layout->addWidget(modeCombo, 1, 1);
    layout->addWidget(caseLabel, 2, 0);  layout->addWidget(caseCombo, 2, 1);
    layout->addWidget(separatorLabel, 3, 0); layout->addWidget(separatorLineEdit, 3, 1);
    layout->addWidget(wrapCheckBox, 4, 0);
    layout->addWidget(contentsLabel, 5, 0, 1, 2);
    layout->addWidget(lineEdit, 6, 0, 1, 2);
    centralWidget->setLayout(layout);
    setCentralWidget(centralWidget);

    changeCase(caseCombo->currentIndex());
    changeMode(modeCombo->currentIndex());

    setWindowTitle(tr("Tree Model Completer"));
    lineEdit->setFocus();
}
Пример #27
0
LH_CursorController::LH_CursorController()
{
    updating_link_data_ = false;
    setup_link_json_data_ = new LH_Qt_QString(this, "Cursor Data", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDEVALUE /*| LH_FLAG_HIDDEN*/);
    setup_link_json_data_->setHelp("<p>This field holds the data for this cursor; all cursor objects by default link themselves to \"Primary Cursor\".</p>"
                                   "<p>You only need change the name of this link if your layout needs more than one cursor.");

    setup_link_postback_ = new LH_Qt_QString(this, "Cursor Postback", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSOURCE | LH_FLAG_READONLY | LH_FLAG_HIDDEN);

    setup_link_current_pos = new LH_Qt_QString(this, "Cursor Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY  /* | LH_FLAG_HIDDEN*/);
    setup_link_current_pos->setHelp("<p>Displays the coordinates of the cursor at present, as well as whether the controller is currently active:</p>"
                                    "<p>(x,y) [active]</p>"
                                    "<p>This is mainly provided for advanced layout designers if they want to link something to the current cursor position.</p>");

    setup_link_selected_pos = new LH_Qt_QString(this, "Selected Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY  /* | LH_FLAG_HIDDEN*/);
    setup_link_selected_pos->setHelp("<p>Displays the coordinates of the selected point at present, as well as whether the controller is currently active:</p>"
                                     "<p>(x,y) [active]</p>"
                                     "<p>This is mainly provided for advanced layout designers if they want to link something to the current selection position.</p>");

    //setup_link_postback_->setLinkFilter("CursorPostback");
    //setup_link_json_data_->setLinkFilter("Cursors");

    setup_cursor_active_ = new LH_Qt_bool(this, "Active", cursor_data_.active, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
    setup_cursor_sel_x_ = new LH_Qt_int(this, "X (Selected)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
    setup_cursor_sel_y_ = new LH_Qt_int(this, "Y (Selected)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
    setup_cursor_x_ = new LH_Qt_int(this, "X (Current)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
    setup_cursor_y_ = new LH_Qt_int(this, "Y (Current)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);

    new LH_Qt_QString(this, "hr1", "<hr>", LH_FLAG_NOSOURCE | LH_FLAG_NOSINK | LH_FLAG_HIDETITLE, lh_type_string_html );

    setup_coordinate_ = new LH_Qt_QString(this, "Coordinate", "1,1", LH_FLAG_NOSAVE_DATA | LH_FLAG_READONLY | LH_FLAG_FIRST | LH_FLAG_HIDDEN);
    setup_coordinate_->setHelp("The current cursor location.");

    cursorModes.append((cursorMode){smSelectDeselect, true , "Activate, Move & Select / Deselect"});
    cursorModes.append((cursorMode){smSelect        , true , "Activate, Move & Select Only (one is always selected)"});
    cursorModes.append((cursorMode){smNone          , true , "Activate & Move Only (Highlighted option is selected)"});
    cursorModes.append((cursorMode){smNone          , false, "Move Only (Highlighted option is selected, always activated)"});
    cursorModes.append((cursorMode){smSelectDeselect, false, "Move & Select / Deselect Only (Always activated)"});
    cursorModes.append((cursorMode){smSelect        , false, "Move & Select Only (Always activated)"});

    //cursor_data_ = (cursorData){1,1,false,0,0,false,0,0,false,false,0,0,(bounds){(minmax){0,0},(minmax){0,0}}};

    QStringList modeNames = QStringList();
    foreach(cursorMode cm, cursorModes) modeNames.append(cm.description);
    setup_mode_ = new LH_Qt_QStringList(this,"Cursor Mode",modeNames,LH_FLAG_AUTORENDER);
    setup_mode_->setHelp("This allows the user to select how the cursor should behave. Each cursor mode is a combination of several options:<br/>"
                         "<br/>"
                         "<ul>"
                         "<li><b>Activate</b></br>"
                         "If a mode includes \"activation\" then in it's default state the cursor is hidden and nothing happens when using the movement or selection keys. Insetad the user must first press the activation key to display the cursor. Whilst active the cursor is visible, can be moved and, if appropriate, items can be selected and deselected. If activation is not included in the mode, then the cursor is assumed to always be active.</li>"
                         "<li><b>Select</b></br>"
                         "For modes that include selecting, the user must first move the cursor over the desired option and then press the select key before anything happens. If a mode does not include selection, then simply moving the cursor changes the selection immediately.</li>"
                         "</li>"
                         "<li><b>Deselect</b></br>"
                         "Some modes have select/deselect behaviour, specified by this option. With this ability the user can \"turn off\" everything; without it there will always be one item selected.</li>"
                         "</li>"
                         "</ul>");
    connect( setup_mode_, SIGNAL(changed()), this, SLOT(changeMode()) );

    setup_boundry_ = new LH_Qt_QString(this,"Boundries","1,1,3,3",0);
    setup_boundry_->setHelp("This box should contain the borders of the \"box\" the cusror can move in.</br></br>The format is [left],[top],[right],[bottom] <br/><br/>e.g.:<br/>\"1,1,1,4\" would denote a box one column wide and four rows high<br/>\"1,1,3,3\" would be a square of three columns and three rows.");
    connect( setup_boundry_, SIGNAL(changed()), this, SLOT(changeBounds()) );
    setup_boundry_loop_ = new LH_Qt_bool(this, "Loop at edges", false);
    setup_boundry_loop_->setHelp("By default when at the furthest edge of the box the cursor stops. Ticking this however will change that so that moving off one edge will bring the cursor back in on the opposite side.");

    setup_invalid_coordinates_ = new LH_Qt_QString(this,"Invalid Points\n(x,y;x,y;x,y)","",0);
    setup_invalid_coordinates_->setHelp("If you wish to create a \"void\" in the cusrsor space, this allows you to do so. List all the points here that the cursor is not allowed to land on and it will be prevented from doing so either by jumping over the invlid points to the next valid one or simply by blocking its movement.<br/><br/>The format is [x1],[y1];[x2],[y2];[x3][y3]; etc...<br/>e.g.: for the boundry \"1,1,2,5\" the invalid points \"1,2;1,3;1,4\" would prevent the cursor landing on any of the top three middle cells, creating a \"U\"-like shape.");
    setup_jump_invalid_ = new LH_Qt_bool(this, "Jump over invalid points", true);
    setup_jump_invalid_->setHelp("By default when the cursor tries to move onto an invlid point it \"jumps\" the cell in question, and keeps moving in the same direction until reaching one where it is allowed to be. Alternatively, checking this box will prevent this, turning invalid points into \"walls\" that have to be moved around manually.");

    setup_move_up_ = new LH_Qt_InputState(this,"Up","",0);
    setup_move_up_->setHelp("The key used to move the cursor up, usually the up key from the LCD control");
    connect( setup_move_up_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveUp(QString,int,int)) );

    setup_move_down_ = new LH_Qt_InputState(this,"Down","",0);
    setup_move_down_->setHelp("The key used to move the cursor down, usually the down key from the LCD control");
    connect( setup_move_down_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveDown(QString,int,int)) );

    setup_move_left_ = new LH_Qt_InputState(this,"Left","",0);
    setup_move_left_->setHelp("The key used to move the cursor left, usually the left key from the LCD control");
    connect( setup_move_left_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveLeft(QString,int,int)) );

    setup_move_right_ = new LH_Qt_InputState(this,"Right","",0);
    setup_move_right_->setHelp("The key used to move the cursor right, usually the right key from the LCD control");
    connect( setup_move_right_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveRight(QString,int,int)) );

    setup_select_ = new LH_Qt_InputState(this,"Select","",0);
    setup_select_->setHelp("The key used to select the currently highlighted option, usually the Ok key from the LCD control");
    connect( setup_select_, SIGNAL(input(QString,int,int)), this, SLOT(doSelect(QString,int,int)) );

    setup_reselect_ = new LH_Qt_InputState(this,"Reselect","",0);
    setup_reselect_->setHelp("The key used to reselect the previously selected highlighted option. Usually this is unused, but is very useful for menu layouts where it acts as a \"return to last layout\" (or cancel) command");
    connect( setup_reselect_, SIGNAL(input(QString,int,int)), this, SLOT(doReselect(QString,int,int)) );

    setup_activate_ = new LH_Qt_InputState(this,"Enable","",0);
    setup_activate_->setHelp("The key used to activate the cursor control");
    connect( setup_activate_, SIGNAL(input(QString,int,int)), this, SLOT(doActivate(QString,int,int)) );

    setup_persistent_ = new LH_Qt_bool(this,"Persistent Selection",false);
    setup_persistent_->setHelp("Ticking this box will cause the system to automatically recall the cursor's last position whether you save the layout or not.<br/><br/>This is mainly of use within menu layouts and allows the menu to open with the last selected option still highlighted.");
    setup_persistent_autoselect_ = new LH_Qt_bool(this,"Auto-reselect",false, LH_FLAG_HIDDEN);
    setup_persistent_autoselect_->setHelp("When recovering a persited selection, this option determins if the option is merely highlighed (i.e. the cursor is positioned on it) or if the option is actually selected.");
    setup_persistent_file_ = new LH_Qt_QFileInfo(this, "Persistence File", QFileInfo(), LH_FLAG_HIDDEN);
    setup_persistent_file_->setHelp("The file in which to save the persisted location.<br/><br/>Note that you can use this to make serveral layouts work together as though they were all parts of the same layout by pointing them all to this file, thus causing the cursor position to persist accross them.");

#ifdef ENABLE_VIRTUAL_CURSOR_KEYS
    setup_virtual_keys_ = new LH_Qt_html(this, 0, LH_FLAG_NOSOURCE | LH_FLAG_NOSINK | LH_FLAG_LAST );
    setup_virtual_keys_->setTitle("<hr><center><table>"
                                 "<tr><td>  </td><td style='background-color:silver;'><center><a href='up'>[  Up  ]</a></center></td><td>  </td><td>         </td><td style='background-color:silver;'><center><a href='act'>[ Act ]</a></center></td></tr>"
                                 "<tr><td style='background-color:silver;'><center><a href='left'>[Left]</a></center></td><td style='background-color:silver;'><center><a href='sel'>[  OK  ]</a></center></td><td style='background-color:silver;'><center><a href='right'>[Right]</a></center></td><td>  </td></tr>"
                                 "<tr><td>  </td><td style='background-color:silver;'><center><a href='down'>[Down]</a></center></td><td>  </td><td>  </td><td style='background-color:silver;'><center><a href='resel'>[  Re  ]</a></center></td></tr>"
                                 "</table></center>");
    connect(setup_virtual_keys_, SIGNAL(change(QString)), this, SLOT(virtualKeyPress(QString)) );
#endif

    connect(setup_link_postback_,SIGNAL(set()),this,SLOT(processPostback()));
    connect(setup_link_postback_,SIGNAL(changed()),this,SLOT(processPostback()));
    connect(setup_persistent_, SIGNAL(changed()), this, SLOT(changePersistent()));
    connect(setup_persistent_file_, SIGNAL(changed()), this, SLOT(loadPersistedSelection()));

    connect(setup_cursor_active_, SIGNAL(changed()), this, SLOT(changeCursorData()));
    connect(setup_cursor_sel_x_, SIGNAL(changed()), this, SLOT(changeCursorData()));
    connect(setup_cursor_sel_y_, SIGNAL(changed()), this, SLOT(changeCursorData()));
    connect(setup_cursor_x_, SIGNAL(changed()), this, SLOT(changeCursorData()));
    connect(setup_cursor_y_, SIGNAL(changed()), this, SLOT(changeCursorData()));

    connect(setup_cursor_active_, SIGNAL(set()), this, SLOT(changeCursorData()));
    connect(setup_cursor_sel_x_, SIGNAL(set()), this, SLOT(changeCursorData()));
    connect(setup_cursor_sel_y_, SIGNAL(set()), this, SLOT(changeCursorData()));
    connect(setup_cursor_x_, SIGNAL(set()), this, SLOT(changeCursorData()));
    connect(setup_cursor_y_, SIGNAL(set()), this, SLOT(changeCursorData()));

    connect(this, SIGNAL(initialized()), this, SLOT(initialiseLinking()));

    updateLocation(0,0);

#ifdef LH_CF
    add_cf_target(setup_cursor_active_);
    add_cf_source(setup_cursor_active_);
    add_cf_target(setup_cursor_sel_x_);
    add_cf_source(setup_cursor_sel_x_);
    add_cf_target(setup_cursor_sel_y_);
    add_cf_source(setup_cursor_sel_y_);
    add_cf_target(setup_cursor_x_);
    add_cf_source(setup_cursor_x_);
    add_cf_target(setup_cursor_y_);
    add_cf_source(setup_cursor_y_);
#endif

}
Пример #28
0
/*---------------------------------------------------------------------*//**
	スタンバイモードへ移行
**//*---------------------------------------------------------------------*/
void EnemyMode::toStanby()
{
	changeMode((s16)ACT_STANDBY, false);
}
Пример #29
0
/**
 * \brief Set up the dock palette widgets
 */
void UBBoardPaletteManager::setupDockPaletteWidgets()
{

    //------------------------------------------------//
    // Create the widgets for the dock palettes

    mpPageNavigWidget = new UBPageNavigationWidget();

#ifdef USE_WEB_WIDGET
    mpLibWidget = new UBLibWidget();
#endif

    mpCachePropWidget = new UBCachePropertiesWidget();

    mpDownloadWidget = new UBDockDownloadWidget();

    // Add the dock palettes
    mLeftPalette = new UBLeftPalette(mContainer);

    // LEFT palette widgets
    mpPageNavigWidget = new UBPageNavigationWidget();
    mLeftPalette->registerWidget(mpPageNavigWidget);
    mLeftPalette->addTab(mpPageNavigWidget);

    if(UBSettings::settings()->teacherGuidePageZeroActivated || UBSettings::settings()->teacherGuideLessonPagesActivated){
        mpTeacherGuideWidget = new UBDockTeacherGuideWidget();
        mLeftPalette->registerWidget(mpTeacherGuideWidget);
        mLeftPalette->addTab(mpTeacherGuideWidget);
    }

    mLeftPalette->connectSignals();

    mRightPalette = new UBRightPalette(mContainer);
    // RIGHT palette widgets
#ifndef USE_WEB_WIDGET
    mpFeaturesWidget = new UBFeaturesWidget();
	mRightPalette->registerWidget(mpFeaturesWidget);
	mRightPalette->addTab(mpFeaturesWidget);
#endif

    //Do not show deprecated lib widget to prevent collisions. Uncomment to return lib widget

#ifdef USE_WEB_WIDGET
    mRightPalette->registerWidget(mpLibWidget);
    mRightPalette->addTab(mpLibWidget);
#endif


    // The cache widget will be visible only if a cache is put on the page
    mRightPalette->registerWidget(mpCachePropWidget);

    //  The download widget will be part of the right palette but
    //  will become visible only when the first download starts
    mRightPalette->registerWidget(mpDownloadWidget);
    mRightPalette->connectSignals();
    changeMode(eUBDockPaletteWidget_BOARD, true);

    // Hide the tabs that must be hidden
    mRightPalette->removeTab(mpDownloadWidget);
    mRightPalette->removeTab(mpCachePropWidget);

}
Пример #30
-1
/*----------------------------------------------------------------------------*/
static enum result canInit(void *object, const void *configBase)
{
  const struct CanConfig * const config = configBase;
  const struct CanBaseConfig baseConfig = {
      .channel = config->channel,
      .rx = config->rx,
      .tx = config->tx
  };
  struct Can * const interface = object;
  enum result res;

  /* Call base class constructor */
  if ((res = CanBase->init(object, &baseConfig)) != E_OK)
    return res;

  interface->base.handler = interruptHandler;
  interface->callback = 0;
  interface->timer = config->timer;
  interface->mode = MODE_LISTENER;

  const size_t poolSize = config->rxBuffers + config->txBuffers;

  res = queueInit(&interface->pool, sizeof(struct CanMessage *), poolSize);
  if (res != E_OK)
    return res;
  res = queueInit(&interface->rxQueue, sizeof(struct CanMessage *),
      config->rxBuffers);
  if (res != E_OK)
    return res;
  res = queueInit(&interface->txQueue, sizeof(struct CanMessage *),
      config->txBuffers);
  if (res != E_OK)
    return res;

  interface->poolBuffer = malloc(sizeof(struct CanStandardMessage) * poolSize);

  struct CanStandardMessage *message = interface->poolBuffer;

  for (size_t index = 0; index < poolSize; ++index)
  {
    queuePush(&interface->pool, &message);
    ++message;
  }

  LPC_CAN_Type * const reg = interface->base.reg;

  reg->MOD = MOD_RM; /* Reset CAN */
  reg->IER = 0; /* Disable Receive Interrupt */
  reg->GSR = 0; /* Reset error counter */

  interface->rate = config->rate;
  reg->BTR = calcBusTimings(interface, interface->rate);

  /* Disable Reset mode and activate Listen Only mode */
  reg->MOD = MOD_LOM;

  LPC_CANAF->AFMR = AFMR_AccBP; //FIXME

#ifdef CONFIG_CAN_PM
  if ((res = pmRegister(interface, powerStateHandler)) != E_OK)
    return res;
#endif

  irqSetPriority(interface->base.irq, config->priority);

  /* Enable interrupts on message reception and bus error */
  reg->IER = IER_RIE | IER_BEIE;

  return E_OK;
}
/*----------------------------------------------------------------------------*/
static void canDeinit(void *object)
{
  struct Can * const interface = object;
  LPC_CAN_Type * const reg = interface->base.reg;

  /* Disable all interrupts */
  reg->IER = 0;

#ifdef CONFIG_CAN_PM
  pmUnregister(interface);
#endif

  queueDeinit(&interface->txQueue);
  queueDeinit(&interface->rxQueue);
  CanBase->deinit(interface);
}
/*----------------------------------------------------------------------------*/
static enum result canCallback(void *object, void (*callback)(void *),
    void *argument)
{
  struct Can * const interface = object;

  interface->callbackArgument = argument;
  interface->callback = callback;
  return E_OK;
}
/*----------------------------------------------------------------------------*/
static enum result canGet(void *object, enum ifOption option, void *data)
{
  struct Can * const interface = object;

  switch (option)
  {
    case IF_AVAILABLE:
      *(size_t *)data = queueSize(&interface->rxQueue);
      return E_OK;

    case IF_PENDING:
      *(size_t *)data = queueSize(&interface->txQueue);
      return E_OK;

    case IF_RATE:
      *(uint32_t *)data = interface->rate;
      return E_OK;

    default:
      return E_INVALID;
  }
}
/*----------------------------------------------------------------------------*/
static enum result canSet(void *object, enum ifOption option,
    const void *data)
{
  struct Can * const interface = object;
  LPC_CAN_Type * const reg = interface->base.reg;

  switch ((enum canOption)option)
  {
    case IF_CAN_ACTIVE:
      changeMode(interface, MODE_ACTIVE);
      return E_OK;

    case IF_CAN_LISTENER:
      changeMode(interface, MODE_LISTENER);
      return E_OK;

    case IF_CAN_LOOPBACK:
      changeMode(interface, MODE_LOOPBACK);
      return E_OK;

    default:
      break;
  }

  switch (option)
  {
    case IF_RATE:
    {
      const uint32_t rate = *(const uint32_t *)data;

      interface->rate = rate;

      reg->MOD |= MOD_RM; /* Enable Reset mode */
      reg->BTR = calcBusTimings(interface, rate);
      reg->MOD &= ~MOD_RM;

      return E_OK;
    }

    default:
      return E_INVALID;
  }
}
/*----------------------------------------------------------------------------*/
static size_t canRead(void *object, void *buffer, size_t length)
{
  assert(length % sizeof(struct CanStandardMessage) == 0);

  struct Can * const interface = object;
  struct CanStandardMessage *output = buffer;
  size_t read = 0;

  while (read < length && !queueEmpty(&interface->rxQueue))
  {
    struct CanMessage *input;
    const irqState state = irqSave();

    queuePop(&interface->rxQueue, &input);
    memcpy(output, input, sizeof(*output));
    queuePush(&interface->pool, &input);

    irqRestore(state);

    read += sizeof(*output);
    ++output;
  }

  return read;
}