ソースを参照

Change class prefix: Fb2 => Fb

Kandrashin Denis 13 年 前
コミット
9117cc7381

+ 5 - 5
source/fb2app.cpp

@@ -10,7 +10,7 @@
     #define PACKAGE_VERSION "0.XX.XX"
 #endif  // PACKAGE_VERSION
 
-void Fb2Application::handleMessage(QtMsgType type, const char *msg)
+void FbApplication::handleMessage(QtMsgType type, const char *msg)
 {
     /*
     switch (type) {
@@ -33,14 +33,14 @@ void Fb2Application::handleMessage(QtMsgType type, const char *msg)
 
 static void fb2MessageHandler(QtMsgType type, const char *msg)
 {
-    ((Fb2Application*)qApp)->handleMessage(type, msg);
+    ((FbApplication*)qApp)->handleMessage(type, msg);
 }
 
 int main(int argc, char *argv[])
 {
     Q_INIT_RESOURCE(fb2edit);
 
-    Fb2Application app(argc, argv);
+    FbApplication app(argc, argv);
     app.setApplicationName(QString(PACKAGE_NAME));
     app.setOrganizationName(QString(PACKAGE_VENDOR));
     app.setApplicationVersion(QString(PACKAGE_VERSION));
@@ -52,9 +52,9 @@ int main(int argc, char *argv[])
     int count = app.arguments().count();
     for (int i = 1; i < count; i++) {
         QString arg = app.arguments().at(i);
-        (new Fb2MainWindow(arg))->show();
+        (new FbMainWindow(arg))->show();
     }
-    if (count == 1) (new Fb2MainWindow)->show();
+    if (count == 1) (new FbMainWindow)->show();
 
     qInstallMsgHandler(fb2MessageHandler);
 

+ 2 - 2
source/fb2app.hpp

@@ -3,12 +3,12 @@
 
 #include <QtGui>
 
-class Fb2Application : public QApplication
+class FbApplication : public QApplication
 {
     Q_OBJECT
 
 public:
-    Fb2Application(int &argc, char **argv, int = QT_VERSION)
+    FbApplication(int &argc, char **argv, int = QT_VERSION)
         : QApplication(argc, argv, QT_VERSION) {}
 
     void handleMessage(QtMsgType type, const char *msg);

+ 28 - 28
source/fb2code.cpp

@@ -20,29 +20,29 @@ static const QString EXPR_COMMENT_END		= "[^-]*-([^-][^-]*-)*->";
 static const QString EXPR_ATTRIBUTE_VALUE	= "\"[^<\"]*\"|'[^<']*'";
 static const QString EXPR_NAME				= "([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*";
 
-Fb2Highlighter::Fb2Highlighter(QObject* parent)
+FbHighlighter::FbHighlighter(QObject* parent)
 : QSyntaxHighlighter(parent)
 {
     init();
 }
 
-Fb2Highlighter::Fb2Highlighter(QTextDocument* parent)
+FbHighlighter::FbHighlighter(QTextDocument* parent)
 : QSyntaxHighlighter(parent)
 {
     init();
 }
 
-Fb2Highlighter::Fb2Highlighter(QTextEdit* parent)
+FbHighlighter::FbHighlighter(QTextEdit* parent)
 : QSyntaxHighlighter(parent)
 {
     init();
 }
 
-Fb2Highlighter::~Fb2Highlighter()
+FbHighlighter::~FbHighlighter()
 {
 }
 
-void Fb2Highlighter::init()
+void FbHighlighter::init()
 {
     fmtSyntaxChar.setForeground(DEFAULT_SYNTAX_CHAR);
     fmtElementName.setForeground(DEFAULT_ELEMENT_NAME);
@@ -53,7 +53,7 @@ void Fb2Highlighter::init()
     fmtOther.setForeground(DEFAULT_OTHER);
 }
 
-void Fb2Highlighter::setHighlightColor(HighlightType type, QColor color, bool foreground)
+void FbHighlighter::setHighlightColor(HighlightType type, QColor color, bool foreground)
 {
     QTextCharFormat format;
     if (foreground)
@@ -63,7 +63,7 @@ void Fb2Highlighter::setHighlightColor(HighlightType type, QColor color, bool fo
     setHighlightFormat(type, format);
 }
 
-void Fb2Highlighter::setHighlightFormat(HighlightType type, QTextCharFormat format)
+void FbHighlighter::setHighlightFormat(HighlightType type, QTextCharFormat format)
 {
     switch (type)
     {
@@ -92,7 +92,7 @@ void Fb2Highlighter::setHighlightFormat(HighlightType type, QTextCharFormat form
     rehighlight();
 }
 
-void Fb2Highlighter::highlightBlock(const QString& text)
+void FbHighlighter::highlightBlock(const QString& text)
 {
     int i = 0;
     int pos = 0;
@@ -275,7 +275,7 @@ void Fb2Highlighter::highlightBlock(const QString& text)
     }
 }
 
-int Fb2Highlighter::processDefaultText(int i, const QString& text)
+int FbHighlighter::processDefaultText(int i, const QString& text)
 {
     // length of matched text
     int iLength = 0;
@@ -330,14 +330,14 @@ int Fb2Highlighter::processDefaultText(int i, const QString& text)
     return iLength;
 }
 
-qreal Fb2CodeEdit::baseFontSize = 10;
-qreal Fb2CodeEdit::zoomRatioMin = 0.2;
-qreal Fb2CodeEdit::zoomRatioMax = 5.0;
+qreal FbCodeEdit::baseFontSize = 10;
+qreal FbCodeEdit::zoomRatioMin = 0.2;
+qreal FbCodeEdit::zoomRatioMax = 5.0;
 
-Fb2CodeEdit::Fb2CodeEdit(QWidget *parent) : QPlainTextEdit(parent)
+FbCodeEdit::FbCodeEdit(QWidget *parent) : QPlainTextEdit(parent)
 {
     lineNumberArea = new LineNumberArea(this);
-    highlighter = new Fb2Highlighter(this);
+    highlighter = new FbHighlighter(this);
     highlighter->setDocument( document() );
 
     connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
@@ -356,7 +356,7 @@ Fb2CodeEdit::Fb2CodeEdit(QWidget *parent) : QPlainTextEdit(parent)
     highlightCurrentLine();
 }
 
-bool Fb2CodeEdit::read(QIODevice *device)
+bool FbCodeEdit::read(QIODevice *device)
 {
     QByteArray data = device->readAll();
     QXmlInputSource source;
@@ -365,7 +365,7 @@ bool Fb2CodeEdit::read(QIODevice *device)
     return true;
 }
 
-int Fb2CodeEdit::lineNumberAreaWidth()
+int FbCodeEdit::lineNumberAreaWidth()
 {
     int digits = 1;
     int max = qMax(1, blockCount());
@@ -379,12 +379,12 @@ int Fb2CodeEdit::lineNumberAreaWidth()
     return space;
 }
 
-void Fb2CodeEdit::updateLineNumberAreaWidth(int /* newBlockCount */)
+void FbCodeEdit::updateLineNumberAreaWidth(int /* newBlockCount */)
 {
     setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
 }
 
-void Fb2CodeEdit::updateLineNumberArea(const QRect &rect, int dy)
+void FbCodeEdit::updateLineNumberArea(const QRect &rect, int dy)
 {
     if (dy)
         lineNumberArea->scroll(0, dy);
@@ -395,7 +395,7 @@ void Fb2CodeEdit::updateLineNumberArea(const QRect &rect, int dy)
         updateLineNumberAreaWidth(0);
 }
 
-void Fb2CodeEdit::resizeEvent(QResizeEvent *e)
+void FbCodeEdit::resizeEvent(QResizeEvent *e)
 {
     QPlainTextEdit::resizeEvent(e);
 
@@ -403,7 +403,7 @@ void Fb2CodeEdit::resizeEvent(QResizeEvent *e)
     lineNumberArea->setGeometry(QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height()));
 }
 
-void Fb2CodeEdit::highlightCurrentLine()
+void FbCodeEdit::highlightCurrentLine()
 {
     QList<QTextEdit::ExtraSelection> extraSelections;
 
@@ -422,7 +422,7 @@ void Fb2CodeEdit::highlightCurrentLine()
     setExtraSelections(extraSelections);
 }
 
-void Fb2CodeEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
+void FbCodeEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
 {
     QPainter painter(lineNumberArea);
     painter.fillRect(event->rect(), Qt::lightGray);
@@ -447,37 +447,37 @@ void Fb2CodeEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
     }
 }
 
-bool Fb2CodeEdit::findText(const QString &exp, QTextDocument::FindFlags options)
+bool FbCodeEdit::findText(const QString &exp, QTextDocument::FindFlags options)
 {
     return QPlainTextEdit::find(exp, options);
 }
 
-void Fb2CodeEdit::find()
+void FbCodeEdit::find()
 {
-    Fb2CodeFindDlg dlg(*this);
+    FbCodeFindDlg dlg(*this);
     dlg.exec();
 }
 
-void Fb2CodeEdit::zoomIn()
+void FbCodeEdit::zoomIn()
 {
     qreal ratio = zoomRatio * 1.1;
     ratio = qMin(ratio, zoomRatioMax);
     setZoomRatio(ratio);
 }
 
-void Fb2CodeEdit::zoomOut()
+void FbCodeEdit::zoomOut()
 {
     qreal ratio = zoomRatio / 1.1;
     ratio = qMax(ratio, zoomRatioMin);
     setZoomRatio(ratio);
 }
 
-void Fb2CodeEdit::zoomReset()
+void FbCodeEdit::zoomReset()
 {
     setZoomRatio(1.0);
 }
 
-void Fb2CodeEdit::setZoomRatio(qreal ratio)
+void FbCodeEdit::setZoomRatio(qreal ratio)
 {
     if (!qFuzzyCompare(1 + zoomRatio, 1 + ratio)) {
         zoomRatio = ratio;

+ 11 - 11
source/fb2code.hpp

@@ -11,13 +11,13 @@
 #include <QColor>
 #include <QTextEdit>
 
-class Fb2Highlighter : public QSyntaxHighlighter
+class FbHighlighter : public QSyntaxHighlighter
 {
 public:
-    Fb2Highlighter(QObject* parent);
-    Fb2Highlighter(QTextDocument* parent);
-    Fb2Highlighter(QTextEdit* parent);
-    ~Fb2Highlighter();
+    FbHighlighter(QObject* parent);
+    FbHighlighter(QTextDocument* parent);
+    FbHighlighter(QTextEdit* parent);
+    ~FbHighlighter();
 
     enum HighlightType
     {
@@ -75,12 +75,12 @@ class QSize;
 class QWidget;
 QT_END_NAMESPACE
 
-class Fb2CodeEdit : public QPlainTextEdit
+class FbCodeEdit : public QPlainTextEdit
 {
     Q_OBJECT
 
 public:
-    Fb2CodeEdit(QWidget *parent = 0);
+    FbCodeEdit(QWidget *parent = 0);
 
     QString text() const { return toPlainText(); }
 
@@ -117,12 +117,12 @@ private:
     class LineNumberArea : public QWidget
     {
     public:
-        LineNumberArea(Fb2CodeEdit *parent) : QWidget(parent) { editor = parent; }
+        LineNumberArea(FbCodeEdit *parent) : QWidget(parent) { editor = parent; }
         QSize sizeHint() const { return QSize(editor->lineNumberAreaWidth(), 0); }
     protected:
         void paintEvent(QPaintEvent *event) { editor->lineNumberAreaPaintEvent(event); }
     private:
-        Fb2CodeEdit *editor;
+        FbCodeEdit *editor;
     };
 
 private:
@@ -131,13 +131,13 @@ private:
     void setZoomRatio(qreal ratio);
 
 private:
-    Fb2Highlighter * highlighter;
+    FbHighlighter * highlighter;
     QWidget *lineNumberArea;
     qreal zoomRatio;
     static qreal baseFontSize;
     static qreal zoomRatioMin;
     static qreal zoomRatioMax;
-    friend class Fb2CodeEdit::LineNumberArea;
+    friend class FbCodeEdit::LineNumberArea;
 };
 
 #endif // FB2CODE_H

+ 16 - 16
source/fb2dlgs.cpp

@@ -13,12 +13,12 @@
 #include <QWebPage>
 
 //---------------------------------------------------------------------------
-//  Fb2CodeFindDlg
+//  FbCodeFindDlg
 //---------------------------------------------------------------------------
 
-Fb2CodeFindDlg::Fb2CodeFindDlg(Fb2CodeEdit &edit)
+FbCodeFindDlg::FbCodeFindDlg(FbCodeEdit &edit)
     : QDialog(&edit)
-    , ui(new Ui::Fb2Find)
+    , ui(new Ui::FbFind)
     , m_edit(edit)
 {
     ui->setupUi(this);
@@ -26,12 +26,12 @@ Fb2CodeFindDlg::Fb2CodeFindDlg(Fb2CodeEdit &edit)
     connect(ui->btnFind, SIGNAL(clicked()), this, SLOT(find()));
 }
 
-Fb2CodeFindDlg::~Fb2CodeFindDlg()
+FbCodeFindDlg::~FbCodeFindDlg()
 {
     delete ui;
 }
 
-void Fb2CodeFindDlg::find()
+void FbCodeFindDlg::find()
 {
     QString text = ui->editText->text();
     if (text.isEmpty()) return;
@@ -44,25 +44,25 @@ void Fb2CodeFindDlg::find()
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TextFindDlg
+//  FbTextFindDlg
 //---------------------------------------------------------------------------
 
-Fb2TextFindDlg::Fb2TextFindDlg(Fb2TextEdit &edit)
+FbTextFindDlg::FbTextFindDlg(FbTextEdit &edit)
     : QDialog(&edit)
-    , ui(new Ui::Fb2Find)
+    , ui(new Ui::FbFind)
     , m_edit(edit)
 {
     ui->setupUi(this);
     connect(ui->btnFind, SIGNAL(clicked()), this, SLOT(find()));
 }
 
-Fb2TextFindDlg::~Fb2TextFindDlg()
+FbTextFindDlg::~FbTextFindDlg()
 {
     m_edit.findText(QString(), QWebPage::HighlightAllOccurrences);
     delete ui;
 }
 
-void Fb2TextFindDlg::find()
+void FbTextFindDlg::find()
 {
     QString text = ui->editText->text();
     if (text.isEmpty()) return;
@@ -75,10 +75,10 @@ void Fb2TextFindDlg::find()
 }
 
 //---------------------------------------------------------------------------
-//  Fb2NoteDlg
+//  FbNoteDlg
 //---------------------------------------------------------------------------
 
-Fb2NoteDlg::Fb2NoteDlg(Fb2TextEdit &view)
+FbNoteDlg::FbNoteDlg(FbTextEdit &view)
     : QDialog(&view)
 {
     setWindowTitle(tr("Insert footnote"));
@@ -114,7 +114,7 @@ Fb2NoteDlg::Fb2NoteDlg(Fb2TextEdit &view)
     frameLayout->setSpacing(0);
     frameLayout->setMargin(0);
 
-    m_text = new Fb2TextBase(frame);
+    m_text = new FbTextBase(frame);
     m_text->setObjectName(QString::fromUtf8("m_text"));
     m_text->setUrl(QUrl(QString::fromUtf8("about:blank")));
     frameLayout->addWidget(m_text);
@@ -132,7 +132,7 @@ Fb2NoteDlg::Fb2NoteDlg(Fb2TextEdit &view)
     m_key->setCurrentIndex(0);
     m_title->setFocus();
 
-    Fb2TextPage *page = new Fb2TextPage(this);
+    FbTextPage *page = new FbTextPage(this);
     connect(m_text, SIGNAL(loadFinished(bool)), SLOT(loadFinished()));
     page->setNetworkAccessManager(view.page()->networkAccessManager());
     page->setContentEditable(true);
@@ -142,8 +142,8 @@ Fb2NoteDlg::Fb2NoteDlg(Fb2TextEdit &view)
     m_text->addTools(m_toolbar);
 }
 
-void Fb2NoteDlg::loadFinished()
+void FbNoteDlg::loadFinished()
 {
-    Fb2TextElement body = m_text->page()->mainFrame()->documentElement().findFirst("body");
+    FbTextElement body = m_text->page()->mainFrame()->documentElement().findFirst("body");
     body.select();
 }

+ 17 - 17
source/fb2dlgs.hpp

@@ -3,9 +3,9 @@
 
 #include <QDialog>
 
-class Fb2CodeEdit;
-class Fb2TextBase;
-class Fb2TextEdit;
+class FbCodeEdit;
+class FbTextBase;
+class FbTextEdit;
 
 QT_BEGIN_NAMESPACE
 class QComboBox;
@@ -15,54 +15,54 @@ class QWebView;
 QT_END_NAMESPACE
 
 namespace Ui {
-class Fb2Find;
+class FbFind;
 }
 
-class Fb2CodeFindDlg : public QDialog
+class FbCodeFindDlg : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit Fb2CodeFindDlg(Fb2CodeEdit &edit);
-    virtual ~Fb2CodeFindDlg();
+    explicit FbCodeFindDlg(FbCodeEdit &edit);
+    virtual ~FbCodeFindDlg();
 
 private slots:
     void find();
 
 private:
-    Ui::Fb2Find * ui;
-    Fb2CodeEdit & m_edit;
+    Ui::FbFind * ui;
+    FbCodeEdit & m_edit;
 };
 
-class Fb2TextFindDlg : public QDialog
+class FbTextFindDlg : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TextFindDlg(Fb2TextEdit &edit);
-    virtual ~Fb2TextFindDlg();
+    explicit FbTextFindDlg(FbTextEdit &edit);
+    virtual ~FbTextFindDlg();
 
 private slots:
     void find();
 
 private:
-    Ui::Fb2Find * ui;
-    Fb2TextEdit & m_edit;
+    Ui::FbFind * ui;
+    FbTextEdit & m_edit;
 };
 
-class Fb2NoteDlg : public QDialog
+class FbNoteDlg : public QDialog
 {
     Q_OBJECT
     
 public:
-    explicit Fb2NoteDlg(Fb2TextEdit &view);
+    explicit FbNoteDlg(FbTextEdit &view);
 
 private slots:
     void loadFinished();
 
 private:
     QComboBox *m_key;
-    Fb2TextBase *m_text;
+    FbTextBase *m_text;
     QLineEdit *m_title;
     QToolBar *m_toolbar;
 };

+ 3 - 3
source/fb2find.ui

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ui version="4.0">
- <class>Fb2Find</class>
- <widget class="QDialog" name="Fb2Find">
+ <class>FbFind</class>
+ <widget class="QDialog" name="FbFind">
   <property name="geometry">
    <rect>
     <x>0</x>
@@ -162,7 +162,7 @@
   <connection>
    <sender>btnClose</sender>
    <signal>clicked()</signal>
-   <receiver>Fb2Find</receiver>
+   <receiver>FbFind</receiver>
    <slot>close()</slot>
    <hints>
     <hint type="sourcelabel">

+ 95 - 95
source/fb2head.cpp

@@ -16,35 +16,35 @@
 #include "fb2utils.h"
 
 //---------------------------------------------------------------------------
-//  Fb2Scheme::Fb2
+//  FbScheme::Fb
 //---------------------------------------------------------------------------
 
-Fb2Scheme::Fb2::Fb2()
+FbScheme::Fb::Fb()
 {
     QFile file(":/fb2/FictionBook2.1.xsd");
     if (file.open(QIODevice::ReadOnly)) setContent(&file);
 }
 
 //---------------------------------------------------------------------------
-//  Fb2Scheme
+//  FbScheme
 //---------------------------------------------------------------------------
 
-const QDomDocument & Fb2Scheme::fb2()
+const QDomDocument & FbScheme::fb2()
 {
-    static const Fb2 doc;
+    static const Fb doc;
     return doc;
 }
 
-FB2_BEGIN_KEYHASH(Fb2Scheme)
+FB2_BEGIN_KEYHASH(FbScheme)
     FB2_KEY( XsElement     , "xs:element"     );
     FB2_KEY( XsChoice      , "xs:choice"      );
     FB2_KEY( XsComplexType , "xs:complexType" );
     FB2_KEY( XsSequence    , "xs:sequence"    );
 FB2_END_KEYHASH
 
-void Fb2Scheme::items(QStringList &list) const
+void FbScheme::items(QStringList &list) const
 {
-    Fb2Scheme child = typeScheme().firstChildElement();
+    FbScheme child = typeScheme().firstChildElement();
     while (!child.isNull()) {
         switch (toKeyword(child.tagName())) {
             case XsElement: {
@@ -62,12 +62,12 @@ void Fb2Scheme::items(QStringList &list) const
     }
 }
 
-Fb2Scheme Fb2Scheme::typeScheme() const
+FbScheme FbScheme::typeScheme() const
 {
     QString typeName = type();
     if (typeName.isEmpty()) return *this;
 
-    Fb2Scheme child = fb2().firstChildElement("xs:schema").firstChildElement();
+    FbScheme child = fb2().firstChildElement("xs:schema").firstChildElement();
     while (!child.isNull()) {
         if (child.tagName() == "xs:complexType") {
             if (child.attribute("name") == typeName) return child.element(typeName);
@@ -75,10 +75,10 @@ Fb2Scheme Fb2Scheme::typeScheme() const
         child = child.nextSiblingElement();
     }
 
-    return Fb2Scheme();
+    return FbScheme();
 }
 
-QString Fb2Scheme::info() const
+QString FbScheme::info() const
 {
     QDomElement element = *this;
     if (element.isNull()) return QString();
@@ -92,26 +92,26 @@ QString Fb2Scheme::info() const
     return element.text();
 }
 
-QString Fb2Scheme::type() const
+QString FbScheme::type() const
 {
     if (isNull()) return QString();
     QString result = attribute("type");
     if (!result.isEmpty()) return result;
-    Fb2Scheme child = firstChildElement("xs:complexType");
+    FbScheme child = firstChildElement("xs:complexType");
     child = child.firstChildElement("xs:complexContent");
     child = child.firstChildElement("xs:extension");
     return child.attribute("base");
 }
 
-Fb2Scheme Fb2Scheme::element(const QString &name) const
+FbScheme FbScheme::element(const QString &name) const
 {
-    Fb2Scheme parent = *this;
+    FbScheme parent = *this;
     if (parent.isNull()) {
         parent = fb2().documentElement();
         parent = parent.element("FictionBook");
     }
 
-    Fb2Scheme child = parent.firstChildElement();
+    FbScheme child = parent.firstChildElement();
     while (!child.isNull()) {
         switch (toKeyword(child.tagName())) {
             case XsElement: {
@@ -120,7 +120,7 @@ Fb2Scheme Fb2Scheme::element(const QString &name) const
             case XsChoice:
             case XsComplexType:
             case XsSequence: {
-                    Fb2Scheme result = child.element(name);
+                    FbScheme result = child.element(name);
                     if (!result.isNull()) return result;
                 } break;
             default: ;
@@ -139,14 +139,14 @@ Fb2Scheme Fb2Scheme::element(const QString &name) const
         child = child.nextSiblingElement();
     }
 
-    return Fb2Scheme();
+    return FbScheme();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2HeadItem
+//  FbHeadItem
 //---------------------------------------------------------------------------
 
-Fb2HeadItem::HintHash::HintHash()
+FbHeadItem::HintHash::HintHash()
 {
     insert( "title-info"    , tr( "Book"        ));
     insert( "document-info" , tr( "File"        ));
@@ -167,14 +167,14 @@ Fb2HeadItem::HintHash::HintHash()
     insert( "history"       , tr( "History"     ));
 }
 
-FB2_BEGIN_KEYHASH(Fb2HeadItem)
+FB2_BEGIN_KEYHASH(FbHeadItem)
     FB2_KEY( Auth   , "author"    );
     FB2_KEY( Cover  , "coverpage" );
     FB2_KEY( Image  , "image"       );
     FB2_KEY( Seqn   , "sequence"  );
 FB2_END_KEYHASH
 
-Fb2HeadItem::Fb2HeadItem(QWebElement &element, Fb2HeadItem *parent)
+FbHeadItem::FbHeadItem(QWebElement &element, FbHeadItem *parent)
     : QObject(parent)
     , m_element(element)
     , m_parent(parent)
@@ -193,14 +193,14 @@ Fb2HeadItem::Fb2HeadItem(QWebElement &element, Fb2HeadItem *parent)
     addChildren(element);
 }
 
-Fb2HeadItem::~Fb2HeadItem()
+FbHeadItem::~FbHeadItem()
 {
-    foreach (Fb2HeadItem * item, m_list) {
+    foreach (FbHeadItem * item, m_list) {
         delete item;
     }
 }
 
-Fb2HeadItem * Fb2HeadItem::append(const QString name)
+FbHeadItem * FbHeadItem::append(const QString name)
 {
     m_element.appendInside("<div></div>");
     QWebElement element = m_element.lastChild();
@@ -208,20 +208,20 @@ Fb2HeadItem * Fb2HeadItem::append(const QString name)
     if (name == "annotation" || name == "history") {
         element.appendInside("<p><br></p>");
     }
-    Fb2HeadItem * child = new Fb2HeadItem(element, this);
+    FbHeadItem * child = new FbHeadItem(element, this);
     m_list << child;
     return child;
 }
 
-void Fb2HeadItem::addChildren(QWebElement &parent)
+void FbHeadItem::addChildren(QWebElement &parent)
 {
     QWebElement child = parent.firstChild();
     while (!child.isNull()) {
         QString tag = child.tagName().toLower();
         if (tag == "div") {
-            m_list << new Fb2HeadItem(child, this);
+            m_list << new FbHeadItem(child, this);
         } else if (tag == "img") {
-            m_list << new Fb2HeadItem(child, this);
+            m_list << new FbHeadItem(child, this);
         } else {
             addChildren(child);
         }
@@ -229,20 +229,20 @@ void Fb2HeadItem::addChildren(QWebElement &parent)
     }
 }
 
-Fb2HeadItem * Fb2HeadItem::item(const QModelIndex &index) const
+FbHeadItem * FbHeadItem::item(const QModelIndex &index) const
 {
     int row = index.row();
     if (row < 0 || row >= m_list.size()) return NULL;
     return m_list[row];
 }
 
-Fb2HeadItem * Fb2HeadItem::item(int row) const
+FbHeadItem * FbHeadItem::item(int row) const
 {
     if (row < 0 || row >= m_list.size()) return NULL;
     return m_list[row];
 }
 
-QString Fb2HeadItem::text(int col) const
+QString FbHeadItem::text(int col) const
 {
     switch (col) {
         case 0: return QString("<%1> %2").arg(m_name).arg(hint());
@@ -255,7 +255,7 @@ QString Fb2HeadItem::text(int col) const
     return QString();
 }
 
-QString Fb2HeadItem::hint() const
+QString FbHeadItem::hint() const
 {
     static HintHash hints;
     HintHash::const_iterator it = hints.find(m_name);
@@ -263,7 +263,7 @@ QString Fb2HeadItem::hint() const
     return it.value();
 }
 
-QString Fb2HeadItem::value() const
+QString FbHeadItem::value() const
 {
     switch (toKeyword(m_name)) {
         case Auth : {
@@ -274,7 +274,7 @@ QString Fb2HeadItem::value() const
         } break;
         case Cover : {
             QString text;
-            foreach (Fb2HeadItem * item, m_list) {
+            foreach (FbHeadItem * item, m_list) {
                 if (item->m_name == "image") {
                     if (!text.isEmpty()) text += ", ";
                     text += item->value();
@@ -297,21 +297,21 @@ QString Fb2HeadItem::value() const
     return m_element.toPlainText().simplified();
 }
 
-QString Fb2HeadItem::sub(const QString &key) const
+QString FbHeadItem::sub(const QString &key) const
 {
-    foreach (Fb2HeadItem * item, m_list) {
+    foreach (FbHeadItem * item, m_list) {
         if (item->m_name == key) return item->value();
     }
     return QString();
 }
 
-Fb2Scheme Fb2HeadItem::scheme() const
+FbScheme FbHeadItem::scheme() const
 {
-    Fb2Scheme parent = m_parent ? m_parent->scheme() : Fb2Scheme();
+    FbScheme parent = m_parent ? m_parent->scheme() : FbScheme();
     return parent.element(m_name);
 }
 
-void Fb2HeadItem::remove(int row)
+void FbHeadItem::remove(int row)
 {
     if (row < 0 || row >= count()) return;
     m_list[row]->m_element.removeFromDocument();
@@ -319,10 +319,10 @@ void Fb2HeadItem::remove(int row)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2HeadModel
+//  FbHeadModel
 //---------------------------------------------------------------------------
 
-Fb2HeadModel::Fb2HeadModel(QWebView &view, QObject *parent)
+FbHeadModel::FbHeadModel(QWebView &view, QObject *parent)
     : QAbstractItemModel(parent)
     , m_view(view)
     , m_root(NULL)
@@ -330,48 +330,48 @@ Fb2HeadModel::Fb2HeadModel(QWebView &view, QObject *parent)
     QWebElement doc = view.page()->mainFrame()->documentElement();
     QWebElement head = doc.findFirst("div.description");
     if (head.isNull()) return;
-    m_root = new Fb2HeadItem(head);
+    m_root = new FbHeadItem(head);
 }
 
-Fb2HeadModel::~Fb2HeadModel()
+FbHeadModel::~FbHeadModel()
 {
     if (m_root) delete m_root;
 }
 
-void Fb2HeadModel::expand(QTreeView *view)
+void FbHeadModel::expand(QTreeView *view)
 {
     QModelIndex parent = QModelIndex();
     int count = rowCount(parent);
     for (int i = 0; i < count; i++) {
         QModelIndex child = index(i, 0, parent);
-        Fb2HeadItem *node = item(child);
+        FbHeadItem *node = item(child);
         if (!node) continue;
         view->expand(child);
         int count = rowCount(child);
         for (int j = 0; j < count; j++) {
             QModelIndex ch = index(j, 0, child);
-            Fb2HeadItem *node = item(ch);
+            FbHeadItem *node = item(ch);
             if (node) view->expand(ch);
         }
     }
 }
 
-Fb2HeadItem * Fb2HeadModel::item(const QModelIndex &index) const
+FbHeadItem * FbHeadModel::item(const QModelIndex &index) const
 {
     if (index.isValid()) {
-        return static_cast<Fb2HeadItem*>(index.internalPointer());
+        return static_cast<FbHeadItem*>(index.internalPointer());
     } else {
         return 0;
     }
 }
 
-int Fb2HeadModel::columnCount(const QModelIndex &parent) const
+int FbHeadModel::columnCount(const QModelIndex &parent) const
 {
     Q_UNUSED(parent);
     return 6;
 }
 
-QModelIndex Fb2HeadModel::index(int row, int column, const QModelIndex &parent) const
+QModelIndex FbHeadModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (!m_root || row < 0 || column < 0) return QModelIndex();
 
@@ -379,8 +379,8 @@ QModelIndex Fb2HeadModel::index(int row, int column, const QModelIndex &parent)
         return createIndex(row, column, (void*)m_root);
     }
 
-    if (Fb2HeadItem *owner = item(parent)) {
-        if (Fb2HeadItem *child = owner->item(row)) {
+    if (FbHeadItem *owner = item(parent)) {
+        if (FbHeadItem *child = owner->item(row)) {
             return createIndex(row, column, (void*)child);
         }
     }
@@ -388,11 +388,11 @@ QModelIndex Fb2HeadModel::index(int row, int column, const QModelIndex &parent)
     return QModelIndex();
 }
 
-QModelIndex Fb2HeadModel::parent(const QModelIndex &child) const
+QModelIndex FbHeadModel::parent(const QModelIndex &child) const
 {
-    if (Fb2HeadItem * node = static_cast<Fb2HeadItem*>(child.internalPointer())) {
-        if (Fb2HeadItem * parent = node->parent()) {
-            if (Fb2HeadItem * owner = parent->parent()) {
+    if (FbHeadItem * node = static_cast<FbHeadItem*>(child.internalPointer())) {
+        if (FbHeadItem * parent = node->parent()) {
+            if (FbHeadItem * owner = parent->parent()) {
                 return createIndex(owner->index(parent), 0, (void*)parent);
             } else {
                 return createIndex(0, 0, (void*)parent);
@@ -402,22 +402,22 @@ QModelIndex Fb2HeadModel::parent(const QModelIndex &child) const
     return QModelIndex();
 }
 
-int Fb2HeadModel::rowCount(const QModelIndex &parent) const
+int FbHeadModel::rowCount(const QModelIndex &parent) const
 {
     if (parent.column() > 0) return 0;
     if (!parent.isValid()) return m_root ? 1 : 0;
-    Fb2HeadItem *owner = item(parent);
+    FbHeadItem *owner = item(parent);
     return owner ? owner->count() : 0;
 }
 
-QVariant Fb2HeadModel::data(const QModelIndex &index, int role) const
+QVariant FbHeadModel::data(const QModelIndex &index, int role) const
 {
     if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
-    Fb2HeadItem * i = item(index);
+    FbHeadItem * i = item(index);
     return i ? i->text(index.column()) : QVariant();
 }
 
-QVariant Fb2HeadModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant FbHeadModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
     if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
         switch (section) {
@@ -428,22 +428,22 @@ QVariant Fb2HeadModel::headerData(int section, Qt::Orientation orientation, int
     return QVariant();
 }
 
-void Fb2HeadItem::setText(const QString &text)
+void FbHeadItem::setText(const QString &text)
 {
     m_text = text;
 }
 
-bool Fb2HeadModel::setData(const QModelIndex &index, const QVariant &value, int role)
+bool FbHeadModel::setData(const QModelIndex &index, const QVariant &value, int role)
 {
     if (role != Qt::EditRole) return false;
-    Fb2HeadItem * i = item(index);
+    FbHeadItem * i = item(index);
     if (!i) return false;
     i->setText(value.toString());
     emit dataChanged(index, index);
     return true;
 }
 
-Qt::ItemFlags Fb2HeadModel::flags(const QModelIndex &index) const
+Qt::ItemFlags FbHeadModel::flags(const QModelIndex &index) const
 {
     if (!index.isValid()) return 0;
     Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
@@ -452,10 +452,10 @@ Qt::ItemFlags Fb2HeadModel::flags(const QModelIndex &index) const
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TreeView
+//  FbTreeView
 //---------------------------------------------------------------------------
 
-Fb2HeadView::Fb2HeadView(Fb2TextEdit &view, QWidget *parent)
+FbHeadView::FbHeadView(FbTextEdit &view, QWidget *parent)
     : QTreeView(parent)
     , m_view(view)
 {
@@ -463,17 +463,17 @@ Fb2HeadView::Fb2HeadView(Fb2TextEdit &view, QWidget *parent)
 
     setContextMenuPolicy(Qt::ActionsContextMenu);
 
-    actionInsert = act = new QAction(Fb2Icon("list-add"), tr("&Append"), this);
+    actionInsert = act = new QAction(FbIcon("list-add"), tr("&Append"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(Qt::Key_Insert);
     act->setPriority(QAction::LowPriority);
     connect(act, SIGNAL(triggered()), SLOT(appendNode()));
     addAction(act);
 
-    actionModify = act = new QAction(Fb2Icon("list-add"), tr("&Modify"), this);
+    actionModify = act = new QAction(FbIcon("list-add"), tr("&Modify"), this);
     act->setPriority(QAction::LowPriority);
 
-    actionDelete = act = new QAction(Fb2Icon("list-remove"), tr("&Delete"), this);
+    actionDelete = act = new QAction(FbIcon("list-remove"), tr("&Delete"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(Qt::Key_Delete);
     act->setPriority(QAction::LowPriority);
@@ -492,21 +492,21 @@ Fb2HeadView::Fb2HeadView(Fb2TextEdit &view, QWidget *parent)
     connect(actionModify, SIGNAL(triggered()), SLOT(editCurrent()));
 }
 
-void Fb2HeadView::initToolbar(QToolBar &toolbar)
+void FbHeadView::initToolbar(QToolBar &toolbar)
 {
     toolbar.addSeparator();
     toolbar.addAction(actionInsert);
     toolbar.addAction(actionDelete);
 }
 
-void Fb2HeadView::updateTree()
+void FbHeadView::updateTree()
 {
-    Fb2HeadModel * model = new Fb2HeadModel(m_view, this);
+    FbHeadModel * model = new FbHeadModel(m_view, this);
     setModel(model);
     model->expand(this);
 }
 
-void Fb2HeadView::editCurrent()
+void FbHeadView::editCurrent()
 {
     if (!model()) return;
     QModelIndex current = currentIndex();
@@ -517,19 +517,19 @@ void Fb2HeadView::editCurrent()
     edit(index);
 }
 
-void Fb2HeadView::activated(const QModelIndex &index)
+void FbHeadView::activated(const QModelIndex &index)
 {
     if (index.isValid() && index.column() == 1) edit(index);
     showStatus(index);
 }
 
-void Fb2HeadView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
+void FbHeadView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
 {
     QTreeView::currentChanged(current, previous);
     showStatus(current);
 }
 
-void Fb2HeadView::showStatus(const QModelIndex &current)
+void FbHeadView::showStatus(const QModelIndex &current)
 {
     if (!model()) return;
     if (!current.isValid()) return;
@@ -538,20 +538,20 @@ void Fb2HeadView::showStatus(const QModelIndex &current)
     emit status(model()->data(index).toString());
 }
 
-void Fb2HeadView::collapsed(const QModelIndex &index)
+void FbHeadView::collapsed(const QModelIndex &index)
 {
     if (model() && !model()->parent(index).isValid()) {
         expand(index);
     }
 }
 
-void Fb2HeadView::appendNode()
+void FbHeadView::appendNode()
 {
-    Fb2HeadModel * m = qobject_cast<Fb2HeadModel*>(model());
+    FbHeadModel * m = qobject_cast<FbHeadModel*>(model());
     if (!m) return;
 
     QModelIndex current = currentIndex();
-    Fb2HeadItem * item = m->item(current);
+    FbHeadItem * item = m->item(current);
     if (!item) return;
 
     QString name = item->name().toLower();
@@ -569,45 +569,45 @@ void Fb2HeadView::appendNode()
         item->scheme().items(list);
     }
 
-    Fb2NodeDlg dlg(this, item->scheme(), list);
+    FbNodeDlg dlg(this, item->scheme(), list);
     if (dlg.exec()) {
         current = m->append(current, dlg.value());
         if (current.isValid()) setCurrentIndex(current);
     }
 }
 
-void Fb2HeadView::removeNode()
+void FbHeadView::removeNode()
 {
-    Fb2HeadModel * m = qobject_cast<Fb2HeadModel*>(model());
+    FbHeadModel * m = qobject_cast<FbHeadModel*>(model());
     if (m) m->remove(currentIndex());
 }
 
-QModelIndex Fb2HeadModel::append(const QModelIndex &parent, const QString &name)
+QModelIndex FbHeadModel::append(const QModelIndex &parent, const QString &name)
 {
-    Fb2HeadItem * owner = item(parent);
+    FbHeadItem * owner = item(parent);
     if (!owner) return QModelIndex();
     int row = owner->count();
     beginInsertRows(parent, row, row);
-    Fb2HeadItem * item = owner->append(name);
+    FbHeadItem * item = owner->append(name);
     endInsertRows();
     return createIndex(row, 0, (void*)item);
 }
 
-void Fb2HeadModel::remove(const QModelIndex &index)
+void FbHeadModel::remove(const QModelIndex &index)
 {
     int r = index.row();
     QModelIndex p = parent(index);
     beginRemoveRows(p, r, r + 1);
-    Fb2HeadItem * i = item(p);
+    FbHeadItem * i = item(p);
     if (i) i->remove(r);
     endRemoveRows();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2NodeDlg
+//  FbNodeDlg
 //---------------------------------------------------------------------------
 
-Fb2NodeDlg::Fb2NodeDlg(QWidget *parent, Fb2Scheme scheme, QStringList &list)
+FbNodeDlg::FbNodeDlg(QWidget *parent, FbScheme scheme, QStringList &list)
     : QDialog(parent)
     , m_scheme(scheme)
 {
@@ -649,12 +649,12 @@ Fb2NodeDlg::Fb2NodeDlg(QWidget *parent, Fb2Scheme scheme, QStringList &list)
     }
 }
 
-void Fb2NodeDlg::comboChanged(const QString &text)
+void FbNodeDlg::comboChanged(const QString &text)
 {
     m_text->setText(m_scheme.element(text).info());
 }
 
-QString Fb2NodeDlg::value() const
+QString FbNodeDlg::value() const
 {
     return m_combo->currentText();
 }

+ 31 - 31
source/fb2head.hpp

@@ -19,9 +19,9 @@ QT_END_NAMESPACE
 
 #include "fb2xml.h"
 
-class Fb2TextEdit;
+class FbTextEdit;
 
-class Fb2Scheme : public QDomElement
+class FbScheme : public QDomElement
 {
     FB2_BEGIN_KEYLIST
         XsElement,
@@ -31,25 +31,25 @@ class Fb2Scheme : public QDomElement
     FB2_END_KEYLIST
 
 private:
-    class Fb2 : public QDomDocument { public: Fb2(); };
+    class Fb : public QDomDocument { public: Fb(); };
 
 public:
-    Fb2Scheme() {}
-    Fb2Scheme(const Fb2Scheme &x) : QDomElement(x) {}
-    Fb2Scheme(const QDomElement &x) : QDomElement(x) {}
-    Fb2Scheme& operator=(const Fb2Scheme &x) { QDomElement::operator=(x); return *this; }
+    FbScheme() {}
+    FbScheme(const FbScheme &x) : QDomElement(x) {}
+    FbScheme(const QDomElement &x) : QDomElement(x) {}
+    FbScheme& operator=(const FbScheme &x) { QDomElement::operator=(x); return *this; }
 
     static const QDomDocument & fb2();
-    Fb2Scheme element(const QString &name) const;
+    FbScheme element(const QString &name) const;
     void items(QStringList &list) const;
     QString info() const;
     QString type() const;
 
 private:
-    Fb2Scheme typeScheme() const;
+    FbScheme typeScheme() const;
 };
 
-class Fb2HeadItem: public QObject
+class FbHeadItem: public QObject
 {
     Q_OBJECT
 
@@ -61,19 +61,19 @@ class Fb2HeadItem: public QObject
     FB2_END_KEYLIST
 
 public:
-    explicit Fb2HeadItem(QWebElement &element, Fb2HeadItem *parent = 0);
+    explicit FbHeadItem(QWebElement &element, FbHeadItem *parent = 0);
 
-    virtual ~Fb2HeadItem();
+    virtual ~FbHeadItem();
 
-    Fb2HeadItem * append(const QString name);
+    FbHeadItem * append(const QString name);
 
     void remove(int row);
 
-    Fb2HeadItem * item(const QModelIndex &index) const;
+    FbHeadItem * item(const QModelIndex &index) const;
 
-    Fb2HeadItem * item(int row) const;
+    FbHeadItem * item(int row) const;
 
-    int index(Fb2HeadItem * child) const {
+    int index(FbHeadItem * child) const {
         return m_list.indexOf(child);
     }
 
@@ -81,7 +81,7 @@ public:
         return m_list.size();
     }
 
-    Fb2HeadItem * parent() const {
+    FbHeadItem * parent() const {
         return m_parent;
     }
 
@@ -99,7 +99,7 @@ public:
 
     QString sub(const QString &key) const;
 
-    Fb2Scheme scheme() const;
+    FbScheme scheme() const;
 
 private:
     class HintHash : public QHash<QString, QString>
@@ -114,23 +114,23 @@ private:
     QString hint() const;
 
 private:
-    QList<Fb2HeadItem*> m_list;
+    QList<FbHeadItem*> m_list;
     QWebElement m_element;
-    Fb2HeadItem * m_parent;
+    FbHeadItem * m_parent;
     QString m_name;
     QString m_text;
     QString m_id;
 };
 
-class Fb2HeadModel: public QAbstractItemModel
+class FbHeadModel: public QAbstractItemModel
 {
     Q_OBJECT
 
 public:
-    explicit Fb2HeadModel(QWebView &view, QObject *parent = 0);
-    virtual ~Fb2HeadModel();
+    explicit FbHeadModel(QWebView &view, QObject *parent = 0);
+    virtual ~FbHeadModel();
     void expand(QTreeView *view);
-    Fb2HeadItem * item(const QModelIndex &index) const;
+    FbHeadItem * item(const QModelIndex &index) const;
     QModelIndex append(const QModelIndex &parent, const QString &name);
     void remove(const QModelIndex &index);
 
@@ -146,15 +146,15 @@ public:
 
 private:
     QWebView & m_view;
-    Fb2HeadItem * m_root;
+    FbHeadItem * m_root;
 };
 
-class Fb2HeadView : public QTreeView
+class FbHeadView : public QTreeView
 {
     Q_OBJECT
 
 public:
-    explicit Fb2HeadView(Fb2TextEdit &view, QWidget *parent = 0);
+    explicit FbHeadView(FbTextEdit &view, QWidget *parent = 0);
     void initToolbar(QToolBar &toolbar);
 
 signals:
@@ -177,25 +177,25 @@ private:
     void showStatus(const QModelIndex &current);
 
 private:
-    Fb2TextEdit & m_view;
+    FbTextEdit & m_view;
     QAction * actionInsert;
     QAction * actionModify;
     QAction * actionDelete;
 };
 
-class Fb2NodeDlg : public QDialog
+class FbNodeDlg : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit Fb2NodeDlg(QWidget *parent, Fb2Scheme scheme, QStringList &list);
+    explicit FbNodeDlg(QWidget *parent, FbScheme scheme, QStringList &list);
     QString value() const;
 
 private slots:
     void comboChanged(const QString &text);
 
 private:
-    const Fb2Scheme m_scheme;
+    const FbScheme m_scheme;
     QComboBox * m_combo;
     QLabel * m_text;
 };

+ 24 - 24
source/fb2html.cpp

@@ -4,12 +4,12 @@
 #include "fb2text.hpp"
 
 //---------------------------------------------------------------------------
-//  Fb2TextElement
+//  FbTextElement
 //---------------------------------------------------------------------------
 
-void Fb2TextElement::getChildren(Fb2ElementList &list)
+void FbTextElement::getChildren(FbElementList &list)
 {
-    Fb2TextElement child = firstChild();
+    FbTextElement child = firstChild();
     while (!child.isNull()) {
         QString tag = child.tagName().toLower();
         if (tag == "div") {
@@ -23,43 +23,43 @@ void Fb2TextElement::getChildren(Fb2ElementList &list)
     }
 }
 
-QString Fb2TextElement::location()
+QString FbTextElement::location()
 {
     static const QString javascript = FB2::read(":/js/get_location.js").prepend("var element=this;");
     return evaluateJavaScript(javascript).toString();
 }
 
-void Fb2TextElement::select()
+void FbTextElement::select()
 {
     static const QString javascript = FB2::read(":/js/set_cursor.js");
     evaluateJavaScript(javascript);
 }
 
-bool Fb2TextElement::isBody() const
+bool FbTextElement::isBody() const
 {
     return tagName() == "DIV" && attribute("class").toLower() == "body";
 }
 
-bool Fb2TextElement::isSection() const
+bool FbTextElement::isSection() const
 {
     return tagName() == "DIV" && attribute("class").toLower() == "section";
 }
 
-bool Fb2TextElement::hasTitle() const
+bool FbTextElement::hasTitle() const
 {
-    return Fb2TextElement(firstChild()).isTitle();
+    return FbTextElement(firstChild()).isTitle();
 }
 
-bool Fb2TextElement::isTitle() const
+bool FbTextElement::isTitle() const
 {
     return tagName() == "DIV" && attribute("class").toLower() == "title";
 }
 
 //---------------------------------------------------------------------------
-//  Fb2InsertCmd
+//  FbInsertCmd
 //---------------------------------------------------------------------------
 
-Fb2InsertCmd::Fb2InsertCmd(const Fb2TextElement &element)
+FbInsertCmd::FbInsertCmd(const FbTextElement &element)
     : QUndoCommand()
     , m_element(element)
     , m_parent(element.previousSibling())
@@ -71,7 +71,7 @@ Fb2InsertCmd::Fb2InsertCmd(const Fb2TextElement &element)
     }
 }
 
-void Fb2InsertCmd::redo()
+void FbInsertCmd::redo()
 {
     if (m_inner) {
         m_parent.prependInside(m_element);
@@ -81,16 +81,16 @@ void Fb2InsertCmd::redo()
     m_element.select();
 }
 
-void Fb2InsertCmd::undo()
+void FbInsertCmd::undo()
 {
     m_element.takeFromDocument();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2DeleteCmd
+//  FbDeleteCmd
 //---------------------------------------------------------------------------
 
-Fb2DeleteCmd::Fb2DeleteCmd(const Fb2TextElement &element)
+FbDeleteCmd::FbDeleteCmd(const FbTextElement &element)
     : QUndoCommand()
     , m_element(element)
     , m_parent(element.previousSibling())
@@ -102,12 +102,12 @@ Fb2DeleteCmd::Fb2DeleteCmd(const Fb2TextElement &element)
     }
 }
 
-void Fb2DeleteCmd::redo()
+void FbDeleteCmd::redo()
 {
     m_element.takeFromDocument();
 }
 
-void Fb2DeleteCmd::undo()
+void FbDeleteCmd::undo()
 {
     if (m_inner) {
         m_parent.prependInside(m_element);
@@ -118,24 +118,24 @@ void Fb2DeleteCmd::undo()
 }
 
 //---------------------------------------------------------------------------
-//  Fb2MoveUpCmd
+//  FbMoveUpCmd
 //---------------------------------------------------------------------------
 
-Fb2MoveUpCmd::Fb2MoveUpCmd(const Fb2TextElement &element)
+FbMoveUpCmd::FbMoveUpCmd(const FbTextElement &element)
     : QUndoCommand()
     , m_element(element)
 {
 }
 
-void Fb2MoveUpCmd::redo()
+void FbMoveUpCmd::redo()
 {
-    Fb2TextElement subling = m_element.previousSibling();
+    FbTextElement subling = m_element.previousSibling();
     subling.prependOutside(m_element.takeFromDocument());
 }
 
-void Fb2MoveUpCmd::undo()
+void FbMoveUpCmd::undo()
 {
-    Fb2TextElement subling = m_element.nextSibling();
+    FbTextElement subling = m_element.nextSibling();
     subling.appendOutside(m_element.takeFromDocument());
 }
 

+ 26 - 26
source/fb2html.h

@@ -4,19 +4,19 @@
 #include <QUndoCommand>
 #include <QWebElement>
 
-class Fb2TextPage;
+class FbTextPage;
 
-class Fb2TextElement;
+class FbTextElement;
 
-typedef QList<Fb2TextElement> Fb2ElementList;
+typedef QList<FbTextElement> FbElementList;
 
-class Fb2TextElement : public QWebElement
+class FbTextElement : public QWebElement
 {
 public:
-    Fb2TextElement() {}
-    Fb2TextElement(const QWebElement &x) : QWebElement(x) {}
-    Fb2TextElement &operator=(const QWebElement &x) { QWebElement::operator=(x); return *this; }
-    void getChildren(Fb2ElementList &list);
+    FbTextElement() {}
+    FbTextElement(const QWebElement &x) : QWebElement(x) {}
+    FbTextElement &operator=(const QWebElement &x) { QWebElement::operator=(x); return *this; }
+    void getChildren(FbElementList &list);
     QString location();
     bool hasTitle() const;
     bool isBody() const;
@@ -24,50 +24,50 @@ public:
     bool isTitle() const;
 
 public:
-    Fb2TextElement findFirst(const QString &selectorQuery) const { return QWebElement::findFirst(selectorQuery); }
-    Fb2TextElement parent() const { return QWebElement::parent(); }
-    Fb2TextElement firstChild() const { return QWebElement::firstChild(); }
-    Fb2TextElement lastChild() const { return QWebElement::lastChild(); }
-    Fb2TextElement nextSibling() const { return QWebElement::nextSibling(); }
-    Fb2TextElement previousSibling() const { return QWebElement::previousSibling(); }
-    Fb2TextElement document() const { return QWebElement::document(); }
+    FbTextElement findFirst(const QString &selectorQuery) const { return QWebElement::findFirst(selectorQuery); }
+    FbTextElement parent() const { return QWebElement::parent(); }
+    FbTextElement firstChild() const { return QWebElement::firstChild(); }
+    FbTextElement lastChild() const { return QWebElement::lastChild(); }
+    FbTextElement nextSibling() const { return QWebElement::nextSibling(); }
+    FbTextElement previousSibling() const { return QWebElement::previousSibling(); }
+    FbTextElement document() const { return QWebElement::document(); }
 
 public:
     void select();
 };
 
-class Fb2InsertCmd : public QUndoCommand
+class FbInsertCmd : public QUndoCommand
 {
 public:
-    explicit Fb2InsertCmd(const Fb2TextElement &element);
+    explicit FbInsertCmd(const FbTextElement &element);
     virtual void undo();
     virtual void redo();
 private:
-    Fb2TextElement m_parent;
-    Fb2TextElement m_element;
+    FbTextElement m_parent;
+    FbTextElement m_element;
     bool m_inner;
 };
 
-class Fb2DeleteCmd : public QUndoCommand
+class FbDeleteCmd : public QUndoCommand
 {
 public:
-    explicit Fb2DeleteCmd(const Fb2TextElement &element);
+    explicit FbDeleteCmd(const FbTextElement &element);
     virtual void undo();
     virtual void redo();
 private:
-    Fb2TextElement m_element;
-    Fb2TextElement m_parent;
+    FbTextElement m_element;
+    FbTextElement m_parent;
     bool m_inner;
 };
 
-class Fb2MoveUpCmd : public QUndoCommand
+class FbMoveUpCmd : public QUndoCommand
 {
 public:
-    explicit Fb2MoveUpCmd(const Fb2TextElement &element);
+    explicit FbMoveUpCmd(const FbTextElement &element);
     virtual void undo();
     virtual void redo();
 private:
-    Fb2TextElement m_element;
+    FbTextElement m_element;
 };
 
 #endif // FB2HTML_H

+ 79 - 79
source/fb2main.cpp

@@ -12,7 +12,7 @@
 #include "fb2head.hpp"
 #include "fb2utils.h"
 
-Fb2MainWindow::Fb2MainWindow()
+FbMainWindow::FbMainWindow()
 {
     init();
     setCurrentFile();
@@ -20,7 +20,7 @@ Fb2MainWindow::Fb2MainWindow()
     textFrame->view.load(":blank.fb2");
 }
 
-Fb2MainWindow::Fb2MainWindow(const QString &filename, ViewMode mode)
+FbMainWindow::FbMainWindow(const QString &filename, ViewMode mode)
 {
     init();
     setCurrentFile(filename);
@@ -33,7 +33,7 @@ Fb2MainWindow::Fb2MainWindow(const QString &filename, ViewMode mode)
     }
 }
 
-void Fb2MainWindow::init()
+void FbMainWindow::init()
 {
     connect(qApp, SIGNAL(logMessage(QString)), SLOT(logMessage(QString)));
 
@@ -58,7 +58,7 @@ void Fb2MainWindow::init()
     setUnifiedTitleAndToolBarOnMac(true);
 }
 
-void Fb2MainWindow::logMessage(const QString &message)
+void FbMainWindow::logMessage(const QString &message)
 {
     if (!messageEdit) {
         messageEdit = new QTextEdit(this);
@@ -73,22 +73,22 @@ void Fb2MainWindow::logMessage(const QString &message)
     messageEdit->append(message);
 }
 
-void Fb2MainWindow::logShowed()
+void FbMainWindow::logShowed()
 {
     messageEdit->setMaximumHeight(QWIDGETSIZE_MAX);
 }
 
-void Fb2MainWindow::logDestroyed()
+void FbMainWindow::logDestroyed()
 {
     messageEdit = NULL;
 }
 
-void Fb2MainWindow::treeDestroyed()
+void FbMainWindow::treeDestroyed()
 {
     dockTree = NULL;
 }
 
-bool Fb2MainWindow::loadXML(const QString &filename)
+bool FbMainWindow::loadXML(const QString &filename)
 {
     if (!filename.isEmpty()) {
         QFile file(filename);
@@ -100,7 +100,7 @@ bool Fb2MainWindow::loadXML(const QString &filename)
     return false;
 }
 
-void Fb2MainWindow::closeEvent(QCloseEvent *event)
+void FbMainWindow::closeEvent(QCloseEvent *event)
 {
     if (maybeSave()) {
         writeSettings();
@@ -110,19 +110,19 @@ void Fb2MainWindow::closeEvent(QCloseEvent *event)
     }
 }
 
-void Fb2MainWindow::fileNew()
+void FbMainWindow::fileNew()
 {
-    Fb2MainWindow *other = new Fb2MainWindow;
+    FbMainWindow *other = new FbMainWindow;
     other->move(x() + 40, y() + 40);
     other->show();
 }
 
-void Fb2MainWindow::fileOpen()
+void FbMainWindow::fileOpen()
 {
     QString filename = QFileDialog::getOpenFileName(this, tr("Open file"), QString(), "Fiction book files (*.fb2)");
     if (filename.isEmpty()) return;
 
-    Fb2MainWindow * existing = findFb2MainWindow(filename);
+    FbMainWindow * existing = findFbMainWindow(filename);
     if (existing) {
         existing->show();
         existing->raise();
@@ -135,7 +135,7 @@ void Fb2MainWindow::fileOpen()
             setCurrentFile(filename);
             textFrame->view.load(filename);
         } else {
-            Fb2MainWindow * other = new Fb2MainWindow(filename, FB2);
+            FbMainWindow * other = new FbMainWindow(filename, FB2);
             other->move(x() + 40, y() + 40);
             other->show();
         }
@@ -144,14 +144,14 @@ void Fb2MainWindow::fileOpen()
             setCurrentFile(filename);
             loadXML(filename);
         } else {
-            Fb2MainWindow * other = new Fb2MainWindow(filename, XML);
+            FbMainWindow * other = new FbMainWindow(filename, XML);
             other->move(x() + 40, y() + 40);
             other->show();
         }
     }
 }
 
-bool Fb2MainWindow::fileSave()
+bool FbMainWindow::fileSave()
 {
     if (isUntitled) {
         return fileSaveAs();
@@ -160,9 +160,9 @@ bool Fb2MainWindow::fileSave()
     }
 }
 
-bool Fb2MainWindow::fileSaveAs()
+bool FbMainWindow::fileSaveAs()
 {
-    Fb2SaveDialog dlg(this, tr("Save As..."));
+    FbSaveDialog dlg(this, tr("Save As..."));
     dlg.selectFile(curFile);
     if (!dlg.exec()) return false;
     QString fileName = dlg.fileName();
@@ -170,13 +170,13 @@ bool Fb2MainWindow::fileSaveAs()
     return saveFile(fileName, dlg.codec());
 }
 
-void Fb2MainWindow::about()
+void FbMainWindow::about()
 {
     QMessageBox::about(this, tr("About fb2edit"),
         tr("The <b>fb2edit</b> is application for editing FB2-files."));
 }
 
-void Fb2MainWindow::documentWasModified()
+void FbMainWindow::documentWasModified()
 {
     bool modified = false;
     if (codeEdit) modified = codeEdit->isModified();
@@ -188,7 +188,7 @@ void Fb2MainWindow::documentWasModified()
     setWindowModified(modified);
 }
 
-void Fb2MainWindow::cleanChanged(bool clean)
+void FbMainWindow::cleanChanged(bool clean)
 {
     QFileInfo info = windowFilePath();
     QString title = info.fileName();
@@ -198,7 +198,7 @@ void Fb2MainWindow::cleanChanged(bool clean)
     setWindowModified(!clean);
 }
 
-void Fb2MainWindow::createActions()
+void FbMainWindow::createActions()
 {
     QAction * act;
     QMenu * menu;
@@ -209,7 +209,7 @@ void Fb2MainWindow::createActions()
     tool = addToolBar(tr("File"));
     tool->setMovable(false);
 
-    act = new QAction(Fb2Icon("document-new"), tr("&New"), this);
+    act = new QAction(FbIcon("document-new"), tr("&New"), this);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::New);
     act->setStatusTip(tr("Create a new file"));
@@ -217,21 +217,21 @@ void Fb2MainWindow::createActions()
     menu->addAction(act);
     tool->addAction(act);
 
-    act = new QAction(Fb2Icon("document-open"), tr("&Open..."), this);
+    act = new QAction(FbIcon("document-open"), tr("&Open..."), this);
     act->setShortcuts(QKeySequence::Open);
     act->setStatusTip(tr("Open an existing file"));
     connect(act, SIGNAL(triggered()), this, SLOT(fileOpen()));
     menu->addAction(act);
     tool->addAction(act);
 
-    act = new QAction(Fb2Icon("document-save"), tr("&Save"), this);
+    act = new QAction(FbIcon("document-save"), tr("&Save"), this);
     act->setShortcuts(QKeySequence::Save);
     act->setStatusTip(tr("Save the document to disk"));
     connect(act, SIGNAL(triggered()), this, SLOT(fileSave()));
     menu->addAction(act);
     tool->addAction(act);
 
-    act = new QAction(Fb2Icon("document-save-as"), tr("Save &As..."), this);
+    act = new QAction(FbIcon("document-save-as"), tr("Save &As..."), this);
     act->setShortcuts(QKeySequence::SaveAs);
     act->setStatusTip(tr("Save the document under a new name"));
     connect(act, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
@@ -239,13 +239,13 @@ void Fb2MainWindow::createActions()
 
     menu->addSeparator();
 
-    act = new QAction(Fb2Icon("window-close"), tr("&Close"), this);
+    act = new QAction(FbIcon("window-close"), tr("&Close"), this);
     act->setShortcuts(QKeySequence::Close);
     act->setStatusTip(tr("Close this window"));
     connect(act, SIGNAL(triggered()), this, SLOT(close()));
     menu->addAction(act);
 
-    act = new QAction(Fb2Icon("application-exit"), tr("E&xit"), this);
+    act = new QAction(FbIcon("application-exit"), tr("E&xit"), this);
     act->setShortcuts(QKeySequence::Quit);
     act->setStatusTip(tr("Exit the application"));
     connect(act, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
@@ -255,13 +255,13 @@ void Fb2MainWindow::createActions()
 
     connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
 
-    actionUndo = act = new QAction(Fb2Icon("edit-undo"), tr("&Undo"), this);
+    actionUndo = act = new QAction(FbIcon("edit-undo"), tr("&Undo"), this);
     act->setPriority(QAction::LowPriority);
     act->setShortcut(QKeySequence::Undo);
     act->setEnabled(false);
     menu->addAction(act);
 
-    actionRedo = act = new QAction(Fb2Icon("edit-redo"), tr("&Redo"), this);
+    actionRedo = act = new QAction(FbIcon("edit-redo"), tr("&Redo"), this);
     act->setPriority(QAction::LowPriority);
     act->setShortcut(QKeySequence::Redo);
     act->setEnabled(false);
@@ -269,7 +269,7 @@ void Fb2MainWindow::createActions()
 
     menu->addSeparator();
 
-    actionCut = act = new QAction(Fb2Icon("edit-cut"), tr("Cu&t"), this);
+    actionCut = act = new QAction(FbIcon("edit-cut"), tr("Cu&t"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Cut);
@@ -277,7 +277,7 @@ void Fb2MainWindow::createActions()
     act->setEnabled(false);
     menu->addAction(act);
 
-    actionCopy = act = new QAction(Fb2Icon("edit-copy"), tr("&Copy"), this);
+    actionCopy = act = new QAction(FbIcon("edit-copy"), tr("&Copy"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Copy);
@@ -285,7 +285,7 @@ void Fb2MainWindow::createActions()
     act->setEnabled(false);
     menu->addAction(act);
 
-    actionPaste = act = new QAction(Fb2Icon("edit-paste"), tr("&Paste"), this);
+    actionPaste = act = new QAction(FbIcon("edit-paste"), tr("&Paste"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Paste);
@@ -295,16 +295,16 @@ void Fb2MainWindow::createActions()
 
     menu->addSeparator();
 
-    actionFind = act = new QAction(Fb2Icon("edit-find"), tr("&Find..."), this);
+    actionFind = act = new QAction(FbIcon("edit-find"), tr("&Find..."), this);
     act->setShortcuts(QKeySequence::Find);
     menu->addAction(act);
 
-    actionReplace = act = new QAction(Fb2Icon("edit-find-replace"), tr("&Replace..."), this);
+    actionReplace = act = new QAction(FbIcon("edit-find-replace"), tr("&Replace..."), this);
     menu->addAction(act);
 
     menu->addSeparator();
 
-    act = new QAction(Fb2Icon("preferences-desktop"), tr("&Settings"), this);
+    act = new QAction(FbIcon("preferences-desktop"), tr("&Settings"), this);
     act->setShortcuts(QKeySequence::Preferences);
     act->setStatusTip(tr("Application settings"));
     connect(act, SIGNAL(triggered()), SLOT(openSettings()));
@@ -312,18 +312,18 @@ void Fb2MainWindow::createActions()
 
     menu = menuBar()->addMenu(tr("&Insert", "Main menu"));
 
-    actionImage = act = new QAction(Fb2Icon("insert-image"), tr("&Image"), this);
+    actionImage = act = new QAction(FbIcon("insert-image"), tr("&Image"), this);
     menu->addAction(act);
 
-    actionNote = act = new QAction(Fb2Icon("insert-text"), tr("&Footnote"), this);
+    actionNote = act = new QAction(FbIcon("insert-text"), tr("&Footnote"), this);
     menu->addAction(act);
 
-    actionLink = act = new QAction(Fb2Icon("insert-link"), tr("&Hiperlink"), this);
+    actionLink = act = new QAction(FbIcon("insert-link"), tr("&Hiperlink"), this);
     menu->addAction(act);
 
     menu->addSeparator();
 
-    actionSection = act = new QAction(Fb2Icon("insert-object"), tr("&Section"), this);
+    actionSection = act = new QAction(FbIcon("insert-object"), tr("&Section"), this);
     menu->addAction(act);
 
     actionTitle = act = new QAction(tr("&Title"), this);
@@ -352,25 +352,25 @@ void Fb2MainWindow::createActions()
 
     menuText = menu = menuBar()->addMenu(tr("Fo&rmat"));
 
-    actionTextBold = act = new QAction(Fb2Icon("format-text-bold"), tr("&Bold"), this);
+    actionTextBold = act = new QAction(FbIcon("format-text-bold"), tr("&Bold"), this);
     act->setShortcuts(QKeySequence::Bold);
     act->setCheckable(true);
     menu->addAction(act);
 
-    actionTextItalic = act = new QAction(Fb2Icon("format-text-italic"), tr("&Italic"), this);
+    actionTextItalic = act = new QAction(FbIcon("format-text-italic"), tr("&Italic"), this);
     act->setShortcuts(QKeySequence::Italic);
     act->setCheckable(true);
     menu->addAction(act);
 
-    actionTextStrike = act = new QAction(Fb2Icon("format-text-strikethrough"), tr("&Strikethrough"), this);
+    actionTextStrike = act = new QAction(FbIcon("format-text-strikethrough"), tr("&Strikethrough"), this);
     act->setCheckable(true);
     menu->addAction(act);
 
-    actionTextSup = act = new QAction(Fb2Icon("format-text-superscript"), tr("Su&perscript"), this);
+    actionTextSup = act = new QAction(FbIcon("format-text-superscript"), tr("Su&perscript"), this);
     act->setCheckable(true);
     menu->addAction(act);
 
-    actionTextSub = act = new QAction(Fb2Icon("format-text-subscript"), tr("Su&bscript"), this);
+    actionTextSub = act = new QAction(FbIcon("format-text-subscript"), tr("Su&bscript"), this);
     act->setCheckable(true);
     menu->addAction(act);
 
@@ -404,15 +404,15 @@ void Fb2MainWindow::createActions()
 
     menu->addSeparator();
 
-    actionZoomIn = act = new QAction(Fb2Icon("zoom-in"), tr("Zoom in"), this);
+    actionZoomIn = act = new QAction(FbIcon("zoom-in"), tr("Zoom in"), this);
     act->setShortcuts(QKeySequence::ZoomIn);
     menu->addAction(act);
 
-    actionZoomOut = act = new QAction(Fb2Icon("zoom-out"), tr("Zoom out"), this);
+    actionZoomOut = act = new QAction(FbIcon("zoom-out"), tr("Zoom out"), this);
     act->setShortcuts(QKeySequence::ZoomOut);
     menu->addAction(act);
 
-    actionZoomReset = act = new QAction(Fb2Icon("zoom-original"), tr("Zoom original"), this);
+    actionZoomReset = act = new QAction(FbIcon("zoom-original"), tr("Zoom original"), this);
     menu->addAction(act);
 
     menu->addSeparator();
@@ -427,7 +427,7 @@ void Fb2MainWindow::createActions()
     menuBar()->addSeparator();
     menu = menuBar()->addMenu(tr("&Help"));
 
-    act = new QAction(Fb2Icon("help-about"), tr("&About"), this);
+    act = new QAction(FbIcon("help-about"), tr("&About"), this);
     act->setStatusTip(tr("Show the application's About box"));
     connect(act, SIGNAL(triggered()), this, SLOT(about()));
     menu->addAction(act);
@@ -438,25 +438,25 @@ void Fb2MainWindow::createActions()
     menu->addAction(act);
 }
 
-void Fb2MainWindow::openSettings()
+void FbMainWindow::openSettings()
 {
     QMessageBox::about(this, tr("Settings"),
         tr("The <b>fb2edit</b> is application for editing FB2-files."));
 }
 
-void Fb2MainWindow::createTree()
+void FbMainWindow::createTree()
 {
     if (textFrame && centralWidget() == textFrame) {
         dockTree = new QDockWidget(tr("Contents"), this);
         dockTree->setAttribute(Qt::WA_DeleteOnClose);
         dockTree->setFeatures(QDockWidget::AllDockWidgetFeatures);
-        dockTree->setWidget(new Fb2TreeWidget(textFrame->view, this));
+        dockTree->setWidget(new FbTreeWidget(textFrame->view, this));
         connect(dockTree, SIGNAL(destroyed()), SLOT(treeDestroyed()));
         addDockWidget(Qt::LeftDockWidgetArea, dockTree);
     }
 }
 
-void Fb2MainWindow::selectionChanged()
+void FbMainWindow::selectionChanged()
 {
     actionCut->setEnabled(textFrame->view.CutEnabled());
     actionCopy->setEnabled(textFrame->view.CopyEnabled());
@@ -470,32 +470,32 @@ void Fb2MainWindow::selectionChanged()
     statusBar()->showMessage(textFrame->view.page()->status());
 }
 
-void Fb2MainWindow::canUndoChanged(bool canUndo)
+void FbMainWindow::canUndoChanged(bool canUndo)
 {
     actionUndo->setEnabled(canUndo);
 }
 
-void Fb2MainWindow::canRedoChanged(bool canRedo)
+void FbMainWindow::canRedoChanged(bool canRedo)
 {
     actionRedo->setEnabled(canRedo);
 }
 
-void Fb2MainWindow::undoChanged()
+void FbMainWindow::undoChanged()
 {
     actionUndo->setEnabled(textFrame->view.UndoEnabled());
 }
 
-void Fb2MainWindow::redoChanged()
+void FbMainWindow::redoChanged()
 {
     actionRedo->setEnabled(textFrame->view.RedoEnabled());
 }
 
-void Fb2MainWindow::createStatusBar()
+void FbMainWindow::createStatusBar()
 {
     statusBar()->showMessage(tr("Ready"));
 }
 
-void Fb2MainWindow::readSettings()
+void FbMainWindow::readSettings()
 {
     QSettings settings;
     QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
@@ -504,14 +504,14 @@ void Fb2MainWindow::readSettings()
     resize(size);
 }
 
-void Fb2MainWindow::writeSettings()
+void FbMainWindow::writeSettings()
 {
     QSettings settings;
     settings.setValue("pos", pos());
     settings.setValue("size", size());
 }
 
-bool Fb2MainWindow::maybeSave()
+bool FbMainWindow::maybeSave()
 {
     if (textFrame && textFrame->view.isModified()) {
         QMessageBox::StandardButton ret;
@@ -527,7 +527,7 @@ bool Fb2MainWindow::maybeSave()
     return true;
 }
 
-bool Fb2MainWindow::saveFile(const QString &fileName, const QString &codec)
+bool FbMainWindow::saveFile(const QString &fileName, const QString &codec)
 {
     QFile file(fileName);
     if (!file.open(QFile::WriteOnly | QFile::Text)) {
@@ -552,7 +552,7 @@ bool Fb2MainWindow::saveFile(const QString &fileName, const QString &codec)
 */
 }
 
-void Fb2MainWindow::setCurrentFile(const QString &filename)
+void FbMainWindow::setCurrentFile(const QString &filename)
 {
     static int sequenceNumber = 1;
 
@@ -573,31 +573,31 @@ void Fb2MainWindow::setCurrentFile(const QString &filename)
     setWindowTitle(title);
 }
 
-QString Fb2MainWindow::appTitle() const
+QString FbMainWindow::appTitle() const
 {
     return QString(" - ") += qApp->applicationName() += QString(" ") += qApp->applicationVersion();
 }
 
-Fb2MainWindow *Fb2MainWindow::findFb2MainWindow(const QString &fileName)
+FbMainWindow *FbMainWindow::findFbMainWindow(const QString &fileName)
 {
     QString canonicalFilePath = QFileInfo(fileName).canonicalFilePath();
 
     foreach (QWidget *widget, qApp->topLevelWidgets()) {
-        Fb2MainWindow *mainWin = qobject_cast<Fb2MainWindow *>(widget);
+        FbMainWindow *mainWin = qobject_cast<FbMainWindow *>(widget);
         if (mainWin && mainWin->curFile == canonicalFilePath)
             return mainWin;
     }
     return 0;
 }
 
-void Fb2MainWindow::checkScintillaUndo()
+void FbMainWindow::checkScintillaUndo()
 {
     if (!codeEdit) return;
     actionUndo->setEnabled(codeEdit->isUndoAvailable());
     actionRedo->setEnabled(codeEdit->isRedoAvailable());
 }
 
-void Fb2MainWindow::viewCode()
+void FbMainWindow::viewCode()
 {
     if (codeEdit && centralWidget() == codeEdit) return;
 
@@ -614,7 +614,7 @@ void Fb2MainWindow::viewCode()
     FB2DELETE(headTree);
 
     if (!codeEdit) {
-        codeEdit = new Fb2CodeEdit;
+        codeEdit = new FbCodeEdit;
     }
     if (load) codeEdit->load(xml, folds);
     setCentralWidget(codeEdit);
@@ -655,7 +655,7 @@ void Fb2MainWindow::viewCode()
     connect(actionZoomReset, SIGNAL(triggered()), codeEdit, SLOT(zoomReset()));
 }
 
-void Fb2MainWindow::viewText()
+void FbMainWindow::viewText()
 {
     if (textFrame && centralWidget() == textFrame) return;
     QString xml;
@@ -663,7 +663,7 @@ void Fb2MainWindow::viewText()
     FB2DELETE(codeEdit);
     FB2DELETE(headTree);
     if (!textFrame) {
-        textFrame = new Fb2TextFrame(this);
+        textFrame = new FbTextFrame(this);
     }
     setCentralWidget(textFrame);
     textFrame->view.setFocus();
@@ -689,13 +689,13 @@ void Fb2MainWindow::viewText()
     connect(actionTextSub, SIGNAL(triggered()), textFrame->view.pageAction(QWebPage::ToggleSubscript), SIGNAL(triggered()));
     connect(actionTextSup, SIGNAL(triggered()), textFrame->view.pageAction(QWebPage::ToggleSuperscript), SIGNAL(triggered()));
 
-    Fb2TextEdit * textEdit = &(textFrame->view);
+    FbTextEdit * textEdit = &(textFrame->view);
     connect(actionFind, SIGNAL(triggered()), textEdit, SLOT(find()));
     connect(actionImage, SIGNAL(triggered()), textEdit, SLOT(insertImage()));
     connect(actionNote, SIGNAL(triggered()), textEdit, SLOT(insertNote()));
     connect(actionLink, SIGNAL(triggered()), textEdit, SLOT(insertLink()));
 
-    Fb2TextPage * textPage = textEdit->page();
+    FbTextPage * textPage = textEdit->page();
     connect(actionTitle, SIGNAL(triggered()), textPage, SLOT(insertTitle()));
     connect(actionSubtitle, SIGNAL(triggered()), textPage, SLOT(insertSubtitle()));
     connect(actionSection, SIGNAL(triggered()), textPage, SLOT(insertSection()));
@@ -729,7 +729,7 @@ void Fb2MainWindow::viewText()
     tool->addAction(actionZoomReset);
 }
 
-void Fb2MainWindow::viewHead()
+void FbMainWindow::viewHead()
 {
     if (headTree && centralWidget() == headTree) return;
 
@@ -743,11 +743,11 @@ void Fb2MainWindow::viewHead()
     FB2DELETE(toolEdit);
 
     if (!textFrame) {
-        textFrame = new Fb2TextFrame(this);
+        textFrame = new FbTextFrame(this);
     }
 
     if (!headTree) {
-        headTree = new Fb2HeadView(textFrame->view, this);
+        headTree = new FbHeadView(textFrame->view, this);
         connect(headTree, SIGNAL(status(QString)), this, SLOT(status(QString)));
     }
 
@@ -783,19 +783,19 @@ void Fb2MainWindow::viewHead()
     toolEdit->setMovable(false);
 }
 
-void Fb2MainWindow::viewTree()
+void FbMainWindow::viewTree()
 {
     if (dockTree) dockTree->deleteLater(); else createTree();
 }
 
-void Fb2MainWindow::clipboardDataChanged()
+void FbMainWindow::clipboardDataChanged()
 {
     if (const QMimeData *md = QApplication::clipboard()->mimeData()) {
         actionPaste->setEnabled(md->hasText());
     }
 }
 
-void Fb2MainWindow::status(const QString &text)
+void FbMainWindow::status(const QString &text)
 {
     statusBar()->showMessage(text);
 }

+ 12 - 12
source/fb2main.hpp

@@ -14,20 +14,20 @@ class QTreeView;
 class QWebInspector;
 QT_END_NAMESPACE
 
-class Fb2CodeEdit;
-class Fb2TreeView;
-class Fb2HeadView;
-class Fb2TextFrame;
-class Fb2TextEdit;
+class FbCodeEdit;
+class FbTreeView;
+class FbHeadView;
+class FbTextFrame;
+class FbTextEdit;
 
-class Fb2MainWindow : public QMainWindow
+class FbMainWindow : public QMainWindow
 {
     Q_OBJECT
 
 public:
     enum ViewMode { FB2, XML };
-    explicit Fb2MainWindow();
-    explicit Fb2MainWindow(const QString &filename, ViewMode mode = FB2);
+    explicit FbMainWindow();
+    explicit FbMainWindow(const QString &filename, ViewMode mode = FB2);
 
 protected:
     void closeEvent(QCloseEvent *event);
@@ -77,15 +77,15 @@ private:
     bool maybeSave();
     bool saveFile(const QString &fileName, const QString &codec = QString());
     void setCurrentFile(const QString &fileName = QString());
-    Fb2MainWindow *findFb2MainWindow(const QString &fileName);
+    FbMainWindow *findFbMainWindow(const QString &fileName);
 
-    Fb2TextFrame *textFrame;
+    FbTextFrame *textFrame;
     QWebInspector *inspector;
-    Fb2HeadView *headTree;
+    FbHeadView *headTree;
     QTextEdit *noteEdit;
     QTextEdit *messageEdit;
     QDockWidget *dockTree;
-    Fb2CodeEdit *codeEdit;
+    FbCodeEdit *codeEdit;
     QString curFile;
     bool isUntitled;
 

+ 58 - 58
source/fb2read.cpp

@@ -5,10 +5,10 @@
 #include "fb2xml2.h"
 
 //---------------------------------------------------------------------------
-//  Fb2ReadThread
+//  FbReadThread
 //---------------------------------------------------------------------------
 
-Fb2ReadThread::Fb2ReadThread(QObject *parent, const QString &filename, const QString &xml)
+FbReadThread::FbReadThread(QObject *parent, const QString &filename, const QString &xml)
     : QThread(parent)
     , m_filename(filename)
     , m_xml(xml)
@@ -17,30 +17,30 @@ Fb2ReadThread::Fb2ReadThread(QObject *parent, const QString &filename, const QSt
     connect(this, SIGNAL(html(QString, QString)), parent, SLOT(html(QString, QString)));
 }
 
-Fb2ReadThread::~Fb2ReadThread()
+FbReadThread::~FbReadThread()
 {
     stop();
     wait();
 }
 
-void Fb2ReadThread::stop()
+void FbReadThread::stop()
 {
     QMutexLocker locker(&mutex);
     Q_UNUSED(locker);
     m_abort = true;
 }
 
-void Fb2ReadThread::run()
+void FbReadThread::run()
 {
     if (parse()) emit html(m_filename, m_html);
 }
 
 #ifdef FB2_USE_LIBXML2
 
-bool Fb2ReadThread::parse()
+bool FbReadThread::parse()
 {
     QXmlStreamWriter writer(&m_html);
-    Fb2ReadHandler handler(*this, writer);
+    FbReadHandler handler(*this, writer);
     XML2::XmlReader reader;
     reader.setContentHandler(&handler);
     reader.setLexicalHandler(&handler);
@@ -61,10 +61,10 @@ bool Fb2ReadThread::parse()
 
 #else
 
-bool Fb2ReadThread::parse()
+bool FbReadThread::parse()
 {
     QXmlStreamWriter writer(&m_html);
-    Fb2ReadHandler handler(*this, writer);
+    FbReadHandler handler(*this, writer);
     QXmlSimpleReader reader;
     reader.setContentHandler(&handler);
     reader.setLexicalHandler(&handler);
@@ -86,10 +86,10 @@ bool Fb2ReadThread::parse()
 #endif
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::BaseHandler
+//  FbReadHandler::BaseHandler
 //---------------------------------------------------------------------------
 
-void Fb2ReadHandler::BaseHandler::writeAttributes(const QXmlAttributes &atts)
+void FbReadHandler::BaseHandler::writeAttributes(const QXmlAttributes &atts)
 {
     int count = atts.count();
     for (int i = 0; i < count; i++) {
@@ -101,23 +101,23 @@ void Fb2ReadHandler::BaseHandler::writeAttributes(const QXmlAttributes &atts)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::RootHandler
+//  FbReadHandler::RootHandler
 //---------------------------------------------------------------------------
 
-FB2_BEGIN_KEYHASH(Fb2ReadHandler::RootHandler)
+FB2_BEGIN_KEYHASH(FbReadHandler::RootHandler)
     FB2_KEY( Style  , "stylesheet"  );
     FB2_KEY( Descr  , "description" );
     FB2_KEY( Body   , "body"        );
     FB2_KEY( Binary , "binary"      );
 FB2_END_KEYHASH
 
-Fb2ReadHandler::RootHandler::RootHandler(Fb2ReadHandler &owner, const QString &name)
+FbReadHandler::RootHandler::RootHandler(FbReadHandler &owner, const QString &name)
     : BaseHandler(owner, name)
 {
     writer().writeStartElement("body");
 }
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::RootHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::RootHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     switch (toKeyword(name)) {
         case Body   : return new TextHandler(m_owner, name, atts, "div", name);
@@ -128,17 +128,17 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::RootHandler::NewTag(const QString &
     }
 }
 
-void Fb2ReadHandler::RootHandler::EndTag(const QString &name)
+void FbReadHandler::RootHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     writer().writeEndElement();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::StyleHandler
+//  FbReadHandler::StyleHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::StyleHandler::StyleHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::StyleHandler::StyleHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
     : BaseHandler(owner, name)
     , m_empty(true)
 {
@@ -147,13 +147,13 @@ Fb2ReadHandler::StyleHandler::StyleHandler(Fb2ReadHandler &owner, const QString
     writeAttributes(atts);
 }
 
-void Fb2ReadHandler::StyleHandler::TxtTag(const QString &text)
+void FbReadHandler::StyleHandler::TxtTag(const QString &text)
 {
     writer().writeCharacters(text);
     m_empty = false;
 }
 
-void Fb2ReadHandler::StyleHandler::EndTag(const QString &name)
+void FbReadHandler::StyleHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     if (m_empty) writer().writeCharacters(" ");
@@ -161,14 +161,14 @@ void Fb2ReadHandler::StyleHandler::EndTag(const QString &name)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::HeadHandler
+//  FbReadHandler::HeadHandler
 //---------------------------------------------------------------------------
 
-FB2_BEGIN_KEYHASH(Fb2ReadHandler::HeadHandler)
+FB2_BEGIN_KEYHASH(FbReadHandler::HeadHandler)
     FB2_KEY( Image , "image" );
 FB2_END_KEYHASH
 
-Fb2ReadHandler::HeadHandler::HeadHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::HeadHandler::HeadHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
     : BaseHandler(owner, name)
     , m_empty(true)
 {
@@ -177,7 +177,7 @@ Fb2ReadHandler::HeadHandler::HeadHandler(Fb2ReadHandler &owner, const QString &n
     writeAttributes(atts);
 }
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::HeadHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::HeadHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     Q_UNUSED(atts);
     m_empty = false;
@@ -187,13 +187,13 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::HeadHandler::NewTag(const QString &
     }
 }
 
-void Fb2ReadHandler::HeadHandler::TxtTag(const QString &text)
+void FbReadHandler::HeadHandler::TxtTag(const QString &text)
 {
     m_empty = false;
     writer().writeCharacters(text);
 }
 
-void Fb2ReadHandler::HeadHandler::EndTag(const QString &name)
+void FbReadHandler::HeadHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     if (m_empty) writer().writeCharacters(" ");
@@ -201,17 +201,17 @@ void Fb2ReadHandler::HeadHandler::EndTag(const QString &name)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::DescrHandler
+//  FbReadHandler::DescrHandler
 //---------------------------------------------------------------------------
 
-FB2_BEGIN_KEYHASH(Fb2ReadHandler::DescrHandler)
+FB2_BEGIN_KEYHASH(FbReadHandler::DescrHandler)
     FB2_KEY( Title    , "title-info"    );
     FB2_KEY( Document , "document-info" );
     FB2_KEY( Publish  , "publish-info"  );
     FB2_KEY( Custom   , "custom-info"   );
 FB2_END_KEYHASH
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::DescrHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::DescrHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     Q_UNUSED(atts);
     switch (toKeyword(name)) {
@@ -227,10 +227,10 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::DescrHandler::NewTag(const QString
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::TitleHandler
+//  FbReadHandler::TitleHandler
 //---------------------------------------------------------------------------
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::TitleHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::TitleHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     if (name == "annotation" || name == "history") {
         return new TextHandler(m_owner, name, atts, "div", name);
@@ -239,10 +239,10 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::TitleHandler::NewTag(const QString
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::TextHandler
+//  FbReadHandler::TextHandler
 //---------------------------------------------------------------------------
 
-FB2_BEGIN_KEYHASH(Fb2ReadHandler::TextHandler)
+FB2_BEGIN_KEYHASH(FbReadHandler::TextHandler)
     FB2_KEY( Section , "annotation"    );
     FB2_KEY( Section , "author"        );
     FB2_KEY( Section , "cite"          );
@@ -271,7 +271,7 @@ FB2_BEGIN_KEYHASH(Fb2ReadHandler::TextHandler)
     FB2_KEY( Code    , "code"          );
 FB2_END_KEYHASH
 
-Fb2ReadHandler::TextHandler::TextHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style)
+FbReadHandler::TextHandler::TextHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style)
     : BaseHandler(owner, name)
     , m_parent(NULL)
     , m_tag(tag)
@@ -280,7 +280,7 @@ Fb2ReadHandler::TextHandler::TextHandler(Fb2ReadHandler &owner, const QString &n
     Init(atts);
 }
 
-Fb2ReadHandler::TextHandler::TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style)
+FbReadHandler::TextHandler::TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style)
     : BaseHandler(parent->m_owner, name)
     , m_parent(parent)
     , m_tag(tag)
@@ -292,7 +292,7 @@ Fb2ReadHandler::TextHandler::TextHandler(TextHandler *parent, const QString &nam
     }
 }
 
-void Fb2ReadHandler::TextHandler::Init(const QXmlAttributes &atts)
+void FbReadHandler::TextHandler::Init(const QXmlAttributes &atts)
 {
     if (m_tag.isEmpty()) return;
     writer().writeStartElement(m_tag);
@@ -303,7 +303,7 @@ void Fb2ReadHandler::TextHandler::Init(const QXmlAttributes &atts)
     writeAttributes(atts);
 }
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::TextHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::TextHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     QString tag, style;
     switch (toKeyword(name)) {
@@ -323,12 +323,12 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::TextHandler::NewTag(const QString &
     return new TextHandler(this, name, atts, tag, style);
 }
 
-void Fb2ReadHandler::TextHandler::TxtTag(const QString &text)
+void FbReadHandler::TextHandler::TxtTag(const QString &text)
 {
     writer().writeCharacters(text);
 }
 
-void Fb2ReadHandler::TextHandler::EndTag(const QString &name)
+void FbReadHandler::TextHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     if (m_tag.isEmpty()) return;
@@ -336,26 +336,26 @@ void Fb2ReadHandler::TextHandler::EndTag(const QString &name)
     writer().writeEndElement();
 }
 
-bool Fb2ReadHandler::TextHandler::isNotes() const
+bool FbReadHandler::TextHandler::isNotes() const
 {
     if (m_style == "notes") return true;
     return m_parent ? m_parent->isNotes() : false;
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::SpanHandler
+//  FbReadHandler::SpanHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::SpanHandler::SpanHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::SpanHandler::SpanHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, "span")
 {
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::AnchorHandler
+//  FbReadHandler::AnchorHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, "a")
 {
     QString href = Value(atts, "href");
@@ -363,10 +363,10 @@ Fb2ReadHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::ImageHandler
+//  FbReadHandler::ImageHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::ImageHandler::ImageHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::ImageHandler::ImageHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
     : TextHandler(owner, name, atts, "img")
 {
     QString href = Value(atts, "href");
@@ -374,21 +374,21 @@ Fb2ReadHandler::ImageHandler::ImageHandler(Fb2ReadHandler &owner, const QString
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler::BinaryHandler
+//  FbReadHandler::BinaryHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::BinaryHandler::BinaryHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+FbReadHandler::BinaryHandler::BinaryHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
     : BaseHandler(owner, name)
     , m_file(Value(atts, "id"))
 {
 }
 
-void Fb2ReadHandler::BinaryHandler::TxtTag(const QString &text)
+void FbReadHandler::BinaryHandler::TxtTag(const QString &text)
 {
     m_text += text;
 }
 
-void Fb2ReadHandler::BinaryHandler::EndTag(const QString &name)
+void FbReadHandler::BinaryHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     QByteArray in; in.append(m_text);
@@ -396,11 +396,11 @@ void Fb2ReadHandler::BinaryHandler::EndTag(const QString &name)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2ReadHandler
+//  FbReadHandler
 //---------------------------------------------------------------------------
 
-Fb2ReadHandler::Fb2ReadHandler(Fb2ReadThread &thread, QXmlStreamWriter &writer)
-    : Fb2XmlHandler()
+FbReadHandler::FbReadHandler(FbReadThread &thread, QXmlStreamWriter &writer)
+    : FbXmlHandler()
     , m_thread(thread)
     , m_writer(writer)
 {
@@ -417,12 +417,12 @@ Fb2ReadHandler::Fb2ReadHandler(Fb2ReadThread &thread, QXmlStreamWriter &writer)
     m_writer.writeEndElement();
 }
 
-Fb2ReadHandler::~Fb2ReadHandler()
+FbReadHandler::~FbReadHandler()
 {
     m_writer.writeEndElement();
 }
 
-Fb2XmlHandler::NodeHandler * Fb2ReadHandler::CreateRoot(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbReadHandler::CreateRoot(const QString &name, const QXmlAttributes &atts)
 {
     Q_UNUSED(atts);
     if (name == "fictionbook") return new RootHandler(*this, name);
@@ -430,20 +430,20 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::CreateRoot(const QString &name, con
     return 0;
 }
 
-bool Fb2ReadHandler::comment(const QString& ch)
+bool FbReadHandler::comment(const QString& ch)
 {
     m_writer.writeComment(ch);
     return true;
 }
 
-QString Fb2ReadHandler::getFile(const QString &name)
+QString FbReadHandler::getFile(const QString &name)
 {
     QString path;
     QMetaObject::invokeMethod(m_thread.parent(), "temp", Qt::DirectConnection, Q_RETURN_ARG(QString, path), Q_ARG(QString, name));
     return path;
 }
 
-void Fb2ReadHandler::addFile(const QString &name, const QByteArray &data)
+void FbReadHandler::addFile(const QString &name, const QByteArray &data)
 {
     QMetaObject::invokeMethod(m_thread.parent(), "data", Qt::QueuedConnection, Q_ARG(QString, name), Q_ARG(QByteArray, data));
 }

+ 18 - 18
source/fb2read.hpp

@@ -8,12 +8,12 @@
 #include <QThread>
 #include <QXmlDefaultHandler>
 
-class Fb2ReadThread : public QThread
+class FbReadThread : public QThread
 {
     Q_OBJECT
 public:
-    Fb2ReadThread(QObject *parent, const QString &filename, const QString &xml = QString());
-    ~Fb2ReadThread();
+    FbReadThread(QObject *parent, const QString &filename, const QString &xml = QString());
+    ~FbReadThread();
     QString * data() { return &m_html; }
 
 signals:
@@ -36,26 +36,26 @@ private:
     QMutex mutex;
 };
 
-class Fb2ReadHandler : public Fb2XmlHandler
+class FbReadHandler : public FbXmlHandler
 {
 public:
-    explicit Fb2ReadHandler(Fb2ReadThread &thread, QXmlStreamWriter &writer);
-    virtual ~Fb2ReadHandler();
+    explicit FbReadHandler(FbReadThread &thread, QXmlStreamWriter &writer);
+    virtual ~FbReadHandler();
     virtual bool comment(const QString& ch);
-    Fb2ReadThread & thread() { return m_thread; }
+    FbReadThread & thread() { return m_thread; }
     QXmlStreamWriter & writer() { return m_writer; }
 
 private:
     class BaseHandler : public NodeHandler
     {
     public:
-        explicit BaseHandler(Fb2ReadHandler &owner, const QString &name)
+        explicit BaseHandler(FbReadHandler &owner, const QString &name)
             : NodeHandler(name), m_owner(owner) {}
     protected:
         QXmlStreamWriter & writer() { return m_owner.writer(); }
         void writeAttributes(const QXmlAttributes &atts);
     protected:
-        Fb2ReadHandler &m_owner;
+        FbReadHandler &m_owner;
     };
 
     class RootHandler : public BaseHandler
@@ -67,7 +67,7 @@ private:
             Binary,
         FB2_END_KEYLIST
     public:
-        explicit RootHandler(Fb2ReadHandler &owner, const QString &name);
+        explicit RootHandler(FbReadHandler &owner, const QString &name);
     protected:
         virtual NodeHandler * NewTag(const QString & name, const QXmlAttributes &atts);
         virtual void EndTag(const QString &name);
@@ -76,7 +76,7 @@ private:
     class StyleHandler : public BaseHandler
     {
     public:
-        explicit StyleHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts);
+        explicit StyleHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts);
     protected:
         virtual void TxtTag(const QString &text);
         virtual void EndTag(const QString &name);
@@ -90,7 +90,7 @@ private:
             Image,
         FB2_END_KEYLIST
     public:
-        explicit HeadHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts);
+        explicit HeadHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts);
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
         virtual void TxtTag(const QString &text);
@@ -108,7 +108,7 @@ private:
             Custom,
         FB2_END_KEYLIST
     public:
-        explicit DescrHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+        explicit DescrHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
             : HeadHandler(owner, name, atts) {}
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
@@ -117,7 +117,7 @@ private:
     class TitleHandler : public HeadHandler
     {
     public:
-        explicit TitleHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts)
+        explicit TitleHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts)
             : HeadHandler(owner, name, atts) {}
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
@@ -140,7 +140,7 @@ private:
             Code,
        FB2_END_KEYLIST
     public:
-        explicit TextHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style = QString());
+        explicit TextHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style = QString());
         explicit TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag, const QString &style = QString());
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
@@ -170,13 +170,13 @@ private:
     class ImageHandler : public TextHandler
     {
     public:
-        explicit ImageHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts);
+        explicit ImageHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts);
     };
 
     class BinaryHandler : public BaseHandler
     {
     public:
-        explicit BinaryHandler(Fb2ReadHandler &owner, const QString &name, const QXmlAttributes &atts);
+        explicit BinaryHandler(FbReadHandler &owner, const QString &name, const QXmlAttributes &atts);
     protected:
         virtual void TxtTag(const QString &text);
         virtual void EndTag(const QString &name);
@@ -194,7 +194,7 @@ private:
 
 private:
     typedef QHash<QString, QString> StringHash;
-    Fb2ReadThread &m_thread;
+    FbReadThread &m_thread;
     QXmlStreamWriter &m_writer;
     StringHash m_hash;
 };

+ 59 - 59
source/fb2save.cpp

@@ -21,22 +21,22 @@
 #include <QtDebug>
 
 //---------------------------------------------------------------------------
-//  Fb2SaveDialog
+//  FbSaveDialog
 //---------------------------------------------------------------------------
 
-Fb2SaveDialog::Fb2SaveDialog(QWidget *parent, Qt::WindowFlags f)
+FbSaveDialog::FbSaveDialog(QWidget *parent, Qt::WindowFlags f)
     : QFileDialog(parent, f)
 {
     init();
 }
 
-Fb2SaveDialog::Fb2SaveDialog(QWidget *parent, const QString &caption, const QString &directory, const QString &filter)
+FbSaveDialog::FbSaveDialog(QWidget *parent, const QString &caption, const QString &directory, const QString &filter)
     : QFileDialog(parent, caption, directory, filter)
 {
     init();
 }
 
-void Fb2SaveDialog::init()
+void FbSaveDialog::init()
 {
     QMap<QString, QString> codecMap;
     foreach (int mib, QTextCodec::availableMibs()) {
@@ -81,7 +81,7 @@ void Fb2SaveDialog::init()
     layout()->addWidget(combo);
 }
 
-QString Fb2SaveDialog::fileName() const
+QString FbSaveDialog::fileName() const
 {
     foreach (QString filename, selectedFiles()) {
         return filename;
@@ -89,95 +89,95 @@ QString Fb2SaveDialog::fileName() const
     return QString();
 }
 
-QString Fb2SaveDialog::codec() const
+QString FbSaveDialog::codec() const
 {
     return combo->currentText();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2HtmlHandler
+//  FbHtmlHandler
 //---------------------------------------------------------------------------
 
-QString Fb2HtmlHandler::local(const QString &name)
+QString FbHtmlHandler::local(const QString &name)
 {
     return name.mid(name.lastIndexOf(":"));
 }
 
-void Fb2HtmlHandler::onAttr(const QString &name, const QString &value)
+void FbHtmlHandler::onAttr(const QString &name, const QString &value)
 {
     m_atts.append(name, "", local(name), value);
 }
 
-void Fb2HtmlHandler::onNew(const QString &name)
+void FbHtmlHandler::onNew(const QString &name)
 {
     startElement("", local(name), name, m_atts);
     m_atts.clear();
 }
 
-void Fb2HtmlHandler::onTxt(const QString &text)
+void FbHtmlHandler::onTxt(const QString &text)
 {
     characters(text);
 }
 
-void Fb2HtmlHandler::onCom(const QString &text)
+void FbHtmlHandler::onCom(const QString &text)
 {
     comment(text);
 }
 
-void Fb2HtmlHandler::onEnd(const QString &name)
+void FbHtmlHandler::onEnd(const QString &name)
 {
     endElement("", local(name), name);
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveWriter
+//  FbSaveWriter
 //---------------------------------------------------------------------------
 
-Fb2SaveWriter::Fb2SaveWriter(Fb2TextEdit &view, QByteArray *array)
+FbSaveWriter::FbSaveWriter(FbTextEdit &view, QByteArray *array)
     : QXmlStreamWriter(array)
     , m_view(view)
 {
 }
 
-Fb2SaveWriter::Fb2SaveWriter(Fb2TextEdit &view, QIODevice *device)
+FbSaveWriter::FbSaveWriter(FbTextEdit &view, QIODevice *device)
     : QXmlStreamWriter(device)
     , m_view(view)
 {
 }
 
-Fb2SaveWriter::Fb2SaveWriter(Fb2TextEdit &view, QString *string)
+FbSaveWriter::FbSaveWriter(FbTextEdit &view, QString *string)
     : QXmlStreamWriter(string)
     , m_view(view)
 {
 }
 
-void Fb2SaveWriter::writeComment(const QString &ch)
+void FbSaveWriter::writeComment(const QString &ch)
 {
     writeLineEnd();
     QXmlStreamWriter::writeComment(ch);
 
 }
 
-void Fb2SaveWriter::writeStartElement(const QString &name, int level)
+void FbSaveWriter::writeStartElement(const QString &name, int level)
 {
     if (level) writeLineEnd();
     for (int i = 1; i < level; i++) writeCharacters("  ");
     QXmlStreamWriter::writeStartElement(name);
 }
 
-void Fb2SaveWriter::writeEndElement(int level)
+void FbSaveWriter::writeEndElement(int level)
 {
     if (level) writeLineEnd();
     for (int i = 1; i < level; i++) writeCharacters("  ");
     QXmlStreamWriter::writeEndElement();
 }
 
-void Fb2SaveWriter::writeLineEnd()
+void FbSaveWriter::writeLineEnd()
 {
     writeCharacters("\n");
 }
 
-QByteArray Fb2SaveWriter::downloadFile(const QUrl &url)
+QByteArray FbSaveWriter::downloadFile(const QUrl &url)
 {
     QNetworkRequest request(url);
     QNetworkAccessManager * network = m_view.page()->networkAccessManager();
@@ -191,7 +191,7 @@ QByteArray Fb2SaveWriter::downloadFile(const QUrl &url)
     return reply->readAll();
 }
 
-QString Fb2SaveWriter::getFileName(const QString &path)
+QString FbSaveWriter::getFileName(const QString &path)
 {
     if (path.left(1) == "#") {
         QString name = path.mid(1);
@@ -210,13 +210,13 @@ QString Fb2SaveWriter::getFileName(const QString &path)
     }
 }
 
-void Fb2SaveWriter::writeFiles()
+void FbSaveWriter::writeFiles()
 {
     QStringListIterator it(m_names);
     while (it.hasNext()) {
         QString name = it.next();
         if (name.isEmpty()) continue;
-        Fb2TemporaryFile * file = m_view.files().get(name);
+        FbTemporaryFile * file = m_view.files().get(name);
         if (!file) continue;
         writeStartElement("binary", 2);
         writeAttribute("id", name);
@@ -237,7 +237,7 @@ void Fb2SaveWriter::writeFiles()
     }
 }
 
-void Fb2SaveWriter::writeContentType(const QString &name, QByteArray &data)
+void FbSaveWriter::writeContentType(const QString &name, QByteArray &data)
 {
     QBuffer buffer(&data);
     buffer.open(QIODevice::ReadOnly);
@@ -251,10 +251,10 @@ void Fb2SaveWriter::writeContentType(const QString &name, QByteArray &data)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::TextHandler
+//  FbSaveHandler::TextHandler
 //---------------------------------------------------------------------------
 
-FB2_BEGIN_KEYHASH(Fb2SaveHandler::TextHandler)
+FB2_BEGIN_KEYHASH(FbSaveHandler::TextHandler)
     FB2_KEY( Section , "div"    );
     FB2_KEY( Anchor  , "a"      );
     FB2_KEY( Image   , "img"  );
@@ -269,7 +269,7 @@ FB2_BEGIN_KEYHASH(Fb2SaveHandler::TextHandler)
     FB2_KEY( Code    , "tt"     );
 FB2_END_KEYHASH
 
-Fb2SaveHandler::TextHandler::TextHandler(Fb2SaveWriter &writer, const QString &name, const QXmlAttributes &atts, const QString &tag)
+FbSaveHandler::TextHandler::TextHandler(FbSaveWriter &writer, const QString &name, const QXmlAttributes &atts, const QString &tag)
     : NodeHandler(name)
     , m_writer(writer)
     , m_tag(tag)
@@ -279,7 +279,7 @@ Fb2SaveHandler::TextHandler::TextHandler(Fb2SaveWriter &writer, const QString &n
     Init(atts);
 }
 
-Fb2SaveHandler::TextHandler::TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag)
+FbSaveHandler::TextHandler::TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag)
     : NodeHandler(name)
     , m_writer(parent->m_writer)
     , m_tag(tag)
@@ -289,7 +289,7 @@ Fb2SaveHandler::TextHandler::TextHandler(TextHandler *parent, const QString &nam
     Init(atts);
 }
 
-void Fb2SaveHandler::TextHandler::Init(const QXmlAttributes &atts)
+void FbSaveHandler::TextHandler::Init(const QXmlAttributes &atts)
 {
     if (m_tag.isEmpty()) return;
     m_writer.writeStartElement(m_tag, m_level);
@@ -306,7 +306,7 @@ void Fb2SaveHandler::TextHandler::Init(const QXmlAttributes &atts)
     }
 }
 
-Fb2XmlHandler::NodeHandler * Fb2SaveHandler::TextHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbSaveHandler::TextHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     m_hasChild = true;
     QString tag = QString();
@@ -327,69 +327,69 @@ Fb2XmlHandler::NodeHandler * Fb2SaveHandler::TextHandler::NewTag(const QString &
     return new TextHandler(this, name, atts, tag);
 }
 
-void Fb2SaveHandler::TextHandler::TxtTag(const QString &text)
+void FbSaveHandler::TextHandler::TxtTag(const QString &text)
 {
     m_writer.writeCharacters(text);
 }
 
-void Fb2SaveHandler::TextHandler::EndTag(const QString &name)
+void FbSaveHandler::TextHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     if (m_tag.isEmpty()) return;
     m_writer.writeEndElement(m_hasChild ? m_level : 0);
 }
 
-int Fb2SaveHandler::TextHandler::nextLevel() const
+int FbSaveHandler::TextHandler::nextLevel() const
 {
     return m_level ? m_level + 1 : 0;
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::RootHandler
+//  FbSaveHandler::RootHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::RootHandler::RootHandler(Fb2SaveWriter &writer, const QString &name)
+FbSaveHandler::RootHandler::RootHandler(FbSaveWriter &writer, const QString &name)
     : NodeHandler(name)
     , m_writer(writer)
 {
 }
 
-Fb2XmlHandler::NodeHandler * Fb2SaveHandler::RootHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbSaveHandler::RootHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     return name == "body" ? new BodyHandler(m_writer, name, atts) : NULL;
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::BodyHandler
+//  FbSaveHandler::BodyHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::BodyHandler::BodyHandler(Fb2SaveWriter &writer, const QString &name, const QXmlAttributes &atts)
+FbSaveHandler::BodyHandler::BodyHandler(FbSaveWriter &writer, const QString &name, const QXmlAttributes &atts)
     : TextHandler(writer, name, atts, "FictionBook")
 {
     m_writer.writeAttribute("xmlns", "http://www.gribuser.ru/xml/fictionbook/2.0");
     m_writer.writeAttribute("xmlns:l", "http://www.w3.org/1999/xlink");
 }
 
-void Fb2SaveHandler::BodyHandler::EndTag(const QString &name)
+void FbSaveHandler::BodyHandler::EndTag(const QString &name)
 {
     m_writer.writeFiles();
     TextHandler::EndTag(name);
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::SpanHandler
+//  FbSaveHandler::SpanHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::SpanHandler::SpanHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbSaveHandler::SpanHandler::SpanHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, Value(atts, "class") == "Apple-style-span" ? "" : "style")
 {
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::AnchorHandler
+//  FbSaveHandler::AnchorHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbSaveHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, "a")
 {
     QString href = Value(atts, "href");
@@ -397,10 +397,10 @@ Fb2SaveHandler::AnchorHandler::AnchorHandler(TextHandler *parent, const QString
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::ImageHandler
+//  FbSaveHandler::ImageHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::ImageHandler::ImageHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbSaveHandler::ImageHandler::ImageHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, "image")
 {
     QString src = Value(atts, "src");
@@ -411,23 +411,23 @@ Fb2SaveHandler::ImageHandler::ImageHandler(TextHandler *parent, const QString &n
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler::ParagHandler
+//  FbSaveHandler::ParagHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::ParagHandler::ParagHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
+FbSaveHandler::ParagHandler::ParagHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts)
     : TextHandler(parent, name, atts, "")
     , m_parent(parent->tag())
     , m_empty(true)
 {
 }
 
-Fb2XmlHandler::NodeHandler * Fb2SaveHandler::ParagHandler::NewTag(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbSaveHandler::ParagHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     if (m_empty && name != "br") start();
     return TextHandler::NewTag(name, atts);
 }
 
-void Fb2SaveHandler::ParagHandler::TxtTag(const QString &text)
+void FbSaveHandler::ParagHandler::TxtTag(const QString &text)
 {
     if (m_empty) {
         if (isWhiteSpace(text)) return;
@@ -436,14 +436,14 @@ void Fb2SaveHandler::ParagHandler::TxtTag(const QString &text)
     TextHandler::TxtTag(text);
 }
 
-void Fb2SaveHandler::ParagHandler::EndTag(const QString &name)
+void FbSaveHandler::ParagHandler::EndTag(const QString &name)
 {
     Q_UNUSED(name);
     if (m_empty) m_writer.writeStartElement("empty-line", m_level);
     m_writer.writeEndElement(0);
 }
 
-void Fb2SaveHandler::ParagHandler::start()
+void FbSaveHandler::ParagHandler::start()
 {
     if (!m_empty) return;
     QString tag = m_parent == "stanza" ? "v" : "p";
@@ -452,22 +452,22 @@ void Fb2SaveHandler::ParagHandler::start()
 }
 
 //---------------------------------------------------------------------------
-//  Fb2SaveHandler
+//  FbSaveHandler
 //---------------------------------------------------------------------------
 
-Fb2SaveHandler::Fb2SaveHandler(Fb2SaveWriter &writer)
-    : Fb2HtmlHandler()
+FbSaveHandler::FbSaveHandler(FbSaveWriter &writer)
+    : FbHtmlHandler()
     , m_writer(writer)
 {
 }
 
-bool Fb2SaveHandler::comment(const QString& ch)
+bool FbSaveHandler::comment(const QString& ch)
 {
     m_writer.writeComment(ch);
     return true;
 }
 
-Fb2XmlHandler::NodeHandler * Fb2SaveHandler::CreateRoot(const QString &name, const QXmlAttributes &atts)
+FbXmlHandler::NodeHandler * FbSaveHandler::CreateRoot(const QString &name, const QXmlAttributes &atts)
 {
     Q_UNUSED(atts);
     if (name == "html") return new RootHandler(m_writer, name);
@@ -475,7 +475,7 @@ Fb2XmlHandler::NodeHandler * Fb2SaveHandler::CreateRoot(const QString &name, con
     return 0;
 }
 
-bool Fb2SaveHandler::save()
+bool FbSaveHandler::save()
 {
     m_writer.writeStartDocument();
     QWebFrame * frame = m_writer.view().page()->mainFrame();

+ 20 - 20
source/fb2save.hpp

@@ -16,16 +16,16 @@ QT_END_NAMESPACE
 
 #include "fb2temp.hpp"
 
-class Fb2TextEdit;
+class FbTextEdit;
 
-class Fb2SaveDialog : public QFileDialog
+class FbSaveDialog : public QFileDialog
 {
     Q_OBJECT
 
 public:
-    explicit Fb2SaveDialog(QWidget *parent, Qt::WindowFlags f);
+    explicit FbSaveDialog(QWidget *parent, Qt::WindowFlags f);
 
-    explicit Fb2SaveDialog(QWidget *parent = 0,
+    explicit FbSaveDialog(QWidget *parent = 0,
                          const QString &caption = QString(),
                          const QString &directory = QString(),
                          const QString &filter = QString());
@@ -42,12 +42,12 @@ private:
     QLabel * label;
 };
 
-class Fb2HtmlHandler : public QObject, public Fb2XmlHandler
+class FbHtmlHandler : public QObject, public FbXmlHandler
 {
     Q_OBJECT
 
 public:
-    explicit Fb2HtmlHandler() {}
+    explicit FbHtmlHandler() {}
 
 public slots:
     void onAttr(const QString &name, const QString &value);
@@ -63,13 +63,13 @@ private:
     QXmlAttributes m_atts;
 };
 
-class Fb2SaveWriter : public QXmlStreamWriter
+class FbSaveWriter : public QXmlStreamWriter
 {
 public:
-    explicit Fb2SaveWriter(Fb2TextEdit &view, QByteArray *array);
-    explicit Fb2SaveWriter(Fb2TextEdit &view, QIODevice *device);
-    explicit Fb2SaveWriter(Fb2TextEdit &view, QString *string);
-    Fb2TextEdit & view() { return m_view; }
+    explicit FbSaveWriter(FbTextEdit &view, QByteArray *array);
+    explicit FbSaveWriter(FbTextEdit &view, QIODevice *device);
+    explicit FbSaveWriter(FbTextEdit &view, QString *string);
+    FbTextEdit & view() { return m_view; }
     QString getFileName(const QString &src);
     void writeStartElement(const QString &name, int level);
     void writeEndElement(int level);
@@ -80,14 +80,14 @@ private:
     QByteArray downloadFile(const QUrl &url);
     void writeContentType(const QString &name, QByteArray &data);
 private:
-    Fb2TextEdit &m_view;
+    FbTextEdit &m_view;
     QStringList m_names;
 };
 
-class Fb2SaveHandler : public Fb2HtmlHandler
+class FbSaveHandler : public FbHtmlHandler
 {
 public:
-    explicit Fb2SaveHandler(Fb2SaveWriter &writer);
+    explicit FbSaveHandler(FbSaveWriter &writer);
     virtual bool comment(const QString& ch);
     bool save();
 
@@ -109,7 +109,7 @@ private:
             Code,
        FB2_END_KEYLIST
     public:
-        explicit TextHandler(Fb2SaveWriter &writer, const QString &name, const QXmlAttributes &atts, const QString &tag);
+        explicit TextHandler(FbSaveWriter &writer, const QString &name, const QXmlAttributes &atts, const QString &tag);
         explicit TextHandler(TextHandler *parent, const QString &name, const QXmlAttributes &atts, const QString &tag);
         const QString & tag() { return m_tag; }
     protected:
@@ -120,7 +120,7 @@ private:
         void Init(const QXmlAttributes &atts);
         virtual int nextLevel() const;
     protected:
-        Fb2SaveWriter &m_writer;
+        FbSaveWriter &m_writer;
         const QString m_tag;
         const int m_level;
     private:
@@ -130,17 +130,17 @@ private:
     class RootHandler : public NodeHandler
     {
     public:
-        explicit RootHandler(Fb2SaveWriter &writer, const QString &name);
+        explicit RootHandler(FbSaveWriter &writer, const QString &name);
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
     protected:
-        Fb2SaveWriter &m_writer;
+        FbSaveWriter &m_writer;
     };
 
     class BodyHandler : public TextHandler
     {
     public:
-        explicit BodyHandler(Fb2SaveWriter &writer, const QString &name, const QXmlAttributes &atts);
+        explicit BodyHandler(FbSaveWriter &writer, const QString &name, const QXmlAttributes &atts);
     protected:
         virtual void EndTag(const QString &name);
     };
@@ -185,7 +185,7 @@ protected:
     virtual NodeHandler * CreateRoot(const QString &name, const QXmlAttributes &atts);
 
 private:
-    Fb2SaveWriter & m_writer;
+    FbSaveWriter & m_writer;
 };
 
 #endif // FB2SAVE_H

+ 39 - 39
source/fb2temp.cpp

@@ -9,16 +9,16 @@
 #include "fb2text.hpp"
 
 //---------------------------------------------------------------------------
-//  Fb2TemporaryFile
+//  FbTemporaryFile
 //---------------------------------------------------------------------------
 
-Fb2TemporaryFile::Fb2TemporaryFile(const QString &name)
+FbTemporaryFile::FbTemporaryFile(const QString &name)
     : QTemporaryFile()
     , m_name(name)
 {
 }
 
-qint64 Fb2TemporaryFile::write(const QByteArray &data)
+qint64 FbTemporaryFile::write(const QByteArray &data)
 {
     open();
     if (m_hash.isEmpty()) m_hash = md5(data);
@@ -28,12 +28,12 @@ qint64 Fb2TemporaryFile::write(const QByteArray &data)
     return size;
 }
 
-QString Fb2TemporaryFile::md5(const QByteArray &data)
+QString FbTemporaryFile::md5(const QByteArray &data)
 {
     return QCryptographicHash::hash(data, QCryptographicHash::Md5).toBase64();
 }
 
-QByteArray Fb2TemporaryFile::data()
+QByteArray FbTemporaryFile::data()
 {
     open();
     QByteArray data = readAll();
@@ -42,26 +42,26 @@ QByteArray Fb2TemporaryFile::data()
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TemporaryList
+//  FbTemporaryList
 //---------------------------------------------------------------------------
 
-Fb2TemporaryList::Fb2TemporaryList()
+FbTemporaryList::FbTemporaryList()
 {
 }
 
-Fb2TemporaryList::~Fb2TemporaryList()
+FbTemporaryList::~FbTemporaryList()
 {
-    Fb2TemporaryIterator it(*this);
+    FbTemporaryIterator it(*this);
     while (it.hasNext()) delete it.next();
 }
 
-QString Fb2TemporaryList::add(const QString &path, const QByteArray &data)
+QString FbTemporaryList::add(const QString &path, const QByteArray &data)
 {
-    QString hash = Fb2TemporaryFile::md5(data);
+    QString hash = FbTemporaryFile::md5(data);
     QString name = this->name(hash);
     if (name.isEmpty()) {
         name = newName(path);
-        Fb2TemporaryFile * temp = new Fb2TemporaryFile(name);
+        FbTemporaryFile * temp = new FbTemporaryFile(name);
         temp->setHash(hash);
         temp->write(data);
         append(temp);
@@ -69,7 +69,7 @@ QString Fb2TemporaryList::add(const QString &path, const QByteArray &data)
     return name;
 }
 
-QString Fb2TemporaryList::newName(const QString &path)
+QString FbTemporaryList::newName(const QString &path)
 {
     QFileInfo info(path);
     QString name = info.fileName();
@@ -83,50 +83,50 @@ QString Fb2TemporaryList::newName(const QString &path)
     }
 }
 
-Fb2TemporaryFile * Fb2TemporaryList::get(const QString &name) const
+FbTemporaryFile * FbTemporaryList::get(const QString &name) const
 {
-    Fb2TemporaryIterator it(*this);
+    FbTemporaryIterator it(*this);
     while (it.hasNext()) {
-        Fb2TemporaryFile * file = it.next();
+        FbTemporaryFile * file = it.next();
         if (file->name() == name) return file;
     }
     return NULL;
 }
 
-QByteArray Fb2TemporaryList::data(const QString &name) const
+QByteArray FbTemporaryList::data(const QString &name) const
 {
-    Fb2TemporaryIterator it(*this);
+    FbTemporaryIterator it(*this);
     while (it.hasNext()) {
-        Fb2TemporaryFile *file = it.next();
+        FbTemporaryFile *file = it.next();
         if (file->name() == name) return file->data();
     }
     return QByteArray();
 }
 
-const QString & Fb2TemporaryList::set(const QString &name, const QByteArray &data, const QString &hash)
+const QString & FbTemporaryList::set(const QString &name, const QByteArray &data, const QString &hash)
 {
-    Fb2TemporaryFile * file = get(name);
-    if (!file) append(file = new Fb2TemporaryFile(name));
+    FbTemporaryFile * file = get(name);
+    if (!file) append(file = new FbTemporaryFile(name));
     file->setHash(hash);
     file->write(data);
     return file->hash();
 }
 
-QString Fb2TemporaryList::name(const QString &hash) const
+QString FbTemporaryList::name(const QString &hash) const
 {
-    Fb2TemporaryIterator it(*this);
+    FbTemporaryIterator it(*this);
     while (it.hasNext()) {
-        Fb2TemporaryFile *file = it.next();
+        FbTemporaryFile *file = it.next();
         if (file->hash() == hash) return file->name();
     }
     return QString();
 }
 
-bool Fb2TemporaryList::exists(const QString &name) const
+bool FbTemporaryList::exists(const QString &name) const
 {
-    Fb2TemporaryIterator it(*this);
+    FbTemporaryIterator it(*this);
     while (it.hasNext()) {
-        Fb2TemporaryFile *file = it.next();
+        FbTemporaryFile *file = it.next();
         if (file->name() == name) return true;
     }
     return false;
@@ -135,16 +135,16 @@ bool Fb2TemporaryList::exists(const QString &name) const
 #if 0
 
 //---------------------------------------------------------------------------
-//  Fb2NetworkDiskCache
+//  FbNetworkDiskCache
 //---------------------------------------------------------------------------
 
-QNetworkCacheMetaData Fb2NetworkDiskCache::metaData(const QUrl &url)
+QNetworkCacheMetaData FbNetworkDiskCache::metaData(const QUrl &url)
 {
     qCritical() << url.toString();
     return QNetworkDiskCache::metaData(url);
 }
 
-QIODevice * Fb2NetworkDiskCache::data(const QUrl &url)
+QIODevice * FbNetworkDiskCache::data(const QUrl &url)
 {
     qCritical() << url.toString();
     return QNetworkDiskCache::data(url);
@@ -153,10 +153,10 @@ QIODevice * Fb2NetworkDiskCache::data(const QUrl &url)
 #endif
 
 //---------------------------------------------------------------------------
-//  Fb2ImageReply
+//  FbImageReply
 //---------------------------------------------------------------------------
 
-Fb2ImageReply::Fb2ImageReply(QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &data)
+FbImageReply::FbImageReply(QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &data)
     : QNetworkReply()
     , content(data)
     , offset(0)
@@ -171,7 +171,7 @@ Fb2ImageReply::Fb2ImageReply(QNetworkAccessManager::Operation op, const QNetwork
     QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
 }
 
-qint64 Fb2ImageReply::readData(char *data, qint64 maxSize)
+qint64 FbImageReply::readData(char *data, qint64 maxSize)
 {
     if (offset >= content.size()) return -1;
     QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
@@ -182,26 +182,26 @@ qint64 Fb2ImageReply::readData(char *data, qint64 maxSize)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2NetworkAccessManager
+//  FbNetworkAccessManager
 //
 //    http://doc.trolltech.com/qq/32/qq32-webkit-protocols.html
 //---------------------------------------------------------------------------
 
-Fb2NetworkAccessManager::Fb2NetworkAccessManager(Fb2TextEdit &view)
+FbNetworkAccessManager::FbNetworkAccessManager(FbTextEdit &view)
     : QNetworkAccessManager(&view)
     , m_view(view)
 {
 }
 
-QNetworkReply * Fb2NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
+QNetworkReply * FbNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
 {
     if (request.url().scheme() == "fb2" && request.url().path() == m_view.url().path()) return imageRequest(op, request);
     return QNetworkAccessManager::createRequest(op, request, outgoingData);
 }
 
-QNetworkReply * Fb2NetworkAccessManager::imageRequest(Operation op, const QNetworkRequest &request)
+QNetworkReply * FbNetworkAccessManager::imageRequest(Operation op, const QNetworkRequest &request)
 {
     QString name = request.url().fragment();
     QByteArray data = m_view.files().data(name);
-    return new Fb2ImageReply(op, request, data);
+    return new FbImageReply(op, request, data);
 }

+ 15 - 15
source/fb2temp.hpp

@@ -8,15 +8,15 @@
 #include <QTemporaryFile>
 #include <QNetworkAccessManager>
 
-class Fb2TextEdit;
+class FbTextEdit;
 
-class Fb2TemporaryFile : public QTemporaryFile
+class FbTemporaryFile : public QTemporaryFile
 {
     Q_OBJECT
 public:
     static QString md5(const QByteArray &data);
 public:
-    explicit Fb2TemporaryFile(const QString &name);
+    explicit FbTemporaryFile(const QString &name);
     inline qint64 write(const QByteArray &data);
     void setHash(const QString &hash) { m_hash = hash; }
     const QString & hash() const { return m_hash; }
@@ -27,15 +27,15 @@ private:
     QString m_hash;
 };
 
-class Fb2TemporaryList : public QList<Fb2TemporaryFile*>
+class FbTemporaryList : public QList<FbTemporaryFile*>
 {
 public:
-    explicit Fb2TemporaryList();
-    virtual ~Fb2TemporaryList();
+    explicit FbTemporaryList();
+    virtual ~FbTemporaryList();
 
     QString add(const QString &path, const QByteArray &data);
     bool exists(const QString &name) const;
-    Fb2TemporaryFile * get(const QString &name) const;
+    FbTemporaryFile * get(const QString &name) const;
     const QString & set(const QString &name, const QByteArray &data, const QString &hash = QString());
     QString name(const QString &hash) const;
     QByteArray data(const QString &name) const;
@@ -43,25 +43,25 @@ private:
     QString newName(const QString &path);
 };
 
-typedef QListIterator<Fb2TemporaryFile*> Fb2TemporaryIterator;
+typedef QListIterator<FbTemporaryFile*> FbTemporaryIterator;
 
 #if 0
 
-class Fb2NetworkDiskCache : public QNetworkDiskCache
+class FbNetworkDiskCache : public QNetworkDiskCache
 {
 public:
-    explicit Fb2NetworkDiskCache(QObject *parent = 0) : QNetworkDiskCache(parent) {}
+    explicit FbNetworkDiskCache(QObject *parent = 0) : QNetworkDiskCache(parent) {}
     QNetworkCacheMetaData metaData(const QUrl &url);
     QIODevice *data(const QUrl &url);
 };
 
 #endif
 
-class Fb2ImageReply : public QNetworkReply
+class FbImageReply : public QNetworkReply
 {
     Q_OBJECT
 public:
-    explicit Fb2ImageReply(QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &data);
+    explicit FbImageReply(QNetworkAccessManager::Operation op, const QNetworkRequest &request, const QByteArray &data);
     qint64 bytesAvailable() const { return content.size(); }
     bool isSequential() const { return true; }
     void abort() { close(); }
@@ -74,11 +74,11 @@ private:
     qint64 offset;
 };
 
-class Fb2NetworkAccessManager : public QNetworkAccessManager
+class FbNetworkAccessManager : public QNetworkAccessManager
 {
     Q_OBJECT
 public:
-    explicit Fb2NetworkAccessManager(Fb2TextEdit &view);
+    explicit FbNetworkAccessManager(FbTextEdit &view);
 
 protected:
     virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0);
@@ -87,7 +87,7 @@ private:
     QNetworkReply *imageRequest(Operation op, const QNetworkRequest &request);
 
 private:
-    Fb2TextEdit & m_view;
+    FbTextEdit & m_view;
     QString m_path;
 };
 

+ 100 - 100
source/fb2text.cpp

@@ -25,26 +25,26 @@
 #include <QtDebug>
 
 //---------------------------------------------------------------------------
-//  Fb2NoteView
+//  FbNoteView
 //---------------------------------------------------------------------------
 
-class Fb2NoteView : public QWebView
+class FbNoteView : public QWebView
 {
 public:
-    explicit Fb2NoteView(QWidget *parent, const QUrl &url);
+    explicit FbNoteView(QWidget *parent, const QUrl &url);
     void hint(const QWebElement element, const QRect &rect);
 protected:
     void paintEvent(QPaintEvent *event);
     const QUrl m_url;
 };
 
-Fb2NoteView::Fb2NoteView(QWidget *parent, const QUrl &url)
+FbNoteView::FbNoteView(QWidget *parent, const QUrl &url)
     : QWebView(parent)
     , m_url(url)
 {
 }
 
-void Fb2NoteView::paintEvent(QPaintEvent *event)
+void FbNoteView::paintEvent(QPaintEvent *event)
 {
     QWebView::paintEvent(event);
     QPainter painter(this);
@@ -53,7 +53,7 @@ void Fb2NoteView::paintEvent(QPaintEvent *event)
     painter.drawRect( QRect(QPoint(0, 0), size) );
 }
 
-void Fb2NoteView::hint(const QWebElement element, const QRect &rect)
+void FbNoteView::hint(const QWebElement element, const QRect &rect)
 {
     QString html = element.toOuterXml();
     html.prepend(
@@ -67,10 +67,10 @@ void Fb2NoteView::hint(const QWebElement element, const QRect &rect)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TextPage
+//  FbTextPage
 //---------------------------------------------------------------------------
 
-Fb2TextPage::Fb2TextPage(QObject *parent)
+FbTextPage::FbTextPage(QObject *parent)
     : QWebPage(parent)
 {
     QWebSettings *s = settings();
@@ -84,7 +84,7 @@ Fb2TextPage::Fb2TextPage(QObject *parent)
     s->setUserStyleSheetUrl(QUrl::fromLocalFile(":style.css"));
 }
 
-bool Fb2TextPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
+bool FbTextPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
 {
     Q_UNUSED(frame);
     if (type == NavigationTypeLinkClicked) {
@@ -95,62 +95,62 @@ bool Fb2TextPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkReques
     return QWebPage::acceptNavigationRequest(frame, request, type);
 }
 
-QString Fb2TextPage::div(const QString &style, const QString &text)
+QString FbTextPage::div(const QString &style, const QString &text)
 {
     return QString("<div class=%1>%2</div>").arg(style).arg(text);
 }
 
-QString Fb2TextPage::p(const QString &text)
+QString FbTextPage::p(const QString &text)
 {
     return QString("<p>%1</p>").arg(text);
 }
 
-Fb2TextElement Fb2TextPage::body()
+FbTextElement FbTextPage::body()
 {
     return doc().findFirst("body");
 }
 
-Fb2TextElement Fb2TextPage::doc()
+FbTextElement FbTextPage::doc()
 {
     return mainFrame()->documentElement();
 }
 
-void Fb2TextPage::push(QUndoCommand * command, const QString &text)
+void FbTextPage::push(QUndoCommand * command, const QString &text)
 {
     undoStack()->beginMacro(text);
     undoStack()->push(command);
     undoStack()->endMacro();
 }
 
-void Fb2TextPage::update()
+void FbTextPage::update()
 {
     emit contentsChanged();
     emit selectionChanged();
 }
 
-void Fb2TextPage::appendSection(const Fb2TextElement &parent)
+void FbTextPage::appendSection(const FbTextElement &parent)
 {
     QString html = div("section", div("title", p()) + p());
-    Fb2TextElement element = parent;
+    FbTextElement element = parent;
     element.appendInside(html);
     element = parent.lastChild();
-    QUndoCommand * command = new Fb2InsertCmd(element);
+    QUndoCommand * command = new FbInsertCmd(element);
     push(command, tr("Append section"));
 }
 
-void Fb2TextPage::insertBody()
+void FbTextPage::insertBody()
 {
     QString html = div("body", div("title", p()) + div("section", div("title", p()) + p()));
-    Fb2TextElement element = body();
+    FbTextElement element = body();
     element.appendInside(html);
     element = element.lastChild();
-    QUndoCommand * command = new Fb2InsertCmd(element);
+    QUndoCommand * command = new FbInsertCmd(element);
     push(command, tr("Append body"));
 }
 
-void Fb2TextPage::insertSection()
+void FbTextPage::insertSection()
 {
-    Fb2TextElement element = current();
+    FbTextElement element = current();
     while (!element.isNull()) {
         if (element.isSection() || element.isBody()) {
             appendSection(element);
@@ -160,16 +160,16 @@ void Fb2TextPage::insertSection()
     }
 }
 
-void Fb2TextPage::insertTitle()
+void FbTextPage::insertTitle()
 {
-    Fb2TextElement element = current();
+    FbTextElement element = current();
     while (!element.isNull()) {
-        Fb2TextElement parent = element.parent();
+        FbTextElement parent = element.parent();
         if ((parent.isSection() || parent.isBody()) && !parent.hasTitle()) {
             QString html = div("title", p());
             parent.prependInside(html);
             element = parent.firstChild();
-            QUndoCommand * command = new Fb2InsertCmd(element);
+            QUndoCommand * command = new FbInsertCmd(element);
             push(command, tr("Insert title"));
             break;
         }
@@ -177,16 +177,16 @@ void Fb2TextPage::insertTitle()
     }
 }
 
-void Fb2TextPage::insertSubtitle()
+void FbTextPage::insertSubtitle()
 {
-    Fb2TextElement element = current();
+    FbTextElement element = current();
     while (!element.isNull()) {
-        Fb2TextElement parent = element.parent();
+        FbTextElement parent = element.parent();
         if (parent.isSection()) {
             QString html = div("subtitle", p());
             element.prependOutside(html);
             element = element.previousSibling();
-            QUndoCommand * command = new Fb2InsertCmd(element);
+            QUndoCommand * command = new FbInsertCmd(element);
             push(command, tr("Insert subtitle"));
             break;
         }
@@ -194,12 +194,12 @@ void Fb2TextPage::insertSubtitle()
     }
 }
 
-Fb2TextElement Fb2TextPage::current()
+FbTextElement FbTextPage::current()
 {
     return element(location());
 }
 
-Fb2TextElement Fb2TextPage::element(const QString &location)
+FbTextElement FbTextPage::element(const QString &location)
 {
     QStringList list = location.split(",");
     QStringListIterator iterator(list);
@@ -216,35 +216,35 @@ Fb2TextElement Fb2TextPage::element(const QString &location)
     return result;
 }
 
-QString Fb2TextPage::location()
+QString FbTextPage::location()
 {
     static const QString javascript = FB2::read(":/js/get_location.js").prepend("var element=document.getSelection().anchorNode;");
     return mainFrame()->evaluateJavaScript(javascript).toString();
 }
 
-QString Fb2TextPage::status()
+QString FbTextPage::status()
 {
     static const QString javascript = FB2::read(":/js/get_status.js");
     return mainFrame()->evaluateJavaScript(javascript).toString();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TextBase
+//  FbTextBase
 //---------------------------------------------------------------------------
 
-void Fb2TextBase::addTools(QToolBar *tool)
+void FbTextBase::addTools(QToolBar *tool)
 {
     QAction *act;
 
     act = pageAction(QWebPage::Undo);
-    act->setIcon(Fb2Icon("edit-undo"));
+    act->setIcon(FbIcon("edit-undo"));
     act->setText(QObject::tr("&Undo"));
     act->setPriority(QAction::LowPriority);
     act->setShortcut(QKeySequence::Undo);
     tool->addAction(act);
 
     act = pageAction(QWebPage::Redo);
-    act->setIcon(Fb2Icon("edit-redo"));
+    act->setIcon(FbIcon("edit-redo"));
     act->setText(QObject::tr("&Redo"));
     act->setPriority(QAction::LowPriority);
     act->setShortcut(QKeySequence::Redo);
@@ -253,7 +253,7 @@ void Fb2TextBase::addTools(QToolBar *tool)
     tool->addSeparator();
 
     act = pageAction(QWebPage::Cut);
-    act->setIcon(Fb2Icon("edit-cut"));
+    act->setIcon(FbIcon("edit-cut"));
     act->setText(QObject::tr("Cu&t"));
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Cut);
@@ -261,7 +261,7 @@ void Fb2TextBase::addTools(QToolBar *tool)
     tool->addAction(act);
 
     act = pageAction(QWebPage::Copy);
-    act->setIcon(Fb2Icon("edit-copy"));
+    act->setIcon(FbIcon("edit-copy"));
     act->setText(QObject::tr("&Copy"));
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Copy);
@@ -269,7 +269,7 @@ void Fb2TextBase::addTools(QToolBar *tool)
     tool->addAction(act);
 
     act = pageAction(QWebPage::Paste);
-    act->setIcon(Fb2Icon("edit-paste"));
+    act->setIcon(FbIcon("edit-paste"));
     act->setText(QObject::tr("&Paste"));
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Paste);
@@ -279,93 +279,93 @@ void Fb2TextBase::addTools(QToolBar *tool)
     tool->addSeparator();
 
     act = pageAction(QWebPage::ToggleBold);
-    act->setIcon(Fb2Icon("format-text-bold"));
+    act->setIcon(FbIcon("format-text-bold"));
     act->setText(QObject::tr("&Bold"));
     tool->addAction(act);
 
     act = pageAction(QWebPage::ToggleItalic);
-    act->setIcon(Fb2Icon("format-text-italic"));
+    act->setIcon(FbIcon("format-text-italic"));
     act->setText(QObject::tr("&Italic"));
     tool->addAction(act);
 
     act = pageAction(QWebPage::ToggleStrikethrough);
-    act->setIcon(Fb2Icon("format-text-strikethrough"));
+    act->setIcon(FbIcon("format-text-strikethrough"));
     act->setText(QObject::tr("&Strikethrough"));
     tool->addAction(act);
 
     act = pageAction(QWebPage::ToggleSuperscript);
-    act->setIcon(Fb2Icon("format-text-superscript"));
+    act->setIcon(FbIcon("format-text-superscript"));
     act->setText(QObject::tr("Su&perscript"));
     tool->addAction(act);
 
     act = pageAction(QWebPage::ToggleSubscript);
-    act->setIcon(Fb2Icon("format-text-subscript"));
+    act->setIcon(FbIcon("format-text-subscript"));
     act->setText(QObject::tr("Su&bscript"));
     tool->addAction(act);
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TextEdit
+//  FbTextEdit
 //---------------------------------------------------------------------------
 
-Fb2TextEdit::Fb2TextEdit(QWidget *parent)
-    : Fb2TextBase(parent)
+FbTextEdit::FbTextEdit(QWidget *parent)
+    : FbTextBase(parent)
     , m_noteView(0)
     , m_thread(0)
 {
-    setPage(new Fb2TextPage(this));
-    page()->setNetworkAccessManager(new Fb2NetworkAccessManager(*this));
+    setPage(new FbTextPage(this));
+    page()->setNetworkAccessManager(new FbNetworkAccessManager(*this));
     page()->setContentEditable(true);
     connect(page(), SIGNAL(contentsChanged()), this, SLOT(fixContents()));
     connect(page(), SIGNAL(linkHovered(QString,QString,QString)), this, SLOT(linkHovered(QString,QString,QString)));
     connect(this, SIGNAL(loadFinished(bool)), SLOT(loadFinished()));
 }
 
-Fb2TextEdit::~Fb2TextEdit()
+FbTextEdit::~FbTextEdit()
 {
     if (m_noteView) delete m_noteView;
 }
 
-Fb2TextPage * Fb2TextEdit::page()
+FbTextPage * FbTextEdit::page()
 {
-    return qobject_cast<Fb2TextPage*>(Fb2TextBase::page());
+    return qobject_cast<FbTextPage*>(FbTextBase::page());
 }
 
-Fb2NoteView & Fb2TextEdit::noteView()
+FbNoteView & FbTextEdit::noteView()
 {
     if (m_noteView) return *m_noteView;
-    m_noteView = new Fb2NoteView(qobject_cast<QWidget*>(parent()), url());
-    m_noteView->setPage(new Fb2TextPage(this));
+    m_noteView = new FbNoteView(qobject_cast<QWidget*>(parent()), url());
+    m_noteView->setPage(new FbTextPage(this));
     m_noteView->page()->setNetworkAccessManager(page()->networkAccessManager());
     m_noteView->page()->setContentEditable(false);
     m_noteView->setGeometry(QRect(100, 100, 400, 200));
     return *m_noteView;
 }
 
-QWebElement Fb2TextEdit::body()
+QWebElement FbTextEdit::body()
 {
     return doc().findFirst("body");
 }
 
-QWebElement Fb2TextEdit::doc()
+QWebElement FbTextEdit::doc()
 {
     return page()->mainFrame()->documentElement();
 }
 
-void Fb2TextEdit::fixContents()
+void FbTextEdit::fixContents()
 {
     foreach (QWebElement span, doc().findAll("span.apple-style-span[style]")) {
         span.removeAttribute("style");
     }
 }
 
-void Fb2TextEdit::mouseMoveEvent(QMouseEvent *event)
+void FbTextEdit::mouseMoveEvent(QMouseEvent *event)
 {
     m_point = event->pos();
     QWebView::mouseMoveEvent(event);
 }
 
-void Fb2TextEdit::linkHovered(const QString &link, const QString &title, const QString &textContent)
+void FbTextEdit::linkHovered(const QString &link, const QString &title, const QString &textContent)
 {
     Q_UNUSED(title);
     Q_UNUSED(textContent);
@@ -395,29 +395,29 @@ void Fb2TextEdit::linkHovered(const QString &link, const QString &title, const Q
     noteView().hint(element, QRect(point, size));
 }
 
-void Fb2TextEdit::load(const QString &filename, const QString &xml)
+void FbTextEdit::load(const QString &filename, const QString &xml)
 {
     if (m_thread) return;
-    m_thread = new Fb2ReadThread(this, filename, xml);
+    m_thread = new FbReadThread(this, filename, xml);
     m_thread->start();
 }
 
-bool Fb2TextEdit::save(QIODevice *device, const QString &codec)
+bool FbTextEdit::save(QIODevice *device, const QString &codec)
 {
-    Fb2SaveWriter writer(*this, device);
+    FbSaveWriter writer(*this, device);
     if (!codec.isEmpty()) writer.setCodec(codec.toLatin1());
-    bool ok = Fb2SaveHandler(writer).save();
+    bool ok = FbSaveHandler(writer).save();
     if (ok) page()->undoStack()->setClean();
     return ok;
 }
 
-bool Fb2TextEdit::save(QByteArray *array)
+bool FbTextEdit::save(QByteArray *array)
 {
-    Fb2SaveWriter writer(*this, array);
-    return Fb2SaveHandler(writer).save();
+    FbSaveWriter writer(*this, array);
+    return FbSaveHandler(writer).save();
 }
 
-bool Fb2TextEdit::save(QString *string)
+bool FbTextEdit::save(QString *string)
 {
     // Use class QByteArray instead QString
     // to store information about encoding.
@@ -427,12 +427,12 @@ bool Fb2TextEdit::save(QString *string)
     return ok;
 }
 
-void Fb2TextEdit::data(QString name, QByteArray data)
+void FbTextEdit::data(QString name, QByteArray data)
 {
     m_files.set(name, data);
 }
 
-void Fb2TextEdit::html(QString name, QString html)
+void FbTextEdit::html(QString name, QString html)
 {
     static int number = 0;
     setHtml(html, QUrl(QString("fb2:/%1/").arg(number++)));
@@ -440,75 +440,75 @@ void Fb2TextEdit::html(QString name, QString html)
     m_thread = 0;
 }
 
-void Fb2TextEdit::zoomIn()
+void FbTextEdit::zoomIn()
 {
     qreal zoom = zoomFactor();
     setZoomFactor(zoom * 1.1);
 }
 
-void Fb2TextEdit::zoomOut()
+void FbTextEdit::zoomOut()
 {
     qreal zoom = zoomFactor();
     setZoomFactor(zoom * 0.9);
 }
 
-void Fb2TextEdit::zoomReset()
+void FbTextEdit::zoomReset()
 {
     setZoomFactor(1);
 }
 
-bool Fb2TextEdit::UndoEnabled()
+bool FbTextEdit::UndoEnabled()
 {
     return pageAction(QWebPage::Undo)->isEnabled();
 }
 
-bool Fb2TextEdit::RedoEnabled()
+bool FbTextEdit::RedoEnabled()
 {
     return pageAction(QWebPage::Redo)->isEnabled();
 }
 
-bool Fb2TextEdit::CutEnabled()
+bool FbTextEdit::CutEnabled()
 {
     return pageAction(QWebPage::Cut)->isEnabled();
 }
 
-bool Fb2TextEdit::CopyEnabled()
+bool FbTextEdit::CopyEnabled()
 {
     return pageAction(QWebPage::Copy)->isEnabled();
 }
 
-bool Fb2TextEdit::BoldChecked()
+bool FbTextEdit::BoldChecked()
 {
     return pageAction(QWebPage::ToggleBold)->isChecked();
 }
 
-bool Fb2TextEdit::ItalicChecked()
+bool FbTextEdit::ItalicChecked()
 {
     return pageAction(QWebPage::ToggleItalic)->isChecked();
 }
 
-bool Fb2TextEdit::StrikeChecked()
+bool FbTextEdit::StrikeChecked()
 {
     return pageAction(QWebPage::ToggleStrikethrough)->isChecked();
 }
 
-bool Fb2TextEdit::SubChecked()
+bool FbTextEdit::SubChecked()
 {
     return pageAction(QWebPage::ToggleSubscript)->isChecked();
 }
 
-bool Fb2TextEdit::SupChecked()
+bool FbTextEdit::SupChecked()
 {
     return pageAction(QWebPage::ToggleSuperscript)->isChecked();
 }
 
-void Fb2TextEdit::find()
+void FbTextEdit::find()
 {
-    Fb2TextFindDlg dlg(*this);
+    FbTextFindDlg dlg(*this);
     dlg.exec();
 }
 
-void Fb2TextEdit::insertImage()
+void FbTextEdit::insertImage()
 {
     QString filters;
     filters += tr("Common Graphics (*.png *.jpg *.jpeg *.gif);;");
@@ -528,35 +528,35 @@ void Fb2TextEdit::insertImage()
     execCommand("insertImage", name.prepend("#"));
 }
 
-void Fb2TextEdit::insertNote()
+void FbTextEdit::insertNote()
 {
-    Fb2NoteDlg dlg(*this);
+    FbNoteDlg dlg(*this);
     dlg.exec();
 }
 
 
-void Fb2TextEdit::insertLink()
+void FbTextEdit::insertLink()
 {
 }
 
-void Fb2TextEdit::execCommand(const QString &cmd, const QString &arg)
+void FbTextEdit::execCommand(const QString &cmd, const QString &arg)
 {
     QString javascript = QString("document.execCommand(\"%1\",false,\"%2\")").arg(cmd).arg(arg);
     page()->mainFrame()->evaluateJavaScript(javascript);
 }
 
-void Fb2TextEdit::loadFinished()
+void FbTextEdit::loadFinished()
 {
-    Fb2TextElement element = body().findFirst("div.body");
+    FbTextElement element = body().findFirst("div.body");
     if (element.isNull()) element = body();
     element.select();
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TextFrame
+//  FbTextFrame
 //---------------------------------------------------------------------------
 
-Fb2TextFrame::Fb2TextFrame(QWidget* parent)
+FbTextFrame::FbTextFrame(QWidget* parent)
     : QFrame(parent)
     , view(this)
     , dock(0)
@@ -570,12 +570,12 @@ Fb2TextFrame::Fb2TextFrame(QWidget* parent)
     layout->addWidget(&view);
 }
 
-Fb2TextFrame::~Fb2TextFrame()
+FbTextFrame::~FbTextFrame()
 {
     if (dock) dock->deleteLater();
 }
 
-void Fb2TextFrame::showInspector()
+void FbTextFrame::showInspector()
 {
     if (dock) {
         dock->show();
@@ -594,7 +594,7 @@ void Fb2TextFrame::showInspector()
     dock->setWidget(inspector);
 }
 
-void Fb2TextFrame::hideInspector()
+void FbTextFrame::hideInspector()
 {
     if (dock) dock->hide();
 }

+ 24 - 24
source/fb2text.hpp

@@ -17,15 +17,15 @@ class QUndoCommand;
 class QWebInspector;
 QT_END_NAMESPACE
 
-class Fb2NoteView;
-class Fb2TextElement;
+class FbNoteView;
+class FbTextElement;
 
-class Fb2TextBase : public QWebView
+class FbTextBase : public QWebView
 {
     Q_OBJECT
 
 public:
-    Fb2TextBase(QWidget* parent = 0)
+    FbTextBase(QWidget* parent = 0)
         : QWebView(parent)
     {
           m_timer.setInterval(100);
@@ -53,23 +53,23 @@ private:
     QSize m_size;
 };
 
-class Fb2TextPage : public QWebPage
+class FbTextPage : public QWebPage
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TextPage(QObject *parent = 0);
+    explicit FbTextPage(QObject *parent = 0);
 
     void push(QUndoCommand * command, const QString &text = QString());
-    Fb2TextElement element(const QString &location);
-    Fb2TextElement current();
+    FbTextElement element(const QString &location);
+    FbTextElement current();
     QString location();
     QString status();
 
-    Fb2TextElement body();
-    Fb2TextElement doc();
+    FbTextElement body();
+    FbTextElement doc();
 
-    void appendSection(const Fb2TextElement &parent);
+    void appendSection(const FbTextElement &parent);
 
 public slots:
     void insertBody();
@@ -86,16 +86,16 @@ protected:
     void update();
 };
 
-class Fb2TextEdit : public Fb2TextBase
+class FbTextEdit : public FbTextBase
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TextEdit(QWidget *parent = 0);
-    virtual ~Fb2TextEdit();
+    explicit FbTextEdit(QWidget *parent = 0);
+    virtual ~FbTextEdit();
 
-    Fb2TextPage * page();
-    Fb2TemporaryList & files() { return m_files; }
+    FbTextPage * page();
+    FbTemporaryList & files() { return m_files; }
     void load(const QString &filename, const QString &xml = QString());
     bool save(QIODevice *device, const QString &codec = QString());
     bool save(QByteArray *array);
@@ -133,27 +133,27 @@ private slots:
 private:
     void execCommand(const QString &cmd, const QString &arg);
     void exec(QUndoCommand *command);
-    Fb2TemporaryFile * file(const QString &name);
-    Fb2NoteView & noteView();
+    FbTemporaryFile * file(const QString &name);
+    FbNoteView & noteView();
     QWebElement body();
     QWebElement doc();
 
 private:
-    Fb2TemporaryList m_files;
-    Fb2NoteView *m_noteView;
+    FbTemporaryList m_files;
+    FbNoteView *m_noteView;
     QThread *m_thread;
     QPoint m_point;
 };
 
-class Fb2TextFrame : public QFrame
+class FbTextFrame : public QFrame
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TextFrame(QWidget* parent = 0);
-    ~Fb2TextFrame();
+    explicit FbTextFrame(QWidget* parent = 0);
+    ~FbTextFrame();
     void hideInspector();
-    Fb2TextEdit view;
+    FbTextEdit view;
 
 public slots:
     void showInspector();

+ 99 - 99
source/fb2tree.cpp

@@ -16,10 +16,10 @@
 #include "fb2utils.h"
 
 //---------------------------------------------------------------------------
-//  Fb2TreeItem
+//  FbTreeItem
 //---------------------------------------------------------------------------
 
-Fb2TreeItem::Fb2TreeItem(QWebElement &element, Fb2TreeItem *parent, int number)
+FbTreeItem::FbTreeItem(QWebElement &element, FbTreeItem *parent, int number)
     : QObject(parent)
     , m_element(element)
     , m_parent(parent)
@@ -28,14 +28,14 @@ Fb2TreeItem::Fb2TreeItem(QWebElement &element, Fb2TreeItem *parent, int number)
     init();
 }
 
-Fb2TreeItem::~Fb2TreeItem()
+FbTreeItem::~FbTreeItem()
 {
-    foreach (Fb2TreeItem * item, m_list) {
+    foreach (FbTreeItem * item, m_list) {
         delete item;
     }
 }
 
-void Fb2TreeItem::init()
+void FbTreeItem::init()
 {
     m_text = QString();
     m_name = m_element.tagName().toLower();
@@ -57,32 +57,32 @@ void Fb2TreeItem::init()
     }
 }
 
-QString Fb2TreeItem::title()
+QString FbTreeItem::title()
 {
     return m_element.toPlainText().left(255).simplified();
 }
 
-Fb2TreeItem * Fb2TreeItem::item(const QModelIndex &index) const
+FbTreeItem * FbTreeItem::item(const QModelIndex &index) const
 {
     int row = index.row();
     if (row < 0 || row >= m_list.size()) return NULL;
     return m_list[row];
 }
 
-Fb2TreeItem * Fb2TreeItem::item(int row) const
+FbTreeItem * FbTreeItem::item(int row) const
 {
     if (row < 0 || row >= m_list.size()) return NULL;
     return m_list[row];
 }
 
-QString Fb2TreeItem::text() const
+QString FbTreeItem::text() const
 {
     QString name = m_name;
     if (!m_body.isEmpty()) name += " name=" + m_body;
     return QString("<%1> %2").arg(name).arg(m_text);
 }
 
-QString Fb2TreeItem::selector() const
+QString FbTreeItem::selector() const
 {
     QString text = "";
     QString selector = ".get(0)";
@@ -105,11 +105,11 @@ QString Fb2TreeItem::selector() const
     return selector.prepend("$('html')");
 }
 
-Fb2TreeItem * Fb2TreeItem::content(const Fb2TreeModel &model, int number) const
+FbTreeItem * FbTreeItem::content(const FbTreeModel &model, int number) const
 {
-    Fb2TextElement element = m_element.firstChild();
+    FbTextElement element = m_element.firstChild();
     while (number-- > 0) element = element.nextSibling();
-    Fb2TreeList::const_iterator it;
+    FbTreeList::const_iterator it;
     for (it = m_list.constBegin(); it != m_list.constEnd(); it++) {
         if ((*it)->element() == element) return *it;
     }
@@ -117,10 +117,10 @@ Fb2TreeItem * Fb2TreeItem::content(const Fb2TreeModel &model, int number) const
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TreeModel
+//  FbTreeModel
 //---------------------------------------------------------------------------
 
-Fb2TreeModel::Fb2TreeModel(Fb2TextEdit &view, QObject *parent)
+FbTreeModel::FbTreeModel(FbTextEdit &view, QObject *parent)
     : QAbstractItemModel(parent)
     , m_view(view)
     , m_root(NULL)
@@ -128,51 +128,51 @@ Fb2TreeModel::Fb2TreeModel(Fb2TextEdit &view, QObject *parent)
     QWebElement doc = view.page()->mainFrame()->documentElement();
     QWebElement body = doc.findFirst("body");
     if (body.isNull()) return;
-    m_root = new Fb2TreeItem(body);
+    m_root = new FbTreeItem(body);
 }
 
-Fb2TreeModel::~Fb2TreeModel()
+FbTreeModel::~FbTreeModel()
 {
     if (m_root) delete m_root;
 }
 
-Fb2TreeItem * Fb2TreeModel::item(const QModelIndex &index) const
+FbTreeItem * FbTreeModel::item(const QModelIndex &index) const
 {
     if (index.isValid()) {
-        return static_cast<Fb2TreeItem*>(index.internalPointer());
+        return static_cast<FbTreeItem*>(index.internalPointer());
     } else {
         return m_root;
     }
 }
 
-int Fb2TreeModel::columnCount(const QModelIndex &parent) const
+int FbTreeModel::columnCount(const QModelIndex &parent) const
 {
     Q_UNUSED(parent);
     return 1;
 }
 
-QModelIndex Fb2TreeModel::index(Fb2TreeItem *item, int column) const
+QModelIndex FbTreeModel::index(FbTreeItem *item, int column) const
 {
-    Fb2TreeItem *parent = item->parent();
+    FbTreeItem *parent = item->parent();
     return parent ? createIndex(parent->index(item), column, (void*)item) : QModelIndex();
 }
 
-QModelIndex Fb2TreeModel::index(int row, int column, const QModelIndex &parent) const
+QModelIndex FbTreeModel::index(int row, int column, const QModelIndex &parent) const
 {
     if (!m_root || row < 0 || column < 0) return QModelIndex();
-    if (Fb2TreeItem *owner = item(parent)) {
-        if (Fb2TreeItem *child = owner->item(row)) {
+    if (FbTreeItem *owner = item(parent)) {
+        if (FbTreeItem *child = owner->item(row)) {
             return createIndex(row, column, (void*)child);
         }
     }
     return QModelIndex();
 }
 
-QModelIndex Fb2TreeModel::parent(const QModelIndex &child) const
+QModelIndex FbTreeModel::parent(const QModelIndex &child) const
 {
-    if (Fb2TreeItem * node = static_cast<Fb2TreeItem*>(child.internalPointer())) {
-        if (Fb2TreeItem * parent = node->parent()) {
-            if (Fb2TreeItem * owner = parent->parent()) {
+    if (FbTreeItem * node = static_cast<FbTreeItem*>(child.internalPointer())) {
+        if (FbTreeItem * parent = node->parent()) {
+            if (FbTreeItem * owner = parent->parent()) {
                 return createIndex(owner->index(parent), 0, (void*)parent);
             }
         }
@@ -180,50 +180,50 @@ QModelIndex Fb2TreeModel::parent(const QModelIndex &child) const
     return QModelIndex();
 }
 
-int Fb2TreeModel::rowCount(const QModelIndex &parent) const
+int FbTreeModel::rowCount(const QModelIndex &parent) const
 {
     if (parent.column() > 0) return 0;
-    Fb2TreeItem *owner = item(parent);
+    FbTreeItem *owner = item(parent);
     return owner ? owner->count() : 0;
 }
 
-QVariant Fb2TreeModel::data(const QModelIndex &index, int role) const
+QVariant FbTreeModel::data(const QModelIndex &index, int role) const
 {
     if (role != Qt::DisplayRole) return QVariant();
-    Fb2TreeItem * i = item(index);
+    FbTreeItem * i = item(index);
     return i ? i->text() : QVariant();
 }
 
-void Fb2TreeModel::selectText(const QModelIndex &index)
+void FbTreeModel::selectText(const QModelIndex &index)
 {
-    if (Fb2TreeItem *node = item(index)) {
+    if (FbTreeItem *node = item(index)) {
         node->element().select();
     }
 }
 
-QModelIndex Fb2TreeModel::index(const QString &location) const
+QModelIndex FbTreeModel::index(const QString &location) const
 {
     QModelIndex result;
-    Fb2TreeItem * parent = m_root;
+    FbTreeItem * parent = m_root;
     QStringList list = location.split(",");
     QStringListIterator iterator(list);
     while (parent && iterator.hasNext()) {
         QString str = iterator.next();
         if (str.left(5) == "HTML=") continue;
         int key = str.mid(str.indexOf("=")+1).toInt();
-        Fb2TreeItem * child = parent->content(*this, key);
+        FbTreeItem * child = parent->content(*this, key);
         if (child) result = index(child);
         parent = child;
     }
     return result;
 }
 
-QModelIndex Fb2TreeModel::move(const QModelIndex &index, int dx, int dy)
+QModelIndex FbTreeModel::move(const QModelIndex &index, int dx, int dy)
 {
-    Fb2TreeItem *child = item(index);
+    FbTreeItem *child = item(index);
     if (!child) return QModelIndex();
 
-    Fb2TreeItem *owner = child->parent();
+    FbTreeItem *owner = child->parent();
     if (!owner) return QModelIndex();
 
     int from = index.row();
@@ -248,7 +248,7 @@ QModelIndex Fb2TreeModel::move(const QModelIndex &index, int dx, int dy)
 
         case +1: {
             if (from == 0) return QModelIndex();
-            Fb2TreeItem * brother = owner->item(from - 1);
+            FbTreeItem * brother = owner->item(from - 1);
             if (child->name() != "section") return QModelIndex();
             if (brother->name() != "section") return QModelIndex();
             QModelIndex target = createIndex(from - 1, 0, (void*)brother);
@@ -272,8 +272,8 @@ QModelIndex Fb2TreeModel::move(const QModelIndex &index, int dx, int dy)
                 from = to + dy;
             }
 
-            Fb2TreeItem * child = owner->item(to);
-            Fb2TreeItem * brother = owner->item(from);
+            FbTreeItem * child = owner->item(to);
+            FbTreeItem * brother = owner->item(from);
 
             QString n = child->name();
             bool ok = (n == "body" || n == "section") && n == brother->name();
@@ -284,23 +284,23 @@ QModelIndex Fb2TreeModel::move(const QModelIndex &index, int dx, int dy)
             owner->insert(brother, to);
             endMoveRows();
 
-            QUndoCommand * command = new Fb2MoveUpCmd(brother->element());
+            QUndoCommand * command = new FbMoveUpCmd(brother->element());
             m_view.page()->push(command, tr("Move section"));
         } break;
     }
     return result;
 }
 
-bool Fb2TreeModel::removeRows(int row, int count, const QModelIndex &parent)
+bool FbTreeModel::removeRows(int row, int count, const QModelIndex &parent)
 {
     if (row < 0 || count <= 0 || row + count > rowCount(parent)) return false;
-    Fb2TreeItem * owner = item(parent);
+    FbTreeItem * owner = item(parent);
     if (!owner) return false;
     int last = row + count - 1;
     beginRemoveRows(parent, row, last);
     for (int i = last; i >= row; i--) {
-        if (Fb2TreeItem * child = owner->takeAt(i)) {
-            QUndoCommand * command = new Fb2DeleteCmd(child->element());
+        if (FbTreeItem * child = owner->takeAt(i)) {
+            QUndoCommand * command = new FbDeleteCmd(child->element());
             m_view.page()->push(command, "Delete element");
             delete child;
         }
@@ -309,16 +309,16 @@ bool Fb2TreeModel::removeRows(int row, int count, const QModelIndex &parent)
     return true;
 }
 
-void Fb2TreeModel::update(Fb2TreeItem &owner)
+void FbTreeModel::update(FbTreeItem &owner)
 {
     owner.init();
-    Fb2ElementList list;
+    FbElementList list;
     owner.element().getChildren(list);
 
     int pos = 0;
     QModelIndex index = this->index(&owner);
-    for (Fb2ElementList::iterator it = list.begin(); it != list.end(); it++) {
-        Fb2TreeItem * child = 0;
+    for (FbElementList::iterator it = list.begin(); it != list.end(); it++) {
+        FbTreeItem * child = 0;
         QWebElement element = *it;
         int count = owner.count();
         for (int i = pos; i < count; i++) {
@@ -340,7 +340,7 @@ void Fb2TreeModel::update(Fb2TreeItem &owner)
                 emit dataChanged(i, i);
             }
         } else {
-            Fb2TreeItem * child = new Fb2TreeItem(element);
+            FbTreeItem * child = new FbTreeItem(element);
             beginInsertRows(index, pos, pos);
             owner.insert(child, pos);
             endInsertRows();
@@ -357,7 +357,7 @@ void Fb2TreeModel::update(Fb2TreeItem &owner)
     }
 }
 
-void Fb2TreeModel::update()
+void FbTreeModel::update()
 {
     QWebElement doc = m_view.page()->mainFrame()->documentElement();
     QWebElement body = doc.findFirst("body");
@@ -366,17 +366,17 @@ void Fb2TreeModel::update()
         update(*m_root);
     } else {
         if (!body.isNull()) {
-            m_root = new Fb2TreeItem(body);
+            m_root = new FbTreeItem(body);
             update(*m_root);
         }
     }
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TreeView
+//  FbTreeView
 //---------------------------------------------------------------------------
 
-Fb2TreeView::Fb2TreeView(Fb2TextEdit &view, QWidget *parent)
+FbTreeView::FbTreeView(FbTextEdit &view, QWidget *parent)
     : QTreeView(parent)
     , m_view(view)
 {
@@ -401,11 +401,11 @@ Fb2TreeView::Fb2TreeView(Fb2TextEdit &view, QWidget *parent)
     QMetaObject::invokeMethod(this, "updateTree", Qt::QueuedConnection);
 }
 
-void Fb2TreeView::initActions(QToolBar *toolbar)
+void FbTreeView::initActions(QToolBar *toolbar)
 {
     QAction * act;
 
-    act = new QAction(Fb2Icon("list-add"), tr("&Insert"), this);
+    act = new QAction(FbIcon("list-add"), tr("&Insert"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(Qt::Key_Insert);
     act->setPriority(QAction::LowPriority);
@@ -413,7 +413,7 @@ void Fb2TreeView::initActions(QToolBar *toolbar)
     toolbar->addAction(act);
     m_menu.addAction(act);
 
-    act = new QAction(Fb2Icon("list-remove"), tr("&Delete"), this);
+    act = new QAction(FbIcon("list-remove"), tr("&Delete"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(Qt::Key_Delete);
     act->setPriority(QAction::LowPriority);
@@ -423,21 +423,21 @@ void Fb2TreeView::initActions(QToolBar *toolbar)
 
     m_menu.addSeparator();
 
-    actionCut = act = new QAction(Fb2Icon("edit-cut"), tr("Cu&t"), this);
+    actionCut = act = new QAction(FbIcon("edit-cut"), tr("Cu&t"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Cut);
     act->setEnabled(false);
     m_menu.addAction(act);
 
-    actionCopy = act = new QAction(Fb2Icon("edit-copy"), tr("&Copy"), this);
+    actionCopy = act = new QAction(FbIcon("edit-copy"), tr("&Copy"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Copy);
     act->setEnabled(false);
     m_menu.addAction(act);
 
-    actionPaste = act = new QAction(Fb2Icon("edit-paste"), tr("&Paste"), this);
+    actionPaste = act = new QAction(FbIcon("edit-paste"), tr("&Paste"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setPriority(QAction::LowPriority);
     act->setShortcuts(QKeySequence::Paste);
@@ -446,28 +446,28 @@ void Fb2TreeView::initActions(QToolBar *toolbar)
     toolbar->addSeparator();
     m_menu.addSeparator();
 
-    act = new QAction(Fb2Icon("go-up"), tr("&Up"), this);
+    act = new QAction(FbIcon("go-up"), tr("&Up"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
     connect(act, SIGNAL(triggered()), SLOT(moveUp()));
     toolbar->addAction(act);
     m_menu.addAction(act);
 
-    act = new QAction(Fb2Icon("go-down"), tr("&Down"), this);
+    act = new QAction(FbIcon("go-down"), tr("&Down"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
     connect(act, SIGNAL(triggered()), SLOT(moveDown()));
     toolbar->addAction(act);
     m_menu.addAction(act);
 
-    act = new QAction(Fb2Icon("go-previous"), tr("&Left"), this);
+    act = new QAction(FbIcon("go-previous"), tr("&Left"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
     connect(act, SIGNAL(triggered()), SLOT(moveLeft()));
     toolbar->addAction(act);
     m_menu.addAction(act);
 
-    act = new QAction(Fb2Icon("go-next"), tr("&Right"), this);
+    act = new QAction(FbIcon("go-next"), tr("&Right"), this);
     act->setShortcutContext(Qt::WidgetShortcut);
     act->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right));
     connect(act, SIGNAL(triggered()), SLOT(moveRight()));
@@ -475,7 +475,7 @@ void Fb2TreeView::initActions(QToolBar *toolbar)
     m_menu.addAction(act);
 }
 
-void Fb2TreeView::keyPressEvent(QKeyEvent *event)
+void FbTreeView::keyPressEvent(QKeyEvent *event)
 {
     if (event->modifiers() == Qt::NoModifier) {
         switch (event->key()) {
@@ -486,33 +486,33 @@ void Fb2TreeView::keyPressEvent(QKeyEvent *event)
     QTreeView::keyPressEvent(event);
 }
 
-void Fb2TreeView::contextMenu(const QPoint &pos)
+void FbTreeView::contextMenu(const QPoint &pos)
 {
     m_menu.exec(QCursor::pos());
 }
 
-void Fb2TreeView::selectionChanged()
+void FbTreeView::selectionChanged()
 {
     m_timerSelect.start();
 }
 
-void Fb2TreeView::contentsChanged()
+void FbTreeView::contentsChanged()
 {
     m_timerUpdate.start();
 }
 
-void Fb2TreeView::activated(const QModelIndex &index)
+void FbTreeView::activated(const QModelIndex &index)
 {
     if (qApp->focusWidget() == &m_view) return;
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         m->selectText(index);
     }
 }
 
-void Fb2TreeView::selectTree()
+void FbTreeView::selectTree()
 {
     if (qApp->focusWidget() == this) return;
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         QString location = m->view().page()->location();
         QModelIndex index = m->index(location);
         if (!index.isValid()) return;
@@ -521,38 +521,38 @@ void Fb2TreeView::selectTree()
     }
 }
 
-void Fb2TreeView::updateTree()
+void FbTreeView::updateTree()
 {
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         m->update();
     } else {
-        m = new Fb2TreeModel(m_view, this);
+        m = new FbTreeModel(m_view, this);
         m->update();
         setModel(m);
     }
     selectTree();
 }
 
-QModelIndex Fb2TreeModel::append(const QModelIndex &parent, Fb2TextElement element)
+QModelIndex FbTreeModel::append(const QModelIndex &parent, FbTextElement element)
 {
-    Fb2TreeItem * owner = item(parent);
+    FbTreeItem * owner = item(parent);
     if (!owner || owner == m_root) return QModelIndex();
     int row = owner->count();
-    Fb2TreeItem * child = new Fb2TreeItem(element);
+    FbTreeItem * child = new FbTreeItem(element);
     beginInsertRows(parent, row, row);
     owner->insert(child, row);
     endInsertRows();
     return createIndex(row, 0, (void*)child);
 }
 
-void Fb2TreeView::insertNode()
+void FbTreeView::insertNode()
 {
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         QModelIndex index = currentIndex();
-        Fb2TreeItem * item = m->item(index);
+        FbTreeItem * item = m->item(index);
         if (!item) return;
 
-        Fb2TextElement element = item->element();
+        FbTextElement element = item->element();
         while (!element.isNull()) {
             if (element.isSection() || element.isBody()) {
                 m_view.page()->appendSection(element);
@@ -570,9 +570,9 @@ void Fb2TreeView::insertNode()
     }
 }
 
-void Fb2TreeView::deleteNode()
+void FbTreeView::deleteNode()
 {
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         QModelIndex index = currentIndex();
         QModelIndex parent = m->parent(index);
 
@@ -590,14 +590,14 @@ void Fb2TreeView::deleteNode()
     }
 }
 
-Fb2TreeModel * Fb2TreeView::model()
+FbTreeModel * FbTreeView::model()
 {
-    return qobject_cast<Fb2TreeModel*>(QTreeView::model());
+    return qobject_cast<FbTreeModel*>(QTreeView::model());
 }
 
-void Fb2TreeView::moveCurrent(int dx, int dy)
+void FbTreeView::moveCurrent(int dx, int dy)
 {
-    if (Fb2TreeModel * m = model()) {
+    if (FbTreeModel * m = model()) {
         QModelIndex index = currentIndex();
         QModelIndex result = m->move(index, dx, dy);
         if (result.isValid()) {
@@ -609,31 +609,31 @@ void Fb2TreeView::moveCurrent(int dx, int dy)
     }
 }
 
-void Fb2TreeView::moveUp()
+void FbTreeView::moveUp()
 {
     moveCurrent(0, -1);
 }
 
-void Fb2TreeView::moveDown()
+void FbTreeView::moveDown()
 {
     moveCurrent(0, +1);
 }
 
-void Fb2TreeView::moveLeft()
+void FbTreeView::moveLeft()
 {
     moveCurrent(-1, 0);
 }
 
-void Fb2TreeView::moveRight()
+void FbTreeView::moveRight()
 {
     moveCurrent(+1, 0);
 }
 
 //---------------------------------------------------------------------------
-//  Fb2TreeWidget
+//  FbTreeWidget
 //---------------------------------------------------------------------------
 
-Fb2TreeWidget::Fb2TreeWidget(Fb2TextEdit &view, QWidget* parent)
+FbTreeWidget::FbTreeWidget(FbTextEdit &view, QWidget* parent)
     : QWidget(parent)
 {
     QVBoxLayout * layout = new QVBoxLayout(this);
@@ -641,7 +641,7 @@ Fb2TreeWidget::Fb2TreeWidget(Fb2TextEdit &view, QWidget* parent)
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setObjectName(QString::fromUtf8("verticalLayout"));
 
-    m_tree = new Fb2TreeView(view, this);
+    m_tree = new FbTreeView(view, this);
     layout->addWidget(m_tree);
 
     m_tool = new QToolBar(this);

+ 35 - 35
source/fb2tree.hpp

@@ -13,42 +13,42 @@ QT_BEGIN_NAMESPACE
 class QAction;
 QT_END_NAMESPACE
 
-class Fb2TextEdit;
+class FbTextEdit;
 
-class Fb2TreeItem;
+class FbTreeItem;
 
-class Fb2TreeModel;
+class FbTreeModel;
 
-typedef QList<Fb2TreeItem*> Fb2TreeList;
+typedef QList<FbTreeItem*> FbTreeList;
 
-class Fb2TreeItem: public QObject
+class FbTreeItem: public QObject
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TreeItem(QWebElement &element, Fb2TreeItem *parent = 0, int index = 0);
+    explicit FbTreeItem(QWebElement &element, FbTreeItem *parent = 0, int index = 0);
 
-    virtual ~Fb2TreeItem();
+    virtual ~FbTreeItem();
 
-    Fb2TreeItem * item(const QModelIndex &index) const;
+    FbTreeItem * item(const QModelIndex &index) const;
 
-    Fb2TreeItem * item(int row) const;
+    FbTreeItem * item(int row) const;
 
-    Fb2TreeItem & operator=(const QWebElement &element) {
+    FbTreeItem & operator=(const QWebElement &element) {
         m_element = element;
         return *this;
     }
 
-    int index(Fb2TreeItem * child) const {
+    int index(FbTreeItem * child) const {
         return m_list.indexOf(child);
     }
 
-    void insert(Fb2TreeItem * child, int row) {
+    void insert(FbTreeItem * child, int row) {
         m_list.insert(row, child);
         child->m_parent = this;
     }
 
-    Fb2TreeItem * takeAt(int row) {
+    FbTreeItem * takeAt(int row) {
         return m_list.takeAt(row);
     }
 
@@ -56,11 +56,11 @@ public:
         return m_list.size();
     }
 
-    Fb2TextElement element() const {
+    FbTextElement element() const {
         return m_element;
     }
 
-    Fb2TreeItem * parent() const {
+    FbTreeItem * parent() const {
         return m_parent;
     }
 
@@ -72,7 +72,7 @@ public:
         return m_element.geometry().topLeft();
     }
 
-    Fb2TreeItem * content(const Fb2TreeModel &model, int number) const;
+    FbTreeItem * content(const FbTreeModel &model, int number) const;
 
     QString selector() const;
 
@@ -84,29 +84,29 @@ private:
     QString title();
 
 private:
-    Fb2TreeList m_list;
+    FbTreeList m_list;
     QWebElement m_element;
     QString m_name;
     QString m_text;
     QString m_body;
-    Fb2TreeItem * m_parent;
+    FbTreeItem * m_parent;
     int m_number;
 };
 
-class Fb2TreeModel: public QAbstractItemModel
+class FbTreeModel: public QAbstractItemModel
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TreeModel(Fb2TextEdit &view, QObject *parent = 0);
-    virtual ~Fb2TreeModel();
-    QModelIndex index(Fb2TreeItem *item, int column = 0) const;
+    explicit FbTreeModel(FbTextEdit &view, QObject *parent = 0);
+    virtual ~FbTreeModel();
+    QModelIndex index(FbTreeItem *item, int column = 0) const;
     QModelIndex index(const QString &location) const;
-    Fb2TextEdit & view() { return m_view; }
+    FbTextEdit & view() { return m_view; }
     void selectText(const QModelIndex &index);
     QModelIndex move(const QModelIndex &index, int dx, int dy);
-    QModelIndex append(const QModelIndex &parent, Fb2TextElement element);
-    Fb2TreeItem * item(const QModelIndex &index) const;
+    QModelIndex append(const QModelIndex &parent, FbTextElement element);
+    FbTreeItem * item(const QModelIndex &index) const;
     void update();
 
 public:
@@ -118,19 +118,19 @@ public:
     virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
 
 private:
-    void update(Fb2TreeItem &item);
+    void update(FbTreeItem &item);
 
 private:
-    Fb2TextEdit & m_view;
-    Fb2TreeItem * m_root;
+    FbTextEdit & m_view;
+    FbTreeItem * m_root;
 };
 
-class Fb2TreeView : public QTreeView
+class FbTreeView : public QTreeView
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TreeView(Fb2TextEdit &view, QWidget *parent = 0);
+    explicit FbTreeView(FbTextEdit &view, QWidget *parent = 0);
     void initActions(QToolBar *toolbar);
 
 public slots:
@@ -156,10 +156,10 @@ protected:
 
 private:
     void moveCurrent(int dx, int dy);
-    Fb2TreeModel * model();
+    FbTreeModel * model();
 
 private:
-    Fb2TextEdit & m_view;
+    FbTextEdit & m_view;
     QTimer m_timerSelect;
     QTimer m_timerUpdate;
     QMenu m_menu;
@@ -169,16 +169,16 @@ private:
         *actionPaste;
 };
 
-class Fb2TreeWidget : public QWidget
+class FbTreeWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    explicit Fb2TreeWidget(Fb2TextEdit &view, QWidget* parent = 0);
+    explicit FbTreeWidget(FbTextEdit &view, QWidget* parent = 0);
 
 protected:
     QToolBar * m_tool;
-    Fb2TreeView * m_tree;
+    FbTreeView * m_tree;
 };
 
 #endif // FB2TREE_H

+ 1 - 1
source/fb2utils.cpp

@@ -11,7 +11,7 @@ static QIcon loadIcon(const QString &name)
     return icon;
 }
 
-Fb2Icon::Fb2Icon(const QString &name)
+FbIcon::FbIcon(const QString &name)
     : QIcon(fromTheme(name, loadIcon(name)))
 {
 }

+ 2 - 2
source/fb2utils.h

@@ -6,10 +6,10 @@
 
 #define FB2DELETE(p) { if ((p) != NULL) { delete (p); (p) = NULL; } }
 
-class Fb2Icon : public QIcon
+class FbIcon : public QIcon
 {
 public:
-    explicit Fb2Icon(const QString &name);
+    explicit FbIcon(const QString &name);
 };
 
 namespace FB2 {

+ 16 - 16
source/fb2xml.cpp

@@ -2,10 +2,10 @@
 #include <QtDebug>
 
 //---------------------------------------------------------------------------
-//  Fb2XmlHandler::NodeHandler
+//  FbXmlHandler::NodeHandler
 //---------------------------------------------------------------------------
 
-QString Fb2XmlHandler::NodeHandler::Value(const QXmlAttributes &attributes, const QString &name)
+QString FbXmlHandler::NodeHandler::Value(const QXmlAttributes &attributes, const QString &name)
 {
     int count = attributes.count();
     for (int i = 0; i < count; i++ ) {
@@ -16,7 +16,7 @@ QString Fb2XmlHandler::NodeHandler::Value(const QXmlAttributes &attributes, cons
     return QString();
 }
 
-bool Fb2XmlHandler::NodeHandler::doStart(const QString &name, const QXmlAttributes &attributes)
+bool FbXmlHandler::NodeHandler::doStart(const QString &name, const QXmlAttributes &attributes)
 {
     if (m_handler) return m_handler->doStart(name, attributes);
     m_handler = NewTag(name, attributes);
@@ -31,13 +31,13 @@ bool Fb2XmlHandler::NodeHandler::doStart(const QString &name, const QXmlAttribut
     return true;
 }
 
-bool Fb2XmlHandler::NodeHandler::doText(const QString &text)
+bool FbXmlHandler::NodeHandler::doText(const QString &text)
 {
     if (m_handler) m_handler->doText(text); else TxtTag(text);
     return true;
 }
 
-bool Fb2XmlHandler::NodeHandler::doEnd(const QString &name, bool & exists)
+bool FbXmlHandler::NodeHandler::doEnd(const QString &name, bool & exists)
 {
     if (m_handler) {
         bool found = exists || name == m_name;
@@ -53,21 +53,21 @@ bool Fb2XmlHandler::NodeHandler::doEnd(const QString &name, bool & exists)
 }
 
 //---------------------------------------------------------------------------
-//  Fb2XmlHandler
+//  FbXmlHandler
 //---------------------------------------------------------------------------
 
-Fb2XmlHandler::Fb2XmlHandler()
+FbXmlHandler::FbXmlHandler()
     : QXmlDefaultHandler()
     , m_handler(0)
 {
 }
 
-Fb2XmlHandler::~Fb2XmlHandler()
+FbXmlHandler::~FbXmlHandler()
 {
     if (m_handler) delete m_handler;
 }
 
-bool Fb2XmlHandler::startElement(const QString & namespaceURI, const QString & localName, const QString &qName, const QXmlAttributes &attributes)
+bool FbXmlHandler::startElement(const QString & namespaceURI, const QString & localName, const QString &qName, const QXmlAttributes &attributes)
 {
     Q_UNUSED(namespaceURI);
     Q_UNUSED(localName);
@@ -77,12 +77,12 @@ bool Fb2XmlHandler::startElement(const QString & namespaceURI, const QString & l
     return m_handler;
 }
 
-bool Fb2XmlHandler::isWhiteSpace(const QString &str)
+bool FbXmlHandler::isWhiteSpace(const QString &str)
 {
     return str.simplified().isEmpty();
 }
 
-bool Fb2XmlHandler::characters(const QString &str)
+bool FbXmlHandler::characters(const QString &str)
 {
     QString s = str.simplified();
     if (s.isEmpty()) return true;
@@ -91,7 +91,7 @@ bool Fb2XmlHandler::characters(const QString &str)
     return m_handler && m_handler->doText(s);
 }
 
-bool Fb2XmlHandler::endElement(const QString & namespaceURI, const QString & localName, const QString &qName)
+bool FbXmlHandler::endElement(const QString & namespaceURI, const QString & localName, const QString &qName)
 {
     Q_UNUSED(namespaceURI);
     Q_UNUSED(localName);
@@ -99,7 +99,7 @@ bool Fb2XmlHandler::endElement(const QString & namespaceURI, const QString & loc
     return m_handler && m_handler->doEnd(qName.toLower(), found);
 }
 
-bool Fb2XmlHandler::error(const QXmlParseException& exception)
+bool FbXmlHandler::error(const QXmlParseException& exception)
 {
     qCritical() << QObject::tr("Parse error at line %1, column %2: %3")
        .arg(exception.lineNumber())
@@ -108,7 +108,7 @@ bool Fb2XmlHandler::error(const QXmlParseException& exception)
     return false;
 }
 
-bool Fb2XmlHandler::warning(const QXmlParseException& exception)
+bool FbXmlHandler::warning(const QXmlParseException& exception)
 {
     qWarning() << QObject::tr("Parse error at line %1, column %2: %3")
        .arg(exception.lineNumber())
@@ -117,7 +117,7 @@ bool Fb2XmlHandler::warning(const QXmlParseException& exception)
     return false;
 }
 
-bool Fb2XmlHandler::fatalError(const QXmlParseException &exception)
+bool FbXmlHandler::fatalError(const QXmlParseException &exception)
 {
     qCritical() << QObject::tr("Parse error at line %1, column %2: %3")
        .arg(exception.lineNumber())
@@ -126,7 +126,7 @@ bool Fb2XmlHandler::fatalError(const QXmlParseException &exception)
     return false;
 }
 
-QString Fb2XmlHandler::errorString() const
+QString FbXmlHandler::errorString() const
 {
     return m_error;
 }

+ 3 - 3
source/fb2xml.h

@@ -25,11 +25,11 @@ x::KeywordHash::KeywordHash() {
 
 #define FB2_KEY(key,str) insert(str,key);
 
-class Fb2XmlHandler : public QXmlDefaultHandler
+class FbXmlHandler : public QXmlDefaultHandler
 {
 public:
-    explicit Fb2XmlHandler();
-    virtual ~Fb2XmlHandler();
+    explicit FbXmlHandler();
+    virtual ~FbXmlHandler();
     bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes);
     bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
     bool characters(const QString &str);

BIN
source/ts/ru.qm


+ 78 - 49
source/ts/ru.ts

@@ -2,14 +2,14 @@
 <!DOCTYPE TS>
 <TS version="2.0" language="ru_RU">
 <context>
-    <name>Fb2CodeFindDlg</name>
+    <name>FbCodeFindDlg</name>
     <message>
         <source>Complete words</source>
         <translation>Слова полностью</translation>
     </message>
 </context>
 <context>
-    <name>Fb2Find</name>
+    <name>FbFind</name>
     <message>
         <source>Find</source>
         <translation>Поиск</translation>
@@ -56,7 +56,7 @@
     </message>
 </context>
 <context>
-    <name>Fb2HeadItem</name>
+    <name>FbHeadItem</name>
     <message>
         <source>#</source>
         <translation>№</translation>
@@ -131,7 +131,7 @@
     </message>
 </context>
 <context>
-    <name>Fb2HeadModel</name>
+    <name>FbHeadModel</name>
     <message>
         <source>Key</source>
         <translation>Ключ</translation>
@@ -142,7 +142,7 @@
     </message>
 </context>
 <context>
-    <name>Fb2HeadView</name>
+    <name>FbHeadView</name>
     <message>
         <source>&amp;Append</source>
         <translation type="unfinished">&amp;Добавить</translation>
@@ -157,7 +157,7 @@
     </message>
 </context>
 <context>
-    <name>Fb2MainWindow</name>
+    <name>FbMainWindow</name>
     <message>
         <source>&amp;New</source>
         <translation>&amp;Новый</translation>
@@ -455,9 +455,13 @@
         <source>&amp;Subtitle</source>
         <translation>По&amp;дзаголовок &lt;subtitle&gt;</translation>
     </message>
+    <message>
+        <source>&amp;Epigraph</source>
+        <translation>&amp;Эпиграф &lt;epigraph&gt;</translation>
+    </message>
 </context>
 <context>
-    <name>Fb2NodeDlg</name>
+    <name>FbNodeDlg</name>
     <message>
         <source>Insert tag</source>
         <translation type="unfinished"></translation>
@@ -468,30 +472,22 @@
     </message>
 </context>
 <context>
-    <name>Fb2Note</name>
+    <name>FbNote</name>
     <message>
         <source>Insert footnote</source>
-        <translation>Вставить сноску</translation>
-    </message>
-    <message>
-        <source>about:blank</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Вставить сноску</translation>
     </message>
     <message>
         <source>Identifier:</source>
-        <translation>Идентификатор:</translation>
+        <translation type="obsolete">Идентификатор:</translation>
     </message>
     <message>
         <source>Title:</source>
-        <translation>Заголовок:</translation>
-    </message>
-    <message>
-        <source>TextLabel</source>
-        <translation type="unfinished"></translation>
+        <translation type="obsolete">Заголовок:</translation>
     </message>
 </context>
 <context>
-    <name>Fb2NoteDlg</name>
+    <name>FbNoteDlg</name>
     <message>
         <source>&lt;create new&gt;</source>
         <translation>&lt;создать новый&gt;</translation>
@@ -510,7 +506,7 @@
     </message>
 </context>
 <context>
-    <name>Fb2SaveDialog</name>
+    <name>FbSaveDialog</name>
     <message>
         <source>Fiction book files (*.fb2)</source>
         <translation type="unfinished"></translation>
@@ -525,7 +521,67 @@
     </message>
 </context>
 <context>
-    <name>Fb2TreeView</name>
+    <name>FbTextEdit</name>
+    <message>
+        <source>Common Graphics (*.png *.jpg *.jpeg *.gif);;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Portable Network Graphics (PNG) (*.png);;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>JPEG (*.jpg *.jpeg);;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Graphics Interchange Format (*.gif);;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>All Files (*)</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert image...</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FbTextFrame</name>
+    <message>
+        <source>Web inspector</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FbTextPage</name>
+    <message>
+        <source>Append section</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Append body</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert title</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Insert subtitle</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FbTreeModel</name>
+    <message>
+        <source>Move section</source>
+        <translation type="unfinished"></translation>
+    </message>
+</context>
+<context>
+    <name>FbTreeView</name>
     <message>
         <source>&amp;Insert</source>
         <translation>&amp;Вставка</translation>
@@ -563,33 +619,6 @@
         <translation>&amp;Вставить</translation>
     </message>
 </context>
-<context>
-    <name>Fb2WebView</name>
-    <message>
-        <source>Common Graphics (*.png *.jpg *.jpeg *.gif);;</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Portable Network Graphics (PNG) (*.png);;</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>JPEG (*.jpg *.jpeg);;</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Graphics Interchange Format (*.gif);;</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>All Files (*)</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Insert image...</source>
-        <translation type="unfinished"></translation>
-    </message>
-</context>
 <context>
     <name>QObject</name>
     <message>