Preferences: Remove Customize Workbenches dialog.
This commit is contained in:
@@ -331,7 +331,6 @@ SET(Gui_UIC_SRCS
|
||||
DlgSettingsPythonConsole.ui
|
||||
DlgCheckableMessageBox.ui
|
||||
DlgToolbars.ui
|
||||
DlgWorkbenches.ui
|
||||
DlgTreeWidget.ui
|
||||
DlgLocationAngle.ui
|
||||
DlgLocationPos.ui
|
||||
@@ -526,7 +525,6 @@ SET(Dialog_Customize_CPP_SRCS
|
||||
DlgCustomizeSpNavSettings.cpp
|
||||
DlgKeyboardImp.cpp
|
||||
DlgToolbarsImp.cpp
|
||||
DlgWorkbenchesImp.cpp
|
||||
QListWidgetCustom.cpp
|
||||
QListWidgetDragBugFix.cpp
|
||||
)
|
||||
@@ -538,7 +536,6 @@ SET(Dialog_Customize_HPP_SRCS
|
||||
DlgCustomizeSpNavSettings.h
|
||||
DlgKeyboardImp.h
|
||||
DlgToolbarsImp.h
|
||||
DlgWorkbenchesImp.h
|
||||
QListWidgetCustom.h
|
||||
QListWidgetDragBugFix.h
|
||||
)
|
||||
@@ -551,7 +548,6 @@ SET(Dialog_Customize_SRCS
|
||||
DlgCustomizeSpNavSettings.ui
|
||||
DlgKeyboard.ui
|
||||
DlgToolbars.ui
|
||||
DlgWorkbenches.ui
|
||||
)
|
||||
SOURCE_GROUP("Dialog\\Customize" FILES ${Dialog_Customize_SRCS})
|
||||
|
||||
|
||||
@@ -1,289 +0,0 @@
|
||||
<?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="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="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="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><html><head/><body><p><span style=" font-weight:600;">Move the selected workbench to enabled workbenches.</span></p></body></html></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="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><html><head/><body><p><span style=" font-weight:600;">Move the selected item up.</span></p><p>The item will be moved up.</p></body></html></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="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><html><head/><body><p><span style=" font-weight:600;">Remove the selected workbench from enabled workbenches</span></p></body></html></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>
|
||||
<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><p>Sort enabled workbenches</p></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="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><html><head/><body><p><span style=" font-weight:600;">Remove the selected workbench from enabled workbenches</span></p></body></html></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="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><html><head/><body><p><span style=" font-weight:600;">Move the selected item down.</span></p><p>The item will be moved down</p></body></html></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="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="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="10" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:8pt; font-weight:600;">Note:</span><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt;"> The changes become active the next time you start the application</span></p></body></html></string>
|
||||
</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>
|
||||
@@ -1,273 +0,0 @@
|
||||
/***************************************************************************
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
// Based on DlgToolbars.cpp
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QDebug>
|
||||
# include <QInputDialog>
|
||||
#endif
|
||||
|
||||
#include "DlgWorkbenchesImp.h"
|
||||
#include "ui_DlgWorkbenches.h"
|
||||
#include "Application.h"
|
||||
#include "QListWidgetCustom.h"
|
||||
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
|
||||
const QString DlgWorkbenchesImp::all_workbenches = QString::fromLatin1("ALL");
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::DlgWorkbenchesImp */
|
||||
|
||||
DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgWorkbenches)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
set_lw_properties(ui->lw_enabled_workbenches);
|
||||
set_lw_properties(ui->lw_disabled_workbenches);
|
||||
ui->lw_disabled_workbenches->setProperty("OnlyAcceptFrom",
|
||||
QStringList() << ui->lw_enabled_workbenches->objectName());
|
||||
ui->lw_disabled_workbenches->setSortingEnabled(true);
|
||||
|
||||
ui->lw_enabled_workbenches->setProperty("OnlyAcceptFrom",
|
||||
QStringList() << ui->lw_enabled_workbenches->objectName()
|
||||
<< ui->lw_disabled_workbenches->objectName());
|
||||
|
||||
QStringList enabled_wbs_list = load_enabled_workbenches();
|
||||
QStringList disabled_wbs_list = load_disabled_workbenches();
|
||||
QStringList workbenches = Application::Instance->workbenches();
|
||||
|
||||
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) {
|
||||
if (workbenches.contains(*it)) {
|
||||
add_workbench(ui->lw_enabled_workbenches, *it);
|
||||
} else {
|
||||
qDebug() << "Ignoring unknown" << *it << "workbench found in user preferences.";
|
||||
}
|
||||
}
|
||||
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
|
||||
if (disabled_wbs_list.contains(*it)){
|
||||
add_workbench(ui->lw_disabled_workbenches, *it);
|
||||
} else if (!enabled_wbs_list.contains(*it)){
|
||||
qDebug() << "Adding unknown " << *it << "workbench.";
|
||||
add_workbench(ui->lw_enabled_workbenches, *it);
|
||||
}
|
||||
}
|
||||
ui->lw_enabled_workbenches->setCurrentRow(0);
|
||||
ui->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, const QString& it)
|
||||
{
|
||||
QPixmap px = Application::Instance->workbenchIcon(it);
|
||||
QString mt = Application::Instance->workbenchMenuText(it);
|
||||
auto 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) {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::hideEvent(QHideEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
save_workbenches();
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::onAddMacroAction(const QByteArray& macro)
|
||||
{
|
||||
Q_UNUSED(macro);
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
{
|
||||
Q_UNUSED(macro);
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::onModifyMacroAction(const QByteArray& macro)
|
||||
{
|
||||
Q_UNUSED(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 = ui->lw_disabled_workbenches->currentItem();
|
||||
if (ci) {
|
||||
move_workbench(ui->lw_enabled_workbenches, ci);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::on_remove_from_enabled_workbenches_btn_clicked()
|
||||
{
|
||||
QListWidgetItem* ci = ui->lw_enabled_workbenches->currentItem();
|
||||
if (ci) {
|
||||
move_workbench(ui->lw_disabled_workbenches, ci);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::shift_workbench(bool up)
|
||||
{
|
||||
int direction;
|
||||
if (up){
|
||||
direction = -1;
|
||||
} else {
|
||||
direction = 1;
|
||||
}
|
||||
if (ui->lw_enabled_workbenches->currentItem()) {
|
||||
int index = ui->lw_enabled_workbenches->currentRow();
|
||||
QListWidgetItem *item = ui->lw_enabled_workbenches->takeItem(index);
|
||||
ui->lw_enabled_workbenches->insertItem(index + direction, item);
|
||||
ui->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()
|
||||
{
|
||||
ui->lw_enabled_workbenches->sortItems();
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::on_add_all_to_enabled_workbenches_btn_clicked()
|
||||
{
|
||||
while (ui->lw_disabled_workbenches->count() > 0) {
|
||||
QListWidgetItem* item = ui->lw_disabled_workbenches->item(0);
|
||||
move_workbench(ui->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());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
enabled_wbs_list = enabled_wbs.split(QLatin1String(","), Qt::SkipEmptyParts);
|
||||
#else
|
||||
enabled_wbs_list = enabled_wbs.split(QLatin1String(","), QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
QStringList DlgWorkbenchesImp::load_disabled_workbenches()
|
||||
{
|
||||
QString disabled_wbs;
|
||||
QStringList disabled_wbs_list;
|
||||
ParameterGrp::handle hGrp;
|
||||
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches");
|
||||
disabled_wbs = QString::fromStdString(hGrp->GetASCII("Disabled", ""));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|
||||
disabled_wbs_list = disabled_wbs.split(QLatin1String(","), Qt::SkipEmptyParts);
|
||||
#else
|
||||
disabled_wbs_list = disabled_wbs.split(QLatin1String(","), QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
return disabled_wbs_list;
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::save_workbenches()
|
||||
{
|
||||
QString enabled_wbs;
|
||||
QString disabled_wbs;
|
||||
ParameterGrp::handle hGrp;
|
||||
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches");
|
||||
hGrp->Clear();
|
||||
|
||||
if (ui->lw_enabled_workbenches->count() == 0) {
|
||||
enabled_wbs.append(QString::fromLatin1("NoneWorkbench"));
|
||||
} else {
|
||||
for (int i = 0; i < ui->lw_enabled_workbenches->count(); i++) {
|
||||
QVariant item_data = ui->lw_enabled_workbenches->item(i)->data(Qt::UserRole);
|
||||
QString name = item_data.toString();
|
||||
enabled_wbs.append(name + QString::fromLatin1(","));
|
||||
}
|
||||
}
|
||||
hGrp->SetASCII("Enabled", enabled_wbs.toLatin1());
|
||||
|
||||
for (int i = 0; i < ui->lw_disabled_workbenches->count(); i++) {
|
||||
QVariant item_data = ui->lw_disabled_workbenches->item(i)->data(Qt::UserRole);
|
||||
QString name = item_data.toString();
|
||||
disabled_wbs.append(name + QString::fromLatin1(","));
|
||||
}
|
||||
hGrp->SetASCII("Disabled", disabled_wbs.toLatin1());
|
||||
}
|
||||
|
||||
#include "moc_DlgWorkbenchesImp.cpp"
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2015 FreeCAD Developers *
|
||||
* Author: Przemo Firszt <przemo@firszt.eu> *
|
||||
* *
|
||||
* 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 *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
// Based on DlgToolbars.h file
|
||||
|
||||
|
||||
#ifndef GUI_DIALOG_DLGWORKBENCHES_IMP_H
|
||||
#define GUI_DIALOG_DLGWORKBENCHES_IMP_H
|
||||
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QListWidgetCustom;
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgWorkbenches;
|
||||
|
||||
class DlgWorkbenchesImp : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgWorkbenchesImp(QWidget* parent = nullptr);
|
||||
~DlgWorkbenchesImp() override;
|
||||
static QStringList load_enabled_workbenches();
|
||||
static QStringList load_disabled_workbenches();
|
||||
static const QString all_workbenches;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e) override;
|
||||
void hideEvent(QHideEvent * event) override;
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onAddMacroAction(const QByteArray&) override;
|
||||
void onRemoveMacroAction(const QByteArray&) override;
|
||||
void onModifyMacroAction(const QByteArray&) override;
|
||||
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, const QString& it);
|
||||
void move_workbench(QListWidgetCustom *lwc_dest,
|
||||
QListWidgetItem *wi);
|
||||
void save_workbenches();
|
||||
void shift_workbench(bool up);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgWorkbenches> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
} // namespace Gui
|
||||
|
||||
#endif // GUI_DIALOG_DLGWORKBENCHES_IMP_H
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "DlgSettingsLazyLoadedImp.h"
|
||||
|
||||
#include "DlgToolbarsImp.h"
|
||||
#include "DlgWorkbenchesImp.h"
|
||||
#include "DlgActionsImp.h"
|
||||
#include "DlgCommandsImp.h"
|
||||
#include "DlgKeyboardImp.h"
|
||||
@@ -87,7 +86,6 @@ WidgetFactorySupplier::WidgetFactorySupplier()
|
||||
//
|
||||
new CustomPageProducer<DlgCustomCommandsImp>;
|
||||
new CustomPageProducer<DlgCustomKeyboardImp>;
|
||||
new CustomPageProducer<DlgWorkbenchesImp>;
|
||||
new CustomPageProducer<DlgCustomToolbarsImp>;
|
||||
new CustomPageProducer<DlgCustomActionsImp>;
|
||||
new CustomPageProducer<DlgCustomizeSpNavSettings>;
|
||||
|
||||
Reference in New Issue
Block a user