Example #1
0
BOOL LGGAutoCorrect::saveListToDisk(std::string listName, std::string fileName)
{
	if(mAutoCorrects.has(listName))
	{
		llofstream file;
		file.open(fileName.c_str());
		LLSDSerialize::toPrettyXML(exportList(listName), file);
		file.close();
		return TRUE;
	}
	return FALSE;
}
Example #2
0
void StationTreeView::contextMenuEvent( QContextMenuEvent* event )
{
	QModelIndex index = this->selectionModel()->currentIndex();
	ModelTreeItem* item = static_cast<ModelTreeItem*>(index.internalPointer());

	if (!item)  // Otherwise sometimes it crashes when (unmotivated ;-) ) clicking in a treeview
		return;

	// The current index refers to a parent item (e.g. a listname)
	if (item->childCount() > 0)
	{
		QMenu menu;
		QAction* propertyAction = menu.addAction("Display list properties...");
		QAction* exportAction   = menu.addAction("Export to GMS...");
		QAction* saveAction   = menu.addAction("Save to file...");
		menu.addSeparator();
		QAction* removeAction   = menu.addAction("Remove station list");

		connect(propertyAction, SIGNAL(triggered()), this, SLOT(showPropertiesDialog()));
		connect(exportAction,   SIGNAL(triggered()), this, SLOT(exportList()));
		connect(saveAction,   SIGNAL(triggered()), this, SLOT(saveList()));
		connect(removeAction,   SIGNAL(triggered()), this, SLOT(removeStationList()));
		menu.exec(event->globalPos());
	}
	// The current index refers to a station object
	else
	{
		QString temp_name;
		QMenu menu;

		if (static_cast<StationTreeModel*>(model())->stationFromIndex(index,
		                                                              temp_name)->type() ==
		    GeoLib::Station::BOREHOLE)
		{
			QAction* stratAction = menu.addAction("Display Stratigraphy...");
			QAction* exportAction = menu.addAction("Export to GMS...");
			connect(stratAction, SIGNAL(triggered()), this, SLOT(displayStratigraphy()));
			connect(exportAction, SIGNAL(triggered()), this, SLOT(exportStation()));
			menu.exec(event->globalPos());
		}
		else
		{
			menu.addAction("View Information...");
			QAction* showDiagramAction = menu.addAction("View Diagram...");
			connect(showDiagramAction, SIGNAL(triggered()), this,
			        SLOT(showDiagramPrefsDialog()));
			menu.exec(event->globalPos());
		}
	}
}