summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp34
-rw-r--r--src/mainview.h12
-rw-r--r--src/webpage.cpp1
-rw-r--r--src/webtab.cpp82
-rw-r--r--src/webtab.h22
-rw-r--r--src/webview.cpp169
-rw-r--r--src/webview.h28
7 files changed, 167 insertions, 181 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 903ec12b..1efcb0e4 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -57,24 +57,23 @@
#include <QtGui/QToolButton>
+// loading pixmap path
+const QString loadingGifPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
+
MainView::MainView(MainWindow *parent)
: KTabWidget(parent)
- , _widgetBar(new StackedUrlBar(this))
- , m_addTabButton(0)
+ , m_widgetBar(new StackedUrlBar(this))
+ , m_addTabButton(new QToolButton(this))
, m_currentTabIndex(0)
, m_parentWindow(parent)
{
// setting tabbar
TabBar *tabBar = new TabBar(this);
- m_addTabButton = new QToolButton(this);
setTabBar(tabBar);
// set mouse tracking for tab previews
setMouseTracking(true);
- // loading pixmap path
- m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
-
// connecting tabbar signals
connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)));
@@ -87,7 +86,7 @@ MainView::MainView(MainWindow *parent)
connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
- connect(tabBar, SIGNAL(tabMoved(int, int)), _widgetBar, SLOT(moveBar(int, int)));
+ connect(tabBar, SIGNAL(tabMoved(int, int)), m_widgetBar, SLOT(moveBar(int, int)));
// current page index changing
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
@@ -96,13 +95,6 @@ MainView::MainView(MainWindow *parent)
}
-MainView::~MainView()
-{
- delete _widgetBar;
- delete m_addTabButton;
-}
-
-
void MainView::postLaunch()
{
QStringList list = Application::sessionManager()->closedSites();
@@ -278,7 +270,7 @@ void MainView::currentChanged(int index)
this, SIGNAL(linkHovered(const QString&)));
emit currentTitle(tab->view()->title());
- _widgetBar->setCurrentIndex(index);
+ m_widgetBar->setCurrentIndex(index);
// clean up "status bar"
emit showStatusBarMessage(QString());
@@ -288,7 +280,7 @@ void MainView::currentChanged(int index)
// set focus to the current webview
if (tab->url().scheme() == QL1S("about"))
- _widgetBar->currentWidget()->setFocus();
+ m_widgetBar->currentWidget()->setFocus();
else
tab->view()->setFocus();
}
@@ -325,12 +317,12 @@ WebTab *MainView::newWebTab(bool focused)
if ( ReKonfig::openTabsNearCurrent() )
{
insertTab(currentIndex() + 1, tab, i18n("(Untitled)"));
- _widgetBar->insertWidget(currentIndex() + 1, tab->urlBar());
+ m_widgetBar->insertWidget(currentIndex() + 1, tab->urlBar());
}
else
{
addTab(tab, i18n("(Untitled)"));
- _widgetBar->addWidget(tab->urlBar());
+ m_widgetBar->addWidget(tab->urlBar());
}
updateTabBar();
@@ -495,8 +487,8 @@ void MainView::closeTab(int index, bool del)
removeTab(index);
updateTabBar(); // UI operation: do it ASAP!!
- _widgetBar->removeWidget( tabToClose->urlBar() );
- _widgetBar->setCurrentIndex(m_currentTabIndex);
+ m_widgetBar->removeWidget( tabToClose->urlBar() );
+ m_widgetBar->setCurrentIndex(m_currentTabIndex);
if (del)
{
@@ -677,7 +669,7 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
}
if (addMovie && !label->movie())
{
- QMovie *movie = new QMovie(m_loadingGitPath, QByteArray(), label);
+ QMovie *movie = new QMovie(loadingGifPath, QByteArray(), label);
movie->setSpeed(50);
label->setMovie(movie);
movie->start();
diff --git a/src/mainview.h b/src/mainview.h
index 3ee688e2..3cb34886 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -66,9 +66,9 @@ class REKONQ_TESTS_EXPORT MainView : public KTabWidget
public:
MainView(MainWindow *parent);
- ~MainView();
- inline StackedUrlBar *widgetBar() const { return _widgetBar; }
+ inline StackedUrlBar *widgetBar() const { return m_widgetBar; }
+
TabBar *tabBar() const;
WebTab *currentWebTab() const;
@@ -178,18 +178,16 @@ private:
// --------------------------------------------------------------------------
- StackedUrlBar *_widgetBar;
-
- QString m_loadingGitPath;
+ StackedUrlBar *const m_widgetBar;
// the new tab button
- QToolButton *m_addTabButton;
+ QToolButton *const m_addTabButton;
int m_currentTabIndex;
QList<HistoryItem> m_recentlyClosedTabs;
- MainWindow *m_parentWindow;
+ MainWindow *const m_parentWindow;
};
#endif // MAINVIEW_H
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 67a33047..b04c5e89 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -211,6 +211,7 @@ WebPage::WebPage(QWidget *parent)
// ----- last stuffs
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
+ connect(this, SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequest(const QNetworkRequest &)));
connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
diff --git a/src/webtab.cpp b/src/webtab.cpp
index b4f070a9..bac73fec 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -48,10 +48,10 @@
WebTab::WebTab(QWidget *parent)
: QWidget(parent)
- , _view(new WebView(this))
- , _bar(new UrlBar(this))
- , _progress(0)
- , _part(0)
+ , m_webView(new WebView(this))
+ , m_urlBar(new UrlBar(this))
+ , m_progress(0)
+ , m_part(0)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@@ -59,13 +59,13 @@ WebTab::WebTab(QWidget *parent)
l->setMargin(0);
l->setSpacing(0);
- l->addWidget(_view);
- _view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ l->addWidget(m_webView);
+ m_webView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// fix focus handling
- setFocusProxy(_view);
+ setFocusProxy(m_webView);
- KWebWallet *wallet = _view->page()->wallet();
+ KWebWallet *wallet = m_webView->page()->wallet();
if (wallet)
{
@@ -73,18 +73,18 @@ WebTab::WebTab(QWidget *parent)
this, SLOT(createWalletBar(const QString &, const QUrl &)));
}
- connect(_view, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
- connect(_view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
- connect(_view, SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &)));
+ connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
+ connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
+ connect(m_webView, SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &)));
}
WebTab::~WebTab()
{
- _walletBar.clear();
- _previewSelectorBar.clear();
+ m_walletBar.clear();
+ m_previewSelectorBar.clear();
- delete _part;
+ delete m_part;
}
@@ -102,20 +102,20 @@ KUrl WebTab::url()
void WebTab::updateProgress(int p)
{
- _progress = p;
+ m_progress = p;
emit loadProgressing();
}
void WebTab::loadFinished(bool)
{
- _progress = 0;
+ m_progress = 0;
}
bool WebTab::isPageLoading()
{
- return _progress != 0;
+ return m_progress != 0;
}
@@ -128,37 +128,37 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url)
return;
KWebWallet *wallet = page()->wallet();
- if(_walletBar.isNull()) {
- _walletBar = new WalletBar(this);
- _walletBar.data()->onSaveFormData(key, url);
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, _walletBar.data() );
+ if(m_walletBar.isNull()) {
+ m_walletBar = new WalletBar(this);
+ m_walletBar.data()->onSaveFormData(key, url);
+ qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_walletBar.data() );
} else {
disconnect(wallet);
- _walletBar.data()->notifyUser();
+ m_walletBar.data()->notifyUser();
}
- connect(_walletBar.data(), SIGNAL(saveFormDataAccepted(const QString &)),
+ connect(m_walletBar.data(), SIGNAL(saveFormDataAccepted(const QString &)),
wallet, SLOT(acceptSaveFormDataRequest(const QString &)), Qt::UniqueConnection);
- connect(_walletBar.data(), SIGNAL(saveFormDataRejected(const QString &)),
+ connect(m_walletBar.data(), SIGNAL(saveFormDataRejected(const QString &)),
wallet, SLOT(rejectSaveFormDataRequest(const QString &)), Qt::UniqueConnection);
}
void WebTab::createPreviewSelectorBar(int index)
{
- if(_previewSelectorBar.isNull()) {
- _previewSelectorBar = new PreviewSelectorBar(index, this);
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, _previewSelectorBar.data());
+ if(m_previewSelectorBar.isNull()) {
+ m_previewSelectorBar = new PreviewSelectorBar(index, this);
+ qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_previewSelectorBar.data());
} else {
- disconnect(_previewSelectorBar.data());
- _previewSelectorBar.data()->setIndex(index);
- _previewSelectorBar.data()->notifyUser();
+ disconnect(m_previewSelectorBar.data());
+ m_previewSelectorBar.data()->setIndex(index);
+ m_previewSelectorBar.data()->notifyUser();
}
- connect(page(), SIGNAL(loadStarted()), _previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
- connect(page(), SIGNAL(loadProgress(int)), _previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
- connect(page(), SIGNAL(loadFinished(bool)), _previewSelectorBar.data(), SLOT(loadFinished()), Qt::UniqueConnection);
- connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), _previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection);
+ connect(page(), SIGNAL(loadStarted()), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
+ connect(page(), SIGNAL(loadProgress(int)), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
+ connect(page(), SIGNAL(loadFinished(bool)), m_previewSelectorBar.data(), SLOT(loadFinished()), Qt::UniqueConnection);
+ connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), m_previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection);
}
void WebTab::insertBar(NotificationBar *bar)
@@ -217,21 +217,21 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u)
if(p)
{
// Ok, part exists. Insert & show it..
- _part = p;
+ m_part = p;
qobject_cast<QVBoxLayout *>(layout())->insertWidget(1, p->widget());
p->openUrl(u);
- _view->hide();
+ m_webView->hide();
emit titleChanged(u.url());
return;
}
- if(!_part)
+ if(!m_part)
return;
// Part NO more exists. Let's clean up from webtab
- _view->show();
- qobject_cast<QVBoxLayout *>(layout())->removeWidget(_part->widget());
- delete _part;
- _part = 0;
+ m_webView->show();
+ qobject_cast<QVBoxLayout *>(layout())->removeWidget(m_part->widget());
+ delete m_part;
+ m_part = 0;
}
diff --git a/src/webtab.h b/src/webtab.h
index abab5d73..12f528d9 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -56,10 +56,10 @@ public:
explicit WebTab(QWidget *parent = 0);
~WebTab();
- inline WebView *view() { return _view; }
- UrlBar *urlBar() { return _bar; }
- inline WebPage *page() { return view()->page(); }
- inline int progress() { return _progress; }
+ inline WebView *view() const { return m_webView; }
+ UrlBar *urlBar() const { return m_urlBar; }
+ inline WebPage *page() const { return view()->page(); }
+ inline int progress() const { return m_progress; }
KUrl url();
void createPreviewSelectorBar(int index);
@@ -68,7 +68,7 @@ public:
bool hasRSSInfo();
bool isPageLoading();
- KParts::ReadOnlyPart *part() { return _part; }
+ KParts::ReadOnlyPart *part() { return m_part; }
void setPart(KParts::ReadOnlyPart *p, const KUrl &u);
private Q_SLOTS:
@@ -83,15 +83,15 @@ Q_SIGNALS:
void titleChanged(const QString &);
private:
- WebView *_view;
- UrlBar *_bar;
+ WebView *const m_webView;
+ UrlBar *const m_urlBar;
- int _progress;
+ int m_progress;
- QWeakPointer<WalletBar> _walletBar;
- QWeakPointer<PreviewSelectorBar> _previewSelectorBar;
+ QWeakPointer<WalletBar> m_walletBar;
+ QWeakPointer<PreviewSelectorBar> m_previewSelectorBar;
- KParts::ReadOnlyPart *_part;
+ KParts::ReadOnlyPart *m_part;
};
#endif
diff --git a/src/webview.cpp b/src/webview.cpp
index 978181a5..7664805f 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -65,15 +65,15 @@
WebView::WebView(QWidget* parent)
: KWebView(parent, false)
- , _mousePos(QPoint(0, 0))
- , _autoScrollTimer(new QTimer(this))
- , _VScrollSpeed(0)
- , _HScrollSpeed(0)
- , _canEnableAutoScroll(true)
- , _isAutoScrollEnabled(false)
- , _smoothScrollTimer(new QTimer(this))
- , _smoothScrolling(false)
- , _dy(0)
+ , m_mousePos(QPoint(0, 0))
+ , m_autoScrollTimer(new QTimer(this))
+ , m_vScrollSpeed(0)
+ , m_hScrollSpeed(0)
+ , m_canEnableAutoScroll(true)
+ , m_isAutoScrollEnabled(false)
+ , m_smoothScrollTimer(new QTimer(this))
+ , m_smoothScrolling(false)
+ , m_dy(0)
{
WebPage *page = new WebPage(this);
setPage(page);
@@ -94,7 +94,6 @@ WebView::WebView(QWidget* parent)
// download system
connect(this, SIGNAL(linkShiftClicked(const KUrl &)), page, SLOT(downloadUrl(const KUrl &)));
- connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)), page, SLOT(downloadRequest(const QNetworkRequest &)));
// middle click || ctrl + click signal
connect(this, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)), this, SLOT(loadUrlInNewTab(const KUrl &)));
@@ -104,24 +103,19 @@ WebView::WebView(QWidget* parent)
Application::instance(), SLOT(loadUrl(const KUrl &, const Rekonq::OpenType &)));
// Auto scroll timer
- connect(_autoScrollTimer, SIGNAL(timeout()), this, SLOT(scrollFrameChanged()));
- _autoScrollTimer->setInterval(100);
+ connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(scrollFrameChanged()));
+ m_autoScrollTimer->setInterval(100);
// Smooth scroll timer
- connect(_smoothScrollTimer, SIGNAL(timeout()), this, SLOT(scrollTick()));
- _smoothScrollTimer->setInterval(16);
+ connect(m_smoothScrollTimer, SIGNAL(timeout()), this, SLOT(scrollTick()));
+ m_smoothScrollTimer->setInterval(16);
}
WebView::~WebView()
{
- delete _autoScrollTimer;
-
- if (_smoothScrolling)
+ if (m_smoothScrolling)
stopScrolling();
- delete _smoothScrollTimer;
-
- disconnect();
WebPage* p = page();
@@ -134,7 +128,8 @@ WebView::~WebView()
WebPage *WebView::page()
{
- WebPage *page = qobject_cast<WebPage *>(KWebView::page());
+ WebPage *const page = qobject_cast<WebPage *>(KWebView::page());
+ Q_ASSERT(page);
return page;
}
@@ -350,18 +345,18 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
void WebView::mousePressEvent(QMouseEvent *event)
{
- if (_isAutoScrollEnabled)
+ if (m_isAutoScrollEnabled)
{
setCursor(Qt::ArrowCursor);
- _VScrollSpeed = 0;
- _HScrollSpeed = 0;
- _autoScrollTimer->stop();
- _isAutoScrollEnabled = false;
+ m_vScrollSpeed = 0;
+ m_hScrollSpeed = 0;
+ m_autoScrollTimer->stop();
+ m_isAutoScrollEnabled = false;
return;
}
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
- _canEnableAutoScroll = ReKonfig::autoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty();
+ m_canEnableAutoScroll = ReKonfig::autoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty();
switch (event->button())
{
@@ -374,11 +369,11 @@ void WebView::mousePressEvent(QMouseEvent *event)
break;
case Qt::MidButton:
- if (_canEnableAutoScroll && !_isAutoScrollEnabled)
+ if (m_canEnableAutoScroll && !m_isAutoScrollEnabled)
{
setCursor(KIcon("transform-move").pixmap(32));
- _clickPos = event->pos();
- _isAutoScrollEnabled = true;
+ m_clickPos = event->pos();
+ m_isAutoScrollEnabled = true;
}
break;
@@ -391,15 +386,15 @@ void WebView::mousePressEvent(QMouseEvent *event)
void WebView::mouseMoveEvent(QMouseEvent *event)
{
- _mousePos = event->pos();
+ m_mousePos = event->pos();
- if (_isAutoScrollEnabled)
+ if (m_isAutoScrollEnabled)
{
- QPoint r = _mousePos - _clickPos;
- _HScrollSpeed = r.x() / 2; // you are too fast..
- _VScrollSpeed = r.y() / 2;
- if (!_autoScrollTimer->isActive())
- _autoScrollTimer->start();
+ QPoint r = m_mousePos - m_clickPos;
+ m_hScrollSpeed = r.x() / 2; // you are too fast..
+ m_vScrollSpeed = r.y() / 2;
+ if (!m_autoScrollTimer->isActive())
+ m_autoScrollTimer->start();
return;
}
@@ -505,7 +500,7 @@ void WebView::keyPressEvent(QKeyEvent *event)
}
}
- if (!_canEnableAutoScroll)
+ if (!m_canEnableAutoScroll)
{
KWebView::keyPressEvent(event);
return;
@@ -516,44 +511,44 @@ void WebView::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Up)
{
- _VScrollSpeed--;
- if (!_autoScrollTimer->isActive())
- _autoScrollTimer->start();
+ m_vScrollSpeed--;
+ if (!m_autoScrollTimer->isActive())
+ m_autoScrollTimer->start();
return;
}
if (event->key() == Qt::Key_Down)
{
- _VScrollSpeed++;
- if (!_autoScrollTimer->isActive())
- _autoScrollTimer->start();
+ m_vScrollSpeed++;
+ if (!m_autoScrollTimer->isActive())
+ m_autoScrollTimer->start();
return;
}
if (event->key() == Qt::Key_Right)
{
- _HScrollSpeed++;
- if (!_autoScrollTimer->isActive())
- _autoScrollTimer->start();
+ m_hScrollSpeed++;
+ if (!m_autoScrollTimer->isActive())
+ m_autoScrollTimer->start();
return;
}
if (event->key() == Qt::Key_Left)
{
- _HScrollSpeed--;
- if (!_autoScrollTimer->isActive())
- _autoScrollTimer->start();
+ m_hScrollSpeed--;
+ if (!m_autoScrollTimer->isActive())
+ m_autoScrollTimer->start();
return;
}
- if (_autoScrollTimer->isActive())
+ if (m_autoScrollTimer->isActive())
{
- _autoScrollTimer->stop();
+ m_autoScrollTimer->stop();
}
else
{
- if (_VScrollSpeed || _HScrollSpeed)
- _autoScrollTimer->start();
+ if (m_vScrollSpeed || m_hScrollSpeed)
+ m_autoScrollTimer->start();
}
}
@@ -589,13 +584,13 @@ void WebView::wheelEvent(QWheelEvent *event)
page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), prevPos));
- if ((event->delta() > 0) != !_scrollBottom)
+ if ((event->delta() > 0) != !m_scrollBottom)
stopScrolling();
if (event->delta() > 0)
- _scrollBottom = false;
+ m_scrollBottom = false;
else
- _scrollBottom = true;
+ m_scrollBottom = true;
setupSmoothScrolling(abs(newPos - prevPos));
@@ -621,46 +616,46 @@ void WebView::loadUrlInNewTab(const KUrl &url)
void WebView::scrollFrameChanged()
{
// do the scrolling
- page()->currentFrame()->scroll(_HScrollSpeed, _VScrollSpeed);
+ page()->currentFrame()->scroll(m_hScrollSpeed, m_vScrollSpeed);
// check if we reached the end
int y = page()->currentFrame()->scrollPosition().y();
if (y == 0 || y == page()->currentFrame()->scrollBarMaximum(Qt::Vertical))
- _VScrollSpeed = 0;
+ m_vScrollSpeed = 0;
int x = page()->currentFrame()->scrollPosition().x();
if (x == 0 || x == page()->currentFrame()->scrollBarMaximum(Qt::Horizontal))
- _HScrollSpeed = 0;
+ m_hScrollSpeed = 0;
}
void WebView::setupSmoothScrolling(int posY)
{
- int ddy = qMax(_smoothScrollSteps ? abs(_dy)/_smoothScrollSteps : 0,3);
+ int ddy = qMax(m_smoothScrollSteps ? abs(m_dy)/m_smoothScrollSteps : 0,3);
- _dy += posY;
+ m_dy += posY;
- if (_dy <= 0)
+ if (m_dy <= 0)
{
stopScrolling();
return;
}
- _smoothScrollSteps = 8;
+ m_smoothScrollSteps = 8;
- if (_dy / _smoothScrollSteps < ddy)
+ if (m_dy / m_smoothScrollSteps < ddy)
{
- _smoothScrollSteps = (abs(_dy)+ddy-1)/ddy;
- if (_smoothScrollSteps < 1)
- _smoothScrollSteps = 1;
+ m_smoothScrollSteps = (abs(m_dy)+ddy-1)/ddy;
+ if (m_smoothScrollSteps < 1)
+ m_smoothScrollSteps = 1;
}
- _smoothScrollTime.start();
+ m_smoothScrollTime.start();
- if (!_smoothScrolling)
+ if (!m_smoothScrolling)
{
- _smoothScrolling = true;
- _smoothScrollTimer->start();
+ m_smoothScrolling = true;
+ m_smoothScrollTimer->start();
scrollTick();
}
}
@@ -668,39 +663,39 @@ void WebView::setupSmoothScrolling(int posY)
void WebView::scrollTick()
{
- if (_dy == 0)
+ if (m_dy == 0)
{
stopScrolling();
return;
}
- if (_smoothScrollSteps < 1)
- _smoothScrollSteps = 1;
+ if (m_smoothScrollSteps < 1)
+ m_smoothScrollSteps = 1;
- int takesteps = _smoothScrollTime.restart() / 16;
+ int takesteps = m_smoothScrollTime.restart() / 16;
int scroll_y = 0;
if (takesteps < 1)
takesteps = 1;
- if (takesteps > _smoothScrollSteps)
- takesteps = _smoothScrollSteps;
+ if (takesteps > m_smoothScrollSteps)
+ takesteps = m_smoothScrollSteps;
for(int i = 0; i < takesteps; i++)
{
- int ddy = (_dy / (_smoothScrollSteps+1)) * 2;
+ int ddy = (m_dy / (m_smoothScrollSteps+1)) * 2;
// limit step to requested scrolling distance
- if (abs(ddy) > abs(_dy))
- ddy = _dy;
+ if (abs(ddy) > abs(m_dy))
+ ddy = m_dy;
// update remaining scroll
- _dy -= ddy;
+ m_dy -= ddy;
scroll_y += ddy;
- _smoothScrollSteps--;
+ m_smoothScrollSteps--;
}
- if (_scrollBottom)
+ if (m_scrollBottom)
page()->currentFrame()->scroll(0, scroll_y);
else
page()->currentFrame()->scroll(0, -scroll_y);
@@ -709,7 +704,7 @@ void WebView::scrollTick()
void WebView::stopScrolling()
{
- _smoothScrollTimer->stop();
- _dy = 0;
- _smoothScrolling = false;
+ m_smoothScrollTimer->stop();
+ m_dy = 0;
+ m_smoothScrolling = false;
}
diff --git a/src/webview.h b/src/webview.h
index e760cfe1..9518b74d 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -52,7 +52,7 @@ public:
WebPage *page();
- inline QPoint mousePos() { return _mousePos; }
+ inline QPoint mousePos() { return m_mousePos; }
protected:
void contextMenuEvent(QContextMenuEvent *event);
@@ -86,23 +86,23 @@ signals:
void zoomChanged(int);
private:
- QPoint _mousePos;
- QPoint _clickPos;
+ QPoint m_mousePos;
+ QPoint m_clickPos;
// Auto Scroll
- QTimer *_autoScrollTimer;
- int _VScrollSpeed;
- int _HScrollSpeed;
- bool _canEnableAutoScroll;
- bool _isAutoScrollEnabled;
+ QTimer *const m_autoScrollTimer;
+ int m_vScrollSpeed;
+ int m_hScrollSpeed;
+ bool m_canEnableAutoScroll;
+ bool m_isAutoScrollEnabled;
// Smooth Scroll
- QTimer *_smoothScrollTimer;
- QTime _smoothScrollTime;
- bool _scrollBottom;
- bool _smoothScrolling;
- int _dy;
- int _smoothScrollSteps;
+ QTimer *const m_smoothScrollTimer;
+ QTime m_smoothScrollTime;
+ bool m_scrollBottom;
+ bool m_smoothScrolling;
+ int m_dy;
+ int m_smoothScrollSteps;
};
#endif