From a22159aa57ad5eb0bfb203529a16e2392daab49a Mon Sep 17 00:00:00 2001
From: mir3x <mlewczuk80@gmail.com>
Date: Fri, 20 Oct 2017 18:32:37 +0100
Subject: [PATCH] Qt5 update

---
 src/dhcpcd-qt/dhcpcd-preferences.cpp    | 8 ++++----
 src/dhcpcd-qt/dhcpcd-qt.cpp             | 7 +++++--
 src/dhcpcd-qt/dhcpcd-qt.pro             | 3 ++-
 src/dhcpcd-qt/dhcpcd-ssidmenuwidget.cpp | 2 +-
 src/dhcpcd-qt/dhcpcd-wi.cpp             | 2 +-
 src/dhcpcd-qt/main.cpp                  | 2 +-
 6 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/dhcpcd-qt/dhcpcd-preferences.cpp b/src/dhcpcd-qt/dhcpcd-preferences.cpp
index 7366a06..5331e7e 100644
--- a/src/dhcpcd-qt/dhcpcd-preferences.cpp
+++ b/src/dhcpcd-qt/dhcpcd-preferences.cpp
@@ -182,10 +182,10 @@ void DhcpcdPreferences::listBlocks(const QString &txt)
 	blocks->disconnect(this);
 
 	free(eWhat);
-	eWhat = strdup(txt.toLower().toAscii());
+	eWhat = strdup(txt.toLower().toLatin1());
 
 	list = dhcpcd_config_blocks(parent->getConnection(),
-	    txt.toLower().toAscii());
+	    txt.toLower().toLatin1());
 
 	if (txt == "interface") {
 		char **ifaces, **i;
@@ -294,7 +294,7 @@ const char *DhcpcdPreferences::getString(QLineEdit *le)
 {
 	if (le->text().isEmpty())
 		return NULL;
-	return le->text().trimmed().toAscii();
+	return le->text().trimmed().toLatin1();
 }
 
 bool DhcpcdPreferences::setOption(const char *opt, const char *val, bool *ret)
@@ -405,7 +405,7 @@ void DhcpcdPreferences::showBlock(const QString &txt)
 	if (txt.isEmpty())
 		eBlock = NULL;
 	else
-		eBlock = strdup(txt.toAscii());
+		eBlock = strdup(txt.toLatin1());
 
 	dhcpcd_config_free(config);
 	iface = NULL;
diff --git a/src/dhcpcd-qt/dhcpcd-qt.cpp b/src/dhcpcd-qt/dhcpcd-qt.cpp
index 178e7d8..32242d4 100644
--- a/src/dhcpcd-qt/dhcpcd-qt.cpp
+++ b/src/dhcpcd-qt/dhcpcd-qt.cpp
@@ -224,9 +224,9 @@ void DhcpcdQt::updateOnline(bool showIf)
 			if (showIf)
 				qDebug() << msg;
 			if (msgs.isEmpty())
-				msgs = QString::fromAscii(msg);
+				msgs = QString::fromLatin1(msg);
 			else
-				msgs += '\n' + QString::fromAscii(msg);
+				msgs += '\n' + QString::fromLatin1(msg);
 			free(msg);
 		} else if (showIf)
 			qDebug() << i->ifname << i->reason;
@@ -540,6 +540,9 @@ void DhcpcdQt::notify(QString &title, QString &msg,
 	n->setText(msg);
 	n->sendEvent();
 #else
+    Q_UNUSED(title)
+    Q_UNUSED(msg)
+    Q_UNUSED(icon)
 	//trayIcon->showMessage(title, msg, icon);
 #endif
 }
diff --git a/src/dhcpcd-qt/dhcpcd-qt.pro b/src/dhcpcd-qt/dhcpcd-qt.pro
index 38c37da..36b0f1b 100644
--- a/src/dhcpcd-qt/dhcpcd-qt.pro
+++ b/src/dhcpcd-qt/dhcpcd-qt.pro
@@ -1,4 +1,5 @@
-CONFIG+=		qt gui c++11 debug
+CONFIG+=		qt c++11 debug
+QT       += gui core widgets
 QMAKE_CXXFLAGS+=	-std=c++11 -O2
 
 HEADERS=		dhcpcd-qt.h dhcpcd-about.h dhcpcd-preferences.h \
diff --git a/src/dhcpcd-qt/dhcpcd-ssidmenuwidget.cpp b/src/dhcpcd-qt/dhcpcd-ssidmenuwidget.cpp
index 71ff1aa..dabf17a 100644
--- a/src/dhcpcd-qt/dhcpcd-ssidmenuwidget.cpp
+++ b/src/dhcpcd-qt/dhcpcd-ssidmenuwidget.cpp
@@ -132,7 +132,7 @@ void DhcpcdSsidMenuWidget::setScan(DHCPCD_WI_SCAN *scan)
 		selicon->setPixmap(picon);
 		ssid->setStyleSheet("font:bold;");
 	} else {
-		selicon->setPixmap(NULL);
+		selicon->setPixmap(QPixmap());
 		ssid->setStyleSheet(NULL);
 	}
 	ssid->setText(scan->ssid);
diff --git a/src/dhcpcd-qt/dhcpcd-wi.cpp b/src/dhcpcd-qt/dhcpcd-wi.cpp
index aeec282..d950289 100644
--- a/src/dhcpcd-qt/dhcpcd-wi.cpp
+++ b/src/dhcpcd-qt/dhcpcd-wi.cpp
@@ -314,7 +314,7 @@ void DhcpcdWi::connectSsid(DHCPCD_WI_SCAN *scan)
 		if (pwd.isNull() || pwd.isEmpty())
 			err = dhcpcd_wpa_select(wpa, &s);
 		else
-			err = dhcpcd_wpa_configure(wpa, &s, pwd.toAscii());
+			err = dhcpcd_wpa_configure(wpa, &s, pwd.toLatin1());
 	} else
 		err = dhcpcd_wpa_configure(wpa, &s, NULL);
 
diff --git a/src/dhcpcd-qt/main.cpp b/src/dhcpcd-qt/main.cpp
index f2ffebd..7cbfce7 100644
--- a/src/dhcpcd-qt/main.cpp
+++ b/src/dhcpcd-qt/main.cpp
@@ -24,7 +24,7 @@
  * SUCH DAMAGE.
  */
 
-#include <QtGui>
+#include <QApplication>
 
 #include "dhcpcd-qt.h"
 #include "dhcpcd-singleton.h"

