浏览代码

Small changes

Kandrashin Denis 13 年之前
父节点
当前提交
ef790fc85f
共有 6 个文件被更改,包括 90 次插入76 次删除
  1. 1 1
      source/fb2edit.pro
  2. 19 3
      source/fb2xml.cpp
  3. 2 0
      source/fb2xml.h
  4. 1 1
      source/res/fb2edit.qrc
  5. 二进制
      source/ts/ru.qm
  6. 67 71
      source/ts/ru.ts

+ 1 - 1
source/fb2edit.pro

@@ -23,7 +23,7 @@ RESOURCES = \
 
 TARGET = fb2edit
 
-TRANSLATIONS = res/ts/ru.ts
+TRANSLATIONS = ts/ru.ts
 
 VERSION = 0.01.1
 

+ 19 - 3
source/fb2xml.cpp

@@ -20,7 +20,6 @@ bool Fb2XmlHandler::NodeHandler::doStart(const QString &name, const QXmlAttribut
 {
     if (m_handler) return m_handler->doStart(name, attributes);
     m_handler = NewTag(name, attributes); if (m_handler) return true;
-//    qCritical() << QObject::tr("Unknown XML child tag: <%1> <%2>").arg(m_name).arg(name);
     m_handler = new NodeHandler(name);
     return true;
 }
@@ -40,7 +39,6 @@ bool Fb2XmlHandler::NodeHandler::doEnd(const QString &name, bool & exists)
         if (found) { exists = true; return true; }
     }
     bool found = name == m_name;
-    if (!found) qCritical() << QObject::tr("Conglict XML tags: <%1>  </%2>").arg(m_name).arg(name);
     m_closed = found || exists;
     if (m_closed) EndTag(m_name);
     exists = found;
@@ -93,12 +91,30 @@ bool Fb2XmlHandler::endElement(const QString & namespaceURI, const QString & loc
     return m_handler && m_handler->doEnd(qName.toLower(), found);
 }
 
+bool Fb2XmlHandler::error(const QXmlParseException& exception)
+{
+    qCritical() << QObject::tr("Parse error at line %1, column %2: %3")
+       .arg(exception.lineNumber())
+       .arg(exception.columnNumber())
+       .arg(exception.message().simplified());
+    return false;
+}
+
+bool Fb2XmlHandler::warning(const QXmlParseException& exception)
+{
+    qWarning() << QObject::tr("Parse error at line %1, column %2: %3")
+       .arg(exception.lineNumber())
+       .arg(exception.columnNumber())
+       .arg(exception.message().simplified());
+    return false;
+}
+
 bool Fb2XmlHandler::fatalError(const QXmlParseException &exception)
 {
     qCritical() << QObject::tr("Parse error at line %1, column %2: %3")
        .arg(exception.lineNumber())
        .arg(exception.columnNumber())
-       .arg(exception.message());
+       .arg(exception.message().simplified());
     return false;
 }
 

+ 2 - 0
source/fb2xml.h

@@ -31,6 +31,8 @@ public:
     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);
+    bool error(const QXmlParseException& exception);
+    bool warning(const QXmlParseException& exception);
     bool fatalError(const QXmlParseException &exception);
     QString errorString() const;
 

+ 1 - 1
source/res/fb2edit.qrc

@@ -42,7 +42,7 @@
         <file>24/zoom-in.png</file>
         <file>24/zoom-original.png</file>
         <file>24/zoom-out.png</file>
-        <file>ts/ru.qm</file>
         <file>style.css</file>
+		<file alias ="ts/ru.qm">../ts/ru.qm</file>
     </qresource>
 </RCC>

二进制
source/res/ts/ru.qm → source/ts/ru.qm


+ 67 - 71
source/res/ts/ru.ts → source/ts/ru.ts

@@ -4,298 +4,294 @@
 <context>
     <name>Fb2MainWindow</name>
     <message>
-        <location filename="../fb2main.cpp" line="65"/>
+        <location filename="../fb2main.cpp" line="66"/>
         <source>Message log</source>
         <translation>Информационные сообщения</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="172"/>
+        <location filename="../fb2main.cpp" line="173"/>
         <source>Save As...</source>
         <translation>Сохранить как...</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="179"/>
+        <location filename="../fb2main.cpp" line="180"/>
         <source>About fb2edit</source>
         <translation>О программе...</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="180"/>
+        <location filename="../fb2main.cpp" line="181"/>
         <source>The &lt;b&gt;fb2edit&lt;/b&gt; is application for editing FB2-files.</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="209"/>
+        <location filename="../fb2main.cpp" line="210"/>
         <source>&amp;File</source>
         <translation>&amp;Файл</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="210"/>
+        <location filename="../fb2main.cpp" line="211"/>
         <source>File</source>
         <translation>Файл</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="212"/>
+        <location filename="../fb2main.cpp" line="213"/>
         <source>&amp;New</source>
         <translation>&amp;Новый</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="215"/>
+        <location filename="../fb2main.cpp" line="216"/>
         <source>Create a new file</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="220"/>
+        <location filename="../fb2main.cpp" line="221"/>
         <source>&amp;Open...</source>
         <translation>&amp;Открыть...</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="222"/>
+        <location filename="../fb2main.cpp" line="223"/>
         <source>Open an existing file</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="227"/>
+        <location filename="../fb2main.cpp" line="228"/>
         <source>&amp;Save</source>
         <translation>&amp;Сохранить</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="229"/>
+        <location filename="../fb2main.cpp" line="230"/>
         <source>Save the document to disk</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="234"/>
+        <location filename="../fb2main.cpp" line="235"/>
         <source>Save &amp;As...</source>
         <translation>Сохрать &amp;как...</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="236"/>
+        <location filename="../fb2main.cpp" line="237"/>
         <source>Save the document under a new name</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="242"/>
+        <location filename="../fb2main.cpp" line="243"/>
         <source>&amp;Close</source>
         <translation>&amp;Закрыть</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="244"/>
+        <location filename="../fb2main.cpp" line="245"/>
         <source>Close this window</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="248"/>
+        <location filename="../fb2main.cpp" line="249"/>
         <source>E&amp;xit</source>
         <translation>&amp;Выход</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="250"/>
+        <location filename="../fb2main.cpp" line="251"/>
         <source>Exit the application</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="254"/>
+        <location filename="../fb2main.cpp" line="255"/>
         <source>&amp;Edit</source>
         <translation>&amp;Правка</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="255"/>
+        <location filename="../fb2main.cpp" line="256"/>
         <source>Edit</source>
         <translation>Правка</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="259"/>
+        <location filename="../fb2main.cpp" line="260"/>
         <source>&amp;Undo</source>
         <translation>&amp;Отменить</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="266"/>
+        <location filename="../fb2main.cpp" line="267"/>
         <source>&amp;Redo</source>
         <translation>&amp;Повторить</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="276"/>
+        <location filename="../fb2main.cpp" line="277"/>
         <source>Cu&amp;t</source>
         <translation>Вы&amp;резать</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="279"/>
+        <location filename="../fb2main.cpp" line="280"/>
         <source>Cut the current selection&apos;s contents to the clipboard</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="284"/>
+        <location filename="../fb2main.cpp" line="285"/>
         <source>&amp;Copy</source>
         <translation>&amp;Копировать</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="287"/>
+        <location filename="../fb2main.cpp" line="288"/>
         <source>Copy the current selection&apos;s contents to the clipboard</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="292"/>
+        <location filename="../fb2main.cpp" line="293"/>
         <source>&amp;Paste</source>
         <translation>&amp;Вставить</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="295"/>
+        <location filename="../fb2main.cpp" line="296"/>
         <source>Paste the clipboard&apos;s contents into the current selection</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="300"/>
+        <location filename="../fb2main.cpp" line="301"/>
         <source>Fo&amp;rmat</source>
         <translation>Фо&amp;рмат</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="301"/>
+        <location filename="../fb2main.cpp" line="302"/>
         <source>Format</source>
         <translation>Формат</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="303"/>
+        <location filename="../fb2main.cpp" line="304"/>
         <source>Bold</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="309"/>
+        <location filename="../fb2main.cpp" line="310"/>
         <source>Italic</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="315"/>
+        <location filename="../fb2main.cpp" line="316"/>
         <source>Strikethrough</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="320"/>
+        <location filename="../fb2main.cpp" line="321"/>
         <source>Superscript</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="325"/>
+        <location filename="../fb2main.cpp" line="326"/>
         <source>Subscript</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="330"/>
+        <location filename="../fb2main.cpp" line="331"/>
         <source>&amp;View</source>
         <translation>&amp;Вид</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="332"/>
+        <location filename="../fb2main.cpp" line="333"/>
         <source>&amp;Text</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="336"/>
+        <location filename="../fb2main.cpp" line="337"/>
         <source>&amp;XML</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="349"/>
+        <location filename="../fb2main.cpp" line="350"/>
         <source>Zoom</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="351"/>
+        <location filename="../fb2main.cpp" line="352"/>
         <source>Zoom in</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="356"/>
+        <location filename="../fb2main.cpp" line="357"/>
         <source>Zoom out</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="361"/>
+        <location filename="../fb2main.cpp" line="362"/>
         <source>Zoom original</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="367"/>
+        <location filename="../fb2main.cpp" line="368"/>
         <source>Web inspector</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="373"/>
+        <location filename="../fb2main.cpp" line="374"/>
         <source>&amp;Help</source>
         <translation>&amp;?</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="375"/>
+        <location filename="../fb2main.cpp" line="376"/>
         <source>&amp;About</source>
         <translation>&amp;О программа...</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="376"/>
+        <location filename="../fb2main.cpp" line="377"/>
         <source>Show the application&apos;s About box</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="380"/>
+        <location filename="../fb2main.cpp" line="381"/>
         <source>About &amp;Qt</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="381"/>
+        <location filename="../fb2main.cpp" line="382"/>
         <source>Show the Qt library&apos;s About box</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="393"/>
+        <location filename="../fb2main.cpp" line="394"/>
         <source>Contents</source>
         <translation>Содержание</translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="518"/>
+        <location filename="../fb2main.cpp" line="519"/>
         <source>Ready</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="541"/>
-        <location filename="../fb2main.cpp" line="559"/>
-        <source>SDI</source>
-        <translation></translation>
-    </message>
-    <message>
-        <location filename="../fb2main.cpp" line="542"/>
+        <location filename="../fb2main.cpp" line="543"/>
         <source>The document has been modified. Do you want to save your changes?</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2main.cpp" line="559"/>
+        <location filename="../fb2main.cpp" line="558"/>
         <source>Cannot write file %1: %2.</source>
         <translation></translation>
     </message>
-    <message>
-        <location filename="../fb2main.cpp" line="569"/>
-        <source>File saved</source>
-        <translation></translation>
-    </message>
 </context>
 <context>
     <name>QObject</name>
     <message>
-        <location filename="../fb2read.cpp" line="44"/>
+        <location filename="../fb2read.cpp" line="41"/>
         <source>Cannot read file %1: %2.</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2read.cpp" line="152"/>
-        <source>Conglict XML tags: &lt;%1&gt; - &lt;/%2&gt;</source>
-        <translation></translation>
-    </message>
-    <message>
-        <location filename="../fb2read.cpp" line="398"/>
+        <location filename="../fb2read.cpp" line="378"/>
         <source>The file is not an FB2 file.</source>
         <translation></translation>
     </message>
     <message>
-        <location filename="../fb2read.cpp" line="427"/>
+        <location filename="../fb2xml.cpp" line="96"/>
+        <location filename="../fb2xml.cpp" line="105"/>
+        <location filename="../fb2xml.cpp" line="114"/>
         <source>Parse error at line %1, column %2: %3</source>
         <translation></translation>
     </message>
+    <message>
+        <location filename="../fb2save.cpp" line="198"/>
+        <source>The tag &lt;body&gt; was not found.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../fb2view.cpp" line="105"/>
+        <source>Cannot write file %1: %2.</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 </TS>