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
#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>

View File

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

View File

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

View File

@ -679,6 +679,11 @@ MainWindow::~MainWindow()
#endif
delete this->thrownTogetherRenderer;
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()