Runtime fixes for QT4 support.
parent
2de7b4c0a0
commit
3b7886e61e
|
|
@ -197,7 +197,7 @@ int BrowserWindow::findURLTab(const QUrl &name)
|
||||||
{
|
{
|
||||||
webviewPtr = dynamic_cast<WebViewWindow*>(widgetPtr);
|
webviewPtr = dynamic_cast<WebViewWindow*>(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);
|
m_tabWidget->setCurrentIndex(tabCount);
|
||||||
return 1;
|
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::LeftSide, m_widget);
|
||||||
m_tabWidget->tabBar()->setTabButton((m_tabWidget->count() - 1), QTabBar::RightSide, m_btnClose);
|
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->setTabIndex((m_tabWidget->count() - 1));
|
||||||
m_addNewWebView->setUrl(name);
|
m_addNewWebView->setUrl(name);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
// App headers
|
// App headers
|
||||||
#include "TabWindow.h"
|
#include "TabWindow.h"
|
||||||
|
|
||||||
|
#include <QWebHistory>
|
||||||
|
|
||||||
TabWindow::TabWindow(QWidget *parent) :
|
TabWindow::TabWindow(QWidget *parent) :
|
||||||
QTabWidget(parent)
|
QTabWidget(parent)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,11 @@
|
||||||
|
|
||||||
#include "pgAdmin4.h"
|
#include "pgAdmin4.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
#include <QtWebKitWidgets>
|
#include <QtWebKitWidgets>
|
||||||
|
#else
|
||||||
|
#include <QWebView>
|
||||||
|
#endif
|
||||||
|
|
||||||
class WebViewWindow : public QWebView
|
class WebViewWindow : public QWebView
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,17 @@
|
||||||
#include "ConfigWindow.h"
|
#include "ConfigWindow.h"
|
||||||
#include "Server.h"
|
#include "Server.h"
|
||||||
|
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
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[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
// Create the QT application
|
// 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
|
// Hence - putting this code in a code block so the scope of the socket
|
||||||
// variable vanishes to make that socket available.
|
// variable vanishes to make that socket available.
|
||||||
{
|
{
|
||||||
QTcpSocket socket;
|
QUdpSocket socket;
|
||||||
socket.bind(0, QAbstractSocket::DontShareAddress);
|
socket.bind(0, QUdpSocket::ShareAddress);
|
||||||
port = socket.localPort();
|
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
|
// 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
|
// is still running. If it's not, we probably had a startup error
|
||||||
QThread::sleep(1);
|
delay(1000);
|
||||||
|
|
||||||
// Any errors?
|
// Any errors?
|
||||||
if (server->isFinished() || server->getError().length() > 0)
|
if (server->isFinished() || server->getError().length() > 0)
|
||||||
|
|
@ -127,7 +138,7 @@ int main(int argc, char * argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QThread::sleep(1);
|
delay(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create & show the main window
|
// Create & show the main window
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#else
|
#else
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QtGui>
|
||||||
#include <Qt/qurl.h>
|
#include <Qt/qurl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,6 @@ FORMS = BrowserWindow.ui \
|
||||||
ICON = pgAdmin4.icns
|
ICON = pgAdmin4.icns
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
|
|
||||||
cache()
|
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
pgadmin4.qrc
|
pgadmin4.qrc
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue