diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-02-10 21:24:06 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-02-10 21:24:06 -0500 |
| commit | 1a92e988d63753d2904ac775c4b30589e76c7e5c (patch) | |
| tree | 0a446ad31a46eefa580d1741190bf653fe9a3f56 | |
| parent | f9ab17d41c3c403eba221f7bc176d01efebe8d03 (diff) | |
| download | AleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.tar.gz AleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.tar.bz2 AleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.zip | |
Added about dialog, address bar works
| -rw-r--r-- | AleeBrowser.pro | 3 | ||||
| -rw-r--r-- | about.cpp | 15 | ||||
| -rw-r--r-- | about.h | 22 | ||||
| -rw-r--r-- | about.ui | 141 | ||||
| -rw-r--r-- | main.cpp | 4 | ||||
| -rw-r--r-- | mainbrowser.cpp | 28 | ||||
| -rw-r--r-- | mainbrowser.h | 9 | ||||
| -rw-r--r-- | mainbrowser.ui | 14 |
8 files changed, 224 insertions, 12 deletions
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 <QtWebKitWidgets/QWebView> + +About::About(QWidget *parent) : + QDialog(parent), + ui(new Ui::About) +{ + ui->setupUi(this); +} + +About::~About() +{ + delete ui; +} @@ -0,0 +1,22 @@ +#ifndef ABOUT_H +#define ABOUT_H + +#include <QDialog> + +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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>About</class> + <widget class="QDialog" name="About"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>516</width> + <height>391</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>516</width> + <height>391</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>516</width> + <height>391</height> + </size> + </property> + <property name="windowTitle"> + <string>About - Alee Music Player</string> + </property> + <property name="modal"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>8</width> + <height>21</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>AleeBrowser 2.0 by Alee Productions</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>Licensed with GPL-3.0</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string><html><head/><body><p><a href="https://alee-productions.xyz"><span style=" text-decoration: underline; color:#007af4;">Website</span></a></p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QTextEdit" name="licenseText"> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="html"> + <string><!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></string> + </property> + </widget> + </item> + </layout> + </widget> + <tabstops> + <tabstop>licenseText</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> @@ -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 <QtWebKitWidgets/QWebView> #include <QUrl> #include <QDebug> +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 @@ </property> </widget> </item> - <item row="0" column="0" colspan="2"> - <widget class="QLineEdit" name="lineEdit"> - <property name="text"> - <string>https://www.google.com</string> - </property> - </widget> - </item> <item row="1" column="1"> <spacer name="horizontalSpacer"> <property name="orientation"> @@ -51,6 +44,13 @@ </property> </spacer> </item> + <item row="0" column="0" colspan="2"> + <widget class="QLineEdit" name="lineEdit"> + <property name="text"> + <string>about:blank</string> + </property> + </widget> + </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> |
