Пример #1
0
////////////////////////////////////////////////////////////////////////////////
/// CTreeNodeEditor::setupActions
///
/// @description  This function initalizes all the QActions for being used in
///               the node context menu.
/// @pre          None
/// @post         The QAction member variables are initialized.
///
/// @limitations  None
///
////////////////////////////////////////////////////////////////////////////////
void CTreeNodeEditor::setupActions()
{
    m_nodeAddChildAction = new QAction( tr( "Add Child" ), this );
    connect( m_nodeAddChildAction, SIGNAL( triggered() ), this,
             SLOT( addChildClicked() ) );

    m_nodeAddParentAction = new QAction( tr( "Add Parent" ), this );
    connect( m_nodeAddParentAction, SIGNAL( triggered() ), this,
             SLOT( addParentClicked() ) );

    m_nodeDeleteAction = new QAction( tr( "Delete" ), this );
    connect( m_nodeDeleteAction, SIGNAL( triggered() ), this,
             SLOT( deleteNodeClicked() ) );

    m_nodeEditValueAction = new QAction( tr( "Edit Value" ), this );
    connect( m_nodeEditValueAction, SIGNAL( triggered() ), this,
             SLOT( editValueClicked() ) );

    m_nodeEditHistoryAction = new QAction( tr( "Edit History Value" ), this );
    connect( m_nodeEditHistoryAction, SIGNAL( triggered() ), this,
             SLOT( editHistoryClicked() ) );
    
    m_nodeQuiescentAction = new QAction( tr( "Quiescent" ), this );
    m_nodeQuiescentAction->setCheckable( true );
    connect( m_nodeQuiescentAction, SIGNAL( triggered( bool ) ), this,
             SLOT(setQuiescentClicked( bool ) ) );

    m_nodeRenameAction = new QAction( tr( "Rename" ), this );
    connect( m_nodeRenameAction, SIGNAL( triggered() ), this,
             SLOT( renameNodeClicked() ) );

    m_nodeUnhookAction = new QAction( tr( "Unhook Node" ), this );
    connect( m_nodeUnhookAction, SIGNAL( triggered() ), this,
             SLOT( unhookClicked() ) );
}
Пример #2
0
	CGeorgesNewDialog::CGeorgesNewDialog(QStringList& result, QWidget *parent)
		: QDialog(parent),
		_result(result),
		_descriptionTemplate(QString())
	{
		_ui.setupUi(this);

		setWindowIcon(QIcon(":/images/georges_logo.png"));

		_ui.parentLineEdit->setEnabled(false);
		_ui.addParentButton->setEnabled(true);

		// wizard page
		connect(_ui.wizardBtn, SIGNAL(clicked(bool)),
			this, SLOT(wizardBtnClicked(bool)));
		connect(_ui.wizardList, SIGNAL(itemClicked(QListWidgetItem*)),
			this, SLOT(wizardItemActivated(QListWidgetItem *)));
		
		// form page
		connect(_ui.formBtn, SIGNAL(clicked(bool)),
			this, SLOT(formBtnClicked(bool)));
		connect(_ui.addParentButton, SIGNAL(clicked()),
			this, SLOT(addParentClicked()));
		connect(_ui.deleteParentButton, SIGNAL(clicked()),
			this, SLOT(deleteParentClicked()));
		connect(_ui.formList, SIGNAL(itemActivated(QListWidgetItem*)),
			this, SLOT(formItemActivated(QListWidgetItem *)));
		connect(_ui.formList, SIGNAL(itemClicked(QListWidgetItem*)),
			this, SLOT(formItemActivated(QListWidgetItem *)));
		connect(_ui.parentLineEdit, SIGNAL(editingFinished()),
			this, SLOT(validateParentCombo()));

		// dfn page
		connect(_ui.dfnTypeBtn, SIGNAL(clicked(bool)),
			this, SLOT(dfnTypeClicked(bool)));

		connect(_ui.buttonBox, SIGNAL(accepted()),
			this, SLOT(buttonBoxAccepted()));
		connect(_ui.buttonBox, SIGNAL(rejected()),
			this, SLOT(buttonBoxRejected()));

		// wizard list
		QListWidgetItem *mpWiz = new QListWidgetItem(QIcon(":/images/mp_generic.png"),tr("Raw Material Generator"));
		_ui.wizardList->addItem(mpWiz);

		// form list
		QString path = Modules::mainWin().leveldesignPath();
		QStringList typelist;
		//nlinfo ("Searching files in directory '%s'...", dir.c_str());
		NLMISC::CPath::getPathContent(path.toUtf8().constData(),true,false,true,_files);

		getTypes( /* path.toUtf8() // incompatible parameter type */ );
		//nlinfo ("%d supported file types :",FileTypeToId.size());
		for ( std::map<std::string,uint8>::iterator it = FileTypeToId.begin(); it != FileTypeToId.end(); ++it )
		{
			typelist.append(QString((*it).first.c_str()));
			//nlinfo("%s",(*it).first.c_str());
		}
		_ui.formList->addItems(typelist);

		for(uint i = 0; i < _files.size(); i++)
		{
			std::string extStr = NLMISC::CFile::getExtension( _files[i] );

			// filter files without existing dfn
			if (!NLMISC::CPath::exists(extStr + ".dfn") &&
				!NLMISC::CPath::exists(extStr + ".typ"))
			{
				continue;
			}
			_filelist.append(QString(NLMISC::CFile::getFilename(_files[i]).c_str()));
		}		

		_ui.parentFrame->hide();

		// replace "Heading" and "Descriptive Text" with your string
		_descriptionTemplate = 
			"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\"" 
			"\"http://www.w3.org/TR/REC-html40/strict.dtd\">"
			"\n<html><head><meta name=\"qrichtext\" content=\"1\" />"
			"<style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style>"
			"</head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
			"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
			"<span style=\" font-size:8pt; font-weight:600;\">Heading</span></p>"
			"\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
			"<span style=\" font-size:8pt;\">Descriptive Text</span></p></body></html>";
	}