2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2012-01-01 15:29:55 +01:00
|
|
|
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2011-03-02 16:57:41 +01:00
|
|
|
#ifndef LOCATIONBAR_H
|
|
|
|
#define LOCATIONBAR_H
|
|
|
|
|
|
|
|
#include <QUrl>
|
2011-12-23 11:11:14 +01:00
|
|
|
|
2012-02-29 18:33:50 +01:00
|
|
|
#include "qz_namespace.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "lineedit.h"
|
2012-04-22 17:09:43 +02:00
|
|
|
#include "completer/locationcompleter.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
class QupZilla;
|
|
|
|
class LineEdit;
|
|
|
|
class LocationCompleter;
|
|
|
|
class ClickableLabel;
|
2011-04-15 20:45:22 +02:00
|
|
|
class BookmarkIcon;
|
2012-01-21 20:27:45 +01:00
|
|
|
class TabbedWebView;
|
2011-12-17 14:26:34 +01:00
|
|
|
class SiteIcon;
|
2011-12-27 18:50:52 +01:00
|
|
|
class GoIcon;
|
|
|
|
class RssIcon;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
|
|
|
class QT_QUPZILLA_EXPORT LocationBar : public LineEdit
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
2011-07-11 20:30:49 +02:00
|
|
|
Q_OBJECT
|
2011-09-11 19:15:06 +02:00
|
|
|
Q_PROPERTY(QSize fixedsize READ size WRITE setFixedSize)
|
|
|
|
Q_PROPERTY(int fixedwidth READ width WRITE setFixedWidth)
|
|
|
|
Q_PROPERTY(int fixedheight READ height WRITE setFixedHeight)
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
public:
|
2011-07-11 20:30:49 +02:00
|
|
|
explicit LocationBar(QupZilla* mainClass);
|
2011-03-02 16:57:41 +01:00
|
|
|
~LocationBar();
|
|
|
|
|
2012-08-24 20:53:53 +02:00
|
|
|
void setWebView(TabbedWebView* view);
|
2012-01-21 20:27:45 +01:00
|
|
|
TabbedWebView* webView() { return m_webView; }
|
2011-07-11 20:30:49 +02:00
|
|
|
|
2011-12-15 17:43:06 +01:00
|
|
|
signals:
|
|
|
|
void loadUrl(const QUrl &url);
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
public slots:
|
2012-01-21 20:27:45 +01:00
|
|
|
void showUrl(const QUrl &url);
|
2012-04-22 17:09:43 +02:00
|
|
|
void setText(const QString &text);
|
2011-03-03 14:25:02 +01:00
|
|
|
|
2012-08-24 20:53:53 +02:00
|
|
|
protected:
|
|
|
|
virtual void paintEvent(QPaintEvent* event);
|
|
|
|
|
2011-03-03 14:25:02 +01:00
|
|
|
private slots:
|
2011-03-02 16:57:41 +01:00
|
|
|
void siteIconChanged();
|
|
|
|
void setPrivacy(bool state);
|
|
|
|
void textEdit();
|
2011-12-11 14:12:40 +01:00
|
|
|
void showMostVisited();
|
2011-03-02 16:57:41 +01:00
|
|
|
void showSiteInfo();
|
2011-03-03 14:25:02 +01:00
|
|
|
void rssIconClicked();
|
2012-09-14 22:09:58 +02:00
|
|
|
void bookmarkIconClicked();
|
2011-07-11 20:30:49 +02:00
|
|
|
void urlEnter();
|
|
|
|
void clearIcon();
|
|
|
|
void showRSSIcon(bool state);
|
2012-01-21 19:26:47 +01:00
|
|
|
void pasteAndGo();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2011-11-06 12:05:16 +01:00
|
|
|
void updatePlaceHolderText();
|
2012-09-08 22:52:32 +02:00
|
|
|
void showCompletion(const QString &newText);
|
2011-11-06 12:05:16 +01:00
|
|
|
|
2012-09-19 10:08:30 +02:00
|
|
|
void onLoadStarted();
|
2012-08-24 20:53:53 +02:00
|
|
|
void onLoadProgress(int progress);
|
|
|
|
void onLoadFinished();
|
|
|
|
void hideProgress();
|
|
|
|
|
2012-09-19 10:08:30 +02:00
|
|
|
void onMessage(Qz::AppMessageType, bool);
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
private:
|
2012-09-19 10:08:30 +02:00
|
|
|
enum ProgressStyle {
|
|
|
|
ProgressFilled,
|
|
|
|
ProgressBottom,
|
|
|
|
ProgressTop
|
|
|
|
};
|
|
|
|
|
2012-01-21 19:26:47 +01:00
|
|
|
void contextMenuEvent(QContextMenuEvent* event);
|
2012-09-06 10:53:37 +02:00
|
|
|
void focusInEvent(QFocusEvent* event);
|
|
|
|
void focusOutEvent(QFocusEvent* event);
|
2011-03-17 17:03:04 +01:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
2011-11-16 16:47:08 +01:00
|
|
|
void mousePressEvent(QMouseEvent* event);
|
2011-03-17 17:03:04 +01:00
|
|
|
void keyPressEvent(QKeyEvent* event);
|
2012-01-18 16:52:30 +01:00
|
|
|
void keyReleaseEvent(QKeyEvent* event);
|
2011-03-17 17:03:04 +01:00
|
|
|
void dropEvent(QDropEvent* event);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-18 16:52:30 +01:00
|
|
|
QUrl createUrl();
|
2012-09-06 10:53:37 +02:00
|
|
|
QString convertUrlToText(const QUrl &url) const;
|
2012-01-18 16:52:30 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
void showGoButton();
|
|
|
|
void hideGoButton();
|
|
|
|
|
2012-09-19 10:08:30 +02:00
|
|
|
void loadSettings();
|
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
LocationCompleter m_completer;
|
|
|
|
|
2011-04-15 20:45:22 +02:00
|
|
|
BookmarkIcon* m_bookmarkIcon;
|
2011-12-27 18:50:52 +01:00
|
|
|
GoIcon* m_goIcon;
|
|
|
|
RssIcon* m_rssIcon;
|
2011-12-17 14:26:34 +01:00
|
|
|
SiteIcon* m_siteIcon;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
QupZilla* p_QupZilla;
|
2012-01-21 20:27:45 +01:00
|
|
|
TabbedWebView* m_webView;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-21 19:26:47 +01:00
|
|
|
QMenu* m_menu;
|
|
|
|
QAction* m_pasteAndGoAction;
|
|
|
|
QAction* m_clearAction;
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
bool m_rssIconVisible;
|
2012-01-18 16:52:30 +01:00
|
|
|
bool m_holdingAlt;
|
2012-09-02 15:19:12 +02:00
|
|
|
|
2012-08-24 20:53:53 +02:00
|
|
|
int m_loadProgress;
|
2012-09-19 10:08:30 +02:00
|
|
|
bool m_progressVisible;
|
|
|
|
ProgressStyle m_progressStyle;
|
|
|
|
QColor m_progressColor;
|
2012-10-07 13:22:45 +02:00
|
|
|
|
|
|
|
bool m_forceLineEditPaintEvent;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCATIONBAR_H
|