Thu, 04 Jul 2013 19:18:42 +0300
Converted about dialog
src/aboutDialog.cpp | file | annotate | diff | comparison | revisions | |
src/aboutDialog.h | file | annotate | diff | comparison | revisions | |
src/ui/about.ui | file | annotate | diff | comparison | revisions |
--- a/src/aboutDialog.cpp Thu Jul 04 18:56:34 2013 +0300 +++ b/src/aboutDialog.cpp Thu Jul 04 19:18:42 2013 +0300 @@ -1,84 +1,45 @@ /* * LDForge: LDraw parts authoring CAD * Copyright (C) 2013 Santeri Piippo - * + * * This program 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. - * + * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <QLabel> -#include <QBoxLayout> -#include <QDialogButtonBox> #include <QDesktopServices> #include <QPushButton> -#include <QTextEdit> #include <QUrl> -#include "common.h" #include "aboutDialog.h" +#include "ui_about.h" +#include "gui.h" -AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) { - // Application icon - in full 64 x 64 glory. - QLabel* icon = new QLabel; - icon->setPixmap (getIcon ("ldforge")); - - // Heading - application label and copyright information - QLabel* title = new QLabel( fmt( tr( "<b>" APPNAME " %1</b><br />" - "Copyright (C) 2013 Santeri Piippo" ), fullVersionString ())); +AboutDialog::AboutDialog( QWidget* parent, Qt::WindowFlags f ) : QDialog( parent, f ) +{ + Ui::AboutUI ui; + ui.setupUi( this ); - // Body text - QLabel* info = new QLabel (tr ( - "<p>This software is intended for usage as a parts<br />" - "authoring tool for the <a href=\"http://ldraw.org/\">LDraw</a> parts library.</p>" - - "<p>" APPNAME " is free software, and you are welcome<br />" - "to redistribute it under the terms of GPL v3. See the<br />" - "LICENSE text file for details. If the license text is not<br />" - "available for some reason, see<br />" - "<a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a> for the license terms.</p>" - - "<p>The graphical assets of " APPNAME " are licensed under the<br />" - "<a href=\"http://creativecommons.org/licenses/by-sa/3.0/\">CC Attribution-ShareAlike 3.0 Unported license</a>. The<br />" - "GNU GPL applies to the source code of the program.<br />" - "The application icon is derived from <a href=\"http://en.wikipedia.org/wiki/File:Anvil,_labelled_en.svg\">this image</a>. The<br />" - "linked image (retrieved 22 May 2013) was released<br />" - "into the public domain.</p>" - )); + ui.versionInfo->setText( fmt( tr( "LDForge %1" ), fullVersionString() )); - // Rest in peace, James. - QLabel* memorial = new QLabel( tr( "In living memory of James Jessiman." )); - - QDialogButtonBox* buttons = new QDialogButtonBox (QDialogButtonBox::Close); - QPushButton* helpButton = new QPushButton; - - helpButton->setText ("Mail Author"); - helpButton->setIcon (getIcon ("mail")); - buttons->addButton (static_cast<QAbstractButton*> (helpButton), QDialogButtonBox::HelpRole); - connect (buttons, SIGNAL (helpRequested ()), this, SLOT (slot_mail ())); - connect (buttons, SIGNAL (rejected ()), this, SLOT (reject ())); + QPushButton* mailButton = new QPushButton; + mailButton->setText( "Contact" ); + mailButton->setIcon( getIcon( "mail" )); + ui.buttonBox->addButton( static_cast<QAbstractButton*>( mailButton ), QDialogButtonBox::HelpRole ); + connect( ui.buttonBox, SIGNAL( helpRequested() ), this, SLOT( slot_mail() )); - QVBoxLayout* layout = new QVBoxLayout (this); - - // Align everything to the center. - for (QLabel* label : vector<QLabel*> ({icon, title, info, memorial})) { - label->setAlignment (Qt::AlignCenter); - layout->addWidget (label); - } - - layout->addWidget (buttons); - - setWindowTitle ("About " APPNAME); + setWindowTitle( "About " APPNAME ); } -void AboutDialog::slot_mail () { - QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge")); +void AboutDialog::slot_mail() +{ + QDesktopServices::openUrl( QUrl( "mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge" )); } \ No newline at end of file
--- a/src/aboutDialog.h Thu Jul 04 18:56:34 2013 +0300 +++ b/src/aboutDialog.h Thu Jul 04 19:18:42 2013 +0300 @@ -1,17 +1,17 @@ /* * LDForge: LDraw parts authoring CAD * Copyright (C) 2013 Santeri Piippo - * + * * This program 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. - * + * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -20,17 +20,19 @@ #define ZZ_ABOUTDIALOG_H #include <QDialog> -#include "gui.h" +#include "common.h" -class AboutDialog : public QDialog { +class QPushButton; + +class AboutDialog : public QDialog +{ Q_OBJECT public: - AboutDialog (QWidget* parent = null, Qt::WindowFlags f = 0); - QPushButton* pb_mailAuthor; + AboutDialog( QWidget* parent = null, Qt::WindowFlags f = 0 ); private slots: - void slot_mail (); + void slot_mail(); }; -#endif // ZZ_ABOUTDIALOG_H \ No newline at end of file +#endif // ZZ_ABOUTDIALOG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ui/about.ui Thu Jul 04 19:18:42 2013 +0300 @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>AboutUI</class> + <widget class="QDialog" name="AboutUI"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>320</width> + <height>400</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>320</width> + <height>400</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="windowTitle"> + <string>About LDForge</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../../ldforge.qrc">:/icons/ldforge.png</pixmap> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="versionInfo"> + <property name="styleSheet"> + <string notr="true">font-weight: bold</string> + </property> + <property name="text"> + <string>[[ VERSION INFO HERE]]</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Copyright (C) 2013 Santeri Piippo</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="text"> + <string><html><head/><body><p>This software is intended for usage as a parts authoring tool for the <a href="http://ldraw.org/"><span style=" text-decoration: underline; color:#0057ae;">LDraw</span></a> parts library.</p><p>LDForge is free software, and you are welcome to redistribute it under the terms of GPL v3. See the LICENSE text file for details. If the license text is not available for some reason, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0057ae;">http://www.gnu.org/licenses/</span></a> for the license terms.</p><p>The graphical assets of LDForge are licensed under the <a href="http://creativecommons.org/licenses/by-sa/3.0/"><span style=" text-decoration: underline; color:#0057ae;">CC Attribution-ShareAlike 3.0 Unported license</span></a>. The GNU GPL applies to the source code of the program. The application icon is derived from <a href="http://en.wikipedia.org/wiki/File:Anvil,_labelled_en.svg"><span style=" text-decoration: underline; color:#0057ae;">this image on Wikipedia</span></a>. The linked image (retrieved 22 May 2013) was released into the public domain.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>In living memory of James Jessiman.</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + <property name="centerButtons"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="../../ldforge.qrc"/> + </resources> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>AboutUI</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>296</x> + <y>384</y> + </hint> + <hint type="destinationlabel"> + <x>293</x> + <y>1</y> + </hint> + </hints> + </connection> + </connections> +</ui>