mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Fixed width of pinned tab with Oxygen theme.
- also added runtime check of current Qt theme in use
This commit is contained in:
parent
4e75aac866
commit
3065d58b25
@ -49,6 +49,7 @@
|
|||||||
#include "commandlineoptions.h"
|
#include "commandlineoptions.h"
|
||||||
#include "useragentmanager.h"
|
#include "useragentmanager.h"
|
||||||
#include "restoremanager.h"
|
#include "restoremanager.h"
|
||||||
|
#include "proxystyle.h"
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
@ -83,6 +84,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
|||||||
, m_desktopNotifications(0)
|
, m_desktopNotifications(0)
|
||||||
, m_searchEnginesManager(0)
|
, m_searchEnginesManager(0)
|
||||||
, m_restoreManager(0)
|
, m_restoreManager(0)
|
||||||
|
, m_proxyStyle(0)
|
||||||
, m_dbWriter(new DatabaseWriter(this))
|
, m_dbWriter(new DatabaseWriter(this))
|
||||||
, m_uaManager(new UserAgentManager)
|
, m_uaManager(new UserAgentManager)
|
||||||
, m_isPrivateSession(false)
|
, m_isPrivateSession(false)
|
||||||
@ -977,6 +979,18 @@ void MainApplication::destroyRestoreManager()
|
|||||||
m_restoreManager = 0;
|
m_restoreManager = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainApplication::setProxyStyle(ProxyStyle* style)
|
||||||
|
{
|
||||||
|
m_proxyStyle = style;
|
||||||
|
|
||||||
|
QApplication::setStyle(style);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MainApplication::currentStyle() const
|
||||||
|
{
|
||||||
|
return m_proxyStyle->baseStyle()->objectName();
|
||||||
|
}
|
||||||
|
|
||||||
MainApplication::~MainApplication()
|
MainApplication::~MainApplication()
|
||||||
{
|
{
|
||||||
delete m_uaManager;
|
delete m_uaManager;
|
||||||
|
@ -48,6 +48,7 @@ class IconProvider;
|
|||||||
class SearchEnginesManager;
|
class SearchEnginesManager;
|
||||||
class DatabaseWriter;
|
class DatabaseWriter;
|
||||||
class UserAgentManager;
|
class UserAgentManager;
|
||||||
|
class ProxyStyle;
|
||||||
|
|
||||||
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
||||||
{
|
{
|
||||||
@ -83,6 +84,9 @@ public:
|
|||||||
bool checkSettingsDir();
|
bool checkSettingsDir();
|
||||||
void destroyRestoreManager();
|
void destroyRestoreManager();
|
||||||
|
|
||||||
|
void setProxyStyle(ProxyStyle* style);
|
||||||
|
QString currentStyle() const;
|
||||||
|
|
||||||
QupZilla* getWindow();
|
QupZilla* getWindow();
|
||||||
CookieManager* cookieManager();
|
CookieManager* cookieManager();
|
||||||
BrowsingLibrary* browsingLibrary();
|
BrowsingLibrary* browsingLibrary();
|
||||||
@ -151,6 +155,7 @@ private:
|
|||||||
DesktopNotificationsFactory* m_desktopNotifications;
|
DesktopNotificationsFactory* m_desktopNotifications;
|
||||||
SearchEnginesManager* m_searchEnginesManager;
|
SearchEnginesManager* m_searchEnginesManager;
|
||||||
RestoreManager* m_restoreManager;
|
RestoreManager* m_restoreManager;
|
||||||
|
ProxyStyle* m_proxyStyle;
|
||||||
DatabaseWriter* m_dbWriter;
|
DatabaseWriter* m_dbWriter;
|
||||||
UserAgentManager* m_uaManager;
|
UserAgentManager* m_uaManager;
|
||||||
|
|
||||||
|
@ -33,11 +33,9 @@ int ProxyStyle::styleHint(StyleHint hint, const QStyleOption* option, const QWid
|
|||||||
|
|
||||||
int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
|
int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
|
||||||
{
|
{
|
||||||
switch (metric) {
|
if (metric == PM_TabBarTabHSpace) {
|
||||||
case PM_TabBarTabHSpace:
|
|
||||||
return qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
|
return qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
return QProxyStyle::pixelMetric(metric, option, widget);
|
return QProxyStyle::pixelMetric(metric, option, widget);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -59,7 +59,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#ifdef KDE
|
if (mApp->currentStyle() == "oxygen") {
|
||||||
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
||||||
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
|
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("format-stroke-color", QIcon(":/icons/preferences/application-x-theme.png")));
|
||||||
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
||||||
@ -71,7 +71,8 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
|
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("preferences-desktop-notification", QIcon(":/icons/preferences/dialog-question.png")));
|
||||||
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
|
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("preferences-plugin", QIcon(":/icons/preferences/extension.png")));
|
||||||
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||||
#else
|
}
|
||||||
|
else {
|
||||||
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("preferences-desktop", QIcon(":/icons/preferences/preferences-desktop.png")));
|
||||||
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("application-x-theme", QIcon(":/icons/preferences/application-x-theme.png")));
|
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("application-x-theme", QIcon(":/icons/preferences/application-x-theme.png")));
|
||||||
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
|
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
|
||||||
@ -83,7 +84,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
|
ui->listWidget->item(8)->setIcon(QIcon::fromTheme("dialog-question", QIcon(":/icons/preferences/dialog-question.png")));
|
||||||
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
|
ui->listWidget->item(9)->setIcon(QIcon::fromTheme("extension", QIcon(":/icons/preferences/extension.png")));
|
||||||
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||||
#endif
|
}
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
//GENERAL URLs
|
//GENERAL URLs
|
||||||
|
@ -177,7 +177,12 @@ QSize TabBar::tabSizeHint(int index) const
|
|||||||
static int PINNED_TAB_WIDTH = -1;
|
static int PINNED_TAB_WIDTH = -1;
|
||||||
|
|
||||||
if (PINNED_TAB_WIDTH == -1) {
|
if (PINNED_TAB_WIDTH == -1) {
|
||||||
PINNED_TAB_WIDTH = 16 + style()->pixelMetric(QStyle::PM_TabBarTabHSpace);
|
PINNED_TAB_WIDTH = 16 + style()->pixelMetric(QStyle::PM_TabBarTabHSpace, 0, this);
|
||||||
|
|
||||||
|
// This method for some reason does not work very well with oxygen ...
|
||||||
|
if (mApp->currentStyle() == "oxygen") {
|
||||||
|
PINNED_TAB_WIDTH = 25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize size = QTabBar::tabSizeHint(index);
|
QSize size = QTabBar::tabSizeHint(index);
|
||||||
|
@ -665,7 +665,7 @@ void TabWidget::aboutToShowClosedTabsMenu()
|
|||||||
else {
|
else {
|
||||||
m_menuTabs->clear();
|
m_menuTabs->clear();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach(const ClosedTabsManager::Tab & tab, this->closedTabsManager()->allClosedTabs()) {
|
foreach(const ClosedTabsManager::Tab & tab, closedTabsManager()->allClosedTabs()) {
|
||||||
QString title = tab.title;
|
QString title = tab.title;
|
||||||
if (title.length() > 40) {
|
if (title.length() > 40) {
|
||||||
title.truncate(40);
|
title.truncate(40);
|
||||||
|
@ -130,7 +130,7 @@ int main(int argc, char* argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
app.setStyle(new ProxyStyle);
|
app.setProxyStyle(new ProxyStyle);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user