Merge pull request #1106 from openscad/gui-updates

Gui updates
master
Marius Kintel 2014-12-23 13:20:32 -05:00
commit 32c3e0d322
6 changed files with 166 additions and 50 deletions

View File

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

View File

@ -19,7 +19,7 @@
</p> </p>
<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>
<p> <p>

View File

@ -6,16 +6,98 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>567</width> <width>628</width>
<height>359</height> <height>419</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>About OpenSCAD</string> <string>About OpenSCAD</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QGridLayout" name="gridLayout">
<item> <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"> <widget class="QTextBrowser" name="aboutText">
<property name="minimumSize">
<size>
<width>400</width>
<height>200</height>
</size>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -24,8 +106,31 @@
<string>qrc:/src/AboutDialog.html</string> <string>qrc:/src/AboutDialog.html</string>
</url> </url>
</property> </property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<resources> <resources>

View File

@ -50,13 +50,14 @@ void FontListTableView::startDrag(Qt::DropActions supportedActions)
mimeData->setText(text); mimeData->setText(text);
QFontMetrics fm(font()); QFontMetrics fm(font());
QRect rect(0, 0, fm.width(text), fm.height()); QRect rect(0, 0, fm.width(text) + 8, fm.height() + 8);
QPixmap pixmap(rect.width(), rect.height()); QPixmap pixmap(rect.width(), rect.height());
pixmap.fill(Qt::transparent); pixmap.fill(QColor(240, 240, 240, 160));
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.setFont(font()); painter.setFont(font());
painter.drawText(rect, Qt::AlignCenter, text); painter.drawText(rect, Qt::AlignCenter, text);
painter.drawRect(0, 0, rect.width() - 1, rect.height() - 1);
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
drag->setPixmap(pixmap); drag->setPixmap(pixmap);

View File

@ -337,43 +337,48 @@ QPushButton:pressed {
</item> </item>
</layout> </layout>
</item> </item>
<item row="8" column="1"> <item row="8" column="0" colspan="2">
<widget class="QLabel" name="versionNumberLabel"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizePolicy"> <item>
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <widget class="QCheckBox" name="checkBox">
<horstretch>0</horstretch> <property name="enabled">
<verstretch>0</verstretch> <bool>true</bool>
</sizepolicy> </property>
</property> <property name="autoFillBackground">
<property name="text"> <bool>false</bool>
<string>Version</string> </property>
</property> <property name="text">
<property name="alignment"> <string>Don't show again</string>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property>
</property> <property name="checked">
</widget> <bool>false</bool>
</item> </property>
<item row="8" column="0"> </widget>
<widget class="QCheckBox" name="checkBox"> </item>
<property name="enabled"> <item>
<bool>true</bool> <spacer name="horizontalSpacer">
</property> <property name="orientation">
<property name="sizePolicy"> <enum>Qt::Horizontal</enum>
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> </property>
<horstretch>0</horstretch> <property name="sizeHint" stdset="0">
<verstretch>0</verstretch> <size>
</sizepolicy> <width>2</width>
</property> <height>2</height>
<property name="autoFillBackground"> </size>
<bool>false</bool> </property>
</property> </spacer>
<property name="text"> </item>
<string>Don't show again</string> <item>
</property> <widget class="QLabel" name="versionNumberLabel">
<property name="checked"> <property name="text">
<bool>false</bool> <string>Version</string>
</property> </property>
</widget> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -679,6 +679,11 @@ MainWindow::~MainWindow()
#endif #endif
delete this->thrownTogetherRenderer; delete this->thrownTogetherRenderer;
MainWindow::getWindows()->remove(this); MainWindow::getWindows()->remove(this);
if (MainWindow::getWindows()->size() == 0) {
// Quit application even in case some other windows like
// Preferences are still open.
qApp->quit();
}
} }
void MainWindow::showProgress() void MainWindow::showProgress()