Пример #1
0
AudioDevice *Audio::getDevice(unsigned index, DeviceMode mode)
{
    if(!scanDevices(index))
        return NULL;

    return NULL;
}
Пример #2
0
VideoProvider::VideoProvider()
    : QObject()
    , m_snapTimer(0)
{
    // defer video initialization, to show gui...
    QTimer::singleShot(50, this, SLOT(scanDevices()));
}
Пример #3
0
long CDPreferences::onCmdDeviceScan(FXObject*,FXSelector,void*)
{
    FXint i,n;
    std::vector<FXString> devices;
    std::vector<FXString>::iterator iter;

    scanDevices(devices);

    for(iter=devices.begin(); iter!=devices.end(); ++iter)
    {
        n=devlist->getNumItems();
        for(i=0; i<n; i++)
        {
            if(*iter==devlist->getItemText(i))
                break;
        }

        if(i==n)
        {
            devlist->appendItem(*iter);
            if(std::find(adddev.begin(),adddev.end(),*iter)==adddev.end())
                adddev.push_back(*iter);
        }
    }

    return 1;
}
Пример #4
0
int freespace_perform() {
    struct timeval tv = {0, 0};
    int rc;

    scanDevices();

    rc = libusb_handle_events_timeout(freespace_libusb_context, &tv);
    return libusb_to_freespace_error(rc);
}
Пример #5
0
VJoystickMainWindow::VJoystickMainWindow(QWidget *parent) :
    QMainWindow(parent), m_ui(new Ui::VJoystickMainWindow), m_adapter(0)
{
    m_ui->setupUi(this);

    connect(m_ui->pushButtonScan, SIGNAL(clicked()), this, SLOT(scanDevices()));
    connect(m_ui->pushButtonConnect, SIGNAL(clicked()), this, SLOT(connectToDevices()));
    connect(m_ui->pushButtonDisconnect, SIGNAL(clicked()), this, SLOT(disconnectFromDevices()));

    connect(m_ui->actionScan, SIGNAL(triggered()), this, SLOT(scanDevices()));
    connect(m_ui->actionConnect, SIGNAL(triggered()), this, SLOT(connectToDevices()));
    connect(m_ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(disconnectFromDevices()));

    connect(m_ui->actionExit,  SIGNAL(triggered()), this, SLOT(appExit()));
    connect(m_ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));

    m_ui->comboBoxSelectJoy->setDisabled(true);
    setJoystickInfoVisible(false);
    setDeviceControlVisible(false);

    m_ui->ballWidget->hide();

    m_ui->pushButtonScan->setFocus();
}
Пример #6
0
int freespace_getDeviceList(FreespaceDeviceId* idList,
                            int maxIds,
                            int* numIds) {
    int i;
    int rc;
    *numIds = 0;

    rc = scanDevices();
    if (rc != FREESPACE_SUCCESS) {
        return rc;
    }

    for (i = 0; i < FREESPACE_MAXIMUM_DEVICE_COUNT && *numIds < maxIds; i++) {
        if (devices[i] != NULL) {
            idList[*numIds] = devices[i]->id_;
            *numIds = *numIds + 1;
        }
    }

    return FREESPACE_SUCCESS;
}
Пример #7
0
bool Audio::is_available(unsigned index)
{
    return scanDevices(index);
}
Пример #8
0
BpdeMainWindow::BpdeMainWindow(RInside& R, const QString& sourceFile, QObject *parent)
    : R(R),
    sourceFile(sourceFile), x(), y(), H(), solver(NULL)
{
    tempfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("tfile <- tempfile()")));
    svgfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("sfile <- tempfile()")));

    QWidget *window = new QWidget;
    window->setWindowTitle("BpdeGUI");
    setCentralWidget(window);

    QGroupBox *runParameters = new QGroupBox("Параметры запуска");
    openMPEnabled = new QRadioButton("&OpenMP");
    openClEnabled = new QRadioButton("&OpenCL");

    openMPEnabled->setChecked(true);

    connect(openMPEnabled, SIGNAL(clicked()), this, SLOT(loadSource()));
    connect(openClEnabled, SIGNAL(clicked()), this, SLOT(loadSource()));

    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(openMPEnabled);
    vbox->addWidget(openClEnabled);


    QLabel *threadsLabel = new QLabel("Количество потоков");
    threadsLineEdit = new QLineEdit("4");
    QHBoxLayout *threadNumber = new QHBoxLayout;
    threadNumber->addWidget(threadsLabel);
    threadNumber->addWidget(threadsLineEdit);

    QHBoxLayout *deviceLayout = new QHBoxLayout;
    QLabel *deviceLabel = new QLabel("Устройство");
    deviceComboBox = new QComboBox();

    scanDevices();
    for (std::vector<cl::Device>::iterator it = devices.begin(); it != devices.end(); it++)
        deviceComboBox->addItem((*it).getInfo<CL_DEVICE_NAME>().c_str());

    connect(deviceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSource()));

    deviceLayout->addWidget(deviceLabel);
    deviceLayout->addWidget(deviceComboBox);

    QHBoxLayout* runLayout = new QHBoxLayout;
    runButton = new QPushButton("Начать вычисления", this);
    qDebug() << "Connect : " <<
    connect(runButton, SIGNAL(clicked()), this, SLOT(solve()));
    runLayout->addWidget(runButton);

    QVBoxLayout* ulLayout = new QVBoxLayout;
    ulLayout->addLayout(vbox);
    ulLayout->addLayout(threadNumber);
    ulLayout->addLayout(deviceLayout);
    ulLayout->addLayout(runLayout);

    runParameters->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    runParameters->setLayout(ulLayout);

    QButtonGroup *kernelGroup = new QButtonGroup;
    kernelGroup->addButton(openMPEnabled, 0);
    kernelGroup->addButton(openClEnabled, 1);

    QGroupBox *solveParamBox = new QGroupBox("Настройки вычислительного метода");

    QHBoxLayout *iterationsLayout = new QHBoxLayout;
    QHBoxLayout *stepLayout = new QHBoxLayout;
    QLabel *sourceFileLabel = new QLabel("SourceFile");
    sourceFileEdit = new QLineEdit(sourceFile);
    iterationsEdit = new QLineEdit("10000");
    stepEdit = new QLineEdit("3600");
    QLabel *iterationsLabel = new QLabel("Итерации");
    QLabel *stepLabel = new QLabel("Шаг            ");
    QHBoxLayout *exportLayout = new QHBoxLayout;
    exportImage = new QPushButton("Экспорт изотерм");
    export3D = new QPushButton("Экспорт 3D модели");
    connect(exportImage, SIGNAL(clicked()), this, SLOT(exportIsoterms()));
    connect(export3D, SIGNAL(clicked()), this, SLOT(export3DModel()));

    iterationsLayout->addWidget(iterationsLabel);
    iterationsLayout->addWidget(iterationsEdit);
    stepLayout->addWidget(stepLabel);
    stepLayout->addWidget(stepEdit);

    exportLayout->addWidget(exportImage);
    exportLayout->addWidget(export3D);

    svg = new QSvgWidget();
    loadSource();

    QVBoxLayout *solveParamLayout = new QVBoxLayout;
    solveParamLayout->addWidget(sourceFileLabel);
    solveParamLayout->addWidget(sourceFileEdit);
    solveParamLayout->addLayout(iterationsLayout);
    solveParamLayout->addLayout(stepLayout);
    solveParamLayout->addLayout(exportLayout);

    solveParamBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    solveParamBox->setLayout(solveParamLayout);

    QHBoxLayout *upperlayout = new QHBoxLayout;
    upperlayout->addWidget(runParameters);
    upperlayout->addWidget(solveParamBox);

    QHBoxLayout *lowerlayout = new QHBoxLayout;
    lowerlayout->addWidget(svg);

    QVBoxLayout *outer = new QVBoxLayout;
    outer->addLayout(upperlayout);
    outer->addLayout(lowerlayout);
    window->setLayout(outer);
}