Skip to content

Commit

Permalink
Added support for printing notes. At this moment only text and html n…
Browse files Browse the repository at this point in the history
…otes are supporter.
  • Loading branch information
VanDerSam committed Aug 6, 2014
1 parent 7ef1d32 commit 5915c01
Show file tree
Hide file tree
Showing 33 changed files with 1,908 additions and 1,024 deletions.
170 changes: 170 additions & 0 deletions doc/zNotes_class_diagram.uxf
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="12.2">
<zoom_level>10</zoom_level>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>510</x>
<y>30</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>QObject</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>510</x>
<y>100</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>Note
</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>530</x>
<y>30</y>
<w>50</w>
<h>90</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>30;30;30;70</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>260</x>
<y>200</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>TextNote</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>280</x>
<y>100</y>
<w>300</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>280;30;280;60;30;60;30;100</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>440</x>
<y>200</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>HtmlNote</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>460</x>
<y>100</y>
<w>120</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>100;30;100;60;30;60;30;100</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>600</x>
<y>200</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>PictureNote</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>530</x>
<y>100</y>
<w>140</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>30;30;30;60;120;60;120;100</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>760</x>
<y>200</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>TodoNote</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>530</x>
<y>100</y>
<w>300</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>30;30;30;60;280;60;280;100</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>910</x>
<y>100</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>NoteList</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>580</x>
<y>80</y>
<w>350</w>
<h>50</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;&lt;-</panel_attributes>
<additional_attributes>330;30;30;30</additional_attributes>
</element>
<element>
<type>com.umlet.element.Class</type>
<coordinates>
<x>910</x>
<y>200</y>
<w>100</w>
<h>30</h>
</coordinates>
<panel_attributes>MainWindow</panel_attributes>
<additional_attributes/>
</element>
<element>
<type>com.umlet.element.Relation</type>
<coordinates>
<x>930</x>
<y>100</y>
<w>50</w>
<h>120</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;&lt;-</panel_attributes>
<additional_attributes>30;100;30;30</additional_attributes>
</element>
</diagram>
9 changes: 6 additions & 3 deletions highlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ void Highlighter::highlightBlock(const QString &text)
{
foreach (const HighlightRule &rule, settings.getHighlightRules())
{
if(!rule.enabled) continue;
if(rule.regexp.isEmpty()) continue;
if(!rule.enabled)
continue;
if(rule.regexp.isEmpty())
continue;
QRegExp expression(rule.regexp);
if(!expression.isValid()) continue;
if(!expression.isValid())
continue;
QTextCharFormat format;
format.setForeground(rule.color);
int index = expression.indexIn(text);
Expand Down
12 changes: 11 additions & 1 deletion note_html.cpp → htmlnote.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "note_html.h"
#include "htmlnote.h"
#include "textedit.h"

#include <QTextStream>
#include <QClipboard>
#include <QApplication>
#include <QMessageBox>

HtmlNote::HtmlNote(const QFileInfo& fileinfo, Note::Type type_new)
: Note(fileinfo, type_new)
Expand Down Expand Up @@ -97,3 +98,12 @@ void HtmlNote::noteNotePastePlaintextChanged()
text_edit->setAcceptRichText(!settings.getNotePastePlaintext());
}

bool HtmlNote::isDocumentSupported() const
{
return true;
}

QTextDocument *HtmlNote::document() const
{
return text_edit->document();
}
8 changes: 5 additions & 3 deletions note_html.h → htmlnote.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef NOTE_HTML_H
#define NOTE_HTML_H
#ifndef HTMLNOTE_H
#define HTMLNOTE_H

#include "note.h"

Expand All @@ -18,6 +18,8 @@ class HtmlNote : public Note
QWidget* widget();
void setSelFormat(const QTextCharFormat& format);
QTextCharFormat getSelFormat() const;
bool isDocumentSupported() const;
QTextDocument* document() const;

private slots:
void currentCharFormatChanged(const QTextCharFormat&);
Expand All @@ -30,4 +32,4 @@ private slots:
void formatChanged(const QFont& font);
};

#endif // NOTE_HTML_H
#endif // HTMLNOTE_H
Loading

0 comments on commit 5915c01

Please sign in to comment.