Example #1
0
//!-------------------------------------------------------------------------
//! create a material dialog widget (not embedded mode)
//!-------------------------------------------------------------------------
void MEMaterialPort::manageDialog()
{
    m_dialog = new QDialog(0);
    m_dialog->setWindowIcon(MEMainHandler::instance()->pm_logo);
    QString title = node->getTitle() + ":" + portname;
    m_dialog->setWindowTitle(MEMainHandler::instance()->generateTitle(title));
    connect(m_dialog, SIGNAL(finished(int)), this, SLOT(folderCB()));

    m_chooser = new MEMaterialChooser();
    connect(m_chooser, SIGNAL(materialChanged(const QVector<float> &)), this, SLOT(materialChanged(const QVector<float> &)));
    m_chooser->setParent(m_dialog);

    QVBoxLayout *vbox = new QVBoxLayout(m_dialog);
    vbox->addWidget(m_chooser, 1);

    // create the dialog buttons
    QDialogButtonBox *bb = new QDialogButtonBox();
    QPushButton *pb = NULL;
    pb = bb->addButton("Apply", QDialogButtonBox::AcceptRole);
    pb = bb->addButton("Close", QDialogButtonBox::RejectRole);
    connect(bb, SIGNAL(accepted()), this, SLOT(applyCB()));
    connect(bb, SIGNAL(rejected()), this, SLOT(materialMapClosed()));
    pb = bb->addButton(QDialogButtonBox::Reset);
    connect(pb, SIGNAL(clicked()), this, SLOT(resetCB()));
    vbox->addWidget(bb);

    // user can close the window pressing ESC
    QAction *m_escape_a = new QAction("Escape", this);
    m_escape_a->setShortcut(Qt::Key_Escape);
    connect(m_escape_a, SIGNAL(triggered()), this, SLOT(materialMapClosed()));
    m_dialog->addAction(m_escape_a);
}
// start thread
void ROSAction::start()
{
	std::cout << "Executing Reset Callback Now" << std::endl;
	resetCB();
	{
		boost::lock_guard<boost::mutex> lock(mutex_started_);
		started_ = true;
	}
	{
		boost::lock_guard<boost::mutex> lock(mutex_active_);
		active_ = true;
	}
	std::cout << "Starting Thread Now" << std::endl;
	std::cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;

	execution_thread_ = boost::thread(
		boost::bind(&ROSAction::executionThread, this) );
}