Explorar o código

Migrating to Qt5.5

Alexey Vasiliev %!s(int64=6) %!d(string=hai) anos
pai
achega
5d8c39f9b1
Modificáronse 5 ficheiros con 12 adicións e 7 borrados
  1. 2 1
      fb2edit.pro
  2. 4 4
      source/fb2app.cpp
  3. 1 1
      source/fb2app.hpp
  4. 2 1
      source/fb2code.cpp
  5. 3 0
      source/fb2main.cpp

+ 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;

+ 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"