Add OK button, some Linux window managers do not add a close button to dialogs.

master
Torsten Paul 2014-12-23 18:27:39 +01:00
parent 5dc88d0eed
commit c9a234a079
3 changed files with 116 additions and 11 deletions

View File

@ -1,23 +1,23 @@
#pragma once
#include "openscad.h"
#include "qtgettext.h"
#include "ui_AboutDialog.h"
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
class AboutDialog : public QDialog, public Ui::AboutDialog
{
Q_OBJECT;
public:
AboutDialog(QWidget *) {
setupUi(this);
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + QString(TOSTRING( OPENSCAD_VERSION)) );
this->aboutText->setOpenExternalLinks(true);
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + openscad_versionnumber.c_str());
QUrl flattr_qurl(":icons/flattr.png" );
this->aboutText->loadResource( QTextDocument::ImageResource, flattr_qurl );
QString tmp = this->aboutText->toHtml();
tmp.replace("__VERSION__",QString(TOSTRING(OPENSCAD_VERSION)));
tmp.replace("__VERSION__", openscad_versionnumber.c_str());
this->aboutText->setHtml(tmp);
}
public slots:
void on_okPushButton_clicked() { accept(); }
};

View File

@ -19,7 +19,7 @@
</p>
<p>
<a href="http://www.openscad.org">OpenSCAD</a> version __VERSION__
<b><a href="http://www.openscad.org">OpenSCAD</a> version __VERSION__</b>
</p>
<p>

View File

@ -6,16 +6,98 @@
<rect>
<x>0</x>
<y>0</y>
<width>567</width>
<height>359</height>
<width>628</width>
<height>419</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About OpenSCAD</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>16</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="3">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>96</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../openscad.qrc">:/icons/openscad.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="titleLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;
&lt;p style=&quot;font-family: 'Open Sans', 'Droid Sans', 'sans-serif'; font-weight: bold; padding-bottom: 0; margin-bottom: 0; font-size: 22pt;&quot;&gt;&lt;span style=&quot;color: green;&quot;&gt;Open&lt;/span&gt;SCAD&lt;/p&gt;
&lt;p style=&quot;font-family: 'Open Sans', 'Droid Sans', 'sans-serif'; font-weight: normal; font-size: 14pt; padding-top: 0; margin-top: 0; margin-left: 2em;&quot;&gt;The Programmers Solid 3D CAD Modeller&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0" colspan="3">
<widget class="QTextBrowser" name="aboutText">
<property name="minimumSize">
<size>
<width>400</width>
<height>200</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@ -24,8 +106,31 @@
<string>qrc:/src/AboutDialog.html</string>
</url>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="okPushButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item row="4" column="1">
<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>
</widget>
<resources>