Procházet zdrojové kódy

Merge pull request #7 from vitlav/master

Qt5 build patches
Kandrashin Denis před 3 roky
rodič
revize
378ed15f58
11 změnil soubory, kde provedl 124 přidání a 104 odebrání
  1. 1 0
      AUTHORS
  2. 28 15
      CMakeLists.txt
  3. 1 5
      README
  4. 2 1
      fb2edit.pro
  5. 4 4
      source/fb2app.cpp
  6. 1 1
      source/fb2app.hpp
  7. 2 1
      source/fb2code.cpp
  8. 1 0
      source/fb2logs.cpp
  9. 3 0
      source/fb2main.cpp
  10. binární
      source/ts/ru.qm
  11. 81 77
      source/ts/ru.ts

+ 1 - 0
AUTHORS

@@ -1 +1,2 @@
 Denis Kandrashin <mail@lintest.ru>
+Aleksei Vasiliev <aleksvassiliev@gmail.com>

+ 28 - 15
CMakeLists.txt

@@ -7,21 +7,29 @@
 #
 #########################################################
 
-cmake_minimum_required(VERSION 2.6.0)
+cmake_minimum_required(VERSION 3.1.0)
 
 project(fb2edit)
-set(PACKAGE_VERSION "0.0.9")
+set(PACKAGE_VERSION "0.1.0")
 set(PACKAGE_VENDOR "LinTest")
 set(PACKAGE_NAME ${PROJECT_NAME})
 set(PACKAGE_STRING "${PROJECT_NAME} ${PACKAGE_VERSION}")
-set(PACKAGE_BUGREPORT "mail@lintest.ru")
+set(PACKAGE_BUGREPORT "lav@etersoft.ru")
 
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_AUTOUIC ON)
+
+if(CMAKE_VERSION VERSION_LESS "3.7.0")
+    set(CMAKE_INCLUDE_CURRENT_DIR ON)
+endif()
+    
 message( STATUS "PACKAGE_NAME = ${PACKAGE_STRING}")
 
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/cmake)
 
-find_program( QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac )
-find_package( Qt4 4.6.0 COMPONENTS QtCore QtGui QtNetwork QtWebkit QtXml QtXmlPatterns REQUIRED )
+#find_program( QT_QMAKE_EXECUTABLE NAMES qmake5 qmake-qt5 qmake-mac )
+find_package( Qt5 5.5.0 COMPONENTS Core Gui Network Widgets WebKitWidgets Xml XmlPatterns LinguistTools REQUIRED )
 find_package( LibXML2 )
 
 file( GLOB FB2_HEAD source/*.hpp     )
@@ -29,7 +37,7 @@ file( GLOB FB2_SRCS source/*.cpp     )
 file( GLOB FB2_UIS  source/*.ui      )
 file( GLOB FB2_TSS  source/ts/*.ts   )
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GTK_PKG_FLAGS}")
+#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GTK_PKG_FLAGS}")
 
 if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
     exec_program("git --git-dir=${CMAKE_SOURCE_DIR}/.git log --format=%ai//%h%d -1" OUTPUT_VARIABLE COMMIT_INFO)
@@ -50,21 +58,26 @@ set(CMAKE_IN_SOURCE_BUILD TRUE)
 
 add_definitions(-Wall -g)
 
-qt4_wrap_ui(UI_HEADERS ${FB2_UIS})
-qt4_wrap_cpp(MOC_SRCS ${FB2_HEAD})
-qt4_add_resources(RCC_SRCS ${FB2_RES})
-qt4_add_translation(QMS_FILES ${FB2_TSS})
+qt5_wrap_ui(UI_HEADERS ${FB2_UIS})
+qt5_wrap_cpp(MOC_SRCS ${FB2_HEAD})
+qt5_add_resources(RCC_SRCS ${FB2_RES})
+qt5_add_translation(QMS_FILES ${FB2_TSS})
+
+message( STATUS "PACKAGE_NAME_ = ${CMAKE_PREFIX_PATH}")
 
 add_executable(fb2edit ${FB2_SRCS} ${FB2_HEAD} ${UI_HEADERS} ${MOC_SRCS} ${RCC_SRCS} ${QMS_FILES})
 
-include(${QT_USE_FILE})
+#include(${QT_USE_FILE})
+#include_directories(${QT_INCLUDES})
 include_directories(${CMAKE_BINARY_DIR})
-target_link_libraries(fb2edit ${QT_LIBRARIES})
-add_definitions(${QT_DEFINITIONS})
+target_link_libraries(fb2edit PUBLIC
+    Qt5::Core Qt5::Gui Qt5::Network Qt5::Widgets Qt5::WebKitWidgets Qt5::Xml Qt5::XmlPatterns
+    ${LIBXML2_LIBRARIES}
+    )
+#add_definitions(${QT_DEFINITIONS})
 
+include_directories(${LIBXML2_INCLUDE_DIRS})
 if (LIBXML2_FOUND) 
-    include_directories(${LIBXML2_INCLUDE_DIRS})
-    target_link_libraries(fb2edit ${LIBXML2_LIBRARIES})
     add_definitions(${LIBXML2_DEFINITIONS})
     add_definitions(-DFB2_USE_LIBXML2)
 endif (LIBXML2_FOUND) 

+ 1 - 5
README

@@ -1,9 +1,5 @@
-fb2edit 0.0.9 (c) Denis Kandrashin, 2014
+fork of fb2edit 0.0.9 (http://fb2edit.lintest.ru)
 
 Distribution: source codes are distributed under the terms 
   of GNU General Public License (GPL).
   See LICENSE file for details.
-
-Project homepage: http://fb2edit.lintest.ru
-
-You can contact author by email: mail@lintest.ru

+ 2 - 1
fb2edit.pro

@@ -52,8 +52,9 @@ TARGET = fb2edit
 
 TRANSLATIONS = source/ts/ru.ts
 
+QT += widgets
 QT += xml
-QT += webkit
+QT += webkitwidgets
 QT += network
 QT += xmlpatterns
 

+ 4 - 4
source/fb2app.cpp

@@ -21,12 +21,12 @@ QString FbApplication::lastCommit()
 #endif  // PACKAGE_VERSION
 }
 
-void FbApplication::handleMessage(QtMsgType type, const char *msg)
+void FbApplication::handleMessage(QtMsgType type, const QString& msg)
 {
-    emit logMessage(type, QString::fromUtf8(msg));
+    emit logMessage(type, msg);
 }
 
-static void fb2MessageHandler(QtMsgType type, const char *msg)
+static void fb2MessageHandler(QtMsgType type, const QMessageLogContext&, const QString& msg)
 {
     ((FbApplication*)qApp)->handleMessage(type, msg);
 }
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
     }
     if (count == 1) (new FbMainWindow)->show();
 
-    qInstallMsgHandler(fb2MessageHandler);
+    qInstallMessageHandler(fb2MessageHandler);
 
     return app.exec();
 }

+ 1 - 1
source/fb2app.hpp

@@ -11,7 +11,7 @@ public:
     FbApplication(int &argc, char **argv, int = QT_VERSION)
         : QApplication(argc, argv, QT_VERSION) {}
 
-    void handleMessage(QtMsgType type, const char *msg);
+    void handleMessage(QtMsgType type, const QString& msg);
 
     static QString lastCommit();
 

+ 2 - 1
source/fb2code.cpp

@@ -1,5 +1,6 @@
 #include "fb2code.hpp"
 
+#include <QApplication>
 #include <QXmlSchema>
 #include <QAbstractMessageHandler>
 #include <QXmlSchemaValidator>
@@ -238,7 +239,7 @@ void FbHighlighter::highlightBlock(const QString& text)
     const int len = text.length();
     for (; i < len; ++i)
     {
-        switch (text.at(i).toAscii())
+        switch (text.at(i).toLatin1())
         {
         case '<':
             ++brackets;

+ 1 - 0
source/fb2logs.cpp

@@ -9,6 +9,7 @@
 QVariant FbLogModel::FbLogItem::icon() const
 {
     switch (m_type) {
+        case QtInfoMsg: return QVariant();
         case QtDebugMsg: return FbIcon("dialog-information");
         case QtWarningMsg: return FbIcon("dialog-warning");
         case QtCriticalMsg: return FbIcon("dialog-error");

+ 3 - 0
source/fb2main.cpp

@@ -4,6 +4,9 @@
 #include <QtDebug>
 #include <QTreeView>
 #include <QWebFrame>
+#include <QMessageBox>
+#include <QMenuBar>
+#include <QStatusBar>
 
 #include "fb2app.hpp"
 #include "fb2logs.hpp"

binární
source/ts/ru.qm


+ 81 - 77
source/ts/ru.ts

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="ru_RU">
+<TS version="2.1" language="ru_RU">
 <context>
     <name>FbAuthorDlg</name>
     <message>
@@ -36,11 +36,11 @@
     <name>FbCodeEdit</name>
     <message>
         <source>Schema is not valid: </source>
-        <translation type="unfinished"></translation>
+        <translation>Схема некорректна: </translation>
     </message>
     <message>
         <source>Validation successful</source>
-        <translation>Проверка выполнена успешно </translation>
+        <translation>Проверка выполнена успешно</translation>
     </message>
 </context>
 <context>
@@ -82,7 +82,7 @@
     </message>
     <message>
         <source>&amp;Case sensitive </source>
-        <translation>С &amp;учетом регистра</translation>
+        <translation>С &amp;учётом регистра</translation>
     </message>
     <message>
         <source>&amp;Highlights all</source>
@@ -101,15 +101,15 @@
     <name>FbHeadEdit</name>
     <message>
         <source>&amp;Append</source>
-        <translation type="unfinished">&amp;Добавить</translation>
+        <translation>&amp;Добавить</translation>
     </message>
     <message>
         <source>&amp;Modify</source>
-        <translation type="unfinished">&amp;Изменить</translation>
+        <translation>&amp;Изменить</translation>
     </message>
     <message>
         <source>&amp;Delete</source>
-        <translation type="unfinished">&amp;Удалить</translation>
+        <translation>&amp;Удалить</translation>
     </message>
 </context>
 <context>
@@ -215,15 +215,15 @@
     </message>
     <message>
         <source>Can edit</source>
-        <translation type="unfinished"></translation>
+        <translation>Можно редактировать</translation>
     </message>
     <message>
         <source>Min</source>
-        <translation type="unfinished"></translation>
+        <translation>Мин</translation>
     </message>
     <message>
         <source>Max</source>
-        <translation type="unfinished"></translation>
+        <translation>Макс</translation>
     </message>
 </context>
 <context>
@@ -245,58 +245,58 @@
     <name>FbImageDlg</name>
     <message>
         <source>File name:</source>
-        <translation type="unfinished"></translation>
+        <translation>Имя файла:</translation>
     </message>
     <message>
         <source>Insert picture</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить изображение</translation>
     </message>
     <message>
         <source>Select file</source>
-        <translation type="unfinished"></translation>
+        <translation>Выбрать файл</translation>
     </message>
     <message>
         <source>From collection</source>
-        <translation type="unfinished"></translation>
+        <translation>Из коллекции</translation>
     </message>
     <message>
         <source>Common Graphics (*.png *.jpg *.jpeg *.gif)</source>
-        <translation type="unfinished"></translation>
+        <translation>Все графические форматы (*.png *.jpg *.jpeg *.gif)</translation>
     </message>
     <message>
         <source>Portable Network Graphics (PNG) (*.png)</source>
-        <translation type="unfinished"></translation>
+        <translation>Portable Network Graphics (PNG) (*.png)</translation>
     </message>
     <message>
         <source>JPEG (*.jpg *.jpeg)</source>
-        <translation type="unfinished"></translation>
+        <translation>JPEG (*.jpg *.jpeg)</translation>
     </message>
     <message>
         <source>Graphics Interchange Format (*.gif)</source>
-        <translation type="unfinished"></translation>
+        <translation>Graphics Interchange Format (*.gif)</translation>
     </message>
     <message>
         <source>All Files (*)</source>
-        <translation type="unfinished"></translation>
+        <translation>Все файлы (*)</translation>
     </message>
     <message>
         <source>Insert image...</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить изображение...</translation>
     </message>
 </context>
 <context>
     <name>FbImgsModel</name>
     <message>
         <source>File name</source>
-        <translation type="unfinished">Имя файла</translation>
+        <translation>Имя файла</translation>
     </message>
     <message>
         <source>Type</source>
-        <translation type="unfinished">Тип</translation>
+        <translation>Тип</translation>
     </message>
     <message>
         <source>Size</source>
-        <translation type="unfinished">Размер</translation>
+        <translation>Размер</translation>
     </message>
 </context>
 <context>
@@ -406,7 +406,7 @@
     </message>
     <message>
         <source>&amp;About</source>
-        <translation>&amp;О программе...</translation>
+        <translation>&amp;О программе</translation>
     </message>
     <message>
         <source>&amp;Close</source>
@@ -494,7 +494,7 @@
     </message>
     <message>
         <source>About fb2edit</source>
-        <translation>О программе...</translation>
+        <translation>О программе</translation>
     </message>
     <message>
         <source>&amp;Settings</source>
@@ -643,7 +643,7 @@
     </message>
     <message>
         <source>Clear format</source>
-        <translation>&amp;Очистить формат</translation>
+        <translation>Очистить формат</translation>
     </message>
     <message>
         <source>Paste (no style)</source>
@@ -668,41 +668,45 @@
     </message>
     <message>
         <source>&amp;HTML</source>
-        <translation type="unfinished"></translation>
+        <translation>&amp;HTML</translation>
     </message>
     <message>
         <source>&lt;b&gt;fb2edit&lt;/b&gt; is an application for creating and editing FB2-files.</source>
-        <translation type="unfinished"></translation>
+        <translation>&lt;b&gt;fb2edit&lt;/b&gt; это приложение для создания и редактирования файлов FB2.</translation>
     </message>
     <message>
         <source>&amp;Check...</source>
-        <translation type="unfinished"></translation>
+        <translation>&amp;Проверить...</translation>
     </message>
     <message>
         <source>&amp;Footnotes</source>
         <translation>&amp;Сноски</translation>
     </message>
+    <message>
+        <source>&amp;Export HTML</source>
+        <translation>&amp;Экспорт в HTML</translation>
+    </message>
 </context>
 <context>
     <name>FbNodeDlg</name>
     <message>
         <source>Insert tag</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить тэг</translation>
     </message>
     <message>
         <source>Tag name:</source>
-        <translation type="unfinished"></translation>
+        <translation>Название тэга:</translation>
     </message>
 </context>
 <context>
     <name>FbNodeEditDlg</name>
     <message>
         <source>Modify tag</source>
-        <translation type="unfinished"></translation>
+        <translation>Изменить тэг</translation>
     </message>
     <message>
         <source>Value:</source>
-        <translation type="unfinished"></translation>
+        <translation>Значение:</translation>
     </message>
 </context>
 <context>
@@ -758,22 +762,22 @@
     <name>FbSaveDialog</name>
     <message>
         <source>Fiction book files (*.fb2)</source>
-        <translation type="unfinished"></translation>
+        <translation>Файлы Fiction book (*.fb2)</translation>
     </message>
     <message>
         <source>Any files (*.*)</source>
-        <translation type="unfinished"></translation>
+        <translation>Все файлы (*.*)</translation>
     </message>
     <message>
         <source>&amp;Encoding</source>
-        <translation type="unfinished"></translation>
+        <translation>&amp;Кодировка</translation>
     </message>
 </context>
 <context>
     <name>FbSetup</name>
     <message>
         <source>Settings</source>
-        <translation type="unfinished">Настройки</translation>
+        <translation>Настройки</translation>
     </message>
     <message>
         <source>Tab 1</source>
@@ -781,11 +785,11 @@
     </message>
     <message>
         <source>Default font:</source>
-        <translation type="unfinished"></translation>
+        <translation>Шрифт по умолчанию:</translation>
     </message>
     <message>
         <source>Style file name:</source>
-        <translation type="unfinished"></translation>
+        <translation>Название файла со стилями:</translation>
     </message>
     <message>
         <source>Tab 2</source>
@@ -796,77 +800,81 @@
     <name>FbTextEdit</name>
     <message>
         <source>Insert hyperlink</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить гиперссылку</translation>
     </message>
     <message>
         <source>URL:</source>
-        <translation type="unfinished"></translation>
+        <translation>URL:</translation>
     </message>
     <message>
         <source>Fo&amp;rmat</source>
-        <translation type="unfinished">Фо&amp;рмат</translation>
+        <translation>Фо&amp;рмат</translation>
     </message>
     <message>
         <source>Contents</source>
-        <translation type="unfinished">Содержание</translation>
+        <translation>Содержание</translation>
     </message>
     <message>
         <source>Pictures</source>
-        <translation type="unfinished">Иллюстрации</translation>
+        <translation>Иллюстрации</translation>
     </message>
     <message>
         <source>Web inspector</source>
-        <translation type="unfinished"></translation>
+        <translation>Инспектор</translation>
     </message>
     <message>
         <source>Footnotes</source>
         <translation>Сноски</translation>
     </message>
+    <message>
+        <source>Save As...</source>
+        <translation>Сохранить как...</translation>
+    </message>
 </context>
 <context>
     <name>FbTextPage</name>
     <message>
         <source>Append section</source>
-        <translation type="unfinished"></translation>
+        <translation>Добавить секцию</translation>
     </message>
     <message>
         <source>Append body</source>
-        <translation type="unfinished"></translation>
+        <translation>Добавить тело</translation>
     </message>
     <message>
         <source>Insert title</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить заголовок</translation>
     </message>
     <message>
         <source>Insert subtitle</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить подзаголовок</translation>
     </message>
     <message>
         <source>Insert poem</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить стих</translation>
     </message>
     <message>
         <source>Append stanza</source>
-        <translation type="unfinished"></translation>
+        <translation>Добавить строфу</translation>
     </message>
     <message>
         <source>Insert epigraph</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить эпиграф</translation>
     </message>
     <message>
         <source>Create &lt;%1&gt;</source>
-        <translation type="unfinished"></translation>
+        <translation>Создать &lt;%1&gt;</translation>
     </message>
     <message>
         <source>Remove section</source>
-        <translation type="unfinished">Удалить секцию</translation>
+        <translation>Удалить секцию</translation>
     </message>
 </context>
 <context>
     <name>FbTreeModel</name>
     <message>
         <source>Move section</source>
-        <translation type="unfinished"></translation>
+        <translation>Переместить секцию</translation>
     </message>
 </context>
 <context>
@@ -941,86 +949,82 @@
     </message>
     <message>
         <source>+ Simple text</source>
-        <translation type="unfinished"></translation>
+        <translation>+ Простой текст</translation>
     </message>
 </context>
 <context>
     <name>QObject</name>
     <message>
         <source>The file is not an FB2 file.</source>
-        <translation></translation>
+        <translation>Файл не является файлом FB2.</translation>
     </message>
     <message>
         <source>Cannot read file %1: %2.</source>
         <translation></translation>
     </message>
-    <message>
-        <source>Parse error at line %1, column %2: %3</source>
-        <translation></translation>
-    </message>
     <message>
         <source>The tag &lt;html&gt; was not found.</source>
-        <translation type="unfinished"></translation>
+        <translation>Тэг &lt;html&gt; не найден.</translation>
     </message>
     <message>
         <source>&amp;Undo</source>
-        <translation type="unfinished">&amp;Отменить</translation>
+        <translation>&amp;Отменить</translation>
     </message>
     <message>
         <source>&amp;Redo</source>
-        <translation type="unfinished">&amp;Повторить</translation>
+        <translation>&amp;Повторить</translation>
     </message>
     <message>
         <source>Cu&amp;t</source>
-        <translation type="unfinished">Вы&amp;резать</translation>
+        <translation>Вы&amp;резать</translation>
     </message>
     <message>
         <source>Cut the current selection&apos;s contents to the clipboard</source>
-        <translation type="unfinished"></translation>
+        <translation>Вырезать выделенное содержимое в буфер обмена</translation>
     </message>
     <message>
         <source>&amp;Copy</source>
-        <translation type="unfinished">&amp;Копировать</translation>
+        <translation>&amp;Копировать</translation>
     </message>
     <message>
         <source>Copy the current selection&apos;s contents to the clipboard</source>
-        <translation type="unfinished"></translation>
+        <translation>Скопировать выделенное содержимое в буфер обмена</translation>
     </message>
     <message>
         <source>&amp;Paste</source>
-        <translation type="unfinished">&amp;Вставить</translation>
+        <translation>&amp;Вставить</translation>
     </message>
     <message>
         <source>Paste the clipboard&apos;s contents into the current selection</source>
-        <translation type="unfinished"></translation>
+        <translation>Вставить содержимое буфера обмена в текущее выделение</translation>
     </message>
     <message>
         <source>&amp;Bold</source>
-        <translation type="unfinished">&amp;Жирный</translation>
+        <translation>&amp;Жирный</translation>
     </message>
     <message>
         <source>&amp;Italic</source>
-        <translation type="unfinished">&amp;Курсив</translation>
+        <translation>&amp;Курсив</translation>
     </message>
     <message>
         <source>&amp;Strikethrough</source>
-        <translation type="unfinished">&amp;Зачеркнутый</translation>
+        <translation>&amp;Зачёркнутый</translation>
     </message>
     <message>
         <source>Su&amp;perscript</source>
-        <translation type="unfinished">&amp;Верхний индекс</translation>
+        <translation>&amp;Верхний индекс</translation>
     </message>
     <message>
         <source>Su&amp;bscript</source>
-        <translation type="unfinished">&amp;Нижний индекс</translation>
+        <translation>&amp;Нижний индекс</translation>
     </message>
     <message>
         <source>Unknown image format: %1</source>
-        <translation type="unfinished"></translation>
+        <translation>Неизвестный формат изображения: %1</translation>
     </message>
     <message>
         <source>Clear format</source>
-        <translation type="unfinished">&amp;Очистить формат</translation>
+        <translation>Очистить формат</translation>
     </message>
 </context>
 </TS>