From 91bd95dc59ccdb8d0f519d527e04a282b9c9e442 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 26 Mar 2011 13:34:08 +0100 Subject: [PATCH] Various changes in add new tab button and list all tabs menu --- bin/locale/cs_CZ.qm | Bin 54861 -> 54847 bytes src/data/icons.qrc | 1 + src/data/icons/other/addpanel.png | Bin 0 -> 463 bytes src/data/icons/other/list-add.png | Bin 0 -> 363 bytes src/data/icons/other/plusgrey.png | Bin 0 -> 268 bytes src/downloads/downloadmanager.cpp | 8 +++- src/webview/tabbar.cpp | 11 +++-- src/webview/tabbar.h | 1 + src/webview/tabwidget.cpp | 72 +++++++++++++++++++++++++++--- src/webview/tabwidget.h | 7 ++- src/webview/webpage.cpp | 2 +- src/webview/webview.cpp | 3 +- translations/cs_CZ.ts | 4 +- 13 files changed, 91 insertions(+), 18 deletions(-) create mode 100644 src/data/icons/other/addpanel.png create mode 100644 src/data/icons/other/list-add.png create mode 100644 src/data/icons/other/plusgrey.png diff --git a/bin/locale/cs_CZ.qm b/bin/locale/cs_CZ.qm index cd5c6cecc47203e12ec3d46eeee3dd71ccc01729..b5b1289473cdb0310c2078cadd85b87eb76f4606 100644 GIT binary patch delta 589 zcmY+BUr18{7{$-G>zwyquk#jagW{T$_oX$8GKkE`;Py}`$Os9`Y(s+l^Pph=l*D01 zE64Y+hb4%$jM$8JHzjgge-tKCkudckgdTiKpJIkalaNV@kI?e)fFNaKbk&|4%g|%b`2)-0H_6`E6 zS>cyq@$))+?L%~&^LC9calyK$xxcthn%OB@x?2NeTR2txo&IpZaf)7X+7YHH_LdCV z-tKU|WR%LdP4v(j2Str?92cvIcu~~p25*bHTH+X(z6LxPu=p=+oDWMnJ>tvK6Ajw@+#7kbv{U>f)2x-1b+K2`k3E!6SHA!<4!M5F`sDtmY&@|XKIG)~+9Ysw zMeex10>sDU+o7mcYL?@QK_VBF9UF8}zaIoB<7S5N)q=YpI_TdbwxohZv`C6@ysr%7Pt+<6= fbfX9T=;I$XmFAwzd9tJ?_~8FfsxXJM%awltDf+;S delta 599 zcmYk3Ur1AN6vw}3SDp9X%{fF(D(;Z5u+iAAZ)99WdTBqF$U z9mrr6l8qv^GVhi|ZVOXLNCjy{5J8|mxn5!q_S7$Y>FIMg=WxE~d`~(mEk&iVI~8ll z8wvwm-?#ZwqSJLQl{Bj5{nBw-<3Xw3xszTu zlmf{fnhu`?qLZAF>MO2Us;!5CiA{^URRTf@%aOZnz=wUNJI_HCThiBf3J5-xew6eB ziFxU#Avm|e-uwYN#F>1JnmH%p1P2NZD6iDK#haBt+Q*54724uK>p_Zh(mGC4>@DoK zOsSkH9HL#^B710^gR(e*V{$n;ctO^wo3pa+EVK4KI|tnE6a1(4n5z_>?sKDZnpQcY z7&OOOWrjvLqH4}fdE(eIV0kG&G3SB!C(fuEZE#NQpkZ#Y=`t(r3thnMDGu5UXPq*0 zaUAf6mA86IOh3Wvwhnnkr8hz=t+Usz?;TZZT$4bmRIM8jo7`GgjS(^7-50gBIu4v& zRol+50|j n_>sj0Trz(pTd8Ufn$d#*`9z@?F8Kd%K^Fodn>DYbKbQRl@-M`X diff --git a/src/data/icons.qrc b/src/data/icons.qrc index f02b0f700..d025d1db0 100644 --- a/src/data/icons.qrc +++ b/src/data/icons.qrc @@ -69,5 +69,6 @@ icons/preferences/applications-graphics.png icons/preferences/document-properties.png icons/preferences/stock_keyring.png + icons/other/list-add.png diff --git a/src/data/icons/other/addpanel.png b/src/data/icons/other/addpanel.png new file mode 100644 index 0000000000000000000000000000000000000000..6cb5042f2be71e2fbc5bc1beef88d79df0003c0b GIT binary patch literal 463 zcmV;=0WkiFP)hG98X{hTw1Nz|2if|P_3OO^-P3|u|S*iLP7I%Yp0e29LRxeuHV1P zn;#QK6OoeHd-rLc&b*ljIXB$lpriXd!O%<7@x`002ovPDHLk FV1m0e&c6Tv literal 0 HcmV?d00001 diff --git a/src/data/icons/other/list-add.png b/src/data/icons/other/list-add.png new file mode 100644 index 0000000000000000000000000000000000000000..eb24854a9594b5b792637da2faabb7a37d10e77f GIT binary patch literal 363 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR4qrpp4gU>gfAGmxVt>L|~f2izao*%4U+LiP6uUf@ZTPw*R z({Mq{bJCURUJ(raeRUT$fI>Z4g~l(vm#tNJSr*T^z+__Vvz6P7 zO`YGx1x@)YenQ6ft%7lx;>_u<)7l+c9G*;PPnde_PNdboki|(MQ@<2?go++`c-d7Y zXlX~swd{A@k6+4IR@=&d`tSeb$NUU4zMa3*+!=O%-pBa!o25fVlFvM#yBIuO{an^L HB{Ts5=8a>h literal 0 HcmV?d00001 diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index b1f832b00..d60358296 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -233,7 +233,13 @@ QString DownloadManager::getFileName(QNetworkReply* reply) if (!endName.isEmpty()) endName="."+endName; - return baseName+endName; + QString name = baseName+endName; + if (name.startsWith("\"")) + name = name.mid(1); + if (name.endsWith("\";")) + name.remove("\";"); + + return name; } bool DownloadManager::canClose() diff --git a/src/webview/tabbar.cpp b/src/webview/tabbar.cpp index b53787630..7ea047703 100644 --- a/src/webview/tabbar.cpp +++ b/src/webview/tabbar.cpp @@ -33,7 +33,6 @@ TabBar::TabBar(QupZilla* mainClass, QWidget* parent) : loadSettings(); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); - } void TabBar::loadSettings() @@ -56,14 +55,14 @@ void TabBar::contextMenuRequested(const QPoint &position) TabWidget* tabWidget = qobject_cast(parentWidget()); if (!tabWidget) return; - WebTab* webTab = qobject_cast(tabWidget->widget(m_clickedTab)); - if (!webTab) - return; QMenu menu; menu.addAction(QIcon(":/icons/menu/popup.png"),tr("New tab"), p_QupZilla, SLOT(addTab())); menu.addSeparator(); if (index!=-1) { + WebTab* webTab = qobject_cast(tabWidget->widget(m_clickedTab)); + if (!webTab) + return; menu.addAction( #ifdef Q_WS_X11 style()->standardIcon(QStyle::SP_ArrowBack) @@ -134,7 +133,11 @@ QSize TabBar::tabSizeHint(int index) const if (tabWidget) { WebTab* webTab = qobject_cast(tabWidget->widget(index)); if (webTab && webTab->isPinned()) +#ifdef Q_WS_WIN + size.setWidth(38); +#else size.setWidth(31); +#endif } return size; } diff --git a/src/webview/tabbar.h b/src/webview/tabbar.h index 53273b638..cdc0e9c97 100644 --- a/src/webview/tabbar.h +++ b/src/webview/tabbar.h @@ -38,6 +38,7 @@ public: QSize getTabSizeHint(int index) { return QTabBar::tabSizeHint(index); } void loadSettings(); + QSize getTabSizeHint(int index) const { return QTabBar::tabSizeHint(index); } signals: void reloadTab(int index); diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index 7aa3b7e57..1e7e7c78d 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -23,6 +23,68 @@ #include "locationbar.h" #include "mainapplication.h" #include "webtab.h" +#include "clickablelabel.h" + +class NewTabButton : public QToolButton +{ +public: + explicit NewTabButton(QWidget* parent ) : QToolButton(parent) + { + } + QSize sizeHint() const + { + QSize siz = QToolButton::sizeHint(); + siz.setWidth(25); + return siz; + } + +private: + void paintEvent(QPaintEvent*) + { + QPainter p(this); + QStyleOptionTabV3 opt; + opt.init(this); + style()->drawControl(QStyle::CE_TabBarTab, &opt, &p, this); + + QPixmap pix(":/icons/other/list-add.png"); + QRect r = this->rect(); + r.setHeight(r.height()+3); + r.setWidth(r.width()-1); + style()->drawItemPixmap(&p, r, Qt::AlignCenter, pix); + } +}; + +class TabListButton : public QToolButton +{ +public: + explicit TabListButton(QWidget* parent ) : QToolButton(parent) + { + } + + QSize sizeHint() const + { + QSize siz = QToolButton::sizeHint(); + siz.setWidth(20); + return siz; + } + +private: + void paintEvent(QPaintEvent*) + { + QPainter p(this); + QStyleOptionToolButton opt; + opt.init(this); + if (isDown()) + opt.state |= QStyle::State_On; + if (opt.state & QStyle::State_MouseOver) + opt.activeSubControls = QStyle::SC_ToolButton; + if (!isChecked() && !isDown()) + opt.state |= QStyle::State_Raised; + opt.state |= QStyle::State_AutoRaise; + + style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this); + } +}; TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : QTabWidget(parent) @@ -35,7 +97,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : m_tabBar = new TabBar(p_QupZilla); setTabBar(m_tabBar); setObjectName("tabWidget"); - setStyleSheet(" QTabBar::tab{max-width:250px;}"); + setStyleSheet("QTabBar::tab{ max-width:250px; }"); loadSettings(); @@ -51,20 +113,16 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent) : connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(closeAllButCurrent(int)), this, SLOT(closeAllButCurrent(int))); - m_buttonListTabs = new QToolButton(this); + m_buttonListTabs = new TabListButton(this); m_menuTabs = new QMenu(); m_buttonListTabs->setMenu(m_menuTabs); - m_buttonListTabs->setToolButtonStyle(Qt::ToolButtonTextOnly); m_buttonListTabs->setPopupMode(QToolButton::InstantPopup); - m_buttonListTabs->setAutoRaise(true); m_buttonListTabs->setToolTip(tr("Show list of opened tabs")); connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowTabsMenu())); setCornerWidget(m_buttonListTabs); - m_buttonAddTab = new QToolButton(this); - m_buttonAddTab->setIcon(QIcon(":/icons/other/plus.png")); + m_buttonAddTab = new NewTabButton(this); m_buttonAddTab->setToolTip(tr("Add Tab")); - m_buttonAddTab->setAutoRaise(true); connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab())); setCornerWidget(m_buttonAddTab, Qt::TopLeftCorner); } diff --git a/src/webview/tabwidget.h b/src/webview/tabwidget.h index 5e5231ac2..8add92ee0 100644 --- a/src/webview/tabwidget.h +++ b/src/webview/tabwidget.h @@ -24,11 +24,14 @@ #include #include #include +#include class QupZilla; class WebView; class TabBar; class WebTab; +class TabListButton; +class NewTabButton; class TabWidget : public QTabWidget { @@ -83,8 +86,8 @@ private: TabBar* m_tabBar; QMenu* m_menuTabs; - QToolButton* m_buttonAddTab; - QToolButton* m_buttonListTabs; + NewTabButton* m_buttonAddTab; + TabListButton* m_buttonListTabs; }; #endif // TABWIDGET_H diff --git a/src/webview/webpage.cpp b/src/webview/webpage.cpp index 19ff185ce..81cf2086f 100644 --- a/src/webview/webpage.cpp +++ b/src/webview/webpage.cpp @@ -179,7 +179,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte errString.replace("%FAVICON%", buffer.buffer().toBase64()); errString.replace("%HEADING%", errorString); - errString.replace("%HEADING2%", tr("QupZilla can't load page at %1.").arg(loadedUrl)); + errString.replace("%HEADING2%", tr("QupZilla can't load page from %1.").arg(QUrl(loadedUrl).host())); errString.replace("%LI-1%", tr("Check the address for typing errors such as ww.example.com instead of www.example.com")); errString.replace("%LI-2%", tr("If you are unable to load any pages, check your computer's network connection.")); errString.replace("%LI-3%", tr("If your computer or network is protected by a firewall or proxy, make sure that QupZilla is permitted to access the Web.")); diff --git a/src/webview/webview.cpp b/src/webview/webview.cpp index 4fb960feb..3f9e434b6 100644 --- a/src/webview/webview.cpp +++ b/src/webview/webview.cpp @@ -143,7 +143,8 @@ QLabel* WebView::animationLoading(int index, bool addMovie) QLabel* loadingAnimation = qobject_cast(tabWidget()->getTabBar()->tabButton(index, QTabBar::LeftSide)); if (!loadingAnimation) { - loadingAnimation = new QLabel(this); + loadingAnimation = new QLabel(); + loadingAnimation->setStyleSheet("QLabel { margin: 0px; padding: 0px; }"); } if (addMovie && !loadingAnimation->movie()) { QMovie* movie = new QMovie(":icons/other/progress.gif", QByteArray(), loadingAnimation); diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index a94acb8f0..1104ded63 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -2634,12 +2634,12 @@ Prosím přidejte si nějaký kliknutím na RSS ikonku v navigačním řádku. Unpin Tab - Zrušit připíchnutí + Odepnout panel Pin Tab - Připíchnout panel + Připnout panel