Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ add_library(${module_name}
virtualconsole/vcmatrixproperties.cpp virtualconsole/vcmatrixproperties.h virtualconsole/vcmatrixproperties.ui
virtualconsole/vcproperties.cpp virtualconsole/vcproperties.h virtualconsole/vcproperties.ui
virtualconsole/vcpropertieseditor.cpp virtualconsole/vcpropertieseditor.h
virtualconsole/vcscrollarea.cpp virtualconsole/vcscrollarea.h
virtualconsole/vcslider.cpp virtualconsole/vcslider.h
virtualconsole/vcsliderproperties.cpp virtualconsole/vcsliderproperties.h virtualconsole/vcsliderproperties.ui
virtualconsole/vcsoloframe.cpp virtualconsole/vcsoloframe.h
Expand Down
11 changes: 5 additions & 6 deletions ui/src/assignhotkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define SETTINGS_GEOMETRY "assignhotkey/geometry"
#define SETTINGS_AUTOCLOSE "assignhotkey/autoclose"


/*****************************************************************************
* Initialization
*****************************************************************************/
Expand Down Expand Up @@ -59,11 +60,8 @@ AssignHotKey::AssignHotKey(QWidget* parent, const QKeySequence& keySequence)
m_infoText->setFocusPolicy(Qt::NoFocus);
m_buttonBox->setFocusPolicy(Qt::NoFocus);

m_previewEdit->setReadOnly(true);
m_previewEdit->setAlignment(Qt::AlignCenter);

m_keySequence = QKeySequence(keySequence);
m_previewEdit->setText(m_keySequence.toString(QKeySequence::NativeText));
m_previewLabel->setText(m_keySequence.toString(QKeySequence::NativeText));

QSettings settings;
m_autoCloseCheckBox->setChecked(settings.value(SETTINGS_AUTOCLOSE).toBool());
Expand All @@ -89,13 +87,14 @@ void AssignHotKey::keyPressEvent(QKeyEvent* event)
{
int key = event->key();
if (event->key() == Qt::Key_Control || event->key() == Qt::Key_Alt ||
event->key() == Qt::Key_Shift || event->key() == Qt::Key_Meta)
event->key() == Qt::Key_Shift || event->key() == Qt::Key_Meta ||
event->modifiers() == Qt::ControlModifier)
{
key = 0;
}

m_keySequence = QKeySequence(key | (event->modifiers() & ~Qt::ControlModifier));
m_previewEdit->setText(m_keySequence.toString(QKeySequence::NativeText));
m_previewLabel->setText(m_keySequence.toString(QKeySequence::NativeText));

if (m_autoCloseCheckBox->isChecked() == true && key != 0)
accept();
Expand Down
23 changes: 19 additions & 4 deletions ui/src/assignhotkey.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<widget class="QTextBrowser" name="m_infoText"/>
</item>
<item>
<widget class="QLabel" name="m_previewLabel">
<widget class="QLabel" name="m_keyCombinationLabel">
<property name="text">
<string>Key combination</string>
</property>
Expand All @@ -47,12 +47,27 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_previewEdit">
<widget class="QLabel" name="m_previewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="readOnly">
<bool>true</bool>
<property name="margin">
<number>3</number>
</property>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions ui/src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ HEADERS += virtualconsole/addvcbuttonmatrix.h \
virtualconsole/vcmatrixproperties.h \
virtualconsole/vcproperties.h \
virtualconsole/vcpropertieseditor.h \
virtualconsole/vcscrollarea.h \
virtualconsole/vcslider.h \
virtualconsole/vcsliderproperties.h \
virtualconsole/vcsoloframe.h \
Expand Down Expand Up @@ -337,6 +338,7 @@ SOURCES += virtualconsole/addvcbuttonmatrix.cpp \
virtualconsole/vcmatrixproperties.cpp \
virtualconsole/vcproperties.cpp \
virtualconsole/vcpropertieseditor.cpp \
virtualconsole/vcscrollarea.cpp \
virtualconsole/vcslider.cpp \
virtualconsole/vcsliderproperties.cpp \
virtualconsole/vcsoloframe.cpp \
Expand Down
27 changes: 27 additions & 0 deletions ui/src/virtualconsole/vcproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
VCProperties::VCProperties()
: m_size(QSize(1920, 1080))
, m_gmVisible(true)
, m_keyboardScroll(true)
, m_gmChannelMode(GrandMaster::Intensity)
, m_gmValueMode(GrandMaster::Reduce)
, m_gmSliderMode(GrandMaster::Normal)
Expand All @@ -45,6 +46,7 @@ VCProperties::VCProperties()
VCProperties::VCProperties(const VCProperties& properties)
: m_size(properties.m_size)
, m_gmVisible(properties.m_gmVisible)
, m_keyboardScroll(properties.m_keyboardScroll)
, m_gmChannelMode(properties.m_gmChannelMode)
, m_gmValueMode(properties.m_gmValueMode)
, m_gmSliderMode(properties.m_gmSliderMode)
Expand All @@ -63,6 +65,7 @@ VCProperties &VCProperties::operator=(const VCProperties &props)
{
m_size = props.m_size;
m_gmVisible = props.m_gmVisible;
m_keyboardScroll = props.m_keyboardScroll;
m_gmChannelMode = props.m_gmChannelMode;
m_gmValueMode = props.m_gmValueMode;
m_gmSliderMode = props.m_gmSliderMode;
Expand All @@ -87,6 +90,20 @@ QSize VCProperties::size() const
return m_size;
}

/*****************************************************************************
* Keyboard scrolling
*****************************************************************************/

void VCProperties::setKeyboardScroll(const bool enable)
{
m_keyboardScroll = enable;
}

bool VCProperties::keyboardScroll() const
{
return m_keyboardScroll;
}

/*****************************************************************************
* Grand Master
*****************************************************************************/
Expand Down Expand Up @@ -179,6 +196,15 @@ bool VCProperties::loadXML(QXmlStreamReader &root)
/* Set size if both are valid */
if (sz.isValid() == true)
setSize(sz);
\
bool keyboardScroll = true;

/* Keyboard scrolling */
str = root.attributes().value(KXMLQLCVCPropertiesKeyboardScroll).toString();
if (str.isEmpty() == false)
keyboardScroll = QVariant(str).toBool();
setKeyboardScroll(keyboardScroll);

root.skipCurrentElement();
}
else if (root.name() == KXMLQLCVCPropertiesGrandMaster)
Expand Down Expand Up @@ -242,6 +268,7 @@ bool VCProperties::saveXML(QXmlStreamWriter *doc) const
doc->writeStartElement(KXMLQLCVCPropertiesSize);
doc->writeAttribute(KXMLQLCVCPropertiesSizeWidth, QString::number(size().width()));
doc->writeAttribute(KXMLQLCVCPropertiesSizeHeight, QString::number(size().height()));
doc->writeAttribute(KXMLQLCVCPropertiesKeyboardScroll, QVariant(keyboardScroll()).toString());
doc->writeEndElement();

/***********************
Expand Down
22 changes: 17 additions & 5 deletions ui/src/virtualconsole/vcproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ class Doc;
* @{
*/

#define KXMLQLCVirtualConsole QStringLiteral("VirtualConsole")
#define KXMLQLCVirtualConsole QStringLiteral("VirtualConsole")

#define KXMLQLCVCProperties QStringLiteral("Properties")
#define KXMLQLCVCPropertiesSize QStringLiteral("Size")
#define KXMLQLCVCPropertiesSizeWidth QStringLiteral("Width")
#define KXMLQLCVCPropertiesSizeHeight QStringLiteral("Height")
#define KXMLQLCVCProperties QStringLiteral("Properties")
#define KXMLQLCVCPropertiesSize QStringLiteral("Size")
#define KXMLQLCVCPropertiesSizeWidth QStringLiteral("Width")
#define KXMLQLCVCPropertiesSizeHeight QStringLiteral("Height")
#define KXMLQLCVCPropertiesKeyboardScroll QStringLiteral("KeyboardScroll")

#define KXMLQLCVCPropertiesGrandMaster QStringLiteral("GrandMaster")
#define KXMLQLCVCPropertiesGrandMasterVisible QStringLiteral("Visible")
Expand Down Expand Up @@ -98,8 +99,19 @@ class VCProperties
quint32 grandMasterInputUniverse() const;
quint32 grandMasterInputChannel() const;

/*********************************************************************
* Keyboard scrolling
*********************************************************************/

/** Set Virtual Console keyboard scrolling */
void setKeyboardScroll(const bool enable);

/** Get Virtual Console keyboard scrolling */
bool keyboardScroll() const;

private:
bool m_gmVisible;
bool m_keyboardScroll;
GrandMaster::ChannelMode m_gmChannelMode;
GrandMaster::ValueMode m_gmValueMode;
GrandMaster::SliderMode m_gmSliderMode;
Expand Down
46 changes: 46 additions & 0 deletions ui/src/virtualconsole/vcproperties.ui
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,35 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="m_scrollGroup">
<property name="title">
<string>Scrolling</string>
</property>
<layout class="QGridLayout" name="gridLayout_1">
<item row="0" column="0">
<widget class="QCheckBox" name="m_enableKeyboardScroll">
<property name="text">
<string>Use arrow and PgUp/PgDown keys to scroll</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="m_keyboardScrollWarning">
<property name="text">
<string>Note: enabling keyboard scroll prevents using arrow and PgUp/PgDown keys in Key combinations for console controls.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
Expand Down Expand Up @@ -830,6 +859,7 @@
<tabstops>
<tabstop>m_sizeXSpin</tabstop>
<tabstop>m_sizeYSpin</tabstop>
<tabstop>m_enableKeyboardScroll</tabstop>
<tabstop>m_buttonWspin</tabstop>
<tabstop>m_buttonHspin</tabstop>
<tabstop>m_sliderWspin</tabstop>
Expand Down Expand Up @@ -1004,6 +1034,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_enableKeyboardScroll</sender>
<signal>toggled(bool)</signal>
<receiver>VCPropertiesEditor</receiver>
<slot>slotKeyboardScrollToggled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>190</x>
<y>198</y>
</hint>
<hint type="destinationlabel">
<x>190</x>
<y>245</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_gmVisible</sender>
<signal>toggled(bool)</signal>
Expand Down
6 changes: 6 additions & 0 deletions ui/src/virtualconsole/vcpropertieseditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ VCPropertiesEditor::VCPropertiesEditor(QWidget* parent, const VCProperties& prop
/* General page */
m_sizeXSpin->setValue(properties.size().width());
m_sizeYSpin->setValue(properties.size().height());
m_enableKeyboardScroll->setChecked(properties.keyboardScroll());

/* Widgets page */
QSettings settings;
Expand Down Expand Up @@ -321,6 +322,11 @@ void VCPropertiesEditor::slotSizeYChanged(int value)
m_properties.setSize(sz);
}

void VCPropertiesEditor::slotKeyboardScrollToggled(bool checked)
{
m_properties.setKeyboardScroll(checked);
}

void VCPropertiesEditor::slotSpeedDialConfirmed()
{
if (m_speedValueEdit->text().contains(".") == false)
Expand Down
1 change: 1 addition & 0 deletions ui/src/virtualconsole/vcpropertieseditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class VCPropertiesEditor : public QDialog, public Ui_VCPropertiesEditor
private slots:
void slotSizeXChanged(int value);
void slotSizeYChanged(int value);
void slotKeyboardScrollToggled(bool checked);

/*************************************************************************
* Widgets page
Expand Down
18 changes: 18 additions & 0 deletions ui/src/virtualconsole/vcscrollarea.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "vcscrollarea.h"
#include "qevent.h"

VCScrollArea::VCScrollArea(QWidget *parent) : QScrollArea(parent), m_keyPassthru(false) {
// nothing more right now
}

void VCScrollArea::keyPressEvent(QKeyEvent *ev) {
if (m_keyPassthru) {
ev->ignore();
} else {
QScrollArea::keyPressEvent(ev);
}
}

void VCScrollArea::setKeyPassthruEnabled(bool enable) {
m_keyPassthru = enable;
}
23 changes: 23 additions & 0 deletions ui/src/virtualconsole/vcscrollarea.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef VCSCROLLAREA_H
#define VCSCROLLAREA_H

#include <QObject>
#include <QScrollArea>
#include <QWidget>

class VCScrollArea : public QScrollArea
{
Q_OBJECT
public:
explicit VCScrollArea(QWidget *parent = nullptr);

void setKeyPassthruEnabled(bool enabled);

protected:
void keyPressEvent(QKeyEvent *) override;

private:
bool m_keyPassthru;
};

#endif // VCSCROLLAREA_H
Loading
Loading