/** * This method is the same as the one for UMLObjects except it * displays documentation for a diagram. */ void DocWindow::showDocumentation(UMLScene * scene, bool overwrite) { if (!scene) { reset(); return; } if (m_Showing == st_UMLScene && scene == m_pUMLScene) { if (!overwrite) { return; } } else if (m_Showing == st_UMLWidget && scene == m_pUMLWidget->umlScene()) { if (!overwrite) { updateDocumentation(); } } else { updateDocumentation(true); } m_Showing = st_UMLScene; m_pUMLScene = scene; m_docTE->setText(m_pUMLScene->documentation()); updateLabel(m_pUMLScene->name()); toForeground(); }
/** * This method is the same as the one for UMLObjects except it * displays documentation for an object instance (StateWidget/ * ObjectWidget). */ void DocWindow::showDocumentation(UMLWidget * widget, bool overwrite) { if (!widget) { reset(); return; } if (m_Showing == st_UMLWidget && widget == m_pUMLWidget) { if (!overwrite) { return; } } else if (m_Showing == st_UMLObject && widget->umlObject() == m_pUMLObject) { if (!overwrite) { updateDocumentation(); } } else if (m_Showing == st_UMLScene && widget->umlScene() == m_pUMLScene) { if (!overwrite) { updateDocumentation(); } } else { updateDocumentation(true); } m_Showing = st_UMLWidget; m_pUMLWidget = widget; m_docTE->setText(m_pUMLWidget->documentation()); updateLabel(m_pUMLWidget->name()); toForeground(); }
/** * Called when a widget wishes to display its documentation in the * doc window. If there was already documentation there, that will * be updated before being removed from the view. * * Also call this function if you update the documentation in another * place, such as a properties dialog. Just set overwrite to true. * * Overwrite is used when you believe that the documentation window * is already displaying documentation for the widget you wish to * display. * Overwrite just determines whose version is more up to date. */ void DocWindow::showDocumentation(UMLObject * object, bool overwrite) { if (!object) { reset(); return; } if (m_Showing == st_UMLObject && object == m_pUMLObject) { if (!overwrite) { return; } } else if (m_Showing == st_UMLWidget && object == m_pUMLWidget->umlObject()) { if (!overwrite) { updateDocumentation(); } } else { updateDocumentation(true); } m_Showing = st_UMLObject; m_pUMLObject = object; m_docTE->setText(m_pUMLObject->doc()); if (m_pUMLObject->baseType() == UMLObject::ot_Folder) { UMLFolder *folder = m_pUMLObject->asUMLFolder(); updateLabel(folder->localName()); } else updateLabel(m_pUMLObject->name()); toForeground(); }
ConfigurationDialog::ConfigurationDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ConfigurationDialog), m_settings(0) { ui->setupUi(this); // Filter out characters which are not allowed in a file name QRegExpValidator *fileNameValidator = new QRegExpValidator(ui->name); fileNameValidator->setRegExp(QRegExp(QLatin1String("^[^\\/\\\\\\?\\>\\<\\*\\%\\:\\\"\\']*$"))); ui->name->setValidator(fileNameValidator); updateDocumentation(); connect(ui->name, SIGNAL(textChanged(QString)), this, SLOT(updateOkButton())); updateOkButton(); // force initial test. connect(ui->editor, SIGNAL(documentationChanged(QString,QString)), this, SLOT(updateDocumentation(QString,QString))); // Set palette and font according to settings const TextEditor::FontSettings fs = TextEditor::TextEditorSettings::instance()->fontSettings(); const QTextCharFormat tf = fs.toTextCharFormat(TextEditor::C_TEXT); const QTextCharFormat selectionFormat = fs.toTextCharFormat(TextEditor::C_SELECTION); QPalette pal; pal.setColor(QPalette::Base, tf.background().color()); pal.setColor(QPalette::Text, tf.foreground().color()); pal.setColor(QPalette::Foreground, tf.foreground().color()); if (selectionFormat.background().style() != Qt::NoBrush) pal.setColor(QPalette::Highlight, selectionFormat.background().color()); pal.setBrush(QPalette::HighlightedText, selectionFormat.foreground()); ui->documentation->setPalette(pal); ui->editor->setPalette(pal); ui->documentation->setFont(tf.font()); ui->editor->setFont(tf.font()); // Set style sheet for documentation browser const QTextCharFormat tfOption = fs.toTextCharFormat(TextEditor::C_FIELD); const QTextCharFormat tfParam = fs.toTextCharFormat(TextEditor::C_STRING); const QString css = QString::fromLatin1("span.param {color: %1; background-color: %2;} " "span.option {color: %3; background-color: %4;} " "p { text-align: justify; } ") .arg(tfParam.foreground().color().name()) .arg(tfParam.background().style() == Qt::NoBrush ? QString() : tfParam.background().color().name()) .arg(tfOption.foreground().color().name()) .arg(tfOption.background().style() == Qt::NoBrush ? QString() : tfOption.background().color().name()) ; ui->documentation->document()->setDefaultStyleSheet(css); }
/** * An association was removed from the UMLScene. * If the association removed was the association whose documentation is * being shown, m_pAssocWidget is set to 0. */ void DocWindow::slotAssociationRemoved(AssociationWidget* association) { if (association == m_pAssocWidget || association->umlObject() == m_pUMLObject) { // In old code, the below line crashed (bugs.kde.org/89860) // A hotfix was made and detailed analysis was To Be Done: // reset() // However, it seems to have been fixed and the below line seems to work fine updateDocumentation(true); } }
/** * This method is the same as the one for UMLObjects except it * displays documentation for an association instance * (AssociationWidget). */ void DocWindow::showDocumentation(AssociationWidget * widget, bool overwrite) { if (!widget) { reset(); return; } if (widget == m_pAssocWidget) { if (overwrite) { updateDocumentation(true); } else { return; } } else { updateDocumentation(true); } m_Showing = st_Association; m_pAssocWidget = widget; m_docTE->setText(m_pAssocWidget->documentation()); updateLabel(m_pAssocWidget->name()); toForeground(); }
/** * Called when a widget wishes to display its documentation in the * doc window. If there was already documentation there, that will * be updated before being removed from the view. * * Also call this function if you update the documentation in another * place, such as a properties dialog. Just set overwrite to true. * * Overwrite is used when you believe that the documentation window * is already displaying documentation for the widget you wish to * display. * Overwrite just determines whose version is more up to date. */ void DocWindow::showDocumentation( UMLObject * object, bool overwrite ) { if( object == m_pUMLObject && !overwrite ) return; if( object != m_pUMLObject ) updateDocumentation( true ); m_Showing = st_UMLObject; if( !object ) { m_pDocTE->setText( m_pUMLDoc->documentation() ); m_pUMLObject = 0; return; } m_pUMLObject = object; m_pDocTE->setText( m_pUMLObject->doc() ); }
/** * This method is the same as the one for UMLObjects except it * displays documentation for an association instance * (AssociationWidget). */ void DocWindow::showDocumentation( AssociationWidget * widget, bool overwrite ) { if( widget == m_pAssocWidget && !overwrite ) return; if( widget != m_pAssocWidget ) updateDocumentation( true ); m_Showing = st_Association; if( !widget ) { m_pDocTE->setText( m_pUMLDoc->documentation() ); m_pAssocWidget = 0; return; } m_pAssocWidget = widget; m_pDocTE->setText( m_pAssocWidget->documentation() ); }
/** * This method is the same as the one for UMLObjects except it * displays documentation for a diagram. */ void DocWindow::showDocumentation( UMLView * view, bool overwrite ) { if( view == m_pUMLView && !overwrite ) return; if( view != m_pUMLView ) { updateDocumentation( true ); } m_Showing = st_UMLView; if( !view ) { m_pDocTE->setText( m_pUMLDoc->documentation() ); m_pUMLView = 0; return; } m_pUMLView = view; m_pDocTE->setText( m_pUMLView->getDoc() ); }
/** * Constructor. */ DocWindow::DocWindow( UMLDoc * doc, QWidget *parent ) : QWidget( parent ) { //setup visual display QVBoxLayout * docLayout = new QVBoxLayout( this ); m_pDocTE = new KTextEdit( this ); m_pDocTE->setText( "" ); docLayout->addWidget( m_pDocTE); docLayout->setMargin(0); //m_pDocTE->setWordWrapMode(QTextEdit::WidgetWidth); //setup the documentation variables //show projects documentation to start m_pUMLDoc = doc; m_Showing = st_Project; m_pUMLObject = 0; m_pUMLView = 0; m_pUMLWidget = 0; m_pAssocWidget = 0; updateDocumentation( true, true ); }
/** * A widget was removed from the UMLScene. * If the association removed was the association which documentation is * being shown, m_pUMLWidget is set to 0. */ void DocWindow::slotWidgetRemoved(UMLWidget* widget) { if (widget == m_pUMLWidget || widget->umlObject() == m_pUMLObject) { updateDocumentation(true); } }