Esempio n. 1
0
MainInterface::MainInterface(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MainInterface)
{
    ui->setupUi(this);

    key_pressed = false;
    start_or_end = true;

    target = 0;

    FPGA_Init();

    XYZ_Update(L_X_CURRENT);
    XYZ_Update(L_Y_CURRENT);
    XYZ_Update(L_Z_CURRENT);

    XYZ_Update(L_X_ABSOLUTE);
    XYZ_Update(L_Y_ABSOLUTE);
    XYZ_Update(L_Z_ABSOLUTE);

    XYZ_Update(L_X_REMAIN);
    XYZ_Update(L_Y_REMAIN);
    XYZ_Update(L_Z_REMAIN);

    axisIndexUpdate();

    connect(spark_info ,SIGNAL(xyzChange(int)) ,this ,SLOT(XYZ_Update(int)));
    connect(spark_info ,SIGNAL(coorIndexChange()) ,this ,SLOT(axisIndexUpdate()));

    model = new QStandardItemModel;
    /*数据表索引发生改变*/
    connect(spark_info ,SIGNAL(tableChange()) ,this ,SLOT(tableDataUpdate()));
    /*数据表的加工段和当前加工行发生改变*/
    connect(spark_info ,SIGNAL(tableRowChange()),this ,SLOT(tableRollUpdate()));

    /*初始化功能栏*/
    initFuncBar();

    /*初始化为显示态*/
    tableStateUpdate(TABLE_SHOW);

    spark = new SparkThread();
    connect(spark_info ,SIGNAL(startChange()) ,spark ,SLOT(sparkChange()));

    scan = new ScanThread();
    scan->start();
    connect(this ,SIGNAL(keyPress(int)) ,scan ,SLOT(keyPress(int)));
    connect(this ,SIGNAL(keyRelease(int)) ,scan ,SLOT(keyRelease(int)));

    mesg = new MesgBox(this);
    mesg ->setHidden(false);

    menu = new StartMenu(this);
    menu ->setHidden(true);
    connect(menu ,SIGNAL(finish(bool)) ,this ,SLOT(menuShow(bool)));

    timer = new QTimer(this);
    timer->setInterval(300);
    connect(timer ,SIGNAL(timeout()) ,this ,SLOT(menuTimeout()));

    ui->verticalLayout->addWidget(mesg);
    ui->verticalLayout->addWidget(menu);

    command = new QCommand(this);
    command->setHidden(false);
    /*命令行输入结束时的信号连接*/
    connect(command ,SIGNAL(finish()) ,this ,SLOT(commandFinish()));

    alerts = new QAlerts(this);
    alerts->setHidden(false);
    connect(spark_info ,SIGNAL(boolChange()) ,alerts ,SLOT(alertCheck()));

    clear = new ClearScreen(parent);
    clear->setHidden(true);

#ifndef Q_WS_X11
    QRect screen_size = qApp->desktop()->screenGeometry();
    clear->setGeometry(0, 0, screen_size.width(), screen_size.height());
    clear->setCursor(QCursor(Qt::BlankCursor));

    watcher = new QFileSystemWatcher(this);
    watcher->addPath(DEV_DIR);
    connect(watcher ,SIGNAL(directoryChanged(QString)) ,this ,SLOT(mouseChange(QString)));

    if(!QFile::exists(USB_MOUSE)){
        setCursor(QCursor(Qt::BlankCursor));
        is_usb = false;
    }else{
        setCursor(QCursor(Qt::ArrowCursor));
        is_usb = true;
    }
#else
    clear->setGeometry(0 ,0 ,1024 ,768);
#endif
    connect(scan ,SIGNAL(clear()) ,clear ,SLOT(show()));

    ui->horizontalLayout_3->addWidget(command);
    ui->horizontalLayout_4->addWidget(alerts);
}
Esempio n. 2
0
void SDI_Init(void) 
{
	FPGAConfig conf = FPGA_CONFIG_DEFAULT(0x80000000);
	FPGA_Init( &conf );
}