mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Various changes in add new tab button and list all tabs menu
This commit is contained in:
parent
0102bd8ca3
commit
91bd95dc59
Binary file not shown.
|
@ -69,5 +69,6 @@
|
|||
<file>icons/preferences/applications-graphics.png</file>
|
||||
<file>icons/preferences/document-properties.png</file>
|
||||
<file>icons/preferences/stock_keyring.png</file>
|
||||
<file>icons/other/list-add.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
src/data/icons/other/addpanel.png
Normal file
BIN
src/data/icons/other/addpanel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 463 B |
BIN
src/data/icons/other/list-add.png
Normal file
BIN
src/data/icons/other/list-add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 363 B |
BIN
src/data/icons/other/plusgrey.png
Normal file
BIN
src/data/icons/other/plusgrey.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 268 B |
|
@ -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()
|
||||
|
|
|
@ -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<TabWidget*>(parentWidget());
|
||||
if (!tabWidget)
|
||||
return;
|
||||
WebTab* webTab = qobject_cast<WebTab*>(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<WebTab*>(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<WebTab*>(tabWidget->widget(index));
|
||||
if (webTab && webTab->isPinned())
|
||||
#ifdef Q_WS_WIN
|
||||
size.setWidth(38);
|
||||
#else
|
||||
size.setWidth(31);
|
||||
#endif
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -24,11 +24,14 @@
|
|||
#include <QTabBar>
|
||||
#include <QDateTime>
|
||||
#include <QToolButton>
|
||||
#include <QStylePainter>
|
||||
|
||||
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
|
||||
|
|
|
@ -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 <b>ww.</b>example.com instead of <b>www.</b>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."));
|
||||
|
|
|
@ -143,7 +143,8 @@ QLabel* WebView::animationLoading(int index, bool addMovie)
|
|||
|
||||
QLabel* loadingAnimation = qobject_cast<QLabel*>(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);
|
||||
|
|
|
@ -2634,12 +2634,12 @@ Prosím přidejte si nějaký kliknutím na RSS ikonku v navigačním řádku.</
|
|||
<message>
|
||||
<location filename="../src/webview/tabbar.cpp" line="126"/>
|
||||
<source>Unpin Tab</source>
|
||||
<translation>Zrušit připíchnutí</translation>
|
||||
<translation>Odepnout panel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/tabbar.cpp" line="126"/>
|
||||
<source>Pin Tab</source>
|
||||
<translation>Připíchnout panel</translation>
|
||||
<translation>Připnout panel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/webview/tabbar.cpp" line="128"/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user