Exemple #1
0
/**
 * @brief Slot connected to MarblePopupHeader::deleteMarkerSignal
 * @param p_marker_id
 */
void MarbleMap::deleteMarkerSlot(int p_marker_id)
{
#ifdef DBG_MARBLE_MAP
  qDebug() << "MarbleMap::deleteMarkerSlot(" << p_marker_id << ")";
#endif
  destroyPopup();
  emit deleteMarker(p_marker_id);
}
Exemple #2
0
void
MarkerRuler::slotDeleteMarker()
{
    RG_DEBUG << "MarkerRuler::slotDeleteMarker()\n";
    
    Rosegarden::Marker* marker = getMarkerAtClickPosition();
    
    if (marker)
        emit deleteMarker(marker->getID(),
                          marker->getTime(),
                          strtoqstr(marker->getName()),
                          strtoqstr(marker->getDescription()));                          
}
void MarkerDisplayCustom::update(float wall_dt, float ros_dt)
{
  V_MarkerMessage local_queue;

  {
    boost::mutex::scoped_lock lock(queue_mutex_);

    local_queue.swap( message_queue_ );
  }

  if ( !local_queue.empty() )
  {
    V_MarkerMessage::iterator message_it = local_queue.begin();
    V_MarkerMessage::iterator message_end = local_queue.end();
    for ( ; message_it != message_end; ++message_it )
    {
      visualization_msgs::Marker::ConstPtr& marker = *message_it;

      processMessage( marker );
    }
  }

  {
    S_MarkerBaseCustom::iterator it = markers_with_expiration_.begin();
    S_MarkerBaseCustom::iterator end = markers_with_expiration_.end();
    for (; it != end;)
    {
      MarkerBaseCustomPtr marker = *it;
      if (marker->expired())
      {
        ++it;
        deleteMarker(marker->getID());
      }
      else
      {
        ++it;
      }
    }
  }

  //std::cout << "Updating... " << wall_dt << " " << ros_dt << " " << frame_locked_markers_.size() << std::endl;
  {
    S_MarkerBaseCustom::iterator it = frame_locked_markers_.begin();
    S_MarkerBaseCustom::iterator end = frame_locked_markers_.end();
    for (; it != end; ++it)
    {
      MarkerBaseCustomPtr marker = *it;
      marker->updateFrameLocked();
    }
  }
}
void ImageSegmentor::removeBorderMarkers() {
	int nl = markersPic.rows;
	int nc = markersPic.cols;
	std::set<int> badLabels;
	for (int j=0; j<nl; j++) {
		int* data = markersPic.ptr<int>(j);
		if(j == 0 || j == nl-1 || j == 1 || j == nl - 2) {
			for (int i=0; i<nc; i++) {
				if(data[i] > 1) badLabels.insert(data[i]);
			}
		} else {
			if(data[0] > 1) badLabels.insert(data[0]);
			if(data[nc-1] > 1) badLabels.insert(data[nc-1]);
			if(data[1] > 1) badLabels.insert(data[1]);
			if(data[nc-2] > 1) badLabels.insert(data[nc-2]);
		}
	}
	for(std::set<int>::iterator setIt = badLabels.begin();
			setIt != badLabels.end(); ++setIt) {
		deleteMarker(*setIt);
	}
}
void MarkerDisplay::deleteMarkersInNamespace( const std::string& ns )
{
  std::vector<MarkerID> to_delete;

  // TODO: this is inefficient, should store every in-use id per namespace and lookup by that
  M_IDToMarker::iterator marker_it = markers_.begin();
  M_IDToMarker::iterator marker_end = markers_.end();
  for (; marker_it != marker_end; ++marker_it)
  {
    if (marker_it->first.first == ns)
    {
      to_delete.push_back(marker_it->first);
    }
  }

  {
    std::vector<MarkerID>::iterator it = to_delete.begin();
    std::vector<MarkerID>::iterator end = to_delete.end();
    for (; it != end; ++it)
    {
      deleteMarker(*it);
    }
  }
}
Exemple #6
0
MarkerView::MarkerView(QWidget* parent)
: TopWin(parent, "markerview", Qt::Window /*| WDestructiveClose*/)
{
	//setAttribute(Qt::WA_DeleteOnClose);

	setWindowTitle(tr("OOMidi: Marker"));

	QAction* markerAdd = new QAction(QIcon(*flagIcon), tr("add marker"), this);
	connect(markerAdd, SIGNAL(triggered()), SLOT(addMarker()));

	QAction* markerDelete = new QAction(QIcon(*deleteIcon), tr("delete marker"), this);
	connect(markerDelete, SIGNAL(triggered()), SLOT(deleteMarker()));

	//---------Pulldown Menu----------------------------
	/* We probably don't need an empty menu - Orcan
	QMenu* fileMenu = new QMenu(tr("&File"));
	menuBar()->addMenu(fileMenu);
	 */
	QMenu* editMenu = menuBar()->addMenu(tr("&Edit"));

	editMenu->addAction(markerAdd);
	editMenu->addAction(markerDelete);

	//---------ToolBar----------------------------------
	tools = addToolBar(tr("marker-tools"));
	tools->addActions(undoRedo->actions());

	QToolBar* edit = addToolBar(tr("edit tools"));
	edit->addAction(markerAdd);
	edit->addAction(markerDelete);

	//---------------------------------------------------
	//    master
	//---------------------------------------------------

	QWidget* w = new QWidget;
	setCentralWidget(w);
	QVBoxLayout* vbox = new QVBoxLayout(w);

	table = new QTreeWidget(w);
	table->setAllColumnsShowFocus(true);
	table->setSelectionMode(QAbstractItemView::SingleSelection);

	QStringList columnnames;
	columnnames << tr("Bar:Beat:Tick")
			<< tr("Hr:Mn:Sc:Fr:Sf")
			<< tr("Lock")
			<< tr("Text");

	table->setHeaderLabels(columnnames);
	table->setColumnWidth(2, 40);
	table->header()->setStretchLastSection(true);

	connect(table, SIGNAL(itemSelectionChanged()),
			SLOT(markerSelectionChanged()));
	connect(table, SIGNAL(itemClicked(QTreeWidgetItem*, int)),
			SLOT(clicked(QTreeWidgetItem*)));

	QGroupBox* props = new QGroupBox(tr("Marker Properties"));
	QHBoxLayout *hbox = new QHBoxLayout;

	///editTick = new PosEdit;
	editTick = new Awl::PosEdit;
	editTick->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
			QSizePolicy::Fixed));

	///editSMPTE = new PosEdit;
	editSMPTE = new Awl::PosEdit;
	editSMPTE->setSmpte(true);
	editSMPTE->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
			QSizePolicy::Fixed));

	lock = new QToolButton;
	lock->setIcon(*lockIcon);
	lock->setCheckable(true);

	editName = new QLineEdit;
	editName->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
			QSizePolicy::Preferred));

	hbox->addWidget(editTick);
	hbox->addWidget(editSMPTE);
	hbox->addWidget(lock);
	hbox->addWidget(editName);
	props->setLayout(hbox);

	connect(editName, SIGNAL(textChanged(const QString&)),
			SLOT(nameChanged(const QString&)));
	connect(editTick, SIGNAL(valueChanged(const Pos&)),
			SLOT(tickChanged(const Pos&)));
	connect(editSMPTE, SIGNAL(valueChanged(const Pos&)),
			SLOT(tickChanged(const Pos&)));
	connect(editSMPTE, SIGNAL(valueChanged(const Pos&)),
			editTick, SLOT(setValue(const Pos&)));
	connect(editTick, SIGNAL(valueChanged(const Pos&)),
			editSMPTE, SLOT(setValue(const Pos&)));
	connect(lock, SIGNAL(toggled(bool)),
			SLOT(lockChanged(bool)));
	connect(song, SIGNAL(markerChanged(int)),
			SLOT(markerChanged(int)));

	vbox->addWidget(table);
	vbox->addWidget(props);

	//---------------------------------------------------
	//    Rest
	//---------------------------------------------------

	//connect(song, SIGNAL(songChanged(int)), SLOT(updateList()));
	connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));

	updateList();

	// work around for probable QT/WM interaction bug.
	// for certain window managers, e.g xfce, this window is
	// is displayed although not specifically set to show();
	// bug: 2811156  	 Softsynth GUI unclosable with XFCE4 (and a few others)
	show();
	hide();

}
Exemple #7
0
void Plot::createMenu ()
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu()));

  _menu = new QMenu(this);
  
  _dateAction = new QAction(QIcon(date_xpm), tr("&Date"), this);
  _dateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
  _dateAction->setToolTip(tr("Date"));
  _dateAction->setStatusTip(tr("Date"));
  _dateAction->setCheckable(TRUE);
  _dateAction->setChecked(TRUE);
  connect(_dateAction, SIGNAL(triggered(bool)), this, SLOT(showDate(bool)));
  _menu->addAction(_dateAction);

  _gridAction = new QAction(QIcon(grid_xpm), tr("&Grid"), this);
  _gridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
  _gridAction->setToolTip(tr("Grid"));
  _gridAction->setStatusTip(tr("Grid"));
  _gridAction->setCheckable(TRUE);
  _gridAction->setChecked(TRUE);
  connect(_gridAction, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool)));
  _menu->addAction(_gridAction);

  _infoAction = new QAction(QIcon(about_xpm), tr("Bar &Info"), this);
  _infoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
  _infoAction->setToolTip(tr("Bar Info"));
  _infoAction->setStatusTip(tr("Bar Info"));
  _infoAction->setCheckable(TRUE);
  _infoAction->setChecked(TRUE);
  connect(_infoAction, SIGNAL(triggered(bool)), this, SLOT(setInfo(bool)));
  _menu->addAction(_infoAction);

  _menu->addSeparator();
  
  // create the chart object menu
  QMenu *mm = new QMenu(this);
  mm->setTitle(tr("New Plot Marker..."));
  connect(mm, SIGNAL(triggered(QAction *)), this, SLOT(markerMenuSelected(QAction *)));
  _menu->addMenu(mm);
  
  // buy
  QAction *a = new QAction(QIcon(buyarrow_xpm), tr("&Buy"), this);
  a->setToolTip(tr("Create Buy Arrow Plot Marker"));
  a->setStatusTip(QString(tr("Create Buy Arrow Plot Marker")));
  a->setData(QVariant("MarkerBuy"));
  mm->addAction(a);

  // hline
  a = new QAction(QIcon(horizontal_xpm), tr("&HLine"), this);
  a->setToolTip(tr("Create Horizontal Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Horizontal Line Plot Marker")));
  a->setData(QVariant("MarkerHLine"));
  mm->addAction(a);

  // retracement
  a = new QAction(QIcon(fib_xpm), tr("&Retracement"), this);
  a->setToolTip(tr("Create Retracement Levels Plot Marker"));
  a->setStatusTip(QString(tr("Create Retracement Levels Plot Marker")));
  a->setData(QVariant("MarkerRetracement"));
  mm->addAction(a);

  // sell
  a = new QAction(QIcon(sellarrow_xpm), tr("&Sell"), this);
  a->setToolTip(tr("Create Sell Arrow Plot Marker"));
  a->setStatusTip(QString(tr("Create Sell Arrow Plot Marker")));
  a->setData(QVariant("MarkerSell"));
  mm->addAction(a);

  // text
  a = new QAction(QIcon(text_xpm), tr("&Text"), this);
  a->setToolTip(tr("Create Text Plot Marker"));
  a->setStatusTip(QString(tr("Create Text Plot Marker")));
  a->setData(QVariant("MarkerText"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(trend_xpm), tr("T&Line"), this);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerTLine"));
  mm->addAction(a);

  // vline
  a = new QAction(QIcon(vertical_xpm), tr("&VLine"), this);
  a->setToolTip(tr("Create Vertical Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Vertical Line Plot Marker")));
  a->setData(QVariant("MarkerVLine"));
  mm->addAction(a);
  
  // delete all chart objects
  a = new QAction(QIcon(delete_xpm), tr("Delete All Plot &Markers"), this);
  a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
  a->setToolTip(tr("Delete All Plot Markers"));
  a->setStatusTip(tr("Delete All Plot Markers"));
  connect(a, SIGNAL(triggered(bool)), this, SLOT(deleteAllMarkersDialog()));
  _menu->addAction(a);

  // marker menu
  _markerMenu = new QMenu(this);
  _markerMenu->addAction(QIcon(edit_xpm), QObject::tr("&Edit"), this, SLOT(markerDialog()), QKeySequence(Qt::ALT+Qt::Key_E));
  _markerMenu->addAction(QIcon(delete_xpm), QObject::tr("&Delete"), this, SLOT(deleteMarker()), QKeySequence(Qt::ALT+Qt::Key_D));
}
void MarkerDisplay::processDelete( const visualization_msgs::Marker::ConstPtr& message )
{
  deleteMarker(MarkerID(message->ns, message->id));
  context_->queueRender();
}
Exemple #9
0
void Plot::createMenu ()
{
  setContextMenuPolicy(Qt::CustomContextMenu);
  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showContextMenu()));

  _menu = new QMenu(this);
  
  _dateAction = new QAction(QIcon(":icons/calendar"), tr("Show &Dates"), this);
  _dateAction->setIconVisibleInMenu(true);
  _dateAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
  _dateAction->setToolTip(tr("Show/Hide Date"));
  _dateAction->setStatusTip(tr("Show/Hide Date"));
  _dateAction->setCheckable(true);
  _dateAction->setChecked(true);
  connect(_dateAction, SIGNAL(triggered(bool)), this, SLOT(showDate(bool)));
  _menu->addAction(_dateAction);

  _gridAction = new QAction(QIcon(":icons/grid"), tr("Show &Grid"), this);
  _gridAction->setIconVisibleInMenu(true);
  _gridAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_G));
  _gridAction->setToolTip(tr("Show/Hide Grid"));
  _gridAction->setStatusTip(tr("Show/Hide Grid"));
  _gridAction->setCheckable(true);
  _gridAction->setChecked(true);
  connect(_gridAction, SIGNAL(triggered(bool)), this, SLOT(setGrid(bool)));
  _menu->addAction(_gridAction);

  _infoAction = new QAction(QIcon(":icons/info"), tr("Show Bar &Info"), this);
  _infoAction->setIconVisibleInMenu(true);
  _infoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
  _infoAction->setToolTip(tr("Show/Hide Bar Info"));
  _infoAction->setStatusTip(tr("Show/Hide Bar Info"));
  _infoAction->setCheckable(true);
  _infoAction->setChecked(true);
  connect(_infoAction, SIGNAL(triggered(bool)), this, SLOT(setInfo(bool)));
  _menu->addAction(_infoAction);

  _menu->addSeparator();
  
  // create the chart object menu
  QMenu *mm = new QMenu(this);
  mm->setTitle(tr("New Plot Marker..."));
  connect(mm, SIGNAL(triggered(QAction *)), this, SLOT(markerMenuSelected(QAction *)));
  _menu->addMenu(mm);

  // buy
  QAction *a = new QAction(QIcon(":icons/buy"), tr("&Buy"), this);
  a->setToolTip(tr("Create Buy Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Buy Arrow Plot Marker")));
  a->setData(QVariant("MarkerBuy"));
  mm->addAction(a);

  // sell
  a = new QAction(QIcon(":icons/sell"), tr("&Sell"), this);
  a->setToolTip(tr("Create Sell Arrow Plot Marker"));
  a->setIconVisibleInMenu(true);
  a->setStatusTip(QString(tr("Create Sell Arrow Plot Marker")));
  a->setData(QVariant("MarkerSell"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("Trend &Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerTLine"));
  mm->addAction(a);

  // tline
  a = new QAction(QIcon(":icons/trend"), tr("&Horizontal Line"), this);
  a->setIconVisibleInMenu(true);
  a->setToolTip(tr("Create Trend Line Plot Marker"));
  a->setStatusTip(QString(tr("Create Trend Line Plot Marker")));
  a->setData(QVariant("MarkerHLine"));
  mm->addAction(a);

  // marker menu
  _markerMenu = new QMenu(this);
  _markerMenu->addAction(QIcon(":icons/edit"), QObject::tr("&Edit"), this, SLOT(markerDialog()), QKeySequence(Qt::ALT+Qt::Key_E));
  _markerMenu->addAction(QIcon(":icons/delete"), QObject::tr("&Delete"), this, SLOT(deleteMarker()), QKeySequence(Qt::ALT+Qt::Key_D));
  _markerMenu->menuAction()->setIconVisibleInMenu(true);
}