mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
SubsurfaceAbout class cleanup.
Main change is that now SubsurfaceAbout doesn't have instance object, but it constructs and destructs dynamically. * Remove the static SubsurfaceAbout::instance() class member * construct/destruct about dialog on demand * Other small aboutbox cleanups. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> ACK-ed-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
39a11d7092
commit
3161114106
4 changed files with 73 additions and 64 deletions
|
@ -1,39 +1,26 @@
|
|||
#include "about.h"
|
||||
#include "ssrf-version.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QDebug>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QNetworkReply>
|
||||
#include <qdesktopservices.h>
|
||||
|
||||
SubsurfaceAbout *SubsurfaceAbout::instance()
|
||||
{
|
||||
static SubsurfaceAbout *self = new SubsurfaceAbout(mainWindow());
|
||||
self->setAttribute(Qt::WA_QuitOnClose, false);
|
||||
return self;
|
||||
}
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
SubsurfaceAbout::SubsurfaceAbout(QWidget* parent, Qt::WindowFlags f)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
ui.aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>" \
|
||||
"Subsurface %1 </span><br><br>" \
|
||||
"Multi-platform divelog software<br>" \
|
||||
"<span style='font-size: 8pt'>Linus Torvalds, Dirk Hohndel, and others, 2011-2014</span>").arg(VERSION_STRING));
|
||||
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)
|
||||
void SubsurfaceAbout::on_licenseButton_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("http://www.gnu.org/licenses/gpl-2.0.txt"));
|
||||
}
|
||||
|
||||
void SubsurfaceAbout::websiteClicked(void)
|
||||
void SubsurfaceAbout::on_websiteButton_clicked()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("http://subsurface.hohndel.org"));
|
||||
}
|
||||
|
|
|
@ -9,14 +9,11 @@ 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;
|
||||
private slots:
|
||||
void on_licenseButton_clicked();
|
||||
void on_websiteButton_clicked();
|
||||
private:
|
||||
Ui::SubsurfaceAbout ui;
|
||||
};
|
||||
|
||||
|
|
|
@ -29,22 +29,7 @@
|
|||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>30</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="subsurfaceIcon">
|
||||
<property name="text">
|
||||
|
@ -61,7 +46,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="aboutLabel">
|
||||
<property name="text">
|
||||
<string></string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
|
@ -75,17 +60,55 @@
|
|||
</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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QPushButton" name="licenseButton">
|
||||
<property name="text">
|
||||
<string>&License</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="websiteButton">
|
||||
<property name="text">
|
||||
<string>&Website</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -94,18 +117,18 @@
|
|||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<sender>closeButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>SubsurfaceAbout</receiver>
|
||||
<slot>close()</slot>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>437</y>
|
||||
<x>290</x>
|
||||
<y>411</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>227</x>
|
||||
<y>224</y>
|
||||
<x>340</x>
|
||||
<y>409</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
|
|
@ -503,7 +503,9 @@ void MainWindow::on_actionInputPlan_triggered()
|
|||
|
||||
void MainWindow::on_actionAboutSubsurface_triggered()
|
||||
{
|
||||
SubsurfaceAbout::instance()->show();
|
||||
SubsurfaceAbout dlg(this);
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionUserManual_triggered()
|
||||
|
|
Loading…
Add table
Reference in a new issue