Beispiel #1
0
// ****************************************************************************
//  Constructor: XMLEdit::XMLEdit
//
//  Programmer:  Jeremy Meredith
//  Creation:    October 17, 2002
//
//  Modifications:
//    Brad Whitlock, Fri Mar 7 13:19:55 PST 2008
//    Added "Generate code" menu option.
//
//    Cyrus Harrison, Thu May 15 16:00:46 PDT 200
//    First pass at porting to Qt 4.4.0
//
// ****************************************************************************
XMLEdit::XMLEdit(const QString &file, QWidget *p)
    : QMainWindow(p)
{
    setWindowTitle(tr("XMLEdit: %1").arg(file));

    QMenu *filemenu = menuBar()->addMenu(tr("&File"));
    filemenu->addAction( tr("&New"), this, SLOT(newdoc()), QKeySequence(Qt::CTRL + Qt::Key_N));
    filemenu->addAction(tr("&Open"),  this, SLOT(open()),  QKeySequence(Qt::CTRL + Qt::Key_O));
    filemenu->addAction(tr("&Save"),  this, SLOT(save()),  QKeySequence(Qt::CTRL + Qt::Key_S));
    filemenu->addAction(tr("Save &as"),  this, SLOT(saveAs()),  QKeySequence(Qt::CTRL + Qt::Key_A));
    filemenu->addSeparator();
    filemenu->addAction(tr("&Generate code"),  this, SLOT(generateCode()), QKeySequence(Qt::CTRL + Qt::Key_G));
    filemenu->addSeparator();
    filemenu->addAction( tr("E&xit"), this, SLOT(close()),  QKeySequence(Qt::CTRL + Qt::Key_X) );

    tabs = new QTabWidget(this);
    tabs->setContentsMargins(5,5,5,5);

    plugintab = new XMLEditPlugin(this);
    tabs->addTab(plugintab, tr("Plugin"));

    makefiletab = new XMLEditMakefile(this);
    tabs->addTab(makefiletab, tr("CMake"));
   
    attributetab = new XMLEditAttribute(this);
    tabs->addTab(attributetab, tr("Attribute"));
   
    enumstab = new XMLEditEnums(this);
    tabs->addTab(enumstab, tr("Enums"));
    
    fieldstab = new XMLEditFields(this);
    tabs->addTab(fieldstab, tr("Fields"));

    functionstab = new XMLEditFunctions(this);
    tabs->addTab(functionstab, tr("Functions"));

    constantstab = new XMLEditConstants(this);
    tabs->addTab(constantstab, tr("Constants"));
   
    includestab = new XMLEditIncludes(this);
    tabs->addTab(includestab, tr("Includes"));
    
    codetab = new XMLEditCode(this);
    tabs->addTab(codetab, tr("Code"));
    
    connect(tabs, SIGNAL(currentChanged(int)),
            this, SLOT(updateTab(int)));
            
    setCentralWidget(tabs);
    codeGenerationWindow = 0;
    
    OpenFile(file);
}
Beispiel #2
0
bool LnkProperties::moveLnk()
{
    DocLnk newdoc( *((DocLnk *)lnk) );
    newdoc.setName(d->docname->text());

    if ( !copyFile( newdoc ) ) {
	QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") );
	return FALSE;
    }
    // remove old lnk
    lnk->removeFiles();

    return TRUE;
}
Beispiel #3
0
void LnkProperties::duplicateLnk()
{
    // The duplicate takes the new properties.
    DocLnk newdoc( *((DocLnk *)lnk) );
    if ( d->docname->text() == lnk->name() )
	newdoc.setName(tr("Copy of ")+d->docname->text());
    else
	newdoc.setName(d->docname->text());

    if ( !copyFile( newdoc ) ) {
	QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") );
	return;
    }
    reject();
}
Beispiel #4
0
HRESULT  DMSHelper::SaveDocumentEx(WSDocNonCom& docInfo, bool bShowUIForSaveType, long lSaveInfoFlags, long hWnd )
{
	LOG_WS_FUNCTION_SCOPE_MSG(docInfo.GetDocId());

	HRESULT  hr = E_FAIL;
	WSDOCUMENTPROVIDERLib::tagWSDOCUMENT wsDocument;
	docInfo.InitializeWSDOCUMENT((WSDOCUMENT*) &wsDocument);

	hr = GetDocProvProxy()->SaveDocumentEx(&wsDocument, bShowUIForSaveType ? VARIANT_TRUE : VARIANT_FALSE, lSaveInfoFlags, hWnd);

	WSDocNonCom newdoc((WSDOCUMENT*) &wsDocument);
	docInfo = newdoc;
	WSDocCleaner::CleanWSDoc(wsDocument);

	if (FAILED(hr))
	{
		CStdString sError;
		sError.Format(_T("hr = %x"), hr);
		LOG_WS_ERROR(sError.c_str());
	}
	return hr;
}