toolbar splitted into two

master
shaina7837 2014-09-14 20:14:14 +02:00 committed by Torsten Paul
parent efb23fc9bd
commit 3f37cf8c50
34 changed files with 145 additions and 42 deletions

BIN
images/Open-32(1).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/Open-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/Rotation-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/Save-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/Shape-Cube-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/blackNew.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/blackRender.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/blackUp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

BIN
images/blackUp1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

BIN
images/blackUp2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

BIN
images/blackUp4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

BIN
images/blackUp5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

BIN
images/blackaxes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
images/blackback.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/blackbottom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/blackbottom1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/blackfront.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/blackleft (copy).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/blackleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/blackright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/blackright1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/rightright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
images/zoomin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

BIN
images/zoomout.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 B

View File

@ -307,7 +307,8 @@ src/FontCache.h \
\
src/AutoUpdater.h \
src/legacyeditor.h \
src/toolbar.h
src/toolbar.h \
src/editortoolbar.h
SOURCES += src/version_check.cc \
src/ProgressWidget.cc \
@ -395,7 +396,8 @@ SOURCES += src/version_check.cc \
src/mainwin.cc \
src/FontListDialog.cc \
src/legacyeditor.cc \
src/toolbar.cpp
src/toolbar.cpp \
src/editortoolbar.cpp
# ClipperLib
SOURCES += src/polyclipping/clipper.cpp

View File

@ -22,5 +22,24 @@
<file>images/up.png</file>
<file>images/bottom.png</file>
<file>images/left.png</file>
<file>images/blackUp.png</file>
<file>images/blackNew.png</file>
<file>images/blackRender.png</file>
<file>images/Rotation-32.png</file>
<file>images/Shape-Cube-32.png</file>
<file>images/Open-32.png</file>
<file>images/Open-32(1).png</file>
<file>images/Save-32.png</file>
<file>images/blackbottom.png</file>
<file>images/blackleft (copy).png</file>
<file>images/blackright (copy).png</file>
<file>images/blackright.png</file>
<file>images/blackright1.png</file>
<file>images/rightright.png</file>
<file>images/blackfront.png</file>
<file>images/blackback.png</file>
<file>images/blackaxes.png</file>
<file>images/zoomin.png</file>
<file>images/zoomout.png</file>
</qresource>
</RCC>

View File

@ -8,6 +8,7 @@
#include "Tree.h"
#include "memory.h"
#include "editor.h"
#include "editortoolbar.h"
#include "toolbar.h"
#include <vector>
#include <QMutex>
@ -111,6 +112,7 @@ private:
void setDockWidgetTitle(QDockWidget *dockWidget, QString prefix, bool topLevel);
EditorInterface *editor;
EditorToolBar *editortoolbar;
ToolBar *toolBar;
class QMessageBox *openglbox;

30
src/editortoolbar.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "editortoolbar.h"
EditorToolBar::EditorToolBar(QWidget *parent) :
QToolBar(parent)
{
int defaultColor = this->palette().background().color().lightness();
buttonNew = new QToolButton;
buttonOpen = new QToolButton;
buttonSave = new QToolButton;
buttonZoomIn = new QToolButton;
buttonZoomOut = new QToolButton;
if(defaultColor > 165)
{
buttonNew->setIcon(QIcon("://images/blackNew.png"));
buttonOpen->setIcon(QIcon("://images/Open-32(1).png"));
buttonSave->setIcon(QIcon("://images/Save-32.png"));
} else {
buttonNew->setIcon(QIcon("://images/Document-New-128.png"));
buttonOpen->setIcon(QIcon("://images/Open-128.png"));
buttonSave->setIcon(QIcon("://images/Save-128.png"));
}
this->addWidget(buttonNew);
this->addWidget(buttonOpen);
this->addWidget(buttonSave);
}

21
src/editortoolbar.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef EDITORTOOLBAR_H
#define EDITORTOOLBAR_H
#include <QToolBar>
#include <QToolButton>
class EditorToolBar : public QToolBar
{
Q_OBJECT
public:
explicit EditorToolBar(QWidget *parent = 0);
QToolButton *buttonNew, *buttonOpen, *buttonSave;
QToolButton *buttonZoomIn, *buttonZoomOut;
signals:
public slots:
};
#endif // EDITORTOOLBAR_H

View File

@ -23,6 +23,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <iostream>
#include "GeometryCache.h"
#include "ModuleCache.h"
#include "MainWindow.h"
@ -173,6 +174,7 @@ MainWindow::MainWindow(const QString &filename)
editortype = Preferences::inst()->getValue("editor/editortype").toString();
useScintilla = (editortype == "QScintilla Editor");
#ifdef USE_SCINTILLA_EDITOR
if (useScintilla) {
editor = new ScintillaEditor(editorDockContents);
@ -183,6 +185,9 @@ MainWindow::MainWindow(const QString &filename)
editorDockContents->layout()->addWidget(editor);
editortoolbar = new EditorToolBar(this);
editorDockContents->layout()->addWidget(editortoolbar);
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
@ -398,7 +403,7 @@ MainWindow::MainWindow(const QString &filename)
connect(this->helpActionHomepage, SIGNAL(triggered()), this, SLOT(helpHomepage()));
connect(this->helpActionManual, SIGNAL(triggered()), this, SLOT(helpManual()));
connect(this->helpActionLibraryInfo, SIGNAL(triggered()), this, SLOT(helpLibrary()));
connect(this->helpActionFontInfo, SIGNAL(triggered()), this, SLOT(helpFontInfo()));
connect(this->helpActionFontInfo, SIGNAL(triggered()), this, SLOT(viewModeShowAxes()));
setCurrentOutput();
@ -446,24 +451,32 @@ MainWindow::MainWindow(const QString &filename)
connect(this->replaceAllButton, SIGNAL(clicked()), this, SLOT(replaceAll()));
connect(this->replaceInputField, SIGNAL(returnPressed()), this->replaceButton, SLOT(animateClick()));
//EditorToolbar
connect(editortoolbar->buttonNew, SIGNAL(clicked()), this, SLOT(actionNew()));
connect(editortoolbar->buttonOpen, SIGNAL(clicked()), this, SLOT(actionOpen()));
connect(editortoolbar->buttonSave, SIGNAL(clicked()), this, SLOT(actionSave()));
//Toolbar
toolBar = new ToolBar(this);
verticalLayout_2->addWidget(toolBar);
connect(toolBar->buttonNew, SIGNAL(clicked()), this, SLOT(actionNew()));
connect(toolBar->buttonOpen, SIGNAL(clicked()), this, SLOT(actionOpen()));
connect(toolBar->buttonSave, SIGNAL(clicked()), this, SLOT(actionSave()));
toolBar = new ToolBar(this);
verticalLayout_2->addWidget(toolBar);
connect(toolBar->buttonRender, SIGNAL(clicked()), this, SLOT(actionRender()));
connect(toolBar->buttonTop, SIGNAL(clicked()), this, SLOT(viewAngleTop()));
connect(toolBar->buttonBottom, SIGNAL(clicked()), this, SLOT(viewAngleBottom()));
connect(toolBar->buttonLeft, SIGNAL(clicked()), this, SLOT(viewAngleLeft()));
connect(toolBar->buttonRight, SIGNAL(clicked()), this, SLOT(viewAngleRight()));
connect(toolBar->buttonFront, SIGNAL(clicked()), this, SLOT(viewAngleFront()));
connect(toolBar->buttonBack, SIGNAL(clicked()), this, SLOT(viewAngleBack()));
toolBar->setStyleSheet("QToolBar{background-color:black;}"
"QToolButton:hover{background-color:green;}");
connect(toolBar->buttonBack, SIGNAL(clicked()), this, SLOT(viewModeShowAxes()));
connect(toolBar->buttonAxes, SIGNAL(triggered()), this, SLOT(viewModeShowAxes()));
connect(toolBar->buttonEdges, SIGNAL(clicked()), this, SLOT(viewModeShowEdges()));
connect(toolBar->buttonZoomIn, SIGNAL(clicked()), qglview, SLOT(ZoomIn()));
connect(toolBar->buttonZoomOut, SIGNAL(clicked()), qglview, SLOT(ZoomOut()));
toolBar->setStyleSheet("QToolBar{border:1 solid black;}" );
// "QToolButton:hover{background-color:green;}");
//std::cout<< toolBar->palette().background().color().name().toStdString()<<std::endl;
//std::cout<< toolBar->palette().background().color().lightness()<<std::endl;
// make sure it looks nice..
QSettings settings;
QByteArray windowState = settings.value("window/state", QByteArray()).toByteArray();
@ -529,6 +542,8 @@ void MainWindow::loadViewSettings(){
hideConsole();
editActionHide->setChecked(settings.value("view/hideEditor").toBool());
hideEditor();
toolBarActionHide->setChecked(settings.value("view/hideToolbar").toBool());
hideToolbar();
updateMdiMode(settings.value("advanced/mdi").toBool());
updateUndockMode(settings.value("advanced/undockableWindows").toBool());
}
@ -2222,8 +2237,10 @@ void MainWindow::hideToolbar()
{
if(toolBarActionHide->isChecked()){
toolBar->hide();
editortoolbar->hide();
} else {
toolBar->show();
editortoolbar->show();
}
}

View File

@ -3,39 +3,47 @@
ToolBar::ToolBar(QWidget *parent) :
QToolBar(parent)
{
buttonNew = new QToolButton;
buttonNew->setIcon(QIcon("://images/Document-New-128.png"));
buttonOpen = new QToolButton;
buttonOpen->setIcon(QIcon("://images/Open-128.png"));
buttonSave = new QToolButton;
buttonSave->setIcon(QIcon("://images/Save-128.png"));
int defaultColor = this->palette().background().color().lightness();
buttonRender = new QToolButton;
buttonRender->setIcon(QIcon("://images/Arrowhead-Right-32.png"));
buttonTop = new QToolButton;
buttonTop->setIcon(QIcon("://images/up.png"));
buttonBottom = new QToolButton;
buttonBottom->setIcon(QIcon("://images/bottom.png"));
buttonLeft = new QToolButton;
buttonLeft->setIcon(QIcon("://images/left.png"));
buttonRight = new QToolButton;
buttonRight->setIcon(QIcon("://images/right.png"));
buttonFront = new QToolButton;
buttonFront->setIcon(QIcon("://images/front.png"));
buttonBack = new QToolButton;
buttonBack->setIcon(QIcon("://images/back.png"));
buttonAxes = new QAction(this);
buttonEdges = new QToolButton;
buttonZoomIn = new QToolButton;
buttonZoomOut = new QToolButton;
if(defaultColor > 165)
{
buttonRender->setIcon(QIcon("://images/blackRender.png"));
buttonTop->setIcon(QIcon("://images/blackUp.png"));
buttonBottom->setIcon(QIcon("://images/blackbottom.png"));
buttonLeft->setIcon(QIcon("://images/blackleft (copy).png"));
buttonRight->setIcon(QIcon("://images/rightright.png"));
buttonFront->setIcon(QIcon("://images/blackfront.png"));
buttonBack->setIcon(QIcon("://images/blackback.png"));
buttonAxes->setIcon(QIcon("://images/blackaxes.png"));
buttonEdges->setIcon(QIcon("://images/Rotation-32.png"));
buttonZoomIn->setIcon(QIcon("://images/zoomin.png"));
buttonZoomOut->setIcon(QIcon("://images/zoomout.png"));
} else {
buttonRender->setIcon(QIcon("://images/Arrowhead-Right-32.png"));
buttonTop->setIcon(QIcon("://images/up.png"));
buttonBottom->setIcon(QIcon("://images/bottom.png"));
buttonLeft->setIcon(QIcon("://images/left.png"));
buttonRight->setIcon(QIcon("://images/right.png"));
buttonFront->setIcon(QIcon("://images/front.png"));
buttonBack->setIcon(QIcon("://images/back.png"));
buttonAxes->setIcon(QIcon("://images/axes.png"));
buttonEdges->setIcon(QIcon("://images/grid.png"));
}
this->addWidget(buttonNew);
this->addWidget(buttonOpen);
this->addWidget(buttonSave);
this->addWidget(buttonRender);
this->addSeparator();
this->addWidget(buttonTop);
@ -44,5 +52,8 @@ ToolBar::ToolBar(QWidget *parent) :
this->addWidget(buttonRight);
this->addWidget(buttonFront);
this->addWidget(buttonBack);
this->addAction(buttonAxes);
this->addWidget(buttonEdges);
this->addWidget(buttonZoomIn);
this->addWidget(buttonZoomOut);
}

View File

@ -3,15 +3,16 @@
#include <QToolBar>
#include <QToolButton>
#include <QAction>
class ToolBar : public QToolBar
{
Q_OBJECT
public:
explicit ToolBar(QWidget *parent = 0);
QToolButton *buttonNew, *buttonOpen, *buttonSave, *buttonRender;
QToolButton *buttonZoomIn, *buttonZoomOut, *buttonRender;
QToolButton *buttonTop, *buttonBottom, *buttonLeft, *buttonRight;
QToolButton *buttonFront, *buttonBack;
QToolButton *buttonFront, *buttonBack, *buttonEdges;
QAction *buttonAxes;
signals:
public slots: