mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add an 'About' dialog for the Qt UI
The dialog is similar to the one in the GTK version Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ef0272f5ef
commit
f3b04a88df
5 changed files with 211 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -51,6 +51,7 @@ HEADERS = \
|
||||||
qt-ui/subsurfacewebservices.h \
|
qt-ui/subsurfacewebservices.h \
|
||||||
qt-ui/divecomputermanagementdialog.h \
|
qt-ui/divecomputermanagementdialog.h \
|
||||||
qt-ui/diveplanner.h \
|
qt-ui/diveplanner.h \
|
||||||
|
qt-ui/about.h \
|
||||||
|
|
||||||
|
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
|
@ -88,6 +89,7 @@ SOURCES = \
|
||||||
qt-ui/subsurfacewebservices.cpp \
|
qt-ui/subsurfacewebservices.cpp \
|
||||||
qt-ui/divecomputermanagementdialog.cpp \
|
qt-ui/divecomputermanagementdialog.cpp \
|
||||||
qt-ui/diveplanner.cpp \
|
qt-ui/diveplanner.cpp \
|
||||||
|
qt-ui/about.cpp \
|
||||||
$(RESFILE)
|
$(RESFILE)
|
||||||
|
|
||||||
|
|
||||||
|
|
39
qt-ui/about.cpp
Normal file
39
qt-ui/about.cpp
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
#include "about.h"
|
||||||
|
#include "ui_about.h"
|
||||||
|
#include "../version.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <qdesktopservices.h>
|
||||||
|
|
||||||
|
SubsurfaceAbout *SubsurfaceAbout::instance()
|
||||||
|
{
|
||||||
|
static SubsurfaceAbout *self = new SubsurfaceAbout();
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
SubsurfaceAbout::SubsurfaceAbout(QWidget* parent, Qt::WindowFlags f)
|
||||||
|
: ui( new Ui::SubsurfaceAbout())
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>" \
|
||||||
|
"Subsurface " VERSION_STRING "</span><br><br>" \
|
||||||
|
"Multi-platform divelog software in C<br>" \
|
||||||
|
"<span style='font-size: 8pt'>Linus Torvalds, Dirk Hohndel, and others, 2011, 2012, 2013</span>"));
|
||||||
|
licenseButton = new QPushButton(tr("&License"));
|
||||||
|
websiteButton = new QPushButton(tr("&Website"));
|
||||||
|
ui->buttonBox->addButton(licenseButton, QDialogButtonBox::ActionRole);
|
||||||
|
ui->buttonBox->addButton(websiteButton, QDialogButtonBox::ActionRole);
|
||||||
|
connect(licenseButton, SIGNAL(clicked(bool)), this, SLOT(licenseClicked()));
|
||||||
|
connect(websiteButton, SIGNAL(clicked(bool)), this, SLOT(websiteClicked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubsurfaceAbout::licenseClicked(void)
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SubsurfaceAbout::websiteClicked(void)
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(QUrl("http://subsurface.hohndel.org"));
|
||||||
|
}
|
26
qt-ui/about.h
Normal file
26
qt-ui/about.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef ABOUT_H
|
||||||
|
#define ABOUT_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class SubsurfaceAbout;
|
||||||
|
}
|
||||||
|
|
||||||
|
class SubsurfaceAbout : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
static SubsurfaceAbout* instance();
|
||||||
|
private slots:
|
||||||
|
void licenseClicked();
|
||||||
|
void websiteClicked();
|
||||||
|
private:
|
||||||
|
explicit SubsurfaceAbout(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||||
|
QPushButton *licenseButton;
|
||||||
|
QPushButton *websiteButton;
|
||||||
|
Ui::SubsurfaceAbout *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
142
qt-ui/about.ui
Normal file
142
qt-ui/about.ui
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>SubsurfaceAbout</class>
|
||||||
|
<widget class="QDialog" name="SubsurfaceAbout">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::WindowModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>456</width>
|
||||||
|
<height>450</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>About Subsurface</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../subsurface.qrc">
|
||||||
|
<normaloff>:/subsurface-icon</normaloff>:/subsurface-icon</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<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>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="subsurfaceIcon">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../subsurface.qrc">:/subsurface-icon</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="aboutLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
<property name="centerButtons">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../subsurface.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>SubsurfaceAbout</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>227</x>
|
||||||
|
<y>437</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>227</x>
|
||||||
|
<y>224</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -33,6 +33,7 @@
|
||||||
#include "divecomputermanagementdialog.h"
|
#include "divecomputermanagementdialog.h"
|
||||||
#include "simplewidgets.h"
|
#include "simplewidgets.h"
|
||||||
#include "diveplanner.h"
|
#include "diveplanner.h"
|
||||||
|
#include "about.h"
|
||||||
|
|
||||||
static MainWindow* instance = 0;
|
static MainWindow* instance = 0;
|
||||||
|
|
||||||
|
@ -335,7 +336,7 @@ void MainWindow::on_actionInputPlan_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionAboutSubsurface_triggered()
|
void MainWindow::on_actionAboutSubsurface_triggered()
|
||||||
{
|
{
|
||||||
qDebug("actionAboutSubsurface");
|
SubsurfaceAbout::instance()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionUserManual_triggered()
|
void MainWindow::on_actionUserManual_triggered()
|
||||||
|
|
Loading…
Reference in a new issue