An entry (single formula) in the library. More...
#include <klflib.h>
Public Types | |
enum | PropertyId { Latex = 0, DateTime, Preview, PreviewSize, Category, Tags, Style } |
Public Member Functions | |
KLFLibEntry (const QString &latex=QString(), const QDateTime &dt=QDateTime(), const QImage &preview=QImage(), const QSize &previewsize=QSize(), const QString &category=QString(), const QString &tags=QString(), const KLFStyle &style=KLFStyle()) | |
KLFLibEntry (const QString &latex, const QDateTime &dt, const QImage &preview, const KLFStyle &style) | |
KLFLibEntry (const KLFLibEntry ©) | |
virtual | ~KLFLibEntry () |
QString | latex () const |
QDateTime | dateTime () const |
QImage | preview () const |
QSize | previewSize () const |
QString | category () const |
QString | tags () const |
KLFStyle | style () const |
QString | latexWithCategoryTagsComments () const |
void | setLatex (const QString &latex) |
void | setDateTime (const QDateTime &dt) |
void | setPreview (const QImage &img) |
void | setPreviewSize (const QSize &sz) |
void | setCategory (const QString &s) |
void | setTags (const QString &s) |
void | setStyle (const KLFStyle &style) |
int | setEntryProperty (const QString &propName, const QVariant &value) |
Static Public Member Functions | |
static QString | categoryFromLatex (const QString &latex) |
static QString | tagsFromLatex (const QString &latex) |
static QString | stripCategoryTagsFromLatex (const QString &latex) |
static QString | latexAddCategoryTagsComment (const QString &latex, const QString &category, const QString &tags) |
static QString | normalizeCategoryPath (const QString &categoryPath) |
An entry (single formula) in the library.
Stores Latex code, Date/Time of evaluation, A preview image, A Category String, A Tags String, and a Style in a KLFPropertizedObject-based object.
This object can be used as a normal value (ie. it has copy constructor, assignment operator and default constructor).
Latex |
The Latex Code of the equation. |
DateTime |
The Date/Time at which the equation was evaluated. |
Preview |
An Image Preview of equation (scaled down QImage) |
PreviewSize |
A cached value of the size of value in |
Category |
The Category to which eq. belongs (path-style string) |
Tags |
Tags about the equation (string) |
Style |
KLFStyle style used. |
KLFLibEntry::KLFLibEntry | ( | const QString & | latex = QString() , |
const QDateTime & | dt = QDateTime() , |
||
const QImage & | preview = QImage() , |
||
const QSize & | previewsize = QSize() , |
||
const QString & | category = QString() , |
||
const QString & | tags = QString() , |
||
const KLFStyle & | style = KLFStyle() |
||
) |
Definition at line 50 of file klflib.cpp.
References setCategory(), setDateTime(), setLatex(), setPreview(), setPreviewSize(), setStyle(), and setTags().
KLFLibEntry::KLFLibEntry | ( | const QString & | latex, |
const QDateTime & | dt, | ||
const QImage & | preview, | ||
const KLFStyle & | style | ||
) |
This constructor extracts the legacy-style category and tags from latex, and stores latex with those tags stripped.
Definition at line 64 of file klflib.cpp.
References category(), categoryFromLatex(), setCategory(), setDateTime(), setLatex(), setPreview(), setPreviewSize(), setStyle(), setTags(), QImage::size(), stripCategoryTagsFromLatex(), tags(), and tagsFromLatex().
KLFLibEntry::KLFLibEntry | ( | const KLFLibEntry & | copy | ) |
Definition at line 81 of file klflib.cpp.
References KLFPropertizedObject::allProperties(), and KLFPropertizedObject::setAllProperties().
KLFLibEntry::~KLFLibEntry | ( | ) | [virtual] |
Definition at line 87 of file klflib.cpp.
QString KLFLibEntry::category | ( | ) | const [inline] |
Definition at line 86 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::toString().
Referenced by KLFLibModel::data(), KLFLibEntryEditor::displayEntries(), KLFLibEntry(), operator<<(), KLFMainWin::slotEvaluate(), KLFLibLegacyFileDataPrivate::toLegacyLibItem(), KLFLibModelCache::treeInsertEntry(), and KLFLibModelCache::updateData().
Parses and returns legacy-style category comment string from latex string in the form
%: Category
Definition at line 122 of file klflib.cpp.
References QString::mid(), and QString::section().
Referenced by KLFLibEntry(), and operator>>().
QDateTime KLFLibEntry::dateTime | ( | ) | const [inline] |
Definition at line 83 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::toDateTime().
Referenced by KLFLibModel::data(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
QString KLFLibEntry::latex | ( | ) | const [inline] |
Definition at line 82 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::toString().
Referenced by KLFLibModel::data(), KLFLibEntryEditor::displayEntries(), latexAddCategoryTagsComment(), operator<<(), KLFLibDefaultView::selectedEntries(), KLFMainWin::slotEvaluate(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
QString KLFLibEntry::latexAddCategoryTagsComment | ( | const QString & | latex, |
const QString & | category, | ||
const QString & | tags | ||
) | [static] |
Creates a latex with category and tags comments
Definition at line 179 of file klflib.cpp.
References QString::isEmpty(), and latex().
Referenced by KLFLibLegacyEngine::changeEntries(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
QString KLFLibEntry::latexWithCategoryTagsComments | ( | ) | const [inline] |
Definition at line 90 of file klflib.h.
Referenced by KLFMainWin::restoreFromLibrary().
Renders a category-path "pretty" by removing any double-slashes to single slashes. Trailing slashes are removed. The root category is an empty string.
When a category is set to a lib-entry with setCategory()
, it is automatically normalized.
Returned paths may be compared string-wise for equality.
Definition at line 195 of file klflib.cpp.
References QString::chop(), QString::endsWith(), and QString::trimmed().
Referenced by KLFLibModelCache::fetchMore().
QImage KLFLibEntry::preview | ( | ) | const [inline] |
Definition at line 84 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::value().
Referenced by KLFLibModel::data(), KLFLibEntryEditor::displayEntries(), KLFLibModel::dragImage(), KLFMainWin::restoreFromLibrary(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
QSize KLFLibEntry::previewSize | ( | ) | const [inline] |
Definition at line 85 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::value().
Referenced by KLFLibModel::data(), and KLFLibEntrySorter::entryValue().
void KLFLibEntry::setCategory | ( | const QString & | s | ) | [inline] |
See also normalizeCategoryPath().
Definition at line 101 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
void KLFLibEntry::setDateTime | ( | const QDateTime & | dt | ) | [inline] |
Definition at line 94 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
Set the property named name
to value value
. If the property does not yet exist in the registered properties, it is registered.
Definition at line 92 of file klflib.cpp.
References KLFPropertizedObject::propertyIdForName(), propId, KLFPropertizedObject::registerProperty(), and KLFPropertizedObject::setProperty().
void KLFLibEntry::setLatex | ( | const QString & | latex | ) | [inline] |
Definition at line 93 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
void KLFLibEntry::setPreview | ( | const QImage & | img | ) | [inline] |
Definition at line 95 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
void KLFLibEntry::setPreviewSize | ( | const QSize & | sz | ) | [inline] |
Definition at line 96 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
void KLFLibEntry::setStyle | ( | const KLFStyle & | style | ) | [inline] |
Definition at line 103 of file klflib.h.
References QVariant::fromValue(), and KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
void KLFLibEntry::setTags | ( | const QString & | s | ) | [inline] |
Definition at line 102 of file klflib.h.
References KLFPropertizedObject::setProperty().
Referenced by KLFLibEntry().
Removes legacy-style category and tags comment from latex string
Definition at line 145 of file klflib.cpp.
References QString::length(), and QString::mid().
Referenced by KLFLibLegacyEngine::changeEntries(), KLFLibEntry(), KLFLibLegacyFileDataPrivate::toLegacyLibItem(), and KLFLibLegacyFileDataPrivate::toLibEntry().
KLFStyle KLFLibEntry::style | ( | ) | const [inline] |
Definition at line 88 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::value().
Referenced by KLFLibModel::data(), KLFLibEntryEditor::displayEntries(), KLFMainWin::restoreFromLibrary(), KLFMainWin::slotEvaluate(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
QString KLFLibEntry::tags | ( | ) | const [inline] |
Definition at line 87 of file klflib.h.
References KLFPropertizedObject::property(), and QVariant::toString().
Referenced by KLFLibModel::data(), KLFLibEntryEditor::displayEntries(), KLFLibEntry(), operator<<(), KLFLibDefaultView::selectedEntries(), KLFMainWin::slotEvaluate(), and KLFLibLegacyFileDataPrivate::toLegacyLibItem().
Parses and returns legacy-style tags comment string from latex string
Definition at line 131 of file klflib.cpp.
References QString::mid(), and QString::section().
Referenced by KLFLibEntry(), and operator>>().