aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-02-10 21:24:06 -0500
committerAndrew Lee <alee14498@protonmail.com>2020-02-10 21:24:06 -0500
commit1a92e988d63753d2904ac775c4b30589e76c7e5c (patch)
tree0a446ad31a46eefa580d1741190bf653fe9a3f56
parentf9ab17d41c3c403eba221f7bc176d01efebe8d03 (diff)
downloadAleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.tar.gz
AleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.tar.bz2
AleeBrowser-1a92e988d63753d2904ac775c4b30589e76c7e5c.zip
Added about dialog, address bar works
-rw-r--r--AleeBrowser.pro3
-rw-r--r--about.cpp15
-rw-r--r--about.h22
-rw-r--r--about.ui141
-rw-r--r--main.cpp4
-rw-r--r--mainbrowser.cpp28
-rw-r--r--mainbrowser.h9
-rw-r--r--mainbrowser.ui14
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;
+}
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 <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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://alee-productions.xyz&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007af4;&quot;&gt;Website&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; AleeBrowser: A web browser written in Qt&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; Copyright (C) 2020 Alee Productions&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; This program is free software: you can redistribute it and/or modify&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; it under the terms of the GNU General Public License as published by&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; the Free Software Foundation, either version 3 of the License, or&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; (at your option) any later version.&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; This program is distributed in the hope that it will be useful,&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; GNU General Public License for more details.&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; You should have received a copy of the GNU General Public License&lt;/p&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; along with this program. If not, see &amp;lt;https://www.gnu.org/licenses/&amp;gt;.&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>licenseText</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
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 <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">