Commit 188c24bd authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Made toolbox layout sleeker.

parent 7cb87d6e
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
color-rendering="auto"
color-interpolation="auto"
text-rendering="auto"
stroke-miterlimit="10"
shape-rendering="auto"
font-weight="normal"
font-style="normal"
font-size="12"
image-rendering="auto"
id="svg4333"
version="1.1"
inkscape:version="0.48.5 r10040"
width="128"
height="128"
sodipodi:docname="preferences.svg"
style="font-size:12px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;font-family:Dialog"
inkscape:export-filename="/local/ebke/git/vanilla/OpenFlipper/Icons/preferences.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<metadata
id="metadata4344">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1396"
id="namedview4342"
showgrid="false"
inkscape:zoom="3.5881183"
inkscape:cx="36.800067"
inkscape:cy="83.098073"
inkscape:window-x="-4"
inkscape:window-y="398"
inkscape:window-maximized="1"
inkscape:current-layer="svg4333" />
<!--Unicode Character 'GEAR' (U+2699)-->
<defs
id="genericDefs" />
<g
id="g4336"
transform="matrix(0.59756432,0,0,0.59765077,-13.141789,-75.303997)"
style="fill:#000000;fill-opacity:1;stroke:none">
<g
id="g4338"
style="fill:#000000;fill-opacity:1;stroke:none">
<path
d="m 129.0938,126 q 6.1874,0 12.2343,0.7031 L 144.9844,153 q 9.4218,1.8281 18.4218,6.0469 l 17.7188,-18.5625 q 10.6875,6.3281 19.6875,15.3281 L 189,177.75 q 6.6094,7.0312 11.25,15.4688 l 23.2031,-4.3594 q 5.2031,11.8125 7.4531,24.75 l -20.8124,9.7031 q 0.5624,4.9219 0.5624,9.7031 0,4.7813 -0.5624,9.7032 l 20.8124,9.8437 q -2.25,12.7969 -7.4531,24.6094 L 200.25,272.8125 Q 195.6094,281.25 189,288.4219 l 11.8125,21.7969 q -9,9 -19.6875,15.4687 L 163.4062,307.125 q -9,4.0781 -18.4218,6.0469 l -3.6563,26.1562 q -6.0469,0.8438 -12.2343,0.8438 -6.1876,0 -12.2344,-0.8438 l -3.6563,-26.1562 q -9.4219,-1.9688 -18.4219,-6.0469 L 77.0625,325.6875 Q 66.375,319.2188 57.375,310.2188 l 11.8125,-21.7969 q -6.6094,-7.0313 -11.25,-15.6094 l -23.2031,4.3594 q -5.2032,-11.8125 -7.4532,-24.6094 l 20.8126,-9.8437 q -0.5626,-4.9219 -0.5626,-9.7032 0,-4.7812 0.5626,-9.7031 l -20.8126,-9.7031 q 2.25,-12.9375 7.4532,-24.75 l 23.2031,4.3594 q 4.6406,-8.4376 11.25,-15.6094 L 57.375,155.8125 q 9,-9 19.6875,-15.3281 l 17.7187,18.4218 q 9,-4.0781 18.4219,-5.9062 l 3.6563,-26.2969 Q 122.9062,126 129.0938,126 z m 0,45.1406 q -25.5938,0 -43.7344,18.211 -18.1406,18.2109 -18.1406,43.7343 0,25.5235 18.1406,43.6641 18.1406,18.1406 43.7344,18.1406 25.5937,0 43.7343,-18.1406 18.1407,-18.1406 18.1407,-43.6641 0,-25.5234 -18.1407,-43.7343 -18.1406,-18.211 -43.7343,-18.211 z m 21.7968,61.875 q 0,9 -6.3984,15.3985 -6.3984,6.3984 -15.3984,6.3984 -9,0 -15.3985,-6.3984 -6.3984,-6.3985 -6.3984,-15.3985 0,-9 6.3984,-15.3984 6.3985,-6.3984 15.3985,-6.3984 9,0 15.3984,6.3984 6.3984,6.3984 6.3984,15.3984 z"
id="path4340"
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:1;stroke:none" />
</g>
</g>
</svg>
......@@ -131,7 +131,6 @@ QToolBar * PickMode::toolbar() const {
/** \brief Constructor for the Core Widget
*
*/
......@@ -154,6 +153,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
pickToolBarExternal_(0),
cursorPainter_(0),
sceneGraphDialog_(0),
viewModeChangePopupAction_(0),
modeChangeWidget(0),
fileMenu_(0),
viewMenu_(0),
toolsMenu_(0),
......@@ -545,22 +546,50 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
toolBoxArea_ = new QWidget (toolSplitter_);
viewModeControlBox_ = new QGroupBox (tr("ViewMode"));
viewModeControlBox_ = new QWidget();
QHBoxLayout *hLayout = new QHBoxLayout;
vmChangeButton_ = new QPushButton(tr("Change View Mode"));
QPushButton* vmEditButton = new QPushButton(tr("Edit View Modes"));
hLayout->addWidget(vmChangeButton_);
hLayout->addWidget(vmEditButton);
//vmChangeButton_ = new QPushButton(tr("Change View Mode"));
//QPushButton* vmEditButton = new QPushButton(tr("Edit View Modes"));
/*
* Set up view mode popup button.
*/
viewModePopupBtn_ = new QToolButton();
viewModePopupBtn_->setAutoRaise(true);
//viewModePopupBtn->setText(QString::fromUtf8("⚙"));
viewModePopupBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"preferences.png"));
viewModePopupBtn_->setIconSize(QSize(16, 16));
viewModePopupBtn_->setPopupMode(QToolButton::InstantPopup);
//init widget
modeChangeWidget = new viewModeChangeWidget(viewModes_, this);
modeChangeWidget->setWindowIcon(OpenFlipper::Options::OpenFlipperIcon());
connect(modeChangeWidget,
SIGNAL(changeView(QString, QStringList, QStringList, QStringList)),
this,
SLOT(slotChangeView(QString, QStringList, QStringList, QStringList)));
viewModeChangePopupAction_ = new QWidgetAction(viewModePopupBtn_);
viewModeChangePopupAction_->setDefaultWidget(modeChangeWidget);
viewModePopupBtn_->addAction(viewModeChangePopupAction_);
hLayout->setContentsMargins(0, 0, 0, 0);
hLayout->addStretch(1);
hLayout->addWidget(viewModePopupBtn_);
viewModeControlBox_->setLayout (hLayout);
connect(vmChangeButton_, SIGNAL(clicked()), this, SLOT(slotViewChangeDialog()));
connect(vmEditButton, SIGNAL(clicked()), this, SLOT(slotViewModeDialog()));
connect(modeChangeWidget->editViewModes_pb, SIGNAL(clicked()),
this, SLOT(slotViewModeDialog()));
connect(modeChangeWidget, SIGNAL(wantClose()),
this, SLOT(closeChangeViewModePopup()));
toolBoxScroll_ = new QScrollArea ();
toolBox_ = new SideArea ();
toolBoxScroll_->setContentsMargins(0, 0, 0, 0);
toolBoxScroll_->setWidget (toolBox_);
toolBoxScroll_->setWidgetResizable (true);
toolBoxScroll_->setFrameStyle (QFrame::StyledPanel);
......@@ -568,6 +597,8 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->addWidget(viewModeControlBox_);
vLayout->addWidget(toolBoxScroll_);
vLayout->setContentsMargins(0, 0, 0, 0);
vLayout->setSpacing(0);
if ( OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() ) {
viewModeControlBox_->hide();
......
......@@ -115,6 +115,8 @@
#include <OpenFlipper/INIFile/INIFile.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include "../viewModeWidget/viewModeChangeWidget.hh"
/** \brief ViewMode struct
* This struct contains a ViewMode and its status information such as used widgets,toolbars or context menus
*
......@@ -635,8 +637,8 @@ public:
/// Show a dialog in which the viewMode can be edited
void slotViewModeDialog();
/// Show a dialog in which the viewMode can be changed
void slotViewChangeDialog();
/// Closes the change view mode popup.
void closeChangeViewModePopup();
/// update the content of the specified examiner
void slotUpdateExaminer(unsigned _id);
......@@ -670,7 +672,7 @@ public:
QSplitter* splitter_;
/// Group box containing Task Switcher Controls
QGroupBox *viewModeControlBox_;
QWidget *viewModeControlBox_;
/// Textedit at the bottom for log messages
LoggerWidget* logWidget_;
......@@ -714,8 +716,8 @@ public:
/// Widget for toolBox
QWidget* toolBoxArea_;
/// Button to change viewModes
QPushButton* vmChangeButton_;
/// view mode gear icon at the upper left of the tool box
QToolButton *viewModePopupBtn_;
/// Spliter between toplevel objects and toolbox
QSplitter* toolSplitter_;
......@@ -743,6 +745,10 @@ public:
// widget showing the scenegraph
ACG::QtWidgets::QtSceneGraphDialog* sceneGraphDialog_;
QWidgetAction *viewModeChangePopupAction_;
viewModeChangeWidget* modeChangeWidget;
/** @} */
private slots:
......
......@@ -68,6 +68,7 @@ SideArea::SideArea (QWidget *_parent) :
QVBoxLayout *l = new QVBoxLayout;
l->addLayout (layout_);
l->addStretch(1);
l->setContentsMargins(2, 2, 2, 2);
setLayout (l);
}
......
......@@ -76,6 +76,7 @@ SideElement::SideElement (SideArea *_parent, QWidget *_w, QString _name, QIcon*
font.setBold (false);
QHBoxLayout *hl = new QHBoxLayout;
hl->setContentsMargins(0, 0, 0, 0);
SideElement::TopArea *tra = new SideElement::TopArea (this);
......@@ -123,7 +124,7 @@ SideElement::SideElement (SideArea *_parent, QWidget *_w, QString _name, QIcon*
mainLayout_->addWidget (tra);
mainLayout_->addWidget (_w);
mainLayout_->setSpacing (0);
mainLayout_->setContentsMargins (1,1,1,1);
mainLayout_->setContentsMargins(0, 0, 0, 0);
setLayout (mainLayout_);
_w->hide ();
......
......@@ -337,24 +337,10 @@ void CoreWidget::slotViewModeDialog(){
widget->show( OpenFlipper::Options::currentViewMode() );
}
void CoreWidget::slotViewChangeDialog() {
//init widget
static viewModeChangeWidget* modeChangeWidget = 0;
if ( !modeChangeWidget ){
modeChangeWidget = new viewModeChangeWidget(viewModes_, this);
modeChangeWidget->setWindowIcon( OpenFlipper::Options::OpenFlipperIcon() );
connect(modeChangeWidget, SIGNAL(changeView(QString, QStringList, QStringList, QStringList)), this, SLOT(slotChangeView(QString, QStringList, QStringList, QStringList)) );
}
// Make it look like a dialog
modeChangeWidget->setWindowFlags(Qt::Popup);
modeChangeWidget->show( OpenFlipper::Options::currentViewMode() );
// Move it to the position of the push button
QPoint posButton = vmChangeButton_->mapToGlobal(vmChangeButton_->pos());
modeChangeWidget->move( posButton);
void CoreWidget::closeChangeViewModePopup() {
QWidget *parent = qobject_cast<QWidget*>(modeChangeWidget->parent());
if (parent)
parent->close();
}
/// Slot for Changing visible toolWidgets
......
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ViewModeChangeDialog</class>
<widget class="QDialog" name="ViewModeChangeDialog">
<widget class="QWidget" name="ViewModeChangeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>389</width>
<height>341</height>
<width>480</width>
<height>480</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>480</width>
<height>480</height>
</size>
</property>
<property name="windowTitle">
<string>Choose View Mode</string>
</property>
......@@ -28,46 +34,13 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>380</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="iconSize">
<size>
<width>100</width>
<height>100</height>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="movement">
......@@ -93,6 +66,30 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="editViewModes_pb">
<property name="text">
<string>Edit View Modes</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
......
......@@ -55,15 +55,12 @@
/// Constructor
viewModeChangeWidget::viewModeChangeWidget(const QVector< ViewMode* >& _modes, QWidget *_parent)
: QDialog(_parent),
: QWidget(_parent, Qt::Window | Qt::CustomizeWindowHint),
modes_(_modes)
{
setupUi(this);
connect(viewModeList, SIGNAL(clicked (QModelIndex)), this, SLOT(slotModeClicked(QModelIndex)) );
}
// =======================================================================================================
......@@ -87,17 +84,24 @@ void viewModeChangeWidget::slotModeClicked(QModelIndex /*_idx*/ ){
return;
}
emit changeView(modes_[id]->name,modes_[id]->visibleToolboxes,modes_[id]->visibleToolbars,modes_[id]->visibleContextMenus);
close();
emit wantClose();
}
void viewModeChangeWidget::slot_update(){
update(OpenFlipper::Options::currentViewMode());
};
void viewModeChangeWidget::showEvent(QShowEvent *event) {
slot_update();
QWidget::showEvent(event);
//QMenu *parentMenu = qobject_cast<QMenu*>(parent());
}
/// overloaded show function
void viewModeChangeWidget::show(QString _lastMode){
QDialog::show();
//fill viewModeList
void viewModeChangeWidget::update(QString _lastMode){
//fill viewModeList
viewModeList->clear();
for (int i=0; i < modes_.size(); i++){
QListWidgetItem *item = new QListWidgetItem(viewModeList);
......
......@@ -56,10 +56,11 @@
#include "ui_viewModeChange.hh"
#include <QStringList>
#include <QVector>
#include <QWidgetAction>
struct ViewMode;
class viewModeChangeWidget : public QDialog, public Ui::ViewModeChangeDialog
class viewModeChangeWidget : public QWidget, public Ui::ViewModeChangeDialog
{
Q_OBJECT
private:
......@@ -68,8 +69,17 @@ class viewModeChangeWidget : public QDialog, public Ui::ViewModeChangeDialog
public:
viewModeChangeWidget(const QVector< ViewMode* >& _modes, QWidget *parent = 0 );
void show(QString _lastMode);
void update(QString _lastMode);
public slots:
void slot_update();
signals:
void wantClose();
protected:
void showEvent(QShowEvent *event);
private slots:
void slotModeClicked(QModelIndex _id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment