diff options
author | Davide Beatrici <davidebeatrici@gmail.com> | 2019-12-28 23:09:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-28 23:09:03 +0300 |
commit | 2575d301fa1528cf1d38c003675e8b960bc19f68 (patch) | |
tree | c7b1fba8d588ecdc7790a2a6c62b87798b113951 | |
parent | 61ee9ddf6d425d4da0bbe871280b6764d4409098 (diff) | |
parent | 87ecbd8f561994d107e4fafaaef37d005f45fdc2 (diff) |
Merge PR #3919: Manual plugin UI improvement
-rw-r--r-- | src/mumble/ManualPlugin.cpp | 30 | ||||
-rw-r--r-- | src/mumble/ManualPlugin.ui | 109 | ||||
-rw-r--r-- | src/mumble/mumble_en.ts | 8 |
3 files changed, 89 insertions, 58 deletions
diff --git a/src/mumble/ManualPlugin.cpp b/src/mumble/ManualPlugin.cpp index 0bdd5a338..7b6fe3710 100644 --- a/src/mumble/ManualPlugin.cpp +++ b/src/mumble/ManualPlugin.cpp @@ -21,9 +21,12 @@ static QPointer<Manual> mDlg = NULL; static bool bLinkable = false; static bool bActive = true; -static int iAzimuth = 0; +static int iAzimuth = 180; static int iElevation = 0; +static const QString defaultContext = QString::fromLatin1("Mumble"); +static const QString defaultIdentity = QString::fromLatin1("Agent47"); + static struct { float avatar_pos[3]; float avatar_front[3]; @@ -44,7 +47,16 @@ Manual::Manual(QWidget *p) : QDialog(p) { qgvPosition->viewport()->installEventFilter(this); qgvPosition->scale(1.0f, 1.0f); qgsScene = new QGraphicsScene(QRectF(-5.0f, -5.0f, 10.0f, 10.0f), this); - qgiPosition = qgsScene->addEllipse(QRectF(-0.5f, -0.5f, 1.0f, 1.0f), QApplication::palette().text().color(), QBrush(Qt::red)); + + const float indicatorDiameter = 4.0f; + QPainterPath indicator; + // The center of the indicator's circle will represent the current position + indicator.addEllipse(QRectF(-indicatorDiameter / 2, -indicatorDiameter / 2, indicatorDiameter, indicatorDiameter)); + // A line will indicate the indicator's orientation (azimuth) + indicator.moveTo(0, indicatorDiameter / 2); + indicator.lineTo(0, indicatorDiameter); + + qgiPosition = qgsScene->addPath(indicator); qgvPosition->setScene(qgsScene); qgvPosition->fitInView(-5.0f, -5.0f, 10.0f, 10.0f, Qt::KeepAspectRatio); @@ -63,6 +75,14 @@ Manual::Manual(QWidget *p) : QDialog(p) { qsbAzimuth->setValue(iAzimuth); qsbElevation->setValue(iElevation); updateTopAndFront(iAzimuth, iElevation); + + // Set context and identity to default values in order to + // a) make positional audio work out of the box (needs a context) + // b) make the user aware of what each field might contain + qleContext->setText(defaultContext); + qleIdentity->setText(defaultIdentity); + my.context = defaultContext.toStdString(); + my.identity = defaultIdentity.toStdWString(); } bool Manual::eventFilter(QObject *obj, QEvent *evt) { @@ -120,8 +140,8 @@ void Manual::on_qdsbZ_valueChanged(double d) { } void Manual::on_qsbAzimuth_valueChanged(int i) { - if (i > 180) - qdAzimuth->setValue(-360 + i); + if (i > 360) + qdAzimuth->setValue(i % 360); else qdAzimuth->setValue(i); @@ -181,6 +201,8 @@ void Manual::updateTopAndFront(int azimuth, int elevation) { iAzimuth = azimuth; iElevation = elevation; + qgiPosition->setRotation(azimuth); + double azim = azimuth * M_PI / 180.; double elev = elevation * M_PI / 180.; diff --git a/src/mumble/ManualPlugin.ui b/src/mumble/ManualPlugin.ui index d431f943e..0e59d124d 100644 --- a/src/mumble/ManualPlugin.ui +++ b/src/mumble/ManualPlugin.ui @@ -65,6 +65,9 @@ <height>100.000000000000000</height> </rectf> </property> + <property name="renderHints"> + <set>QPainter::Antialiasing|QPainter::TextAntialiasing</set> + </property> </widget> </item> <item> @@ -142,6 +145,16 @@ <string>Heading</string> </property> <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0"> + <widget class="QSpinBox" name="qsbAzimuth"> + <property name="suffix"> + <string>°</string> + </property> + <property name="maximum"> + <number>360</number> + </property> + </widget> + </item> <item row="0" column="0"> <widget class="QLabel" name="qlAzimuth"> <property name="sizePolicy"> @@ -158,8 +171,8 @@ </property> </widget> </item> - <item row="1" column="0"> - <widget class="QDial" name="qdAzimuth"> + <item row="1" column="1"> + <widget class="QDial" name="qdElevation"> <property name="minimum"> <number>-180</number> </property> @@ -169,6 +182,12 @@ <property name="pageStep"> <number>30</number> </property> + <property name="value"> + <number>90</number> + </property> + <property name="sliderPosition"> + <number>90</number> + </property> <property name="wrapping"> <bool>true</bool> </property> @@ -180,6 +199,19 @@ </property> </widget> </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="qsbElevation"> + <property name="suffix"> + <string>°</string> + </property> + <property name="minimum"> + <number>-90</number> + </property> + <property name="maximum"> + <number>90</number> + </property> + </widget> + </item> <item row="0" column="1"> <widget class="QLabel" name="qlElevation"> <property name="sizePolicy"> @@ -196,23 +228,17 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDial" name="qdElevation"> + <item row="1" column="0"> + <widget class="QDial" name="qdAzimuth"> <property name="minimum"> - <number>-180</number> + <number>0</number> </property> <property name="maximum"> - <number>180</number> + <number>360</number> </property> <property name="pageStep"> <number>30</number> </property> - <property name="value"> - <number>90</number> - </property> - <property name="sliderPosition"> - <number>90</number> - </property> <property name="wrapping"> <bool>true</bool> </property> @@ -224,29 +250,6 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QSpinBox" name="qsbAzimuth"> - <property name="suffix"> - <string>°</string> - </property> - <property name="maximum"> - <number>360</number> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="qsbElevation"> - <property name="suffix"> - <string>°</string> - </property> - <property name="minimum"> - <number>-90</number> - </property> - <property name="maximum"> - <number>90</number> - </property> - </widget> - </item> </layout> </widget> </item> @@ -317,24 +320,27 @@ <property name="title"> <string>State</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="qpbLinked"> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QCheckBox" name="qpbLinked"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="text"> - <string>Linked</string> + <string>Link</string> </property> <property name="checkable"> <bool>true</bool> </property> <property name="checked"> - <bool>true</bool> + <bool>false</bool> </property> </widget> </item> - <item> - <widget class="QPushButton" name="qpbActivated"> + <item row="0" column="1"> + <widget class="QCheckBox" name="qpbActivated"> <property name="text"> - <string>Activated</string> + <string>Activate</string> </property> <property name="checkable"> <bool>true</bool> @@ -344,16 +350,16 @@ </property> </widget> </item> - <item> - <widget class="QPushButton" name="qpbUnhinge"> - <property name="text"> - <string>Unhinge</string> - </property> - </widget> - </item> </layout> </widget> </item> + <item> + <widget class="QPushButton" name="qpbUnhinge"> + <property name="text"> + <string>Unhinge</string> + </property> + </widget> + </item> </layout> </item> </layout> @@ -366,6 +372,9 @@ <property name="standardButtons"> <set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set> </property> + <property name="centerButtons"> + <bool>false</bool> + </property> </widget> </item> </layout> diff --git a/src/mumble/mumble_en.ts b/src/mumble/mumble_en.ts index 0413c6dfe..8af200518 100644 --- a/src/mumble/mumble_en.ts +++ b/src/mumble/mumble_en.ts @@ -5543,15 +5543,15 @@ the channel's context menu.</source> <translation type="unfinished"></translation> </message> <message> - <source>Linked</source> + <source>Unhinge</source> <translation type="unfinished"></translation> </message> <message> - <source>Activated</source> + <source>Link</source> <translation type="unfinished"></translation> </message> <message> - <source>Unhinge</source> + <source>Activate</source> <translation type="unfinished"></translation> </message> </context> @@ -6335,7 +6335,7 @@ To upgrade these files to their latest versions, click the button below.</source <context> <name>PortAudioSystem</name> <message> - <source>Default Device</source> + <source>Default device</source> <translation type="unfinished"></translation> </message> </context> |