mirror of
https://github.com/alee14-projects/AleeBrowser.git
synced 2025-01-22 07:53:18 -05:00
Added about dialog, address bar works
This commit is contained in:
parent
f9ab17d41c
commit
1a92e988d6
8 changed files with 224 additions and 12 deletions
|
@ -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.
|
||||
|
|
15
about.cpp
Normal file
15
about.cpp
Normal file
|
@ -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;
|
||||
}
|
22
about.h
Normal file
22
about.h
Normal file
|
@ -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
|
141
about.ui
Normal file
141
about.ui
Normal file
|
@ -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>
|
4
main.cpp
4
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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in a new issue