mirror of
https://github.com/leozide/leocad
synced 2025-01-29 20:34:50 +01:00
Added mouse preferences tab.
This commit is contained in:
parent
5b0bf780cc
commit
26f9859a8e
11 changed files with 442 additions and 85 deletions
|
@ -472,8 +472,11 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
Options.CategoriesDefault = false;
|
Options.CategoriesDefault = false;
|
||||||
|
|
||||||
Options.KeyboardShortcuts = gKeyboardShortcuts;
|
Options.KeyboardShortcuts = gKeyboardShortcuts;
|
||||||
Options.ShortcutsModified = false;
|
Options.KeyboardShortcutsModified = false;
|
||||||
Options.ShortcutsDefault = false;
|
Options.KeyboardShortcutsDefault = false;
|
||||||
|
Options.MouseShortcuts = gMouseShortcuts;
|
||||||
|
Options.MouseShortcutsModified = false;
|
||||||
|
Options.MouseShortcutsDefault = false;
|
||||||
|
|
||||||
if (!gMainWindow->DoDialog(LC_DIALOG_PREFERENCES, &Options))
|
if (!gMainWindow->DoDialog(LC_DIALOG_PREFERENCES, &Options))
|
||||||
return;
|
return;
|
||||||
|
@ -513,9 +516,9 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
gMainWindow->UpdateCategories();
|
gMainWindow->UpdateCategories();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Options.ShortcutsModified)
|
if (Options.KeyboardShortcutsModified)
|
||||||
{
|
{
|
||||||
if (Options.ShortcutsDefault)
|
if (Options.KeyboardShortcutsDefault)
|
||||||
lcResetDefaultKeyboardShortcuts();
|
lcResetDefaultKeyboardShortcuts();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -526,6 +529,17 @@ void lcApplication::ShowPreferencesDialog()
|
||||||
gMainWindow->UpdateShortcuts();
|
gMainWindow->UpdateShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Options.MouseShortcutsModified)
|
||||||
|
{
|
||||||
|
if (Options.MouseShortcutsDefault)
|
||||||
|
lcResetDefaultMouseShortcuts();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMouseShortcuts = Options.MouseShortcuts;
|
||||||
|
lcSaveDefaultMouseShortcuts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: printing preferences
|
// TODO: printing preferences
|
||||||
/*
|
/*
|
||||||
strcpy(opts.strFooter, m_strFooter);
|
strcpy(opts.strFooter, m_strFooter);
|
||||||
|
|
|
@ -106,8 +106,12 @@ struct lcPreferencesDialogOptions
|
||||||
bool CategoriesDefault;
|
bool CategoriesDefault;
|
||||||
|
|
||||||
lcKeyboardShortcuts KeyboardShortcuts;
|
lcKeyboardShortcuts KeyboardShortcuts;
|
||||||
bool ShortcutsModified;
|
bool KeyboardShortcutsModified;
|
||||||
bool ShortcutsDefault;
|
bool KeyboardShortcutsDefault;
|
||||||
|
|
||||||
|
lcMouseShortcuts MouseShortcuts;
|
||||||
|
bool MouseShortcutsModified;
|
||||||
|
bool MouseShortcutsDefault;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LC_BASEWINDOW_H_
|
#endif // _LC_BASEWINDOW_H_
|
||||||
|
|
|
@ -1393,3 +1393,23 @@ lcCommand gCommands[LC_NUM_COMMANDS] =
|
||||||
};
|
};
|
||||||
|
|
||||||
LC_CASSERT(sizeof(gCommands)/sizeof(gCommands[0]) == LC_NUM_COMMANDS);
|
LC_CASSERT(sizeof(gCommands)/sizeof(gCommands[0]) == LC_NUM_COMMANDS);
|
||||||
|
|
||||||
|
QString gToolNames[LC_NUM_TOOLS] =
|
||||||
|
{
|
||||||
|
"NewPiece", // LC_TOOL_INSERT
|
||||||
|
"NewPointLight", // LC_TOOL_LIGHT
|
||||||
|
"NewSpotLight", // LC_TOOL_SPOTLIGHT
|
||||||
|
"NewCamera", // LC_TOOL_CAMERA
|
||||||
|
"Select", // LC_TOOL_SELECT
|
||||||
|
"Move", // LC_TOOL_MOVE
|
||||||
|
"Rotate", // LC_TOOL_ROTATE
|
||||||
|
"Delete", // LC_TOOL_ERASER
|
||||||
|
"Paint", // LC_TOOL_PAINT
|
||||||
|
"Zoom", // LC_TOOL_ZOOM
|
||||||
|
"Pan", // LC_TOOL_PAN
|
||||||
|
"Orbit", // LC_TOOL_ROTATE_VIEW
|
||||||
|
"Roll", // LC_TOOL_ROLL
|
||||||
|
"ZoomRegion" // LC_TOOL_ZOOM_REGION
|
||||||
|
};
|
||||||
|
|
||||||
|
LC_CASSERT(sizeof(gToolNames) / sizeof(gToolNames[0]) == LC_NUM_TOOLS);
|
||||||
|
|
|
@ -224,4 +224,25 @@ struct lcCommand
|
||||||
|
|
||||||
extern lcCommand gCommands[LC_NUM_COMMANDS];
|
extern lcCommand gCommands[LC_NUM_COMMANDS];
|
||||||
|
|
||||||
|
enum lcTool
|
||||||
|
{
|
||||||
|
LC_TOOL_INSERT,
|
||||||
|
LC_TOOL_LIGHT,
|
||||||
|
LC_TOOL_SPOTLIGHT,
|
||||||
|
LC_TOOL_CAMERA,
|
||||||
|
LC_TOOL_SELECT,
|
||||||
|
LC_TOOL_MOVE,
|
||||||
|
LC_TOOL_ROTATE,
|
||||||
|
LC_TOOL_ERASER,
|
||||||
|
LC_TOOL_PAINT,
|
||||||
|
LC_TOOL_ZOOM,
|
||||||
|
LC_TOOL_PAN,
|
||||||
|
LC_TOOL_ROTATE_VIEW,
|
||||||
|
LC_TOOL_ROLL,
|
||||||
|
LC_TOOL_ZOOM_REGION,
|
||||||
|
LC_NUM_TOOLS
|
||||||
|
};
|
||||||
|
|
||||||
|
extern QString gToolNames[LC_NUM_TOOLS];
|
||||||
|
|
||||||
#endif // _LC_COMMANDS_H_
|
#endif // _LC_COMMANDS_H_
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "lc_file.h"
|
#include "lc_file.h"
|
||||||
#include "lc_math.h"
|
#include "lc_math.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
|
#include "lc_commands.h"
|
||||||
|
|
||||||
#define LC_SEL_NO_PIECES 0x0001 // No pieces in model
|
#define LC_SEL_NO_PIECES 0x0001 // No pieces in model
|
||||||
#define LC_SEL_PIECE 0x0002 // At last 1 piece selected
|
#define LC_SEL_PIECE 0x0002 // At last 1 piece selected
|
||||||
|
@ -79,25 +80,6 @@ public:
|
||||||
lcVector3 mAmbientColor;
|
lcVector3 mAmbientColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum lcTool
|
|
||||||
{
|
|
||||||
LC_TOOL_INSERT,
|
|
||||||
LC_TOOL_LIGHT,
|
|
||||||
LC_TOOL_SPOTLIGHT,
|
|
||||||
LC_TOOL_CAMERA,
|
|
||||||
LC_TOOL_SELECT,
|
|
||||||
LC_TOOL_MOVE,
|
|
||||||
LC_TOOL_ROTATE,
|
|
||||||
LC_TOOL_ERASER,
|
|
||||||
LC_TOOL_PAINT,
|
|
||||||
LC_TOOL_ZOOM,
|
|
||||||
LC_TOOL_PAN,
|
|
||||||
LC_TOOL_ROTATE_VIEW,
|
|
||||||
LC_TOOL_ROLL,
|
|
||||||
LC_TOOL_ZOOM_REGION,
|
|
||||||
LC_NUM_TOOLS
|
|
||||||
};
|
|
||||||
|
|
||||||
struct lcModelHistoryEntry
|
struct lcModelHistoryEntry
|
||||||
{
|
{
|
||||||
QByteArray File;
|
QByteArray File;
|
||||||
|
|
|
@ -41,6 +41,23 @@ void lcLoadDefaultMouseShortcuts()
|
||||||
gMouseShortcuts.Reset();
|
gMouseShortcuts.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcSaveDefaultMouseShortcuts()
|
||||||
|
{
|
||||||
|
QByteArray Buffer;
|
||||||
|
QTextStream Stream(&Buffer, QIODevice::WriteOnly);
|
||||||
|
|
||||||
|
gMouseShortcuts.Save(Stream);
|
||||||
|
|
||||||
|
lcSetProfileBuffer(LC_PROFILE_MOUSE_SHORTCUTS, Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcResetDefaultMouseShortcuts()
|
||||||
|
{
|
||||||
|
gMouseShortcuts.Reset();
|
||||||
|
|
||||||
|
lcRemoveProfileKey(LC_PROFILE_MOUSE_SHORTCUTS);
|
||||||
|
}
|
||||||
|
|
||||||
void lcKeyboardShortcuts::Reset()
|
void lcKeyboardShortcuts::Reset()
|
||||||
{
|
{
|
||||||
for (int CommandIdx = 0; CommandIdx < LC_NUM_COMMANDS; CommandIdx++)
|
for (int CommandIdx = 0; CommandIdx < LC_NUM_COMMANDS; CommandIdx++)
|
||||||
|
@ -125,26 +142,6 @@ void lcMouseShortcuts::Reset()
|
||||||
mShortcuts[LC_TOOL_ZOOM].Button = Qt::RightButton;
|
mShortcuts[LC_TOOL_ZOOM].Button = Qt::RightButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString gToolNames[LC_NUM_TOOLS] =
|
|
||||||
{
|
|
||||||
"AddPiece", // LC_TOOL_INSERT
|
|
||||||
"AddPointLight", // LC_TOOL_LIGHT
|
|
||||||
"AddSpotLight", // LC_TOOL_SPOTLIGHT
|
|
||||||
"AddCamera", // LC_TOOL_CAMERA
|
|
||||||
"Select", // LC_TOOL_SELECT
|
|
||||||
"Move", // LC_TOOL_MOVE
|
|
||||||
"Rotate", // LC_TOOL_ROTATE
|
|
||||||
"Delete", // LC_TOOL_ERASER
|
|
||||||
"Paint", // LC_TOOL_PAINT
|
|
||||||
"CameraZoom", // LC_TOOL_ZOOM
|
|
||||||
"CameraPan", // LC_TOOL_PAN
|
|
||||||
"CameraOrbit", // LC_TOOL_ROTATE_VIEW
|
|
||||||
"CameraRoll", // LC_TOOL_ROLL
|
|
||||||
"CameraZoomRegion" // LC_TOOL_ZOOM_REGION
|
|
||||||
};
|
|
||||||
|
|
||||||
LC_CASSERT(sizeof(gToolNames)/sizeof(gToolNames[0]) == LC_NUM_TOOLS);
|
|
||||||
|
|
||||||
bool lcMouseShortcuts::Save(QTextStream& Stream)
|
bool lcMouseShortcuts::Save(QTextStream& Stream)
|
||||||
{
|
{
|
||||||
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
|
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
|
||||||
|
@ -156,7 +153,8 @@ bool lcMouseShortcuts::Save(QTextStream& Stream)
|
||||||
if (!ButtonIndex)
|
if (!ButtonIndex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Stream << gToolNames[ToolIdx] << QLatin1String("=") << QKeySequence(mShortcuts[ToolIdx].Modifiers | (Qt::Key_0 + ButtonIndex)).toString() << QLatin1String("\n");
|
QString Shortcut = QKeySequence(mShortcuts[ToolIdx].Modifiers | (Qt::Key_0 + ButtonIndex)).toString(QKeySequence::PortableText);
|
||||||
|
Stream << gToolNames[ToolIdx] << QLatin1String("=") << Shortcut << QLatin1String("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream.flush();
|
Stream.flush();
|
||||||
|
@ -191,7 +189,7 @@ bool lcMouseShortcuts::Load(QTextStream& Stream)
|
||||||
|
|
||||||
int Shortcut = KeySequence[0];
|
int Shortcut = KeySequence[0];
|
||||||
mShortcuts[ToolIdx].Modifiers = (Qt::KeyboardModifier)(Shortcut & Qt::KeyboardModifierMask);
|
mShortcuts[ToolIdx].Modifiers = (Qt::KeyboardModifier)(Shortcut & Qt::KeyboardModifierMask);
|
||||||
mShortcuts[ToolIdx].Button = (Qt::MouseButton)(1 << (Shortcut & ~Qt::KeyboardModifierMask));
|
mShortcuts[ToolIdx].Button = (Qt::MouseButton)(1 << ((Shortcut & ~Qt::KeyboardModifierMask) - Qt::Key_0 - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define _LC_SHORTCUTS_H_
|
#define _LC_SHORTCUTS_H_
|
||||||
|
|
||||||
#include "lc_commands.h"
|
#include "lc_commands.h"
|
||||||
#include "lc_model.h"
|
|
||||||
|
|
||||||
class lcKeyboardShortcuts
|
class lcKeyboardShortcuts
|
||||||
{
|
{
|
||||||
|
|
|
@ -1627,7 +1627,7 @@ lcTool View::GetCurrentTool() const
|
||||||
|
|
||||||
lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
|
lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
|
||||||
{
|
{
|
||||||
lcTool OverrideTool = gMouseShortcuts.GetTool(Qt::LeftButton, mInputState.Modifiers);
|
lcTool OverrideTool = gMouseShortcuts.GetTool(Button, mInputState.Modifiers);
|
||||||
|
|
||||||
if (OverrideTool == LC_NUM_TOOLS)
|
if (OverrideTool == LC_NUM_TOOLS)
|
||||||
return LC_TRACKTOOL_NONE;
|
return LC_TRACKTOOL_NONE;
|
||||||
|
|
|
@ -20,6 +20,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
||||||
connect(ui->categoriesTree, SIGNAL(itemSelectionChanged()), this, SLOT(updateParts()));
|
connect(ui->categoriesTree, SIGNAL(itemSelectionChanged()), this, SLOT(updateParts()));
|
||||||
ui->shortcutEdit->installEventFilter(this);
|
ui->shortcutEdit->installEventFilter(this);
|
||||||
connect(ui->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(commandChanged(QTreeWidgetItem*)));
|
connect(ui->commandList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(commandChanged(QTreeWidgetItem*)));
|
||||||
|
connect(ui->mouseTree, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(MouseTreeItemChanged(QTreeWidgetItem*)));
|
||||||
|
|
||||||
options = (lcPreferencesDialogOptions*)data;
|
options = (lcPreferencesDialogOptions*)data;
|
||||||
|
|
||||||
|
@ -64,9 +65,12 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
||||||
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(0));
|
ui->categoriesTree->setCurrentItem(ui->categoriesTree->topLevelItem(0));
|
||||||
|
|
||||||
updateCommandList();
|
updateCommandList();
|
||||||
|
|
||||||
new lcQTreeWidgetColumnStretcher(ui->commandList, 0);
|
new lcQTreeWidgetColumnStretcher(ui->commandList, 0);
|
||||||
commandChanged(NULL);
|
commandChanged(NULL);
|
||||||
|
|
||||||
|
UpdateMouseTree();
|
||||||
|
new lcQTreeWidgetColumnStretcher(ui->mouseTree, 0);
|
||||||
|
MouseTreeItemChanged(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcQPreferencesDialog::~lcQPreferencesDialog()
|
lcQPreferencesDialog::~lcQPreferencesDialog()
|
||||||
|
@ -536,8 +540,8 @@ void lcQPreferencesDialog::on_shortcutAssign_clicked()
|
||||||
|
|
||||||
setShortcutModified(current, options->KeyboardShortcuts.mShortcuts[shortcutIndex] != gCommands[shortcutIndex].DefaultShortcut);
|
setShortcutModified(current, options->KeyboardShortcuts.mShortcuts[shortcutIndex] != gCommands[shortcutIndex].DefaultShortcut);
|
||||||
|
|
||||||
options->ShortcutsModified = true;
|
options->KeyboardShortcutsModified = true;
|
||||||
options->ShortcutsDefault = false;
|
options->KeyboardShortcutsDefault = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPreferencesDialog::on_shortcutRemove_clicked()
|
void lcQPreferencesDialog::on_shortcutRemove_clicked()
|
||||||
|
@ -563,8 +567,8 @@ void lcQPreferencesDialog::on_shortcutsImport_clicked()
|
||||||
|
|
||||||
options->KeyboardShortcuts = Shortcuts;
|
options->KeyboardShortcuts = Shortcuts;
|
||||||
|
|
||||||
options->ShortcutsModified = true;
|
options->KeyboardShortcutsModified = true;
|
||||||
options->ShortcutsDefault = false;
|
options->KeyboardShortcutsDefault = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcQPreferencesDialog::on_shortcutsExport_clicked()
|
void lcQPreferencesDialog::on_shortcutsExport_clicked()
|
||||||
|
@ -589,6 +593,161 @@ void lcQPreferencesDialog::on_shortcutsReset_clicked()
|
||||||
options->KeyboardShortcuts.Reset();
|
options->KeyboardShortcuts.Reset();
|
||||||
updateCommandList();
|
updateCommandList();
|
||||||
|
|
||||||
options->ShortcutsModified = true;
|
options->KeyboardShortcutsModified = true;
|
||||||
options->ShortcutsDefault = true;
|
options->KeyboardShortcutsDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::UpdateMouseTree()
|
||||||
|
{
|
||||||
|
ui->mouseTree->clear();
|
||||||
|
|
||||||
|
for (int ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
|
||||||
|
UpdateMouseTreeItem(ToolIdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::UpdateMouseTreeItem(int ItemIndex)
|
||||||
|
{
|
||||||
|
Qt::MouseButton Button = options->MouseShortcuts.mShortcuts[ItemIndex].Button;
|
||||||
|
QString Shortcut = QKeySequence(options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers).toString(QKeySequence::NativeText);
|
||||||
|
|
||||||
|
switch (Button)
|
||||||
|
{
|
||||||
|
case Qt::LeftButton:
|
||||||
|
Shortcut += tr("Left Button");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::MiddleButton:
|
||||||
|
Shortcut += tr("Middle Button");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::RightButton:
|
||||||
|
Shortcut += tr("Right Button");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Shortcut.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeWidgetItem* Item = ui->mouseTree->topLevelItem(ItemIndex);
|
||||||
|
|
||||||
|
if (Item)
|
||||||
|
Item->setText(1, Shortcut);
|
||||||
|
else
|
||||||
|
new QTreeWidgetItem(ui->mouseTree, QStringList() << gToolNames[ItemIndex] << Shortcut);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::on_mouseAssign_clicked()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem* Current = ui->mouseTree->currentItem();
|
||||||
|
|
||||||
|
if (!Current)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ButtonIndex = ui->mouseButton->currentIndex();
|
||||||
|
Qt::MouseButton Button = Qt::NoButton;
|
||||||
|
Qt::KeyboardModifiers Modifiers = Qt::NoModifier;
|
||||||
|
|
||||||
|
if (ButtonIndex)
|
||||||
|
{
|
||||||
|
switch (ButtonIndex)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
Button = Qt::LeftButton;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
Button = Qt::MiddleButton;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
Button = Qt::RightButton;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->mouseControl->isChecked())
|
||||||
|
Modifiers |= Qt::ControlModifier;
|
||||||
|
|
||||||
|
if (ui->mouseShift->isChecked())
|
||||||
|
Modifiers |= Qt::ShiftModifier;
|
||||||
|
|
||||||
|
if (ui->mouseAlt->isChecked())
|
||||||
|
Modifiers |= Qt::AltModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ItemIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||||
|
options->MouseShortcuts.mShortcuts[ItemIndex].Button = Button;
|
||||||
|
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers = Modifiers;
|
||||||
|
|
||||||
|
options->MouseShortcutsModified = true;
|
||||||
|
options->MouseShortcutsDefault = false;
|
||||||
|
|
||||||
|
UpdateMouseTreeItem(ItemIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::on_mouseRemove_clicked()
|
||||||
|
{
|
||||||
|
QTreeWidgetItem* Current = ui->mouseTree->currentItem();
|
||||||
|
|
||||||
|
if (!Current)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int ItemIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||||
|
options->MouseShortcuts.mShortcuts[ItemIndex].Button = Qt::NoButton;
|
||||||
|
options->MouseShortcuts.mShortcuts[ItemIndex].Modifiers = Qt::NoModifier;
|
||||||
|
|
||||||
|
options->MouseShortcutsModified = true;
|
||||||
|
options->MouseShortcutsDefault = false;
|
||||||
|
|
||||||
|
UpdateMouseTreeItem(ItemIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::on_mouseReset_clicked()
|
||||||
|
{
|
||||||
|
if (QMessageBox::question(this, "LeoCAD", tr("Are you sure you want to load the default mouse shortcuts?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
options->MouseShortcuts.Reset();
|
||||||
|
UpdateMouseTree();
|
||||||
|
|
||||||
|
options->MouseShortcutsModified = true;
|
||||||
|
options->MouseShortcutsDefault = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
|
||||||
|
{
|
||||||
|
if (!Current)
|
||||||
|
{
|
||||||
|
ui->MouseShortcutGroup->setEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->MouseShortcutGroup->setEnabled(true);
|
||||||
|
|
||||||
|
int ToolIndex = ui->mouseTree->indexOfTopLevelItem(Current);
|
||||||
|
|
||||||
|
Qt::MouseButton Button = options->MouseShortcuts.mShortcuts[ToolIndex].Button;
|
||||||
|
|
||||||
|
switch (Button)
|
||||||
|
{
|
||||||
|
case Qt::LeftButton:
|
||||||
|
ui->mouseButton->setCurrentIndex(1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::MiddleButton:
|
||||||
|
ui->mouseButton->setCurrentIndex(2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::RightButton:
|
||||||
|
ui->mouseButton->setCurrentIndex(3);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ui->mouseButton->setCurrentIndex(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::KeyboardModifiers Modifiers = options->MouseShortcuts.mShortcuts[ToolIndex].Modifiers;
|
||||||
|
ui->mouseControl->setChecked((Modifiers & Qt::ControlModifier) != 0);
|
||||||
|
ui->mouseShift->setChecked((Modifiers & Qt::ShiftModifier) != 0);
|
||||||
|
ui->mouseAlt->setChecked((Modifiers & Qt::AltModifier) != 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,18 @@ public slots:
|
||||||
void on_shortcutsExport_clicked();
|
void on_shortcutsExport_clicked();
|
||||||
void on_shortcutsReset_clicked();
|
void on_shortcutsReset_clicked();
|
||||||
void commandChanged(QTreeWidgetItem *current);
|
void commandChanged(QTreeWidgetItem *current);
|
||||||
|
void on_mouseAssign_clicked();
|
||||||
|
void on_mouseRemove_clicked();
|
||||||
|
void on_mouseReset_clicked();
|
||||||
|
void MouseTreeItemChanged(QTreeWidgetItem* Current);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::lcQPreferencesDialog *ui;
|
Ui::lcQPreferencesDialog *ui;
|
||||||
|
|
||||||
void updateCategories();
|
void updateCategories();
|
||||||
void updateCommandList();
|
void updateCommandList();
|
||||||
|
void UpdateMouseTree();
|
||||||
|
void UpdateMouseTreeItem(int ItemIndex);
|
||||||
void setShortcutModified(QTreeWidgetItem *treeItem, bool modified);
|
void setShortcutModified(QTreeWidgetItem *treeItem, bool modified);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -137,32 +137,6 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Mouse sensitivity:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>mouseSensitivity</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QSlider" name="mouseSensitivity">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Check for updates:</string>
|
<string>Check for updates:</string>
|
||||||
|
@ -172,7 +146,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="1">
|
<item row="7" column="1">
|
||||||
<widget class="QComboBox" name="checkForUpdates">
|
<widget class="QComboBox" name="checkForUpdates">
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -191,7 +165,7 @@
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" colspan="2">
|
<item row="8" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="fixedDirectionKeys">
|
<widget class="QCheckBox" name="fixedDirectionKeys">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Fixed direction keys</string>
|
<string>Fixed direction keys</string>
|
||||||
|
@ -672,6 +646,187 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabMouse">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Mouse</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Mouse Shortcuts</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="mouseTree">
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="uniformRowHeights">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Action</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shortcut</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mouseReset">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="MouseShortcutGroup">
|
||||||
|
<property name="title">
|
||||||
|
<string>Shortcut</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>Button:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="mouseButton">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Left</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Middle</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Right</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Modifiers:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mouseControl">
|
||||||
|
<property name="text">
|
||||||
|
<string>Control</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mouseAlt">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alt</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="mouseShift">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shift</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mouseAssign">
|
||||||
|
<property name="text">
|
||||||
|
<string>Assign</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="mouseRemove">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mouse sensitivity:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="mouseSensitivity">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="pageStep">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -708,7 +863,6 @@
|
||||||
<tabstop>povrayExecutableBrowse</tabstop>
|
<tabstop>povrayExecutableBrowse</tabstop>
|
||||||
<tabstop>lgeoPath</tabstop>
|
<tabstop>lgeoPath</tabstop>
|
||||||
<tabstop>lgeoPathBrowse</tabstop>
|
<tabstop>lgeoPathBrowse</tabstop>
|
||||||
<tabstop>mouseSensitivity</tabstop>
|
|
||||||
<tabstop>checkForUpdates</tabstop>
|
<tabstop>checkForUpdates</tabstop>
|
||||||
<tabstop>fixedDirectionKeys</tabstop>
|
<tabstop>fixedDirectionKeys</tabstop>
|
||||||
<tabstop>antiAliasing</tabstop>
|
<tabstop>antiAliasing</tabstop>
|
||||||
|
|
Loading…
Add table
Reference in a new issue