Esempio n. 1
0
// id is an old ident in case of an import
DeploymentDiagramWindow::DeploymentDiagramWindow(const QString & s, BrowserDeploymentDiagram * b, int id)
    : DiagramWindow(b, s), view(0) {
  Q3ToolBar * toolbar = new Q3ToolBar(this, "deployment operations");
  addToolBar(toolbar, TR("Toolbar"), Qt::DockTop, TRUE);
  
  add_edit_button(toolbar);
  toolbar->addSeparator();
  
  select =
    new QToolButton(*selectButton, TR("Select"), QString::null,
		    this, SLOT(hit_select()), toolbar, "select");
  select->setToggleButton(TRUE);
  select->setOn(TRUE);
  current_button = UmlSelect;
  
  addPackage
    = new QToolButton(*packageButton, TR("Add Package"), QString::null,
		      this, SLOT(hit_package()), toolbar, "add package");
  addPackage->setToggleButton(TRUE);
  Q3WhatsThis::add(addPackage, addpackageText());
  
  addFragment
    = new QToolButton(*fragmentButton, TR("Add Fragment"), QString::null,
		      this, SLOT(hit_fragment()), toolbar, "add fragment");
  addFragment->setToggleButton(TRUE);
  Q3WhatsThis::add(addFragment, addfragmentText());
  
  addDeploymentNode =
    new QToolButton(*deploymentNodeButton, TR("Add Deployment Node"), QString::null,
		    this, SLOT(hit_deploymentnode()), toolbar, "add deployment node");
  addDeploymentNode->setToggleButton(TRUE);
  Q3WhatsThis::add(addDeploymentNode, adddeploymentnodeText());
  
  addArtifact =
    new QToolButton(*artifactButton, TR("Add Artifact"), QString::null,
		    this, SLOT(hit_artifact()), toolbar, "add artifact");
  addArtifact->setToggleButton(TRUE);
  Q3WhatsThis::add(addArtifact, addartifactText());
  
  addComponent =
    new QToolButton(*componentButton, TR("Add Component"), QString::null,
		    this, SLOT(hit_component()), toolbar, "add component");
  addComponent->setToggleButton(TRUE);
  Q3WhatsThis::add(addComponent, addcomponentText());
  
  hub =
    new QToolButton(*hubButton, TR("Network connexion/ending"), QString::null,
		    this, SLOT(hit_hub()), toolbar, "network connexion/ending");
  hub->setToggleButton(TRUE);
  Q3WhatsThis::add(hub, hubText());
  
  network =
    new QToolButton(*associationButton, TR("Network"), QString::null,
		    this, SLOT(hit_network()), toolbar, "network");
  network->setToggleButton(TRUE);
  Q3WhatsThis::add(network, networkText());
  
  inherit =
    new QToolButton(*generalisationButton, TR("Inheritance"), QString::null,
		    this, SLOT(hit_inherit()), toolbar, "inheritance");
  inherit->setToggleButton(TRUE);
  Q3WhatsThis::add(inherit, inheritText());
  
  association =
    new QToolButton(*directionalAssociationButton, TR("Association"), QString::null,
		    this, SLOT(hit_association()), toolbar, "association");
  association->setToggleButton(TRUE);
  Q3WhatsThis::add(association, associationText());
  
  dependency =
    new QToolButton(*dependencyButton, TR("Dependency"), QString::null,
		    this, SLOT(hit_dependency()), toolbar, "dependency");
  dependency->setToggleButton(TRUE);
  Q3WhatsThis::add(dependency, dependencyText());
  
  note =
    new QToolButton(*noteButton, TR("Note"), QString::null,
		    this, SLOT(hit_note()), toolbar, "note");
  note->setToggleButton(TRUE);
  Q3WhatsThis::add(note, noteText());
  
  anchor =
    new QToolButton(*anchorButton, TR("Anchor"), QString::null,
		    this, SLOT(hit_anchor()), toolbar, "anchor");
  anchor->setToggleButton(TRUE);
  Q3WhatsThis::add(anchor, anchorText());
  
  text =
    new QToolButton(*textButton, TR("Text"), QString::null,
		    this, SLOT(hit_text()), toolbar, "text");
  text->setToggleButton(TRUE);
  Q3WhatsThis::add(text, textText());
  
  image =
    new QToolButton(*imageButton, TR("Image"), QString::null,
		    this, SLOT(hit_image()), toolbar, "image");
  image->setToggleButton(TRUE);
  Q3WhatsThis::add(image, imageText());  
  
  toolbar->addSeparator();
  add_grid_cmd(toolbar);  
  toolbar->addSeparator();
  add_scale_cmd(toolbar);
  
  //
  
  view = new DeploymentDiagramView(this, canvas, (id != -1) ? id : b->get_ident());
  setFocusProxy(view);
  setCentralWidget(view);
  
  //qApp->setMainWidget(this);
  
  QWorkspace * w = UmlWindow::get_workspace();

  resize((w->width() * 4)/5, (w->height() * 4)/5);
  
  /*if (w->windowList().isEmpty())
    showMaximized();
  else*/
    show();
  
  view->preferred_size_zoom();
    
  //qApp->setMainWidget(0);
}
// id is an old ident in case of an import
DeploymentDiagramWindow::DeploymentDiagramWindow(const QString & s, BrowserDeploymentDiagram * b, int id)
    : DiagramWindow(b, s), view(0)
{
    QToolBar * toolbar = new QToolBar("deployment operations", this);
    toolbar->setMinimumHeight(50);
    toolbar->setOrientation(Qt::Horizontal);
    addToolBar(Qt::TopToolBarArea, toolbar);

    add_edit_button(toolbar);

    select =
        ToolBarFactory::createToolButton(*selectButton, tr("Select"), QString(),
                        this, SLOT(hit_select()), toolbar, "select");
    select->setCheckable(TRUE);
    select->setChecked(TRUE);
    current_button = UmlSelect;

    addPackage
        = ToolBarFactory::createToolButton(*packageButton, tr("Add Package"), QString(),
                          this, SLOT(hit_package()), toolbar, "add package");
    addPackage->setCheckable(TRUE);
    addPackage->setWhatsThis(addpackageText());

    addFragment
        = ToolBarFactory::createToolButton(*fragmentButton, tr("Add Fragment"), QString(),
                          this, SLOT(hit_fragment()), toolbar, "add fragment");
    addFragment->setCheckable(TRUE);
    addFragment->setWhatsThis(addfragmentText());

    addDeploymentNode =
        ToolBarFactory::createToolButton(*deploymentNodeButton, tr("Add Deployment Node"), QString(),
                        this, SLOT(hit_deploymentnode()), toolbar, "add deployment node");
    addDeploymentNode->setCheckable(TRUE);
    addDeploymentNode->setWhatsThis(adddeploymentnodeText());

    addArtifact =
        ToolBarFactory::createToolButton(*artifactButton, tr("Add Artifact"), QString(),
                        this, SLOT(hit_artifact()), toolbar, "add artifact");
    addArtifact->setCheckable(TRUE);
    addArtifact->setWhatsThis(addartifactText());

    addComponent =
        ToolBarFactory::createToolButton(*componentButton, tr("Add Component"), QString(),
                        this, SLOT(hit_component()), toolbar, "add component");
    addComponent->setCheckable(TRUE);
    addComponent->setWhatsThis(addcomponentText());

    hub =
        ToolBarFactory::createToolButton(*hubButton, tr("Network connexion/ending"), QString(),
                        this, SLOT(hit_hub()), toolbar, "network connexion/ending");
    hub->setCheckable(TRUE);
    hub->setWhatsThis(hubText());

    network =
        ToolBarFactory::createToolButton(*associationButton, tr("Network"), QString(),
                        this, SLOT(hit_network()), toolbar, "network");
    network->setCheckable(TRUE);
    network->setWhatsThis(networkText());

    inherit =
        ToolBarFactory::createToolButton(*generalisationButton, tr("Inheritance"), QString(),
                        this, SLOT(hit_inherit()), toolbar, "inheritance");
    inherit->setCheckable(TRUE);
    inherit->setWhatsThis(inheritText());

    association =
        ToolBarFactory::createToolButton(*directionalAssociationButton, tr("Association"), QString(),
                        this, SLOT(hit_association()), toolbar, "association");
    association->setCheckable(TRUE);
    association->setWhatsThis(associationText());

    dependency =
        ToolBarFactory::createToolButton(*dependencyButton, tr("Dependency"), QString(),
                        this, SLOT(hit_dependency()), toolbar, "dependency");
    dependency->setCheckable(TRUE);
    dependency->setWhatsThis(dependencyText());

    note =
        ToolBarFactory::createToolButton(*noteButton, tr("Note"), QString(),
                        this, SLOT(hit_note()), toolbar, "note");
    note->setCheckable(TRUE);
    note->setWhatsThis(noteText());

    anchor =
        ToolBarFactory::createToolButton(*anchorButton, tr("Anchor"), QString(),
                        this, SLOT(hit_anchor()), toolbar, "anchor");
    anchor->setCheckable(TRUE);
    anchor->setWhatsThis(anchorText());

    text =
        ToolBarFactory::createToolButton(*textButton, tr("Text"), QString(),
                        this, SLOT(hit_text()), toolbar, "text");
    text->setCheckable(TRUE);
    text->setWhatsThis(textText());

    image =
        ToolBarFactory::createToolButton(*imageButton, tr("Image"), QString(),
                        this, SLOT(hit_image()), toolbar, "image");
    image->setCheckable(TRUE);
    image->setWhatsThis(imageText());

    toolbar->addSeparator();

    add_scale_cmd(toolbar);

    //

    view = new DeploymentDiagramView(this, canvas, (id != -1) ? id : b->get_ident());
    setFocusProxy(view);
    setCentralWidget(view);

    //qApp->setMainWidget(this);

    QMdiArea * w = UmlWindow::get_workspace();

    m_containingSubWindow->resize((w->width() * 4) / 5, (w->height() * 4) / 5);

    /*if (w->windowList().isEmpty())
      showMaximized();
    else*/
    show();

    view->preferred_size_zoom();

    //qApp->setMainWidget(0);
}