mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36: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 "useragentmanager.h"
|
||||
#include "restoremanager.h"
|
||||
#include "proxystyle.h"
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include <QFileOpenEvent>
|
||||
@ -83,6 +84,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
, m_desktopNotifications(0)
|
||||
, m_searchEnginesManager(0)
|
||||
, m_restoreManager(0)
|
||||
, m_proxyStyle(0)
|
||||
, m_dbWriter(new DatabaseWriter(this))
|
||||
, m_uaManager(new UserAgentManager)
|
||||
, m_isPrivateSession(false)
|
||||
@ -977,6 +979,18 @@ void MainApplication::destroyRestoreManager()
|
||||
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()
|
||||
{
|
||||
delete m_uaManager;
|
||||
|
@ -48,6 +48,7 @@ class IconProvider;
|
||||
class SearchEnginesManager;
|
||||
class DatabaseWriter;
|
||||
class UserAgentManager;
|
||||
class ProxyStyle;
|
||||
|
||||
class QT_QUPZILLA_EXPORT MainApplication : public QtSingleApplication
|
||||
{
|
||||
@ -83,6 +84,9 @@ public:
|
||||
bool checkSettingsDir();
|
||||
void destroyRestoreManager();
|
||||
|
||||
void setProxyStyle(ProxyStyle* style);
|
||||
QString currentStyle() const;
|
||||
|
||||
QupZilla* getWindow();
|
||||
CookieManager* cookieManager();
|
||||
BrowsingLibrary* browsingLibrary();
|
||||
@ -151,6 +155,7 @@ private:
|
||||
DesktopNotificationsFactory* m_desktopNotifications;
|
||||
SearchEnginesManager* m_searchEnginesManager;
|
||||
RestoreManager* m_restoreManager;
|
||||
ProxyStyle* m_proxyStyle;
|
||||
DatabaseWriter* m_dbWriter;
|
||||
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
|
||||
{
|
||||
switch (metric) {
|
||||
case PM_TabBarTabHSpace:
|
||||
if (metric == PM_TabBarTabHSpace) {
|
||||
return qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);
|
||||
|
||||
default:
|
||||
return QProxyStyle::pixelMetric(metric, option, widget);
|
||||
}
|
||||
|
||||
return QProxyStyle::pixelMetric(metric, option, widget);
|
||||
}
|
||||
|
@ -59,31 +59,32 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef KDE
|
||||
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(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
||||
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
||||
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
|
||||
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
|
||||
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
|
||||
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.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(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||
#else
|
||||
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(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
|
||||
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
||||
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
|
||||
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
|
||||
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
|
||||
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.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(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||
#endif
|
||||
if (mApp->currentStyle() == "oxygen") {
|
||||
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(2)->setIcon(QIcon::fromTheme("tab-new-background", QIcon(":/icons/preferences/applications-internet.png")));
|
||||
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("preferences-system-network", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
||||
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/icons/preferences/applications-fonts.png")));
|
||||
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("download", QIcon(":/icons/preferences/mail-inbox.png")));
|
||||
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("user-identity", QIcon(":/icons/preferences/dialog-password.png")));
|
||||
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.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(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||
}
|
||||
else {
|
||||
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(2)->setIcon(QIcon::fromTheme("applications-internet", QIcon(":/icons/preferences/applications-internet.png")));
|
||||
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("applications-webbrowsers", QIcon(":/icons/preferences/applications-webbrowsers.png")));
|
||||
ui->listWidget->item(4)->setIcon(QIcon::fromTheme("applications-fonts", QIcon(":/icons/preferences/applications-fonts.png")));
|
||||
ui->listWidget->item(5)->setIcon(QIcon::fromTheme("mail-inbox", QIcon(":/icons/preferences/mail-inbox.png")));
|
||||
ui->listWidget->item(6)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
|
||||
ui->listWidget->item(7)->setIcon(QIcon::fromTheme("preferences-system-firewall", QIcon(":/icons/preferences/preferences-system-firewall.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(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||
}
|
||||
|
||||
Settings settings;
|
||||
//GENERAL URLs
|
||||
|
@ -177,7 +177,12 @@ QSize TabBar::tabSizeHint(int index) const
|
||||
static int 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);
|
||||
|
@ -665,7 +665,7 @@ void TabWidget::aboutToShowClosedTabsMenu()
|
||||
else {
|
||||
m_menuTabs->clear();
|
||||
int i = 0;
|
||||
foreach(const ClosedTabsManager::Tab & tab, this->closedTabsManager()->allClosedTabs()) {
|
||||
foreach(const ClosedTabsManager::Tab & tab, closedTabsManager()->allClosedTabs()) {
|
||||
QString title = tab.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
|
@ -130,7 +130,7 @@ int main(int argc, char* argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
app.setStyle(new ProxyStyle);
|
||||
app.setProxyStyle(new ProxyStyle);
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user