Added custom about dialog.

This commit is contained in:
Jim Evins
2016-04-11 23:17:47 -04:00
parent 50e52d6675
commit 642739a1ff
7 changed files with 299 additions and 16 deletions
+65
View File
@@ -0,0 +1,65 @@
/* AboutDialog.cpp
*
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
*
* This file is part of gLabels-qt.
*
* gLabels-qt is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gLabels-qt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
*/
#include "AboutDialog.h"
#include <QUrl>
#include <QDesktopServices>
#include <QtDebug>
///
/// Constructor
///
AboutDialog::AboutDialog( QWidget *parent )
: QDialog(parent)
{
setupUi( this );
QString subtitle = tr("Label Designer");
QString version = "x.x.x";
QString description = tr("A program to create labels and business cards.");
QString markup = "<p><span style='font-size:24pt; font-weight:600;'>gLabels </span><span style='font-size:16pt; color:#333333;'>"
+ subtitle + "</span></p>"
+ "<p>" + version + "</p>"
+ "<p>" + description + "</p>"
+ "<p>Copyright &copy; 2016 Jim Evins <evins@snaught.com></p>";
aboutLabel->setText( markup );
}
///
/// "License" Button Clicked Slot
///
void AboutDialog::onLicenseButtonClicked()
{
QDesktopServices::openUrl( QUrl("http://www.gnu.org/licenses/gpl-3.0.txt") );
}
///
/// "Website" Button Clicked Slot
///
void AboutDialog::onWebsiteButtonClicked()
{
QDesktopServices::openUrl( QUrl("http://glabels.org/") );
}
+52
View File
@@ -0,0 +1,52 @@
/* AboutDialog.h
*
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
*
* This file is part of gLabels-qt.
*
* gLabels-qt is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* gLabels-qt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef AboutDialog_h
#define AboutDialog_h
#include "ui_AboutDialog.h"
///
/// About Dialog Widget
///
class AboutDialog : public QDialog, public Ui_AboutDialog
{
Q_OBJECT
/////////////////////////////////
// Life Cycle
/////////////////////////////////
public:
AboutDialog( QWidget *parent = 0 );
/////////////////////////////////
// Slots
/////////////////////////////////
private slots:
void onLicenseButtonClicked();
void onWebsiteButtonClicked();
};
#endif // AboutDialog_h
+3
View File
@@ -4,6 +4,7 @@ project (app CXX)
set (glabels_sources
glabels_main.cpp
AboutDialog.cpp
BarcodeBackends.cpp
BarcodeMenu.cpp
BarcodeMenuButton.cpp
@@ -55,6 +56,7 @@ set (glabels_sources
)
set (glabels_qobject_headers
AboutDialog.h
BarcodeMenu.h
BarcodeMenuButton.h
BarcodeMenuItem.h
@@ -88,6 +90,7 @@ set (glabels_qobject_headers
)
set (glabels_forms
ui/AboutDialog.ui
ui/MergePropertyEditor.ui
ui/ObjectEditor.ui
ui/PreferencesDialog.ui
+3 -15
View File
@@ -20,7 +20,7 @@
#include "Help.h"
#include <QMessageBox>
#include "AboutDialog.h"
#include <iostream>
@@ -39,18 +39,6 @@ void Help::displayContents( QWidget *parent )
///
void Help::displayAbout( QWidget *parent )
{
QMessageBox aboutBox( QMessageBox::NoIcon,
QMessageBox::tr("About gLabels"),
QMessageBox::tr("<p><span style='font-size:24pt; font-weight:600;'>gLabels </span><span style='font-size:16pt; color:#909090;'>Label Designer</span></p>"
"<p>x.x.x</p>"
"<p>A program to create labels and business cards.</p>"
"<font size=\"smaller\">"
"<p><a href=\"http://glabels.org\">Homepage</a></p>"
"<p>Copyright &copy; 2016 Jim Evins <evins@snaught.com></p>"
"</font>"),
QMessageBox::Ok,
parent );
aboutBox.setIconPixmap( QPixmap( ":/images/glabels-logo.png" ) );
aboutBox.exec();
AboutDialog dialog( parent );
dialog.exec();
}
+7
View File
@@ -31,6 +31,13 @@ StartupWizard::StartupWizard( QWidget *parent )
: QDialog(parent)
{
setupUi( this );
QString subtitle = tr("Label Designer");
QString markup = "<span style='font-size:24pt; font-weight:600;'>gLabels </span><span style='font-size:16pt; color:#333333;'>"
+ subtitle + "</span>";
titleLabel->setText( markup );
}
+168
View File
@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>379</width>
<height>317</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About gLabels</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
<item>
<widget class="QLabel" name="Icon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/glabels-logo.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="aboutLabel">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="margin">
<number>10</number>
</property>
</widget>
</item>
<item>
<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>&amp;License</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="websiteButton">
<property name="text">
<string>&amp;Website</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>&amp;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>
<resources>
<include location="../images.qrc"/>
</resources>
<connections>
<connection>
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>322</x>
<y>306</y>
</hint>
<hint type="destinationlabel">
<x>340</x>
<y>316</y>
</hint>
</hints>
</connection>
<connection>
<sender>websiteButton</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>onWebsiteButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>202</x>
<y>296</y>
</hint>
<hint type="destinationlabel">
<x>211</x>
<y>312</y>
</hint>
</hints>
</connection>
<connection>
<sender>licenseButton</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>onLicenseButtonClicked()</slot>
<hints>
<hint type="sourcelabel">
<x>110</x>
<y>294</y>
</hint>
<hint type="destinationlabel">
<x>116</x>
<y>313</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>onWebsiteButtonClicked()</slot>
<slot>onLicenseButtonClicked()</slot>
</slots>
</ui>
+1 -1
View File
@@ -46,7 +46,7 @@
<string notr="true">padding:8px;</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:24pt; font-weight:600;&quot;&gt;gLabels &lt;/span&gt;&lt;span style=&quot; font-size:16pt; color:#909090;&quot;&gt;Label Designer&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:24pt; font-weight:600;&quot;&gt;gLabels &lt;/span&gt;&lt;span style=&quot; font-size:16pt; color:#909090;&quot;&gt;Label Designer&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>