Beispiel #1
0
progressDialog::progressDialog(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags){

    ui.setupUi(this);

    Consumer *c = new Consumer();
    Producer *p = new Producer();

    Thread *t1 = new Thread(0);
    Thread *t2 = new Thread(0);

    connect(this,SIGNAL(begin(bool)),c,SLOT(startReceiving(bool)));
    connect(c,SIGNAL(initiate(bool)),p,SLOT(produce(bool)));
    connect(p,SIGNAL(sendPacket(const QByteArray,bool)),c,SLOT(receiveFrame(const QByteArray,bool)));
    connect(ui.pushButton,SIGNAL(clicked(bool)),this,SLOT(_begin(bool)));
    connect(p,SIGNAL(halt(bool)),c,SLOT(startReceiving(bool)));
	connect(c,SIGNAL(blockDone()),p,SLOT(frameData()));
	connect(c,SIGNAL(measure(bool)),p,SLOT(measurement(bool)),Qt::DirectConnection);
	connect(c,SIGNAL(openDialog()),this,SLOT(startDlg()));
	connect(c,SIGNAL(closeDialog()),this,SLOT(closeDlg()));
	connect(p,SIGNAL(setDlgMax(int)),this,SLOT(setMaxVal(int)));
	connect(p,SIGNAL(setDlgVal(int)),this,SLOT(setVal(int)));
	connect(p,SIGNAL(setSeconds(int)),this,SLOT(setSecondsRemaining(int)));

    c->moveToThread(t1);
    p->moveToThread(t2);

    t1->start();
    t2->start();
}
Beispiel #2
0
//  NAME: testdlg()        
//
//  REMARKS:  creates a modeless dialog which calls several API functions
//            (from the application context & document context)
//
//
//              NOTEs: 
//  RETURNS:
//      void 
// 
void testdlg()
{
	if( modelessDlg ) {
		// dialog was already created, just display it
		// (the dialog only gets deallocated when docman.arx is unloaded)
		modelessDlg->ShowWindow( SW_SHOWNORMAL );
		return;
	}

	if( !modelessDlg && !startDlg() ) {
		ads_printf( "Failed to create modeless dialog box.\n" );
	}

}