Exemplo n.º 1
0
// Make a popup dialog box 
SpinBoard::SpinBoard( QWidget * parent, const char * name )
    : QDialog( parent, name, FALSE, WType_TopLevel )
{
	this->setCaption( "AViz: Set Spins" );

	// Create a hboxlayout that will fill the first row
	hb1 = new QHBox( this, "hb1" );

	// Create a label 
	QLabel * spinL = new QLabel( hb1, "spinL" );
	spinL->setText( " Type: ");

	// Create a combo box that will go into the
	// second column; entries in the combo box will
	// be made later
	spinCob = new QComboBox( FALSE, hb1, "spinSelection" );

	// Define a callback for this combo box
	connect( spinCob, SIGNAL(activated(int)), SLOT(setSpin()) );

	// Create a placeholder 
	QLabel * emptyL0 = new QLabel( hb1, "emptyL0" );
	emptyL0->setText("");

        // Add a check box button
        showSpinCb = new QCheckBox( hb1, "showSpin" );
	showSpinCb->setText( "Show Spins" );
	showSpinCb->setChecked( TRUE );

	// Define a callback for this toggle switch
	connect( showSpinCb, SIGNAL(clicked()), this, SLOT(adjustSpin()) );

        // Create a hboxlayout that will fill the next row
        hb2 = new QHBox( this, "hb2" );

        // Add a label and color labels
        colorL = new QLabel( hb2, "colorL" );
        colorL->setText( " Color: " );
	colorLabel0 = new ColorLabel( hb2, "color0" );
        colorLabel1 = new ColorLabel( hb2, "color1" );
        colorLabel2 = new ColorLabel( hb2, "color2" );
        colorLabel3 = new ColorLabel( hb2, "color3" );
        colorLabel4 = new ColorLabel( hb2, "color4" );
        colorLabel5 = new ColorLabel( hb2, "color5" );
        colorLabel0->setFixedHeight( LABEL_HEIGHT );
        colorLabel1->setFixedHeight( LABEL_HEIGHT );
        colorLabel2->setFixedHeight( LABEL_HEIGHT );
        colorLabel3->setFixedHeight( LABEL_HEIGHT );
        colorLabel4->setFixedHeight( LABEL_HEIGHT );
        colorLabel5->setFixedHeight( LABEL_HEIGHT );
        colorLabel0->setColor( 1.0, 1.0, 1.0);
        colorLabel1->setColor( 1.0, 1.0, 1.0);
        colorLabel2->setColor( 1.0, 1.0, 1.0);
        colorLabel3->setColor( 1.0, 1.0, 1.0);
        colorLabel4->setColor( 1.0, 1.0, 1.0);
        colorLabel5->setColor( 1.0, 1.0, 1.0);

        // Add a push button
        colorButton = new QPushButton( hb2, "colorButton" );
        colorButton->setText( "Set Color..." );

        // Define a callback for this button
        QObject::connect( colorButton, SIGNAL(clicked()), this, SLOT(setColorCb(
)) );

	// Create a hboxlayout that will fill the next row
        sizeBox = new SizeBox( this, "sizeBox" );

	// Create a hboxlayout that will fill the next row
	hb4 = new QHBox( this, "hb4" );

	// Add radiobuttons and a label
        modeL = new QLabel( hb4, "modeL" );
	modeL->setText( " Color Criterion: " ); 

	colorMode = new QButtonGroup( 4, QGroupBox::Horizontal, hb4, "colorMode" );
	colorMode0 = new QRadioButton( colorMode, "type" );
	colorMode0->setText( "Type" );
	colorMode1 = new QRadioButton( colorMode, "position" );
	colorMode1->setText( "Position" );
	colorMode2 = new QRadioButton( colorMode, "property" );
	colorMode2->setText( "Property" );
	colorMode3 = new QRadioButton( colorMode, "colorcode" );
	colorMode3->setText( "ColorCode" );
	colorMode->insert( colorMode0, 0 );
	colorMode->insert( colorMode1, 1 );
	colorMode->insert( colorMode2, 2 );
	colorMode->insert( colorMode3, 3 );

	// Define a callback for these radio buttons
	connect( colorMode, SIGNAL(clicked(int)), this, SLOT(adjustCriterion()) );

	// Create hboxlayouts that will fill the next row; these
        // are shown only when appropriate
        positionBox = new PositionBox( this, "positionBox" );
        propertyBox = new PropertyBox( this, "positionBox" );
        codeBox = new CodeBox( this, "codeBox" );
	
	// Create a box that will fill the next row
	lineTypeBox = new LineTypeBox( this, "lineTypeBox" );

	// Create a hboxlayout that will fill the lowest row
	hb5 = new QHBox( this, "hb5" );
	
	// Create a placeholder 
	QLabel * emptyL1 = new QLabel( hb5, "emptyL1" );

	// Create pushbuttons that will go into the lowest row
	QPushButton * done = new QPushButton( hb5, "done" );
	done->setText( "Done" ); 

	 // Define a callback for that button
        QObject::connect( done, SIGNAL(clicked()), this, SLOT(bdone()) );

	QPushButton * apply = new QPushButton( hb5, "apply" );
	apply->setText( "Apply" ); 

	 // Define a callback for that button
        QObject::connect( apply, SIGNAL(clicked()), this, SLOT(bapply()) );

	QPushButton * cancel = new QPushButton( hb5, "cancel" );
	cancel->setText( "Cancel" ); 

	 // Define a callback for that button
        QObject::connect( cancel, SIGNAL(clicked()), this, SLOT(bcancel()) );

	hb5->setStretchFactor( emptyL1, 10 );

	// Clear the board pointer
	spinBox = NULL;

	// Clear the color board pointer
	cb = NULL;

	// Clear internal variables
        colors = 1;
        colorPosX = colorPosY = 0;
        showColorBoard = FALSE;
	spinRenderStyle = SLINE;
	renderQuality = LOW;

	// Set defaults
	lineTypeBox->setDisabled( TRUE );

	// Set defaults appropriate for startup without data
        colorButton->setDisabled( TRUE );
        sizeBox->setDisabled( TRUE );
        modeL->setDisabled( TRUE );
        colorMode->setDisabled( TRUE );
        colorMode0->setChecked( TRUE );

        // Build default layout
        this->buildLayout( TYPE );
}
Exemplo n.º 2
0
// Make a popup dialog box 
SpinBoard::SpinBoard(MainForm *mainForm, QWidget * parent)
    : QDialog(parent), mainForm(mainForm)
{
    setWindowTitle( "AViz: Set Spins" );

    {
        // Create a hboxlayout that will fill the first row
        hb1 = new QWidget(this);

        // Create a combo box that will go into the
        // second column; entries in the combo box will
        // be made later
        spinCob = new QComboBox();
        connect( spinCob, SIGNAL(activated(int)), SLOT(setSpin()) );

        // Add a check box button
        showSpinCb = new QCheckBox("Show Spins");
        showSpinCb->setChecked(true);

        // Define a callback for this toggle switch
        connect( showSpinCb, SIGNAL(clicked()), this, SLOT(adjustSpin()) );

        QHBoxLayout *hbox = new QHBoxLayout(hb1);
        hbox->addWidget(new QLabel(" Type: "));
        hbox->addWidget(spinCob);
        hbox->addStretch(1);
        hbox->addWidget(showSpinCb);
    }

    {
        // Create a hboxlayout that will fill the next row
        hb2 = new QWidget(this);

        // Add color labels
        colorLabel0 = new ColorLabel(hb2);
        colorLabel1 = new ColorLabel(hb2);
        colorLabel2 = new ColorLabel(hb2);
        colorLabel3 = new ColorLabel(hb2);
        colorLabel4 = new ColorLabel(hb2);
        colorLabel5 = new ColorLabel(hb2);
        colorLabel0->setFixedHeight( LABEL_HEIGHT );
        colorLabel1->setFixedHeight( LABEL_HEIGHT );
        colorLabel2->setFixedHeight( LABEL_HEIGHT );
        colorLabel3->setFixedHeight( LABEL_HEIGHT );
        colorLabel4->setFixedHeight( LABEL_HEIGHT );
        colorLabel5->setFixedHeight( LABEL_HEIGHT );

        // Add a push button
        colorButton = new QPushButton("Set Color...");

        // Define a callback for this button
        connect(colorButton, SIGNAL(clicked()), SLOT(setColorCb()));

        QHBoxLayout *hbox = new QHBoxLayout(hb2);
        hbox->setSpacing(0);
        hbox->addWidget(new QLabel(" Color: "));
        hbox->addWidget(colorLabel0);
        hbox->addWidget(colorLabel1);
        hbox->addWidget(colorLabel2);
        hbox->addWidget(colorLabel3);
        hbox->addWidget(colorLabel4);
        hbox->addWidget(colorLabel5);
        hbox->addWidget(colorButton);
    }


    // Create a hboxlayout that will fill the next row
    sizeBox = new SizeBox(this);

    {
        // Create a hboxlayout that will fill the next row
        hb4 = new QWidget(this);

        // Add radiobuttons and a label
        modeL = new QLabel(" Color Criterion: ");

        colorMode = new QGroupBox();
        QHBoxLayout *colorModeLayout = new QHBoxLayout(colorMode);

        colorMode0 = new QRadioButton("Type");
        colorMode1 = new QRadioButton("Position");
        colorMode2 = new QRadioButton("Property");
        colorMode3 = new QRadioButton("ColorCode");
        colorModeLayout->addWidget(colorMode0);
        colorModeLayout->addWidget(colorMode1);
        colorModeLayout->addWidget(colorMode2);
        colorModeLayout->addWidget(colorMode3);

        QButtonGroup *colorModeButtonGroup = new QButtonGroup(this);
        colorModeButtonGroup->addButton(colorMode0);
        colorModeButtonGroup->addButton(colorMode1);
        colorModeButtonGroup->addButton(colorMode2);
        colorModeButtonGroup->addButton(colorMode3);

        // Define a callback for these radio buttons
        connect(colorModeButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(adjustCriterion()) );

        QHBoxLayout *hBox = new QHBoxLayout(hb4);
        hBox->addWidget(modeL);
        hBox->addWidget(colorMode);
    }

    // Create hboxlayouts that will fill the next row; these
    // are shown only when appropriate
    positionBox = new PositionBox(this);
    propertyBox = new PropertyBox(this);
    codeBox = new CodeBox(this);

    // Create a box that will fill the next row
    lineTypeBox = new LineTypeBox( this );

    {
        hb5 = new DoneApplyCancelWidget(this);
        connect(hb5, SIGNAL(done()), this, SLOT(bdone()) );
        connect(hb5, SIGNAL(applied()), this, SLOT(bapply()) );
        connect(hb5, SIGNAL(canceled()), this, SLOT(bcancel()));
    }

    // Clear the board pointer
    spinBox = NULL;

    // Clear the color board pointer
    cb = NULL;

    // Clear internal variables
    colors = 1;
    colorPosX = colorPosY = 0;
    showColorBoard = false;
    spinRenderStyle = SLINE;
    renderQuality = LOW;

    // Set defaults
    lineTypeBox->setDisabled(true);

    // Set defaults appropriate for startup without data
    colorButton->setDisabled(true);
    sizeBox->setDisabled(true);
    modeL->setDisabled(true);
    colorMode->setDisabled(true);
    colorMode0->setChecked(true);

    // Build default layout
    this->buildLayout( TYPE );
}