From 1a92e988d63753d2904ac775c4b30589e76c7e5c Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 10 Feb 2020 21:24:06 -0500 Subject: Added about dialog, address bar works --- AleeBrowser.pro | 3 ++ about.cpp | 15 ++++++ about.h | 22 +++++++++ about.ui | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 4 +- mainbrowser.cpp | 28 +++++++++-- mainbrowser.h | 9 ++++ mainbrowser.ui | 14 +++--- 8 files changed, 224 insertions(+), 12 deletions(-) create mode 100644 about.cpp create mode 100644 about.h create mode 100644 about.ui diff --git a/AleeBrowser.pro b/AleeBrowser.pro index 94b7477..9d6c60b 100644 --- a/AleeBrowser.pro +++ b/AleeBrowser.pro @@ -16,13 +16,16 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ + about.cpp \ main.cpp \ mainbrowser.cpp HEADERS += \ + about.h \ mainbrowser.h FORMS += \ + about.ui \ mainbrowser.ui # Default rules for deployment. diff --git a/about.cpp b/about.cpp new file mode 100644 index 0000000..cdd0c1e --- /dev/null +++ b/about.cpp @@ -0,0 +1,15 @@ +#include "about.h" +#include "ui_about.h" +#include + +About::About(QWidget *parent) : + QDialog(parent), + ui(new Ui::About) +{ + ui->setupUi(this); +} + +About::~About() +{ + delete ui; +} diff --git a/about.h b/about.h new file mode 100644 index 0000000..a88d2ac --- /dev/null +++ b/about.h @@ -0,0 +1,22 @@ +#ifndef ABOUT_H +#define ABOUT_H + +#include + +namespace Ui { +class About; +} + +class About : public QDialog +{ + Q_OBJECT + +public: + explicit About(QWidget *parent = nullptr); + ~About(); + +private: + Ui::About *ui; +}; + +#endif // ABOUT_H diff --git a/about.ui b/about.ui new file mode 100644 index 0000000..89da092 --- /dev/null +++ b/about.ui @@ -0,0 +1,141 @@ + + + About + + + + 0 + 0 + 516 + 391 + + + + + 516 + 391 + + + + + 516 + 391 + + + + About - Alee Music Player + + + false + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 8 + 21 + + + + + + + + + 16 + + + + AleeBrowser 2.0 by Alee Productions + + + Qt::AlignCenter + + + true + + + + + + + + 16 + + + + Licensed with GPL-3.0 + + + Qt::AlignCenter + + + + + + + <html><head/><body><p><a href="https://alee-productions.xyz"><span style=" text-decoration: underline; color:#007af4;">Website</span></a></p></body></html> + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> AleeBrowser: A web browser written in Qt</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Copyright (C) 2020 Alee Productions</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> This program is free software: you can redistribute it and/or modify</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> it under the terms of the GNU General Public License as published by</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> the Free Software Foundation, either version 3 of the License, or</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> (at your option) any later version.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> This program is distributed in the hope that it will be useful,</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> but WITHOUT ANY WARRANTY; without even the implied warranty of</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> GNU General Public License for more details.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> You should have received a copy of the GNU General Public License</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + + + + licenseText + + + + diff --git a/main.cpp b/main.cpp index 7a461a0..07bb4a7 100644 --- a/main.cpp +++ b/main.cpp @@ -5,7 +5,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); - mainbrowser w; - w.show(); + mainbrowser browser; + browser.show(); return a.exec(); } diff --git a/mainbrowser.cpp b/mainbrowser.cpp index 4a5a04e..4dea0e3 100644 --- a/mainbrowser.cpp +++ b/mainbrowser.cpp @@ -1,17 +1,22 @@ #include "mainbrowser.h" #include "ui_mainbrowser.h" +#include "about.h" #include #include #include +void mainbrowser::bUrl() { + url = ui->lineEdit->text(); + ui->webView->load(QUrl(url)); +} + mainbrowser::mainbrowser(QWidget *parent) : QMainWindow(parent) , ui(new Ui::mainbrowser) { //QString url = ui->lineEdit->text(); ui->setupUi(this); - ui->webView->load(QUrl("https://google.com")); - + ui->webView->load(QUrl("https://about:blank")); } mainbrowser::~mainbrowser() @@ -27,5 +32,22 @@ void mainbrowser::on_actionQuit_triggered() void mainbrowser::on_searchButton_clicked() { - qDebug() << "Search pressed!"; + bUrl(); +} + +void mainbrowser::on_lineEdit_returnPressed() +{ + bUrl(); +} + +void mainbrowser::on_actionAbout_triggered() +{ + About about; + about.exec(); +} + +void mainbrowser::on_webView_urlChanged(const QUrl &arg1) +{ + qDebug() << "Loading" << url; + } diff --git a/mainbrowser.h b/mainbrowser.h index 56dfc56..af95f0a 100644 --- a/mainbrowser.h +++ b/mainbrowser.h @@ -20,7 +20,16 @@ private slots: void on_searchButton_clicked(); + void on_lineEdit_returnPressed(); + + void on_actionAbout_triggered(); + + void bUrl(); + + void on_webView_urlChanged(const QUrl &arg1); + private: Ui::mainbrowser *ui; + QString url; }; #endif // MAINBROWSER_H diff --git a/mainbrowser.ui b/mainbrowser.ui index 92e32f1..9399ab0 100644 --- a/mainbrowser.ui +++ b/mainbrowser.ui @@ -31,13 +31,6 @@ - - - - https://www.google.com - - - @@ -51,6 +44,13 @@ + + + + about:blank + + + -- cgit v1.2.3