diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-02-11 15:50:38 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-02-11 15:50:38 -0500 |
| commit | b8bb2a38695202512f9c6f7f11a0148aa077ab5a (patch) | |
| tree | dd71faa19ae41da9bb2d328b434ecb711f3d29d8 | |
| parent | f36b6114e64d278c5876727ff435547789b35c7f (diff) | |
| download | AleeBrowser-master.tar.gz AleeBrowser-master.tar.bz2 AleeBrowser-master.zip | |
| -rw-r--r-- | mainbrowser.cpp | 27 | ||||
| -rw-r--r-- | mainbrowser.h | 10 | ||||
| -rw-r--r-- | mainbrowser.ui | 22 |
3 files changed, 40 insertions, 19 deletions
diff --git a/mainbrowser.cpp b/mainbrowser.cpp index 04dafe1..64737e9 100644 --- a/mainbrowser.cpp +++ b/mainbrowser.cpp @@ -1,13 +1,10 @@ #include "mainbrowser.h" #include "ui_mainbrowser.h" #include "about.h" -#include <QtWebKitWidgets/QWebView> -#include <QUrl> -#include <QDebug> void mainbrowser::bUrl() { - url = ui->lineEdit->text(); - ui->webView->load(QUrl(url)); + url = ui->urlBar->text(); + ui->webView->load(QUrl("http://" + url)); } mainbrowser::mainbrowser(QWidget *parent) @@ -15,12 +12,14 @@ mainbrowser::mainbrowser(QWidget *parent) , ui(new Ui::mainbrowser) { ui->setupUi(this); - ui->webView->load(QUrl("https://about:blank")); + QWidget::setWindowTitle("Alee Browser"); + ui->urlBar->setText("about:blank"); } mainbrowser::~mainbrowser() { qDebug() << "Closing Alee Browser..."; + ui->webView->deleteLater(); delete ui; } @@ -30,7 +29,7 @@ void mainbrowser::on_actionQuit_triggered() close(); } -void mainbrowser::on_lineEdit_returnPressed() +void mainbrowser::on_urlBar_returnPressed() { bUrl(); } @@ -55,3 +54,17 @@ void mainbrowser::on_refreshButton_clicked() { ui->webView->reload(); } + +void mainbrowser::on_webView_loadStarted() +{ + +} + +void mainbrowser::on_webView_titleChanged(const QString &title) +{ + if (title == NULL) { + QWidget::setWindowTitle("Alee Browser"); + } else { + QWidget::setWindowTitle(title + " - Alee Browser"); + } +} diff --git a/mainbrowser.h b/mainbrowser.h index b697ab6..1ad75bc 100644 --- a/mainbrowser.h +++ b/mainbrowser.h @@ -2,6 +2,10 @@ #define MAINBROWSER_H #include <QMainWindow> +#include <QtWebKit> +#include <QtWebKitWidgets/QWebView> +#include <QUrl> +#include <QDebug> QT_BEGIN_NAMESPACE namespace Ui { class mainbrowser; } @@ -18,7 +22,7 @@ public: private slots: void on_actionQuit_triggered(); - void on_lineEdit_returnPressed(); + void on_urlBar_returnPressed(); void on_actionAbout_triggered(); @@ -30,6 +34,10 @@ private slots: void on_refreshButton_clicked(); + void on_webView_loadStarted(); + + void on_webView_titleChanged(const QString &title); + private: Ui::mainbrowser *ui; QString url; diff --git a/mainbrowser.ui b/mainbrowser.ui index 786d0b3..6ab1503 100644 --- a/mainbrowser.ui +++ b/mainbrowser.ui @@ -18,21 +18,28 @@ <item row="0" column="1"> <widget class="QPushButton" name="forwardButton"> <property name="text"> - <string>-></string> + <string>→</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QPushButton" name="refreshButton"> + <property name="text"> + <string>Refresh</string> </property> </widget> </item> <item row="0" column="0"> <widget class="QPushButton" name="backButton"> <property name="text"> - <string><-</string> + <string>←</string> </property> </widget> </item> <item row="0" column="3"> - <widget class="QLineEdit" name="lineEdit"> + <widget class="QLineEdit" name="urlBar"> <property name="text"> - <string>about:blank</string> + <string/> </property> </widget> </item> @@ -45,13 +52,6 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QPushButton" name="refreshButton"> - <property name="text"> - <string>Refresh</string> - </property> - </widget> - </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> |
