Gui: implementation classes don't inherit from UI classes any more
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
# include <Inventor/events/SoMouseButtonEvent.h>
|
||||
# include <Inventor/nodes/SoOrthographicCamera.h>
|
||||
# include <Inventor/nodes/SoPerspectiveCamera.h>
|
||||
# include <QApplication>
|
||||
# include <QDialog>
|
||||
# include <QFile>
|
||||
# include <QFileInfo>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgActionsImp.h"
|
||||
#include "ui_DlgActions.h"
|
||||
#include "Action.h"
|
||||
#include "Application.h"
|
||||
#include "Command.h"
|
||||
@@ -56,9 +57,11 @@ using namespace Gui::Dialog;
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent )
|
||||
: CustomizeActionPage(parent), bShown( false )
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgCustomActions)
|
||||
, bShown(false)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
// search for all macros
|
||||
std::string cMacroPath = App::GetApplication().
|
||||
GetParameterGroupByPath("User parameter:BaseApp/Preferences/Macro")
|
||||
@@ -66,24 +69,24 @@ DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent )
|
||||
|
||||
QDir d(QString::fromUtf8(cMacroPath.c_str()), QLatin1String("*.FCMacro *.py"));
|
||||
for (unsigned int i=0; i<d.count(); i++ )
|
||||
actionMacros->insertItem(0,d[i],QVariant(false));
|
||||
ui->actionMacros->insertItem(0,d[i],QVariant(false));
|
||||
|
||||
QString systemMacroDirStr = QString::fromUtf8(App::GetApplication().getHomePath()) + QString::fromUtf8("Macro");
|
||||
d = QDir(systemMacroDirStr, QLatin1String("*.FCMacro *.py"));
|
||||
if (d.exists()) {
|
||||
for (unsigned int i=0; i<d.count(); i++ ) {
|
||||
actionMacros->insertItem(0,d[i],QVariant(true));
|
||||
ui->actionMacros->insertItem(0,d[i],QVariant(true));
|
||||
}
|
||||
}
|
||||
|
||||
QStringList labels; labels << tr("Icons") << tr("Macros");
|
||||
actionListWidget->setHeaderLabels(labels);
|
||||
actionListWidget->header()->hide();
|
||||
actionListWidget->setIconSize(QSize(32, 32));
|
||||
ui->actionListWidget->setHeaderLabels(labels);
|
||||
ui->actionListWidget->header()->hide();
|
||||
ui->actionListWidget->setIconSize(QSize(32, 32));
|
||||
#if QT_VERSION >= 0x050000
|
||||
actionListWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->actionListWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
actionListWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->actionListWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
showActions();
|
||||
@@ -101,7 +104,7 @@ DlgCustomActionsImp::~DlgCustomActionsImp()
|
||||
void DlgCustomActionsImp::showEvent(QShowEvent* e)
|
||||
{
|
||||
QWidget::showEvent(e);
|
||||
if (actionMacros->count() == 0 && bShown == false)
|
||||
if (ui->actionMacros->count() == 0 && bShown == false)
|
||||
{
|
||||
bShown = true;
|
||||
QMessageBox::warning(this, tr("No macro"),tr("No macros found."));
|
||||
@@ -164,7 +167,7 @@ void DlgCustomActionsImp::showActions()
|
||||
std::vector<Command*> aclCurMacros = rclMan.getGroupCommands("Macros");
|
||||
for (std::vector<Command*>::iterator it = aclCurMacros.begin(); it != aclCurMacros.end(); ++it)
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(actionListWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
QByteArray actionName = (*it)->getName();
|
||||
item->setData(1, Qt::UserRole, actionName);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
@@ -190,12 +193,12 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite
|
||||
{
|
||||
bool bFound = false;
|
||||
QString scriptName = QString::fromUtf8(pScript->getScriptName());
|
||||
for (int i = 0; i<actionMacros->count(); i++)
|
||||
for (int i = 0; i<ui->actionMacros->count(); i++)
|
||||
{
|
||||
if (actionMacros->itemText(i).startsWith(scriptName, Qt::CaseSensitive))
|
||||
if (ui->actionMacros->itemText(i).startsWith(scriptName, Qt::CaseSensitive))
|
||||
{
|
||||
bFound = true;
|
||||
actionMacros->setCurrentIndex(i);
|
||||
ui->actionMacros->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -207,18 +210,18 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite
|
||||
}
|
||||
|
||||
// fill up labels with the command's data
|
||||
actionWhatsThis -> setText(QString::fromUtf8(pScript->getWhatsThis()));
|
||||
actionMenu -> setText(QString::fromUtf8(pScript->getMenuText()));
|
||||
actionToolTip -> setText(QString::fromUtf8(pScript->getToolTipText()));
|
||||
actionStatus -> setText(QString::fromUtf8(pScript->getStatusTip()));
|
||||
actionAccel -> setText(QString::fromLatin1(pScript->getAccel()));
|
||||
pixmapLabel->clear();
|
||||
ui->actionWhatsThis -> setText(QString::fromUtf8(pScript->getWhatsThis()));
|
||||
ui->actionMenu -> setText(QString::fromUtf8(pScript->getMenuText()));
|
||||
ui->actionToolTip -> setText(QString::fromUtf8(pScript->getToolTipText()));
|
||||
ui->actionStatus -> setText(QString::fromUtf8(pScript->getStatusTip()));
|
||||
ui->actionAccel -> setText(QString::fromLatin1(pScript->getAccel()));
|
||||
ui->pixmapLabel->clear();
|
||||
m_sPixmap = QString::null;
|
||||
const char* name = pScript->getPixmap();
|
||||
if (name && std::strlen(name) > 2)
|
||||
{
|
||||
QPixmap p = Gui::BitmapFactory().pixmap(pScript->getPixmap());
|
||||
pixmapLabel->setPixmap(p);
|
||||
ui->pixmapLabel->setPixmap(p);
|
||||
m_sPixmap = QString::fromUtf8(name); // can also be a path
|
||||
}
|
||||
}
|
||||
@@ -226,13 +229,13 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite
|
||||
|
||||
void DlgCustomActionsImp::on_buttonAddAction_clicked()
|
||||
{
|
||||
if (actionMacros-> currentText().isEmpty())
|
||||
if (ui->actionMacros-> currentText().isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Empty macro"),tr("Please specify the macro first."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionMenu->text().isEmpty())
|
||||
if (ui->actionMenu->text().isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Empty text"),tr("Please specify the menu text first."));
|
||||
return;
|
||||
@@ -241,46 +244,46 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked()
|
||||
// search for the command in the manager
|
||||
QByteArray actionName = newActionName().toLatin1();
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
MacroCommand* macro = new MacroCommand(actionName, actionMacros->itemData(actionMacros->currentIndex()).toBool());
|
||||
MacroCommand* macro = new MacroCommand(actionName, ui->actionMacros->itemData(ui->actionMacros->currentIndex()).toBool());
|
||||
rclMan.addCommand( macro );
|
||||
|
||||
// add new action
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(actionListWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
item->setData(1, Qt::UserRole, actionName);
|
||||
item->setText(1, actionMenu->text());
|
||||
item->setText(1, ui->actionMenu->text());
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if (pixmapLabel->pixmap())
|
||||
item->setIcon(0, *pixmapLabel->pixmap());
|
||||
if (ui->pixmapLabel->pixmap())
|
||||
item->setIcon(0, *ui->pixmapLabel->pixmap());
|
||||
|
||||
// Convert input text into utf8
|
||||
if (!actionWhatsThis->text().isEmpty())
|
||||
macro->setWhatsThis(actionWhatsThis->text().toUtf8());
|
||||
actionWhatsThis->clear();
|
||||
if (!ui->actionWhatsThis->text().isEmpty())
|
||||
macro->setWhatsThis(ui->actionWhatsThis->text().toUtf8());
|
||||
ui->actionWhatsThis->clear();
|
||||
|
||||
if (!actionMacros-> currentText().isEmpty())
|
||||
macro->setScriptName(actionMacros->currentText().toUtf8());
|
||||
if (!ui->actionMacros-> currentText().isEmpty())
|
||||
macro->setScriptName(ui->actionMacros->currentText().toUtf8());
|
||||
|
||||
if (!actionMenu->text().isEmpty())
|
||||
macro->setMenuText(actionMenu->text().toUtf8());
|
||||
actionMenu->clear();
|
||||
if (!ui->actionMenu->text().isEmpty())
|
||||
macro->setMenuText(ui->actionMenu->text().toUtf8());
|
||||
ui->actionMenu->clear();
|
||||
|
||||
if (!actionToolTip->text().isEmpty())
|
||||
macro->setToolTipText(actionToolTip->text().toUtf8());
|
||||
actionToolTip->clear();
|
||||
if (!ui->actionToolTip->text().isEmpty())
|
||||
macro->setToolTipText(ui->actionToolTip->text().toUtf8());
|
||||
ui->actionToolTip->clear();
|
||||
|
||||
if (!actionStatus->text().isEmpty())
|
||||
macro->setStatusTip(actionStatus->text().toUtf8());
|
||||
actionStatus->clear();
|
||||
if (!ui->actionStatus->text().isEmpty())
|
||||
macro->setStatusTip(ui->actionStatus->text().toUtf8());
|
||||
ui->actionStatus->clear();
|
||||
|
||||
if (!m_sPixmap.isEmpty())
|
||||
macro->setPixmap(m_sPixmap.toLatin1());
|
||||
pixmapLabel->clear();
|
||||
ui->pixmapLabel->clear();
|
||||
m_sPixmap = QString::null;
|
||||
|
||||
if (!actionAccel->text().isEmpty()) {
|
||||
macro->setAccel(actionAccel->text().toLatin1());
|
||||
if (!ui->actionAccel->text().isEmpty()) {
|
||||
macro->setAccel(ui->actionAccel->text().toLatin1());
|
||||
}
|
||||
actionAccel->clear();
|
||||
ui->actionAccel->clear();
|
||||
|
||||
// emit signal to notify the container widget
|
||||
addMacroAction(actionName);
|
||||
@@ -288,14 +291,14 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked()
|
||||
|
||||
void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = actionListWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->actionListWidget->currentItem();
|
||||
if (!item)
|
||||
{
|
||||
QMessageBox::warning(this, tr("No item selected"),tr("Please select a macro item first."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionMenu->text().isEmpty())
|
||||
if (ui->actionMenu->text().isEmpty())
|
||||
{
|
||||
QMessageBox::warning(this, tr("Empty text"),tr("Please specify the menu text first."));
|
||||
return;
|
||||
@@ -303,41 +306,41 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
|
||||
|
||||
// search for the command in the manager
|
||||
QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
|
||||
item->setText(1, actionMenu->text());
|
||||
item->setText(1, ui->actionMenu->text());
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
Command* pCmd = rclMan.getCommandByName(actionName.constData());
|
||||
MacroCommand* macro = dynamic_cast<MacroCommand*>(pCmd);
|
||||
if (!macro)
|
||||
return;
|
||||
|
||||
if (!actionWhatsThis->text().isEmpty())
|
||||
macro->setWhatsThis(actionWhatsThis->text().toUtf8());
|
||||
actionWhatsThis->clear();
|
||||
if (!ui->actionWhatsThis->text().isEmpty())
|
||||
macro->setWhatsThis(ui->actionWhatsThis->text().toUtf8());
|
||||
ui->actionWhatsThis->clear();
|
||||
|
||||
if (!actionMacros-> currentText().isEmpty())
|
||||
macro->setScriptName(actionMacros->currentText().toUtf8());
|
||||
if (!ui->actionMacros-> currentText().isEmpty())
|
||||
macro->setScriptName(ui->actionMacros->currentText().toUtf8());
|
||||
|
||||
if (!actionMenu->text().isEmpty())
|
||||
macro->setMenuText(actionMenu->text().toUtf8());
|
||||
actionMenu->clear();
|
||||
if (!ui->actionMenu->text().isEmpty())
|
||||
macro->setMenuText(ui->actionMenu->text().toUtf8());
|
||||
ui->actionMenu->clear();
|
||||
|
||||
if (!actionToolTip->text().isEmpty())
|
||||
macro->setToolTipText(actionToolTip->text().toUtf8());
|
||||
actionToolTip->clear();
|
||||
if (!ui->actionToolTip->text().isEmpty())
|
||||
macro->setToolTipText(ui->actionToolTip->text().toUtf8());
|
||||
ui->actionToolTip->clear();
|
||||
|
||||
if (!actionStatus->text().isEmpty())
|
||||
macro->setStatusTip(actionStatus->text().toUtf8());
|
||||
actionStatus->clear();
|
||||
if (!ui->actionStatus->text().isEmpty())
|
||||
macro->setStatusTip(ui->actionStatus->text().toUtf8());
|
||||
ui->actionStatus->clear();
|
||||
|
||||
if (!m_sPixmap.isEmpty())
|
||||
macro->setPixmap(m_sPixmap.toLatin1());
|
||||
pixmapLabel->clear();
|
||||
ui->pixmapLabel->clear();
|
||||
m_sPixmap = QString::null;
|
||||
|
||||
if (!actionAccel->text().isEmpty()) {
|
||||
macro->setAccel(actionAccel->text().toLatin1());
|
||||
if (!ui->actionAccel->text().isEmpty()) {
|
||||
macro->setAccel(ui->actionAccel->text().toLatin1());
|
||||
}
|
||||
actionAccel->clear();
|
||||
ui->actionAccel->clear();
|
||||
|
||||
// check whether the macro is already in use
|
||||
Action* action = macro->getAction();
|
||||
@@ -377,11 +380,11 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
|
||||
void DlgCustomActionsImp::on_buttonRemoveAction_clicked()
|
||||
{
|
||||
// remove item from list view
|
||||
QTreeWidgetItem* item = actionListWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->actionListWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
int current = actionListWidget->indexOfTopLevelItem(item);
|
||||
actionListWidget->takeTopLevelItem(current);
|
||||
int current = ui->actionListWidget->indexOfTopLevelItem(item);
|
||||
ui->actionListWidget->takeTopLevelItem(current);
|
||||
QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
|
||||
delete item;
|
||||
|
||||
@@ -497,13 +500,13 @@ void DlgCustomActionsImp::on_buttonChoosePixmap_clicked()
|
||||
dlg.setModal(true);
|
||||
dlg.exec();
|
||||
|
||||
pixmapLabel->clear();
|
||||
ui->pixmapLabel->clear();
|
||||
m_sPixmap = QString::null;
|
||||
if (dlg.result() == QDialog::Accepted) {
|
||||
QListWidgetItem* item = dlg.currentItem();
|
||||
if (item) {
|
||||
m_sPixmap = item->text();
|
||||
pixmapLabel->setPixmap(item->icon().pixmap(QSize(32,32)));
|
||||
ui->pixmapLabel->setPixmap(item->icon().pixmap(QSize(32,32)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,10 +542,10 @@ QString DlgCustomActionsImp::newActionName()
|
||||
void DlgCustomActionsImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
actionListWidget->clear();
|
||||
ui->retranslateUi(this);
|
||||
ui->actionListWidget->clear();
|
||||
showActions();
|
||||
actionAccel->setText(qApp->translate("Gui::AccelLineEdit", "none"));
|
||||
ui->actionAccel->setText(qApp->translate("Gui::AccelLineEdit", "none"));
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
@@ -24,16 +24,23 @@
|
||||
#ifndef GUI_DIALOG_DLGACTIONS_IMP_H
|
||||
#define GUI_DIALOG_DLGACTIONS_IMP_H
|
||||
|
||||
#include "ui_DlgActions.h"
|
||||
#include <memory>
|
||||
#include "PropertyPage.h"
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
|
||||
class QListWidgetItem;
|
||||
class QTreeWidgetItem;
|
||||
class QLabel;
|
||||
class QGridLayout;
|
||||
class QLineEdit;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
|
||||
class Ui_DlgCustomActions;
|
||||
|
||||
/** This class implements the creation of user defined actions executing a recorded macro.
|
||||
* It is possible to use these actions in own toolbars or commandbars.
|
||||
* @see Gui::Action
|
||||
@@ -41,7 +48,7 @@ namespace Dialog {
|
||||
* @see Command
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgCustomActionsImp : public CustomizeActionPage, public Ui_DlgCustomActions
|
||||
class DlgCustomActionsImp : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -82,6 +89,7 @@ private:
|
||||
QString newActionName();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgCustomActions> ui;
|
||||
bool bShown; /**< For internal use only*/
|
||||
QString m_sPixmap; /**< Name of the specified pixmap */
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgCommandsImp.h"
|
||||
#include "ui_DlgCommands.h"
|
||||
#include "Application.h"
|
||||
#include "Command.h"
|
||||
#include "BitmapFactory.h"
|
||||
@@ -62,18 +63,19 @@ struct GroupMap_find {
|
||||
*/
|
||||
DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgCustomCommands)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
// paints for active and inactive the same color
|
||||
QPalette pal = categoryTreeWidget->palette();
|
||||
QPalette pal = ui->categoryTreeWidget->palette();
|
||||
pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Active, QPalette::Highlight));
|
||||
pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
|
||||
categoryTreeWidget->setPalette( pal );
|
||||
ui->categoryTreeWidget->setPalette( pal );
|
||||
|
||||
connect(commandTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
connect(ui->commandTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
this, SLOT(onDescription(QTreeWidgetItem*)));
|
||||
connect(categoryTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
connect(ui->categoryTreeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
|
||||
this, SLOT(onGroupActivated(QTreeWidgetItem*)));
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
@@ -104,25 +106,25 @@ DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
|
||||
}
|
||||
|
||||
QStringList labels; labels << tr("Category");
|
||||
categoryTreeWidget->setHeaderLabels(labels);
|
||||
ui->categoryTreeWidget->setHeaderLabels(labels);
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(categoryTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->categoryTreeWidget);
|
||||
item->setText(0, it->second);
|
||||
item->setData(0, Qt::UserRole, QVariant(it->first));
|
||||
}
|
||||
|
||||
labels.clear();
|
||||
labels << tr("Icon") << tr("Command");
|
||||
commandTreeWidget->setHeaderLabels(labels);
|
||||
commandTreeWidget->header()->hide();
|
||||
commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
ui->commandTreeWidget->setHeaderLabels(labels);
|
||||
ui->commandTreeWidget->header()->hide();
|
||||
ui->commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
#if QT_VERSION >= 0x050000
|
||||
commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
categoryTreeWidget->setCurrentItem(categoryTreeWidget->topLevelItem(0));
|
||||
ui->categoryTreeWidget->setCurrentItem(ui->categoryTreeWidget->topLevelItem(0));
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -134,9 +136,9 @@ DlgCustomCommandsImp::~DlgCustomCommandsImp()
|
||||
void DlgCustomCommandsImp::onDescription(QTreeWidgetItem *item)
|
||||
{
|
||||
if (item)
|
||||
textLabel->setText(item->toolTip(1));
|
||||
ui->textLabel->setText(item->toolTip(1));
|
||||
else
|
||||
textLabel->setText(QString());
|
||||
ui->textLabel->setText(QString());
|
||||
}
|
||||
|
||||
/** Shows all commands of this category */
|
||||
@@ -147,13 +149,13 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* item)
|
||||
|
||||
QVariant data = item->data(0, Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
commandTreeWidget->clear();
|
||||
ui->commandTreeWidget->clear();
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -164,7 +166,7 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* item)
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -174,12 +176,12 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* item)
|
||||
}
|
||||
}
|
||||
|
||||
textLabel->setText(QString());
|
||||
ui->textLabel->setText(QString());
|
||||
}
|
||||
|
||||
void DlgCustomCommandsImp::onAddMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QTreeWidgetItem* item = categoryTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -190,7 +192,7 @@ void DlgCustomCommandsImp::onAddMacroAction(const QByteArray& macro)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
@@ -202,7 +204,7 @@ void DlgCustomCommandsImp::onAddMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomCommandsImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QTreeWidgetItem* item = categoryTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -210,11 +212,11 @@ void DlgCustomCommandsImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
commandTreeWidget->takeTopLevelItem(i);
|
||||
ui->commandTreeWidget->takeTopLevelItem(i);
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
@@ -224,7 +226,7 @@ void DlgCustomCommandsImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QTreeWidgetItem* item = categoryTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -234,8 +236,8 @@ void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro)
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
@@ -244,7 +246,7 @@ void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro)
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if (pCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
|
||||
if (commandTreeWidget->isItemSelected(item))
|
||||
if (ui->commandTreeWidget->isItemSelected(item))
|
||||
onDescription(item);
|
||||
break;
|
||||
}
|
||||
@@ -255,12 +257,12 @@ void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro)
|
||||
void DlgCustomCommandsImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
QStringList labels; labels << tr("Category");
|
||||
categoryTreeWidget->setHeaderLabels(labels);
|
||||
ui->categoryTreeWidget->setHeaderLabels(labels);
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
QTreeWidgetItemIterator it(categoryTreeWidget);
|
||||
QTreeWidgetItemIterator it(ui->categoryTreeWidget);
|
||||
while (*it) {
|
||||
QVariant data = (*it)->data(0, Qt::UserRole);
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(data.toByteArray());
|
||||
@@ -270,7 +272,7 @@ void DlgCustomCommandsImp::changeEvent(QEvent *e)
|
||||
}
|
||||
++it;
|
||||
}
|
||||
onGroupActivated(categoryTreeWidget->topLevelItem(0));
|
||||
onGroupActivated(ui->categoryTreeWidget->topLevelItem(0));
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
#ifndef GUI_DIALOG_DLGCOMMANDS_IMP_H
|
||||
#define GUI_DIALOG_DLGCOMMANDS_IMP_H
|
||||
|
||||
#include "ui_DlgCommands.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
class Command;
|
||||
namespace Dialog {
|
||||
class Ui_DlgCustomCommands;
|
||||
|
||||
/** Shows an overview of all available commands of all groups and modules.
|
||||
* You can customize your workbenches just by drag&dropping any commands
|
||||
@@ -38,7 +41,7 @@ namespace Dialog {
|
||||
* customize your own toolbars or commandbars.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgCustomCommandsImp : public CustomizeActionPage, public Ui_DlgCustomCommands
|
||||
class DlgCustomCommandsImp : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -55,6 +58,9 @@ protected Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgCustomCommands> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "DlgCustomizeSpNavSettings.h"
|
||||
#include "ui_DlgCustomizeSpNavSettings.h"
|
||||
#include "GuiApplicationNativeEventAware.h"
|
||||
#include "Application.h"
|
||||
|
||||
@@ -30,7 +31,9 @@
|
||||
using namespace Gui::Dialog;
|
||||
|
||||
DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
|
||||
CustomizeActionPage(parent), init(false)
|
||||
CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgCustomizeSpNavSettings)
|
||||
, init(false)
|
||||
{
|
||||
GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
|
||||
|
||||
@@ -43,7 +46,7 @@ DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
|
||||
return;
|
||||
}
|
||||
this->init = true;
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@@ -67,7 +70,7 @@ void DlgCustomizeSpNavSettings::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
if (this->init) {
|
||||
this->retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
this->setWindowTitle(tr("Spaceball Motion"));
|
||||
@@ -91,55 +94,55 @@ void DlgCustomizeSpNavSettings::on_ButtonCalibrate_clicked()
|
||||
|
||||
void DlgCustomizeSpNavSettings::initialize()
|
||||
{
|
||||
CBDominant->setChecked(spaceballMotionGroup()->GetBool("Dominant", false));
|
||||
CBFlipYZ->setChecked(spaceballMotionGroup()->GetBool("FlipYZ", false));
|
||||
CBRotations->setChecked(spaceballMotionGroup()->GetBool("Rotations", true));
|
||||
CBTranslations->setChecked(spaceballMotionGroup()->GetBool("Translations", true));
|
||||
SliderGlobal->setValue(spaceballMotionGroup()->GetInt("GlobalSensitivity", 0));
|
||||
ui->CBDominant->setChecked(spaceballMotionGroup()->GetBool("Dominant", false));
|
||||
ui->CBFlipYZ->setChecked(spaceballMotionGroup()->GetBool("FlipYZ", false));
|
||||
ui->CBRotations->setChecked(spaceballMotionGroup()->GetBool("Rotations", true));
|
||||
ui->CBTranslations->setChecked(spaceballMotionGroup()->GetBool("Translations", true));
|
||||
ui->SliderGlobal->setValue(spaceballMotionGroup()->GetInt("GlobalSensitivity", 0));
|
||||
|
||||
CBEnablePanLR ->setChecked(spaceballMotionGroup()->GetBool("PanLREnable", true));
|
||||
CBReversePanLR->setChecked(spaceballMotionGroup()->GetBool("PanLRReverse", false));
|
||||
SliderPanLR ->setValue(spaceballMotionGroup()->GetInt("PanLRSensitivity", 0));
|
||||
ui->CBEnablePanLR ->setChecked(spaceballMotionGroup()->GetBool("PanLREnable", true));
|
||||
ui->CBReversePanLR->setChecked(spaceballMotionGroup()->GetBool("PanLRReverse", false));
|
||||
ui->SliderPanLR ->setValue(spaceballMotionGroup()->GetInt("PanLRSensitivity", 0));
|
||||
|
||||
CBEnablePanUD ->setChecked(spaceballMotionGroup()->GetBool("PanUDEnable", true));
|
||||
CBReversePanUD->setChecked(spaceballMotionGroup()->GetBool("PanUDReverse", false));
|
||||
SliderPanUD ->setValue(spaceballMotionGroup()->GetInt("PanUDSensitivity", 0));
|
||||
ui->CBEnablePanUD ->setChecked(spaceballMotionGroup()->GetBool("PanUDEnable", true));
|
||||
ui->CBReversePanUD->setChecked(spaceballMotionGroup()->GetBool("PanUDReverse", false));
|
||||
ui->SliderPanUD ->setValue(spaceballMotionGroup()->GetInt("PanUDSensitivity", 0));
|
||||
|
||||
CBEnableZoom ->setChecked(spaceballMotionGroup()->GetBool("ZoomEnable", true));
|
||||
CBReverseZoom->setChecked(spaceballMotionGroup()->GetBool("ZoomReverse", false));
|
||||
SliderZoom ->setValue(spaceballMotionGroup()->GetInt("ZoomSensitivity", 0));
|
||||
ui->CBEnableZoom ->setChecked(spaceballMotionGroup()->GetBool("ZoomEnable", true));
|
||||
ui->CBReverseZoom->setChecked(spaceballMotionGroup()->GetBool("ZoomReverse", false));
|
||||
ui->SliderZoom ->setValue(spaceballMotionGroup()->GetInt("ZoomSensitivity", 0));
|
||||
|
||||
CBEnableTilt ->setChecked(spaceballMotionGroup()->GetBool("TiltEnable", true));
|
||||
CBReverseTilt->setChecked(spaceballMotionGroup()->GetBool("TiltReverse", false));
|
||||
SliderTilt ->setValue(spaceballMotionGroup()->GetInt("TiltSensitivity", 0));
|
||||
ui->CBEnableTilt ->setChecked(spaceballMotionGroup()->GetBool("TiltEnable", true));
|
||||
ui->CBReverseTilt->setChecked(spaceballMotionGroup()->GetBool("TiltReverse", false));
|
||||
ui->SliderTilt ->setValue(spaceballMotionGroup()->GetInt("TiltSensitivity", 0));
|
||||
|
||||
CBEnableRoll ->setChecked(spaceballMotionGroup()->GetBool("RollEnable", true));
|
||||
CBReverseRoll->setChecked(spaceballMotionGroup()->GetBool("RollReverse", false));
|
||||
SliderRoll ->setValue(spaceballMotionGroup()->GetInt("RollSensitivity", 0));
|
||||
ui->CBEnableRoll ->setChecked(spaceballMotionGroup()->GetBool("RollEnable", true));
|
||||
ui->CBReverseRoll->setChecked(spaceballMotionGroup()->GetBool("RollReverse", false));
|
||||
ui->SliderRoll ->setValue(spaceballMotionGroup()->GetInt("RollSensitivity", 0));
|
||||
|
||||
CBEnableSpin ->setChecked(spaceballMotionGroup()->GetBool("SpinEnable", true));
|
||||
CBReverseSpin->setChecked(spaceballMotionGroup()->GetBool("SpinReverse", false));
|
||||
SliderSpin ->setValue(spaceballMotionGroup()->GetInt("SpinSensitivity", 0));
|
||||
ui->CBEnableSpin ->setChecked(spaceballMotionGroup()->GetBool("SpinEnable", true));
|
||||
ui->CBReverseSpin->setChecked(spaceballMotionGroup()->GetBool("SpinReverse", false));
|
||||
ui->SliderSpin ->setValue(spaceballMotionGroup()->GetInt("SpinSensitivity", 0));
|
||||
|
||||
CBEnableTilt ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseTilt->setEnabled(CBRotations->isChecked() && CBEnableTilt->isChecked());
|
||||
SliderTilt ->setEnabled(CBRotations->isChecked() && CBEnableTilt->isChecked());
|
||||
CBEnableRoll ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseRoll->setEnabled(CBRotations->isChecked() && CBEnableRoll->isChecked());
|
||||
SliderRoll ->setEnabled(CBRotations->isChecked() && CBEnableRoll->isChecked());
|
||||
CBEnableSpin ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseSpin->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
|
||||
SliderSpin ->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
|
||||
ui->CBEnableTilt ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseTilt->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableTilt->isChecked());
|
||||
ui->SliderTilt ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableTilt->isChecked());
|
||||
ui->CBEnableRoll ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseRoll->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableRoll->isChecked());
|
||||
ui->SliderRoll ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableRoll->isChecked());
|
||||
ui->CBEnableSpin ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseSpin->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableSpin->isChecked());
|
||||
ui->SliderSpin ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableSpin->isChecked());
|
||||
|
||||
CBEnablePanLR ->setEnabled(CBTranslations->isChecked());
|
||||
CBReversePanLR->setEnabled(CBTranslations->isChecked() && CBEnablePanLR->isChecked());
|
||||
SliderPanLR ->setEnabled(CBTranslations->isChecked() && CBEnablePanLR->isChecked());
|
||||
CBEnablePanUD ->setEnabled(CBTranslations->isChecked());
|
||||
CBReversePanUD->setEnabled(CBTranslations->isChecked() && CBEnablePanUD->isChecked());
|
||||
SliderPanUD ->setEnabled(CBTranslations->isChecked() && CBEnablePanUD->isChecked());
|
||||
CBEnableZoom ->setEnabled(CBTranslations->isChecked());
|
||||
CBReverseZoom ->setEnabled(CBTranslations->isChecked() && CBEnableZoom->isChecked());
|
||||
SliderZoom ->setEnabled(CBTranslations->isChecked() && CBEnableZoom->isChecked());
|
||||
ui->CBEnablePanLR ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReversePanLR->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanLR->isChecked());
|
||||
ui->SliderPanLR ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanLR->isChecked());
|
||||
ui->CBEnablePanUD ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReversePanUD->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanUD->isChecked());
|
||||
ui->SliderPanUD ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanUD->isChecked());
|
||||
ui->CBEnableZoom ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReverseZoom ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnableZoom->isChecked());
|
||||
ui->SliderZoom ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnableZoom->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_ButtonDefaultSpNavMotions_clicked()
|
||||
@@ -150,155 +153,155 @@ void DlgCustomizeSpNavSettings::on_ButtonDefaultSpNavMotions_clicked()
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBDominant_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("Dominant", CBDominant->isChecked());
|
||||
spaceballMotionGroup()->SetBool("Dominant", ui->CBDominant->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBFlipYZ_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("FlipYZ", CBFlipYZ->isChecked());
|
||||
spaceballMotionGroup()->SetBool("FlipYZ", ui->CBFlipYZ->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBRotations_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("Rotations", CBRotations->isChecked());
|
||||
spaceballMotionGroup()->SetBool("Rotations", ui->CBRotations->isChecked());
|
||||
|
||||
CBEnableTilt ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseTilt->setEnabled(CBRotations->isChecked() && CBEnableTilt->isChecked());
|
||||
SliderTilt ->setEnabled(CBRotations->isChecked() && CBEnableTilt->isChecked());
|
||||
CBEnableRoll ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseRoll->setEnabled(CBRotations->isChecked() && CBEnableRoll->isChecked());
|
||||
SliderRoll ->setEnabled(CBRotations->isChecked() && CBEnableRoll->isChecked());
|
||||
CBEnableSpin ->setEnabled(CBRotations->isChecked());
|
||||
CBReverseSpin->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
|
||||
SliderSpin ->setEnabled(CBRotations->isChecked() && CBEnableSpin->isChecked());
|
||||
ui->CBEnableTilt ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseTilt->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableTilt->isChecked());
|
||||
ui->SliderTilt ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableTilt->isChecked());
|
||||
ui->CBEnableRoll ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseRoll->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableRoll->isChecked());
|
||||
ui->SliderRoll ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableRoll->isChecked());
|
||||
ui->CBEnableSpin ->setEnabled(ui->CBRotations->isChecked());
|
||||
ui->CBReverseSpin->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableSpin->isChecked());
|
||||
ui->SliderSpin ->setEnabled(ui->CBRotations->isChecked() && ui->CBEnableSpin->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBTranslations_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("Translations", CBTranslations->isChecked());
|
||||
spaceballMotionGroup()->SetBool("Translations", ui->CBTranslations->isChecked());
|
||||
|
||||
CBEnablePanLR ->setEnabled(CBTranslations->isChecked());
|
||||
CBReversePanLR->setEnabled(CBTranslations->isChecked() && CBEnablePanLR->isChecked());
|
||||
SliderPanLR ->setEnabled(CBTranslations->isChecked() && CBEnablePanLR->isChecked());
|
||||
CBEnablePanUD ->setEnabled(CBTranslations->isChecked());
|
||||
CBReversePanUD->setEnabled(CBTranslations->isChecked() && CBEnablePanUD->isChecked());
|
||||
SliderPanUD ->setEnabled(CBTranslations->isChecked() && CBEnablePanUD->isChecked());
|
||||
CBEnableZoom ->setEnabled(CBTranslations->isChecked());
|
||||
CBReverseZoom ->setEnabled(CBTranslations->isChecked() && CBEnableZoom->isChecked());
|
||||
SliderZoom ->setEnabled(CBTranslations->isChecked() && CBEnableZoom->isChecked());
|
||||
ui->CBEnablePanLR ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReversePanLR->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanLR->isChecked());
|
||||
ui->SliderPanLR ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanLR->isChecked());
|
||||
ui->CBEnablePanUD ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReversePanUD->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanUD->isChecked());
|
||||
ui->SliderPanUD ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnablePanUD->isChecked());
|
||||
ui->CBEnableZoom ->setEnabled(ui->CBTranslations->isChecked());
|
||||
ui->CBReverseZoom ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnableZoom->isChecked());
|
||||
ui->SliderZoom ->setEnabled(ui->CBTranslations->isChecked() && ui->CBEnableZoom->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderGlobal_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("GlobalSensitivity", SliderGlobal->value());
|
||||
spaceballMotionGroup()->SetInt("GlobalSensitivity", ui->SliderGlobal->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnablePanLR_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("PanLREnable", CBEnablePanLR->isChecked());
|
||||
spaceballMotionGroup()->SetBool("PanLREnable", ui->CBEnablePanLR->isChecked());
|
||||
|
||||
CBReversePanLR->setEnabled(CBEnablePanLR->isChecked());
|
||||
SliderPanLR ->setEnabled(CBEnablePanLR->isChecked());
|
||||
ui->CBReversePanLR->setEnabled(ui->CBEnablePanLR->isChecked());
|
||||
ui->SliderPanLR ->setEnabled(ui->CBEnablePanLR->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReversePanLR_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("PanLRReverse", CBReversePanLR->isChecked());
|
||||
spaceballMotionGroup()->SetBool("PanLRReverse", ui->CBReversePanLR->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderPanLR_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("PanLRSensitivity", SliderPanLR->value());
|
||||
spaceballMotionGroup()->SetInt("PanLRSensitivity", ui->SliderPanLR->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnablePanUD_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("PanUDEnable", CBEnablePanUD->isChecked());
|
||||
spaceballMotionGroup()->SetBool("PanUDEnable", ui->CBEnablePanUD->isChecked());
|
||||
|
||||
CBReversePanUD->setEnabled(CBEnablePanUD->isChecked());
|
||||
SliderPanUD ->setEnabled(CBEnablePanUD->isChecked());
|
||||
ui->CBReversePanUD->setEnabled(ui->CBEnablePanUD->isChecked());
|
||||
ui->SliderPanUD ->setEnabled(ui->CBEnablePanUD->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReversePanUD_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("PanUDReverse", CBReversePanUD->isChecked());
|
||||
spaceballMotionGroup()->SetBool("PanUDReverse", ui->CBReversePanUD->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderPanUD_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("PanUDSensitivity", SliderPanUD->value());
|
||||
spaceballMotionGroup()->SetInt("PanUDSensitivity", ui->SliderPanUD->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnableZoom_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("ZoomEnable", CBEnableZoom->isChecked());
|
||||
spaceballMotionGroup()->SetBool("ZoomEnable", ui->CBEnableZoom->isChecked());
|
||||
|
||||
CBReverseZoom ->setEnabled(CBEnableZoom->isChecked());
|
||||
SliderZoom ->setEnabled(CBEnableZoom->isChecked());
|
||||
ui->CBReverseZoom ->setEnabled(ui->CBEnableZoom->isChecked());
|
||||
ui->SliderZoom ->setEnabled(ui->CBEnableZoom->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReverseZoom_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("ZoomReverse", CBReverseZoom->isChecked());
|
||||
spaceballMotionGroup()->SetBool("ZoomReverse", ui->CBReverseZoom->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderZoom_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("ZoomSensitivity", SliderZoom->value());
|
||||
spaceballMotionGroup()->SetInt("ZoomSensitivity", ui->SliderZoom->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnableTilt_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("TiltEnable", CBEnableTilt->isChecked());
|
||||
spaceballMotionGroup()->SetBool("TiltEnable", ui->CBEnableTilt->isChecked());
|
||||
|
||||
CBReverseTilt->setEnabled(CBEnableTilt->isChecked());
|
||||
SliderTilt ->setEnabled(CBEnableTilt->isChecked());
|
||||
ui->CBReverseTilt->setEnabled(ui->CBEnableTilt->isChecked());
|
||||
ui->SliderTilt ->setEnabled(ui->CBEnableTilt->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReverseTilt_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("TiltReverse", CBReverseTilt->isChecked());
|
||||
spaceballMotionGroup()->SetBool("TiltReverse", ui->CBReverseTilt->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderTilt_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("TiltSensitivity", SliderTilt->value());
|
||||
spaceballMotionGroup()->SetInt("TiltSensitivity", ui->SliderTilt->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnableRoll_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("RollEnable", CBEnableRoll->isChecked());
|
||||
spaceballMotionGroup()->SetBool("RollEnable", ui->CBEnableRoll->isChecked());
|
||||
|
||||
CBReverseRoll->setEnabled(CBEnableRoll->isChecked());
|
||||
SliderRoll ->setEnabled(CBEnableRoll->isChecked());
|
||||
ui->CBReverseRoll->setEnabled(ui->CBEnableRoll->isChecked());
|
||||
ui->SliderRoll ->setEnabled(ui->CBEnableRoll->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReverseRoll_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("RollReverse", CBReverseRoll->isChecked());
|
||||
spaceballMotionGroup()->SetBool("RollReverse", ui->CBReverseRoll->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderRoll_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("RollSensitivity", SliderRoll->value());
|
||||
spaceballMotionGroup()->SetInt("RollSensitivity", ui->SliderRoll->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBEnableSpin_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("SpinEnable", CBEnableSpin->isChecked());
|
||||
spaceballMotionGroup()->SetBool("SpinEnable", ui->CBEnableSpin->isChecked());
|
||||
|
||||
CBReverseSpin->setEnabled(CBEnableSpin->isChecked());
|
||||
SliderSpin ->setEnabled(CBEnableSpin->isChecked());
|
||||
ui->CBReverseSpin->setEnabled(ui->CBEnableSpin->isChecked());
|
||||
ui->SliderSpin ->setEnabled(ui->CBEnableSpin->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_CBReverseSpin_clicked()
|
||||
{
|
||||
spaceballMotionGroup()->SetBool("SpinReverse", CBReverseSpin->isChecked());
|
||||
spaceballMotionGroup()->SetBool("SpinReverse", ui->CBReverseSpin->isChecked());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::on_SliderSpin_sliderReleased()
|
||||
{
|
||||
spaceballMotionGroup()->SetInt("SpinSensitivity", SliderSpin->value());
|
||||
spaceballMotionGroup()->SetInt("SpinSensitivity", ui->SliderSpin->value());
|
||||
}
|
||||
|
||||
void DlgCustomizeSpNavSettings::onAddMacroAction(const QByteArray ¯oName)
|
||||
|
||||
@@ -24,15 +24,17 @@
|
||||
#ifndef DLGCUSTOMIZESPNAVSETTINGS_H
|
||||
#define DLGCUSTOMIZESPNAVSETTINGS_H
|
||||
|
||||
#include "ui_DlgCustomizeSpNavSettings.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <Base/Parameter.h>
|
||||
#include <memory>
|
||||
|
||||
class Ui_DlgCustomizeSpNavSettings;
|
||||
|
||||
namespace Gui
|
||||
{
|
||||
namespace Dialog
|
||||
{
|
||||
class DlgCustomizeSpNavSettings : public CustomizeActionPage, public Ui_DlgCustomizeSpNavSettings
|
||||
class DlgCustomizeSpNavSettings : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -79,6 +81,7 @@ namespace Gui
|
||||
void initialize();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgCustomizeSpNavSettings> ui;
|
||||
bool init;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ void DlgDisplayPropertiesImp::on_buttonUserDefinedMaterial_clicked()
|
||||
dlg.setViewProviders(Provider);
|
||||
dlg.exec();
|
||||
|
||||
d->ui.buttonColor->setColor(dlg.diffuseColor->color());
|
||||
d->ui.buttonColor->setColor(dlg.diffuseColor());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgEditorImp.h"
|
||||
#include "ui_DlgEditor.h"
|
||||
#include "PrefWidgets.h"
|
||||
#include "PythonEditor.h"
|
||||
|
||||
@@ -55,9 +56,10 @@ struct DlgSettingsEditorP
|
||||
*/
|
||||
DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
, ui(new Ui_DlgEditorSettings)
|
||||
{
|
||||
this->setupUi(this);
|
||||
this->EnableFolding->hide(); // Switch off until we have an editor with folding
|
||||
ui->setupUi(this);
|
||||
ui->EnableFolding->hide(); // Switch off until we have an editor with folding
|
||||
|
||||
d = new DlgSettingsEditorP();
|
||||
QColor col;
|
||||
@@ -123,14 +125,14 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
|
||||
(QString::fromLatin1(QT_TR_NOOP("Current line highlight")), lCLine));
|
||||
|
||||
QStringList labels; labels << tr("Items");
|
||||
this->displayItems->setHeaderLabels(labels);
|
||||
this->displayItems->header()->hide();
|
||||
ui->displayItems->setHeaderLabels(labels);
|
||||
ui->displayItems->header()->hide();
|
||||
for (QVector<QPair<QString, unsigned int> >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(this->displayItems);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->displayItems);
|
||||
item->setText(0, tr((*it).first.toLatin1()));
|
||||
}
|
||||
pythonSyntax = new PythonSyntaxHighlighter(textEdit1);
|
||||
pythonSyntax->setDocument(textEdit1->document());
|
||||
pythonSyntax = new PythonSyntaxHighlighter(ui->textEdit1);
|
||||
pythonSyntax->setDocument(ui->textEdit1->document());
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -147,30 +149,30 @@ DlgSettingsEditorImp::~DlgSettingsEditorImp()
|
||||
*/
|
||||
void DlgSettingsEditorImp::on_displayItems_currentItemChanged(QTreeWidgetItem *item)
|
||||
{
|
||||
int index = displayItems->indexOfTopLevelItem(item);
|
||||
int index = ui->displayItems->indexOfTopLevelItem(item);
|
||||
unsigned int col = d->colormap[index].second;
|
||||
colorButton->setColor(QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff));
|
||||
ui->colorButton->setColor(QColor((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff));
|
||||
}
|
||||
|
||||
/** Updates the color map if a color was changed */
|
||||
void DlgSettingsEditorImp::on_colorButton_changed()
|
||||
{
|
||||
QColor col = colorButton->color();
|
||||
QColor col = ui->colorButton->color();
|
||||
unsigned int lcol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
|
||||
|
||||
int index = displayItems->indexOfTopLevelItem(displayItems->currentItem());
|
||||
int index = ui->displayItems->indexOfTopLevelItem(ui->displayItems->currentItem());
|
||||
d->colormap[index].second = lcol;
|
||||
pythonSyntax->setColor( d->colormap[index].first, col );
|
||||
}
|
||||
|
||||
void DlgSettingsEditorImp::saveSettings()
|
||||
{
|
||||
EnableLineNumber->onSave();
|
||||
EnableFolding->onSave();
|
||||
tabSize->onSave();
|
||||
indentSize->onSave();
|
||||
radioTabs->onSave();
|
||||
radioSpaces->onSave();
|
||||
ui->EnableLineNumber->onSave();
|
||||
ui->EnableFolding->onSave();
|
||||
ui->tabSize->onSave();
|
||||
ui->indentSize->onSave();
|
||||
ui->radioTabs->onSave();
|
||||
ui->radioSpaces->onSave();
|
||||
|
||||
// Saves the color map
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor");
|
||||
@@ -179,20 +181,20 @@ void DlgSettingsEditorImp::saveSettings()
|
||||
hGrp->SetUnsigned((*it).first.toLatin1(), col);
|
||||
}
|
||||
|
||||
hGrp->SetInt( "FontSize", fontSize->value() );
|
||||
hGrp->SetASCII( "Font", fontFamily->currentText().toLatin1() );
|
||||
hGrp->SetInt( "FontSize", ui->fontSize->value() );
|
||||
hGrp->SetASCII( "Font", ui->fontFamily->currentText().toLatin1() );
|
||||
}
|
||||
|
||||
void DlgSettingsEditorImp::loadSettings()
|
||||
{
|
||||
EnableLineNumber->onRestore();
|
||||
EnableFolding->onRestore();
|
||||
tabSize->onRestore();
|
||||
indentSize->onRestore();
|
||||
radioTabs->onRestore();
|
||||
radioSpaces->onRestore();
|
||||
ui->EnableLineNumber->onRestore();
|
||||
ui->EnableFolding->onRestore();
|
||||
ui->tabSize->onRestore();
|
||||
ui->indentSize->onRestore();
|
||||
ui->radioTabs->onRestore();
|
||||
ui->radioSpaces->onRestore();
|
||||
|
||||
textEdit1->setPlainText(QString::fromLatin1(
|
||||
ui->textEdit1->setPlainText(QString::fromLatin1(
|
||||
"# Short Python sample\n"
|
||||
"import sys\n"
|
||||
"def foo(begin, end):\n"
|
||||
@@ -217,20 +219,20 @@ void DlgSettingsEditorImp::loadSettings()
|
||||
|
||||
// fill up font styles
|
||||
//
|
||||
fontSize->setValue(10);
|
||||
fontSize->setValue( hGrp->GetInt("FontSize", fontSize->value()) );
|
||||
ui->fontSize->setValue(10);
|
||||
ui->fontSize->setValue( hGrp->GetInt("FontSize", ui->fontSize->value()) );
|
||||
|
||||
QByteArray fontName = this->font().family().toLatin1();
|
||||
|
||||
QFontDatabase fdb;
|
||||
QStringList familyNames = fdb.families( QFontDatabase::Any );
|
||||
fontFamily->addItems(familyNames);
|
||||
ui->fontFamily->addItems(familyNames);
|
||||
int index = familyNames.indexOf(QString::fromLatin1(hGrp->GetASCII("Font", fontName).c_str()));
|
||||
if (index < 0) index = 0;
|
||||
fontFamily->setCurrentIndex(index);
|
||||
on_fontFamily_activated(this->fontFamily->currentText());
|
||||
ui->fontFamily->setCurrentIndex(index);
|
||||
on_fontFamily_activated(ui->fontFamily->currentText());
|
||||
|
||||
displayItems->setCurrentItem(displayItems->topLevelItem(0));
|
||||
ui->displayItems->setCurrentItem(ui->displayItems->topLevelItem(0));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,8 +243,8 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e)
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
int index = 0;
|
||||
for (QVector<QPair<QString, unsigned int> >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it)
|
||||
this->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1()));
|
||||
this->retranslateUi(this);
|
||||
ui->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1()));
|
||||
ui->retranslateUi(this);
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
@@ -250,14 +252,14 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e)
|
||||
|
||||
void DlgSettingsEditorImp::on_fontFamily_activated(const QString& fontFamily)
|
||||
{
|
||||
int fontSize = this->fontSize->value();
|
||||
int fontSize = ui->fontSize->value();
|
||||
QFont ft(fontFamily, fontSize);
|
||||
textEdit1->setFont(ft);
|
||||
ui->textEdit1->setFont(ft);
|
||||
}
|
||||
|
||||
void DlgSettingsEditorImp::on_fontSize_valueChanged(const QString&)
|
||||
{
|
||||
on_fontFamily_activated(this->fontFamily->currentText());
|
||||
on_fontFamily_activated(ui->fontFamily->currentText());
|
||||
}
|
||||
|
||||
#include "moc_DlgEditorImp.cpp"
|
||||
|
||||
@@ -24,20 +24,23 @@
|
||||
#ifndef GUI_DIALOG_DLGEDITORSETTINGSIMP_H
|
||||
#define GUI_DIALOG_DLGEDITORSETTINGSIMP_H
|
||||
|
||||
#include "ui_DlgEditor.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
class PythonSyntaxHighlighter;
|
||||
|
||||
namespace Dialog {
|
||||
class Ui_DlgEditorSettings;
|
||||
|
||||
/** This class implements a preferences page for the editor settings.
|
||||
* Here you can change different color settings and font for editors.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
struct DlgSettingsEditorP;
|
||||
class DlgSettingsEditorImp : public PreferencePage, public Ui_DlgEditorSettings
|
||||
class DlgSettingsEditorImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -59,6 +62,7 @@ protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgEditorSettings> ui;
|
||||
DlgSettingsEditorP* d;
|
||||
Gui::PythonSyntaxHighlighter* pythonSyntax;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgInputDialogImp.h"
|
||||
#include "ui_DlgInputDialog.h"
|
||||
#include "SpinBox.h"
|
||||
|
||||
|
||||
@@ -42,18 +43,19 @@ using namespace Gui::Dialog;
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgInputDialogImp::DlgInputDialogImp( const QString& labelTxt, QWidget* parent, bool modal, Type type )
|
||||
: QDialog( parent )
|
||||
: QDialog(parent)
|
||||
, ui(new Ui_DlgInputDialog)
|
||||
{
|
||||
this->setModal(modal);
|
||||
this->setupUi(this);
|
||||
label->setText(labelTxt);
|
||||
ui->setupUi(this);
|
||||
ui->label->setText(labelTxt);
|
||||
|
||||
QSize sh = sizeHint();
|
||||
setType(type);
|
||||
resize(qMax(sh.width(), 400), 1);
|
||||
|
||||
connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(tryAccept()));
|
||||
connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
|
||||
connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(tryAccept()));
|
||||
connect(ui->lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,21 +70,21 @@ void DlgInputDialogImp::textChanged( const QString &s )
|
||||
{
|
||||
bool on = true;
|
||||
|
||||
if (lineEdit->validator()) {
|
||||
QString str = lineEdit->text();
|
||||
int index = lineEdit->cursorPosition();
|
||||
on = ( lineEdit->validator()->validate(str, index) == QValidator::Acceptable );
|
||||
if (ui->lineEdit->validator()) {
|
||||
QString str = ui->lineEdit->text();
|
||||
int index = ui->lineEdit->cursorPosition();
|
||||
on = ( ui->lineEdit->validator()->validate(str, index) == QValidator::Acceptable );
|
||||
}
|
||||
else if ( type() != LineEdit ) {
|
||||
on = !s.isEmpty();
|
||||
}
|
||||
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled( on );
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled( on );
|
||||
}
|
||||
|
||||
void DlgInputDialogImp::tryAccept()
|
||||
{
|
||||
if (!lineEdit->text().isEmpty())
|
||||
if (!ui->lineEdit->text().isEmpty())
|
||||
accept();
|
||||
}
|
||||
|
||||
@@ -94,29 +96,29 @@ void DlgInputDialogImp::setType( DlgInputDialogImp::Type t )
|
||||
switch (inputtype)
|
||||
{
|
||||
case LineEdit:
|
||||
input = lineEdit;
|
||||
input = ui->lineEdit;
|
||||
break;
|
||||
case SpinBox:
|
||||
input = spinBox;
|
||||
input = ui->spinBox;
|
||||
break;
|
||||
case UIntBox:
|
||||
input = uIntSpinBox;
|
||||
input = ui->uIntSpinBox;
|
||||
break;
|
||||
case FloatSpinBox:
|
||||
input = floatSpinBox;
|
||||
input = ui->floatSpinBox;
|
||||
break;
|
||||
case ComboBox:
|
||||
input = comboBox;
|
||||
input = ui->comboBox;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (input) {
|
||||
stack->setCurrentWidget(input->parentWidget());
|
||||
stack->setFixedHeight( input->sizeHint().height() );
|
||||
ui->stack->setCurrentWidget(input->parentWidget());
|
||||
ui->stack->setFixedHeight( input->sizeHint().height() );
|
||||
input->setFocus();
|
||||
label->setBuddy( input );
|
||||
ui->label->setBuddy( input );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,27 +129,27 @@ DlgInputDialogImp::Type DlgInputDialogImp::type() const
|
||||
|
||||
QSpinBox *DlgInputDialogImp::getSpinBox() const
|
||||
{
|
||||
return spinBox;
|
||||
return ui->spinBox;
|
||||
}
|
||||
|
||||
Gui::UIntSpinBox *DlgInputDialogImp::getUIntBox() const
|
||||
{
|
||||
return uIntSpinBox;
|
||||
return ui->uIntSpinBox;
|
||||
}
|
||||
|
||||
QDoubleSpinBox *DlgInputDialogImp::getFloatSpinBox() const
|
||||
{
|
||||
return floatSpinBox;
|
||||
return ui->floatSpinBox;
|
||||
}
|
||||
|
||||
QLineEdit *DlgInputDialogImp::getLineEdit() const
|
||||
{
|
||||
return lineEdit;
|
||||
return ui->lineEdit;
|
||||
}
|
||||
|
||||
QComboBox *DlgInputDialogImp::getComboBox() const
|
||||
{
|
||||
return comboBox;
|
||||
return ui->comboBox;
|
||||
}
|
||||
|
||||
#include "moc_DlgInputDialogImp.cpp"
|
||||
|
||||
@@ -24,10 +24,19 @@
|
||||
#ifndef GUI_DIALOG_DLGINPUTDIALOGIMP_H
|
||||
#define GUI_DIALOG_DLGINPUTDIALOGIMP_H
|
||||
|
||||
#include "ui_DlgInputDialog.h"
|
||||
#include <memory>
|
||||
#include <QDialog>
|
||||
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
|
||||
namespace Gui {
|
||||
class UIntSpinBox;
|
||||
|
||||
namespace Dialog {
|
||||
class Ui_DlgInputDialog;
|
||||
|
||||
/**
|
||||
* The DlgInputDialogImp dialog class does basically the same as Qt's QInputDialog
|
||||
@@ -36,7 +45,7 @@ namespace Dialog {
|
||||
* the flexibility.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class GuiExport DlgInputDialogImp : public QDialog, public Ui_DlgInputDialog
|
||||
class GuiExport DlgInputDialogImp : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -61,6 +70,9 @@ protected Q_SLOTS:
|
||||
|
||||
protected:
|
||||
Type inputtype;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgInputDialog> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <Base/Parameter.h>
|
||||
|
||||
#include "DlgKeyboardImp.h"
|
||||
#include "ui_DlgKeyboard.h"
|
||||
#include "Action.h"
|
||||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
@@ -64,9 +65,11 @@ struct GroupMap_find {
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent )
|
||||
: CustomizeActionPage(parent), firstShow(true)
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgCustomKeyboard)
|
||||
, firstShow(true)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::map<std::string,Command*> sCommands = cCmdMgr.getCommands();
|
||||
@@ -97,23 +100,23 @@ DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent )
|
||||
|
||||
int index = 0;
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
categoryBox->addItem(it->second);
|
||||
categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
ui->categoryBox->addItem(it->second);
|
||||
ui->categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
}
|
||||
|
||||
QStringList labels;
|
||||
labels << tr("Icon") << tr("Command");
|
||||
commandTreeWidget->setHeaderLabels(labels);
|
||||
commandTreeWidget->header()->hide();
|
||||
commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
ui->commandTreeWidget->setHeaderLabels(labels);
|
||||
ui->commandTreeWidget->header()->hide();
|
||||
ui->commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
#if QT_VERSION >= 0x050000
|
||||
commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
assignedTreeWidget->setHeaderLabels(labels);
|
||||
assignedTreeWidget->header()->hide();
|
||||
ui->assignedTreeWidget->setHeaderLabels(labels);
|
||||
ui->assignedTreeWidget->header()->hide();
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -127,7 +130,7 @@ void DlgCustomKeyboardImp::showEvent(QShowEvent* e)
|
||||
// If we did this already in the constructor we wouldn't get the vertical scrollbar if needed.
|
||||
// The problem was noticed with Qt 4.1.4 but may arise with any later version.
|
||||
if (firstShow) {
|
||||
on_categoryBox_activated(categoryBox->currentIndex());
|
||||
on_categoryBox_activated(ui->categoryBox->currentIndex());
|
||||
firstShow = false;
|
||||
}
|
||||
}
|
||||
@@ -147,46 +150,46 @@ void DlgCustomKeyboardImp::on_commandTreeWidget_currentItemChanged(QTreeWidgetIt
|
||||
if (cmd->getAction()) {
|
||||
QKeySequence ks = cmd->getAction()->shortcut();
|
||||
QKeySequence ks2 = QString::fromLatin1(cmd->getAccel());
|
||||
QKeySequence ks3 = editShortcut->text();
|
||||
QKeySequence ks3 = ui->editShortcut->text();
|
||||
|
||||
if (ks.isEmpty())
|
||||
accelLineEditShortcut->setText( tr("none") );
|
||||
ui->accelLineEditShortcut->setText( tr("none") );
|
||||
else
|
||||
accelLineEditShortcut->setText(ks.toString(QKeySequence::NativeText));
|
||||
ui->accelLineEditShortcut->setText(ks.toString(QKeySequence::NativeText));
|
||||
|
||||
buttonAssign->setEnabled(!editShortcut->text().isEmpty() && (ks != ks3));
|
||||
buttonReset->setEnabled((ks != ks2));
|
||||
ui->buttonAssign->setEnabled(!ui->editShortcut->text().isEmpty() && (ks != ks3));
|
||||
ui->buttonReset->setEnabled((ks != ks2));
|
||||
} else {
|
||||
QKeySequence ks = QString::fromLatin1(cmd->getAccel());
|
||||
if (ks.isEmpty())
|
||||
accelLineEditShortcut->setText( tr("none") );
|
||||
ui->accelLineEditShortcut->setText( tr("none") );
|
||||
else
|
||||
accelLineEditShortcut->setText(ks.toString(QKeySequence::NativeText));
|
||||
buttonAssign->setEnabled(false);
|
||||
buttonReset->setEnabled(false);
|
||||
ui->accelLineEditShortcut->setText(ks.toString(QKeySequence::NativeText));
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
ui->buttonReset->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
textLabelDescription->setText(item->toolTip(1));
|
||||
ui->textLabelDescription->setText(item->toolTip(1));
|
||||
}
|
||||
|
||||
/** Shows all commands of this category */
|
||||
void DlgCustomKeyboardImp::on_categoryBox_activated(int index)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(index, Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(index, Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
commandTreeWidget->clear();
|
||||
buttonAssign->setEnabled(false);
|
||||
buttonReset->setEnabled(false);
|
||||
accelLineEditShortcut->clear();
|
||||
editShortcut->clear();
|
||||
ui->commandTreeWidget->clear();
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
ui->buttonReset->setEnabled(false);
|
||||
ui->accelLineEditShortcut->clear();
|
||||
ui->editShortcut->clear();
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands( group.toLatin1() );
|
||||
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -197,7 +200,7 @@ void DlgCustomKeyboardImp::on_categoryBox_activated(int index)
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -211,7 +214,7 @@ void DlgCustomKeyboardImp::on_categoryBox_activated(int index)
|
||||
/** Assigns a new accelerator to the selected command. */
|
||||
void DlgCustomKeyboardImp::on_buttonAssign_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = commandTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -222,10 +225,10 @@ void DlgCustomKeyboardImp::on_buttonAssign_clicked()
|
||||
Command* cmd = cCmdMgr.getCommandByName(name.constData());
|
||||
if (cmd && cmd->getAction()) {
|
||||
Action* action = cmd->getAction();
|
||||
QKeySequence shortcut = editShortcut->text();
|
||||
QKeySequence shortcut = ui->editShortcut->text();
|
||||
action->setShortcut(shortcut.toString(QKeySequence::NativeText));
|
||||
accelLineEditShortcut->setText(editShortcut->text());
|
||||
editShortcut->clear();
|
||||
ui->accelLineEditShortcut->setText(ui->editShortcut->text());
|
||||
ui->editShortcut->clear();
|
||||
|
||||
// update the tool tip
|
||||
QString accel = shortcut.toString(QKeySequence::NativeText);
|
||||
@@ -259,16 +262,16 @@ void DlgCustomKeyboardImp::on_buttonAssign_clicked()
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
|
||||
hGrp->SetASCII(name.constData(), accelLineEditShortcut->text().toUtf8());
|
||||
buttonAssign->setEnabled(false);
|
||||
buttonReset->setEnabled(true);
|
||||
hGrp->SetASCII(name.constData(), ui->accelLineEditShortcut->text().toUtf8());
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
ui->buttonReset->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/** Clears the accelerator of the selected command. */
|
||||
void DlgCustomKeyboardImp::on_buttonClear_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = commandTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -280,8 +283,8 @@ void DlgCustomKeyboardImp::on_buttonClear_clicked()
|
||||
if (cmd && cmd->getAction()) {
|
||||
Action* action = cmd->getAction();
|
||||
action->setShortcut(QString());
|
||||
accelLineEditShortcut->clear();
|
||||
editShortcut->clear();
|
||||
ui->accelLineEditShortcut->clear();
|
||||
ui->editShortcut->clear();
|
||||
|
||||
// update the tool tip
|
||||
QString toolTip = QCoreApplication::translate(cmd->className(),
|
||||
@@ -296,16 +299,16 @@ void DlgCustomKeyboardImp::on_buttonClear_clicked()
|
||||
action->setStatusTip(statusTip);
|
||||
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
|
||||
hGrp->SetASCII(name.constData(), accelLineEditShortcut->text().toUtf8());
|
||||
buttonAssign->setEnabled(false);
|
||||
buttonReset->setEnabled(true);
|
||||
hGrp->SetASCII(name.constData(), ui->accelLineEditShortcut->text().toUtf8());
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
ui->buttonReset->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/** Resets the accelerator of the selected command to the default. */
|
||||
void DlgCustomKeyboardImp::on_buttonReset_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = commandTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -317,12 +320,12 @@ void DlgCustomKeyboardImp::on_buttonReset_clicked()
|
||||
if (cmd && cmd->getAction()) {
|
||||
cmd->getAction()->setShortcut(QString::fromLatin1(cmd->getAccel()));
|
||||
QString txt = cmd->getAction()->shortcut().toString(QKeySequence::NativeText);
|
||||
accelLineEditShortcut->setText((txt.isEmpty() ? tr("none") : txt));
|
||||
ui->accelLineEditShortcut->setText((txt.isEmpty() ? tr("none") : txt));
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut");
|
||||
hGrp->RemoveASCII(name.constData());
|
||||
}
|
||||
|
||||
buttonReset->setEnabled( false );
|
||||
ui->buttonReset->setEnabled( false );
|
||||
}
|
||||
|
||||
/** Resets the accelerator of all commands to the default. */
|
||||
@@ -338,14 +341,14 @@ void DlgCustomKeyboardImp::on_buttonResetAll_clicked()
|
||||
}
|
||||
|
||||
WindowParameter::getDefaultParameter()->RemoveGrp("Shortcut");
|
||||
buttonReset->setEnabled(false);
|
||||
ui->buttonReset->setEnabled(false);
|
||||
}
|
||||
|
||||
/** Checks for an already occupied shortcut. */
|
||||
void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
{
|
||||
assignedTreeWidget->clear();
|
||||
QTreeWidgetItem* item = commandTreeWidget->currentItem();
|
||||
ui->assignedTreeWidget->clear();
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
QVariant data = item->data(1, Qt::UserRole);
|
||||
@@ -354,13 +357,13 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* cmd = cCmdMgr.getCommandByName(name.constData());
|
||||
if (cmd && !cmd->getAction()) {
|
||||
buttonAssign->setEnabled(false); // command not in use
|
||||
ui->buttonAssign->setEnabled(false); // command not in use
|
||||
return;
|
||||
}
|
||||
|
||||
buttonAssign->setEnabled(true);
|
||||
ui->buttonAssign->setEnabled(true);
|
||||
QKeySequence ks(sc);
|
||||
if (!ks.isEmpty() && !editShortcut->isNone()) {
|
||||
if (!ks.isEmpty() && !ui->editShortcut->isNone()) {
|
||||
int countAmbiguous = 0;
|
||||
QString ambiguousCommand;
|
||||
QString ambiguousMenu;
|
||||
@@ -379,7 +382,7 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
ambiguousCommand = QString::fromLatin1((*it)->getName()); // store the last one
|
||||
ambiguousMenu = qApp->translate((*it)->className(), (*it)->getMenuText());
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(assignedTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->assignedTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -393,13 +396,13 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
}
|
||||
|
||||
if (countAmbiguous > 0)
|
||||
assignedTreeWidget->resizeColumnToContents(0);
|
||||
ui->assignedTreeWidget->resizeColumnToContents(0);
|
||||
|
||||
if (countAmbiguous > 1) {
|
||||
QMessageBox::warning(this, tr("Multiple defined shortcut"),
|
||||
tr("The shortcut '%1' is defined more than once. This could result in unexpected behaviour.").arg(sc) );
|
||||
editShortcut->setFocus();
|
||||
buttonAssign->setEnabled(false);
|
||||
ui->editShortcut->setFocus();
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
}
|
||||
else if (countAmbiguous == 1 && ambiguousCommand != QLatin1String(name)) {
|
||||
QMessageBox box(this);
|
||||
@@ -418,31 +421,31 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
}
|
||||
}
|
||||
else {
|
||||
editShortcut->setFocus();
|
||||
buttonAssign->setEnabled(false);
|
||||
ui->editShortcut->setFocus();
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cmd && cmd->getAction() && cmd->getAction()->shortcut() == ks)
|
||||
buttonAssign->setEnabled(false);
|
||||
ui->buttonAssign->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cmd && cmd->getAction() && cmd->getAction()->shortcut().isEmpty())
|
||||
buttonAssign->setEnabled(false); // both key sequences are empty
|
||||
ui->buttonAssign->setEnabled(false); // both key sequences are empty
|
||||
}
|
||||
}
|
||||
|
||||
void DlgCustomKeyboardImp::onAddMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
@@ -454,15 +457,15 @@ void DlgCustomKeyboardImp::onAddMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomKeyboardImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
commandTreeWidget->takeTopLevelItem(i);
|
||||
ui->commandTreeWidget->takeTopLevelItem(i);
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
@@ -472,14 +475,14 @@ void DlgCustomKeyboardImp::onRemoveMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
@@ -488,8 +491,8 @@ void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro)
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if (pCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
|
||||
if (commandTreeWidget->isItemSelected(item))
|
||||
textLabelDescription->setText(item->toolTip(1));
|
||||
if (ui->commandTreeWidget->isItemSelected(item))
|
||||
ui->textLabelDescription->setText(item->toolTip(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -499,19 +502,19 @@ void DlgCustomKeyboardImp::onModifyMacroAction(const QByteArray& macro)
|
||||
void DlgCustomKeyboardImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
int count = categoryBox->count();
|
||||
ui->retranslateUi(this);
|
||||
int count = ui->categoryBox->count();
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
for (int i=0; i<count; i++) {
|
||||
QVariant data = categoryBox->itemData(i, Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(i, Qt::UserRole);
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(data.toByteArray());
|
||||
if (!aCmds.empty()) {
|
||||
QString text = qApp->translate(aCmds[0]->className(), aCmds[0]->getGroupName());
|
||||
categoryBox->setItemText(i, text);
|
||||
ui->categoryBox->setItemText(i, text);
|
||||
}
|
||||
}
|
||||
on_categoryBox_activated(categoryBox->currentIndex());
|
||||
on_categoryBox_activated(ui->categoryBox->currentIndex());
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
@@ -24,11 +24,14 @@
|
||||
#ifndef GUI_DIALOG_DLGKEYBOARD_IMP_H
|
||||
#define GUI_DIALOG_DLGKEYBOARD_IMP_H
|
||||
|
||||
#include "ui_DlgKeyboard.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgCustomKeyboard;
|
||||
|
||||
/** Shows an overview of all available commands of all groups and modules.
|
||||
* You can customize your workbenches just by drag&dropping any commands
|
||||
@@ -37,7 +40,7 @@ namespace Dialog {
|
||||
* customize your own toolbars or commandbars.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgCustomKeyboardImp : public CustomizeActionPage, public Ui_DlgCustomKeyboard
|
||||
class DlgCustomKeyboardImp : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -64,6 +67,7 @@ protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgCustomKeyboard> ui;
|
||||
bool firstShow;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QInputDialog>
|
||||
# include <QLabel>
|
||||
# include <QHeaderView>
|
||||
# include <QMessageBox>
|
||||
# include <QComboBox>
|
||||
#endif
|
||||
|
||||
#include "DlgMacroExecuteImp.h"
|
||||
#include "ui_DlgMacroExecute.h"
|
||||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "Command.h"
|
||||
@@ -76,21 +78,23 @@ namespace Gui {
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgMacroExecuteImp::DlgMacroExecuteImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
: QDialog( parent, fl ), WindowParameter( "Macro" )
|
||||
: QDialog( parent, fl )
|
||||
, WindowParameter( "Macro" )
|
||||
, ui(new Ui_DlgMacroExecute)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
// retrieve the macro path from parameter or use the user data as default
|
||||
std::string path = getWindowParameter()->GetASCII("MacroPath",
|
||||
App::Application::getUserMacroDir().c_str());
|
||||
this->macroPath = QString::fromUtf8(path.c_str());
|
||||
fileChooser->setFileName(this->macroPath);
|
||||
ui->fileChooser->setFileName(this->macroPath);
|
||||
|
||||
// Fill the List box
|
||||
QStringList labels; labels << tr("Macros");
|
||||
userMacroListBox->setHeaderLabels(labels);
|
||||
userMacroListBox->header()->hide();
|
||||
systemMacroListBox->setHeaderLabels(labels);
|
||||
systemMacroListBox->header()->hide();
|
||||
ui->userMacroListBox->setHeaderLabels(labels);
|
||||
ui->userMacroListBox->header()->hide();
|
||||
ui->systemMacroListBox->setHeaderLabels(labels);
|
||||
ui->systemMacroListBox->header()->hide();
|
||||
fillUpList();
|
||||
}
|
||||
|
||||
@@ -111,19 +115,19 @@ void DlgMacroExecuteImp::fillUpList(void)
|
||||
QDir dir(this->macroPath, QLatin1String("*.FCMacro *.py"));
|
||||
|
||||
// fill up with the directory
|
||||
userMacroListBox->clear();
|
||||
ui->userMacroListBox->clear();
|
||||
for (unsigned int i=0; i<dir.count(); i++ ) {
|
||||
MacroItem* item = new MacroItem(userMacroListBox,false);
|
||||
MacroItem* item = new MacroItem(ui->userMacroListBox,false);
|
||||
item->setText(0, dir[i]);
|
||||
}
|
||||
|
||||
QString dirstr = QString::fromUtf8(App::GetApplication().getHomePath()) + QString::fromUtf8("Macro");
|
||||
dir = QDir(dirstr, QLatin1String("*.FCMacro *.py"));
|
||||
|
||||
systemMacroListBox->clear();
|
||||
ui->systemMacroListBox->clear();
|
||||
if (dir.exists()) {
|
||||
for (unsigned int i=0; i<dir.count(); i++ ) {
|
||||
MacroItem* item = new MacroItem(systemMacroListBox,true);
|
||||
MacroItem* item = new MacroItem(ui->systemMacroListBox,true);
|
||||
item->setText(0, dir[i]);
|
||||
}
|
||||
}
|
||||
@@ -135,48 +139,48 @@ void DlgMacroExecuteImp::fillUpList(void)
|
||||
void DlgMacroExecuteImp::on_userMacroListBox_currentItemChanged(QTreeWidgetItem* item)
|
||||
{
|
||||
if (item) {
|
||||
LineEditMacroName->setText(item->text(0));
|
||||
ui->LineEditMacroName->setText(item->text(0));
|
||||
|
||||
executeButton->setEnabled(true);
|
||||
deleteButton->setEnabled(true);
|
||||
toolbarButton->setEnabled(true);
|
||||
createButton->setEnabled(true);
|
||||
editButton->setEnabled(true);
|
||||
renameButton->setEnabled(true);
|
||||
duplicateButton->setEnabled(true);
|
||||
ui->executeButton->setEnabled(true);
|
||||
ui->deleteButton->setEnabled(true);
|
||||
ui->toolbarButton->setEnabled(true);
|
||||
ui->createButton->setEnabled(true);
|
||||
ui->editButton->setEnabled(true);
|
||||
ui->renameButton->setEnabled(true);
|
||||
ui->duplicateButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
executeButton->setEnabled(false);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(true);
|
||||
editButton->setEnabled(false);
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(false);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(true);
|
||||
ui->editButton->setEnabled(false);
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgMacroExecuteImp::on_systemMacroListBox_currentItemChanged(QTreeWidgetItem* item)
|
||||
{
|
||||
if (item) {
|
||||
LineEditMacroName->setText(item->text(0));
|
||||
ui->LineEditMacroName->setText(item->text(0));
|
||||
|
||||
executeButton->setEnabled(true);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(false);
|
||||
editButton->setEnabled(true); //look but don't touch
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(true);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(false);
|
||||
ui->editButton->setEnabled(true); //look but don't touch
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
executeButton->setEnabled(false);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(false);
|
||||
editButton->setEnabled(false);
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(false);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(false);
|
||||
ui->editButton->setEnabled(false);
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,54 +189,54 @@ void DlgMacroExecuteImp::on_tabMacroWidget_currentChanged(int index)
|
||||
QTreeWidgetItem* item;
|
||||
|
||||
if (index == 0) { //user-specific
|
||||
item = userMacroListBox->currentItem();
|
||||
item = ui->userMacroListBox->currentItem();
|
||||
if (item) {
|
||||
executeButton->setEnabled(true);
|
||||
deleteButton->setEnabled(true);
|
||||
toolbarButton->setEnabled(true);
|
||||
createButton->setEnabled(true);
|
||||
editButton->setEnabled(true);
|
||||
renameButton->setEnabled(true);
|
||||
duplicateButton->setEnabled(true);
|
||||
ui->executeButton->setEnabled(true);
|
||||
ui->deleteButton->setEnabled(true);
|
||||
ui->toolbarButton->setEnabled(true);
|
||||
ui->createButton->setEnabled(true);
|
||||
ui->editButton->setEnabled(true);
|
||||
ui->renameButton->setEnabled(true);
|
||||
ui->duplicateButton->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
executeButton->setEnabled(false);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(true);
|
||||
editButton->setEnabled(false);
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(false);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(true);
|
||||
ui->editButton->setEnabled(false);
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else { //index==1 system-wide
|
||||
item = systemMacroListBox->currentItem();
|
||||
item = ui->systemMacroListBox->currentItem();
|
||||
|
||||
if (item) {
|
||||
executeButton->setEnabled(true);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(false);
|
||||
editButton->setEnabled(true); //but you can't save it
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(true);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(false);
|
||||
ui->editButton->setEnabled(true); //but you can't save it
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
executeButton->setEnabled(false);
|
||||
deleteButton->setEnabled(false);
|
||||
toolbarButton->setEnabled(false);
|
||||
createButton->setEnabled(false);
|
||||
editButton->setEnabled(false);
|
||||
renameButton->setEnabled(false);
|
||||
duplicateButton->setEnabled(false);
|
||||
ui->executeButton->setEnabled(false);
|
||||
ui->deleteButton->setEnabled(false);
|
||||
ui->toolbarButton->setEnabled(false);
|
||||
ui->createButton->setEnabled(false);
|
||||
ui->editButton->setEnabled(false);
|
||||
ui->renameButton->setEnabled(false);
|
||||
ui->duplicateButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (item) {
|
||||
LineEditMacroName->setText(item->text(0));
|
||||
ui->LineEditMacroName->setText(item->text(0));
|
||||
}
|
||||
else {
|
||||
LineEditMacroName->clear();
|
||||
ui->LineEditMacroName->clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,13 +247,13 @@ void DlgMacroExecuteImp::accept()
|
||||
{
|
||||
QTreeWidgetItem* item;
|
||||
|
||||
int index = tabMacroWidget->currentIndex();
|
||||
int index = ui->tabMacroWidget->currentIndex();
|
||||
if (index == 0) { //user-specific
|
||||
item = userMacroListBox->currentItem();
|
||||
item = ui->userMacroListBox->currentItem();
|
||||
}
|
||||
else {
|
||||
//index == 1 system-wide
|
||||
item = systemMacroListBox->currentItem();
|
||||
item = ui->systemMacroListBox->currentItem();
|
||||
}
|
||||
if (!item)
|
||||
return;
|
||||
@@ -306,14 +310,14 @@ void DlgMacroExecuteImp::on_editButton_clicked()
|
||||
QDir dir;
|
||||
QTreeWidgetItem* item = 0;
|
||||
|
||||
int index = tabMacroWidget->currentIndex();
|
||||
int index = ui->tabMacroWidget->currentIndex();
|
||||
if (index == 0) { //user-specific
|
||||
item = userMacroListBox->currentItem();
|
||||
item = ui->userMacroListBox->currentItem();
|
||||
dir.setPath(this->macroPath);
|
||||
}
|
||||
else {
|
||||
//index == 1 system-wide
|
||||
item = systemMacroListBox->currentItem();
|
||||
item = ui->systemMacroListBox->currentItem();
|
||||
dir.setPath(QString::fromUtf8(App::GetApplication().getHomePath()) + QString::fromUtf8("Macro"));
|
||||
}
|
||||
|
||||
@@ -387,7 +391,7 @@ void DlgMacroExecuteImp::on_createButton_clicked()
|
||||
/** Deletes the selected macro file from your harddisc. */
|
||||
void DlgMacroExecuteImp::on_deleteButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = userMacroListBox->currentItem();
|
||||
QTreeWidgetItem* item = ui->userMacroListBox->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -407,8 +411,8 @@ void DlgMacroExecuteImp::on_deleteButton_clicked()
|
||||
{
|
||||
QDir dir(this->macroPath);
|
||||
dir.remove(fn);
|
||||
int index = userMacroListBox->indexOfTopLevelItem(item);
|
||||
userMacroListBox->takeTopLevelItem(index);
|
||||
int index = ui->userMacroListBox->indexOfTopLevelItem(item);
|
||||
ui->userMacroListBox->takeTopLevelItem(index);
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
@@ -448,7 +452,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem* item = userMacroListBox->currentItem();
|
||||
QTreeWidgetItem* item = ui->userMacroListBox->currentItem();
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -659,9 +663,9 @@ void DlgMacroExecuteImp::on_renameButton_clicked()
|
||||
QDir dir;
|
||||
QTreeWidgetItem* item = 0;
|
||||
|
||||
int index = tabMacroWidget->currentIndex();
|
||||
int index = ui->tabMacroWidget->currentIndex();
|
||||
if (index == 0) { //user-specific
|
||||
item = userMacroListBox->currentItem();
|
||||
item = ui->userMacroListBox->currentItem();
|
||||
dir.setPath(this->macroPath);
|
||||
}
|
||||
|
||||
@@ -692,7 +696,7 @@ void DlgMacroExecuteImp::on_renameButton_clicked()
|
||||
else {
|
||||
// keep the item selected although it's not necessarily in alphabetic order
|
||||
item->setText(0, fn);
|
||||
LineEditMacroName->setText(fn);
|
||||
ui->LineEditMacroName->setText(fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,9 +712,9 @@ void DlgMacroExecuteImp::on_duplicateButton_clicked()
|
||||
QDir dir;
|
||||
QTreeWidgetItem* item = 0;
|
||||
|
||||
int index = tabMacroWidget->currentIndex();
|
||||
int index = ui->tabMacroWidget->currentIndex();
|
||||
if (index == 0) { //user-specific
|
||||
item = userMacroListBox->currentItem();
|
||||
item = ui->userMacroListBox->currentItem();
|
||||
dir.setPath(this->macroPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,18 +24,22 @@
|
||||
#ifndef GUI_DIALOG_DLGMACROEXECUTEIMP_H
|
||||
#define GUI_DIALOG_DLGMACROEXECUTEIMP_H
|
||||
|
||||
#include "ui_DlgMacroExecute.h"
|
||||
#include "Window.h"
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
|
||||
class QTreeWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgMacroExecute;
|
||||
|
||||
/**
|
||||
* The DlgMacroExecuteImp class implements a dialog to execute or edit a
|
||||
* recorded macro.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgMacroExecuteImp : public QDialog, public Ui_DlgMacroExecute, public Gui::WindowParameter
|
||||
class DlgMacroExecuteImp : public QDialog, public Gui::WindowParameter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -65,6 +69,9 @@ protected:
|
||||
|
||||
protected:
|
||||
QString macroPath;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgMacroExecute> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -1,82 +1,101 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Gui::Dialog::DlgMacroRecord</class>
|
||||
<widget class="QDialog" name="Gui::Dialog::DlgMacroRecord" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="Gui::Dialog::DlgMacroRecord">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>166</height>
|
||||
<width>302</width>
|
||||
<height>229</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Macro recording</string>
|
||||
</property>
|
||||
<property name="modal" >
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Macro name:</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="topMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLineEdit" name="lineEditPath" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="lineEditPath"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Macro path:</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditMacroPath" >
|
||||
<property name="enabled" >
|
||||
<widget class="QLineEdit" name="lineEditMacroPath">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonChooseDir" >
|
||||
<property name="maximumSize" >
|
||||
<widget class="QPushButton" name="pushButtonChooseDir">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>35</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -85,29 +104,38 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonStart" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="buttonStart">
|
||||
<property name="text">
|
||||
<string>Record</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>27</height>
|
||||
@@ -116,18 +144,18 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonStop" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="buttonStop">
|
||||
<property name="text">
|
||||
<string>Stop</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonCancel" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="buttonCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -136,7 +164,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<tabstops>
|
||||
<tabstop>lineEditPath</tabstop>
|
||||
<tabstop>buttonStart</tabstop>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "Application.h"
|
||||
#include "MainWindow.h"
|
||||
#include "DlgMacroRecordImp.h"
|
||||
#include "ui_DlgMacroRecord.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
|
||||
@@ -48,9 +49,11 @@ using namespace Gui::Dialog;
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgMacroRecordImp::DlgMacroRecordImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
: QDialog(parent, fl), WindowParameter("Macro")
|
||||
: QDialog(parent, fl)
|
||||
, WindowParameter("Macro")
|
||||
, ui(new Ui_DlgMacroRecord)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
// get the macro home path
|
||||
this->macroPath = QString::fromUtf8(getWindowParameter()->GetASCII("MacroPath",
|
||||
@@ -58,13 +61,13 @@ DlgMacroRecordImp::DlgMacroRecordImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
this->macroPath = QDir::toNativeSeparators(QDir(this->macroPath).path() + QDir::separator());
|
||||
|
||||
// set the edit fields
|
||||
this->lineEditMacroPath->setText(macroPath);
|
||||
ui->lineEditMacroPath->setText(macroPath);
|
||||
|
||||
// get a pointer to the macro manager
|
||||
this->macroManager = Application::Instance->macroManager();
|
||||
|
||||
// check if a macro recording is in progress
|
||||
this->macroManager->isOpen() ? buttonStart->setEnabled(false) : buttonStop->setEnabled(false);
|
||||
this->macroManager->isOpen() ? ui->buttonStart->setEnabled(false) : ui->buttonStop->setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,7 +84,7 @@ DlgMacroRecordImp::~DlgMacroRecordImp()
|
||||
void DlgMacroRecordImp::on_buttonStart_clicked()
|
||||
{
|
||||
// test if the path already set
|
||||
if (lineEditPath->text().isEmpty()) {
|
||||
if (ui->lineEditPath->text().isEmpty()) {
|
||||
QMessageBox::information(getMainWindow(), tr("Macro recorder"),
|
||||
tr("Specify first a place to save."));
|
||||
return;
|
||||
@@ -95,7 +98,7 @@ void DlgMacroRecordImp::on_buttonStart_clicked()
|
||||
}
|
||||
|
||||
// search in the macro path first for an already existing macro
|
||||
QString fn = this->macroPath + lineEditPath->text();
|
||||
QString fn = this->macroPath + ui->lineEditPath->text();
|
||||
if (!fn.endsWith(QLatin1String(".FCMacro"))) fn += QLatin1String(".FCMacro");
|
||||
QFileInfo fi(fn);
|
||||
if (fi.isFile() && fi.exists()) {
|
||||
@@ -151,7 +154,7 @@ void DlgMacroRecordImp::on_pushButtonChooseDir_clicked()
|
||||
QString newDir = QFileDialog::getExistingDirectory(0,tr("Choose macro directory"),macroPath);
|
||||
if (!newDir.isEmpty()) {
|
||||
macroPath = QDir::toNativeSeparators(newDir + QDir::separator());
|
||||
this->lineEditMacroPath->setText(macroPath);
|
||||
ui->lineEditMacroPath->setText(macroPath);
|
||||
getWindowParameter()->SetASCII("MacroPath",macroPath.toUtf8());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,19 +24,21 @@
|
||||
#ifndef GUI_DIALOG_DLGMACRORECORDIMP_H
|
||||
#define GUI_DIALOG_DLGMACRORECORDIMP_H
|
||||
|
||||
#include "ui_DlgMacroRecord.h"
|
||||
#include "Window.h"
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace Gui {
|
||||
class MacroManager;
|
||||
namespace Dialog {
|
||||
class Ui_DlgMacroRecord;
|
||||
|
||||
/**
|
||||
* The DlgMacroRecordImp class implements a dialog to record a macro.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgMacroRecordImp : public QDialog, public Ui_DlgMacroRecord, public Gui::WindowParameter
|
||||
class DlgMacroRecordImp : public QDialog, public Gui::WindowParameter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -51,7 +53,8 @@ protected Q_SLOTS:
|
||||
void on_pushButtonChooseDir_clicked();
|
||||
void on_lineEditMacroPath_textChanged ( const QString & );
|
||||
|
||||
protected:
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgMacroRecord> ui;
|
||||
/// convenience pointer
|
||||
MacroManager* macroManager;
|
||||
QString macroPath; // Macro file to save in
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <App/Material.h>
|
||||
|
||||
#include "DlgMaterialPropertiesImp.h"
|
||||
#include "ui_DlgMaterialProperties.h"
|
||||
#include "Widgets.h"
|
||||
#include "SpinBox.h"
|
||||
#include "ViewProvider.h"
|
||||
@@ -44,19 +45,21 @@ using namespace Gui::Dialog;
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgMaterialPropertiesImp::DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent, Qt::WindowFlags fl)
|
||||
: QDialog(parent, fl), material(mat)
|
||||
: QDialog(parent, fl)
|
||||
, ui(new Ui_DlgMaterialProperties)
|
||||
, material(mat)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
if (material != "ShapeMaterial") {
|
||||
this->textLabel1->hide();
|
||||
this->diffuseColor->hide();
|
||||
ui->textLabel1->hide();
|
||||
ui->diffuseColor->hide();
|
||||
}
|
||||
|
||||
//#if !defined(Q_OS_MAC)
|
||||
ambientColor->setAutoChangeColor(true);
|
||||
diffuseColor->setAutoChangeColor(true);
|
||||
emissiveColor->setAutoChangeColor(true);
|
||||
specularColor->setAutoChangeColor(true);
|
||||
ui->ambientColor->setAutoChangeColor(true);
|
||||
ui->diffuseColor->setAutoChangeColor(true);
|
||||
ui->emissiveColor->setAutoChangeColor(true);
|
||||
ui->specularColor->setAutoChangeColor(true);
|
||||
//#endif
|
||||
}
|
||||
|
||||
@@ -67,12 +70,17 @@ DlgMaterialPropertiesImp::~DlgMaterialPropertiesImp()
|
||||
{
|
||||
}
|
||||
|
||||
QColor DlgMaterialPropertiesImp::diffuseColor() const
|
||||
{
|
||||
return ui->diffuseColor->color();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ambient color.
|
||||
*/
|
||||
void DlgMaterialPropertiesImp::on_ambientColor_changed()
|
||||
{
|
||||
QColor col = ambientColor->color();
|
||||
QColor col = ui->ambientColor->color();
|
||||
float r = (float)col.red()/255.0f;
|
||||
float g = (float)col.green()/255.0f;
|
||||
float b = (float)col.blue()/255.0f;
|
||||
@@ -94,7 +102,7 @@ void DlgMaterialPropertiesImp::on_ambientColor_changed()
|
||||
*/
|
||||
void DlgMaterialPropertiesImp::on_diffuseColor_changed()
|
||||
{
|
||||
QColor col = diffuseColor->color();
|
||||
QColor col = ui->diffuseColor->color();
|
||||
float r = (float)col.red()/255.0f;
|
||||
float g = (float)col.green()/255.0f;
|
||||
float b = (float)col.blue()/255.0f;
|
||||
@@ -116,7 +124,7 @@ void DlgMaterialPropertiesImp::on_diffuseColor_changed()
|
||||
*/
|
||||
void DlgMaterialPropertiesImp::on_emissiveColor_changed()
|
||||
{
|
||||
QColor col = emissiveColor->color();
|
||||
QColor col = ui->emissiveColor->color();
|
||||
float r = (float)col.red()/255.0f;
|
||||
float g = (float)col.green()/255.0f;
|
||||
float b = (float)col.blue()/255.0f;
|
||||
@@ -138,7 +146,7 @@ void DlgMaterialPropertiesImp::on_emissiveColor_changed()
|
||||
*/
|
||||
void DlgMaterialPropertiesImp::on_specularColor_changed()
|
||||
{
|
||||
QColor col = specularColor->color();
|
||||
QColor col = ui->specularColor->color();
|
||||
float r = (float)col.red()/255.0f;
|
||||
float g = (float)col.green()/255.0f;
|
||||
float b = (float)col.blue()/255.0f;
|
||||
@@ -187,22 +195,22 @@ void DlgMaterialPropertiesImp::setViewProviders(const std::vector<Gui::ViewProvi
|
||||
int r = int(mat.ambientColor.r * 255.0f);
|
||||
int g = int(mat.ambientColor.g * 255.0f);
|
||||
int b = int(mat.ambientColor.b * 255.0f);
|
||||
ambientColor->setColor( QColor(r,g,b) );
|
||||
ui->ambientColor->setColor( QColor(r,g,b) );
|
||||
r = int(mat.diffuseColor.r * 255.0f);
|
||||
g = int(mat.diffuseColor.g * 255.0f);
|
||||
b = int(mat.diffuseColor.b * 255.0f);
|
||||
diffuseColor->setColor( QColor(r,g,b) );
|
||||
ui->diffuseColor->setColor( QColor(r,g,b) );
|
||||
r = int(mat.emissiveColor.r * 255.0f);
|
||||
g = int(mat.emissiveColor.g * 255.0f);
|
||||
b = int(mat.emissiveColor.b * 255.0f);
|
||||
emissiveColor->setColor( QColor(r,g,b) );
|
||||
ui->emissiveColor->setColor( QColor(r,g,b) );
|
||||
r = int(mat.specularColor.r * 255.0f);
|
||||
g = int(mat.specularColor.g * 255.0f);
|
||||
b = int(mat.specularColor.b * 255.0f);
|
||||
specularColor->setColor( QColor(r,g,b) );
|
||||
shininess->blockSignals(true);
|
||||
shininess->setValue((int)(100.0f * (mat.shininess+0.001f)));
|
||||
shininess->blockSignals(false);
|
||||
ui->specularColor->setColor( QColor(r,g,b) );
|
||||
ui->shininess->blockSignals(true);
|
||||
ui->shininess->setValue((int)(100.0f * (mat.shininess+0.001f)));
|
||||
ui->shininess->blockSignals(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,15 +24,17 @@
|
||||
#ifndef GUI_DIALOG_DLGMATERIALPROPERTIES_IMP_H
|
||||
#define GUI_DIALOG_DLGMATERIALPROPERTIES_IMP_H
|
||||
|
||||
#include "ui_DlgMaterialProperties.h"
|
||||
#include <QDialog>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
class ViewProvider;
|
||||
|
||||
namespace Dialog {
|
||||
class Ui_DlgMaterialProperties;
|
||||
|
||||
class DlgMaterialPropertiesImp : public QDialog, public Ui_DlgMaterialProperties
|
||||
class DlgMaterialPropertiesImp : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -40,6 +42,7 @@ public:
|
||||
DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent = 0, Qt::WindowFlags fl = 0);
|
||||
~DlgMaterialPropertiesImp();
|
||||
void setViewProviders(const std::vector<Gui::ViewProvider*>&);
|
||||
QColor diffuseColor() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void on_ambientColor_changed();
|
||||
@@ -49,6 +52,7 @@ public Q_SLOTS:
|
||||
void on_shininess_valueChanged(int);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgMaterialProperties> ui;
|
||||
std::string material;
|
||||
std::vector<Gui::ViewProvider*> Objects;
|
||||
};
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgOnlineHelpImp.h"
|
||||
#include "ui_DlgOnlineHelp.h"
|
||||
#include "PrefWidgets.h"
|
||||
|
||||
#include <Base/Parameter.h>
|
||||
@@ -46,12 +47,13 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgOnlineHelpImp::DlgOnlineHelpImp( QWidget* parent )
|
||||
: PreferencePage(parent)
|
||||
, ui(new Ui_DlgOnlineHelp)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
prefStartPage->setFilter(QString::fromLatin1("%1 (*.html *.htm)").arg(tr("HTML files")));
|
||||
if (prefStartPage->fileName().isEmpty()) {
|
||||
prefStartPage->setFileName(getStartpage());
|
||||
ui->prefStartPage->setFilter(QString::fromLatin1("%1 (*.html *.htm)").arg(tr("HTML files")));
|
||||
if (ui->prefStartPage->fileName().isEmpty()) {
|
||||
ui->prefStartPage->setFileName(getStartpage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,12 +78,12 @@ QString DlgOnlineHelpImp::getStartpage()
|
||||
|
||||
void DlgOnlineHelpImp::saveSettings()
|
||||
{
|
||||
prefStartPage->onSave();
|
||||
ui->prefStartPage->onSave();
|
||||
}
|
||||
|
||||
void DlgOnlineHelpImp::loadSettings()
|
||||
{
|
||||
prefStartPage->onRestore();
|
||||
ui->prefStartPage->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +92,7 @@ void DlgOnlineHelpImp::loadSettings()
|
||||
void DlgOnlineHelpImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
|
||||
@@ -24,18 +24,19 @@
|
||||
#ifndef GUI_DIALOG_DLGONLINEHELP_IMP_H
|
||||
#define GUI_DIALOG_DLGONLINEHELP_IMP_H
|
||||
|
||||
#include "ui_DlgOnlineHelp.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgOnlineHelp;
|
||||
|
||||
/** This class implements the dialog for downloading the online documentation.
|
||||
* Moreover it allows to specify location of the start page an an external browser.
|
||||
* Here you can specify to use a proxy if necessary and some more stuff.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgOnlineHelpImp : public PreferencePage, public Ui_DlgOnlineHelp
|
||||
class DlgOnlineHelpImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -53,6 +54,9 @@ protected:
|
||||
|
||||
protected:
|
||||
void on_lineEditDownload_fileNameSelected(const QString&);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgOnlineHelp> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgReportViewImp.h"
|
||||
#include "ui_DlgReportView.h"
|
||||
#include "PrefWidgets.h"
|
||||
|
||||
|
||||
@@ -43,8 +44,9 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgReportViewImp::DlgReportViewImp( QWidget* parent )
|
||||
: PreferencePage(parent)
|
||||
, ui(new Ui_DlgReportView)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,34 +58,34 @@ DlgReportViewImp::~DlgReportViewImp()
|
||||
|
||||
void DlgReportViewImp::saveSettings()
|
||||
{
|
||||
checkLogging->onSave();
|
||||
checkWarning->onSave();
|
||||
checkError->onSave();
|
||||
checkShowReportViewOnWarningOrError->onSave();
|
||||
colorText->onSave();
|
||||
colorLogging->onSave();
|
||||
colorWarning->onSave();
|
||||
colorError->onSave();
|
||||
pythonOutput->onSave();
|
||||
pythonError->onSave();
|
||||
ui->checkLogging->onSave();
|
||||
ui->checkWarning->onSave();
|
||||
ui->checkError->onSave();
|
||||
ui->checkShowReportViewOnWarningOrError->onSave();
|
||||
ui->colorText->onSave();
|
||||
ui->colorLogging->onSave();
|
||||
ui->colorWarning->onSave();
|
||||
ui->colorError->onSave();
|
||||
ui->pythonOutput->onSave();
|
||||
ui->pythonError->onSave();
|
||||
}
|
||||
|
||||
void DlgReportViewImp::loadSettings()
|
||||
{
|
||||
checkLogging->onRestore();
|
||||
checkWarning->onRestore();
|
||||
checkError->onRestore();
|
||||
checkShowReportViewOnWarningOrError->onRestore();
|
||||
colorText->onRestore();
|
||||
colorLogging->onRestore();
|
||||
colorWarning->onRestore();
|
||||
colorError->onRestore();
|
||||
pythonOutput->blockSignals(true);
|
||||
pythonOutput->onRestore();
|
||||
pythonOutput->blockSignals(false);
|
||||
pythonError->blockSignals(true);
|
||||
pythonError->onRestore();
|
||||
pythonError->blockSignals(false);
|
||||
ui->checkLogging->onRestore();
|
||||
ui->checkWarning->onRestore();
|
||||
ui->checkError->onRestore();
|
||||
ui->checkShowReportViewOnWarningOrError->onRestore();
|
||||
ui->colorText->onRestore();
|
||||
ui->colorLogging->onRestore();
|
||||
ui->colorWarning->onRestore();
|
||||
ui->colorError->onRestore();
|
||||
ui->pythonOutput->blockSignals(true);
|
||||
ui->pythonOutput->onRestore();
|
||||
ui->pythonOutput->blockSignals(false);
|
||||
ui->pythonError->blockSignals(true);
|
||||
ui->pythonError->onRestore();
|
||||
ui->pythonError->blockSignals(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +94,7 @@ void DlgReportViewImp::loadSettings()
|
||||
void DlgReportViewImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
|
||||
@@ -24,17 +24,18 @@
|
||||
#ifndef GUI_DIALOG_DLG_REPORT_VIEW_IMP
|
||||
#define GUI_DIALOG_DLG_REPORT_VIEW_IMP
|
||||
|
||||
#include "ui_DlgReportView.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgReportView;
|
||||
|
||||
/** The DlgReportViewImp class implements the available settings for the
|
||||
* report output window to change.
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgReportViewImp : public PreferencePage, public Ui_DlgReportView
|
||||
class DlgReportViewImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -47,6 +48,9 @@ public:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgReportView> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgSettings3DViewImp.h"
|
||||
#include "ui_DlgSettings3DView.h"
|
||||
#include "MainWindow.h"
|
||||
#include "NavigationStyle.h"
|
||||
#include "PrefWidgets.h"
|
||||
@@ -56,9 +57,10 @@ bool DlgSettings3DViewImp::showMsg = true;
|
||||
*/
|
||||
DlgSettings3DViewImp::DlgSettings3DViewImp(QWidget* parent)
|
||||
: PreferencePage( parent )
|
||||
, ui(new Ui_DlgSettings3DView)
|
||||
, q0(0), q1(0), q2(0), q3(1)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
retranslate();
|
||||
}
|
||||
|
||||
@@ -76,43 +78,43 @@ void DlgSettings3DViewImp::saveSettings()
|
||||
// where we set some attributes afterwards
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View");
|
||||
QVariant data = comboNavigationStyle->itemData(comboNavigationStyle->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole);
|
||||
hGrp->SetASCII("NavigationStyle", (const char*)data.toByteArray());
|
||||
|
||||
int index = comboOrbitStyle->currentIndex();
|
||||
int index = ui->comboOrbitStyle->currentIndex();
|
||||
hGrp->SetInt("OrbitStyle", index);
|
||||
|
||||
index = this->comboAliasing->currentIndex();
|
||||
index = ui->comboAliasing->currentIndex();
|
||||
hGrp->SetInt("AntiAliasing", index);
|
||||
|
||||
index = this->naviCubeCorner->currentIndex();
|
||||
index = ui->naviCubeCorner->currentIndex();
|
||||
hGrp->SetInt("CornerNaviCube", index);
|
||||
|
||||
index = this->renderCache->currentIndex();
|
||||
index = ui->renderCache->currentIndex();
|
||||
hGrp->SetInt("RenderCache", index);
|
||||
|
||||
QVariant const &vBoxMarkerSize = this->boxMarkerSize->itemData(this->boxMarkerSize->currentIndex());
|
||||
QVariant const &vBoxMarkerSize = ui->boxMarkerSize->itemData(ui->boxMarkerSize->currentIndex());
|
||||
hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt());
|
||||
|
||||
checkBoxZoomAtCursor->onSave();
|
||||
checkBoxInvertZoom->onSave();
|
||||
checkBoxDisableTilt->onSave();
|
||||
spinBoxZoomStep->onSave();
|
||||
checkBoxDragAtCursor->onSave();
|
||||
CheckBox_CornerCoordSystem->onSave();
|
||||
CheckBox_ShowFPS->onSave();
|
||||
CheckBox_useVBO->onSave();
|
||||
CheckBox_NaviCube->onSave();
|
||||
CheckBox_UseAutoRotation->onSave();
|
||||
FloatSpinBox_EyeDistance->onSave();
|
||||
checkBoxBacklight->onSave();
|
||||
backlightColor->onSave();
|
||||
sliderIntensity->onSave();
|
||||
radioPerspective->onSave();
|
||||
radioOrthographic->onSave();
|
||||
qspinNewDocScale->onSave();
|
||||
ui->checkBoxZoomAtCursor->onSave();
|
||||
ui->checkBoxInvertZoom->onSave();
|
||||
ui->checkBoxDisableTilt->onSave();
|
||||
ui->spinBoxZoomStep->onSave();
|
||||
ui->checkBoxDragAtCursor->onSave();
|
||||
ui->CheckBox_CornerCoordSystem->onSave();
|
||||
ui->CheckBox_ShowFPS->onSave();
|
||||
ui->CheckBox_useVBO->onSave();
|
||||
ui->CheckBox_NaviCube->onSave();
|
||||
ui->CheckBox_UseAutoRotation->onSave();
|
||||
ui->FloatSpinBox_EyeDistance->onSave();
|
||||
ui->checkBoxBacklight->onSave();
|
||||
ui->backlightColor->onSave();
|
||||
ui->sliderIntensity->onSave();
|
||||
ui->radioPerspective->onSave();
|
||||
ui->radioOrthographic->onSave();
|
||||
ui->qspinNewDocScale->onSave();
|
||||
|
||||
QVariant camera = comboNewDocView->itemData(comboNewDocView->currentIndex(), Qt::UserRole);
|
||||
QVariant camera = ui->comboNewDocView->itemData(ui->comboNewDocView->currentIndex(), Qt::UserRole);
|
||||
hGrp->SetASCII("NewDocumentCameraOrientation", (const char*)camera.toByteArray());
|
||||
if (camera == QByteArray("Custom")) {
|
||||
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
|
||||
@@ -125,71 +127,71 @@ void DlgSettings3DViewImp::saveSettings()
|
||||
|
||||
void DlgSettings3DViewImp::loadSettings()
|
||||
{
|
||||
checkBoxZoomAtCursor->onRestore();
|
||||
checkBoxInvertZoom->onRestore();
|
||||
checkBoxDisableTilt->onRestore();
|
||||
spinBoxZoomStep->onRestore();
|
||||
checkBoxDragAtCursor->onRestore();
|
||||
CheckBox_CornerCoordSystem->onRestore();
|
||||
CheckBox_ShowFPS->onRestore();
|
||||
CheckBox_useVBO->onRestore();
|
||||
CheckBox_NaviCube->onRestore();
|
||||
CheckBox_UseAutoRotation->onRestore();
|
||||
FloatSpinBox_EyeDistance->onRestore();
|
||||
checkBoxBacklight->onRestore();
|
||||
backlightColor->onRestore();
|
||||
sliderIntensity->onRestore();
|
||||
radioPerspective->onRestore();
|
||||
radioOrthographic->onRestore();
|
||||
qspinNewDocScale->onRestore();
|
||||
ui->checkBoxZoomAtCursor->onRestore();
|
||||
ui->checkBoxInvertZoom->onRestore();
|
||||
ui->checkBoxDisableTilt->onRestore();
|
||||
ui->spinBoxZoomStep->onRestore();
|
||||
ui->checkBoxDragAtCursor->onRestore();
|
||||
ui->CheckBox_CornerCoordSystem->onRestore();
|
||||
ui->CheckBox_ShowFPS->onRestore();
|
||||
ui->CheckBox_useVBO->onRestore();
|
||||
ui->CheckBox_NaviCube->onRestore();
|
||||
ui->CheckBox_UseAutoRotation->onRestore();
|
||||
ui->FloatSpinBox_EyeDistance->onRestore();
|
||||
ui->checkBoxBacklight->onRestore();
|
||||
ui->backlightColor->onRestore();
|
||||
ui->sliderIntensity->onRestore();
|
||||
ui->radioPerspective->onRestore();
|
||||
ui->radioOrthographic->onRestore();
|
||||
ui->qspinNewDocScale->onRestore();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/View");
|
||||
std::string model = hGrp->GetASCII("NavigationStyle",CADNavigationStyle::getClassTypeId().getName());
|
||||
int index = comboNavigationStyle->findData(QByteArray(model.c_str()));
|
||||
if (index > -1) comboNavigationStyle->setCurrentIndex(index);
|
||||
int index = ui->comboNavigationStyle->findData(QByteArray(model.c_str()));
|
||||
if (index > -1) ui->comboNavigationStyle->setCurrentIndex(index);
|
||||
|
||||
index = hGrp->GetInt("OrbitStyle", int(NavigationStyle::Trackball));
|
||||
index = Base::clamp(index, 0, comboOrbitStyle->count()-1);
|
||||
comboOrbitStyle->setCurrentIndex(index);
|
||||
index = Base::clamp(index, 0, ui->comboOrbitStyle->count()-1);
|
||||
ui->comboOrbitStyle->setCurrentIndex(index);
|
||||
|
||||
index = hGrp->GetInt("AntiAliasing", int(Gui::View3DInventorViewer::None));
|
||||
index = Base::clamp(index, 0, comboAliasing->count()-1);
|
||||
comboAliasing->setCurrentIndex(index);
|
||||
index = Base::clamp(index, 0, ui->comboAliasing->count()-1);
|
||||
ui->comboAliasing->setCurrentIndex(index);
|
||||
// connect after setting current item of the combo box
|
||||
connect(comboAliasing, SIGNAL(currentIndexChanged(int)),
|
||||
connect(ui->comboAliasing, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onAliasingChanged(int)));
|
||||
|
||||
index = hGrp->GetInt("CornerNaviCube", 1);
|
||||
naviCubeCorner->setCurrentIndex(index);
|
||||
ui->naviCubeCorner->setCurrentIndex(index);
|
||||
|
||||
index = hGrp->GetInt("RenderCache", 0);
|
||||
renderCache->setCurrentIndex(index);
|
||||
ui->renderCache->setCurrentIndex(index);
|
||||
|
||||
int const current = hGrp->GetInt("MarkerSize", 9L);
|
||||
this->boxMarkerSize->addItem(tr("5px"), QVariant(5));
|
||||
this->boxMarkerSize->addItem(tr("7px"), QVariant(7));
|
||||
this->boxMarkerSize->addItem(tr("9px"), QVariant(9));
|
||||
this->boxMarkerSize->addItem(tr("11px"), QVariant(11));
|
||||
this->boxMarkerSize->addItem(tr("13px"), QVariant(13));
|
||||
this->boxMarkerSize->addItem(tr("15px"), QVariant(15));
|
||||
index = this->boxMarkerSize->findData(QVariant(current));
|
||||
ui->boxMarkerSize->addItem(tr("5px"), QVariant(5));
|
||||
ui->boxMarkerSize->addItem(tr("7px"), QVariant(7));
|
||||
ui->boxMarkerSize->addItem(tr("9px"), QVariant(9));
|
||||
ui->boxMarkerSize->addItem(tr("11px"), QVariant(11));
|
||||
ui->boxMarkerSize->addItem(tr("13px"), QVariant(13));
|
||||
ui->boxMarkerSize->addItem(tr("15px"), QVariant(15));
|
||||
index = ui->boxMarkerSize->findData(QVariant(current));
|
||||
if (index < 0) index = 2;
|
||||
this->boxMarkerSize->setCurrentIndex(index);
|
||||
ui->boxMarkerSize->setCurrentIndex(index);
|
||||
|
||||
comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric"));
|
||||
comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric"));
|
||||
comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric"));
|
||||
comboNewDocView->addItem(tr("Top"), QByteArray("Top"));
|
||||
comboNewDocView->addItem(tr("Front"), QByteArray("Front"));
|
||||
comboNewDocView->addItem(tr("Left"), QByteArray("Left"));
|
||||
comboNewDocView->addItem(tr("Right"), QByteArray("Right"));
|
||||
comboNewDocView->addItem(tr("Rear"), QByteArray("Rear"));
|
||||
comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom"));
|
||||
comboNewDocView->addItem(tr("Custom"), QByteArray("Custom"));
|
||||
ui->comboNewDocView->addItem(tr("Isometric"), QByteArray("Isometric"));
|
||||
ui->comboNewDocView->addItem(tr("Dimetric"), QByteArray("Dimetric"));
|
||||
ui->comboNewDocView->addItem(tr("Trimetric"), QByteArray("Trimetric"));
|
||||
ui->comboNewDocView->addItem(tr("Top"), QByteArray("Top"));
|
||||
ui->comboNewDocView->addItem(tr("Front"), QByteArray("Front"));
|
||||
ui->comboNewDocView->addItem(tr("Left"), QByteArray("Left"));
|
||||
ui->comboNewDocView->addItem(tr("Right"), QByteArray("Right"));
|
||||
ui->comboNewDocView->addItem(tr("Rear"), QByteArray("Rear"));
|
||||
ui->comboNewDocView->addItem(tr("Bottom"), QByteArray("Bottom"));
|
||||
ui->comboNewDocView->addItem(tr("Custom"), QByteArray("Custom"));
|
||||
std::string camera = hGrp->GetASCII("NewDocumentCameraOrientation", "Trimetric");
|
||||
index = comboNewDocView->findData(QByteArray(camera.c_str()));
|
||||
if (index > -1) comboNewDocView->setCurrentIndex(index);
|
||||
index = ui->comboNewDocView->findData(QByteArray(camera.c_str()));
|
||||
if (index > -1) ui->comboNewDocView->setCurrentIndex(index);
|
||||
if (camera == "Custom") {
|
||||
ParameterGrp::handle hCustom = hGrp->GetGroup("Custom");
|
||||
q0 = hCustom->GetFloat("Q0", q0);
|
||||
@@ -198,33 +200,33 @@ void DlgSettings3DViewImp::loadSettings()
|
||||
q3 = hCustom->GetFloat("Q3", q3);
|
||||
}
|
||||
|
||||
connect(comboNewDocView, SIGNAL(currentIndexChanged(int)),
|
||||
connect(ui->comboNewDocView, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onNewDocViewChanged(int)));
|
||||
}
|
||||
|
||||
void DlgSettings3DViewImp::on_mouseButton_clicked()
|
||||
{
|
||||
QDialog dlg(this);
|
||||
Ui_MouseButtons ui;
|
||||
ui.setupUi(&dlg);
|
||||
Ui_MouseButtons uimb;
|
||||
uimb.setupUi(&dlg);
|
||||
|
||||
QVariant data = comboNavigationStyle->itemData(comboNavigationStyle->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->comboNavigationStyle->itemData(ui->comboNavigationStyle->currentIndex(), Qt::UserRole);
|
||||
void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray());
|
||||
std::unique_ptr<UserNavigationStyle> ns(static_cast<UserNavigationStyle*>(instance));
|
||||
ui.groupBox->setTitle(ui.groupBox->title()+QString::fromLatin1(" ")+comboNavigationStyle->currentText());
|
||||
uimb.groupBox->setTitle(uimb.groupBox->title()+QString::fromLatin1(" ")+ui->comboNavigationStyle->currentText());
|
||||
QString descr;
|
||||
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION));
|
||||
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
|
||||
ui.selectionLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
uimb.selectionLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING));
|
||||
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
|
||||
ui.panningLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
uimb.panningLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING));
|
||||
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
|
||||
ui.rotationLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
uimb.rotationLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING));
|
||||
descr.replace(QLatin1String("\n"), QLatin1String("<p>"));
|
||||
ui.zoomingLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
uimb.zoomingLabel->setText(QString::fromLatin1("<b>%1</b>").arg(descr));
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
@@ -234,18 +236,18 @@ void DlgSettings3DViewImp::on_mouseButton_clicked()
|
||||
void DlgSettings3DViewImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
comboAliasing->blockSignals(true);
|
||||
int navigation = comboNavigationStyle->currentIndex();
|
||||
int orbit = comboOrbitStyle->currentIndex();
|
||||
int aliasing = comboAliasing->currentIndex();
|
||||
int corner = naviCubeCorner->currentIndex();
|
||||
retranslateUi(this);
|
||||
ui->comboAliasing->blockSignals(true);
|
||||
int navigation = ui->comboNavigationStyle->currentIndex();
|
||||
int orbit = ui->comboOrbitStyle->currentIndex();
|
||||
int aliasing = ui->comboAliasing->currentIndex();
|
||||
int corner = ui->naviCubeCorner->currentIndex();
|
||||
ui->retranslateUi(this);
|
||||
retranslate();
|
||||
comboNavigationStyle->setCurrentIndex(navigation);
|
||||
comboOrbitStyle->setCurrentIndex(orbit);
|
||||
comboAliasing->setCurrentIndex(aliasing);
|
||||
comboAliasing->blockSignals(false);
|
||||
naviCubeCorner->setCurrentIndex(corner);
|
||||
ui->comboNavigationStyle->setCurrentIndex(navigation);
|
||||
ui->comboOrbitStyle->setCurrentIndex(orbit);
|
||||
ui->comboAliasing->setCurrentIndex(aliasing);
|
||||
ui->comboAliasing->blockSignals(false);
|
||||
ui->naviCubeCorner->setCurrentIndex(corner);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
@@ -254,7 +256,7 @@ void DlgSettings3DViewImp::changeEvent(QEvent *e)
|
||||
|
||||
void DlgSettings3DViewImp::retranslate()
|
||||
{
|
||||
comboNavigationStyle->clear();
|
||||
ui->comboNavigationStyle->clear();
|
||||
|
||||
// add submenu at the end to select navigation style
|
||||
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
|
||||
@@ -262,7 +264,7 @@ void DlgSettings3DViewImp::retranslate()
|
||||
QByteArray data(it->first.getName());
|
||||
QString name = QApplication::translate(it->first.getName(), it->second.c_str());
|
||||
|
||||
comboNavigationStyle->addItem(name, data);
|
||||
ui->comboNavigationStyle->addItem(name, data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +283,7 @@ void DlgSettings3DViewImp::onAliasingChanged(int index)
|
||||
|
||||
void DlgSettings3DViewImp::onNewDocViewChanged(int index)
|
||||
{
|
||||
QVariant camera = comboNewDocView->itemData(index, Qt::UserRole);
|
||||
QVariant camera = ui->comboNewDocView->itemData(index, Qt::UserRole);
|
||||
if (camera == QByteArray("Custom")) {
|
||||
CameraDialog dlg(this);
|
||||
dlg.setValues(q0, q1, q2, q3);
|
||||
|
||||
@@ -24,18 +24,21 @@
|
||||
#ifndef GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
|
||||
#define GUI_DIALOG_DLGSETTINGS3DVIEWIMP_H
|
||||
|
||||
#include "ui_DlgSettings3DView.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettings3DView;
|
||||
|
||||
/**
|
||||
* The DlgSettings3DViewImp class implements a preference page to change settings
|
||||
* for the Inventor viewer.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgSettings3DViewImp : public PreferencePage, public Ui_DlgSettings3DView
|
||||
class DlgSettings3DViewImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -56,6 +59,7 @@ protected:
|
||||
void retranslate();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettings3DView> ui;
|
||||
static bool showMsg;
|
||||
double q0, q1, q2, q3;
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgSettingsColorGradientImp.h"
|
||||
#include "ui_DlgSettingsColorGradient.h"
|
||||
#include "SpinBox.h"
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
@@ -45,12 +46,13 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgSettingsColorGradientImp::DlgSettingsColorGradientImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
: QDialog( parent, fl )
|
||||
, ui(new Ui_DlgSettingsColorGradient)
|
||||
{
|
||||
this->setupUi(this);
|
||||
fMaxVal = new QDoubleValidator(-1000,1000,spinBoxDecimals->maximum(),this);
|
||||
floatLineEditMax->setValidator(fMaxVal);
|
||||
fMinVal = new QDoubleValidator(-1000,1000,spinBoxDecimals->maximum(),this);
|
||||
floatLineEditMin->setValidator(fMinVal);
|
||||
ui->setupUi(this);
|
||||
fMaxVal = new QDoubleValidator(-1000,1000,ui->spinBoxDecimals->maximum(),this);
|
||||
ui->floatLineEditMax->setValidator(fMaxVal);
|
||||
fMinVal = new QDoubleValidator(-1000,1000,ui->spinBoxDecimals->maximum(),this);
|
||||
ui->floatLineEditMin->setValidator(fMinVal);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,23 +68,23 @@ void DlgSettingsColorGradientImp::setColorModel( App::ColorGradient::TColorModel
|
||||
switch (tModel)
|
||||
{
|
||||
case App::ColorGradient::TRIA:
|
||||
comboBoxModel->setCurrentIndex(0);
|
||||
ui->comboBoxModel->setCurrentIndex(0);
|
||||
break;
|
||||
case App::ColorGradient::INVERSE_TRIA:
|
||||
comboBoxModel->setCurrentIndex(1);
|
||||
ui->comboBoxModel->setCurrentIndex(1);
|
||||
break;
|
||||
case App::ColorGradient::GRAY:
|
||||
comboBoxModel->setCurrentIndex(2);
|
||||
ui->comboBoxModel->setCurrentIndex(2);
|
||||
break;
|
||||
case App::ColorGradient::INVERSE_GRAY:
|
||||
comboBoxModel->setCurrentIndex(3);
|
||||
ui->comboBoxModel->setCurrentIndex(3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
App::ColorGradient::TColorModel DlgSettingsColorGradientImp::colorModel() const
|
||||
{
|
||||
int item = comboBoxModel->currentIndex();
|
||||
int item = ui->comboBoxModel->currentIndex();
|
||||
if ( item == 0 )
|
||||
return App::ColorGradient::TRIA;
|
||||
else if ( item == 1 )
|
||||
@@ -98,79 +100,79 @@ void DlgSettingsColorGradientImp::setColorStyle( App::ColorGradient::TStyle tSty
|
||||
switch ( tStyle )
|
||||
{
|
||||
case App::ColorGradient::FLOW:
|
||||
radioButtonFlow->setChecked(true);
|
||||
ui->radioButtonFlow->setChecked(true);
|
||||
break;
|
||||
case App::ColorGradient::ZERO_BASED:
|
||||
radioButtonZero->setChecked(true);
|
||||
ui->radioButtonZero->setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
App::ColorGradient::TStyle DlgSettingsColorGradientImp::colorStyle() const
|
||||
{
|
||||
return radioButtonZero->isChecked() ? App::ColorGradient::ZERO_BASED : App::ColorGradient::FLOW;
|
||||
return ui->radioButtonZero->isChecked() ? App::ColorGradient::ZERO_BASED : App::ColorGradient::FLOW;
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setOutGrayed( bool grayed )
|
||||
{
|
||||
checkBoxGrayed->setChecked( grayed );
|
||||
ui->checkBoxGrayed->setChecked( grayed );
|
||||
}
|
||||
|
||||
bool DlgSettingsColorGradientImp::isOutGrayed() const
|
||||
{
|
||||
return checkBoxGrayed->isChecked();
|
||||
return ui->checkBoxGrayed->isChecked();
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setOutInvisible( bool invisible )
|
||||
{
|
||||
checkBoxInvisible->setChecked( invisible );
|
||||
ui->checkBoxInvisible->setChecked( invisible );
|
||||
}
|
||||
|
||||
bool DlgSettingsColorGradientImp::isOutInvisible() const
|
||||
{
|
||||
return checkBoxInvisible->isChecked();
|
||||
return ui->checkBoxInvisible->isChecked();
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setRange( float fMin, float fMax )
|
||||
{
|
||||
floatLineEditMax->blockSignals(true);
|
||||
floatLineEditMax->setText(QLocale::system().toString(fMax, 'f', numberOfDecimals()));
|
||||
floatLineEditMax->blockSignals(false);
|
||||
floatLineEditMin->blockSignals(true);
|
||||
floatLineEditMin->setText(QLocale::system().toString(fMin, 'f', numberOfDecimals()));
|
||||
floatLineEditMin->blockSignals(false);
|
||||
ui->floatLineEditMax->blockSignals(true);
|
||||
ui->floatLineEditMax->setText(QLocale::system().toString(fMax, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMax->blockSignals(false);
|
||||
ui->floatLineEditMin->blockSignals(true);
|
||||
ui->floatLineEditMin->setText(QLocale::system().toString(fMin, 'f', numberOfDecimals()));
|
||||
ui->floatLineEditMin->blockSignals(false);
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::getRange(float& fMin, float& fMax) const
|
||||
{
|
||||
fMax = QLocale::system().toFloat(floatLineEditMax->text());
|
||||
fMin = QLocale::system().toFloat(floatLineEditMin->text());
|
||||
fMax = QLocale::system().toFloat(ui->floatLineEditMax->text());
|
||||
fMin = QLocale::system().toFloat(ui->floatLineEditMin->text());
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setNumberOfLabels(int val)
|
||||
{
|
||||
spinBoxLabel->setValue( val );
|
||||
ui->spinBoxLabel->setValue( val );
|
||||
}
|
||||
|
||||
int DlgSettingsColorGradientImp::numberOfLabels() const
|
||||
{
|
||||
return spinBoxLabel->value();
|
||||
return ui->spinBoxLabel->value();
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::setNumberOfDecimals(int val)
|
||||
{
|
||||
spinBoxDecimals->setValue(val);
|
||||
ui->spinBoxDecimals->setValue(val);
|
||||
}
|
||||
|
||||
int DlgSettingsColorGradientImp::numberOfDecimals() const
|
||||
{
|
||||
return spinBoxDecimals->value();
|
||||
return ui->spinBoxDecimals->value();
|
||||
}
|
||||
|
||||
void DlgSettingsColorGradientImp::accept()
|
||||
{
|
||||
double fMax = QLocale::system().toDouble(floatLineEditMax->text());
|
||||
double fMin = QLocale::system().toDouble(floatLineEditMin->text());
|
||||
double fMax = QLocale::system().toDouble(ui->floatLineEditMax->text());
|
||||
double fMin = QLocale::system().toDouble(ui->floatLineEditMin->text());
|
||||
|
||||
if (fMax <= fMin) {
|
||||
QMessageBox::warning(this, tr("Wrong parameter"),
|
||||
|
||||
@@ -24,19 +24,22 @@
|
||||
#ifndef GUI_DIALOG_DLGSETTINGSCOLORGRADIENT_IMP_H
|
||||
#define GUI_DIALOG_DLGSETTINGSCOLORGRADIENT_IMP_H
|
||||
|
||||
#include "ui_DlgSettingsColorGradient.h"
|
||||
#include <App/ColorModel.h>
|
||||
#include <QDialog>
|
||||
#include <memory>
|
||||
|
||||
class QDoubleValidator;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettingsColorGradient;
|
||||
|
||||
/**
|
||||
* The DlgSettingsColorGradientImp class implements a preference page to change settings
|
||||
* for the color gradient bar.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class DlgSettingsColorGradientImp : public QDialog, public Ui_DlgSettingsColorGradient
|
||||
class DlgSettingsColorGradientImp : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -74,6 +77,7 @@ public:
|
||||
//@}
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsColorGradient> ui;
|
||||
QDoubleValidator* fMaxVal;
|
||||
QDoubleValidator* fMinVal;
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <zlib.h>
|
||||
|
||||
#include "DlgSettingsDocumentImp.h"
|
||||
#include "ui_DlgSettingsDocument.h"
|
||||
#include "PrefWidgets.h"
|
||||
#include "AutoSaver.h"
|
||||
|
||||
@@ -39,15 +40,16 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgSettingsDocumentImp::DlgSettingsDocumentImp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
, ui(new Ui_DlgSettingsDocument)
|
||||
{
|
||||
this->setupUi(this);
|
||||
prefSaveTransaction->hide();
|
||||
prefDiscardTransaction->hide();
|
||||
ui->setupUi(this);
|
||||
ui->prefSaveTransaction->hide();
|
||||
ui->prefDiscardTransaction->hide();
|
||||
|
||||
prefCountBackupFiles->setMaximum(INT_MAX);
|
||||
prefCompression->setMinimum(Z_NO_COMPRESSION);
|
||||
prefCompression->setMaximum(Z_BEST_COMPRESSION);
|
||||
connect( prefLicenseType, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseTypeChanged(int)) );
|
||||
ui->prefCountBackupFiles->setMaximum(INT_MAX);
|
||||
ui->prefCompression->setMinimum(Z_NO_COMPRESSION);
|
||||
ui->prefCompression->setMaximum(Z_BEST_COMPRESSION);
|
||||
connect( ui->prefLicenseType, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseTypeChanged(int)) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,59 +63,59 @@ DlgSettingsDocumentImp::~DlgSettingsDocumentImp()
|
||||
|
||||
void DlgSettingsDocumentImp::saveSettings()
|
||||
{
|
||||
prefCheckNewDoc->onSave();
|
||||
prefCompression->onSave();
|
||||
ui->prefCheckNewDoc->onSave();
|
||||
ui->prefCompression->onSave();
|
||||
|
||||
prefUndoRedo->onSave();
|
||||
prefUndoRedoSize->onSave();
|
||||
prefSaveTransaction->onSave();
|
||||
prefDiscardTransaction->onSave();
|
||||
prefSaveThumbnail->onSave();
|
||||
prefAddLogo->onSave();
|
||||
prefSaveBackupFiles->onSave();
|
||||
prefCountBackupFiles->onSave();
|
||||
prefDuplicateLabel->onSave();
|
||||
prefPartialLoading->onSave();
|
||||
prefLicenseType->onSave();
|
||||
prefLicenseUrl->onSave();
|
||||
prefAuthor->onSave();
|
||||
prefSetAuthorOnSave->onSave();
|
||||
prefCompany->onSave();
|
||||
prefRecovery->onSave();
|
||||
prefAutoSaveEnabled->onSave();
|
||||
prefAutoSaveTimeout->onSave();
|
||||
prefCanAbortRecompute->onSave();
|
||||
ui->prefUndoRedo->onSave();
|
||||
ui->prefUndoRedoSize->onSave();
|
||||
ui->prefSaveTransaction->onSave();
|
||||
ui->prefDiscardTransaction->onSave();
|
||||
ui->prefSaveThumbnail->onSave();
|
||||
ui->prefAddLogo->onSave();
|
||||
ui->prefSaveBackupFiles->onSave();
|
||||
ui->prefCountBackupFiles->onSave();
|
||||
ui->prefDuplicateLabel->onSave();
|
||||
ui->prefPartialLoading->onSave();
|
||||
ui->prefLicenseType->onSave();
|
||||
ui->prefLicenseUrl->onSave();
|
||||
ui->prefAuthor->onSave();
|
||||
ui->prefSetAuthorOnSave->onSave();
|
||||
ui->prefCompany->onSave();
|
||||
ui->prefRecovery->onSave();
|
||||
ui->prefAutoSaveEnabled->onSave();
|
||||
ui->prefAutoSaveTimeout->onSave();
|
||||
ui->prefCanAbortRecompute->onSave();
|
||||
|
||||
int timeout = prefAutoSaveTimeout->value();
|
||||
if (!prefAutoSaveEnabled->isChecked())
|
||||
int timeout = ui->prefAutoSaveTimeout->value();
|
||||
if (!ui->prefAutoSaveEnabled->isChecked())
|
||||
timeout = 0;
|
||||
AutoSaver::instance()->setTimeout(timeout * 60000);
|
||||
}
|
||||
|
||||
void DlgSettingsDocumentImp::loadSettings()
|
||||
{
|
||||
prefCheckNewDoc->onRestore();
|
||||
prefCompression->onRestore();
|
||||
ui->prefCheckNewDoc->onRestore();
|
||||
ui->prefCompression->onRestore();
|
||||
|
||||
prefUndoRedo->onRestore();
|
||||
prefUndoRedoSize->onRestore();
|
||||
prefSaveTransaction->onRestore();
|
||||
prefDiscardTransaction->onRestore();
|
||||
prefSaveThumbnail->onRestore();
|
||||
prefAddLogo->onRestore();
|
||||
prefSaveBackupFiles->onRestore();
|
||||
prefCountBackupFiles->onRestore();
|
||||
prefDuplicateLabel->onRestore();
|
||||
prefPartialLoading->onRestore();
|
||||
prefLicenseType->onRestore();
|
||||
prefLicenseUrl->onRestore();
|
||||
prefAuthor->onRestore();
|
||||
prefSetAuthorOnSave->onRestore();
|
||||
prefCompany->onRestore();
|
||||
prefRecovery->onRestore();
|
||||
prefAutoSaveEnabled->onRestore();
|
||||
prefAutoSaveTimeout->onRestore();
|
||||
prefCanAbortRecompute->onRestore();
|
||||
ui->prefUndoRedo->onRestore();
|
||||
ui->prefUndoRedoSize->onRestore();
|
||||
ui->prefSaveTransaction->onRestore();
|
||||
ui->prefDiscardTransaction->onRestore();
|
||||
ui->prefSaveThumbnail->onRestore();
|
||||
ui->prefAddLogo->onRestore();
|
||||
ui->prefSaveBackupFiles->onRestore();
|
||||
ui->prefCountBackupFiles->onRestore();
|
||||
ui->prefDuplicateLabel->onRestore();
|
||||
ui->prefPartialLoading->onRestore();
|
||||
ui->prefLicenseType->onRestore();
|
||||
ui->prefLicenseUrl->onRestore();
|
||||
ui->prefAuthor->onRestore();
|
||||
ui->prefSetAuthorOnSave->onRestore();
|
||||
ui->prefCompany->onRestore();
|
||||
ui->prefRecovery->onRestore();
|
||||
ui->prefAutoSaveEnabled->onRestore();
|
||||
ui->prefAutoSaveTimeout->onRestore();
|
||||
ui->prefCanAbortRecompute->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +124,7 @@ void DlgSettingsDocumentImp::loadSettings()
|
||||
void DlgSettingsDocumentImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
@@ -134,39 +136,39 @@ void DlgSettingsDocumentImp::changeEvent(QEvent *e)
|
||||
*/
|
||||
void DlgSettingsDocumentImp::onLicenseTypeChanged(int index)
|
||||
{
|
||||
prefLicenseUrl->setReadOnly(true);
|
||||
ui->prefLicenseUrl->setReadOnly(true);
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://en.wikipedia.org/wiki/All_rights_reserved"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://en.wikipedia.org/wiki/All_rights_reserved"));
|
||||
break;
|
||||
case 1:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by/4.0/"));
|
||||
break;
|
||||
case 2:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-sa/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-sa/4.0/"));
|
||||
break;
|
||||
case 3:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nd/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nd/4.0/"));
|
||||
break;
|
||||
case 4:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc/4.0/"));
|
||||
break;
|
||||
case 5:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc-sa/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc-sa/4.0/"));
|
||||
break;
|
||||
case 6:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc-nd/4.0/"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://creativecommons.org/licenses/by-nc-nd/4.0/"));
|
||||
break;
|
||||
case 7:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://en.wikipedia.org/wiki/Public_domain"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://en.wikipedia.org/wiki/Public_domain"));
|
||||
break;
|
||||
case 8:
|
||||
prefLicenseUrl->setText(QString::fromLatin1("http://artlibre.org/licence/lal"));
|
||||
ui->prefLicenseUrl->setText(QString::fromLatin1("http://artlibre.org/licence/lal"));
|
||||
break;
|
||||
default:
|
||||
prefLicenseUrl->clear();
|
||||
prefLicenseUrl->setReadOnly(false);
|
||||
ui->prefLicenseUrl->clear();
|
||||
ui->prefLicenseUrl->setReadOnly(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,18 +24,19 @@
|
||||
#ifndef GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
|
||||
#define GUI_DIALOG_DLGSETTINGSDOCUMENT_IMP_H
|
||||
|
||||
#include "ui_DlgSettingsDocument.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettingsDocument;
|
||||
|
||||
/**
|
||||
* The DlgSettingsDocumentImp class implements a preference page to change settings
|
||||
* for the document.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgSettingsDocumentImp : public PreferencePage, public Ui_DlgSettingsDocument
|
||||
class DlgSettingsDocumentImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -51,6 +52,9 @@ protected Q_SLOTS:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsDocument> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "DlgSettingsImageImp.h"
|
||||
#include "ui_DlgSettingsImage.h"
|
||||
#include "SpinBox.h"
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
@@ -37,22 +38,23 @@ using namespace std;
|
||||
*/
|
||||
DlgSettingsImageImp::DlgSettingsImageImp( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui(new Ui_DlgSettingsImage)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
SbVec2s res = SoOffscreenRenderer::getMaximumResolution();
|
||||
spinWidth->setMaximum((int)res[0]);
|
||||
spinHeight->setMaximum((int)res[1]);
|
||||
ui->spinWidth->setMaximum((int)res[0]);
|
||||
ui->spinHeight->setMaximum((int)res[1]);
|
||||
|
||||
_width = width();
|
||||
_height = height();
|
||||
_fRatio = (float)_width/(float)_height;
|
||||
|
||||
comboMethod->addItem(tr("Offscreen (New)"), QByteArray("QtOffscreenRenderer"));
|
||||
comboMethod->addItem(tr("Offscreen (Old)"), QByteArray("CoinOffscreenRenderer"));
|
||||
comboMethod->addItem(tr("Framebuffer (custom)"), QByteArray("FramebufferObject"));
|
||||
comboMethod->addItem(tr("Framebuffer (as is)"), QByteArray("GrabFramebuffer"));
|
||||
ui->comboMethod->addItem(tr("Offscreen (New)"), QByteArray("QtOffscreenRenderer"));
|
||||
ui->comboMethod->addItem(tr("Offscreen (Old)"), QByteArray("CoinOffscreenRenderer"));
|
||||
ui->comboMethod->addItem(tr("Framebuffer (custom)"), QByteArray("FramebufferObject"));
|
||||
ui->comboMethod->addItem(tr("Framebuffer (as is)"), QByteArray("GrabFramebuffer"));
|
||||
#if QT_VERSION < 0x050000
|
||||
comboMethod->addItem(tr("Pixel buffer"), QByteArray("PixelBuffer"));
|
||||
ui->comboMethod->addItem(tr("Pixel buffer"), QByteArray("PixelBuffer"));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -67,7 +69,7 @@ DlgSettingsImageImp::~DlgSettingsImageImp()
|
||||
void DlgSettingsImageImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
@@ -78,10 +80,10 @@ void DlgSettingsImageImp::changeEvent(QEvent *e)
|
||||
void DlgSettingsImageImp::setImageSize(int w, int h)
|
||||
{
|
||||
// set current screen size
|
||||
standardSizeBox->setItemData(0, QSize(w,h));
|
||||
ui->standardSizeBox->setItemData(0, QSize(w,h));
|
||||
|
||||
spinWidth->setValue(w);
|
||||
spinHeight->setValue(h);
|
||||
ui->spinWidth->setValue(w);
|
||||
ui->spinHeight->setValue(h);
|
||||
|
||||
// As the image size is in pixel why shouldn't _width and _height be integers?
|
||||
_width = w;
|
||||
@@ -95,10 +97,10 @@ void DlgSettingsImageImp::setImageSize(int w, int h)
|
||||
void DlgSettingsImageImp::setImageSize( const QSize& s )
|
||||
{
|
||||
// set current screen size
|
||||
standardSizeBox->setItemData(0, s);
|
||||
ui->standardSizeBox->setItemData(0, s);
|
||||
|
||||
spinWidth->setValue( s.width() );
|
||||
spinHeight->setValue( s.height() );
|
||||
ui->spinWidth->setValue( s.width() );
|
||||
ui->spinHeight->setValue( s.height() );
|
||||
|
||||
// As the image size is in pixel why shouldn't _width and _height be integers?
|
||||
_width = s.width();
|
||||
@@ -111,7 +113,7 @@ void DlgSettingsImageImp::setImageSize( const QSize& s )
|
||||
*/
|
||||
QSize DlgSettingsImageImp::imageSize() const
|
||||
{
|
||||
return QSize( spinWidth->value(), spinHeight->value() );
|
||||
return QSize( ui->spinWidth->value(), ui->spinHeight->value() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +121,7 @@ QSize DlgSettingsImageImp::imageSize() const
|
||||
*/
|
||||
int DlgSettingsImageImp::imageWidth() const
|
||||
{
|
||||
return spinWidth->value();
|
||||
return ui->spinWidth->value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +129,7 @@ int DlgSettingsImageImp::imageWidth() const
|
||||
*/
|
||||
int DlgSettingsImageImp::imageHeight() const
|
||||
{
|
||||
return spinHeight->value();
|
||||
return ui->spinHeight->value();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,15 +138,15 @@ int DlgSettingsImageImp::imageHeight() const
|
||||
*/
|
||||
QString DlgSettingsImageImp::comment() const
|
||||
{
|
||||
if ( !textEditComment->isEnabled() )
|
||||
if ( !ui->textEditComment->isEnabled() )
|
||||
return QString::null;
|
||||
else
|
||||
return textEditComment->toPlainText();
|
||||
return ui->textEditComment->toPlainText();
|
||||
}
|
||||
|
||||
int DlgSettingsImageImp::backgroundType() const
|
||||
{
|
||||
return comboBackground->currentIndex();
|
||||
return ui->comboBackground->currentIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,13 +154,13 @@ int DlgSettingsImageImp::backgroundType() const
|
||||
*/
|
||||
void DlgSettingsImageImp::setBackgroundType(int t)
|
||||
{
|
||||
if ( t < comboBackground->count() )
|
||||
comboBackground->setCurrentIndex(t);
|
||||
if ( t < ui->comboBackground->count() )
|
||||
ui->comboBackground->setCurrentIndex(t);
|
||||
}
|
||||
|
||||
bool DlgSettingsImageImp::addWatermark() const
|
||||
{
|
||||
return checkWatermark->isChecked();
|
||||
return ui->checkWatermark->isChecked();
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::onSelectedFilter(const QString& filter)
|
||||
@@ -166,23 +168,23 @@ void DlgSettingsImageImp::onSelectedFilter(const QString& filter)
|
||||
bool ok = (filter.startsWith(QLatin1String("JPG")) ||
|
||||
filter.startsWith(QLatin1String("JPEG")) ||
|
||||
filter.startsWith(QLatin1String("PNG")));
|
||||
buttonGroupComment->setEnabled( ok );
|
||||
ui->buttonGroupComment->setEnabled( ok );
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::adjustImageSize(float fRatio)
|
||||
{
|
||||
// if width has changed then adjust height and vice versa, if both has changed then adjust width
|
||||
if (_height != spinHeight->value())
|
||||
if (_height != ui->spinHeight->value())
|
||||
{
|
||||
_height = spinHeight->value();
|
||||
_height = ui->spinHeight->value();
|
||||
_width = (int)((float)_height*fRatio);
|
||||
spinWidth->setValue( (int)_width );
|
||||
ui->spinWidth->setValue( (int)_width );
|
||||
}
|
||||
else // if( _width != spinWidth->value() )
|
||||
{
|
||||
_width = spinWidth->value();
|
||||
_width = ui->spinWidth->value();
|
||||
_height = (int)((float)_width/fRatio);
|
||||
spinHeight->setValue( (int)_height );
|
||||
ui->spinHeight->setValue( (int)_height );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,50 +212,50 @@ void DlgSettingsImageImp::on_standardSizeBox_activated(int index)
|
||||
{
|
||||
if (index == 0) {
|
||||
// we have set the user data for the 1st item
|
||||
QSize s = standardSizeBox->itemData(0).toSize();
|
||||
spinWidth->setValue(s.width());
|
||||
spinHeight->setValue(s.height());
|
||||
QSize s = ui->standardSizeBox->itemData(0).toSize();
|
||||
ui->spinWidth->setValue(s.width());
|
||||
ui->spinHeight->setValue(s.height());
|
||||
}
|
||||
else {
|
||||
// try to extract from the string
|
||||
QString text = standardSizeBox->itemText(index);
|
||||
QString text = ui->standardSizeBox->itemText(index);
|
||||
QRegExp rx(QLatin1String("\\b\\d{2,4}\\b"));
|
||||
int pos = 0;
|
||||
pos = rx.indexIn(text, pos);
|
||||
QString w = text.mid(pos, rx.matchedLength());
|
||||
spinWidth->setValue(w.toInt());
|
||||
ui->spinWidth->setValue(w.toInt());
|
||||
pos += rx.matchedLength();
|
||||
pos = rx.indexIn(text, pos);
|
||||
QString h = text.mid(pos, rx.matchedLength());
|
||||
spinHeight->setValue(h.toInt());
|
||||
ui->spinHeight->setValue(h.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::setMethod(const QByteArray& m)
|
||||
{
|
||||
int index = comboMethod->findData(m);
|
||||
int index = ui->comboMethod->findData(m);
|
||||
if (index >= 0)
|
||||
comboMethod->setCurrentIndex(index);
|
||||
ui->comboMethod->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
QByteArray DlgSettingsImageImp::method() const
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
int index = comboMethod->currentIndex();
|
||||
comboMethod->itemData(index).toByteArray();
|
||||
int index = ui->comboMethod->currentIndex();
|
||||
ui->comboMethod->itemData(index).toByteArray();
|
||||
#else
|
||||
return comboMethod->currentData().toByteArray();
|
||||
return ui->comboMethod->currentData().toByteArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DlgSettingsImageImp::on_comboMethod_activated(int index)
|
||||
{
|
||||
QByteArray data = comboMethod->itemData(index).toByteArray();
|
||||
QByteArray data = ui->comboMethod->itemData(index).toByteArray();
|
||||
if (data == QByteArray("GrabFramebuffer")) {
|
||||
groupBoxProp->setEnabled(false);
|
||||
ui->groupBoxProp->setEnabled(false);
|
||||
}
|
||||
else {
|
||||
groupBoxProp->setEnabled(true);
|
||||
ui->groupBoxProp->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,16 +27,19 @@
|
||||
#include <Inventor/SoOffscreenRenderer.h>
|
||||
#include <Inventor/SbMatrix.h>
|
||||
|
||||
#include "ui_DlgSettingsImage.h"
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettingsImage;
|
||||
|
||||
/**
|
||||
* The DlgSettings3DViewImp class implements a preference page to change settings
|
||||
* for the Inventor viewer.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class DlgSettingsImageImp : public QWidget, public Ui::DlgSettingsImage
|
||||
class DlgSettingsImageImp : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -81,6 +84,7 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsImage> ui;
|
||||
float _fRatio;
|
||||
int _width, _height;
|
||||
SbMatrix _Matrix;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "DlgSettingsMacroImp.h"
|
||||
#include "ui_DlgSettingsMacro.h"
|
||||
#include "Application.h"
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
@@ -36,16 +37,17 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgSettingsMacroImp::DlgSettingsMacroImp( QWidget* parent )
|
||||
: PreferencePage( parent )
|
||||
, ui(new Ui_DlgSettingsMacro)
|
||||
{
|
||||
this->setupUi(this);
|
||||
ui->setupUi(this);
|
||||
|
||||
// Was never implemented, so hide it
|
||||
this->FileLogCheckBox->hide();
|
||||
this->MacroPath_2->hide();
|
||||
ui->FileLogCheckBox->hide();
|
||||
ui->MacroPath_2->hide();
|
||||
|
||||
if (MacroPath->fileName().isEmpty()) {
|
||||
if (ui->MacroPath->fileName().isEmpty()) {
|
||||
QDir d(QString::fromUtf8(App::GetApplication().getUserMacroDir().c_str()));
|
||||
MacroPath->setFileName(d.path());
|
||||
ui->MacroPath->setFileName(d.path());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,24 +61,24 @@ DlgSettingsMacroImp::~DlgSettingsMacroImp()
|
||||
|
||||
void DlgSettingsMacroImp::saveSettings()
|
||||
{
|
||||
PrefCheckBox_LocalEnv->onSave();
|
||||
MacroPath->onSave();
|
||||
PrefCheckBox_RecordGui->onSave();
|
||||
PrefCheckBox_GuiAsComment->onSave();
|
||||
PConsoleCheckBox->onSave();
|
||||
FileLogCheckBox->onSave();
|
||||
MacroPath_2->onSave();
|
||||
ui->PrefCheckBox_LocalEnv->onSave();
|
||||
ui->MacroPath->onSave();
|
||||
ui->PrefCheckBox_RecordGui->onSave();
|
||||
ui->PrefCheckBox_GuiAsComment->onSave();
|
||||
ui->PConsoleCheckBox->onSave();
|
||||
ui->FileLogCheckBox->onSave();
|
||||
ui->MacroPath_2->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsMacroImp::loadSettings()
|
||||
{
|
||||
PrefCheckBox_LocalEnv->onRestore();
|
||||
MacroPath->onRestore();
|
||||
PrefCheckBox_RecordGui->onRestore();
|
||||
PrefCheckBox_GuiAsComment->onRestore();
|
||||
PConsoleCheckBox->onRestore();
|
||||
FileLogCheckBox->onRestore();
|
||||
MacroPath_2->onRestore();
|
||||
ui->PrefCheckBox_LocalEnv->onRestore();
|
||||
ui->MacroPath->onRestore();
|
||||
ui->PrefCheckBox_RecordGui->onRestore();
|
||||
ui->PrefCheckBox_GuiAsComment->onRestore();
|
||||
ui->PConsoleCheckBox->onRestore();
|
||||
ui->FileLogCheckBox->onRestore();
|
||||
ui->MacroPath_2->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +87,7 @@ void DlgSettingsMacroImp::loadSettings()
|
||||
void DlgSettingsMacroImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
|
||||
@@ -24,18 +24,19 @@
|
||||
#ifndef GUI_DIALOG_DLGSETTINGSMACROIMP_H
|
||||
#define GUI_DIALOG_DLGSETTINGSMACROIMP_H
|
||||
|
||||
#include "ui_DlgSettingsMacro.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettingsMacro;
|
||||
|
||||
/**
|
||||
* The DlgSettingsMacroImp class implements a preference page to change settings
|
||||
* for macro stuff.
|
||||
* \author Jürgen Riegel
|
||||
*/
|
||||
class DlgSettingsMacroImp : public PreferencePage, public Ui_DlgSettingsMacro
|
||||
class DlgSettingsMacroImp : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -48,6 +49,9 @@ public:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsMacro> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgSettingsViewColor.h"
|
||||
#include "ui_DlgSettingsViewColor.h"
|
||||
#include "PrefWidgets.h"
|
||||
|
||||
using namespace Gui::Dialog;
|
||||
@@ -39,10 +40,11 @@ using namespace Gui::Dialog;
|
||||
*/
|
||||
DlgSettingsViewColor::DlgSettingsViewColor(QWidget* parent)
|
||||
: PreferencePage(parent)
|
||||
, ui(new Ui_DlgSettingsViewColor)
|
||||
{
|
||||
this->setupUi(this);
|
||||
this->HighlightColor->setEnabled(this->checkBoxPreselection->isChecked());
|
||||
this->SelectionColor->setEnabled(this->checkBoxSelection->isChecked());
|
||||
ui->setupUi(this);
|
||||
ui->HighlightColor->setEnabled(ui->checkBoxPreselection->isChecked());
|
||||
ui->SelectionColor->setEnabled(ui->checkBoxSelection->isChecked());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,38 +57,38 @@ DlgSettingsViewColor::~DlgSettingsViewColor()
|
||||
|
||||
void DlgSettingsViewColor::saveSettings()
|
||||
{
|
||||
SelectionColor_Background->onSave();
|
||||
backgroundColorFrom->onSave();
|
||||
backgroundColorTo->onSave();
|
||||
backgroundColorMid->onSave();
|
||||
radioButtonSimple->onSave();
|
||||
radioButtonGradient->onSave();
|
||||
checkMidColor->onSave();
|
||||
checkBoxPreselection->onSave();
|
||||
checkBoxSelection->onSave();
|
||||
HighlightColor->onSave();
|
||||
SelectionColor->onSave();
|
||||
spinPickRadius->onSave();
|
||||
TreeEditColor->onSave();
|
||||
TreeActiveColor->onSave();
|
||||
ui->SelectionColor_Background->onSave();
|
||||
ui->backgroundColorFrom->onSave();
|
||||
ui->backgroundColorTo->onSave();
|
||||
ui->backgroundColorMid->onSave();
|
||||
ui->radioButtonSimple->onSave();
|
||||
ui->radioButtonGradient->onSave();
|
||||
ui->checkMidColor->onSave();
|
||||
ui->checkBoxPreselection->onSave();
|
||||
ui->checkBoxSelection->onSave();
|
||||
ui->HighlightColor->onSave();
|
||||
ui->SelectionColor->onSave();
|
||||
ui->spinPickRadius->onSave();
|
||||
ui->TreeEditColor->onSave();
|
||||
ui->TreeActiveColor->onSave();
|
||||
}
|
||||
|
||||
void DlgSettingsViewColor::loadSettings()
|
||||
{
|
||||
SelectionColor_Background->onRestore();
|
||||
backgroundColorFrom->onRestore();
|
||||
backgroundColorTo->onRestore();
|
||||
backgroundColorMid->onRestore();
|
||||
radioButtonSimple->onRestore();
|
||||
radioButtonGradient->onRestore();
|
||||
checkMidColor->onRestore();
|
||||
checkBoxPreselection->onRestore();
|
||||
checkBoxSelection->onRestore();
|
||||
HighlightColor->onRestore();
|
||||
SelectionColor->onRestore();
|
||||
spinPickRadius->onRestore();
|
||||
TreeEditColor->onRestore();
|
||||
TreeActiveColor->onRestore();
|
||||
ui->SelectionColor_Background->onRestore();
|
||||
ui->backgroundColorFrom->onRestore();
|
||||
ui->backgroundColorTo->onRestore();
|
||||
ui->backgroundColorMid->onRestore();
|
||||
ui->radioButtonSimple->onRestore();
|
||||
ui->radioButtonGradient->onRestore();
|
||||
ui->checkMidColor->onRestore();
|
||||
ui->checkBoxPreselection->onRestore();
|
||||
ui->checkBoxSelection->onRestore();
|
||||
ui->HighlightColor->onRestore();
|
||||
ui->SelectionColor->onRestore();
|
||||
ui->spinPickRadius->onRestore();
|
||||
ui->TreeEditColor->onRestore();
|
||||
ui->TreeActiveColor->onRestore();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,7 +97,7 @@ void DlgSettingsViewColor::loadSettings()
|
||||
void DlgSettingsViewColor::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
|
||||
@@ -24,18 +24,19 @@
|
||||
#ifndef GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
|
||||
#define GUI_DIALOG_DLGSETTINGSVIEWCOLOR_H
|
||||
|
||||
#include "ui_DlgSettingsViewColor.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgSettingsViewColor;
|
||||
|
||||
/**
|
||||
* The DlgSettingsViewColor class implements a preference page to change color settings
|
||||
* for the Inventor viewer like background and selection.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class DlgSettingsViewColor : public PreferencePage, public Ui_DlgSettingsViewColor
|
||||
class DlgSettingsViewColor : public PreferencePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -48,6 +49,9 @@ public:
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgSettingsViewColor> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgToolbarsImp.h"
|
||||
#include "ui_DlgToolbars.h"
|
||||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "Command.h"
|
||||
@@ -67,13 +68,15 @@ struct GroupMap_find {
|
||||
* true to construct a modal dialog.
|
||||
*/
|
||||
DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
|
||||
: CustomizeActionPage(parent), type(t)
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgCustomToolbars)
|
||||
, type(t)
|
||||
{
|
||||
this->setupUi(this);
|
||||
moveActionRightButton->setIcon(BitmapFactory().pixmap(":/icons/button_right.svg"));
|
||||
moveActionLeftButton->setIcon(BitmapFactory().pixmap(":/icons/button_left.svg"));
|
||||
moveActionDownButton->setIcon(BitmapFactory().pixmap(":/icons/button_down.svg"));
|
||||
moveActionUpButton->setIcon(BitmapFactory().pixmap(":/icons/button_up.svg"));
|
||||
ui->setupUi(this);
|
||||
ui->moveActionRightButton->setIcon(BitmapFactory().pixmap(":/icons/button_right.svg"));
|
||||
ui->moveActionLeftButton->setIcon(BitmapFactory().pixmap(":/icons/button_left.svg"));
|
||||
ui->moveActionDownButton->setIcon(BitmapFactory().pixmap(":/icons/button_down.svg"));
|
||||
ui->moveActionUpButton->setIcon(BitmapFactory().pixmap(":/icons/button_up.svg"));
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::map<std::string,Command*> sCommands = cCmdMgr.getCommands();
|
||||
@@ -104,52 +107,52 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
|
||||
|
||||
int index = 0;
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
categoryBox->addItem(it->second);
|
||||
categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
ui->categoryBox->addItem(it->second);
|
||||
ui->categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
}
|
||||
|
||||
// fills the combo box with all available workbenches
|
||||
QStringList workbenches = Application::Instance->workbenches();
|
||||
workbenches.sort();
|
||||
index = 1;
|
||||
workbenchBox->addItem(QApplication::windowIcon(), tr("Global"));
|
||||
workbenchBox->setItemData(0, QVariant(QString::fromLatin1("Global")), Qt::UserRole);
|
||||
ui->workbenchBox->addItem(QApplication::windowIcon(), tr("Global"));
|
||||
ui->workbenchBox->setItemData(0, QVariant(QString::fromLatin1("Global")), Qt::UserRole);
|
||||
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
|
||||
QPixmap px = Application::Instance->workbenchIcon(*it);
|
||||
QString mt = Application::Instance->workbenchMenuText(*it);
|
||||
if (mt != QLatin1String("<none>")) {
|
||||
if (px.isNull())
|
||||
workbenchBox->addItem(mt);
|
||||
ui->workbenchBox->addItem(mt);
|
||||
else
|
||||
workbenchBox->addItem(px, mt);
|
||||
workbenchBox->setItemData(index, QVariant(*it), Qt::UserRole);
|
||||
ui->workbenchBox->addItem(px, mt);
|
||||
ui->workbenchBox->setItemData(index, QVariant(*it), Qt::UserRole);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
QStringList labels;
|
||||
labels << tr("Icon") << tr("Command");
|
||||
commandTreeWidget->setHeaderLabels(labels);
|
||||
commandTreeWidget->header()->hide();
|
||||
commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
ui->commandTreeWidget->setHeaderLabels(labels);
|
||||
ui->commandTreeWidget->header()->hide();
|
||||
ui->commandTreeWidget->setIconSize(QSize(32, 32));
|
||||
#if QT_VERSION >= 0x050000
|
||||
commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
ui->commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
labels.clear(); labels << tr("Command");
|
||||
toolbarTreeWidget->setHeaderLabels(labels);
|
||||
toolbarTreeWidget->header()->hide();
|
||||
ui->toolbarTreeWidget->setHeaderLabels(labels);
|
||||
ui->toolbarTreeWidget->header()->hide();
|
||||
|
||||
on_categoryBox_activated(categoryBox->currentIndex());
|
||||
on_categoryBox_activated(ui->categoryBox->currentIndex());
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w) {
|
||||
QString name = QString::fromLatin1(w->name().c_str());
|
||||
int index = workbenchBox->findData(name);
|
||||
workbenchBox->setCurrentIndex(index);
|
||||
int index = ui->workbenchBox->findData(name);
|
||||
ui->workbenchBox->setCurrentIndex(index);
|
||||
}
|
||||
on_workbenchBox_activated(workbenchBox->currentIndex());
|
||||
on_workbenchBox_activated(ui->workbenchBox->currentIndex());
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -187,7 +190,7 @@ void DlgCustomToolbars::moveDownCustomCommand(const QString&, const QByteArray&)
|
||||
|
||||
void DlgCustomToolbars::hideEvent(QHideEvent * event)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
|
||||
@@ -196,22 +199,22 @@ void DlgCustomToolbars::hideEvent(QHideEvent * event)
|
||||
|
||||
void DlgCustomToolbars::on_categoryBox_activated(int index)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(index, Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(index, Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
commandTreeWidget->clear();
|
||||
ui->commandTreeWidget->clear();
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
|
||||
|
||||
// Create a separator item
|
||||
QTreeWidgetItem* sepitem = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* sepitem = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
sepitem->setText(1, tr("<Separator>"));
|
||||
sepitem->setData(1, Qt::UserRole, QByteArray("Separator"));
|
||||
sepitem->setSizeHint(0, QSize(32, 32));
|
||||
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -222,7 +225,7 @@ void DlgCustomToolbars::on_categoryBox_activated(int index)
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
@@ -235,9 +238,9 @@ void DlgCustomToolbars::on_categoryBox_activated(int index)
|
||||
|
||||
void DlgCustomToolbars::on_workbenchBox_activated(int index)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(index, Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(index, Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
toolbarTreeWidget->clear();
|
||||
ui->toolbarTreeWidget->clear();
|
||||
|
||||
QByteArray workbenchname = workbench.toLatin1();
|
||||
importCustomToolbars(workbenchname);
|
||||
@@ -259,7 +262,7 @@ void DlgCustomToolbars::importCustomToolbars(const QByteArray& name)
|
||||
CommandManager& rMgr = Application::Instance->commandManager();
|
||||
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
|
||||
// create a toplevel item
|
||||
QTreeWidgetItem* toplevel = new QTreeWidgetItem(toolbarTreeWidget);
|
||||
QTreeWidgetItem* toplevel = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
bool active = (*it)->GetBool("Active", true);
|
||||
toplevel->setCheckState(0, (active ? Qt::Checked : Qt::Unchecked));
|
||||
|
||||
@@ -303,8 +306,8 @@ void DlgCustomToolbars::exportCustomToolbars(const QByteArray& workbench)
|
||||
hGrp->Clear();
|
||||
|
||||
CommandManager& rMgr = Application::Instance->commandManager();
|
||||
for (int i=0; i<toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = ui->toolbarTreeWidget->topLevelItem(i);
|
||||
QString groupName = QString::fromLatin1("Custom_%1").arg(i+1);
|
||||
QByteArray toolbarName = toplevel->text(0).toUtf8();
|
||||
ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toLatin1());
|
||||
@@ -336,11 +339,11 @@ void DlgCustomToolbars::exportCustomToolbars(const QByteArray& workbench)
|
||||
/** Adds a new action */
|
||||
void DlgCustomToolbars::on_moveActionRightButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = commandTreeWidget->currentItem();
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->currentItem();
|
||||
if (item) {
|
||||
QTreeWidgetItem* current = toolbarTreeWidget->currentItem();
|
||||
QTreeWidgetItem* current = ui->toolbarTreeWidget->currentItem();
|
||||
if (!current)
|
||||
current = toolbarTreeWidget->topLevelItem(0);
|
||||
current = ui->toolbarTreeWidget->topLevelItem(0);
|
||||
else if (current->parent())
|
||||
current = current->parent();
|
||||
if (current && !current->parent()) {
|
||||
@@ -354,7 +357,7 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -362,8 +365,8 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked()
|
||||
/** Removes an action */
|
||||
void DlgCustomToolbars::on_moveActionLeftButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* parent = item->parent();
|
||||
int index = parent->indexOfChild(item);
|
||||
parent->takeChild(index);
|
||||
@@ -388,7 +391,7 @@ void DlgCustomToolbars::on_moveActionLeftButton_clicked()
|
||||
delete item;
|
||||
}
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -396,8 +399,8 @@ void DlgCustomToolbars::on_moveActionLeftButton_clicked()
|
||||
/** Moves up an action */
|
||||
void DlgCustomToolbars::on_moveActionUpButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* parent = item->parent();
|
||||
int index = parent->indexOfChild(item);
|
||||
if (index > 0) {
|
||||
@@ -420,13 +423,13 @@ void DlgCustomToolbars::on_moveActionUpButton_clicked()
|
||||
|
||||
parent->takeChild(index);
|
||||
parent->insertChild(index-1, item);
|
||||
toolbarTreeWidget->setCurrentItem(item);
|
||||
ui->toolbarTreeWidget->setCurrentItem(item);
|
||||
|
||||
moveUpCustomCommand(parent->text(0), data);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -434,8 +437,8 @@ void DlgCustomToolbars::on_moveActionUpButton_clicked()
|
||||
/** Moves down an action */
|
||||
void DlgCustomToolbars::on_moveActionDownButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem();
|
||||
if (item && item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* parent = item->parent();
|
||||
int index = parent->indexOfChild(item);
|
||||
if (index < parent->childCount()-1) {
|
||||
@@ -458,13 +461,13 @@ void DlgCustomToolbars::on_moveActionDownButton_clicked()
|
||||
|
||||
parent->takeChild(index);
|
||||
parent->insertChild(index+1, item);
|
||||
toolbarTreeWidget->setCurrentItem(item);
|
||||
ui->toolbarTreeWidget->setCurrentItem(item);
|
||||
|
||||
moveDownCustomCommand(parent->text(0), data);
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -472,12 +475,12 @@ void DlgCustomToolbars::on_moveActionDownButton_clicked()
|
||||
void DlgCustomToolbars::on_newButton_clicked()
|
||||
{
|
||||
bool ok;
|
||||
QString text = QString::fromLatin1("Custom%1").arg(toolbarTreeWidget->topLevelItemCount()+1);
|
||||
QString text = QString::fromLatin1("Custom%1").arg(ui->toolbarTreeWidget->topLevelItemCount()+1);
|
||||
text = QInputDialog::getText(this, tr("New toolbar"), tr("Toolbar name:"), QLineEdit::Normal, text, &ok);
|
||||
if (ok) {
|
||||
// Check for duplicated name
|
||||
for (int i=0; i<toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = ui->toolbarTreeWidget->topLevelItem(i);
|
||||
QString groupName = toplevel->text(0);
|
||||
if (groupName == text) {
|
||||
QMessageBox::warning(this, tr("Duplicated name"), tr("The toolbar name '%1' is already used").arg(text));
|
||||
@@ -485,12 +488,12 @@ void DlgCustomToolbars::on_newButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(toolbarTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
item->setText(0, text);
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
toolbarTreeWidget->setItemExpanded(item, true);
|
||||
ui->toolbarTreeWidget->setItemExpanded(item, true);
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
addCustomToolbar(text);
|
||||
@@ -499,15 +502,15 @@ void DlgCustomToolbars::on_newButton_clicked()
|
||||
|
||||
void DlgCustomToolbars::on_deleteButton_clicked()
|
||||
{
|
||||
QTreeWidgetItem* item = toolbarTreeWidget->currentItem();
|
||||
if (item && !item->parent() && toolbarTreeWidget->isItemSelected(item)) {
|
||||
int index = toolbarTreeWidget->indexOfTopLevelItem(item);
|
||||
toolbarTreeWidget->takeTopLevelItem(index);
|
||||
QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem();
|
||||
if (item && !item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) {
|
||||
int index = ui->toolbarTreeWidget->indexOfTopLevelItem(item);
|
||||
ui->toolbarTreeWidget->takeTopLevelItem(index);
|
||||
removeCustomToolbar(item->text(0));
|
||||
delete item;
|
||||
}
|
||||
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -515,16 +518,16 @@ void DlgCustomToolbars::on_deleteButton_clicked()
|
||||
void DlgCustomToolbars::on_renameButton_clicked()
|
||||
{
|
||||
bool renamed = false;
|
||||
QTreeWidgetItem* item = toolbarTreeWidget->currentItem();
|
||||
if (item && !item->parent() && toolbarTreeWidget->isItemSelected(item)) {
|
||||
QTreeWidgetItem* item = ui->toolbarTreeWidget->currentItem();
|
||||
if (item && !item->parent() && ui->toolbarTreeWidget->isItemSelected(item)) {
|
||||
bool ok;
|
||||
QString old_text = item->text(0);
|
||||
QString text = QInputDialog::getText(this, tr("Rename toolbar"), tr("Toolbar name:"),
|
||||
QLineEdit::Normal, old_text, &ok);
|
||||
if (ok && text != old_text) {
|
||||
// Check for duplicated name
|
||||
for (int i=0; i<toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = ui->toolbarTreeWidget->topLevelItem(i);
|
||||
QString groupName = toplevel->text(0);
|
||||
if (groupName == text && toplevel != item) {
|
||||
QMessageBox::warning(this, tr("Duplicated name"), tr("The toolbar name '%1' is already used").arg(text));
|
||||
@@ -539,7 +542,7 @@ void DlgCustomToolbars::on_renameButton_clicked()
|
||||
}
|
||||
|
||||
if (renamed) {
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QString workbench = data.toString();
|
||||
exportCustomToolbars(workbench.toLatin1());
|
||||
}
|
||||
@@ -547,14 +550,14 @@ void DlgCustomToolbars::on_renameButton_clicked()
|
||||
|
||||
void DlgCustomToolbars::onAddMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
@@ -566,15 +569,15 @@ void DlgCustomToolbars::onAddMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomToolbars::onRemoveMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
commandTreeWidget->takeTopLevelItem(i);
|
||||
ui->commandTreeWidget->takeTopLevelItem(i);
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
@@ -584,15 +587,15 @@ void DlgCustomToolbars::onRemoveMacroAction(const QByteArray& macro)
|
||||
|
||||
void DlgCustomToolbars::onModifyMacroAction(const QByteArray& macro)
|
||||
{
|
||||
QVariant data = categoryBox->itemData(categoryBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(ui->categoryBox->currentIndex(), Qt::UserRole);
|
||||
QString group = data.toString();
|
||||
if (group == QLatin1String("Macros"))
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
// the left side
|
||||
for (int i=0; i<commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = commandTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->commandTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
|
||||
QByteArray command = item->data(1, Qt::UserRole).toByteArray();
|
||||
if (command == macro) {
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
@@ -605,8 +608,8 @@ void DlgCustomToolbars::onModifyMacroAction(const QByteArray& macro)
|
||||
}
|
||||
}
|
||||
// the right side
|
||||
for (int i=0; i<toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i);
|
||||
for (int i=0; i<ui->toolbarTreeWidget->topLevelItemCount(); i++) {
|
||||
QTreeWidgetItem* toplevel = ui->toolbarTreeWidget->topLevelItem(i);
|
||||
for (int j=0; j<toplevel->childCount(); j++) {
|
||||
QTreeWidgetItem* item = toplevel->child(j);
|
||||
QByteArray command = item->data(0, Qt::UserRole).toByteArray();
|
||||
@@ -623,19 +626,19 @@ void DlgCustomToolbars::onModifyMacroAction(const QByteArray& macro)
|
||||
void DlgCustomToolbars::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
this->retranslateUi(this);
|
||||
int count = categoryBox->count();
|
||||
ui->retranslateUi(this);
|
||||
int count = ui->categoryBox->count();
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
for (int i=0; i<count; i++) {
|
||||
QVariant data = categoryBox->itemData(i, Qt::UserRole);
|
||||
QVariant data = ui->categoryBox->itemData(i, Qt::UserRole);
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(data.toByteArray());
|
||||
if (!aCmds.empty()) {
|
||||
QString text = qApp->translate(aCmds[0]->className(), aCmds[0]->getGroupName());
|
||||
categoryBox->setItemText(i, text);
|
||||
ui->categoryBox->setItemText(i, text);
|
||||
}
|
||||
}
|
||||
on_categoryBox_activated(categoryBox->currentIndex());
|
||||
on_categoryBox_activated(ui->categoryBox->currentIndex());
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
@@ -663,7 +666,7 @@ DlgCustomToolbarsImp::~DlgCustomToolbarsImp()
|
||||
|
||||
void DlgCustomToolbarsImp::addCustomToolbar(const QString& name)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QToolBar* bar = getMainWindow()->addToolBar(name);
|
||||
@@ -673,7 +676,7 @@ void DlgCustomToolbarsImp::addCustomToolbar(const QString& name)
|
||||
|
||||
void DlgCustomToolbarsImp::removeCustomToolbar(const QString& name)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
|
||||
@@ -688,7 +691,7 @@ void DlgCustomToolbarsImp::removeCustomToolbar(const QString& name)
|
||||
|
||||
void DlgCustomToolbarsImp::renameCustomToolbar(const QString& old_name, const QString& new_name)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(old_name);
|
||||
@@ -739,7 +742,7 @@ void DlgCustomToolbarsImp::setActionGroup(QAction* action, const QList<QAction*>
|
||||
|
||||
void DlgCustomToolbarsImp::addCustomCommand(const QString& name, const QByteArray& cmd)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
|
||||
@@ -766,7 +769,7 @@ void DlgCustomToolbarsImp::addCustomCommand(const QString& name, const QByteArra
|
||||
|
||||
void DlgCustomToolbarsImp::removeCustomCommand(const QString& name, const QByteArray& userdata)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
|
||||
@@ -796,7 +799,7 @@ void DlgCustomToolbarsImp::removeCustomCommand(const QString& name, const QByteA
|
||||
|
||||
void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteArray& userdata)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
|
||||
@@ -837,7 +840,7 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA
|
||||
|
||||
void DlgCustomToolbarsImp::moveDownCustomCommand(const QString& name, const QByteArray& userdata)
|
||||
{
|
||||
QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole);
|
||||
QVariant data = ui->workbenchBox->itemData(ui->workbenchBox->currentIndex(), Qt::UserRole);
|
||||
Workbench* w = WorkbenchManager::instance()->active();
|
||||
if (w && w->name() == std::string((const char*)data.toByteArray())) {
|
||||
QList<QToolBar*> bars = getMainWindow()->findChildren<QToolBar*>(name);
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
#ifndef GUI_DIALOG_DLGTOOLBARS_IMP_H
|
||||
#define GUI_DIALOG_DLGTOOLBARS_IMP_H
|
||||
|
||||
#include "ui_DlgToolbars.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgCustomToolbars;
|
||||
|
||||
/** This class implements the creation of user defined toolbars.
|
||||
* In the left panel are shown all command groups with their command objects.
|
||||
@@ -38,7 +39,7 @@ namespace Dialog {
|
||||
*
|
||||
* \author Werner Mayer
|
||||
*/
|
||||
class DlgCustomToolbars : public CustomizeActionPage, public Ui_DlgCustomToolbars
|
||||
class DlgCustomToolbars : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -77,6 +78,8 @@ private:
|
||||
void importCustomToolbars(const QByteArray&);
|
||||
void exportCustomToolbars(const QByteArray&);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<Ui_DlgCustomToolbars> ui;
|
||||
private:
|
||||
Type type;
|
||||
};
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#endif
|
||||
|
||||
#include "DlgWorkbenchesImp.h"
|
||||
#include "ui_DlgWorkbenches.h"
|
||||
#include "Application.h"
|
||||
#include "BitmapFactory.h"
|
||||
#include "Command.h"
|
||||
@@ -47,17 +48,18 @@ const QString DlgWorkbenchesImp::all_workbenches = QString::fromLatin1("ALL");
|
||||
|
||||
DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
|
||||
: CustomizeActionPage(parent)
|
||||
, ui(new Ui_DlgWorkbenches)
|
||||
{
|
||||
this->setupUi(this);
|
||||
set_lw_properties(lw_enabled_workbenches);
|
||||
set_lw_properties(lw_disabled_workbenches);
|
||||
lw_disabled_workbenches->setProperty("OnlyAcceptFrom",
|
||||
QStringList() << lw_enabled_workbenches->objectName());
|
||||
lw_disabled_workbenches->setSortingEnabled(true);
|
||||
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);
|
||||
|
||||
lw_enabled_workbenches->setProperty("OnlyAcceptFrom",
|
||||
QStringList() << lw_enabled_workbenches->objectName()
|
||||
<< lw_disabled_workbenches->objectName());
|
||||
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();
|
||||
@@ -65,21 +67,21 @@ DlgWorkbenchesImp::DlgWorkbenchesImp(QWidget* parent)
|
||||
|
||||
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) {
|
||||
if (workbenches.contains(*it)) {
|
||||
add_workbench(lw_enabled_workbenches, *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(lw_disabled_workbenches, *it);
|
||||
add_workbench(ui->lw_disabled_workbenches, *it);
|
||||
} else if (!enabled_wbs_list.contains(*it)){
|
||||
qDebug() << "Adding unknown " << *it << "workbench.";
|
||||
add_workbench(lw_enabled_workbenches, *it);
|
||||
add_workbench(ui->lw_enabled_workbenches, *it);
|
||||
}
|
||||
}
|
||||
lw_enabled_workbenches->setCurrentRow(0);
|
||||
lw_disabled_workbenches->setCurrentRow(0);
|
||||
ui->lw_enabled_workbenches->setCurrentRow(0);
|
||||
ui->lw_disabled_workbenches->setCurrentRow(0);
|
||||
}
|
||||
|
||||
/** Destroys the object and frees any allocated resources */
|
||||
@@ -109,7 +111,7 @@ void DlgWorkbenchesImp::add_workbench(QListWidgetCustom *lw, const QString& it)
|
||||
void DlgWorkbenchesImp::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateUi(this);
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
else {
|
||||
QWidget::changeEvent(e);
|
||||
@@ -148,17 +150,17 @@ void DlgWorkbenchesImp::move_workbench(QListWidgetCustom *lwc_dest,
|
||||
|
||||
void DlgWorkbenchesImp::on_add_to_enabled_workbenches_btn_clicked()
|
||||
{
|
||||
QListWidgetItem* ci = lw_disabled_workbenches->currentItem();
|
||||
QListWidgetItem* ci = ui->lw_disabled_workbenches->currentItem();
|
||||
if (ci) {
|
||||
move_workbench(lw_enabled_workbenches, ci);
|
||||
move_workbench(ui->lw_enabled_workbenches, ci);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgWorkbenchesImp::on_remove_from_enabled_workbenches_btn_clicked()
|
||||
{
|
||||
QListWidgetItem* ci = lw_enabled_workbenches->currentItem();
|
||||
QListWidgetItem* ci = ui->lw_enabled_workbenches->currentItem();
|
||||
if (ci) {
|
||||
move_workbench(lw_disabled_workbenches, ci);
|
||||
move_workbench(ui->lw_disabled_workbenches, ci);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,11 +172,11 @@ void DlgWorkbenchesImp::shift_workbench(bool up)
|
||||
} 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,14 +192,14 @@ void DlgWorkbenchesImp::on_shift_workbench_down_btn_clicked()
|
||||
|
||||
void DlgWorkbenchesImp::on_sort_enabled_workbenches_btn_clicked()
|
||||
{
|
||||
lw_enabled_workbenches->sortItems();
|
||||
ui->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);
|
||||
while (ui->lw_disabled_workbenches->count() > 0) {
|
||||
QListWidgetItem* item = ui->lw_disabled_workbenches->item(0);
|
||||
move_workbench(ui->lw_enabled_workbenches, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,19 +246,19 @@ void DlgWorkbenchesImp::save_workbenches()
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches");
|
||||
hGrp->Clear();
|
||||
|
||||
if (lw_enabled_workbenches->count() == 0) {
|
||||
if (ui->lw_enabled_workbenches->count() == 0) {
|
||||
enabled_wbs.append(QString::fromLatin1("NoneWorkbench"));
|
||||
} else {
|
||||
for (int i = 0; i < lw_enabled_workbenches->count(); i++) {
|
||||
QVariant item_data = lw_enabled_workbenches->item(i)->data(Qt::UserRole);
|
||||
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 < lw_disabled_workbenches->count(); i++) {
|
||||
QVariant item_data = lw_disabled_workbenches->item(i)->data(Qt::UserRole);
|
||||
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(","));
|
||||
}
|
||||
|
||||
@@ -24,13 +24,17 @@
|
||||
#ifndef GUI_DIALOG_DLGWORKBENCHES_IMP_H
|
||||
#define GUI_DIALOG_DLGWORKBENCHES_IMP_H
|
||||
|
||||
#include "ui_DlgWorkbenches.h"
|
||||
#include "PropertyPage.h"
|
||||
#include <memory>
|
||||
|
||||
class QListWidgetCustom;
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Gui {
|
||||
namespace Dialog {
|
||||
class Ui_DlgWorkbenches;
|
||||
|
||||
class DlgWorkbenchesImp : public CustomizeActionPage, public Ui_DlgWorkbenches
|
||||
class DlgWorkbenchesImp : public CustomizeActionPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -63,6 +67,9 @@ private:
|
||||
QListWidgetItem *wi);
|
||||
void save_workbenches();
|
||||
void shift_workbench(bool up);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui_DlgWorkbenches> ui;
|
||||
};
|
||||
|
||||
} // namespace Dialog
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
# include <QThread>
|
||||
# include <QBuffer>
|
||||
# include <QByteArray>
|
||||
# include <QCheckBox>
|
||||
# include <QClipboard>
|
||||
# include <QMimeData>
|
||||
# include <QCloseEvent>
|
||||
@@ -72,6 +73,7 @@
|
||||
#include "Assistant.h"
|
||||
#include "DownloadManager.h"
|
||||
#include "WaitCursor.h"
|
||||
#include "FileDialog.h"
|
||||
|
||||
#include "Action.h"
|
||||
#include "Command.h"
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "DlgCustomizeSpNavSettings.h"
|
||||
#include "InputField.h"
|
||||
#include "QuantitySpinBox.h"
|
||||
#include "PrefWidgets.h"
|
||||
|
||||
using namespace Gui;
|
||||
using namespace Gui::Dialog;
|
||||
|
||||
Reference in New Issue
Block a user