App: Add dialog to pick preferred workbenches

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt 2015-05-07 22:22:23 +01:00 committed by wmayer
parent b507505a47
commit 4c383527f8
12 changed files with 1199 additions and 16 deletions

View File

@ -40,6 +40,7 @@
#include "Application.h"
#include "Command.h"
#include "DlgUndoRedo.h"
#include "DlgWorkbenchesImp.h"
#include "FileDialog.h"
#include "MainWindow.h"
#include "WhatsThis.h"
@ -519,26 +520,22 @@ void WorkbenchGroup::refreshWorkbenchList()
{
QString active = QString::fromAscii(WorkbenchManager::instance()->active()->name().c_str());
QStringList items = Application::Instance->workbenches();
QStringList enabled_wbs_list = DlgWorkbenchesImp::load_enabled_workbenches();
QList<QAction*> workbenches = _group->actions();
int numWorkbenches = std::min<int>(workbenches.count(), items.count());
// sort by workbench menu text
QMap<QString, QString> menuText;
for (int index = 0; index < numWorkbenches; index++) {
QString text = Application::Instance->workbenchMenuText(items[index]);
menuText[text] = items[index];
}
int i=0;
for (QMap<QString, QString>::Iterator it = menuText.begin(); it != menuText.end(); ++it, i++) {
QPixmap px = Application::Instance->workbenchIcon(it.value());
QString tip = Application::Instance->workbenchToolTip(it.value());
workbenches[i]->setObjectName(it.value());
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it, i++) {
QString s = *it;
QString name = Application::Instance->workbenchMenuText(*it);
QPixmap px = Application::Instance->workbenchIcon(*it);
QString tip = Application::Instance->workbenchToolTip(*it);
workbenches[i]->setObjectName(*it);
workbenches[i]->setIcon(px);
workbenches[i]->setText(it.key());
workbenches[i]->setText(name);
workbenches[i]->setToolTip(tip);
workbenches[i]->setStatusTip(tr("Select the '%1' workbench").arg(it.key()));
workbenches[i]->setStatusTip(tr("Select the '%1' workbench").arg(name));
workbenches[i]->setVisible(false);
workbenches[i]->setVisible(true);
// Note: See remark at WorkbenchComboBox::onWorkbenchActivated
// Calling setChecked() here causes to uncheck the current item

View File

@ -193,6 +193,7 @@ set(Gui_MOC_HDRS
DlgSettingsUnitsImp.h
DlgTipOfTheDayImp.h
DlgToolbarsImp.h
DlgWorkbenchesImp.h
TaskDlgRelocation.h
DlgUndoRedo.h
DockWindow.h
@ -219,6 +220,7 @@ set(Gui_MOC_HDRS
PythonDebugger.h
PythonEditor.h
QuantitySpinBox.h
QListWidgetCustom.h
ReportView.h
SceneInspector.h
SelectionView.h
@ -287,6 +289,7 @@ SET(Gui_UIC_SRCS
DlgSettingsMacro.ui
DlgTipOfTheDay.ui
DlgToolbars.ui
DlgWorkbenches.ui
DlgTreeWidget.ui
DlgLocationAngle.ui
DlgLocationPos.ui
@ -435,6 +438,8 @@ SET(Dialog_Customize_CPP_SRCS
DlgCustomizeSpNavSettings.cpp
DlgKeyboardImp.cpp
DlgToolbarsImp.cpp
DlgWorkbenchesImp.cpp
QListWidgetCustom.cpp
)
SET(Dialog_Customize_HPP_SRCS
DlgActionsImp.h
@ -444,6 +449,8 @@ SET(Dialog_Customize_HPP_SRCS
DlgCustomizeSpNavSettings.h
DlgKeyboardImp.h
DlgToolbarsImp.h
DlgWorkbenchesImp.h
QListWidgetCustom.h
)
SET(Dialog_Customize_SRCS
${Dialog_Customize_CPP_SRCS}
@ -454,6 +461,7 @@ SET(Dialog_Customize_SRCS
DlgCustomizeSpNavSettings.ui
DlgKeyboard.ui
DlgToolbars.ui
DlgWorkbenches.ui
)
SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})

View File

@ -25,6 +25,7 @@
#ifndef _PreComp_
# include <QEvent>
# include <QGridLayout>
# include <QSizePolicy>
# include <QPushButton>
#endif
@ -49,7 +50,8 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WFlags fl)
: QDialog(parent, fl)
{
setModal(false);
resize( 434, 365 );
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
resize( 690, 365 );
setWindowTitle(tr("Customize"));
setSizeGripEnabled( true );

289
src/Gui/DlgWorkbenches.ui Normal file
View File

@ -0,0 +1,289 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Gui::Dialog::DlgWorkbenches</class>
<widget class="QWidget" name="Gui::Dialog::DlgWorkbenches">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>421</width>
<height>354</height>
</rect>
</property>
<property name="windowTitle">
<string>Workbenches</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="2" rowspan="8">
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lb_enabled">
<property name="text">
<string>Enabled workbenches</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidgetCustom" name="lw_enabled_workbenches"/>
</item>
</layout>
</item>
<item row="6" column="3" rowspan="4">
<spacer name="sp_right">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>33</width>
<height>57</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" rowspan="8">
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lb_disabled">
<property name="text">
<string>Disabled workbenches</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidgetCustom" name="lw_disabled_workbenches"/>
</item>
</layout>
</item>
<item row="6" column="1" rowspan="4">
<spacer name="sp_left">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>33</width>
<height>57</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="shift_workbench_down_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Move down</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Move the selected item down.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The item will be moved down&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_down.svg</normaloff>:/icons/button_down.svg</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="remove_from_enabled_workbenches_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Move left</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Remove the selected workbench from enabled workbenches&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_left.svg</normaloff>:/icons/button_left.svg</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="add_to_enabled_workbenches_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Move right</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Move the selected workbench to enabled workbenches.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_right.svg</normaloff>:/icons/button_right.svg</iconset>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QPushButton" name="sort_enabled_workbenches_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Sort enabled workbenches</string>
</property>
<property name="whatsThis">
<string>&lt;b&gt;Sort enabled workbenches&lt;/p&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_sort.svg</normaloff>:/icons/button_sort.svg</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="shift_workbench_up_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Move up</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Move the selected item up.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The item will be moved up.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_up.svg</normaloff>:/icons/button_up.svg</iconset>
</property>
</widget>
</item>
<item row="10" column="0" colspan="4">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:600;&quot;&gt;Note:&lt;/span&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt; The changes become active the next time you start FreeCAD&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="add_all_to_enabled_workbenches_btn">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>30</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Add all to enabled workbenches</string>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Remove the selected workbench from enabled workbenches&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="Icons/resource.qrc">
<normaloff>:/icons/button_add_all.svg</normaloff>:/icons/button_add_all.svg</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QListWidgetCustom</class>
<extends>QListWidget</extends>
<header>QListWidgetCustom.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Icons/resource.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,234 @@
/***************************************************************************
* Copyright (c) 2015 FreeCAD Developers *
* Author: Przemo Firszt <przemo@firszt.eu> *
* Based on DlgToolbars.cpp file *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QInputDialog>
#endif
#include "DlgWorkbenchesImp.h"
#include "Application.h"
#include "BitmapFactory.h"
#include "Command.h"
#include "MainWindow.h"
#include "Widgets.h"
#include "Workbench.h"
#include "WorkbenchManager.h"
#include "QListWidgetCustom.h"
using namespace Gui::Dialog;
const QString DlgWorkbenchesImp::all_workbenches = QString::fromAscii("ALL");
/* TRANSLATOR Gui::Dialog::DlgWorkbenches */
DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
: CustomizeActionPage(parent)
{
this->setupUi(this);
set_lw_properties(lw_enabled_workbenches);
set_lw_properties(lw_disabled_workbenches);
const QString lw_disabled_name = QString::fromAscii("disabled workbenches");
lw_disabled_workbenches->setAccessibleName(lw_disabled_name);
lw_disabled_workbenches->setSortingEnabled(true);
QStringList enabled_wbs_list = load_enabled_workbenches();
QStringList workbenches = Application::Instance->workbenches();
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) {
if (workbenches.contains(*it)){
QString wb = *it;
add_workbench(lw_enabled_workbenches, wb);
} else {
qDebug("Ignoring unknown " + it->toLatin1() + " workbench found in user preferences.");
}
}
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
if (!enabled_wbs_list.contains(*it)){
QString wb = *it;
add_workbench(lw_disabled_workbenches, wb);
}
}
lw_enabled_workbenches->setCurrentRow(0);
lw_disabled_workbenches->setCurrentRow(0);
}
/** Destroys the object and frees any allocated resources */
DlgWorkbenchesImp::~DlgWorkbenchesImp()
{
}
void DlgWorkbenchesImp::set_lw_properties(QListWidgetCustom *lw)
{
lw->setDragDropMode(QAbstractItemView::DragDrop);
lw->setSelectionMode(QAbstractItemView::SingleSelection);
lw->viewport()->setAcceptDrops(true);
lw->setDropIndicatorShown(true);
lw->setDragEnabled(true);
lw->setDefaultDropAction(Qt::MoveAction);
}
void DlgWorkbenchesImp::add_workbench(QListWidgetCustom *lw, QString it)
{
QPixmap px = Application::Instance->workbenchIcon(it);
QString mt = Application::Instance->workbenchMenuText(it);
QListWidgetItem *wi = (new QListWidgetItem(QIcon(px), mt));
wi->setData(Qt::UserRole, QVariant(it));
lw->addItem(wi);
}
void DlgWorkbenchesImp::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
retranslateUi(this);
}
else {
QWidget::changeEvent(e);
}
}
void DlgWorkbenchesImp::hideEvent(QHideEvent * event)
{
save_enabled_workbenches();
}
void DlgWorkbenchesImp::onAddMacroAction(const QByteArray& macro)
{
}
void DlgWorkbenchesImp::onRemoveMacroAction(const QByteArray& macro)
{
}
void DlgWorkbenchesImp::onModifyMacroAction(const QByteArray& macro)
{
}
void DlgWorkbenchesImp::move_workbench(QListWidgetCustom *lwc_dest,
QListWidgetItem *wi)
{
QListWidgetItem* item = wi->clone();
lwc_dest->addItem(item);
lwc_dest->setCurrentItem(item);
delete wi;
}
void DlgWorkbenchesImp::on_add_to_enabled_workbenches_btn_clicked()
{
QListWidgetItem* ci = lw_disabled_workbenches->currentItem();
if (ci) {
move_workbench(lw_enabled_workbenches, ci);
}
}
void DlgWorkbenchesImp::on_remove_from_enabled_workbenches_btn_clicked()
{
QListWidgetItem* ci = lw_enabled_workbenches->currentItem();
if (ci) {
move_workbench(lw_disabled_workbenches, ci);
}
}
void DlgWorkbenchesImp::shift_workbench(bool up)
{
int direction;
if (up){
direction = -1;
} else {
direction = 1;
}
if (lw_enabled_workbenches->currentItem()) {
int index = lw_enabled_workbenches->currentRow();
QListWidgetItem *item = lw_enabled_workbenches->takeItem(index);
lw_enabled_workbenches->insertItem(index + direction, item);
lw_enabled_workbenches->setCurrentRow(index + direction);
}
}
void DlgWorkbenchesImp::on_shift_workbench_up_btn_clicked()
{
shift_workbench(true);
}
void DlgWorkbenchesImp::on_shift_workbench_down_btn_clicked()
{
shift_workbench(false);
}
void DlgWorkbenchesImp::on_sort_enabled_workbenches_btn_clicked()
{
lw_enabled_workbenches->sortItems();
}
void DlgWorkbenchesImp::on_add_all_to_enabled_workbenches_btn_clicked()
{
while (lw_disabled_workbenches->count() > 0) {
QListWidgetItem* item = lw_disabled_workbenches->item(0);
move_workbench(lw_enabled_workbenches, item);
}
}
QStringList DlgWorkbenchesImp::load_enabled_workbenches()
{
QString enabled_wbs;
QStringList enabled_wbs_list;
ParameterGrp::handle hGrp;
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches");
enabled_wbs = QString::fromStdString(hGrp->GetASCII("Enabled", all_workbenches.toStdString().c_str()).c_str());
enabled_wbs_list = enabled_wbs.split(QLatin1String(","), QString::SkipEmptyParts);
if (enabled_wbs_list.at(0) == all_workbenches) {
enabled_wbs_list.removeFirst();
QStringList workbenches = Application::Instance->workbenches();
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
enabled_wbs_list.append(*it);
}
enabled_wbs_list.sort();
}
return enabled_wbs_list;
}
void DlgWorkbenchesImp::save_enabled_workbenches()
{
QString enabled_wbs;
ParameterGrp::handle hGrp;
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches");
hGrp->Clear();
if (lw_enabled_workbenches->count() == 0) {
enabled_wbs.append(QString::fromAscii("NoneWorkbench"));
} else {
for (int i = 0; i < lw_enabled_workbenches->count(); i++) {
QVariant item_data = lw_enabled_workbenches->item(i)->data(Qt::UserRole);
QString name = item_data.toString();
enabled_wbs.append(name + QString::fromAscii(","));
}
}
hGrp->SetASCII("Enabled", enabled_wbs.toAscii());
}
#include "moc_DlgWorkbenchesImp.cpp"

View File

@ -0,0 +1,70 @@
/***************************************************************************
* Copyright (c) 2015 FreeCAD Developers *
* Author: Przemo Firszt <przemo@firszt.eu> *
* Based on DlgToolbars.h file *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_DIALOG_DLGWORKBENCHES_IMP_H
#define GUI_DIALOG_DLGWORKBENCHES_IMP_H
#include "ui_DlgWorkbenches.h"
#include "PropertyPage.h"
namespace Gui {
namespace Dialog {
class DlgWorkbenchesImp : public CustomizeActionPage, public Ui_DlgWorkbenches
{
Q_OBJECT
public:
DlgWorkbenchesImp(QWidget* parent = 0);
~DlgWorkbenchesImp();
static QStringList load_enabled_workbenches();
static const QString all_workbenches;
protected:
void changeEvent(QEvent *e);
void hideEvent(QHideEvent * event);
protected Q_SLOTS:
void onAddMacroAction(const QByteArray&);
void onRemoveMacroAction(const QByteArray&);
void onModifyMacroAction(const QByteArray&);
void on_add_to_enabled_workbenches_btn_clicked();
void on_remove_from_enabled_workbenches_btn_clicked();
void on_shift_workbench_up_btn_clicked();
void on_shift_workbench_down_btn_clicked();
void on_sort_enabled_workbenches_btn_clicked();
void on_add_all_to_enabled_workbenches_btn_clicked();
private:
void set_lw_properties(QListWidgetCustom *lw);
void add_workbench(QListWidgetCustom *lw, QString it);
void move_workbench(QListWidgetCustom *lwc_dest,
QListWidgetItem *wi);
void save_enabled_workbenches();
void shift_workbench(bool up);
};
} // namespace Dialog
} // namespace Gui
#endif // GUI_DIALOG_DLGWORKBENCHES_IMP_H

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg1307"
sodipodi:version="0.32"
inkscape:version="0.91 r13725"
sodipodi:docname="button_add_all.svg"
inkscape:export-filename="/home/lapo/Desktop/Grafica/Icone/media-actions-outlines.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
version="1.0"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs1309">
<linearGradient
id="linearGradient4191">
<stop
style="stop-color:#0040ff;stop-opacity:1;"
offset="0"
id="stop4193" />
<stop
style="stop-color:#0087ff;stop-opacity:0;"
offset="1"
id="stop4195" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4191"
id="linearGradient4197-3"
x1="21.747749"
y1="24.417788"
x2="44.452961"
y2="57.526573"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.00571829,-0.4849747,0.4849747,-0.00571829,31.482529,47.589423)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4191"
id="linearGradient4197-3-4"
x1="21.747749"
y1="24.417788"
x2="44.452961"
y2="57.526573"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.00571829,-0.4849747,0.4849747,-0.00571829,31.482529,15.589423)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.19607843"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.65625"
inkscape:cx="23.061033"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:grid-points="true"
fill="#fcaf3e"
showguides="false"
inkscape:guide-bbox="true"
guidetolerance="1px"
stroke="#729fcf"
inkscape:window-width="1366"
inkscape:window-height="702"
inkscape:window-x="0"
inkscape:window-y="27"
showborder="true"
inkscape:showpageshadow="false"
inkscape:window-maximized="1">
<sodipodi:guide
orientation="horizontal"
position="38.996647"
id="guide2194" />
<sodipodi:guide
orientation="horizontal"
position="9.0140845"
id="guide2196" />
<sodipodi:guide
orientation="vertical"
position="9.0140845"
id="guide2198" />
<sodipodi:guide
orientation="vertical"
position="38.975184"
id="guide2200" />
<sodipodi:guide
orientation="horizontal"
position="22.988281"
id="guide2202" />
<sodipodi:guide
orientation="vertical"
position="23.908786"
id="guide2204" />
<sodipodi:guide
orientation="vertical"
position="157.99417"
id="guide4332" />
<sodipodi:guide
orientation="horizontal"
position="-36.062446"
id="guide4334" />
<sodipodi:guide
orientation="horizontal"
position="-58.02695"
id="guide4336" />
<sodipodi:guide
orientation="vertical"
position="180.00287"
id="guide4338" />
<sodipodi:guide
orientation="vertical"
position="107.92217"
id="guide4417" />
<sodipodi:guide
orientation="vertical"
position="129.93087"
id="guide4419" />
<sodipodi:guide
orientation="horizontal"
position="19.996875"
id="guide5106" />
<sodipodi:guide
orientation="horizontal"
position="63.039674"
id="guide5119" />
<sodipodi:guide
orientation="horizontal"
position="49.066305"
id="guide5121" />
<sodipodi:guide
orientation="horizontal"
position="-86.007168"
id="guide5307" />
<sodipodi:guide
orientation="horizontal"
position="-108.09009"
id="guide5309" />
<sodipodi:guide
orientation="horizontal"
position="-100.15429"
id="guide3111" />
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="0.5px"
spacingy="0.5px"
color="#3f3fff"
empcolor="#3f3fff"
opacity="0.15"
empopacity="0.38"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata1312">
<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:creator>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:creator>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:subject>
<rdf:Bag />
</dc:subject>
<dc:contributor>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:contributor>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
style="display:inline"
inkscape:r_cx="true"
inkscape:r_cy="true"
transform="translate(0,16)">
<path
style="display:inline;fill:url(#linearGradient4197-3);fill-opacity:1;stroke:#0037ff;stroke-width:0.48500836px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 2.6862451,37.196904 -0.0377,-9.62696 45.7631169,-0.420428 0.114781,-9.552952 12.82502,14.024567 -12.864394,14.782306 -0.189295,-9.625172 z"
id="path4181-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<path
style="display:inline;fill:url(#linearGradient4197-3-4);fill-opacity:1;stroke:#0037ff;stroke-width:0.48500836px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 2.6862451,5.1969042 -0.0377,-9.62696 45.7631169,-0.420428 0.114781,-9.5529522 12.82502,14.02456718 L 48.487069,14.403437 48.297774,4.7782652 Z"
id="path4181-5-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64"
height="64"
id="svg1307"
sodipodi:version="0.32"
inkscape:version="0.91 r13725"
sodipodi:docname="button_sort.svg"
inkscape:export-filename="/home/lapo/Desktop/Grafica/Icone/media-actions-outlines.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
version="1.0"
inkscape:r_cx="true"
inkscape:r_cy="true"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs1309">
<linearGradient
id="linearGradient4191">
<stop
style="stop-color:#0040ff;stop-opacity:1;"
offset="0"
id="stop4193" />
<stop
style="stop-color:#0087ff;stop-opacity:0;"
offset="1"
id="stop4195" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4191"
id="linearGradient4197"
x1="21.747749"
y1="24.417788"
x2="44.452961"
y2="57.526573"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.61431881,0.00724338,-0.00724338,-0.61431881,64.21784,23.066338)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4191"
id="linearGradient4197-1"
x1="21.747749"
y1="24.417788"
x2="44.452961"
y2="57.526573"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.61431881,-0.00724338,0.00724338,0.61431881,-0.21783981,8.9336621)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.19607843"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="6.65625"
inkscape:cx="32"
inkscape:cy="32"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:grid-points="true"
fill="#fcaf3e"
showguides="false"
inkscape:guide-bbox="true"
guidetolerance="1px"
stroke="#729fcf"
inkscape:window-width="1366"
inkscape:window-height="702"
inkscape:window-x="0"
inkscape:window-y="27"
showborder="true"
inkscape:showpageshadow="false"
inkscape:window-maximized="1">
<sodipodi:guide
orientation="horizontal"
position="38.996647"
id="guide2194" />
<sodipodi:guide
orientation="horizontal"
position="9.0140845"
id="guide2196" />
<sodipodi:guide
orientation="vertical"
position="9.0140845"
id="guide2198" />
<sodipodi:guide
orientation="vertical"
position="38.975184"
id="guide2200" />
<sodipodi:guide
orientation="horizontal"
position="22.988281"
id="guide2202" />
<sodipodi:guide
orientation="vertical"
position="23.908786"
id="guide2204" />
<sodipodi:guide
orientation="vertical"
position="157.99417"
id="guide4332" />
<sodipodi:guide
orientation="horizontal"
position="-36.062446"
id="guide4334" />
<sodipodi:guide
orientation="horizontal"
position="-58.02695"
id="guide4336" />
<sodipodi:guide
orientation="vertical"
position="180.00287"
id="guide4338" />
<sodipodi:guide
orientation="vertical"
position="107.92217"
id="guide4417" />
<sodipodi:guide
orientation="vertical"
position="129.93087"
id="guide4419" />
<sodipodi:guide
orientation="horizontal"
position="19.996875"
id="guide5106" />
<sodipodi:guide
orientation="horizontal"
position="63.039674"
id="guide5119" />
<sodipodi:guide
orientation="horizontal"
position="49.066305"
id="guide5121" />
<sodipodi:guide
orientation="horizontal"
position="-86.007168"
id="guide5307" />
<sodipodi:guide
orientation="horizontal"
position="-108.09009"
id="guide5309" />
<sodipodi:guide
orientation="horizontal"
position="-100.15429"
id="guide3111" />
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="0.5px"
spacingy="0.5px"
color="#3f3fff"
empcolor="#3f3fff"
opacity="0.15"
empopacity="0.38"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata1312">
<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:creator>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:creator>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
<dc:subject>
<rdf:Bag />
</dc:subject>
<dc:contributor>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:contributor>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<cc:requires
rdf:resource="http://web.resource.org/cc/ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
style="display:inline"
inkscape:r_cx="true"
inkscape:r_cy="true"
transform="translate(0,16)">
<path
style="fill:url(#linearGradient4197);fill-opacity:1;stroke:#0037ff;stroke-width:0.61436146px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M 51.053608,27.762108 38.85911,27.809865 38.326554,1.6221571 26.225802,1.4767642 43.990761,-14.768726 62.715548,1.5266378 50.523316,1.766419 Z"
id="path4181"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
<path
style="display:inline;fill:url(#linearGradient4197-1);fill-opacity:1;stroke:#0037ff;stroke-width:0.61436146px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="M 12.946392,4.2378921 25.14089,4.1901351 25.673446,30.377842 37.774197,30.523235 20.009239,46.768726 1.2844522,30.473362 13.476684,30.233581 Z"
id="path4181-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -15,6 +15,8 @@
<file>button_left.svg</file>
<file>button_right.svg</file>
<file>button_up.svg</file>
<file>button_sort.svg</file>
<file>button_add_all.svg</file>
<file>button_valid.svg</file>
<file>button_invalid.svg</file>
<file>macro-execute.svg</file>

View File

@ -0,0 +1,62 @@
/***************************************************************************
* Copyright (c) 2015 FreeCAD Developers *
* Author: Przemo Firszt <przemo@firszt.eu> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QListWidget>
# include <QDragMoveEvent>
# include <QString>
#endif
#include "QListWidgetCustom.h"
QListWidgetCustom::QListWidgetCustom(QWidget * parent)
: QListWidget(parent)
{
}
QListWidgetCustom::~QListWidgetCustom()
{
}
/* Overriden dragMoveEvent prevents dragging items that originated
* from the same list for "disabled workbenches". Dragging from outside
* is still allowed. Also it blocks dragging from another instance of FreeCAD
*/
void QListWidgetCustom::dragMoveEvent(QDragMoveEvent *e)
{
if (e->source() != 0) {
const QString disabled_wbs = QString::fromAscii("disabled workbenches");
if (e->source()->accessibleName() == disabled_wbs) {
if (e->source() == this) {
e->ignore();
} else {
e->accept();
}
} else {
e->accept();
}
} else {
e->ignore();
}
}

View File

@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (c) 2015 FreeCAD Developers *
* Author: Przemo Firszt <przemo@firszt.eu> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library 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 Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef QLISTWIDGETCUSTOM_HPP
#define QLISTWIDGETCUSTOM_HPP
#include <QListWidget>
#include <QDragMoveEvent>
#include <QString>
class QListWidgetCustom : public QListWidget {
public:
QListWidgetCustom (QWidget *parent);
~QListWidgetCustom ();
protected:
void dragMoveEvent(QDragMoveEvent *e);
};
#endif

View File

@ -41,6 +41,7 @@
#include "DlgReportViewImp.h"
#include "DlgToolbarsImp.h"
#include "DlgWorkbenchesImp.h"
#include "DlgActionsImp.h"
#include "DlgCommandsImp.h"
#include "DlgKeyboardImp.h"
@ -75,6 +76,7 @@ WidgetFactorySupplier::WidgetFactorySupplier()
//
new CustomPageProducer<DlgCustomCommandsImp>;
new CustomPageProducer<DlgCustomKeyboardImp>;
new CustomPageProducer<DlgWorkbenchesImp>;
new CustomPageProducer<DlgCustomToolbarsImp>;
//new CustomPageProducer<DlgCustomToolBoxbarsImp>;
new CustomPageProducer<DlgCustomActionsImp>;