diff --git a/src/lib/adblock/adblockdialog.cpp b/src/lib/adblock/adblockdialog.cpp
index cc27ee7bb..98cedb5d0 100644
--- a/src/lib/adblock/adblockdialog.cpp
+++ b/src/lib/adblock/adblockdialog.cpp
@@ -36,7 +36,9 @@ AdBlockDialog::AdBlockDialog(QWidget* parent)
{
setAttribute(Qt::WA_DeleteOnClose);
setupUi(this);
-
+#ifdef Q_OS_MAC
+ tabWidget->setDocumentMode(false);
+#endif
adblockCheckBox->setChecked(m_manager->isEnabled());
QMenu* menu = new QMenu(buttonMenu);
diff --git a/src/lib/autofill/autofillnotification.ui b/src/lib/autofill/autofillnotification.ui
index b1838f612..5dc1e0dd2 100644
--- a/src/lib/autofill/autofillnotification.ui
+++ b/src/lib/autofill/autofillnotification.ui
@@ -121,7 +121,7 @@
-
-
+
@@ -132,6 +132,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
diff --git a/src/lib/lib.pro b/src/lib/lib.pro
index 56e5ab688..d1584f371 100644
--- a/src/lib/lib.pro
+++ b/src/lib/lib.pro
@@ -214,7 +214,8 @@ SOURCES += \
autofill/autofillwidget.cpp \
tools/menubar.cpp \
navigation/navigationcontainer.cpp \
- tools/horizontallistwidget.cpp
+ tools/horizontallistwidget.cpp \
+ tools/mactoolbutton.cpp
HEADERS += \
webview/tabpreview.h \
@@ -383,7 +384,8 @@ HEADERS += \
autofill/autofillwidget.h \
tools/menubar.h \
navigation/navigationcontainer.h \
- tools/horizontallistwidget.h
+ tools/horizontallistwidget.h \
+ tools/mactoolbutton.h
FORMS += \
preferences/autofillmanager.ui \
diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp
index 924dad08f..69f6abf48 100644
--- a/src/lib/navigation/locationbar.cpp
+++ b/src/lib/navigation/locationbar.cpp
@@ -552,6 +552,7 @@ void LocationBar::hideProgress()
void LocationBar::paintEvent(QPaintEvent* event)
{
+#ifndef Q_OS_MAC
if (m_completer.isPopupVisible() && !m_completer.showingMostVisited()) {
// We need to draw cursor when popup is visible
// But don't paint it if we are just showing most visited sites
@@ -582,6 +583,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
p.fillRect(cursorRect, option.palette.text().color());
return;
}
+#endif
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
LineEdit::paintEvent(event);
diff --git a/src/lib/other/sourceviewersearch.ui b/src/lib/other/sourceviewersearch.ui
index 56bb2b8ec..5c727b2d3 100644
--- a/src/lib/other/sourceviewersearch.ui
+++ b/src/lib/other/sourceviewersearch.ui
@@ -21,7 +21,7 @@
4
-
-
+
0
@@ -51,7 +51,7 @@
-
-
+
0
@@ -67,7 +67,7 @@
-
-
+
0
@@ -105,6 +105,11 @@
+
+ MacToolButton
+ QToolButton
+
+
FocusSelectLineEdit
QLineEdit
diff --git a/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.ui b/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.ui
index cf8af56d7..71d7f790b 100644
--- a/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.ui
+++ b/src/lib/plugins/qtwebkit/spellcheck/spellcheckdialog.ui
@@ -31,7 +31,7 @@
-
-
+
Change...
@@ -123,6 +123,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index cd723463f..88b364a97 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -165,7 +165,7 @@
-
-
+
Use current
@@ -307,7 +307,7 @@
-
-
+
Use current
@@ -952,7 +952,7 @@
0
-
-
+
Select color
@@ -962,7 +962,7 @@
-
-
+
Reset
@@ -1307,7 +1307,7 @@
-
-
+
...
@@ -1892,7 +1892,7 @@
-
-
+
...
@@ -1997,7 +1997,7 @@
-
-
+
...
@@ -2441,7 +2441,7 @@
-
-
+
...
@@ -2573,6 +2573,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
buttonBox
afterLaunch
diff --git a/src/lib/rss/rssmanager.cpp b/src/lib/rss/rssmanager.cpp
index 19f493dc6..9e42b9a11 100644
--- a/src/lib/rss/rssmanager.cpp
+++ b/src/lib/rss/rssmanager.cpp
@@ -43,7 +43,9 @@ RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent)
, p_QupZilla(mainClass)
{
ui->setupUi(this);
-
+#ifdef Q_OS_MAC
+ ui->tabWidget->setDocumentMode(false);
+#endif
ui->tabWidget->setElideMode(Qt::ElideRight);
m_networkManager = mApp->networkManager();
diff --git a/src/lib/rss/rssnotification.ui b/src/lib/rss/rssnotification.ui
index f0ef9620e..a8c55e085 100644
--- a/src/lib/rss/rssnotification.ui
+++ b/src/lib/rss/rssnotification.ui
@@ -83,7 +83,7 @@
-
-
+
@@ -94,6 +94,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
diff --git a/src/lib/tools/docktitlebarwidget.ui b/src/lib/tools/docktitlebarwidget.ui
index fe75f3aaa..c486ef290 100644
--- a/src/lib/tools/docktitlebarwidget.ui
+++ b/src/lib/tools/docktitlebarwidget.ui
@@ -30,7 +30,7 @@
-
-
+
Qt::NoFocus
@@ -50,6 +50,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
diff --git a/src/lib/tools/html5permissions/html5permissionsnotification.ui b/src/lib/tools/html5permissions/html5permissionsnotification.ui
index c139fbe5b..9e860525b 100644
--- a/src/lib/tools/html5permissions/html5permissionsnotification.ui
+++ b/src/lib/tools/html5permissions/html5permissionsnotification.ui
@@ -78,7 +78,7 @@
-
-
+
@@ -89,6 +89,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+
diff --git a/src/lib/tools/mactoolbutton.cpp b/src/lib/tools/mactoolbutton.cpp
new file mode 100644
index 000000000..5c68c9f49
--- /dev/null
+++ b/src/lib/tools/mactoolbutton.cpp
@@ -0,0 +1,53 @@
+/* ============================================================
+* QupZilla - WebKit based browser
+* Copyright (C) 2013 David Rosca
+* Copyright (C) 2013 S. Razi Alavizadeh
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+* ============================================================ */
+#include "mactoolbutton.h"
+
+#ifdef Q_OS_MAC
+MacToolButton::MacToolButton(QWidget* parent)
+ : QPushButton(parent)
+ , m_autoRise(false)
+ , m_buttonFixedSize(18, 18)
+{
+}
+
+void MacToolButton::setIconSize(const QSize &size)
+{
+ QPushButton::setIconSize(size);
+ m_buttonFixedSize = QSize(size.width()+2, size.height()+2);
+}
+
+void MacToolButton::setAutoRaise(bool enable)
+{
+ m_autoRise = enable;
+ setFlat(enable);
+ if (enable) {
+ setFixedSize(m_buttonFixedSize);
+ }
+}
+
+bool MacToolButton::autoRaise() const
+{
+ return m_autoRise;
+}
+#else
+MacToolButton::MacToolButton(QWidget* parent)
+ : QToolButton(parent)
+{
+}
+#endif
diff --git a/src/lib/tools/mactoolbutton.h b/src/lib/tools/mactoolbutton.h
new file mode 100644
index 000000000..032e717a2
--- /dev/null
+++ b/src/lib/tools/mactoolbutton.h
@@ -0,0 +1,55 @@
+/* ============================================================
+* QupZilla - WebKit based browser
+* Copyright (C) 2013 David Rosca
+* Copyright (C) 2013 S. Razi Alavizadeh
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+* ============================================================ */
+#ifndef MACTOOLBUTTON_H
+#define MACTOOLBUTTON_H
+
+#include "qz_namespace.h"
+
+#ifdef Q_OS_MAC
+#include
+
+class QT_QUPZILLA_EXPORT MacToolButton : public QPushButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise)
+
+public:
+ explicit MacToolButton(QWidget* parent = 0);
+
+ void setIconSize(const QSize &size);
+
+ void setAutoRaise(bool enable);
+ bool autoRaise() const;
+
+private:
+ bool m_autoRise;
+ QSize m_buttonFixedSize;
+};
+#else
+#include
+
+class QT_QUPZILLA_EXPORT MacToolButton : public QToolButton
+{
+ Q_OBJECT
+
+public:
+ explicit MacToolButton(QWidget* parent = 0);
+};
+#endif
+#endif // MACTOOLBUTTON_H
diff --git a/src/lib/webview/searchtoolbar.ui b/src/lib/webview/searchtoolbar.ui
index dec93784a..cd324bbba 100644
--- a/src/lib/webview/searchtoolbar.ui
+++ b/src/lib/webview/searchtoolbar.ui
@@ -18,7 +18,7 @@
4
-
-
+
0
@@ -57,7 +57,7 @@
-
-
+
0
@@ -70,7 +70,7 @@
-
-
+
0
@@ -83,7 +83,7 @@
-
-
+
Highlight
@@ -93,7 +93,7 @@
-
-
+
Case sensitive
@@ -130,6 +130,11 @@
QLineEdit
+
+ MacToolButton
+ QToolButton
+
+
diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp
index 8c91662a9..f4a968804 100644
--- a/src/lib/webview/tabbar.cpp
+++ b/src/lib/webview/tabbar.cpp
@@ -319,7 +319,7 @@ void TabBar::showCloseButton(int index)
}
WebTab* webTab = qobject_cast(m_tabWidget->widget(index));
- QAbstractButton* button = qobject_cast(tabButton(index, QTabBar::RightSide));
+ QAbstractButton* button = qobject_cast(tabButton(index, closeButtonPosition()));
if (button || (webTab && webTab->isPinned())) {
return;
@@ -327,7 +327,7 @@ void TabBar::showCloseButton(int index)
QAbstractButton* closeButton = new CloseButton(this);
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeTabFromButton()));
- setTabButton(index, QTabBar::RightSide, closeButton);
+ setTabButton(index, closeButtonPosition(), closeButton);
}
void TabBar::hideCloseButton(int index)
@@ -336,12 +336,12 @@ void TabBar::hideCloseButton(int index)
return;
}
- CloseButton* button = qobject_cast(tabButton(index, QTabBar::RightSide));
+ CloseButton* button = qobject_cast(tabButton(index, closeButtonPosition()));
if (!button) {
return;
}
- setTabButton(index, QTabBar::RightSide, 0);
+ setTabButton(index, closeButtonPosition(), 0);
button->deleteLater();
}
@@ -352,7 +352,7 @@ void TabBar::updatePinnedTabCloseButton(int index)
}
WebTab* webTab = qobject_cast(m_tabWidget->widget(index));
- QAbstractButton* button = qobject_cast(tabButton(index, QTabBar::RightSide));
+ QAbstractButton* button = qobject_cast(tabButton(index, closeButtonPosition()));
bool pinned = webTab && webTab->isPinned();
@@ -383,7 +383,7 @@ void TabBar::closeTabFromButton()
int tabToClose = -1;
for (int i = 0; i < count(); ++i) {
- if (tabButton(i, QTabBar::RightSide) == button) {
+ if (tabButton(i, closeButtonPosition()) == button) {
tabToClose = i;
break;
}
@@ -463,6 +463,16 @@ int TabBar::normalTabsCount()
return count() - m_pinnedTabsCount;
}
+QTabBar::ButtonPosition TabBar::iconButtonPosition()
+{
+ return (closeButtonPosition() == QTabBar::RightSide ? QTabBar::LeftSide : QTabBar::RightSide);
+}
+
+QTabBar::ButtonPosition TabBar::closeButtonPosition()
+{
+ return (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
+}
+
void TabBar::showTabPreview()
{
WebTab* webTab = qobject_cast(m_tabWidget->widget(m_tabPreview->previewIndex()));
@@ -709,10 +719,9 @@ void CloseButton::paintEvent(QPaintEvent*)
opt.state |= QStyle::State_Sunken;
}
- if (const QTabBar* tb = qobject_cast(parent())) {
+ if (TabBar* tb = qobject_cast(parent())) {
int index = tb->currentIndex();
- QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb);
- if (tb->tabButton(index, position) == this) {
+ if (tb->tabButton(index, tb->closeButtonPosition()) == this) {
opt.state |= QStyle::State_Selected;
}
}
diff --git a/src/lib/webview/tabbar.h b/src/lib/webview/tabbar.h
index be5573575..f04daaaa6 100644
--- a/src/lib/webview/tabbar.h
+++ b/src/lib/webview/tabbar.h
@@ -42,6 +42,9 @@ public:
int pinnedTabsCount();
int normalTabsCount();
+ QTabBar::ButtonPosition iconButtonPosition();
+ QTabBar::ButtonPosition closeButtonPosition();
+
void updatePinnedTabCloseButton(int index);
void disconnectObjects();
diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp
index 410c141d6..b29cdff74 100644
--- a/src/lib/webview/tabwidget.cpp
+++ b/src/lib/webview/tabwidget.cpp
@@ -468,10 +468,10 @@ void TabWidget::startTabAnimation(int index)
return;
}
- QLabel* label = qobject_cast(m_tabBar->tabButton(index, QTabBar::LeftSide));
+ QLabel* label = qobject_cast(m_tabBar->tabButton(index, m_tabBar->iconButtonPosition()));
if (!label) {
label = new QLabel();
- m_tabBar->setTabButton(index, QTabBar::LeftSide, label);
+ m_tabBar->setTabButton(index, m_tabBar->iconButtonPosition(), label);
}
if (label->movie()) {
@@ -492,7 +492,7 @@ void TabWidget::stopTabAnimation(int index)
return;
}
- QLabel* label = qobject_cast(m_tabBar->tabButton(index, QTabBar::LeftSide));
+ QLabel* label = qobject_cast(m_tabBar->tabButton(index, m_tabBar->iconButtonPosition()));
if (label && label->movie()) {
label->movie()->stop();
@@ -512,11 +512,11 @@ void TabWidget::setTabIcon(int index, const QIcon &icon)
return;
}
- QLabel* label = qobject_cast(m_tabBar->tabButton(index, QTabBar::LeftSide));
+ QLabel* label = qobject_cast(m_tabBar->tabButton(index, m_tabBar->iconButtonPosition()));
if (!label) {
label = new QLabel();
label->resize(16, 16);
- m_tabBar->setTabButton(index, QTabBar::LeftSide, label);
+ m_tabBar->setTabButton(index, m_tabBar->iconButtonPosition(), label);
}
label->setPixmap(icon.pixmap(16, 16));
diff --git a/src/plugins/GreaseMonkey/gm_notification.ui b/src/plugins/GreaseMonkey/gm_notification.ui
index 56fdc6960..7b8a30ee2 100644
--- a/src/plugins/GreaseMonkey/gm_notification.ui
+++ b/src/plugins/GreaseMonkey/gm_notification.ui
@@ -67,7 +67,7 @@
-
-
+
@@ -78,6 +78,13 @@
+
+
+ MacToolButton
+ QToolButton
+
+
+