1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Fixed loading animation sometimes stopped while page still loading +

updated positioning of hovered link widget
Also when adblock is disabled, the statusbar icon is now clickable.
When running with different profile from command line argument, in
preferences will be showed real starting profile, not active.
This commit is contained in:
nowrep 2011-10-15 16:37:32 +02:00
parent 3747babdc9
commit 722a79aef1
12 changed files with 71 additions and 74 deletions

View File

@ -26,6 +26,7 @@ Compiling
Before compiling, make sure you have have installed Qt (>=4.7) development libraries and
you read BUILDING informations.
Then you can start compile by running this commands:
$ cd src/
@ -33,6 +34,7 @@ Then you can start compile by running this commands:
$ make
The executable binary can now be found in bin/ directory.
To install QupZilla, run this command: (it may be neccessary to run as root)
$ make install
@ -53,4 +55,5 @@ FAQ and Changelog
If you are experiencing some sort of issue, before you open an issue, please read FAQ.
FAQ: https://github.com/nowrep/QupZilla/blob/master/FAQ
Changelog: https://github.com/nowrep/QupZilla/wiki/Changelog

View File

@ -21,10 +21,9 @@
#include "webpage.h"
AdBlockIcon::AdBlockIcon(QupZilla *mainClass, QWidget *parent)
:ClickableLabel(parent)
,p_QupZilla(mainClass)
: ClickableLabel(parent)
, p_QupZilla(mainClass)
{
setPixmap(QPixmap(":/icons/other/adblock.png"));
setMaximumHeight(16);
setCursor(Qt::PointingHandCursor);
setToolTip(tr("AdBlock let you block any unwanted content on pages"));
@ -60,6 +59,14 @@ void AdBlockIcon::learnAboutRules()
p_QupZilla->tabWidget()->addView(QUrl("http://adblockplus.org/en/filters"), tr("New tab"), TabWidget::NewSelectedTab);
}
void AdBlockIcon::setEnabled(bool enabled)
{
if (enabled)
setPixmap(QPixmap(":icons/other/adblock.png"));
else
setPixmap(QPixmap(":icons/other/adblock-disabled.png"));
}
AdBlockIcon::~AdBlockIcon()
{
}

View File

@ -34,6 +34,7 @@ public:
signals:
public slots:
void setEnabled(bool enabled);
private slots:
void showMenu(const QPoint &pos);

View File

@ -78,16 +78,16 @@ const QIcon QupZilla::qupzillaIcon()
return i;
}
QupZilla::QupZilla(bool tryRestore, QUrl startUrl) :
QMainWindow(0)
,m_tryRestore(tryRestore)
,m_historyMenuChanged(true)
,m_bookmarksMenuChanged(true)
,m_startingUrl(startUrl)
,m_actionPrivateBrowsing(0)
,m_webInspectorDock(0)
,m_sideBar(0)
,m_statusBarMessage(new StatusBarMessage(this))
QupZilla::QupZilla(bool tryRestore, QUrl startUrl)
: QMainWindow(0)
, m_tryRestore(tryRestore)
, m_historyMenuChanged(true)
, m_bookmarksMenuChanged(true)
, m_startingUrl(startUrl)
, m_actionPrivateBrowsing(0)
, m_webInspectorDock(0)
, m_sideBar(0)
, m_statusBarMessage(new StatusBarMessage(this))
{
setObjectName("mainwindow");
setAttribute(Qt::WA_DeleteOnClose);

View File

@ -223,7 +223,7 @@ private:
QAction* m_actionRestoreTab;
QLabel* m_privateBrowsing;
ClickableLabel* m_adblockIcon;
AdBlockIcon* m_adblockIcon;
QPointer<WebInspectorDockWidget> m_webInspectorDock;
BookmarksToolbar* m_bookmarksToolbar;

View File

@ -65,5 +65,6 @@
<file>icons/exeicons/qupzilla256.png</file>
<file>icons/menu/informations.png</file>
<file>icons/faenza/user-bookmarks.png</file>
<file>icons/other/adblock-disabled.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 902 B

View File

@ -21,10 +21,6 @@
TipLabel::TipLabel(QupZilla* parent) : SqueezeLabelV1(parent) , p_QupZilla(parent)
{
m_timer = new QTimer();
m_timer->setInterval(300);
connect(m_timer, SIGNAL(timeout()), this, SLOT(checkMainWindowFocus()));
setWindowFlags(Qt::ToolTip);
setForegroundRole(QPalette::ToolTipText);
setBackgroundRole(QPalette::ToolTipBase);
@ -45,52 +41,43 @@ void TipLabel::paintEvent(QPaintEvent *ev)
SqueezeLabelV1::paintEvent(ev);
}
void TipLabel::show()
{
if (!p_QupZilla->weView()->hasFocus())
return;
m_timer->start();
SqueezeLabelV1::show();
}
void TipLabel::hide()
{
m_timer->stop();
SqueezeLabelV1::hide();
}
void TipLabel::checkMainWindowFocus()
{
if (!p_QupZilla->weView()->hasFocus())
hide();
}
StatusBarMessage::StatusBarMessage(QupZilla* mainClass)
: QObject()
: QObject(mainClass)
, p_QupZilla(mainClass)
, m_statusBarText(new TipLabel(mainClass))
{
m_statusBarText = new TipLabel(mainClass);
}
#define STATUS_Y_OFFSET -35
#define STATUS_X_OFFSET +3
#define STATUS_TOOLTIP_WIDTH_OFFSET -20
void StatusBarMessage::showMessage(const QString &message)
{
if (p_QupZilla->statusBar()->isVisible()) {
if (p_QupZilla->statusBar()->isVisible())
p_QupZilla->statusBar()->showMessage(message);
} else {
QPoint position = p_QupZilla->weView()->mapToGlobal(p_QupZilla->weView()->pos());
position.setY( p_QupZilla->weView()->size().height() + position.y() STATUS_Y_OFFSET);
position.setX(position.x() STATUS_X_OFFSET);
m_statusBarText->move(position);
m_statusBarText->setMaximumWidth(p_QupZilla->size().width() STATUS_TOOLTIP_WIDTH_OFFSET);
else {
WebView* view = p_QupZilla->weView();
QWebFrame* mainFrame = view->page()->mainFrame();
int horizontalScrollSize = 0;
int verticalScrollSize = 0;
const int scrollbarSize = p_QupZilla->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
if (mainFrame->scrollBarMaximum(Qt::Horizontal))
horizontalScrollSize = scrollbarSize;
if (mainFrame->scrollBarMaximum(Qt::Vertical))
verticalScrollSize = scrollbarSize;
m_statusBarText->setText(message);
m_statusBarText->resize(m_statusBarText->sizeHint());
m_statusBarText->setMaximumWidth(view->width() - verticalScrollSize);
QPoint position;
position.setY(view->height() - horizontalScrollSize - m_statusBarText->height());
QRect statusRect = QRect(view->mapToGlobal(QPoint(0, position.y())), m_statusBarText->size());
if (statusRect.contains(QCursor::pos()))
position.setY(position.y() - m_statusBarText->height());
m_statusBarText->move(view->mapToGlobal(position));
m_statusBarText->show();
}
}

View File

@ -21,6 +21,7 @@
#include <QObject>
#include <QToolTip>
#include "squeezelabelv1.h"
#include "animatedwidget.h"
class QupZilla;
class TipLabel;
@ -31,14 +32,8 @@ class TipLabel : public SqueezeLabelV1 {
public:
TipLabel(QupZilla* parent);
void paintEvent(QPaintEvent *ev);
void show();
void hide();
private slots:
void checkMainWindowFocus();
private:
QTimer* m_timer;
QupZilla* p_QupZilla;
};

View File

@ -101,12 +101,13 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) :
connect(ui->newTabUseActual, SIGNAL(clicked()), this, SLOT(useActualNewTab()));
//PROFILES
m_actProfileName = mApp->getActiveProfilPath();
m_actProfileName = m_actProfileName.left(m_actProfileName.length()-1);
m_actProfileName = m_actProfileName.mid(m_actProfileName.lastIndexOf("/"));
m_actProfileName.remove("/");
QString homePath = QDir::homePath();
homePath += "/.qupzilla/";
QSettings profileSettings(homePath + "profiles/profiles.ini", QSettings::IniFormat);
m_actProfileName = profileSettings.value("Profiles/startProfile", "default").toString();
ui->startProfile->addItem(m_actProfileName);
QDir profilesDir(QDir::homePath()+"/.qupzilla/profiles/");
QDir profilesDir(QDir::homePath() + "/.qupzilla/profiles/");
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach (QString name, list_) {
if (m_actProfileName == name)
@ -675,9 +676,9 @@ void Preferences::saveSettings()
//Profiles
QString homePath = QDir::homePath();
homePath+="/.qupzilla/";
QSettings profileSettings(homePath+"profiles/profiles.ini", QSettings::IniFormat);
profileSettings.setValue("Profiles/startProfile",ui->startProfile->currentText());
homePath += "/.qupzilla/";
QSettings profileSettings(homePath + "profiles/profiles.ini", QSettings::IniFormat);
profileSettings.setValue("Profiles/startProfile", ui->startProfile->currentText());
m_pluginsList->save();
m_themesManager->save();

View File

@ -255,11 +255,11 @@ void WebView::titleChanged()
QString title2 = title_;
tabWidget()->setTabToolTip(tabIndex(),title2);
title2+=" - QupZilla";
title2 += " - QupZilla";
if (isCurrent())
p_QupZilla->setWindowTitle(title2);
tabWidget()->setTabText(tabIndex(),title_);
tabWidget()->setTabText(tabIndex(), title_);
}
void WebView::iconChanged()
@ -267,15 +267,17 @@ void WebView::iconChanged()
if (mApp->isClosing())
return;
// QIcon icon_ = icon();
if (isCurrent())
emit siteIconChanged();
if (m_isLoading)
return;
QIcon icon_ = siteIcon();
if (!icon_.isNull())
animationLoading(tabIndex(), false)->setPixmap(icon_.pixmap(16,16));
else
animationLoading(tabIndex(), false)->setPixmap(IconProvider::fromTheme("text-plain").pixmap(16,16));
if (isCurrent())
emit siteIconChanged();
}
QIcon WebView::siteIcon()