void DefineEntry::deleteProperty()
{
#ifdef DEBUG
    qDebug("void DefineEntry::deleteProperty()");
#endif

    if (isUsed)
    {
        if (QMessageBox::warning(this, "Delete", "By deleting this property, you\nwill delete all data associated\nwith this property in the nodes of\nthis type.\nAre you sure??", 1, 2, 0) != 1)
            return;

        int deletedID = static_cast<PropertyBoxItem *>(EntryProperties->item(EntryProperties->currentItem()))->getID();
        if (deletedID)
            deletedProperties.append(deletedID);
#ifdef DEBUG
        qDebug("deleted property id: %d", deletedID);
#endif

    }

    EntryProperties->setFocus();
    EntryProperties->removeItem(EntryProperties->currentItem());

    if (!EntryProperties->count())
    {
        PropertyName->setText("");
        disableWidgets();
    }
}
DefineEntry::DefineEntry(QWidget* parent, const char* name, bool modal, WFlags fl)
        : DefineEntryBase(parent, name, modal, fl)
{
    disableWidgets();
    propertyNChanged = false;
    editEntry = 0;
    isUsed = false;
}
Esempio n. 3
0
void ViewManager::attachRewriterView()
{
    if (currentDesignDocument()->rewriterView()) {
        currentDesignDocument()->rewriterView()->setWidgetStatusCallback([this](bool enable) {
            if (enable)
                enableWidgets();
            else
                disableWidgets();
        });

        currentModel()->setRewriterView(currentDesignDocument()->rewriterView());
        currentDesignDocument()->rewriterView()->reactivateTextMofifierChangeSignals();
    }
}
Esempio n. 4
0
GroupWisePrivacyDialog::GroupWisePrivacyDialog( GroupWiseAccount * account, QWidget *parent, const char * /*name*/ )
 : KDialog(  parent)
 , m_account( account ), m_dirty( false ), m_searchDlg(0)
{
	setCaption(i18nc( "Account specific privacy settings", "Manage Privacy for %1", account->accountId() ));
	setButtons(KDialog::Ok|KDialog::Apply|KDialog::Cancel);
	setDefaultButton(Ok);
	setModal(false);
	QWidget * wid = new QWidget( this );
	m_privacy.setupUi( wid );
	setMainWidget( wid );
	PrivacyManager * mgr = m_account->client()->privacyManager();
	// populate the widget;
	// admin lock
	if ( mgr->isPrivacyLocked() )
	{
		m_privacy.status->setText( i18n( "Privacy settings have been administratively locked" ) );
		disableWidgets();
	}

	populateWidgets();

	m_privacy.allowList->setSelectionMode( Q3ListBox::Extended );
	m_privacy.denyList->setSelectionMode( Q3ListBox::Extended );

	connect( m_privacy.btnAllow, SIGNAL(clicked()), SLOT(slotAllowClicked()) );
	connect( m_privacy.btnBlock, SIGNAL(clicked()), SLOT(slotBlockClicked()) );
	connect( m_privacy.btnAdd, SIGNAL(clicked()), SLOT(slotAddClicked()) );
	connect( m_privacy.btnRemove, SIGNAL(clicked()), SLOT(slotRemoveClicked()) );
	connect( m_privacy.allowList, SIGNAL(selectionChanged()), SLOT(slotAllowListClicked()) );
	connect( m_privacy.denyList, SIGNAL(selectionChanged()), SLOT(slotDenyListClicked()) );
	connect( mgr, SIGNAL(privacyChanged(QString,bool)), SLOT(slotPrivacyChanged()) );
	connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
	connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
	m_privacy.btnAdd->setEnabled( true );
	m_privacy.btnAllow->setEnabled( false );
	m_privacy.btnBlock->setEnabled( false );
	m_privacy.btnRemove->setEnabled( false );

/*	showButtonOK( true );
	showButtonApply( true );
	showButtonCancel( true );
	*/
	show();
}
Esempio n. 5
0
//--------------------------------------------------------------------------------------
// Mwars::Mwars()
// the Constructor
//--------------------------------------------------------------------------------------
Mwars::Mwars(QWidget *parent) : QMainWindow(parent), ui(new Ui::mwarsForm)  {

    ui->setupUi(this);  // Ui:mwarsForm ui

    //*********** two timers
    QTimer *keepServerAliveTimer = new QTimer(this);  // instantiate timer
    QTimer *testTimer = new QTimer(this);


    // a. TCP stream to scanner server
    // clientSocket: client socket sends stream to scanner. clientSocket already exists
    // Q_SIGNALS signals emitted by socket  unimplemented: void hostFound() void connected()
    connect( &clientSocket, SIGNAL(error(QAbstractSocket::SocketError)),
            this, SLOT(clientSocketError(QAbstractSocket::SocketError)) );
    connect( &clientSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
            this, SLOT(clientSocketState(QAbstractSocket::SocketState)) );

    connect( &clientSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) );
    connect( &clientSocket, SIGNAL(disconnected()), this, SLOT(disconnectedz()) );

    // b. UDP stream from opencv / camera
    listenSocket = new QUdpSocket ( this );
    listenSocket->bind(9988 );
    connect( listenSocket, SIGNAL(readyRead()),this, SLOT(OnReadyRead()) );

    //signals from within code
    connect( this, SIGNAL(connectScanner()), this, SLOT(connectToScanner()));  // Constructor
    connect( keepServerAliveTimer, SIGNAL(timeout()), this, SLOT(keepServerAlive()));

//    connect( testTimer, SIGNAL(timeout()), this, SLOT(testSignal()));

    // signals from ui
    connect( ui->xSlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->ySlider, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));
    connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(sendScanCmd()));

    //connect( ui->pbLaserToggle, SIGNAL(clicked()), this, SLOT(laserToggle()));
    connect( ui->pushButtonLaserDisableToggle, SIGNAL(clicked()), this, SLOT(laserDisableToggle()));
    connect( ui->pushButtonScannerToggle, SIGNAL(clicked()), this, SLOT(scannerToggle()));
    connect( ui->pushButtonConnect, SIGNAL(clicked()), this, SLOT(connectToScanner()));
    connect( ui->radioButtonVerboseOn, SIGNAL(clicked()), this, SLOT(verboseOn()));
    connect( ui->radioButtonVerboseOff, SIGNAL(clicked()), this, SLOT(verboseOff()));
    connect( ui->pushButtonResetScanner, SIGNAL(clicked()), this, SLOT(resetScanner()));
    connect( ui->pushButtonCameraDataToggle, SIGNAL(clicked()), this, SLOT(cameraDataToggle()));
    connect( ui->pushButtonTestDataToggle, SIGNAL(clicked()), this, SLOT(testDataToggle()));
    //connect( ui->pbAlignBS, SIGNAL(clicked()), this, SLOT(alignBoresight()));

    connect( ui->pbCalibrateToggle, SIGNAL(clicked()), this, SLOT(calibrateToggle()));
    connect( ui->pbCalSetULHC, SIGNAL(clicked()), this, SLOT(calSetULHC()));
    connect( ui->pbCalSetLRHC, SIGNAL(clicked()), this, SLOT(calSetLRHC()));
    connect( ui->pbCalFullFrame, SIGNAL(clicked()), this, SLOT(calFullFrame()));
    connect( ui->pbCalHalfFrame, SIGNAL(clicked()), this, SLOT(calHalfFrame()));

    connect( ui->spinboxXCamTrim, SIGNAL(valueChanged(int)), this, SLOT(xCamTrim()));
    connect( ui->spinboxYCamTrim, SIGNAL(valueChanged(int)), this, SLOT(yCamTrim()));
    connect( ui->pbCamTrimOffset, SIGNAL(clicked()), this, SLOT(camTrimOffset()));

    connect( ui->sbXCamOffset, SIGNAL(valueChanged(int)), this, SLOT(xCamOffset()));
    connect( ui->sbYCamOffset, SIGNAL(valueChanged(int)), this, SLOT(yCamOffset()));
    connect( ui->pbCamOffset, SIGNAL(clicked()), this, SLOT(camScanOffset()));

    connect( ui->pbCalLaserBsight, SIGNAL(clicked()), this, SLOT(alignBoresight()));
    //connect( this, SIGNAL (testSignal()), this, SLOT (testSignal()));


    // temporary stuff to test parallax offset
    g_xLenWallFOV_mm = (1310 * 2);  // measured width, x axis, of FOV at target distance = range (mm)
    g_yLenWallFOV_mm = (975 * 2);
    g_xSF_pixelTomm =  (float)g_xLenWallFOV_mm / CAMERA_X_PIXELS;
    g_ySF_pixelTomm =  (float)g_yLenWallFOV_mm / CAMERA_Y_PIXELS;
    range_mm         = 2750;          // measured range cam to target (mm)


    //overwritten when cam file is read
    g_xScanFOVOrigin_su = DAC_X_MIN;		// scanner origin corresponding to x_camFOVOrigin (scan units)
    g_xScanFOVMax_su    = DAC_X_MAX;		// scanner max x corresponding to x_camFOVMax (scan units)

    // read camera to scanner calibration file. This reads the calibration parameters
    // and sets main slider and spin box values
    readXMLFile();

    ui->spinboxXCamTrim->setRange(-5000, +5000);
    ui->spinboxYCamTrim->setRange(-5000, +5000);
    ui->radioButtonVerboseOff->setChecked(true);

    clearStateWidets();				// clear Server State widget text

#ifdef FORCE_ENABLE_WIDGETS
    enableWidgets();
#else
     disableWidgets();				// control widgets get enabled when connected
#endif

    verbose = false;                // verbose OFF
    laserOnFlag = false;
    testDataEnableFlag = false;     // set by TestData button to turn on test data stream
    cameraDataEnableFlag = false;   // set by Camera Data button to turn on OpenCVcamera data stream
    laserDisableFlag = false;       // set by Laser On/Off button
    scannerOnFlag = false;          // set by Scanner On/Off button
    tcpConnected = false;           // tcp connected
    serverReady = false;
    calibrateFlag = false;

    setWindowTitle(tr("MWARS SCANNER CONSOLE"));



    // =================== start scannerserver comms ===============================
    //  a) UDP stream of co-ords and laser command from OpenCV Project mwars
    //  b) TCP connection to server in the scanner unit

    // 1. connect to the TCP server in the laser scanner unit
    emit connectScanner();              //runs connectToScanner


    // ==================== timers ==================================
    // start the keep alivetimer. Used to get response to update Console
    keepServerAliveTimer->start(1000);  //1000 = 1 sec

    //start the test signal timer for testSignal()
    // 1000 = 1 sec, 1 = 1mS
    //testTimer->start(100);             // 5 Hz
    //testTimer->start(10);              // 50 Hz
    //testTimer->start(20);              // 25 Hz
    // testTimer->start(60);              //  8 Hz
    // testTimer->start(50);              //  10 Hz

    sendScanCmd();     // init scanner, slew to slider values

    rectangleIsRunning = false;
}