diff --git a/runtime/BrowserWindow.cpp b/runtime/BrowserWindow.cpp index 6b2ae3f6b..409ece977 100644 --- a/runtime/BrowserWindow.cpp +++ b/runtime/BrowserWindow.cpp @@ -197,7 +197,7 @@ int BrowserWindow::findURLTab(const QUrl &name) { webviewPtr = dynamic_cast(widgetPtr); - if (webviewPtr != NULL && !QString::compare(webviewPtr->getFirstLoadURL(),name.url(), Qt::CaseInsensitive)) + if (webviewPtr != NULL && !QString::compare(webviewPtr->getFirstLoadURL(),name.host(), Qt::CaseInsensitive)) { m_tabWidget->setCurrentIndex(tabCount); return 1; @@ -412,7 +412,7 @@ void BrowserWindow::urlLinkClicked(const QUrl &name) m_tabWidget->tabBar()->setTabButton((m_tabWidget->count() - 1), QTabBar::LeftSide, m_widget); m_tabWidget->tabBar()->setTabButton((m_tabWidget->count() - 1), QTabBar::RightSide, m_btnClose); - m_addNewWebView->setFirstLoadURL(name.url()); + m_addNewWebView->setFirstLoadURL(name.host()); m_addNewWebView->setTabIndex((m_tabWidget->count() - 1)); m_addNewWebView->setUrl(name); } diff --git a/runtime/TabWindow.cpp b/runtime/TabWindow.cpp index 9d02bb795..a1aa62084 100644 --- a/runtime/TabWindow.cpp +++ b/runtime/TabWindow.cpp @@ -14,6 +14,7 @@ // App headers #include "TabWindow.h" +#include TabWindow::TabWindow(QWidget *parent) : QTabWidget(parent) diff --git a/runtime/WebViewWindow.h b/runtime/WebViewWindow.h index 4fdddfc8d..59280f3f6 100644 --- a/runtime/WebViewWindow.h +++ b/runtime/WebViewWindow.h @@ -14,7 +14,11 @@ #include "pgAdmin4.h" +#if QT_VERSION >= 0x050000 #include +#else +#include +#endif class WebViewWindow : public QWebView { diff --git a/runtime/pgAdmin4.cpp b/runtime/pgAdmin4.cpp index 906bd31ac..f21bc196f 100644 --- a/runtime/pgAdmin4.cpp +++ b/runtime/pgAdmin4.cpp @@ -29,6 +29,17 @@ #include "ConfigWindow.h" #include "Server.h" +#include + +void delay( int milliseconds ) +{ + QTime endTime = QTime::currentTime().addMSecs( milliseconds ); + while( QTime::currentTime() < endTime ) + { + QCoreApplication::processEvents( QEventLoop::AllEvents, 100 ); + } +} + int main(int argc, char * argv[]) { // Create the QT application @@ -47,8 +58,8 @@ int main(int argc, char * argv[]) // Hence - putting this code in a code block so the scope of the socket // variable vanishes to make that socket available. { - QTcpSocket socket; - socket.bind(0, QAbstractSocket::DontShareAddress); + QUdpSocket socket; + socket.bind(0, QUdpSocket::ShareAddress); port = socket.localPort(); } @@ -69,7 +80,7 @@ int main(int argc, char * argv[]) // This is a hack. Wait a second and then check to see if the server thread // is still running. If it's not, we probably had a startup error - QThread::sleep(1); + delay(1000); // Any errors? if (server->isFinished() || server->getError().length() > 0) @@ -127,7 +138,7 @@ int main(int argc, char * argv[]) exit(1); } - QThread::sleep(1); + delay(1000); } // Create & show the main window diff --git a/runtime/pgAdmin4.h b/runtime/pgAdmin4.h index 48da3b09f..7730e23dd 100644 --- a/runtime/pgAdmin4.h +++ b/runtime/pgAdmin4.h @@ -23,6 +23,7 @@ #include #else #include +#include #include #endif diff --git a/runtime/pgAdmin4.pro b/runtime/pgAdmin4.pro index 3da541447..6aa0361c6 100644 --- a/runtime/pgAdmin4.pro +++ b/runtime/pgAdmin4.pro @@ -71,8 +71,6 @@ FORMS = BrowserWindow.ui \ ICON = pgAdmin4.icns QMAKE_INFO_PLIST = Info.plist -cache() - RESOURCES += \ pgadmin4.qrc