mirror of https://github.com/vitalif/openscad
Merge branch 'master' of github.com:openscad/openscad
commit
5d28e86e95
|
@ -307,6 +307,7 @@ src/FontCache.h \
|
|||
src/system-gl.h \
|
||||
src/CsgInfo.h \
|
||||
\
|
||||
src/Dock.h \
|
||||
src/AutoUpdater.h \
|
||||
src/launchingscreen.h \
|
||||
src/legacyeditor.h \
|
||||
|
@ -397,6 +398,7 @@ SOURCES += src/version_check.cc \
|
|||
src/openscad.cc \
|
||||
src/mainwin.cc \
|
||||
src/UIUtils.cc \
|
||||
src/Dock.cc \
|
||||
src/FontListDialog.cc \
|
||||
src/launchingscreen.cc \
|
||||
src/legacyeditor.cc \
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
#include <iostream>
|
||||
#include <QSettings>
|
||||
|
||||
#include "Dock.h"
|
||||
|
||||
Dock::Dock(QWidget *parent) : QDockWidget(parent), action(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
Dock::~Dock()
|
||||
{
|
||||
}
|
||||
|
||||
void Dock::setVisible(bool visible)
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue(configKey, !visible);
|
||||
if (action != NULL) {
|
||||
action->setChecked(!visible);
|
||||
}
|
||||
QDockWidget::setVisible(visible);
|
||||
}
|
||||
|
||||
void Dock::setConfigKey(const QString configKey)
|
||||
{
|
||||
this->configKey = configKey;
|
||||
}
|
||||
|
||||
void Dock::setAction(QAction *action)
|
||||
{
|
||||
this->action = action;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QAction>
|
||||
#include <QDockWidget>
|
||||
|
||||
class Dock : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Dock(QWidget *parent = NULL);
|
||||
virtual ~Dock();
|
||||
void setConfigKey(const QString configKey);
|
||||
void setAction(QAction *action);
|
||||
|
||||
public slots:
|
||||
void setVisible(bool visible);
|
||||
|
||||
private:
|
||||
QString configKey;
|
||||
QAction *action;
|
||||
};
|
|
@ -239,7 +239,6 @@ private:
|
|||
|
||||
char const * afterCompileSlot;
|
||||
bool procevents;
|
||||
bool isClosing;
|
||||
class QTemporaryFile *tempFile;
|
||||
class ProgressWidget *progresswidget;
|
||||
class CGALWorker *cgalworker;
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1397</width>
|
||||
<height>33</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
|
@ -287,7 +289,7 @@
|
|||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="editorDock">
|
||||
<widget class="Dock" name="editorDock">
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
|
@ -410,7 +412,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="consoleDock">
|
||||
<widget class="Dock" name="consoleDock">
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>8</number>
|
||||
</attribute>
|
||||
|
@ -1092,6 +1094,12 @@
|
|||
<header>QGLView.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Dock</class>
|
||||
<extends>QDockWidget</extends>
|
||||
<header>Dock.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../openscad.qrc"/>
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
#include <QTemporaryFile>
|
||||
#include <QDockWidget>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
@ -225,7 +226,6 @@ MainWindow::MainWindow(const QString &filename)
|
|||
tval = 0;
|
||||
fps = 0;
|
||||
fsteps = 1;
|
||||
isClosing = false;
|
||||
|
||||
const QString importStatement = "import(\"%1\");\n";
|
||||
const QString surfaceStatement = "surface(\"%1\");\n";
|
||||
|
@ -530,8 +530,30 @@ MainWindow::MainWindow(const QString &filename)
|
|||
* fill the available space.
|
||||
*/
|
||||
editor->setInitialSizeHint(QSize((5 * this->width() / 11), 100));
|
||||
} else {
|
||||
#ifdef Q_OS_WIN
|
||||
// Try moving the main window into the display range, this
|
||||
// can occur when closing OpenSCAD on a second monitor which
|
||||
// is not available at the time the application is started
|
||||
// again.
|
||||
// On Windows that causes the main window to open in a not
|
||||
// easily reachable place.
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
QRect desktopRect = desktop->frameGeometry().adjusted(250, 150, -250, -150).normalized();
|
||||
QRect windowRect = frameGeometry();
|
||||
if (!desktopRect.intersects(windowRect)) {
|
||||
windowRect.moveCenter(desktopRect.center());
|
||||
windowRect = windowRect.intersected(desktopRect);
|
||||
move(windowRect.topLeft());
|
||||
resize(windowRect.size());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
this->editorDock->setConfigKey("view/hideEditor");
|
||||
this->editorDock->setAction(this->viewActionHideEditor);
|
||||
this->consoleDock->setConfigKey("view/hideConsole");
|
||||
this->consoleDock->setAction(this->viewActionHideConsole);
|
||||
connect(this->editorDock, SIGNAL(topLevelChanged(bool)), this, SLOT(editorTopLevelChanged(bool)));
|
||||
connect(this->consoleDock, SIGNAL(topLevelChanged(bool)), this, SLOT(consoleTopLevelChanged(bool)));
|
||||
|
||||
|
@ -2265,25 +2287,13 @@ void MainWindow::viewAll()
|
|||
this->qglview->updateGL();
|
||||
}
|
||||
|
||||
void MainWindow::on_editorDock_visibilityChanged(bool visible)
|
||||
void MainWindow::on_editorDock_visibilityChanged(bool)
|
||||
{
|
||||
if (isClosing) {
|
||||
return;
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("view/hideEditor", !visible);
|
||||
viewActionHideEditor->setChecked(!visible);
|
||||
editorTopLevelChanged(editorDock->isFloating());
|
||||
}
|
||||
|
||||
void MainWindow::on_consoleDock_visibilityChanged(bool visible)
|
||||
void MainWindow::on_consoleDock_visibilityChanged(bool)
|
||||
{
|
||||
if (isClosing) {
|
||||
return;
|
||||
}
|
||||
QSettings settings;
|
||||
settings.setValue("view/hideConsole", !visible);
|
||||
viewActionHideConsole->setChecked(!visible);
|
||||
consoleTopLevelChanged(consoleDock->isFloating());
|
||||
}
|
||||
|
||||
|
@ -2453,7 +2463,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
|||
delete this->tempFile;
|
||||
this->tempFile = NULL;
|
||||
}
|
||||
isClosing = true;
|
||||
event->accept();
|
||||
} else {
|
||||
event->ignore();
|
||||
|
|
Loading…
Reference in New Issue