File: qt5.patch

package info (click to toggle)
bdbvu 0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 172 kB
  • sloc: cpp: 528; makefile: 4
file content (94 lines) | stat: -rw-r--r-- 2,859 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From b4b27c66016c2009bea7f60a6344e6cc864c3976 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.drung@cloud.ionos.com>
Date: Wed, 16 Aug 2017 11:10:35 +0200
Subject: [PATCH] Support building against Qt5

Qt4 has been deprecated since Qt5's first release on December 19th 2012.
Make the code compile with Qt5.

QString::toAscii() was obsoleted. The function QString::toLatin1() does
the same.
---
 bdbvu.pro      | 1 +
 database.cpp   | 4 ++--
 database.h     | 2 +-
 main.cpp       | 2 +-
 mainwindow.cpp | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/bdbvu.pro b/bdbvu.pro
index d5337cf..84511f9 100644
--- a/bdbvu.pro
+++ b/bdbvu.pro
@@ -25,6 +25,7 @@ HEADERS += mainwindow.h \
     database.h
 FORMS += mainwindow.ui
 DEFINES += HAVE_CXX_STDHEADERS
+QT += widgets
 
 # environment specific settings (OS X)
 osx {
diff --git a/database.cpp b/database.cpp
index 14cfc58..6e69812 100644
--- a/database.cpp
+++ b/database.cpp
@@ -105,7 +105,7 @@ void database::opensubdb(const QString &dbname)
     closesubdb();
     try {
         sdb = new Db(&env, 0);
-        sdb->open(0, filename.toAscii(), dbname.toAscii(), DB_UNKNOWN, DB_RDONLY | DB_RDWRMASTER, 0);
+        sdb->open(0, filename.toLatin1(), dbname.toLatin1(), DB_UNKNOWN, DB_RDONLY | DB_RDWRMASTER, 0);
         buildKeyList();
     } catch (DbException ex) {
         closesubdb();
@@ -132,7 +132,7 @@ static QString makeVisible(const QString& s) {
     QString r;
     foreach (QChar c, s) {
         if (c != QChar('\n') && (c < QChar(' ') || c > QChar('~')))
-            r.append(QString("\\%1").arg(c.toAscii() & 0xff, 2, 16, QChar('0')));
+            r.append(QString("\\%1").arg(c.toLatin1() & 0xff, 2, 16, QChar('0')));
         else if (c == QChar('\\'))
             r.append("\\\\");
         else
diff --git a/database.h b/database.h
index a735e4c..f8b58da 100644
--- a/database.h
+++ b/database.h
@@ -35,7 +35,7 @@ public:
     dbexception(const QString& message) : std::exception() { this->message = message; }
     virtual ~dbexception() throw() {}
 
-    const char* what() const throw() { return message.toAscii(); }
+    const char* what() const throw() { return message.toLatin1(); }
 
 private:
     QString message;
diff --git a/main.cpp b/main.cpp
index e80f721..6c5df04 100644
--- a/main.cpp
+++ b/main.cpp
@@ -18,7 +18,7 @@
 
 */
 
-#include <QtGui/QApplication>
+#include <QApplication>
 #include "mainwindow.h"
 
 int main(int argc, char *argv[])
diff --git a/mainwindow.cpp b/mainwindow.cpp
index ccf58ce..8f17872 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -68,7 +68,7 @@ void MainWindow::openFile(QString filename)
 {
     db.close();
     try {
-        db.open(filename.toAscii());
+        db.open(filename.toLatin1());
     }
     catch (dbexception ex) {
         QMessageBox::critical(this, "BDBVu", ex.what());
-- 
2.11.0