mirror of https://github.com/KLayout/klayout.git
Some refactoring for reducing size of layMainWindow.cc a little.
This commit is contained in:
parent
4bba58cde1
commit
9c7a9f4c6c
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>HelpDialog</class>
|
||||||
|
<widget class="QDialog" name="HelpDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>900</width>
|
||||||
|
<height>500</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Assistant</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="lay::BrowserPanel" name="browser_panel" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>1</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="button_frame">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>lay::BrowserPanel</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>layBrowserPanel.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>button_frame</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>HelpDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>436</x>
|
||||||
|
<y>487</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>309</x>
|
||||||
|
<y>498</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
|
|
@ -9,9 +9,11 @@ DEFINES += MAKE_LAY_LIBRARY
|
||||||
HEADERS = \
|
HEADERS = \
|
||||||
layApplication.h \
|
layApplication.h \
|
||||||
layClipDialog.h \
|
layClipDialog.h \
|
||||||
|
layControlWidgetStack.h \
|
||||||
layCrashMessage.h \
|
layCrashMessage.h \
|
||||||
layFillDialog.h \
|
layFillDialog.h \
|
||||||
layGSIHelpProvider.h \
|
layGSIHelpProvider.h \
|
||||||
|
layHelpAboutDialog.h \
|
||||||
layHelpDialog.h \
|
layHelpDialog.h \
|
||||||
layHelpProvider.h \
|
layHelpProvider.h \
|
||||||
layHelpSource.h \
|
layHelpSource.h \
|
||||||
|
|
@ -25,6 +27,7 @@ HEADERS = \
|
||||||
layMainWindow.h \
|
layMainWindow.h \
|
||||||
layNavigator.h \
|
layNavigator.h \
|
||||||
layProgress.h \
|
layProgress.h \
|
||||||
|
layProgressDialog.h \
|
||||||
layProgressWidget.h \
|
layProgressWidget.h \
|
||||||
layResourceHelpProvider.h \
|
layResourceHelpProvider.h \
|
||||||
layRuntimeErrorForm.h \
|
layRuntimeErrorForm.h \
|
||||||
|
|
@ -35,6 +38,7 @@ HEADERS = \
|
||||||
laySettingsForm.h \
|
laySettingsForm.h \
|
||||||
layTechSetupDialog.h \
|
layTechSetupDialog.h \
|
||||||
layTextProgress.h \
|
layTextProgress.h \
|
||||||
|
layTextProgressDelegate.h \
|
||||||
layVersion.h \
|
layVersion.h \
|
||||||
layCommon.h \
|
layCommon.h \
|
||||||
layConfig.h \
|
layConfig.h \
|
||||||
|
|
@ -57,7 +61,8 @@ HEADERS = \
|
||||||
layMacroEditorSetupPage.h \
|
layMacroEditorSetupPage.h \
|
||||||
layPasswordDialog.h \
|
layPasswordDialog.h \
|
||||||
layForceLink.h \
|
layForceLink.h \
|
||||||
layInit.h
|
layInit.h \
|
||||||
|
layViewWidgetStack.h
|
||||||
|
|
||||||
FORMS = \
|
FORMS = \
|
||||||
ClipDialog.ui \
|
ClipDialog.ui \
|
||||||
|
|
@ -66,6 +71,7 @@ FORMS = \
|
||||||
DeleteModeDialog.ui \
|
DeleteModeDialog.ui \
|
||||||
FillDialog.ui \
|
FillDialog.ui \
|
||||||
HelpAboutDialog.ui \
|
HelpAboutDialog.ui \
|
||||||
|
HelpDialog.ui \
|
||||||
LogViewerDialog.ui \
|
LogViewerDialog.ui \
|
||||||
MacroEditorDialog.ui \
|
MacroEditorDialog.ui \
|
||||||
MacroPropertiesDialog.ui \
|
MacroPropertiesDialog.ui \
|
||||||
|
|
@ -112,9 +118,11 @@ SOURCES = \
|
||||||
gsiDeclLayMainWindow.cc \
|
gsiDeclLayMainWindow.cc \
|
||||||
layApplication.cc \
|
layApplication.cc \
|
||||||
layClipDialog.cc \
|
layClipDialog.cc \
|
||||||
|
layControlWidgetStack.cc \
|
||||||
layCrashMessage.cc \
|
layCrashMessage.cc \
|
||||||
layFillDialog.cc \
|
layFillDialog.cc \
|
||||||
layGSIHelpProvider.cc \
|
layGSIHelpProvider.cc \
|
||||||
|
layHelpAboutDialog.cc \
|
||||||
layHelpDialog.cc \
|
layHelpDialog.cc \
|
||||||
layHelpProvider.cc \
|
layHelpProvider.cc \
|
||||||
layHelpSource.cc \
|
layHelpSource.cc \
|
||||||
|
|
@ -128,6 +136,7 @@ SOURCES = \
|
||||||
layMainWindow.cc \
|
layMainWindow.cc \
|
||||||
layNavigator.cc \
|
layNavigator.cc \
|
||||||
layProgress.cc \
|
layProgress.cc \
|
||||||
|
layProgressDialog.cc \
|
||||||
layProgressWidget.cc \
|
layProgressWidget.cc \
|
||||||
layResourceHelpProvider.cc \
|
layResourceHelpProvider.cc \
|
||||||
layRuntimeErrorForm.cc \
|
layRuntimeErrorForm.cc \
|
||||||
|
|
@ -139,6 +148,7 @@ SOURCES = \
|
||||||
laySettingsForm.cc \
|
laySettingsForm.cc \
|
||||||
layTechSetupDialog.cc \
|
layTechSetupDialog.cc \
|
||||||
layTextProgress.cc \
|
layTextProgress.cc \
|
||||||
|
layTextProgressDelegate.cc \
|
||||||
layVersion.cc \
|
layVersion.cc \
|
||||||
layMacroController.cc \
|
layMacroController.cc \
|
||||||
layTechnologyController.cc \
|
layTechnologyController.cc \
|
||||||
|
|
@ -159,7 +169,8 @@ SOURCES = \
|
||||||
layMacroEditorSetupPage.cc \
|
layMacroEditorSetupPage.cc \
|
||||||
layPasswordDialog.cc \
|
layPasswordDialog.cc \
|
||||||
layForceLink.cc \
|
layForceLink.cc \
|
||||||
layInit.cc
|
layInit.cc \
|
||||||
|
layViewWidgetStack.cc
|
||||||
|
|
||||||
RESOURCES = layBuildInMacros.qrc \
|
RESOURCES = layBuildInMacros.qrc \
|
||||||
layHelpResources.qrc \
|
layHelpResources.qrc \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layControlWidgetStack.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
ControlWidgetStack::ControlWidgetStack(QWidget *parent, const char *name)
|
||||||
|
: QFrame (parent), mp_current_widget (0)
|
||||||
|
{
|
||||||
|
setObjectName (QString::fromUtf8 (name));
|
||||||
|
|
||||||
|
// Background ist a simple label without a text currently
|
||||||
|
mp_bglabel = new QLabel (this);
|
||||||
|
mp_bglabel->setAutoFillBackground (true);
|
||||||
|
mp_bglabel->setAlignment (Qt::AlignVCenter | Qt::AlignHCenter);
|
||||||
|
mp_bglabel->show ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlWidgetStack::focusInEvent(QFocusEvent *)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
||||||
|
if (m_widgets [i]->isVisible ()) {
|
||||||
|
m_widgets [i]->setFocus ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlWidgetStack::add_widget(QWidget *w)
|
||||||
|
{
|
||||||
|
m_widgets.push_back (w);
|
||||||
|
w->setParent (this);
|
||||||
|
resize_children ();
|
||||||
|
raise_widget (m_widgets.size () - 1);
|
||||||
|
|
||||||
|
int mw = 0;
|
||||||
|
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
||||||
|
mw = std::max (m_widgets [i]->sizeHint ().width (), mw);
|
||||||
|
mw = std::max (m_widgets [i]->minimumWidth (), mw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mw > minimumWidth ()) {
|
||||||
|
setMinimumWidth (mw);
|
||||||
|
resize (minimumWidth (), height ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ControlWidgetStack::sizeHint() const
|
||||||
|
{
|
||||||
|
int w = 0;
|
||||||
|
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
||||||
|
w = std::max (m_widgets [i]->sizeHint ().width (), w);
|
||||||
|
}
|
||||||
|
return QSize (w, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlWidgetStack::remove_widget(size_t index)
|
||||||
|
{
|
||||||
|
if (index < m_widgets.size ()) {
|
||||||
|
if (mp_current_widget == m_widgets [index]) {
|
||||||
|
mp_current_widget = 0;
|
||||||
|
}
|
||||||
|
m_widgets.erase (m_widgets.begin () + index);
|
||||||
|
}
|
||||||
|
if (m_widgets.size () == 0) {
|
||||||
|
mp_bglabel->show ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlWidgetStack::raise_widget(size_t index)
|
||||||
|
{
|
||||||
|
mp_current_widget = 0;
|
||||||
|
bool any_visible = false;
|
||||||
|
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
||||||
|
if (m_widgets [i]) {
|
||||||
|
if (i == index) {
|
||||||
|
m_widgets [i]->show ();
|
||||||
|
mp_current_widget = m_widgets [i];
|
||||||
|
any_visible = true;
|
||||||
|
} else {
|
||||||
|
m_widgets [i]->hide ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! any_visible) {
|
||||||
|
mp_bglabel->show ();
|
||||||
|
} else {
|
||||||
|
mp_bglabel->hide ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *ControlWidgetStack::widget(size_t index)
|
||||||
|
{
|
||||||
|
if (index < m_widgets.size ()) {
|
||||||
|
return m_widgets [index];
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *ControlWidgetStack::background_widget()
|
||||||
|
{
|
||||||
|
return mp_bglabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControlWidgetStack::resize_children()
|
||||||
|
{
|
||||||
|
// set the geometry of all children
|
||||||
|
for (std::vector <QWidget *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) {
|
||||||
|
if (*child) {
|
||||||
|
(*child)->setGeometry (0, 0, width (), height ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mp_bglabel->setGeometry (0, 0, width (), height ());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layControlWidgetStack
|
||||||
|
#define HDR_layControlWidgetStack
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
class ControlWidgetStack
|
||||||
|
: public QFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ControlWidgetStack (QWidget *parent = 0, const char *name = 0);
|
||||||
|
|
||||||
|
void focusInEvent (QFocusEvent *);
|
||||||
|
|
||||||
|
QSize sizeHint () const;
|
||||||
|
|
||||||
|
void add_widget (QWidget *w);
|
||||||
|
void remove_widget (size_t index);
|
||||||
|
void raise_widget (size_t index);
|
||||||
|
QWidget *widget (size_t index);
|
||||||
|
QWidget *background_widget ();
|
||||||
|
|
||||||
|
QWidget *currentWidget () const
|
||||||
|
{
|
||||||
|
return mp_current_widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t count () const
|
||||||
|
{
|
||||||
|
return m_widgets.size ();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void resizeEvent (QResizeEvent *)
|
||||||
|
{
|
||||||
|
resize_children ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void resize_children ();
|
||||||
|
|
||||||
|
std::vector <QWidget *> m_widgets;
|
||||||
|
QWidget *mp_current_widget;
|
||||||
|
QLabel *mp_bglabel;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layHelpAboutDialog.h"
|
||||||
|
#include "layApplication.h"
|
||||||
|
#include "layVersion.h"
|
||||||
|
#include "layHelpSource.h" // because of escape_xml
|
||||||
|
#include "layInit.h"
|
||||||
|
#include "dbInit.h"
|
||||||
|
#include "gsiInterpreter.h"
|
||||||
|
|
||||||
|
#include "ui_HelpAboutDialog.h"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// Implementation of the "help about" dialog
|
||||||
|
|
||||||
|
HelpAboutDialog::HelpAboutDialog (QWidget *parent)
|
||||||
|
: QDialog (parent)
|
||||||
|
{
|
||||||
|
mp_ui = new Ui::HelpAboutDialog ();
|
||||||
|
mp_ui->setupUi (this);
|
||||||
|
|
||||||
|
std::vector<std::string> build_options;
|
||||||
|
if (lay::ApplicationBase::instance ()->ruby_interpreter ().available ()) {
|
||||||
|
build_options.push_back (tl::to_string (tr ("Ruby interpreter ")) + lay::ApplicationBase::instance ()->ruby_interpreter ().version ());
|
||||||
|
}
|
||||||
|
if (lay::ApplicationBase::instance ()->python_interpreter ().available ()) {
|
||||||
|
build_options.push_back (tl::to_string (tr ("Python interpreter ")) + lay::ApplicationBase::instance ()->python_interpreter ().version ());
|
||||||
|
}
|
||||||
|
#if defined(HAVE_QTBINDINGS)
|
||||||
|
build_options.push_back (tl::to_string (tr ("Qt bindings for scripts")));
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_64BIT_COORD)
|
||||||
|
build_options.push_back (tl::to_string (tr ("Wide coordinates (64 bit)")));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::string s;
|
||||||
|
|
||||||
|
s = "<html><body>";
|
||||||
|
|
||||||
|
s += "<h1>";
|
||||||
|
s += escape_xml (std::string (lay::Version::name ()) + " " + lay::Version::version ());
|
||||||
|
s += "</h1>";
|
||||||
|
|
||||||
|
std::vector<std::string> about_paras = tl::split (lay::Version::about_text (), "\n\n");
|
||||||
|
for (std::vector<std::string>::const_iterator p = about_paras.begin (); p != about_paras.end (); ++p) {
|
||||||
|
s += std::string ("<p>") + escape_xml (*p) + "</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! build_options.empty ()) {
|
||||||
|
s += "<p>";
|
||||||
|
s += "<h4>";
|
||||||
|
s += escape_xml (tl::to_string (QObject::tr ("Build options:")));
|
||||||
|
s += "</h4><ul>";
|
||||||
|
for (std::vector<std::string>::const_iterator bo = build_options.begin (); bo != build_options.end (); ++bo) {
|
||||||
|
s += "<li>";
|
||||||
|
s += escape_xml (*bo);
|
||||||
|
s += "</li>";
|
||||||
|
}
|
||||||
|
s += "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! lay::plugins ().empty () || ! db::plugins ().empty ()) {
|
||||||
|
|
||||||
|
s += "<p>";
|
||||||
|
s += "<h4>";
|
||||||
|
s += escape_xml (tl::to_string (QObject::tr ("Binary extensions:")));
|
||||||
|
s += "</h4><ul>";
|
||||||
|
|
||||||
|
for (std::list<lay::PluginDescriptor>::const_iterator pd = lay::plugins ().begin (); pd != lay::plugins ().end (); ++pd) {
|
||||||
|
s += "<li>";
|
||||||
|
if (! pd->description.empty ()) {
|
||||||
|
s += escape_xml (pd->description);
|
||||||
|
} else {
|
||||||
|
s += escape_xml (pd->path);
|
||||||
|
}
|
||||||
|
if (! pd->version.empty ()) {
|
||||||
|
s += " (" + escape_xml (pd->version) + ")";
|
||||||
|
}
|
||||||
|
s += "</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (std::list<db::PluginDescriptor>::const_iterator pd = db::plugins ().begin (); pd != db::plugins ().end (); ++pd) {
|
||||||
|
s += "<li>";
|
||||||
|
if (! pd->description.empty ()) {
|
||||||
|
s += escape_xml (pd->description);
|
||||||
|
} else {
|
||||||
|
s += escape_xml (pd->path);
|
||||||
|
}
|
||||||
|
if (! pd->version.empty ()) {
|
||||||
|
s += " (" + escape_xml (pd->version) + ")";
|
||||||
|
}
|
||||||
|
s += "</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
s += "</ul>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
s += "</body></html>";
|
||||||
|
|
||||||
|
std::string t = tl::to_string (QObject::tr ("About ")) + lay::Version::name ();
|
||||||
|
|
||||||
|
setWindowTitle (tl::to_qstring (t));
|
||||||
|
|
||||||
|
mp_ui->main->setWordWrap (true);
|
||||||
|
mp_ui->main->setText (tl::to_qstring (s));
|
||||||
|
}
|
||||||
|
|
||||||
|
HelpAboutDialog::~HelpAboutDialog ()
|
||||||
|
{
|
||||||
|
delete mp_ui;
|
||||||
|
mp_ui = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layHelpAboutDialog
|
||||||
|
#define HDR_layHelpAboutDialog
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class HelpAboutDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief A dialog for showing the "help about" dialog
|
||||||
|
*/
|
||||||
|
class LAY_PUBLIC HelpAboutDialog
|
||||||
|
: public QDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HelpAboutDialog (QWidget *parent);
|
||||||
|
~HelpAboutDialog ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::HelpAboutDialog *mp_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include "layHelpSource.h"
|
#include "layHelpSource.h"
|
||||||
#include "layBrowserPanel.h"
|
#include "layBrowserPanel.h"
|
||||||
#include "tlStaticObjects.h"
|
#include "tlStaticObjects.h"
|
||||||
|
#include "ui_HelpDialog.h"
|
||||||
|
|
||||||
#include "tlString.h"
|
#include "tlString.h"
|
||||||
|
|
||||||
|
|
@ -42,35 +43,16 @@ HelpDialog::HelpDialog (QWidget *parent, bool modal)
|
||||||
: QDialog (modal ? parent : 0 /*show as separate window*/, modal ? Qt::WindowFlags (0) : Qt::Window /*enabled minimize button*/),
|
: QDialog (modal ? parent : 0 /*show as separate window*/, modal ? Qt::WindowFlags (0) : Qt::Window /*enabled minimize button*/),
|
||||||
m_initialized (false)
|
m_initialized (false)
|
||||||
{
|
{
|
||||||
|
mp_ui = new Ui::HelpDialog ();
|
||||||
|
mp_ui->setupUi (this);
|
||||||
|
|
||||||
setModal (modal);
|
setModal (modal);
|
||||||
|
|
||||||
QVBoxLayout *help_layout = new QVBoxLayout (this);
|
mp_ui->button_frame->setVisible (modal);
|
||||||
setLayout (help_layout);
|
|
||||||
setWindowTitle (QObject::tr ("Assistant"));
|
|
||||||
mp_browser_panel = new lay::BrowserPanel (this);
|
|
||||||
help_layout->addWidget (mp_browser_panel);
|
|
||||||
|
|
||||||
QSizePolicy sp = mp_browser_panel->sizePolicy ();
|
|
||||||
sp.setVerticalStretch (1);
|
|
||||||
mp_browser_panel->setSizePolicy (sp);
|
|
||||||
|
|
||||||
if (modal) {
|
|
||||||
QFrame *button_frame = new QFrame (this);
|
|
||||||
help_layout->addWidget (button_frame);
|
|
||||||
QHBoxLayout *button_layout = new QHBoxLayout (button_frame);
|
|
||||||
button_layout->setMargin (0);
|
|
||||||
QPushButton *close_button = new QPushButton (button_frame);
|
|
||||||
button_layout->addStretch (1);
|
|
||||||
button_layout->addWidget (close_button);
|
|
||||||
close_button->setText (QObject::tr ("Close"));
|
|
||||||
close_button->setDefault (false);
|
|
||||||
close_button->setAutoDefault (false);
|
|
||||||
connect (close_button, SIGNAL (clicked ()), this, SLOT (accept ()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_def_title = windowTitle ();
|
m_def_title = windowTitle ();
|
||||||
connect (mp_browser_panel, SIGNAL (title_changed (const QString &)), this, SLOT (title_changed (const QString &)));
|
connect (mp_ui->browser_panel, SIGNAL (title_changed (const QString &)), this, SLOT (title_changed (const QString &)));
|
||||||
connect (mp_browser_panel, SIGNAL (url_changed (const QString &)), this, SLOT (title_changed (const QString &)));
|
connect (mp_ui->browser_panel, SIGNAL (url_changed (const QString &)), this, SLOT (title_changed (const QString &)));
|
||||||
}
|
}
|
||||||
|
|
||||||
HelpDialog::~HelpDialog ()
|
HelpDialog::~HelpDialog ()
|
||||||
|
|
@ -82,14 +64,14 @@ void HelpDialog::title_changed (const QString &)
|
||||||
{
|
{
|
||||||
QString wt;
|
QString wt;
|
||||||
|
|
||||||
QString title = tl::to_qstring (mp_browser_panel->title ());
|
QString title = tl::to_qstring (mp_ui->browser_panel->title ());
|
||||||
if (title.isNull () || title.size () == 0) {
|
if (title.isNull () || title.size () == 0) {
|
||||||
wt = m_def_title;
|
wt = m_def_title;
|
||||||
} else {
|
} else {
|
||||||
wt = m_def_title + QString::fromUtf8 (" - ") + title;
|
wt = m_def_title + QString::fromUtf8 (" - ") + title;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString url = tl::to_qstring (mp_browser_panel->url ());
|
QString url = tl::to_qstring (mp_ui->browser_panel->url ());
|
||||||
if (! url.isNull () && url.size () > 0) {
|
if (! url.isNull () && url.size () > 0) {
|
||||||
wt += QString::fromUtf8 (" [") + url + QString::fromUtf8 ("]");
|
wt += QString::fromUtf8 (" [") + url + QString::fromUtf8 ("]");
|
||||||
}
|
}
|
||||||
|
|
@ -100,13 +82,13 @@ void HelpDialog::title_changed (const QString &)
|
||||||
void HelpDialog::load (const std::string &url)
|
void HelpDialog::load (const std::string &url)
|
||||||
{
|
{
|
||||||
initialize ();
|
initialize ();
|
||||||
mp_browser_panel->load (url);
|
mp_ui->browser_panel->load (url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpDialog::search (const std::string &topic)
|
void HelpDialog::search (const std::string &topic)
|
||||||
{
|
{
|
||||||
initialize ();
|
initialize ();
|
||||||
mp_browser_panel->search (topic);
|
mp_ui->browser_panel->search (topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpDialog::showEvent (QShowEvent *)
|
void HelpDialog::showEvent (QShowEvent *)
|
||||||
|
|
@ -121,13 +103,13 @@ void HelpDialog::initialize ()
|
||||||
{
|
{
|
||||||
if (! m_initialized) {
|
if (! m_initialized) {
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
mp_browser_panel->set_search_url ("int:/search.xml", "string");
|
mp_ui->browser_panel->set_search_url ("int:/search.xml", "string");
|
||||||
if (! mp_help_source) {
|
if (! mp_help_source) {
|
||||||
mp_help_source = new lay::HelpSource ();
|
mp_help_source = new lay::HelpSource ();
|
||||||
tl::StaticObjects::reg (&mp_help_source);
|
tl::StaticObjects::reg (&mp_help_source);
|
||||||
}
|
}
|
||||||
mp_browser_panel->set_source (mp_help_source);
|
mp_ui->browser_panel->set_source (mp_help_source);
|
||||||
mp_browser_panel->set_home ("int:/index.xml");
|
mp_ui->browser_panel->set_home ("int:/index.xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class HelpDialog;
|
||||||
|
}
|
||||||
|
|
||||||
namespace lay
|
namespace lay
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -58,7 +63,7 @@ protected slots:
|
||||||
void title_changed (const QString &t);
|
void title_changed (const QString &t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lay::BrowserPanel *mp_browser_panel;
|
Ui::HelpDialog *mp_ui;
|
||||||
QRect m_geometry;
|
QRect m_geometry;
|
||||||
static lay::HelpSource *mp_help_source;
|
static lay::HelpSource *mp_help_source;
|
||||||
QString m_def_title;
|
QString m_def_title;
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,9 @@
|
||||||
#include "layConfig.h"
|
#include "layConfig.h"
|
||||||
#include "layMainWindow.h"
|
#include "layMainWindow.h"
|
||||||
#include "layHelpDialog.h"
|
#include "layHelpDialog.h"
|
||||||
#include "layHelpSource.h" // because of escape_xml
|
|
||||||
#include "layNavigator.h"
|
#include "layNavigator.h"
|
||||||
#include "layProgress.h"
|
#include "layProgress.h"
|
||||||
|
#include "layProgressDialog.h"
|
||||||
#include "layProgressWidget.h"
|
#include "layProgressWidget.h"
|
||||||
#include "layStream.h"
|
#include "layStream.h"
|
||||||
#include "layLayerControlPanel.h" // because of LabelWithBackground
|
#include "layLayerControlPanel.h" // because of LabelWithBackground
|
||||||
|
|
@ -89,10 +89,12 @@
|
||||||
#include "laySaltController.h"
|
#include "laySaltController.h"
|
||||||
#include "layTipDialog.h"
|
#include "layTipDialog.h"
|
||||||
#include "layMacroController.h"
|
#include "layMacroController.h"
|
||||||
|
#include "layHelpAboutDialog.h"
|
||||||
|
#include "layControlWidgetStack.h"
|
||||||
|
#include "layViewWidgetStack.h"
|
||||||
#include "layInit.h"
|
#include "layInit.h"
|
||||||
#include "antObject.h"
|
#include "antObject.h"
|
||||||
#include "antService.h"
|
#include "antService.h"
|
||||||
#include "ui_HelpAboutDialog.h"
|
|
||||||
#include "gsi.h"
|
#include "gsi.h"
|
||||||
#include "gsiInterpreter.h"
|
#include "gsiInterpreter.h"
|
||||||
#include "gtf.h"
|
#include "gtf.h"
|
||||||
|
|
@ -104,334 +106,6 @@ const int max_dirty_files = 15;
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
// -------------------------------------------------------------
|
||||||
|
|
||||||
class ProgressDialog
|
|
||||||
: public QDialog,
|
|
||||||
public tl::Object
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProgressDialog (QWidget *parent, lay::ProgressReporter *pr)
|
|
||||||
: QDialog (parent), mp_pr (pr)
|
|
||||||
{
|
|
||||||
QVBoxLayout *vbl = new QVBoxLayout (this);
|
|
||||||
vbl->setMargin (0);
|
|
||||||
vbl->setSpacing (0);
|
|
||||||
|
|
||||||
mp_progress_widget = new ProgressWidget (pr, this, true);
|
|
||||||
mp_progress_widget->setObjectName (QString::fromUtf8 ("progress"));
|
|
||||||
vbl->addWidget (mp_progress_widget);
|
|
||||||
|
|
||||||
setWindowTitle (QObject::tr ("Progress"));
|
|
||||||
setWindowModality (Qt::WindowModal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * /*event*/)
|
|
||||||
{
|
|
||||||
if (mp_pr) {
|
|
||||||
// NOTE: We don't kill on close for now. This creates a too easy way to scrap results.
|
|
||||||
// mp_pr->signal_break ();
|
|
||||||
// TODO: there should be a warning saying some jobs are pending.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_progress (tl::Progress *progress)
|
|
||||||
{
|
|
||||||
mp_progress_widget->set_progress (progress);
|
|
||||||
}
|
|
||||||
|
|
||||||
void add_widget (QWidget *widget)
|
|
||||||
{
|
|
||||||
mp_progress_widget->add_widget (widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_widget ()
|
|
||||||
{
|
|
||||||
mp_progress_widget->remove_widget ();
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *get_widget () const
|
|
||||||
{
|
|
||||||
return mp_progress_widget->get_widget ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
lay::ProgressWidget *mp_progress_widget;
|
|
||||||
lay::ProgressReporter *mp_pr;
|
|
||||||
};
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
|
|
||||||
class ControlWidgetStack
|
|
||||||
: public QFrame
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ControlWidgetStack (QWidget *parent = 0, const char *name = 0)
|
|
||||||
: QFrame (parent), mp_current_widget (0)
|
|
||||||
{
|
|
||||||
setObjectName (QString::fromUtf8 (name));
|
|
||||||
|
|
||||||
// Background ist a simple label without a text currently
|
|
||||||
mp_bglabel = new QLabel (this);
|
|
||||||
mp_bglabel->setAutoFillBackground (true);
|
|
||||||
mp_bglabel->setAlignment (Qt::AlignVCenter | Qt::AlignHCenter);
|
|
||||||
mp_bglabel->show ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void focusInEvent (QFocusEvent *)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
|
||||||
if (m_widgets [i]->isVisible ()) {
|
|
||||||
m_widgets [i]->setFocus ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void addWidget (QWidget *w)
|
|
||||||
{
|
|
||||||
m_widgets.push_back (w);
|
|
||||||
w->setParent (this);
|
|
||||||
resize_children ();
|
|
||||||
raiseWidget (m_widgets.size () - 1);
|
|
||||||
|
|
||||||
int mw = 0;
|
|
||||||
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
|
||||||
mw = std::max (m_widgets [i]->sizeHint ().width (), mw);
|
|
||||||
mw = std::max (m_widgets [i]->minimumWidth (), mw);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mw > minimumWidth ()) {
|
|
||||||
setMinimumWidth (mw);
|
|
||||||
resize (minimumWidth (), height ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize sizeHint () const
|
|
||||||
{
|
|
||||||
int w = 0;
|
|
||||||
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
|
||||||
w = std::max (m_widgets [i]->sizeHint ().width (), w);
|
|
||||||
}
|
|
||||||
return QSize (w, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeWidget (size_t index)
|
|
||||||
{
|
|
||||||
if (index < m_widgets.size ()) {
|
|
||||||
if (mp_current_widget == m_widgets [index]) {
|
|
||||||
mp_current_widget = 0;
|
|
||||||
}
|
|
||||||
m_widgets.erase (m_widgets.begin () + index);
|
|
||||||
}
|
|
||||||
if (m_widgets.size () == 0) {
|
|
||||||
mp_bglabel->show ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *currentWidget () const
|
|
||||||
{
|
|
||||||
return mp_current_widget;
|
|
||||||
}
|
|
||||||
|
|
||||||
void raiseWidget (size_t index)
|
|
||||||
{
|
|
||||||
mp_current_widget = 0;
|
|
||||||
bool any_visible = false;
|
|
||||||
for (size_t i = 0; i < m_widgets.size (); ++i) {
|
|
||||||
if (m_widgets [i]) {
|
|
||||||
if (i == index) {
|
|
||||||
m_widgets [i]->show ();
|
|
||||||
mp_current_widget = m_widgets [i];
|
|
||||||
any_visible = true;
|
|
||||||
} else {
|
|
||||||
m_widgets [i]->hide ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! any_visible) {
|
|
||||||
mp_bglabel->show ();
|
|
||||||
} else {
|
|
||||||
mp_bglabel->hide ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *widget (size_t index)
|
|
||||||
{
|
|
||||||
if (index < m_widgets.size ()) {
|
|
||||||
return m_widgets [index];
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *background_widget ()
|
|
||||||
{
|
|
||||||
return mp_bglabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t count () const
|
|
||||||
{
|
|
||||||
return m_widgets.size ();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void resizeEvent (QResizeEvent *)
|
|
||||||
{
|
|
||||||
resize_children ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void resize_children ()
|
|
||||||
{
|
|
||||||
// set the geometry of all children
|
|
||||||
for (std::vector <QWidget *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) {
|
|
||||||
if (*child) {
|
|
||||||
(*child)->setGeometry (0, 0, width (), height ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mp_bglabel->setGeometry (0, 0, width (), height ());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector <QWidget *> m_widgets;
|
|
||||||
QWidget *mp_current_widget;
|
|
||||||
QLabel *mp_bglabel;
|
|
||||||
};
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
|
|
||||||
class ViewWidgetStack
|
|
||||||
: public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ViewWidgetStack (QWidget *parent = 0, const char *name = 0)
|
|
||||||
: QWidget (parent)
|
|
||||||
{
|
|
||||||
setObjectName (QString::fromUtf8 (name));
|
|
||||||
|
|
||||||
mp_bglabel = new QLabel (this);
|
|
||||||
mp_bglabel->setAutoFillBackground (true);
|
|
||||||
mp_bglabel->setText (QObject::tr ("<html><body><p><img src=\":/logo.png\"/></p><p>Use File/Open to open a layout</p></body></html>"));
|
|
||||||
mp_bglabel->setAlignment (Qt::AlignVCenter | Qt::AlignHCenter);
|
|
||||||
mp_bglabel->show ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void addWidget (LayoutView *w)
|
|
||||||
{
|
|
||||||
m_widgets.push_back (w);
|
|
||||||
w->setParent (this);
|
|
||||||
resize_children ();
|
|
||||||
raiseWidget (m_widgets.size () - 1);
|
|
||||||
|
|
||||||
updateGeometry ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeWidget (size_t index)
|
|
||||||
{
|
|
||||||
if (index < m_widgets.size ()) {
|
|
||||||
m_widgets.erase (m_widgets.begin () + index);
|
|
||||||
}
|
|
||||||
if (m_widgets.size () == 0) {
|
|
||||||
mp_bglabel->show ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void raiseWidget (size_t index)
|
|
||||||
{
|
|
||||||
if (index < m_widgets.size ()) {
|
|
||||||
mp_bglabel->hide ();
|
|
||||||
m_widgets [index]->show ();
|
|
||||||
} else {
|
|
||||||
mp_bglabel->show ();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t i = 0;
|
|
||||||
for (std::vector <LayoutView *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child, ++i) {
|
|
||||||
if (i != index) {
|
|
||||||
(*child)->hide ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LayoutView *widget (size_t index)
|
|
||||||
{
|
|
||||||
if (index < m_widgets.size ()) {
|
|
||||||
return m_widgets [index];
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *background_widget ()
|
|
||||||
{
|
|
||||||
return mp_bglabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void resizeEvent (QResizeEvent *)
|
|
||||||
{
|
|
||||||
resize_children ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void resize_children ()
|
|
||||||
{
|
|
||||||
// set the geometry of all children
|
|
||||||
for (std::vector <LayoutView *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) {
|
|
||||||
(*child)->setGeometry (0, 0, width (), height ());
|
|
||||||
}
|
|
||||||
mp_bglabel->setGeometry (0, 0, width (), height ());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector <LayoutView *> m_widgets;
|
|
||||||
QLabel *mp_bglabel;
|
|
||||||
};
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
|
|
||||||
TextProgressDelegate::TextProgressDelegate (MainWindow *mw, int verbosity)
|
|
||||||
: lay::TextProgress (verbosity), mp_mw (mw)
|
|
||||||
{
|
|
||||||
// .. nothing yet ..
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextProgressDelegate::update_progress (tl::Progress *progress)
|
|
||||||
{
|
|
||||||
if (!mp_mw->update_progress (progress)) {
|
|
||||||
lay::TextProgress::update_progress (progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextProgressDelegate::show_progress_bar (bool show)
|
|
||||||
{
|
|
||||||
if (!mp_mw->show_progress_bar (show)) {
|
|
||||||
lay::TextProgress::show_progress_bar (show);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TextProgressDelegate::progress_wants_widget () const
|
|
||||||
{
|
|
||||||
return mp_mw != 0 && mp_mw->progress_wants_widget ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextProgressDelegate::progress_add_widget (QWidget *widget)
|
|
||||||
{
|
|
||||||
if (mp_mw) {
|
|
||||||
mp_mw->progress_add_widget (widget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *TextProgressDelegate::progress_get_widget () const
|
|
||||||
{
|
|
||||||
return mp_mw ? mp_mw->progress_get_widget () : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextProgressDelegate::progress_remove_widget ()
|
|
||||||
{
|
|
||||||
if (mp_mw) {
|
|
||||||
mp_mw->progress_remove_widget ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------
|
|
||||||
|
|
||||||
static MainWindow *mw_instance = 0;
|
static MainWindow *mw_instance = 0;
|
||||||
|
|
||||||
MainWindow *
|
MainWindow *
|
||||||
|
|
@ -1004,12 +678,12 @@ MainWindow::close_all ()
|
||||||
|
|
||||||
lay::LayoutView *view = mp_views.back ();
|
lay::LayoutView *view = mp_views.back ();
|
||||||
mp_views.pop_back ();
|
mp_views.pop_back ();
|
||||||
mp_lp_stack->removeWidget (mp_views.size ());
|
mp_lp_stack->remove_widget (mp_views.size ());
|
||||||
mp_hp_stack->removeWidget (mp_views.size ());
|
mp_hp_stack->remove_widget (mp_views.size ());
|
||||||
mp_libs_stack->removeWidget (mp_views.size ());
|
mp_libs_stack->remove_widget (mp_views.size ());
|
||||||
mp_eo_stack->removeWidget (mp_views.size ());
|
mp_eo_stack->remove_widget (mp_views.size ());
|
||||||
mp_bm_stack->removeWidget (mp_views.size ());
|
mp_bm_stack->remove_widget (mp_views.size ());
|
||||||
mp_view_stack->removeWidget (mp_views.size ());
|
mp_view_stack->remove_widget (mp_views.size ());
|
||||||
|
|
||||||
delete view;
|
delete view;
|
||||||
|
|
||||||
|
|
@ -2698,12 +2372,12 @@ MainWindow::select_view (int index)
|
||||||
current_view ()->zoom_box (box);
|
current_view ()->zoom_box (box);
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_view_stack->raiseWidget (index);
|
mp_view_stack->raise_widget (index);
|
||||||
mp_hp_stack->raiseWidget (index);
|
mp_hp_stack->raise_widget (index);
|
||||||
mp_lp_stack->raiseWidget (index);
|
mp_lp_stack->raise_widget (index);
|
||||||
mp_libs_stack->raiseWidget (index);
|
mp_libs_stack->raise_widget (index);
|
||||||
mp_eo_stack->raiseWidget (index);
|
mp_eo_stack->raise_widget (index);
|
||||||
mp_bm_stack->raiseWidget (index);
|
mp_bm_stack->raise_widget (index);
|
||||||
mp_setup_form->setup ();
|
mp_setup_form->setup ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -2890,12 +2564,12 @@ MainWindow::clone_current_view ()
|
||||||
|
|
||||||
mp_layer_toolbox->set_view (current_view ());
|
mp_layer_toolbox->set_view (current_view ());
|
||||||
|
|
||||||
mp_view_stack->addWidget (view);
|
mp_view_stack->add_widget (view);
|
||||||
mp_lp_stack->addWidget (view->layer_control_frame ());
|
mp_lp_stack->add_widget (view->layer_control_frame ());
|
||||||
mp_hp_stack->addWidget (view->hierarchy_control_frame ());
|
mp_hp_stack->add_widget (view->hierarchy_control_frame ());
|
||||||
mp_libs_stack->addWidget (view->libraries_frame ());
|
mp_libs_stack->add_widget (view->libraries_frame ());
|
||||||
mp_eo_stack->addWidget (view->editor_options_frame ());
|
mp_eo_stack->add_widget (view->editor_options_frame ());
|
||||||
mp_bm_stack->addWidget (view->bookmarks_frame ());
|
mp_bm_stack->add_widget (view->bookmarks_frame ());
|
||||||
|
|
||||||
bool f = m_disable_tab_selected;
|
bool f = m_disable_tab_selected;
|
||||||
m_disable_tab_selected = true;
|
m_disable_tab_selected = true;
|
||||||
|
|
@ -3141,12 +2815,12 @@ MainWindow::close_view (int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_tab_bar->removeTab (index);
|
mp_tab_bar->removeTab (index);
|
||||||
mp_view_stack->removeWidget (index);
|
mp_view_stack->remove_widget (index);
|
||||||
mp_lp_stack->removeWidget (index);
|
mp_lp_stack->remove_widget (index);
|
||||||
mp_hp_stack->removeWidget (index);
|
mp_hp_stack->remove_widget (index);
|
||||||
mp_libs_stack->removeWidget (index);
|
mp_libs_stack->remove_widget (index);
|
||||||
mp_eo_stack->removeWidget (index);
|
mp_eo_stack->remove_widget (index);
|
||||||
mp_bm_stack->removeWidget (index);
|
mp_bm_stack->remove_widget (index);
|
||||||
|
|
||||||
view_closed_event (int (index));
|
view_closed_event (int (index));
|
||||||
|
|
||||||
|
|
@ -3684,12 +3358,12 @@ MainWindow::create_view ()
|
||||||
|
|
||||||
mp_layer_toolbox->set_view (current_view ());
|
mp_layer_toolbox->set_view (current_view ());
|
||||||
|
|
||||||
mp_view_stack->addWidget (mp_views.back ());
|
mp_view_stack->add_widget (mp_views.back ());
|
||||||
mp_lp_stack->addWidget (mp_views.back ()->layer_control_frame ());
|
mp_lp_stack->add_widget (mp_views.back ()->layer_control_frame ());
|
||||||
mp_hp_stack->addWidget (mp_views.back ()->hierarchy_control_frame ());
|
mp_hp_stack->add_widget (mp_views.back ()->hierarchy_control_frame ());
|
||||||
mp_libs_stack->addWidget (mp_views.back ()->libraries_frame ());
|
mp_libs_stack->add_widget (mp_views.back ()->libraries_frame ());
|
||||||
mp_eo_stack->addWidget (mp_views.back ()->editor_options_frame ());
|
mp_eo_stack->add_widget (mp_views.back ()->editor_options_frame ());
|
||||||
mp_bm_stack->addWidget (mp_views.back ()->bookmarks_frame ());
|
mp_bm_stack->add_widget (mp_views.back ()->bookmarks_frame ());
|
||||||
|
|
||||||
bool f = m_disable_tab_selected;
|
bool f = m_disable_tab_selected;
|
||||||
m_disable_tab_selected = true;
|
m_disable_tab_selected = true;
|
||||||
|
|
@ -3748,12 +3422,12 @@ MainWindow::create_or_load_layout (const std::string *filename, const db::LoadLa
|
||||||
|
|
||||||
mp_layer_toolbox->set_view (current_view ());
|
mp_layer_toolbox->set_view (current_view ());
|
||||||
|
|
||||||
mp_view_stack->addWidget (mp_views.back ());
|
mp_view_stack->add_widget (mp_views.back ());
|
||||||
mp_lp_stack->addWidget (mp_views.back ()->layer_control_frame ());
|
mp_lp_stack->add_widget (mp_views.back ()->layer_control_frame ());
|
||||||
mp_hp_stack->addWidget (mp_views.back ()->hierarchy_control_frame ());
|
mp_hp_stack->add_widget (mp_views.back ()->hierarchy_control_frame ());
|
||||||
mp_libs_stack->addWidget (mp_views.back ()->libraries_frame ());
|
mp_libs_stack->add_widget (mp_views.back ()->libraries_frame ());
|
||||||
mp_eo_stack->addWidget (mp_views.back ()->editor_options_frame ());
|
mp_eo_stack->add_widget (mp_views.back ()->editor_options_frame ());
|
||||||
mp_bm_stack->addWidget (mp_views.back ()->bookmarks_frame ());
|
mp_bm_stack->add_widget (mp_views.back ()->bookmarks_frame ());
|
||||||
|
|
||||||
bool f = m_disable_tab_selected;
|
bool f = m_disable_tab_selected;
|
||||||
m_disable_tab_selected = true;
|
m_disable_tab_selected = true;
|
||||||
|
|
@ -4475,108 +4149,6 @@ MainWindow::plugin_removed (lay::PluginDeclaration *cls)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
|
||||||
// Implementation of the "help about" dialog
|
|
||||||
|
|
||||||
HelpAboutDialog::HelpAboutDialog (QWidget *parent)
|
|
||||||
: QDialog (parent)
|
|
||||||
{
|
|
||||||
mp_ui = new Ui::HelpAboutDialog ();
|
|
||||||
mp_ui->setupUi (this);
|
|
||||||
|
|
||||||
std::vector<std::string> build_options;
|
|
||||||
if (lay::ApplicationBase::instance ()->ruby_interpreter ().available ()) {
|
|
||||||
build_options.push_back (tl::to_string (tr ("Ruby interpreter ")) + lay::ApplicationBase::instance ()->ruby_interpreter ().version ());
|
|
||||||
}
|
|
||||||
if (lay::ApplicationBase::instance ()->python_interpreter ().available ()) {
|
|
||||||
build_options.push_back (tl::to_string (tr ("Python interpreter ")) + lay::ApplicationBase::instance ()->python_interpreter ().version ());
|
|
||||||
}
|
|
||||||
#if defined(HAVE_QTBINDINGS)
|
|
||||||
build_options.push_back (tl::to_string (tr ("Qt bindings for scripts")));
|
|
||||||
#endif
|
|
||||||
#if defined(HAVE_64BIT_COORD)
|
|
||||||
build_options.push_back (tl::to_string (tr ("Wide coordinates (64 bit)")));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string s;
|
|
||||||
|
|
||||||
s = "<html><body>";
|
|
||||||
|
|
||||||
s += "<h1>";
|
|
||||||
s += escape_xml (std::string (lay::Version::name ()) + " " + lay::Version::version ());
|
|
||||||
s += "</h1>";
|
|
||||||
|
|
||||||
std::vector<std::string> about_paras = tl::split (lay::Version::about_text (), "\n\n");
|
|
||||||
for (std::vector<std::string>::const_iterator p = about_paras.begin (); p != about_paras.end (); ++p) {
|
|
||||||
s += std::string ("<p>") + escape_xml (*p) + "</p>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! build_options.empty ()) {
|
|
||||||
s += "<p>";
|
|
||||||
s += "<h4>";
|
|
||||||
s += escape_xml (tl::to_string (QObject::tr ("Build options:")));
|
|
||||||
s += "</h4><ul>";
|
|
||||||
for (std::vector<std::string>::const_iterator bo = build_options.begin (); bo != build_options.end (); ++bo) {
|
|
||||||
s += "<li>";
|
|
||||||
s += escape_xml (*bo);
|
|
||||||
s += "</li>";
|
|
||||||
}
|
|
||||||
s += "</ul>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! lay::plugins ().empty () || ! db::plugins ().empty ()) {
|
|
||||||
|
|
||||||
s += "<p>";
|
|
||||||
s += "<h4>";
|
|
||||||
s += escape_xml (tl::to_string (QObject::tr ("Binary extensions:")));
|
|
||||||
s += "</h4><ul>";
|
|
||||||
|
|
||||||
for (std::list<lay::PluginDescriptor>::const_iterator pd = lay::plugins ().begin (); pd != lay::plugins ().end (); ++pd) {
|
|
||||||
s += "<li>";
|
|
||||||
if (! pd->description.empty ()) {
|
|
||||||
s += escape_xml (pd->description);
|
|
||||||
} else {
|
|
||||||
s += escape_xml (pd->path);
|
|
||||||
}
|
|
||||||
if (! pd->version.empty ()) {
|
|
||||||
s += " (" + escape_xml (pd->version) + ")";
|
|
||||||
}
|
|
||||||
s += "</li>";
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::list<db::PluginDescriptor>::const_iterator pd = db::plugins ().begin (); pd != db::plugins ().end (); ++pd) {
|
|
||||||
s += "<li>";
|
|
||||||
if (! pd->description.empty ()) {
|
|
||||||
s += escape_xml (pd->description);
|
|
||||||
} else {
|
|
||||||
s += escape_xml (pd->path);
|
|
||||||
}
|
|
||||||
if (! pd->version.empty ()) {
|
|
||||||
s += " (" + escape_xml (pd->version) + ")";
|
|
||||||
}
|
|
||||||
s += "</li>";
|
|
||||||
}
|
|
||||||
|
|
||||||
s += "</ul>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
s += "</body></html>";
|
|
||||||
|
|
||||||
std::string t = tl::to_string (QObject::tr ("About ")) + lay::Version::name ();
|
|
||||||
|
|
||||||
setWindowTitle (tl::to_qstring (t));
|
|
||||||
|
|
||||||
mp_ui->main->setWordWrap (true);
|
|
||||||
mp_ui->main->setText (tl::to_qstring (s));
|
|
||||||
}
|
|
||||||
|
|
||||||
HelpAboutDialog::~HelpAboutDialog ()
|
|
||||||
{
|
|
||||||
delete mp_ui;
|
|
||||||
mp_ui = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
// Declaration of the "plugin" for the menu entries
|
// Declaration of the "plugin" for the menu entries
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef HDR_layMainWindow
|
#ifndef HDR_layMainWindow
|
||||||
#define HDR_layMainWindow
|
#define HDR_layMainWindow
|
||||||
|
|
||||||
|
|
@ -46,6 +44,7 @@
|
||||||
#include "layProgress.h"
|
#include "layProgress.h"
|
||||||
#include "layTextProgress.h"
|
#include "layTextProgress.h"
|
||||||
#include "layTechnology.h"
|
#include "layTechnology.h"
|
||||||
|
#include "layTextProgressDelegate.h"
|
||||||
#include "tlException.h"
|
#include "tlException.h"
|
||||||
#include "tlDeferredExecution.h"
|
#include "tlDeferredExecution.h"
|
||||||
#include "tlObjectCollection.h"
|
#include "tlObjectCollection.h"
|
||||||
|
|
@ -61,10 +60,6 @@ class QStackedWidget;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QAction;
|
class QAction;
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class HelpAboutDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace lay {
|
namespace lay {
|
||||||
|
|
||||||
class SettingsForm;
|
class SettingsForm;
|
||||||
|
|
@ -84,38 +79,19 @@ class Navigator;
|
||||||
class LayerToolbox;
|
class LayerToolbox;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class HelpDialog;
|
class HelpDialog;
|
||||||
|
class HelpAboutDialog;
|
||||||
|
class ControlWidgetStack;
|
||||||
|
class ViewWidgetStack;
|
||||||
|
class ProgressWidget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A dialog for showing the "help about" dialog
|
* @brief A big main window class
|
||||||
|
*
|
||||||
|
* The main window is the core UI feature of the application.
|
||||||
|
* The main window is view container, basic controller, configuration root
|
||||||
|
* and holder of many resources.
|
||||||
|
* The main window is a singleton.
|
||||||
*/
|
*/
|
||||||
class LAY_PUBLIC HelpAboutDialog
|
|
||||||
: public QDialog
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
HelpAboutDialog (QWidget *parent);
|
|
||||||
~HelpAboutDialog ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::HelpAboutDialog *mp_ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
class TextProgressDelegate
|
|
||||||
: public lay::TextProgress
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TextProgressDelegate (MainWindow *mw, int verbosity);
|
|
||||||
|
|
||||||
virtual void update_progress (tl::Progress *progress);
|
|
||||||
virtual void show_progress_bar (bool show);
|
|
||||||
virtual bool progress_wants_widget () const;
|
|
||||||
virtual void progress_add_widget (QWidget *widget);
|
|
||||||
virtual QWidget *progress_get_widget () const;
|
|
||||||
virtual void progress_remove_widget ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
MainWindow *mp_mw;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LAY_PUBLIC MainWindow
|
class LAY_PUBLIC MainWindow
|
||||||
: public QMainWindow,
|
: public QMainWindow,
|
||||||
public lay::Dispatcher
|
public lay::Dispatcher
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layProgressDialog.h"
|
||||||
|
#include "layProgressWidget.h"
|
||||||
|
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
ProgressDialog::ProgressDialog (QWidget *parent, ProgressReporter *pr)
|
||||||
|
: QDialog (parent), mp_pr (pr)
|
||||||
|
{
|
||||||
|
QVBoxLayout *vbl = new QVBoxLayout (this);
|
||||||
|
vbl->setMargin (0);
|
||||||
|
vbl->setSpacing (0);
|
||||||
|
|
||||||
|
mp_progress_widget = new ProgressWidget (pr, this, true);
|
||||||
|
mp_progress_widget->setObjectName (QString::fromUtf8 ("progress"));
|
||||||
|
vbl->addWidget (mp_progress_widget);
|
||||||
|
|
||||||
|
setWindowTitle (QObject::tr ("Progress"));
|
||||||
|
setWindowModality (Qt::WindowModal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressDialog::closeEvent (QCloseEvent *)
|
||||||
|
{
|
||||||
|
if (mp_pr) {
|
||||||
|
// NOTE: We don't kill on close for now. This creates a too easy way to scrap results.
|
||||||
|
// mp_pr->signal_break ();
|
||||||
|
// TODO: there should be a warning saying some jobs are pending.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressDialog::set_progress (tl::Progress *progress)
|
||||||
|
{
|
||||||
|
mp_progress_widget->set_progress (progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressDialog::add_widget (QWidget *widget)
|
||||||
|
{
|
||||||
|
mp_progress_widget->add_widget (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProgressDialog::remove_widget ()
|
||||||
|
{
|
||||||
|
mp_progress_widget->remove_widget ();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *ProgressDialog::get_widget () const
|
||||||
|
{
|
||||||
|
return mp_progress_widget->get_widget ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layProgressDialog
|
||||||
|
#define HDR_layProgressDialog
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
#include "tlObject.h"
|
||||||
|
#include "tlProgress.h"
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
class ProgressReporter;
|
||||||
|
class ProgressWidget;
|
||||||
|
|
||||||
|
class ProgressDialog
|
||||||
|
: public QDialog,
|
||||||
|
public tl::Object
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProgressDialog (QWidget *parent, lay::ProgressReporter *pr);
|
||||||
|
|
||||||
|
void closeEvent (QCloseEvent * /*event*/);
|
||||||
|
|
||||||
|
void set_progress (tl::Progress *progress);
|
||||||
|
void add_widget (QWidget *widget);
|
||||||
|
void remove_widget ();
|
||||||
|
QWidget *get_widget () const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
lay::ProgressWidget *mp_progress_widget;
|
||||||
|
lay::ProgressReporter *mp_pr;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layTextProgressDelegate.h"
|
||||||
|
#include "layMainWindow.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
TextProgressDelegate::TextProgressDelegate (MainWindow *mw, int verbosity)
|
||||||
|
: lay::TextProgress (verbosity), mp_mw (mw)
|
||||||
|
{
|
||||||
|
// .. nothing yet ..
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextProgressDelegate::update_progress (tl::Progress *progress)
|
||||||
|
{
|
||||||
|
if (!mp_mw->update_progress (progress)) {
|
||||||
|
lay::TextProgress::update_progress (progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextProgressDelegate::show_progress_bar (bool show)
|
||||||
|
{
|
||||||
|
if (!mp_mw->show_progress_bar (show)) {
|
||||||
|
lay::TextProgress::show_progress_bar (show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TextProgressDelegate::progress_wants_widget () const
|
||||||
|
{
|
||||||
|
return mp_mw != 0 && mp_mw->progress_wants_widget ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextProgressDelegate::progress_add_widget (QWidget *widget)
|
||||||
|
{
|
||||||
|
if (mp_mw) {
|
||||||
|
mp_mw->progress_add_widget (widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *TextProgressDelegate::progress_get_widget () const
|
||||||
|
{
|
||||||
|
return mp_mw ? mp_mw->progress_get_widget () : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextProgressDelegate::progress_remove_widget ()
|
||||||
|
{
|
||||||
|
if (mp_mw) {
|
||||||
|
mp_mw->progress_remove_widget ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layTextProgressDelegate
|
||||||
|
#define HDR_layTextProgressDelegate
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
#include "layTextProgress.h"
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
class MainWindow;
|
||||||
|
|
||||||
|
class TextProgressDelegate
|
||||||
|
: public lay::TextProgress
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TextProgressDelegate (MainWindow *mw, int verbosity);
|
||||||
|
|
||||||
|
virtual void update_progress (tl::Progress *progress);
|
||||||
|
virtual void show_progress_bar (bool show);
|
||||||
|
virtual bool progress_wants_widget () const;
|
||||||
|
virtual void progress_add_widget (QWidget *widget);
|
||||||
|
virtual QWidget *progress_get_widget () const;
|
||||||
|
virtual void progress_remove_widget ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWindow *mp_mw;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,103 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "layViewWidgetStack.h"
|
||||||
|
#include "layLayoutView.h"
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
ViewWidgetStack::ViewWidgetStack (QWidget *parent, const char *name)
|
||||||
|
: QWidget (parent)
|
||||||
|
{
|
||||||
|
setObjectName (QString::fromUtf8 (name));
|
||||||
|
|
||||||
|
mp_bglabel = new QLabel (this);
|
||||||
|
mp_bglabel->setAutoFillBackground (true);
|
||||||
|
mp_bglabel->setText (QObject::tr ("<html><body><p><img src=\":/logo.png\"/></p><p>Use File/Open to open a layout</p></body></html>"));
|
||||||
|
mp_bglabel->setAlignment (Qt::AlignVCenter | Qt::AlignHCenter);
|
||||||
|
mp_bglabel->show ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewWidgetStack::add_widget (LayoutView *w)
|
||||||
|
{
|
||||||
|
m_widgets.push_back (w);
|
||||||
|
w->setParent (this);
|
||||||
|
resize_children ();
|
||||||
|
raise_widget (m_widgets.size () - 1);
|
||||||
|
|
||||||
|
updateGeometry ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewWidgetStack::remove_widget (size_t index)
|
||||||
|
{
|
||||||
|
if (index < m_widgets.size ()) {
|
||||||
|
m_widgets.erase (m_widgets.begin () + index);
|
||||||
|
}
|
||||||
|
if (m_widgets.size () == 0) {
|
||||||
|
mp_bglabel->show ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewWidgetStack::raise_widget (size_t index)
|
||||||
|
{
|
||||||
|
if (index < m_widgets.size ()) {
|
||||||
|
mp_bglabel->hide ();
|
||||||
|
m_widgets [index]->show ();
|
||||||
|
} else {
|
||||||
|
mp_bglabel->show ();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
for (std::vector <LayoutView *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child, ++i) {
|
||||||
|
if (i != index) {
|
||||||
|
(*child)->hide ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LayoutView *ViewWidgetStack::widget (size_t index)
|
||||||
|
{
|
||||||
|
if (index < m_widgets.size ()) {
|
||||||
|
return m_widgets [index];
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *ViewWidgetStack::background_widget ()
|
||||||
|
{
|
||||||
|
return mp_bglabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewWidgetStack::resize_children ()
|
||||||
|
{
|
||||||
|
// set the geometry of all children
|
||||||
|
for (std::vector <LayoutView *>::iterator child = m_widgets.begin (); child != m_widgets.end (); ++child) {
|
||||||
|
(*child)->setGeometry (0, 0, width (), height ());
|
||||||
|
}
|
||||||
|
mp_bglabel->setGeometry (0, 0, width (), height ());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
KLayout Layout Viewer
|
||||||
|
Copyright (C) 2006-2020 Matthias Koefferlein
|
||||||
|
|
||||||
|
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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HDR_layViewWidgetStack
|
||||||
|
#define HDR_layViewWidgetStack
|
||||||
|
|
||||||
|
#include "layCommon.h"
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
|
namespace lay
|
||||||
|
{
|
||||||
|
|
||||||
|
class LayoutView;
|
||||||
|
|
||||||
|
class ViewWidgetStack
|
||||||
|
: public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ViewWidgetStack (QWidget *parent = 0, const char *name = 0);
|
||||||
|
|
||||||
|
void add_widget (LayoutView *w);
|
||||||
|
void remove_widget (size_t index);
|
||||||
|
void raise_widget (size_t index);
|
||||||
|
LayoutView *widget (size_t index);
|
||||||
|
QWidget *background_widget ();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void resizeEvent (QResizeEvent *)
|
||||||
|
{
|
||||||
|
resize_children ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void resize_children ();
|
||||||
|
|
||||||
|
std::vector <LayoutView *> m_widgets;
|
||||||
|
QLabel *mp_bglabel;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue