zz_aboutDialog.cpp

Tue, 07 May 2013 01:16:58 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 07 May 2013 01:16:58 +0300
changeset 171
36165e58e457
parent 161
c9fba92c4e35
permissions
-rw-r--r--

Forgot the icon

123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <stdlib.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <qlabel.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <qboxlayout.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <qdialogbuttonbox.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <qdesktopservices.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <qurl.h>
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "common.h"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "zz_aboutDialog.h"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 AboutDialog::AboutDialog (QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f) {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 QWidget* mainTab, *licenseTab;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 QTabWidget* tabs = new QTabWidget;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 mainTab = new QWidget;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 123
diff changeset
35 // Application icon - in full 64 x 64 glory.
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 QLabel* icon = new QLabel;
158
499286fcbf37 Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents: 135
diff changeset
37 icon->setPixmap (getIcon ("ldforge"));
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 // Heading - application label and copyright information
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
40 QLabel* title = new QLabel (fmt ("<b>" APPNAME " v%d.%d</b><br />"
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 "Copyright (C) 2013 Santeri Piippo",
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 VERSION_MAJOR, VERSION_MINOR));
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 // Body text
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 QLabel* info = new QLabel (
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 "<p>This software is intended for usage as a parts<br />"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 "authoring tool for the <a href=\"http://ldraw.org/\">LDraw</a> parts library.</p>"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
49 "<p>" APPNAME " is free software, and you are welcome<br />"
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 "to redistribute it under the terms of GPL v3. See the LICENSE<br />"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 "text file or the license tab in this dialog for details. If the<br />"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 "license text is not available for some reason, see<br />"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 "<a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 "for the license terms.</p>"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 "<p>The application icon is derived from "
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 "<a href=\"http://en.wikipedia.org/wiki/File:Anvil,_labelled_en.svg\">this image</a>.</p>"
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 );
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 // Rest in peace, James.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 QLabel* memorial = new QLabel ("In living memory of James Jessiman.");
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 QVBoxLayout* layout = new QVBoxLayout;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 layout->addWidget (icon);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 layout->addWidget (title);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 layout->addWidget (info);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 layout->addWidget (memorial);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 // Align everything to the center.
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 158
diff changeset
70 for (QLabel* label : vector<QLabel*> ({icon, title, info, memorial}))
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 label->setAlignment (Qt::AlignCenter);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 mainTab->setLayout (layout);
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
74 tabs->addTab (mainTab, "About " APPNAME);
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 }
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 licenseTab = new QWidget;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 QTextEdit* license = new QTextEdit;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 license->setReadOnly (true);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 QFont font ("Monospace");
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 font.setStyleHint (QFont::TypeWriter);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 font.setPixelSize (10);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 license->setFont (font);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 // Make the text view wide enough to display the license text.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 // Why isn't 80 sufficient here?
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 license->setMinimumWidth (license->fontMetrics ().width ('a') * 85);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 // Try open the license text
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 FILE* fp = fopen ("LICENSE", "r");
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 if (fp == null) {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 // Failed; tell the user how to get the license text instead.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 setlocale (LC_ALL, "C");
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
99 char const* text = "Couldn't open LICENSE: %s.<br />"
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 "See <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a> for the GPLv3 text.";
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
102 license->setHtml (fmt (text, strerror (errno)));
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 } else {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 // Figure out file size
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 fseek (fp, 0, SEEK_END);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 const size_t length = ftell (fp);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 rewind (fp);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
109 // Init text buffer and write pointer
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 char* licenseText = new char[length];
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 char* writePtr = &licenseText[0];
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 // Read in the license text
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 while (true) {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 *writePtr = fgetc (fp);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 if (feof (fp))
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 break;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 writePtr++;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 }
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 // Add terminating null character and add the license text to the
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 // license dialog text view.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 *writePtr = '\0';
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 license->setText (licenseText);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 // And dump the trash on the way out.
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 delete[] licenseText;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 }
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
131
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 QVBoxLayout* layout = new QVBoxLayout;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 layout->addWidget (license);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 licenseTab->setLayout (layout);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 tabs->addTab (licenseTab, "License");
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 }
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 QDialogButtonBox* buttons = new QDialogButtonBox (QDialogButtonBox::Close);
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 158
diff changeset
139 QPushButton* helpButton = new QPushButton;
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 helpButton->setText ("Mail Author");
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142 helpButton->setIcon (getIcon ("mail"));
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 158
diff changeset
143 buttons->addButton (static_cast<QAbstractButton*> (helpButton), QDialogButtonBox::HelpRole);
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
144 connect (buttons, SIGNAL (helpRequested ()), this, SLOT (slot_mail ()));
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 connect (buttons, SIGNAL (rejected ()), this, SLOT (reject ()));
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 QVBoxLayout* layout = new QVBoxLayout;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 layout->addWidget (tabs);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 layout->addWidget (buttons);
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150 setLayout (layout);
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
151 setWindowTitle ("About " APPNAME);
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 }
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154 void AboutDialog::slot_mail () {
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155 QDesktopServices::openUrl (QUrl ("mailto:Santeri Piippo <arezey@gmail.com>?subject=LDForge"));
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156 }

mercurial