mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Merge pull request #706 from srazi/master
[Qt5][Windows] Added support for compiling QupZilla with Qt5 on Windows (msvc).
This commit is contained in:
commit
489b5bcc2f
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,3 +28,5 @@ tests/modeltest
|
||||
*.ilk
|
||||
*.kdev4
|
||||
*.swp
|
||||
*_manifest.*
|
||||
*.embed.manifest
|
||||
|
2
src/lib/3rdparty/ecwin7.cpp
vendored
2
src/lib/3rdparty/ecwin7.cpp
vendored
@ -32,7 +32,7 @@ EcWin7::EcWin7()
|
||||
}
|
||||
|
||||
// Init taskbar communication
|
||||
void EcWin7::init(WId wid)
|
||||
void EcWin7::init(HWND wid)
|
||||
{
|
||||
mWindowId = wid;
|
||||
mTaskbarMessageId = RegisterWindowMessage(L"TaskbarButtonCreated");
|
||||
|
6
src/lib/3rdparty/ecwin7.h
vendored
6
src/lib/3rdparty/ecwin7.h
vendored
@ -27,7 +27,7 @@
|
||||
|
||||
// Windows only data definitions
|
||||
#ifdef W7TASKBAR
|
||||
|
||||
#define NOMINMAX
|
||||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
#define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
// Initialization methods
|
||||
EcWin7();
|
||||
void init(WId wid);
|
||||
void init(HWND wid);
|
||||
bool winEvent(MSG* message, long* result);
|
||||
|
||||
// Overlay icon handling
|
||||
@ -63,7 +63,7 @@ public:
|
||||
void setProgressState(ToolBarProgressState state);
|
||||
|
||||
private:
|
||||
WId mWindowId;
|
||||
HWND mWindowId;
|
||||
UINT mTaskbarMessageId;
|
||||
ITaskbarList3* mTaskbar;
|
||||
HICON mOverlayIcon;
|
||||
|
8
src/lib/3rdparty/qtlockedfile_win.cpp
vendored
8
src/lib/3rdparty/qtlockedfile_win.cpp
vendored
@ -66,16 +66,24 @@ Qt::HANDLE QtLockedFile::getMutexHandle(int idx, bool doCreate)
|
||||
|
||||
Qt::HANDLE mutex;
|
||||
if (doCreate) {
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA( { mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16()); },
|
||||
{ mutex = CreateMutexA(NULL, FALSE, mname.toLocal8Bit().constData()); });
|
||||
#else // QT_WA removed from Qt5: http://qt-project.org/forums/viewthread/22994/#107379
|
||||
mutex = CreateMutexW(NULL, FALSE, (TCHAR*)mname.utf16());
|
||||
#endif
|
||||
if (!mutex) {
|
||||
qErrnoWarning("QtLockedFile::lock(): CreateMutex failed");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if (QT_VERSION < 0x050000)
|
||||
QT_WA( { mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16()); },
|
||||
{ mutex = OpenMutexA(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, mname.toLocal8Bit().constData()); });
|
||||
#else // QT_WA removed from Qt5: http://qt-project.org/forums/viewthread/22994/#107379
|
||||
mutex = OpenMutexW(SYNCHRONIZE | MUTEX_MODIFY_STATE, FALSE, (TCHAR*)mname.utf16());
|
||||
#endif
|
||||
if (!mutex) {
|
||||
if (GetLastError() != ERROR_FILE_NOT_FOUND) {
|
||||
qErrnoWarning("QtLockedFile::lock(): OpenMutex failed");
|
||||
|
41
src/lib/3rdparty/qtwin.cpp
vendored
41
src/lib/3rdparty/qtwin.cpp
vendored
@ -84,7 +84,11 @@ public:
|
||||
void removeWidget(QWidget* widget) {
|
||||
widgets.removeAll(widget);
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
|
||||
private:
|
||||
QWidgetList widgets;
|
||||
@ -93,7 +97,7 @@ private:
|
||||
static bool resolveLibs()
|
||||
{
|
||||
if (!pDwmIsCompositionEnabled) {
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
QLibrary dwmLib(QString::fromLatin1("dwmapi"));
|
||||
pDwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
|
||||
pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
|
||||
pDwmEnableBlurBehindWindow = (PtrDwmEnableBlurBehindWindow)dwmLib.resolve("DwmEnableBlurBehindWindow");
|
||||
@ -164,9 +168,13 @@ bool QtWin::enableBlurBehindWindow(QWidget* widget, bool enable)
|
||||
bb.fEnable = enable;
|
||||
bb.dwFlags = DWM_BB_ENABLE;
|
||||
bb.hRgnBlur = NULL;
|
||||
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, enable);
|
||||
widget->setAttribute(Qt::WA_NoSystemBackground, enable);
|
||||
hr = pDwmEnableBlurBehindWindow(widget->winId(), &bb);
|
||||
// Qt5: setting WA_TranslucentBackground without the following line hides the widget!!
|
||||
widget->setWindowOpacity(1);
|
||||
|
||||
hr = pDwmEnableBlurBehindWindow(hwndOfWidget(widget) , &bb);
|
||||
if (SUCCEEDED(hr)) {
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
@ -202,16 +210,18 @@ bool QtWin::extendFrameIntoClientArea(QWidget* widget, int left, int top, int ri
|
||||
bool result = false;
|
||||
#ifdef Q_OS_WIN
|
||||
if (resolveLibs()) {
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
QLibrary dwmLib(QString::fromLatin1("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
MARGINS m = {left, right, top, bottom};
|
||||
hr = pDwmExtendFrameIntoClientArea(widget->winId(), &m);
|
||||
hr = pDwmExtendFrameIntoClientArea(hwndOfWidget(widget), &m);
|
||||
if (SUCCEEDED(hr)) {
|
||||
result = true;
|
||||
windowNotifier()->addWidget(widget);
|
||||
widgetsBlurState.insert(widget, true);
|
||||
}
|
||||
widget->setAttribute(Qt::WA_TranslucentBackground, result);
|
||||
// Qt5: setting WA_TranslucentBackground without the following line hides the widget!!
|
||||
widget->setWindowOpacity(1);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
@ -230,7 +240,7 @@ QColor QtWin::colorizationColor()
|
||||
if (resolveLibs()) {
|
||||
DWORD color = 0;
|
||||
BOOL opaque = FALSE;
|
||||
QLibrary dwmLib(QString::fromAscii("dwmapi"));
|
||||
QLibrary dwmLib(QString::fromLatin1("dwmapi"));
|
||||
HRESULT hr = S_OK;
|
||||
hr = pDwmGetColorizationColor(&color, &opaque);
|
||||
if (SUCCEEDED(hr)) {
|
||||
@ -242,6 +252,16 @@ QColor QtWin::colorizationColor()
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
HWND QtWin::hwndOfWidget(const QWidget* widget)
|
||||
{
|
||||
if (widget) {
|
||||
return reinterpret_cast<HWND>(widget->winId());
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
WindowNotifier* QtWin::windowNotifier()
|
||||
{
|
||||
static WindowNotifier* windowNotifierInstance = 0;
|
||||
@ -253,8 +273,15 @@ WindowNotifier* QtWin::windowNotifier()
|
||||
|
||||
|
||||
/* Notify all enabled windows that the DWM state changed */
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool WindowNotifier::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool WindowNotifier::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
|
||||
bool compositionEnabled = QtWin::isCompositionEnabled();
|
||||
foreach(QWidget * widget, widgets) {
|
||||
@ -270,7 +297,11 @@ bool WindowNotifier::winEvent(MSG* message, long* result)
|
||||
}
|
||||
}
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
return QWidget::winEvent(message, result);
|
||||
#else
|
||||
return QWidget::nativeEvent(eventType, _message, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef W7API
|
||||
|
5
src/lib/3rdparty/qtwin.h
vendored
5
src/lib/3rdparty/qtwin.h
vendored
@ -38,6 +38,8 @@
|
||||
* these functions will simply not do anything.
|
||||
*/
|
||||
#ifdef Q_OS_WIN
|
||||
// Qt5 compile issue: http://comments.gmane.org/gmane.comp.lib.qt.user/4711
|
||||
#define NOMINMAX
|
||||
#ifdef W7API
|
||||
#include <ShlObj.h>
|
||||
#include <shlwapi.h>
|
||||
@ -62,6 +64,9 @@ public:
|
||||
static QColor colorizationColor();
|
||||
|
||||
static void setupJumpList();
|
||||
#ifdef Q_OS_WIN
|
||||
static HWND hwndOfWidget(const QWidget* widget);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static WindowNotifier* windowNotifier();
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "locationbar.h"
|
||||
#include "searchtoolbar.h"
|
||||
#include "websearchbar.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "sidebar.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "cookiejar.h"
|
||||
#include "cookiemanager.h"
|
||||
@ -40,12 +42,10 @@
|
||||
#include "rssmanager.h"
|
||||
#include "mainapplication.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "checkboxdialog.h"
|
||||
#include "adblockmanager.h"
|
||||
#include "clickablelabel.h"
|
||||
#include "docktitlebarwidget.h"
|
||||
#include "sidebar.h"
|
||||
#include "iconprovider.h"
|
||||
#include "progressbar.h"
|
||||
#include "adblockicon.h"
|
||||
@ -661,6 +661,8 @@ void QupZilla::loadSettings()
|
||||
m_usingTransparentBackground = true;
|
||||
|
||||
applyBlurToMainWindow();
|
||||
update();
|
||||
|
||||
//install event filter
|
||||
menuBar()->installEventFilter(this);
|
||||
m_navigationBar->installEventFilter(this);
|
||||
@ -1998,8 +2000,15 @@ void QupZilla::moveToVirtualDesktop(int desktopId)
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool QupZilla::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool QupZilla::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
if (message && message->message == WM_DWMCOMPOSITIONCHANGED) {
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-View-Settings");
|
||||
@ -2039,7 +2048,11 @@ bool QupZilla::winEvent(MSG* message, long* result)
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
}
|
||||
#if (QT_VERSION < 0x050000)
|
||||
return QMainWindow::winEvent(message, result);
|
||||
#else
|
||||
return QMainWindow::nativeEvent(eventType, _message, result);
|
||||
#endif
|
||||
}
|
||||
|
||||
void QupZilla::applyBlurToMainWindow(bool force)
|
||||
|
@ -208,7 +208,11 @@ private:
|
||||
void disconnectObjects();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
bool eventFilter(QObject* object, QEvent* event);
|
||||
#endif
|
||||
|
||||
|
@ -367,9 +367,16 @@ void DownloadItem::openFile()
|
||||
void DownloadItem::openFolder()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString winFileName = m_path + m_fileName;
|
||||
winFileName.replace(QLatin1Char('/'), "\\");
|
||||
QProcess::startDetached("explorer.exe /e,/select,\"" + winFileName + "\"");
|
||||
if (m_fileName.endsWith(" ")) {
|
||||
// explorer.exe don't support filenames that end with SPACE
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
|
||||
}
|
||||
else {
|
||||
QString winFileName = m_path + m_fileName;
|
||||
winFileName.replace(QLatin1Char('/'), "\\");
|
||||
QString shExArg = "/e,/select,\""+winFileName+"\"";
|
||||
ShellExecute(NULL, NULL, TEXT("explorer.exe"), shExArg.toStdWString().c_str(), NULL, SW_SHOW);
|
||||
}
|
||||
#else
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m_path));
|
||||
#endif
|
||||
|
@ -58,7 +58,7 @@ DownloadManager::DownloadManager(QWidget* parent)
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
if (QtWin::isRunningWindows7()) {
|
||||
win7.init(this->winId());
|
||||
win7.init(QtWin::hwndOfWidget(this));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -116,8 +116,15 @@ void DownloadManager::startExternalManager(const QUrl &url)
|
||||
}
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
#if (QT_VERSION < 0x050000)
|
||||
bool DownloadManager::winEvent(MSG* message, long* result)
|
||||
{
|
||||
#else
|
||||
bool DownloadManager::nativeEvent(const QByteArray &eventType, void* _message, long* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
MSG* message = static_cast<MSG*>(_message);
|
||||
#endif
|
||||
return win7.winEvent(message, result);
|
||||
}
|
||||
#endif
|
||||
|
@ -80,7 +80,11 @@ public slots:
|
||||
|
||||
#ifdef W7TASKBAR
|
||||
protected:
|
||||
#if (QT_VERSION < 0x050000)
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#else
|
||||
virtual bool nativeEvent(const QByteArray &eventType, void* _message, long* result);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include "tabbedwebview.h"
|
||||
#include "tabwidget.h"
|
||||
#include "qupzilla.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "webpluginfactory.h"
|
||||
#include "mainapplication.h"
|
||||
#include "checkboxdialog.h"
|
||||
#include "widget.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "speeddial.h"
|
||||
#include "popupwebpage.h"
|
||||
#include "popupwebview.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
|
||||
#include "webview.h"
|
||||
#include "webpage.h"
|
||||
#include "mainapplication.h"
|
||||
@ -22,6 +23,7 @@
|
||||
#include "iconprovider.h"
|
||||
#include "history.h"
|
||||
#include "autofillmodel.h"
|
||||
#include "pluginproxy.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "sourceviewer.h"
|
||||
#include "siteinfo.h"
|
||||
@ -31,7 +33,6 @@
|
||||
#include "settings.h"
|
||||
#include "qzsettings.h"
|
||||
#include "enhancedmenu.h"
|
||||
#include "pluginproxy.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
|
Loading…
Reference in New Issue
Block a user