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 "about.h"
|
||||||
#include "ssrf-version.h"
|
#include "ssrf-version.h"
|
||||||
#include "mainwindow.h"
|
#include <QDesktopServices>
|
||||||
#include <QDebug>
|
#include <QUrl>
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <qdesktopservices.h>
|
|
||||||
|
|
||||||
SubsurfaceAbout *SubsurfaceAbout::instance()
|
|
||||||
{
|
|
||||||
static SubsurfaceAbout *self = new SubsurfaceAbout(mainWindow());
|
|
||||||
self->setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
SubsurfaceAbout::SubsurfaceAbout(QWidget* parent, Qt::WindowFlags f)
|
SubsurfaceAbout::SubsurfaceAbout(QWidget* parent, Qt::WindowFlags f)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
setWindowModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
ui.aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>" \
|
ui.aboutLabel->setText(tr("<span style='font-size: 18pt; font-weight: bold;'>" \
|
||||||
"Subsurface %1 </span><br><br>" \
|
"Subsurface %1 </span><br><br>" \
|
||||||
"Multi-platform divelog software<br>" \
|
"Multi-platform divelog software<br>" \
|
||||||
"<span style='font-size: 8pt'>Linus Torvalds, Dirk Hohndel, and others, 2011-2014</span>").arg(VERSION_STRING));
|
"<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"));
|
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"));
|
QDesktopServices::openUrl(QUrl("http://subsurface.hohndel.org"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,11 @@ class SubsurfaceAbout : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SubsurfaceAbout* instance();
|
|
||||||
private slots:
|
|
||||||
void licenseClicked();
|
|
||||||
void websiteClicked();
|
|
||||||
private:
|
|
||||||
explicit SubsurfaceAbout(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
explicit SubsurfaceAbout(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||||
QPushButton *licenseButton;
|
private slots:
|
||||||
QPushButton *websiteButton;
|
void on_licenseButton_clicked();
|
||||||
|
void on_websiteButton_clicked();
|
||||||
|
private:
|
||||||
Ui::SubsurfaceAbout ui;
|
Ui::SubsurfaceAbout ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,22 +29,7 @@
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
|
||||||
<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>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="subsurfaceIcon">
|
<widget class="QLabel" name="subsurfaceIcon">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -61,7 +46,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="aboutLabel">
|
<widget class="QLabel" name="aboutLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string></string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="textFormat">
|
||||||
<enum>Qt::RichText</enum>
|
<enum>Qt::RichText</enum>
|
||||||
|
@ -75,17 +60,55 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="orientation">
|
<item>
|
||||||
<enum>Qt::Horizontal</enum>
|
<spacer name="horizontalSpacer">
|
||||||
</property>
|
<property name="orientation">
|
||||||
<property name="standardButtons">
|
<enum>Qt::Horizontal</enum>
|
||||||
<set>QDialogButtonBox::Close</set>
|
</property>
|
||||||
</property>
|
<property name="sizeHint" stdset="0">
|
||||||
<property name="centerButtons">
|
<size>
|
||||||
<bool>true</bool>
|
<width>40</width>
|
||||||
</property>
|
<height>20</height>
|
||||||
</widget>
|
</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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -94,18 +117,18 @@
|
||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>buttonBox</sender>
|
<sender>closeButton</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>SubsurfaceAbout</receiver>
|
<receiver>SubsurfaceAbout</receiver>
|
||||||
<slot>close()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>227</x>
|
<x>290</x>
|
||||||
<y>437</y>
|
<y>411</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>227</x>
|
<x>340</x>
|
||||||
<y>224</y>
|
<y>409</y>
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
|
|
@ -503,7 +503,9 @@ void MainWindow::on_actionInputPlan_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionAboutSubsurface_triggered()
|
void MainWindow::on_actionAboutSubsurface_triggered()
|
||||||
{
|
{
|
||||||
SubsurfaceAbout::instance()->show();
|
SubsurfaceAbout dlg(this);
|
||||||
|
|
||||||
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionUserManual_triggered()
|
void MainWindow::on_actionUserManual_triggered()
|
||||||
|
@ -900,4 +902,4 @@ void MainWindow::on_profSAC_clicked(bool triggered)
|
||||||
TOOLBOX_PREF_PROFILE(show_sac);
|
TOOLBOX_PREF_PROFILE(show_sac);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef TOOLBOX_PREF_PROFILE
|
#undef TOOLBOX_PREF_PROFILE
|
||||||
|
|
Loading…
Add table
Reference in a new issue