示例#1
0
View::~View()
{
    auto copy = m_children;
    for (View* v : copy) {
        removeView(v);
    }
}
示例#2
0
SessionTabWidget::SessionTabWidget(Session* session, QWidget* parent) :
    TabWidget(parent)
{
    d.handler.setSession(session);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int)));
    connect(this, SIGNAL(newTabRequested()), this, SLOT(onNewTabRequested()), Qt::QueuedConnection);
    connect(this, SIGNAL(tabMenuRequested(int,QPoint)), this, SLOT(onTabMenuRequested(int,QPoint)));

    connect(session, SIGNAL(activeChanged(bool)), this, SLOT(updateStatus()));
    connect(session, SIGNAL(connectedChanged(bool)), this, SLOT(updateStatus()));

    connect(&d.handler, SIGNAL(receiverToBeAdded(QString)), this, SLOT(openView(QString)));
    connect(&d.handler, SIGNAL(receiverToBeRemoved(QString)), this, SLOT(removeView(QString)));
    connect(&d.handler, SIGNAL(receiverToBeRenamed(QString,QString)), this, SLOT(renameView(QString,QString)));

    QShortcut* shortcut = new QShortcut(QKeySequence::AddTab, this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(onNewTabRequested()));

    shortcut = new QShortcut(QKeySequence::Close, this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(closeCurrentView()));

    MessageView* view = openView(d.handler.session()->host());
    d.handler.setDefaultReceiver(view);
    updateStatus();

    applySettings(d.settings);
}
示例#3
0
SessionTabWidget::SessionTabWidget(Session* session, QWidget* parent) :
    TabWidget(parent)
{
    d.hasQuit = false;
    d.handler.setSession(session);
    session->setParent(&d.handler);

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(tabActivated(int)));
    connect(this, SIGNAL(newTabRequested()), this, SLOT(onNewTabRequested()), Qt::QueuedConnection);

    connect(session, SIGNAL(activeChanged(bool)), this, SLOT(onActiveChanged(bool)));
    connect(session, SIGNAL(disconnected()), this, SLOT(onDisconnected()));

    connect(&d.handler, SIGNAL(receiverToBeAdded(QString)), this, SLOT(openView(QString)));
    connect(&d.handler, SIGNAL(receiverToBeRemoved(QString)), this, SLOT(removeView(QString)));
    connect(&d.handler, SIGNAL(receiverToBeRenamed(QString,QString)), this, SLOT(renameView(QString,QString)));

    QShortcut* shortcut = new QShortcut(QKeySequence::AddTab, this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(onNewTabRequested()));

    shortcut = new QShortcut(QKeySequence::Close, this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(closeCurrentView()));

    applySettings(Application::settings());

    registerSwipeGestures(Qt::Horizontal);

    MessageView* view = openView(d.handler.session()->host());
    d.handler.setDefaultReceiver(view);
    setTabInactive(0, !session->isActive());
}
示例#4
0
bool ArrayBuffer::transfer(ArrayBufferContents& result)
{
    ASSERT(!isShared());
    RefPtr<ArrayBuffer> keepAlive(this);

    if (!m_contents.data()) {
        result.neuter();
        return false;
    }

    bool allViewsAreNeuterable = true;
    for (ArrayBufferView* i = m_firstView; i; i = i->m_nextView) {
        if (!i->isNeuterable())
            allViewsAreNeuterable = false;
    }

    if (allViewsAreNeuterable) {
        m_contents.transfer(result);
    } else {
        m_contents.copyTo(result);
        if (!result.data())
            return false;
    }

    while (m_firstView) {
        ArrayBufferView* current = m_firstView;
        removeView(current);
        if (allViewsAreNeuterable || current->isNeuterable())
            current->neuter();
    }

    m_isNeutered = true;

    return true;
}
示例#5
0
bool ArrayBuffer::transfer(ArrayBufferContents& result, Vector<RefPtr<ArrayBufferView> >& neuteredViews)
{
    RefPtr<ArrayBuffer> keepAlive(this);

    if (!m_contents.m_data) {
        result.m_data = 0;
        return false;
    }

    bool allViewsAreNeuterable = true;
    for (ArrayBufferView* i = m_firstView; i; i = i->m_nextView) {
        if (!i->isNeuterable())
            allViewsAreNeuterable = false;
    }

    if (allViewsAreNeuterable)
        m_contents.transfer(result);
    else {
        m_contents.copyTo(result);
        if (!result.m_data)
            return false;
    }

    while (m_firstView) {
        ArrayBufferView* current = m_firstView;
        removeView(current);
        if (allViewsAreNeuterable || current->isNeuterable())
            current->neuter();
        neuteredViews.append(current);
    }
    return true;
}
ContainerWidget * MultiViewWidget::createContainer(QWidget *widget)
{
  ContainerWidget *container = new ContainerWidget;
  connect(container, SIGNAL(splitHorizontal()), SLOT(splitHorizontal()));
  connect(container, SIGNAL(splitVertical()), SLOT(splitVertical()));
  connect(container, SIGNAL(closeView()), SLOT(removeView()));

  if (widget) {
    container->setViewWidget(widget);
  }
  // If we have a factory, then create the options widget too!
  else if (m_factory) {
    QWidget *optionsWidget = new QWidget;
    QVBoxLayout *v = new QVBoxLayout;
    optionsWidget->setLayout(v);
    v->addStretch();
    foreach (const QString &name, m_factory->views()) {
      QPushButton *button = new QPushButton(name);
      button->setToolTip(tr("Create a new view"));
      connect(button, SIGNAL(clicked()), SLOT(createView()));
      QHBoxLayout *h = new QHBoxLayout;
      h->addStretch();
      h->addWidget(button);
      h->addStretch();
      v->addLayout(h);
    }
    v->addStretch();
    container->layout()->addWidget(optionsWidget);
  }

  return container;
}
示例#7
0
void FilteredTreeView::setView(QAbstractItemView *view)
{
	removeView();
	View = view;
	NameFilterWidget->setView(View);
	insertView();
}
示例#8
0
void terrama2::services::view::core::DataManager::removeJSon(const QJsonObject& obj)
{
  try
  {
    std::lock_guard<std::recursive_mutex> lock(mtx_);
    auto view = obj["View"].toArray();
    for(auto json : view)
    {
      auto dataId = json.toInt();
      removeView(dataId);
    }

    terrama2::core::DataManager::DataManager::removeJSon(obj);
  }
  catch(const terrama2::Exception& /*e*/)
  {
    // loggend on throw...
  }
  catch(boost::exception& e)
  {
    TERRAMA2_LOG_ERROR() << boost::diagnostic_information(e);
  }
  catch(std::exception& e)
  {
    TERRAMA2_LOG_ERROR() << e.what();
  }
  catch(...)
  {
    TERRAMA2_LOG_ERROR() << QObject::tr("Unknown error...");
  }
}
示例#9
0
void CurveEditor::setUIVisible(bool visible)
{
	if (impl_->bPanelVisible_ == visible)
	{
		return;
	}

	impl_->bPanelVisible_ = visible;
	if (!impl_->curvePanel_.valid())
	{
		return;
	}

	DependsLocal<IUIApplication> depends;
	auto uiApplication = depends.get<IUIApplication>();
	if (uiApplication == nullptr)
	{
		return;
	}

	IView& view = *impl_->curvePanel_.get();
	if (visible)
	{
		//show panel
		uiApplication->addView(view);
	}
	else
	{
		//hide panel
		uiApplication->removeView(view);
	}
}
示例#10
0
void TerminalModel::viewDestroyed(QObject* view)
{
    TerminalView* display = (TerminalView*)view;

    Q_ASSERT( _views.contains(display) );

    removeView(display);
}
示例#11
0
文件: Session.cpp 项目: Artox/qtmoko
void Session::viewDestroyed(QObject* view)
{
    TerminalDisplay* display = (TerminalDisplay*)view;

    Q_ASSERT( _views.contains(display) );

    removeView(display);
}
示例#12
0
void SimApp::hideApp()
{
    if ( view ) {
        removeView( view );
        hasSustainedDisplayText = false;
    }
    hide();
}
示例#13
0
void FilteredTreeView::setPosition(FilterPosition filterPosition)
{
	if (CurrentFilterPosition == filterPosition)
		return;

	removeView();
	CurrentFilterPosition = filterPosition;
	insertView();
}
示例#14
0
void terrama2::services::view::core::DataManager::update(terrama2::services::view::core::ViewPtr view)
{
  {
    std::lock_guard<std::recursive_mutex> lock(mtx_);
    blockSignals(true);
    removeView(view->id);
    add(view);
    blockSignals(false);
  }

  emit viewUpdated(view);
}
示例#15
0
void TGroup::remove(TView *p) {
   if (p) {
      ushort saveState;
      saveState = p->state;
      p->hide();
      removeView(p);
      p->owner = 0;
      p->next= 0;
      if ((saveState & sfVisible) != 0)
         p->show();
   }
}
示例#16
0
void ColorPicker::removePanel()
{
	auto uiApplication = this->get< IUIApplication >();
	if (uiApplication == nullptr)
	{
		return;
	}

	if (colorView_ != nullptr)
	{
		uiApplication->removeView( *colorView_ );
	}
}
void medViewContainer::setClosingMode(medViewContainer::ClosingMode mode)
{
    d->closingMode = mode;
    switch(d->closingMode)
    {
    case medViewContainer::CLOSE_CONTAINER:
        d->closeContainerButton->show();
        d->closeContainerButton->disconnect(this, SLOT(removeView()));
        connect(d->closeContainerButton, SIGNAL(clicked()), this, SLOT(close()));
        break;
    case medViewContainer::CLOSE_VIEW:
        d->closeContainerButton->show();
        d->closeContainerButton->disconnect(this, SLOT(close()));
        connect(d->closeContainerButton, SIGNAL(clicked()), this, SLOT(removeView()));
        break;
    case medViewContainer::CLOSE_BUTTON_HIDDEN:
        d->closeContainerButton->hide();
        d->closeContainerButton->disconnect(this, SLOT(close()));
        connect(d->closeContainerButton, SIGNAL(clicked()), this, SLOT(removeView()));
        break;
    }
}
示例#18
0
void Project::fini()
{
    auto uiApplication = contextManager_.queryInterface<IUIApplication>();
    assert( uiApplication != nullptr );
    if(view_ != nullptr)
    {
        uiApplication->removeView( *view_ );
    }
    auto em = contextManager_.queryInterface<IEnvManager>();
    em->removeEnv( envId_ );
    view_ = nullptr;
    projectData_ = nullptr;
}
示例#19
0
void TimelinePanel::removePanel()
{
	auto uiApplication = this->get<IUIApplication>();
	if (uiApplication == nullptr)
	{
		return;
	}
	if (timelineView_.valid())
	{
		auto view = timelineView_.get();
		uiApplication->removeView(*view);
		view = nullptr;
	}
}
void ViewController::addView(ControllableView *view,bool destroyOld) {
    ControllableView *tmpView = getView(view->type());
    if(tmpView == view) return;
    ControllableView * cView = currentView();
    if(tmpView) removeView(tmpView,destroyOld);
    m_views.append(view);

    m_currentViewIndex = -1; // reset index because it can be not valid
    if(cView) setCurrent(cView);
    // Check if the old current view was replaced by a new one and set new to current
    if(cView && !currentView()) setCurrent(view);

    if(view->jsObject())
        view->jsObject()->setParent(this);  // for javascript access.
}
示例#21
0
void PythonPanel::removePanel()
{
	auto uiApplication = get< IUIApplication >();
	
	if (uiApplication == nullptr)
	{
		NGT_ERROR_MSG( "Failed to find IUIApplication\n" );
		return;
	}

	if (pythonView_ != nullptr)
	{
		uiApplication->removeView( *pythonView_ );
	}
}
示例#22
0
ViewConfigurationDialog::ViewConfigurationDialog(Project *project, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ViewConfigurationDialog),
    mProject(project)
{
    ui->setupUi(this);

    mViewModel = new ViewsModel(mProject);
    ui->viewView->setModel( mViewModel );

    mTabsModel = 0;
    mItemsModel = 0;
    mPhrasalGlossesModel = 0;

    mView = 0;
    mTab = 0;

    connect(ui->addView, SIGNAL(clicked()), this, SLOT(addView()) );
    connect(ui->removeView, SIGNAL(clicked()), this, SLOT(removeView()) );

    connect(ui->addTab, SIGNAL(clicked()), this, SLOT(addTab()) );
    connect(ui->removeTab, SIGNAL(clicked()), this, SLOT(removeTab()) );

    connect(ui->addItem, SIGNAL(clicked()), this, SLOT(addItem()) );
    connect(ui->removeItem, SIGNAL(clicked()), this, SLOT(removeItem()) );
    connect(ui->itemView, SIGNAL(activated(QModelIndex)), this, SLOT(editItem(QModelIndex)) );

    connect(ui->addPhrasalGloss, SIGNAL(clicked()), this, SLOT(addPhrasalGloss()) );
    connect(ui->removePhrasalGloss, SIGNAL(clicked()), this, SLOT(removePhrasalGloss()) );
    connect(ui->phrasalGlossView, SIGNAL(activated(QModelIndex)), this, SLOT(editPhrasalGloss(QModelIndex)) );

    connect(ui->viewView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(viewChanged(QItemSelection,QItemSelection)));
    connect(ui->itemWritingSystemsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(indexLanguageChanged(int)));

    connect(ui->viewUp, SIGNAL(clicked()), this, SLOT(viewUp()));
    connect(ui->viewDown, SIGNAL(clicked()), this, SLOT(viewDown()));
    connect(ui->tabUp, SIGNAL(clicked()), this, SLOT(tabUp()));
    connect(ui->tabDown, SIGNAL(clicked()), this, SLOT(tabDown()));
    connect(ui->itemUp, SIGNAL(clicked()), this, SLOT(itemUp()));
    connect(ui->itemDown, SIGNAL(clicked()), this, SLOT(itemDown()));
    connect(ui->phrasalGlossUp, SIGNAL(clicked()), this, SLOT(phrasalGlossUp()));
    connect(ui->phrasalGlossDown, SIGNAL(clicked()), this, SLOT(phrasalGlossDown()));

    setTabWidgetsEnabled(false);
    setItemWidgetsEnabled(false);
}
示例#23
0
void HelloPanel::removePanel()
{
	auto uiApplication = this->get<IUIApplication>();
	if (uiApplication == nullptr)
	{
		return;
	}

	if (helloView_.valid())
	{
		auto view = helloView_.get();
		uiApplication->removeView(*view);
		view = nullptr;
	}

    helloPanelExposed_ = nullptr;
}
示例#24
0
void LayoutManager::removeView(IView& view)
{
	auto viewIt = views_.find(&view);
	if (viewIt == views_.end())
	{
		return;
	}

	auto region = viewIt->second;
	if (region == nullptr)
	{
		views_.erase(viewIt);
		return;
	}

	region->removeView(view);
	views_.erase(viewIt);
}
示例#25
0
void SimApp::terminateSession()
{
#ifndef QTOPIA_TEST
    waitDlg->hide();
#endif
    QSimTerminalResponse resp;
    if ( view )
        resp.setCommand( view->command() );
    resp.setResult( QSimTerminalResponse::SessionTerminated );
    stk->sendResponse( resp );
    if ( view )
        removeView( view );
    stk->end();
    if (commandOutsideMenu) {
        commandOutsideMenu = false;
        hide();
    }
}
示例#26
0
void CurveEditor::init(const ObjectHandle& context)
{
	DependsLocal<IViewCreator, IUIApplication> depends;
	auto viewCreator = depends.get<IViewCreator>();
	auto uiApplication = depends.get<IUIApplication>();
	if (viewCreator != nullptr && uiApplication != nullptr)
	{
		impl_->bPanelVisible_ = true;
		impl_->curvePanel_ = viewCreator->createView("plg_curve_editor/CurveEditor.qml", context, [this, uiApplication](IView& view) {
			if (uiApplication)
			{
				if (!impl_->bPanelVisible_)
				{
					uiApplication->removeView(view);
				}
			}
		});
	}
}
示例#27
0
bool ArrayBuffer::transfer(ArrayBufferContents& result, Vector<RefPtr<ArrayBufferView> >& neuteredViews)
{
    RefPtr<ArrayBuffer> keepAlive(this);

    if (!m_contents.m_data) {
        result.m_data = 0;
        return false;
    }

    m_contents.transfer(result);

    while (m_firstView) {
        ArrayBufferView* current = m_firstView;
        removeView(current);
        current->neuter();
        neuteredViews.append(current);
    }
    return true;
}
示例#28
0
文件: cframe.cpp 项目: EQ4/vstgui
/**
 * @param pView the view which should be set to modal.
 * @return true if view could be set as the modal view. false if there is a already a modal view or the view to be set as modal is already attached.
 */
bool CFrame::setModalView (CView* pView)
{
	if (pView == 0 && pModalView == 0)
		return true;

	// If there is a modal view or the view 
	if ((pView && pModalView) || (pView && pView->isAttached ()))
		return false;

	if (pModalView)
	{
		removeView (pModalView, false);
	}
	
	pModalView = pView;

	if (pModalView)
	{
		bool result = addView (pModalView);
		if (result)
		{
			clearMouseViews (CPoint (0, 0), 0, true);
			CViewContainer* container = dynamic_cast<CViewContainer*> (pModalView);
			if (container)
				container->advanceNextFocusView (0, false);
			else
				setFocusView (pModalView->wantsFocus () ? pModalView : 0);
		}
		return result;
	}
	else
	{
		CPoint where;
		getCurrentMouseLocation (where);
		checkMouseViews (where, getCurrentMouseButtons ());
	}

	return true;
}
示例#29
0
文件: ctabview.cpp 项目: EQ4/vstgui
//-----------------------------------------------------------------------------
void CTabView::setCurrentChild (CTabChildView* childView)
{
	if (currentChild)
	{
		if (childView == currentChild)
		{
			if (currentChild->button)
				currentChild->button->setValue (1.f);
			return;
		}
		if (currentChild->button)
			currentChild->button->setValue (0.f);
		removeView (currentChild->view, false);
	}
	currentChild = childView;
	if (currentChild)
	{
		addView (currentChild->view);
		if (currentChild->button)
			currentChild->button->setValue (1.f);
	}
	invalid ();
}
示例#30
0
void SimApp::setView(SimCommandView *w)
{
    // View for other than DisplayText received. Cancel sustainedDisplay
    if ( !qobject_cast<SimText*>(w) && hasSustainedDisplayText )
       hasSustainedDisplayText = false;

#ifndef QTOPIA_TEST
    waitDlg->hide();
#endif
    hideNotification();
    stack->addWidget(w);
    if (view) {
        view->removeEventFilter(this);
        removeView(view);
    }
    view = w;
    view->installEventFilter(this);
    stack->setCurrentWidget(w);
    if (!isVisible() && (!view->inherits("SimMenu") || !((SimMenu*)view)->isMainMenu())) {
        commandOutsideMenu = true;
        showMaximized();
    }
    emit viewChanged(w);
}