Page 1 of 1

Compiling GUI on lastest QT

PostPosted: Tue Apr 07, 2015 1:08 am
by spin7ion
Hello, there!

I tried to compile GUI on lastest ubuntu with updated libs from repos. That throw me plenty of such errors:
Code: Select all
/DSLogic-gui/main.cpp:33:30: fatal error: QtGui/QApplication: No such file or directory
 #include <QtGui/QApplication>
                              ^
compilation terminated.
make[2]: *** [CMakeFiles/DSLogic.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/DSLogic.dir/all] Error 2
make: *** [all] Error 2

After replacing
Code: Select all
#include <QtGui/QApplication>

on
Code: Select all
#include <QApplication>

as recommended for lastest QT(http://www.qtcentre.org/threads/53452-QtGui-QApplication-No-such-file-or-directorty) I get plenty errors about ASCII to UTF8 conversions in toolbars and window names.
I had to replace conversions with unconverted strings as lastest QT use utf8 out of the box: http://www.qtcentre.org/threads/55805-error-UnicodeUTF8-is-not-a-member-of-QApplication.

Could you please fix it in next release. I can send you fixed code, if you wish.

Re: Compiling GUI on lastest QT

PostPosted: Tue Apr 07, 2015 5:43 pm
by Anders
Please, post a pull-request on github. That allow everyone to benefit from your effort to cleanup the code.

Though, don't really expect something from DreamSource; they've been quiet for far too long now.

Re: Compiling GUI on lastest QT

PostPosted: Wed Apr 15, 2015 10:48 pm
by Andy
Sorry for a long time without any update and news.
We are back for working on this project.
Any fixes and update please post a pull-request on our new repo:
https://github.com/DreamSourceLab/DSView

Thanks.

Re: Compiling GUI on lastest QT

PostPosted: Fri Apr 17, 2015 9:41 am
by iplayfast
The problem is that the code has been made for QT4, most people use QT5 now.
I've attached a patch file that resolves all the issues. Just apply it to your repository, or add the changes by hand. There aren't many.

Well I tried to add a patch file, but this forum won't allow extensions patch or txt. So here it is.
Code: Select all
diff --git a/DSView/main.cpp b/DSView/main.cpp
index 3964880..58f06e2 100644
--- a/DSView/main.cpp
+++ b/DSView/main.cpp
@@ -30,7 +30,7 @@
 
 #include <getopt.h>
 
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QDebug>
 #include <QFile>
 #include <QDir>
diff --git a/DSView/pv/devicemanager.cpp b/DSView/pv/devicemanager.cpp
index 6bee8b7..f47cfb4 100644
--- a/DSView/pv/devicemanager.cpp
+++ b/DSView/pv/devicemanager.cpp
@@ -31,7 +31,7 @@
 #include <stdexcept>
 #include <string>
 
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QObject>
 #include <QDebug>
 #include <QDir>
diff --git a/DSView/pv/mainwindow.cpp b/DSView/pv/mainwindow.cpp
index 7a0c940..fd37f0c 100644
--- a/DSView/pv/mainwindow.cpp
+++ b/DSView/pv/mainwindow.cpp
@@ -225,8 +225,7 @@ void MainWindow::setup_ui()
    // Set the title
     QString title = QApplication::applicationName()+" v"+QApplication::applicationVersion();
     std::string std_title = title.toStdString();
-    setWindowTitle(QApplication::translate("MainWindow", std_title.c_str(), 0,
-      QApplication::UnicodeUTF8));
+    setWindowTitle(QApplication::translate("MainWindow", std_title.c_str(), 0));
 
    // Setup _session events
    connect(&_session, SIGNAL(capture_state_changed(int)), this,
@@ -522,7 +521,7 @@ void MainWindow::on_screenShot()
                        tr("%1 Files (*.%2);;All Files (*)")
                        .arg(format.toUpper()).arg(format));
     if (!fileName.isEmpty())
-        pixmap.save(fileName, format.toAscii());
+        pixmap.save(fileName, format.toLatin1().constData());
 }
 
 void MainWindow::on_save()
diff --git a/DSView/pv/prop/int.cpp b/DSView/pv/prop/int.cpp
index 5c0dc7d..e468fdc 100644
--- a/DSView/pv/prop/int.cpp
+++ b/DSView/pv/prop/int.cpp
@@ -31,21 +31,43 @@
 
 using boost::optional;
 using namespace std;
-
+#ifndef INT8_MIN
 #define INT8_MIN    (-0x7f - 1)
+#endif
+#ifndef INT16_MIN
 #define INT16_MIN   (-0x7fff - 1)
+#endif
+#ifndef INT32_MIN
 #define INT32_MIN   (-0x7fffffff - 1)
+#endif
+#ifndef INT64_MIN
 #define INT64_MIN   (-0x7fffffffffffffff - 1)
-
+#endif
+#ifndef INT8_MAX
 #define INT8_MAX    0x7f
+#endif
+#ifndef INT16_MAX
 #define INT16_MAX   0x7fff
+#endif
+#ifndef INT32_MAX   
 #define INT32_MAX   0x7fffffff
+#endif
+#ifndef INT64_MAX   
 #define INT64_MAX   0x7fffffffffffffff
+#endif
 
+#ifndef UINT8_MAX   
 #define UINT8_MAX   0xff
+#endif
+#ifndef UINT16_MAX 
 #define UINT16_MAX  0xffff
+#endif
+#ifndef UINT32_MAX 
 #define UINT32_MAX  0xffffffff
+#endif
+#ifndef UINT64_MAX 
 #define UINT64_MAX  0xffffffffffffffff
+#endif
 
 namespace pv {
 namespace prop {
diff --git a/DSView/pv/toolbars/filebar.cpp b/DSView/pv/toolbars/filebar.cpp
index 736b57b..134a11a 100644
--- a/DSView/pv/toolbars/filebar.cpp
+++ b/DSView/pv/toolbars/filebar.cpp
@@ -48,7 +48,7 @@ FileBar::FileBar(SigSession &session, QWidget *parent) :
 
     _action_open = new QAction(this);
     _action_open->setText(QApplication::translate(
-        "File", "&Open...", 0, QApplication::UnicodeUTF8));
+        "File", "&Open...", 0));
     _action_open->setIcon(QIcon::fromTheme("file",
         QIcon(":/icons/open.png")));
     _action_open->setObjectName(QString::fromUtf8("actionOpen"));
@@ -57,7 +57,7 @@ FileBar::FileBar(SigSession &session, QWidget *parent) :
 
     _action_save = new QAction(this);
     _action_save->setText(QApplication::translate(
-        "File", "&Save...", 0, QApplication::UnicodeUTF8));
+        "File", "&Save...", 0 ));
     _action_save->setIcon(QIcon::fromTheme("file",
         QIcon(":/icons/save.png")));
     _action_save->setObjectName(QString::fromUtf8("actionSave"));
@@ -66,7 +66,7 @@ FileBar::FileBar(SigSession &session, QWidget *parent) :
 
     _action_capture = new QAction(this);
     _action_capture->setText(QApplication::translate(
-        "File", "&Capture...", 0, QApplication::UnicodeUTF8));
+        "File", "&Capture...", 0 ));
     _action_capture->setIcon(QIcon::fromTheme("file",
         QIcon(":/icons/capture.png")));
     _action_capture->setObjectName(QString::fromUtf8("actionCapture"));
diff --git a/DSView/pv/toolbars/logobar.cpp b/DSView/pv/toolbars/logobar.cpp
index 842a74e..ab7ef6d 100644
--- a/DSView/pv/toolbars/logobar.cpp
+++ b/DSView/pv/toolbars/logobar.cpp
@@ -47,7 +47,7 @@ LogoBar::LogoBar(SigSession &session, QWidget *parent) :
 
     _about = new QAction(this);
     _about->setText(QApplication::translate(
-        "File", "&About...", 0, QApplication::UnicodeUTF8));
+        "File", "&About...", 0 ));
     _about->setIcon(QIcon::fromTheme("file",
         QIcon(":/icons/about.png")));
     _about->setObjectName(QString::fromUtf8("actionAbout"));
@@ -56,7 +56,7 @@ LogoBar::LogoBar(SigSession &session, QWidget *parent) :
 
     _wiki = new QAction(this);
     _wiki->setText(QApplication::translate(
-        "File", "&Wiki", 0, QApplication::UnicodeUTF8));
+        "File", "&Wiki", 0 ));
     _wiki->setIcon(QIcon::fromTheme("file",
         QIcon(":/icons/wiki.png")));
     _wiki->setObjectName(QString::fromUtf8("actionWiki"));
diff --git a/DSView/pv/view/view.cpp b/DSView/pv/view/view.cpp
index 1a912d4..a04d91e 100644
--- a/DSView/pv/view/view.cpp
+++ b/DSView/pv/view/view.cpp
@@ -27,7 +27,7 @@
 
 #include <boost/foreach.hpp>
 
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
 #include <QEvent>
 #include <QMouseEvent>
 #include <QScrollBar>
diff --git a/libsigrok4DSL/config.h.in b/libsigrok4DSL/config.h.in
index d81e9f7..d4b42b2 100644
--- a/libsigrok4DSL/config.h.in
+++ b/libsigrok4DSL/config.h.in
@@ -94,9 +94,6 @@
    */
 #undef LT_OBJDIR
 
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
 /* Name of package */
 #undef PACKAGE
 
diff --git a/libusbx-1.0.18/config.h.in b/libusbx-1.0.18/config.h.in
index 2e5e0f4..effc220 100644
--- a/libusbx-1.0.18/config.h.in
+++ b/libusbx-1.0.18/config.h.in
@@ -82,9 +82,6 @@
    */
 #undef LT_OBJDIR
 
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
 /* Darwin backend */
 #undef OS_DARWIN
 

Re: Compiling GUI on lastest QT

PostPosted: Fri Apr 17, 2015 1:32 pm
by Anders
I've a pull-request for a patch that I originally created a little while ago, that does the Qt5 adaptions. (Though, it does them in an unconditional way). See https://github.com/DreamSourceLab/DSView/pull/48.