2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
2017-08-25 17:11:29 +02:00
|
|
|
* Falkon - Qt web browser
|
2018-01-25 14:07:19 +01:00
|
|
|
* Copyright (C) 2010-2018 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
|
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
#include "lineedit.h"
|
2017-08-11 15:20:30 +02:00
|
|
|
#include "searchenginesmanager.h"
|
2018-01-25 15:19:10 +01:00
|
|
|
#include "loadrequest.h"
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-15 23:22:35 +01:00
|
|
|
class QStringListModel;
|
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
class BrowserWindow;
|
2011-03-02 16:57:41 +01:00
|
|
|
class LocationCompleter;
|
|
|
|
class ClickableLabel;
|
2012-01-21 20:27:45 +01:00
|
|
|
class TabbedWebView;
|
2014-02-09 12:22:49 +01:00
|
|
|
class BookmarksIcon;
|
2011-12-17 14:26:34 +01:00
|
|
|
class SiteIcon;
|
2011-12-27 18:50:52 +01:00
|
|
|
class GoIcon;
|
2013-02-08 18:44:26 +01:00
|
|
|
class AutoFillIcon;
|
2018-01-25 15:19:10 +01:00
|
|
|
class BookmarkItem;
|
2012-02-29 18:33:50 +01:00
|
|
|
|
2017-08-25 17:11:29 +02:00
|
|
|
class FALKON_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
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
public:
|
2018-01-31 10:30:28 +01:00
|
|
|
explicit LocationBar(QWidget *parent = nullptr);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2018-01-25 15:19:10 +01:00
|
|
|
struct LoadAction {
|
|
|
|
enum Type {
|
|
|
|
Invalid = 0,
|
|
|
|
Search,
|
|
|
|
Bookmark,
|
|
|
|
Url
|
|
|
|
};
|
|
|
|
Type type = Invalid;
|
|
|
|
SearchEngine searchEngine;
|
|
|
|
BookmarkItem *bookmark = nullptr;
|
|
|
|
LoadRequest loadRequest;
|
|
|
|
};
|
|
|
|
|
2018-01-31 10:30:28 +01:00
|
|
|
// BrowserWindow can be null!
|
|
|
|
BrowserWindow *browserWindow() const;
|
|
|
|
void setBrowserWindow(BrowserWindow *window);
|
|
|
|
|
2014-03-15 23:22:35 +01:00
|
|
|
TabbedWebView* webView() const;
|
2012-08-24 20:53:53 +02:00
|
|
|
void setWebView(TabbedWebView* view);
|
2011-12-15 17:43:06 +01:00
|
|
|
|
2015-01-21 12:38:12 +01:00
|
|
|
static QString convertUrlToText(const QUrl &url);
|
2018-01-25 15:19:10 +01:00
|
|
|
static SearchEngine searchEngine();
|
|
|
|
static LoadAction loadAction(const QString &text);
|
2015-01-21 12:38:12 +01:00
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
public slots:
|
2012-04-22 17:09:43 +02:00
|
|
|
void setText(const QString &text);
|
2014-03-15 23:22:35 +01:00
|
|
|
void showUrl(const QUrl &url);
|
2018-01-25 14:07:19 +01:00
|
|
|
void loadRequest(const LoadRequest &request);
|
2011-03-03 14:25:02 +01:00
|
|
|
|
|
|
|
private slots:
|
2014-11-18 12:45:37 +01:00
|
|
|
void textEdited(const QString &text);
|
2014-03-16 12:11:24 +01:00
|
|
|
void requestLoadUrl();
|
2013-02-10 12:28:53 +01:00
|
|
|
void pasteAndGo();
|
|
|
|
|
2014-03-16 12:11:24 +01:00
|
|
|
void updateSiteIcon();
|
2011-11-06 12:05:16 +01:00
|
|
|
void updatePlaceHolderText();
|
2014-03-16 12:11:24 +01:00
|
|
|
|
|
|
|
void setPrivacyState(bool state);
|
|
|
|
void setGoIconVisible(bool state);
|
|
|
|
|
2017-08-11 12:26:50 +02:00
|
|
|
void showCompletion(const QString &completion, bool completeDomain);
|
2014-03-15 23:22:35 +01:00
|
|
|
void showDomainCompletion(const QString &completion);
|
2014-03-01 13:02:57 +01:00
|
|
|
void clearCompletion();
|
2011-11-06 12:05:16 +01:00
|
|
|
|
2014-03-16 12:11:24 +01:00
|
|
|
void loadStarted();
|
|
|
|
void loadProgress(int progress);
|
|
|
|
void loadFinished();
|
2012-08-24 20:53:53 +02:00
|
|
|
void hideProgress();
|
|
|
|
|
2014-03-09 12:49:45 +01:00
|
|
|
void loadSettings();
|
2012-09-19 10:08:30 +02:00
|
|
|
|
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);
|
2014-03-15 23:22:35 +01:00
|
|
|
void showEvent(QShowEvent* 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 keyPressEvent(QKeyEvent* event);
|
|
|
|
void dropEvent(QDropEvent* event);
|
2014-03-16 13:06:38 +01:00
|
|
|
void paintEvent(QPaintEvent* event);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-15 23:22:35 +01:00
|
|
|
void refreshTextFormat();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-01 13:02:57 +01:00
|
|
|
LocationCompleter* m_completer;
|
2014-03-15 23:22:35 +01:00
|
|
|
QStringListModel* m_domainCompleterModel;
|
2012-04-22 17:09:43 +02:00
|
|
|
|
2014-02-09 12:22:49 +01:00
|
|
|
BookmarksIcon* m_bookmarkIcon;
|
2011-12-27 18:50:52 +01:00
|
|
|
GoIcon* m_goIcon;
|
2011-12-17 14:26:34 +01:00
|
|
|
SiteIcon* m_siteIcon;
|
2013-02-08 18:44:26 +01:00
|
|
|
AutoFillIcon* m_autofillIcon;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-02-19 22:07:21 +01:00
|
|
|
BrowserWindow* m_window;
|
2012-01-21 20:27:45 +01:00
|
|
|
TabbedWebView* m_webView;
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-01-18 16:52:30 +01:00
|
|
|
bool m_holdingAlt;
|
2014-11-18 12:45:37 +01:00
|
|
|
int m_oldTextLength;
|
|
|
|
int m_currentTextLength;
|
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;
|
2016-02-27 17:12:39 +01:00
|
|
|
QTimer *m_progressTimer;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LOCATIONBAR_H
|