SingleDocument::SingleDocument(MainWindow *mainWindow, QWidget *parent) :
    QsciScintilla(parent), m_mainWindow(mainWindow), m_documentName("")
{

    if(g_apiFiles.isEmpty())
    {
        QDirIterator it(getScriptEditorFilesFolder()+ "/apiFiles", QStringList() << "*.api", QDir::Files, QDirIterator::Subdirectories);
        while (it.hasNext())
        {
            QFile file(it.next());
            if (file.open(QFile::ReadOnly))
            {
                QTextStream in(&file);
                QString singleEntry = in.readLine();
                QString fileName = QFileInfo(file.fileName()).fileName();

                while(!singleEntry.isEmpty())
                {
                    g_apiFiles[fileName] << QString(singleEntry).replace("\\n", "\n");
                    singleEntry = in.readLine();
                }
            }
            file.close();
        }

    }
    connect(this, SIGNAL(textChanged()), m_mainWindow, SLOT(documentWasModified()));
}
Пример #2
0
QWERTYEditor::QWERTYEditor() {
	/* 
		Конструктор. 
		Создаем объект класса QPlainTextEdit и устанвливаем	его в центральный 
		виджет. Затем вызываем функции формирования главного окна приложения. 
		Затем читаем настройки. После этого привызяваем сигнал о модификации 
		документа в соответствующий	слот. В конце вызываем функцию установки 
		текущего файла.
	*/

    textEdit = new QPlainTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect (
            textEdit -> document (), 
            SIGNAL ( contentsChanged() ),
            this, 
            SLOT ( documentWasModified() )
            );

    setCurrentFile ("");
}
Пример #3
0
bool MdiChild::loadFile(const QString &fileName)
{
    QSettings* preferences = new QSettings(QSettings::IniFormat, QSettings::UserScope,
    "DGSOFTWARE", "Notatio Antiqua");
    preferences->beginGroup("Font");
    if (preferences->value("standardFont") != "")
            setFontFamily(preferences->value("standardFont").toString());
    preferences->endGroup();
    QFile file(fileName);
    if (!file.open(QFile::ReadOnly | QFile::Text)) {
        QMessageBox::warning(this, tr("Notatio Antiqua"),
                             tr("Can't read file: %1:\n%2.")
                             .arg(fileName)
                             .arg(file.errorString()));
        return false;
    }
    preferences->beginGroup("File");
    preferences->setValue("lastOpen",fileName);
    preferences->endGroup();
    QTextStream in(&file);
    in.setCodec("UTF-8");
    QApplication::setOverrideCursor(Qt::WaitCursor);
    setPlainText(in.readAll());
    QApplication::restoreOverrideCursor();
    setCurrentFile(fileName);
    highlighter = new Highlighter(document());
    connect(document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    return true;
}
Пример #4
0
 bool MdiChild::loadFile(const QString &fileName)
 {
     QFile file(fileName);
     if (!file.open(QFile::ReadOnly | QFile::Text)) {
         QMessageBox::warning(this, tr("File Editor"),
                              tr("Cannot read file %1:\n%2.")
                              .arg(fileName)
                              .arg(file.errorString()));
         return false;
     }

     QTextStream in(&file);
     QApplication::setOverrideCursor(Qt::WaitCursor);
     setPlainText(in.readAll());
     QApplication::restoreOverrideCursor();

     setCurrentFile(fileName);
     if (fileName.endsWith(".mdp", Qt::CaseInsensitive))
    	 m_highlighter=new MDPHighlighter(document());

     connect(document(), SIGNAL(contentsChanged()),
             this, SLOT(documentWasModified()));

     return true;
 }
Пример #5
0
void MdiChild::setModified()
{
  ui->modelsList->refreshList();
  fileChanged = true;
  updateTitle();
  documentWasModified();
}
Пример #6
0
void npcedit::setCurrentFile(const QString &fileName)
{
    curFile = QFileInfo(fileName).canonicalFilePath();
    isUntitled = false;
    //document()->setModified(false);
    setWindowModified(false);
    documentWasModified();
    setWindowTitle(userFriendlyCurrentFile() + "[*]");
}
Пример #7
0
//新建文件操作
void MdiChild::newFile()
{
    static int sequenceNumber=1;//设置窗口编号,因为编号一直被保存,所以需要使用静态变量
    isUntitled=true;//新建文档没有被保存过
    curFile=tr("未命名文档%1.txt").arg(sequenceNumber++);//将当前文件命名为未命名文档加编号,编号先使用再加一
    setWindowTitle(curFile+"[*]"+"-多文档编辑器");//设置窗口标题,使用[*]可以在文档被更改后在文件名称后显示"*"号

    //文档更改时发射contentsChanged()信号,执行documentWasModified()槽
    connect(document(),SIGNAL(contentsChanged()),this,SLOT(documentWasModified()));
}
Пример #8
0
 void MdiChild::newFile()
 {
     static int sequenceNumber = 1;

     isUntitled = true;
     curFile = tr("document%1.txt").arg(sequenceNumber++);
     setWindowTitle(curFile + "[*]");

     connect(document(), SIGNAL(contentsChanged()),this, SLOT(documentWasModified()));
 }
Пример #9
0
void CodeEditor::newFile()
{
    static int sequenceNumber = 1;

    m_isUntitled = true;
    m_curFile = tr("document%1.txt").arg(sequenceNumber++);
    setWindowTitle(m_curFile + "[*]");

    connect(this, SIGNAL(textChanged()), this, SLOT(documentWasModified()));
}
Пример #10
0
void MyMdi::NewFile()
{
    static int sequence_number = 1;
    is_saved_ = false;
    current_file_path_ = QStringLiteral("未命名文档%1.txt").arg(sequence_number++);
    setWindowTitle(current_file_path_ + "[*]");//设置文档默认标题,“[*]”在默认情况下是什么都不显示的,只有当调用setWindowModified()
    //函数的时候,会自动在由“[*]”的地方加上“*”,后面的文字会自动后移
    connect(document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified()));//文档内容发生改变时,
    //触发槽函数DocumentWasModified().
}
JsonEditorMain::JsonEditorMain(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::JsonEditorMain),
    newInsertText(tr("Insert new data")),
    treeViewColumnKey(tr("Node")),
    treeViewColumnValue(tr("Value")),
    treeViewColumnType(tr("Type"))
{
    ui->setupUi(this);
    connect(ui->menuCodeTools, SIGNAL(toggled(bool)), this, SLOT(toggleCodeToolbar(bool)));
    connect(ui->menuFindTools, SIGNAL(toggled(bool)), this, SLOT(toggleFindToolbar(bool)));
    connect(ui->menuFileTools, SIGNAL(toggled(bool)), this, SLOT(toggleFileToolbar(bool)));
    connect(ui->menuEditTools, SIGNAL(toggled(bool)), this, SLOT(toggleEditToolbar(bool)));
    connect(ui->menuRefresh, SIGNAL(triggered()), this, SLOT(refreshJsonTree()));
    connect(ui->menuInsertNode, SIGNAL(triggered()), this, SLOT(insertTreeNode()));
    connect(ui->menuInsertChild, SIGNAL(triggered()), this, SLOT(insertTreeChild()));
    connect(ui->menuDeleteNode, SIGNAL(triggered()), this, SLOT(deleteTreeNode()));
    connect(ui->jsonTree, SIGNAL(clicked(QModelIndex)), this, SLOT(updateActions()));
    connect(ui->menuFormat, SIGNAL(triggered()), this, SLOT(formatCode()));
    connect(ui->menuHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(ui->jsonTree, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(dataEdit(QModelIndex)));


//    connect(ui->menuNewFile, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(ui->menuOpenFile, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->menuSaveFile, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->menuSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));

    JSHighlighter * highlight = new JSHighlighter(ui->jsonCode->document());

    setCurrentFile("");

    textEdit = ui->jsonCode;
    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));
    setUnifiedTitleAndToolBarOnMac(true);

    m_findDialog = new FindDialog(this);
    m_findDialog->setModal(false);
    m_findDialog->setTextEdit(textEdit);

    m_findReplaceDialog = new FindReplaceDialog(this);
    m_findReplaceDialog->setModal(false);
    m_findReplaceDialog->setTextEdit(textEdit);

    connect(ui->menuFind, SIGNAL(triggered()), m_findDialog, SLOT(show()));
    connect(ui->menuReplace, SIGNAL(triggered()), m_findReplaceDialog, SLOT(show()));

//    connect(ui->actionFindNext, SIGNAL(triggered()), m_findDialog, SLOT(findNext()));
//    connect(ui->actionFindPrevious, SIGNAL(triggered()), m_findDialog, SLOT(findPrev()));

    readSettings();
}
Пример #12
0
int MdiChild::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: documentWasModified(); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
MainWindow::MainWindow()
{
    textEdit = new QTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
}
Пример #14
0
void MdiChild::newFile()
{
    static int sequenceNumber = 1;
    isUntitled = true;
    curFile = tr("document%1.sv").arg(sequenceNumber++);
    lexer=new QsciLexerSystemVerilog();

     QVariant var=UVESettings::getInstance()->value(CONF_FONT,DEFAULT_FONT);
     lexer->setFont(var.value<QFont>());

    setLexer(lexer);

    //setCurrentFile(curFile);
    curFileDate= QDateTime();
    setWindowTitle(curFile + "[*]");
    CONNECT(this, SIGNAL(textChanged()), this, SLOT(documentWasModified()));
}
Пример #15
0
void MdiChild::newFile()
{
    static int sequenceNumber = 1;
    QSettings* preferences = new QSettings(QSettings::IniFormat, QSettings::UserScope,
    "DGSOFTWARE", "Notatio Antiqua");
    preferences->beginGroup("Font");
    if (preferences->value("standardFont") != "")
            setFontFamily(preferences->value("standardFont").toString());
    preferences->endGroup();
    isUntitled = true;
    curFile = tr("Document%1.gabc").arg(sequenceNumber++);
    setWindowTitle(curFile + "[*]");
    highlighter = new Highlighter(document());
    connect(document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));
    highlighter = new Highlighter(document());   
}
Пример #16
0
MainWindow::MainWindow()
{
    textEdit = new QsciScintilla;
    setCentralWidget(textEdit);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit, SIGNAL(textChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
}
Пример #17
0
XmlWindow::XmlWindow(QWidget *parent) : QWidget(parent){

    QFont font;
    font.setFamily("Courier");
    font.setFixedPitch(true);
    font.setPointSize(11);
    font.setBold(true);

    setNulls();

    //Used to avoid loading simulation again when this caused the initial change
    during_update_of_schema = false;

    textEdit = new CodeEditor(this);
    textEdit->setFont(font);
    textEdit->setWordWrapMode( QTextOption::NoWrap );


    QLabel *aa = new QLabel(this);
    aa->setText("");
    aa->setMinimumHeight(37);
    aa->setMaximumHeight(37);
    toolBar = new QToolBar("File/edit", aa);//addToolBar(tr("File"));

    layout = new QVBoxLayout(this);
    layout->setContentsMargins(QMargins(0,0,0,0));
    layout->addWidget(aa);
    layout->addWidget(textEdit);
    this->setLayout(layout);

    highlighter = new XMLHighlighter(textEdit->document());

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
    //setUnifiedTitleAndToolBarOnMac(true);
}
Пример #18
0
MainWindow::MainWindow()
{
    textEdit = new QPlainTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
    setUnifiedTitleAndToolBarOnMac(true);
}
Пример #19
0
Editor::Editor(QWidget *parent )
        : QTextEdit(parent){

    numUntitleDocuments++;

    action = new QAction(this);
    action->setCheckable(true);
    
    isUntitle = true;
    curFile = tr("Untitle Document %1").arg(numUntitleDocuments);
    document()->setModified(false);
    
    connect(document(), SIGNAL(contentsChanged()), this, 
                        SLOT(documentWasModified()));

    setDocumentTitle(curFile);
    setAttribute(Qt::WA_DeleteOnClose);
}
Пример #20
0
//加载文件操作
bool MdiChild::loadFile(const QString &fileName)
{
    QFile file(fileName);//新建QFile对象
    if(!file.open(QFile::ReadOnly|QFile::Text))//只读方式打开文件,出错则提示,并返回false
    {
        QMessageBox::warning(this,tr("多文档编辑器"),tr("无法读取文件%1:\n%2.").arg(fileName).arg(file.errorString()));
        return false;
    }

    QTextStream in(&file);//新建文本流对象
    QApplication::setOverrideCursor(Qt::WaitCursor);//设置鼠标状态为等待状态
    setPlainText(in.readAll());//读取文件的全部文本内容,并添加到编辑器中
    QApplication::restoreOverrideCursor();//恢复鼠标状态
    setCurrentFile(fileName);//设置当前文件
    connect(document(),SIGNAL(contentsChanged()),this,SLOT(documentWasModified()));
    return true;

}
Пример #21
0
bool MyMdi::LoadFile(const QString &file_name)
{
    QFile file(file_name);//建立需打开的文件对象
    if(!file.open(QFile::ReadOnly | QFile::Text))
    {
        //打开失败时,输出错误信息
        QMessageBox::warning(this, "多文档编辑器", QStringLiteral("无法读取文件 %1:\n%2").arg(file_name).arg(file.errorString()));
        return false;
    }
    QTextStream in(&file);//文本流
    QApplication::setOverrideCursor(Qt::WaitCursor);//设置整个应用程序的光标形状为等待形状,因为如果文件的内容非常多时可以提醒用户
    setPlainText(in.readAll());//读取文本流中的所有内容,并显示在其窗体中
    QApplication::restoreOverrideCursor();//恢复开始时的光标状态
    SetCurrentFile(file_name);//设置标题什么的
    //注意这里发射信号用的是contentsChanged(),而不是contentsChange().
    connect(document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified()));

    return true;
}
Пример #22
0
bool TextRoom::saveFile(const QString &fileName)
{
	QFile file(fileName);
	if (!file.open(QFile::WriteOnly | QFile::Text))
	{
		QMessageBox::warning(this, qApp->applicationName(),
							 tr("Cannot write file %1:\n%2.")
							 .arg(fileName)
							 .arg(file.errorString()));
		return false;
	}
	QTextStream out(&file);
	out.setCodec("UTF-8");

// If filename extension is .txt then convert to plain text or Only Plain Text Option is selected.
	QApplication::setOverrideCursor(Qt::WaitCursor);
	if (fileName.endsWith("txt") || isPlainText )
	{
		out << textEdit->document()->toPlainText();
	}
	else if (fileName.endsWith("txr"))
	{
		QByteArray ba = "utf-8";
		
		out <<scratchDialog->ui.scratchTextEdit->document()->toHtml(ba) << "\n<split>\n" << textEdit->document()->toHtml(ba);
	}
        else if (fileName.endsWith("odt"))
        {
                QTextDocumentWriter writer(fileName, "odf");
                writer.write(textEdit->document());
        }
	else
	{
		QByteArray ba = "utf-8";
		out << textEdit->document()->toHtml(ba);
	}
	QApplication::restoreOverrideCursor();

	setCurrentFile(fileName);
	documentWasModified();	
	return true;
}
Пример #23
0
bool MdiChild::loadFile(const QString &fileName)
{
    QFile file(fileName);
    if (!file.open(QFile::ReadOnly | QFile::Text)) {
        QMessageBox::warning(this, tr("UVE"),
                             tr("Cannot read file %1:\n%2.")
                             .arg(fileName)
                             .arg(file.errorString()));
        return false;
    }

    QTextStream in(&file);
    QApplication::setOverrideCursor(Qt::WaitCursor);
    setText(in.readAll());
    QApplication::restoreOverrideCursor();
    setCurrentFile(fileName);
    CONNECT(this, SIGNAL(textChanged()), this, SLOT(documentWasModified()));

    return true;
}
Пример #24
0
void chanEditorWidget::init(){
	m_action = new QAction(this);

	m_action->setCheckable(true);

	connect(m_action, SIGNAL(triggered()), this, SLOT(show()));
	connect(m_action, SIGNAL(triggered()), this, SLOT(setFocus()));

	connect(this, SIGNAL(textChanged()), this, SLOT(documentWasModified()));


	QsciLexerCPP* lexer = new QsciLexerCPP(this);

	setLexer(lexer);

	//设置边框行号
	setMarginLineNumbers(1, true);

	//精确的括号匹配
	setBraceMatching(QsciScintilla::BraceMatch::StrictBraceMatch);

	//设置折叠
	setFolding(QsciScintilla::FoldStyle::CircledTreeFoldStyle);

	//设置自动填充有效
	setAutoCompletionFillupsEnabled(true);

	//所有可能的来源
	setAutoCompletionSource(QsciScintilla::AcsAll);

	//补字符号
	setCaretLineVisible(true);

	setAutoIndent(true);

	setUtf8(true);

	setWhitespaceVisibility(QsciScintilla::WsVisible);

	setAttribute(Qt::WA_DeleteOnClose);
}
Пример #25
0
TextEditor::TextEditor(const QString &fileName, QWidget *parent) : QMainWindow(parent)
{
    qDebug("TextEditor()");
    textEdit = new QTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified()));

    resize( 640,400 );
    if (!fileName.isEmpty())
        loadFile(fileName);
    else
        setCurrentFile("");
}
Пример #26
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: newFile(); break;
        case 1: open(); break;
        case 2: { bool _r = save();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 3: { bool _r = saveAs();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 4: about(); break;
        case 5: documentWasModified(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
//-----------------------------------------------------------------------------------------
bool GenericTextEditor::displayText(QString docName, QString text, QString extension, QString optionalData)
{
    // If there is no extra extension passed, then try to find the matching one based on the doc name
    ITextEditorCodecFactory* codecFactory;
    if(extension == "")    
        codecFactory = GenericTextEditor::findMatchingCodecFactory(docName);
    else
        codecFactory = GenericTextEditor::findMatchingCodecFactory(extension);

    if(codecFactory == 0)
        return false;

    GenericTextEditorDocument* document = 0;
    if(!isDocAlreadyShowing(docName, document) || isAllowDoubleDisplay())
    {
        document = new GenericTextEditorDocument(this);
        ITextEditorCodec* codec = codecFactory->create(document, docName);
        document->setCodec(codec);
        document->displayText(docName, text, optionalData);
        QMdiSubWindow *window = addSubWindow(document);
        window->setWindowIcon(QIcon(codec->getDocumentIcon()));
        document->showMaximized();
        QTabBar* tabBar = findChildren<QTabBar*>().at(0);
        tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, docName);    
    }
    else
    {
        document->getCodec()->setOptionalData(optionalData);
        document->getCodec()->onDisplayRequest();
        setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window()));
        document->setFocus(Qt::ActiveWindowFocusReason);
    }

    moveToForeground();

    connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified()));
    mActSave->setEnabled(false);

    return true;
}
Пример #28
0
CMainWindow::CMainWindow()
{
    textEdit = new QPlainTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();
    createToolBars();
    createStatusBar();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
    setUnifiedTitleAndToolBarOnMac(true);


    // add sample widows ...
    sampleData = new CGraphViewer();
    frecuencyData  = new CGraphViewer();


    nordGroupBox = new QGroupBox(tr("Vertical layout"));

    QVBoxLayout *verticalLayout = new QVBoxLayout;

    //horizontalLayout->addWidget(graph);
    //sampleData->setWindow(0,0,800,200);

    verticalLayout->addWidget(sampleData);
    verticalLayout->addWidget(frecuencyData);

    nordGroupBox->setLayout(verticalLayout);
    setCentralWidget(nordGroupBox);


}
//-----------------------------------------------------------------------------------------
bool GenericTextEditor::displayTextFromFile(QString filePath, QString optionalData)
{
    ITextEditorCodecFactory* codecFactory = GenericTextEditor::findMatchingCodecFactory(filePath);

    if(codecFactory == 0)
       return false;    
    
    GenericTextEditorDocument* document = 0;
    if(!isPathAlreadyShowing(filePath, document) || isAllowDoubleDisplay())
    {
        document = new GenericTextEditorDocument(this);
        ITextEditorCodec* codec = codecFactory->create(document, filePath);
        document->setCodec(codec);
        document->displayTextFromFile(QFile(filePath).fileName(), filePath, optionalData);
        QMdiSubWindow *window = addSubWindow(document);
        window->setWindowIcon(QIcon(codec->getDocumentIcon()));
        document->showMaximized();
        QTabBar* tabBar = findChildren<QTabBar*>().at(0);
        tabBar->setTabToolTip(findChildren<QMdiSubWindow*>().size() - 1, QFile(filePath).fileName());   
    }
    else
    {
        document->getCodec()->setOptionalData(optionalData);
        document->getCodec()->onDisplayRequest();
        setActiveSubWindow(qobject_cast<QMdiSubWindow*>(document->window()));
        document->setFocus(Qt::ActiveWindowFocusReason);
    }

    moveToForeground();   

    connect(document, SIGNAL(textChanged()), document, SLOT(documentWasModified()));
    
    mActSave->setEnabled(false);

    return true;
}
Пример #30
0
void npcedit::newFile(unsigned long npcID)
{
    npc_id = npcID;
    static int sequenceNumber = 1;
    ui->CurrentNPCID->setText( QString::number(npcID) );

    isUntitled = true;

    curFile = tr("npc-%1.txt").arg(npcID);

    setWindowTitle(curFile + QString(" [*] (%1)").arg(sequenceNumber++));

    setDefaultData(npcID);

    NpcData = DefaultNPCData; // create data template
    StartNPCData = DefaultNPCData;
    setDataBoxes();

    documentWasModified();

    loadPreview();
    /*connect(document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));*/
}