Пример #1
0
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget,
                         QWidget * parent, Qt::WindowFlags f) :
  CopasiWidget(parent, NULL, f),
  mPages(),
  mObjectType(objectType),
  mIgnoreLeave(false)
{
  setupUi(this);

  mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>");

  mpTabWidget->addTab(pCopasiWidget, "Details");
  mPages.push_back(pCopasiWidget);

  switch (mObjectType)
    {
      case  ListViews::MODEL:
        mpBtnNew->hide();
        mpBtnCopy->hide();
        mpBtnDelete->hide();
        break;

      case ListViews::MODELPARAMETERSET:
        mpBtnNew->setText("Apply");
        mpBtnNew->setToolTip("Apply the current parameters to the model.");

        // The break statement is intentionally missing

      default:
        CQNotes* pNotes = new CQNotes(mpTabWidget);
        mPages.push_back(pNotes);
        mpTabWidget->addTab(pNotes, "Notes");

        connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew()));
        connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy()));
        connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete()));
        connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy()));
        break;
    }

  CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget);
  mPages.push_back(pMIRIAMWidget);
  mpTabWidget->addTab(pMIRIAMWidget, "Annotation");
  connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy()));

  CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget);
  mPages.push_back(pRDFTreeView);
  mpTabWidget->addTab(pRDFTreeView, "RDF Browser");
}
Пример #2
0
void CQTabWidget::slotBtnCopy()
{
  mpBtnCopy->setFocus();

  leave();

  mIgnoreLeave = true;

  // CQCompartments and CQSpecies have copy options, use CModelExpansion, and do their own switching.
  if (QString(mPages[0]->metaObject()->className()) == "CQCompartment")
    {
      CQCompartment * pQCompartment = dynamic_cast< CQCompartment * >(mPages[0]);
      pQCompartment->copy();
    }
  else if (QString(mPages[0]->metaObject()->className()) == "CQSpeciesDetail")
    {
      CQSpeciesDetail * pQSpeciesDetail = dynamic_cast< CQSpeciesDetail * >(mPages[0]);
      pQSpeciesDetail->copy();
    }
  else if (QString(mPages[0]->metaObject()->className()) == "ReactionsWidget1")
    {
      ReactionsWidget1 * pReactionsWidget1 = dynamic_cast< ReactionsWidget1 * >(mPages[0]);
      pReactionsWidget1->copy();
    }
  else
    {
      emit copyClicked();
      emit newClicked();
    }

  mIgnoreLeave = false;
}
Пример #3
0
SubTabController::SubTabController(SubTabView* subTabView)
  : OSQObjectController(),
    m_subTabView(subTabView)
{
  addQObject(subTabView);

  bool isConnected = false;
  isConnected = connect(subTabView, SIGNAL(itemSelected(OSItem*)),
                        this, SLOT(selectItem(OSItem*)));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(itemRemoveClicked(OSItem*)),
                        this, SLOT(removeItem(OSItem*)));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(itemReplacementDropped(OSItem*, const OSItemId&)),
                        this, SLOT(replaceItem(OSItem*, const OSItemId&)));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(selectionCleared()),
                        this, SLOT(clearSelection()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(itemDropped(const OSItemId&)),
                        this, SLOT(handleDrop(const OSItemId&)));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(addClicked()),
                        this, SLOT(doAdd()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(copyClicked()),
                        this, SLOT(doCopy()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(removeClicked()),
                        this, SLOT(doRemove()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(purgeClicked()),
                        this, SLOT(doPurge()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(openBclDlgClicked()),
                        this, SIGNAL(openBclDlgClicked()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(openLibDlgClicked()),
                        this, SIGNAL(openLibDlgClicked()));
  BOOST_ASSERT(isConnected);

  isConnected = connect(subTabView, SIGNAL(dropZoneItemClicked(OSItem*)),
                        this, SLOT(inspectItem(OSItem*)));
  BOOST_ASSERT(isConnected);
}
Пример #4
0
CQTabWidget::CQTabWidget(const ListViews::ObjectType & objectType, CopasiWidget * pCopasiWidget,
                         QWidget * parent, Qt::WindowFlags f) :
  CopasiWidget(parent, NULL, f),
  mPages(),
  mObjectType(objectType),
  mIgnoreLeave(false)
{
  setupUi(this);

  mpLblName->setText("<h3>" + FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) + "</h3>");

  mpTabWidget->addTab(pCopasiWidget, "Details");
  mPages.push_back(pCopasiWidget);

  switch (mObjectType)
    {
      case  ListViews::ObjectType::MODEL:
        mpBtnNew->hide();
        mpBtnCopy->hide();
        mpBtnDelete->hide();
        break;

      case ListViews::ObjectType::MODELPARAMETERSET:
        mpBtnNew->setText("Apply");
        mpBtnNew->setToolTip("Apply the current parameters to the model.");

      // The break statement is intentionally missing

      default:
        CQNotes* pNotes = new CQNotes(mpTabWidget);
        mPages.push_back(pNotes);
        mpTabWidget->addTab(pNotes, "Notes");

        connect(this, SIGNAL(newClicked()), pCopasiWidget, SLOT(slotBtnNew()));
        connect(this, SIGNAL(copyClicked()), pCopasiWidget, SLOT(slotBtnCopy()));
        connect(this, SIGNAL(deleteClicked()), pCopasiWidget, SLOT(slotBtnDelete()));
        connect(this, SIGNAL(copyClicked()), pNotes, SLOT(slotBtnCopy()));
        break;
    }

  CQMiriamWidget* pMIRIAMWidget = new CQMiriamWidget(mpTabWidget);
  mPages.push_back(pMIRIAMWidget);
  mpTabWidget->addTab(pMIRIAMWidget, "Annotation");
  connect(this, SIGNAL(copyClicked()), pMIRIAMWidget, SLOT(slotBtnCopy()));

  CQRDFTreeView* pRDFTreeView = new CQRDFTreeView(mpTabWidget);
  mPages.push_back(pRDFTreeView);
  mpTabWidget->addTab(pRDFTreeView, "RDF Browser");

#ifdef COPASI_Provenance

  if ((FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Species") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Compartment") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Reaction") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Event") || (FROM_UTF8(ListViews::ObjectTypeName[mObjectType]) == "Global Quantity"))
    {
      //FROM_UTF8(mpObject->getObjectName())
      //mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget, mpUndoStack, metaObject()->, pWindow->getVersionHierarchy()->getPathFile(), pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel(),  pWindow->getProvenanceParentOfCurrentVersion(), pWindow->getVersionHierarchy()->getParentOfCurrentModel());
      mpEntityProvenanceDialog = new CEntityProvenanceDialog(mpTabWidget);
      mPathFile = pWindow->getVersionHierarchy()->getPathFile();
      mVersionPathToCurrentModel = pWindow->getVersionHierarchy()->getVersionsPathToCurrentModel();
      mPages.push_back(mpEntityProvenanceDialog);
      mpTabWidget->addTab(mpEntityProvenanceDialog, "Provenance");
      //connect(this, SIGNAL(activated()), this, SLOT(mpEntityProvenanceDialog->exec()));
      //connect(this, SIGNAL(),EntityProvenanceDialog ,SLOT(EntityProvenanceDialog->exec()));
    }

#endif
}
Пример #5
0
SubTabView::SubTabView(OSItemSelector* itemSelector,
                       OSInspectorView *inspectorView,
                       QWidget * parent)
  : QSplitter(parent),
    m_itemSelector(itemSelector),
    m_inspectorView(inspectorView)
{
  this->setObjectName("GrayWidgetWithLeftTopBorders");

  //QHBoxLayout * mainHLayout = new QHBoxLayout();
  //mainHLayout->setContentsMargins(1,1,0,0);
  //mainHLayout->setSpacing(0);
  //this->setLayout(mainHLayout);

  QWidget * leftWidget = new QWidget();
  //leftWidget->setFixedWidth(190);
  //mainHLayout->addWidget(leftWidget);
  addWidget(leftWidget);
  
  QVBoxLayout * outerLeftVLayout = new QVBoxLayout();
  outerLeftVLayout->setContentsMargins(0,0,0,0);
  outerLeftVLayout->setSpacing(0);
  leftWidget->setLayout(outerLeftVLayout);
  //mainHLayout->addLayout(outerLeftVLayout);

  // Item Selector
  outerLeftVLayout->addWidget(m_itemSelector, 10);

  bool isConnected = false;
  isConnected = QObject::connect(m_itemSelector,
                                 SIGNAL(itemSelected(OSItem*)),
                                 this,
                                 SIGNAL(itemSelected(OSItem*)));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelector,
                                 SIGNAL(itemRemoveClicked(OSItem*)),
                                 this,
                                 SIGNAL(itemRemoveClicked(OSItem*)));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelector,
                                 SIGNAL(itemReplacementDropped(OSItem*, const OSItemId&)),
                                 this,
                                 SIGNAL(itemReplacementDropped(OSItem*, const OSItemId&)));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelector,
                                 SIGNAL(selectionCleared()),
                                 this,
                                 SIGNAL(selectionCleared()));
  OS_ASSERT(isConnected);


  // Item Selector Buttons
  m_itemSelectorButtons = new OSItemSelectorButtons();
  outerLeftVLayout->addWidget(m_itemSelectorButtons);
  
  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(itemDropped(const OSItemId&)),
                                 this,
                                 SIGNAL(itemDropped(const OSItemId&)));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(addClicked()),
                                 this,
                                 SIGNAL(addClicked()));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(copyClicked()),
                                 this,
                                 SIGNAL(copyClicked()));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(removeClicked()),
                                 this,
                                 SIGNAL(removeClicked()));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(purgeClicked()),
                                 this,
                                 SIGNAL(purgeClicked()));
  OS_ASSERT(isConnected);

  isConnected = QObject::connect(m_itemSelectorButtons,
                                 SIGNAL(openBclDlgClicked()),
                                 this,
                                 SIGNAL(openBclDlgClicked()));
  OS_ASSERT(isConnected);

  //isConnected = QObject::connect(m_itemSelectorButtons,
  //                               SIGNAL(openLibDlgClicked()),
  //                               this,
  //                               SIGNAL(openLibDlgClicked()));
  //OS_ASSERT(isConnected); TODO

  // vertical separator
  //QWidget * vLine = new QWidget();
  //vLine->setObjectName("VLine");
  //vLine->setStyleSheet("QWidget#VLine { background: #445051;}");
  //vLine->setFixedWidth(2);
  //mainHLayout->addWidget(vLine);

  // Inspector View
  //mainHLayout->addWidget(m_inspectorView, 10);
  addWidget(m_inspectorView);
  setStretchFactor(1,100000);

  isConnected = QObject::connect(m_inspectorView,
                                 SIGNAL(dropZoneItemClicked(OSItem*)),
                                 this,
                                 SIGNAL(dropZoneItemClicked(OSItem*)));
  OS_ASSERT(isConnected);
}
Пример #6
0
KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
  : DCOPObject("interface"), 
    KDialogBase(parent, name, true, QString::null, Help|User1, User1, 
    true, KStdGuiItem::quit() )
{
    grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
    grabber->move( -1000, -1000 );
    grabber->installEventFilter( this );

    KStartupInfo::appStarted();

    QVBox *vbox = makeVBoxMainWidget();
    mainWidget = new KSnapshotWidget( vbox, "mainWidget" );

    connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));

    connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
    connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) );
    connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );
    connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) );

    grabber->show();
    grabber->grabMouse( waitCursor );

    if ( !grabCurrent )
	snapshot = QPixmap::grabWindow( qt_xrootwin() );
    else {
	mainWidget->setMode( WindowUnderCursor );
	mainWidget->setIncludeDecorations( true );
	performGrab();
    }

    updatePreview();
    grabber->releaseMouse();
    grabber->hide();

    KConfig *conf=KGlobal::config();
    conf->setGroup("GENERAL");
    mainWidget->setDelay(conf->readNumEntry("delay",0));
    mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
    mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));
    filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));

    // Make sure the name is not already being used
    while(KIO::NetAccess::exists( filename, false, this )) {
	autoincFilename();
    }

    connect( &grabTimer, SIGNAL( timeout() ), this, SLOT(  grabTimerDone() ) );
    connect( &updateTimer, SIGNAL( timeout() ), this, SLOT(  updatePreview() ) );
    QTimer::singleShot( 0, this, SLOT( updateCaption() ) );

    KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);

    QPushButton *helpButton = actionButton( Help );
    helpButton->setPopup(helpMenu->menu());

    KAccel* accel = new KAccel(this);
    accel->insert(KStdAccel::Quit, kapp, SLOT(quit()));
    accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user without showing the file dialog."),
		   CTRL+SHIFT+Key_S, this, SLOT(slotSave()));
    accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs()));
//    accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs()));
    accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
		   i18n("Save the snapshot to the file specified by the user."),
		   CTRL+Key_A, this, SLOT(slotSaveAs()));
    accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
    accel->insert(KStdAccel::New, this, SLOT(slotGrab()));
    accel->insert(KStdAccel::Copy, this, SLOT(slotCopy()));

    accel->insert( "Quit2", Key_Q, this, SLOT(slotSave()));
    accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs()));
    accel->insert( "Print2", Key_P, this, SLOT(slotPrint()));
    accel->insert( "New2", Key_N, this, SLOT(slotGrab()));
    accel->insert( "New3", Key_Space, this, SLOT(slotGrab()));

    setEscapeButton( User1 );
    connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );

    mainWidget->btnNew->setFocus();
}