Setting UI improvement

* pressing shift while clicking the button shows overview
* hint in overview, that there are shortcuts
This commit is contained in:
Klaus Basan
2018-05-28 21:41:05 +02:00
parent 0ef58f03ba
commit 4021822753
11 changed files with 154 additions and 127 deletions

View File

@@ -14,6 +14,7 @@
#include "ui_maininfoareacomponent.h"
#include <QIcon>
#include <QGuiApplication>
using namespace BlackMisc;
using namespace BlackGui;
@@ -108,6 +109,20 @@ namespace BlackGui
this->selectArea(InfoAreaLog);
}
void CMainInfoAreaComponent::selectArea(CMainInfoAreaComponent::InfoArea infoArea)
{
CInfoArea::selectArea(static_cast<int>(infoArea));
if (infoArea == InfoAreaSettings)
{
// pressing shift will go to overview
const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
if (km.testFlag(Qt::ShiftModifier))
{
ui->comp_Settings->setSettingsOverviewTab();
}
}
}
void CMainInfoAreaComponent::selectLog()
{
this->selectArea(InfoAreaLog);

View File

@@ -118,7 +118,7 @@ namespace BlackGui
void toggleFloating(InfoArea infoArea) { CInfoArea::toggleFloatingByIndex(static_cast<int>(infoArea)); }
//! Select area
void selectArea(InfoArea infoArea) { CInfoArea::selectArea(static_cast<int>(infoArea)); }
void selectArea(InfoArea infoArea);
//! Select log
void selectLog();

View File

@@ -116,15 +116,15 @@ namespace BlackGui
}
else if (senderButton == ui->pb_CockpitIdent && sGui->getIContextOwnAircraft())
{
emit identPressed();
emit this->identPressed();
}
else if (senderButton == ui->pb_Opacity050)
{
emit changedOpacity(50);
emit this->changedOpacity(50);
}
else if (senderButton == ui->pb_Opacity100)
{
emit changedOpacity(100);
emit this->changedOpacity(100);
}
else if (senderButton == ui->pb_SoundMaxVolume && sGui->getIContextAudio())
{

View File

@@ -34,8 +34,7 @@ namespace BlackGui
{
//! Main keypad area as used with main info area
//! \sa CMainInfoAreaComponent
class BLACKGUI_EXPORT CMainKeypadAreaComponent :
public QFrame
class BLACKGUI_EXPORT CMainKeypadAreaComponent : public QFrame
{
Q_OBJECT

View File

@@ -259,12 +259,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>62</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>100%</string>
</property>
@@ -307,6 +301,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Use &quot;SHIFT&quot; for overview</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
@@ -326,12 +323,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>62</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>50%</string>
</property>
@@ -423,7 +414,22 @@
<tabstop>pb_MainAircrafts</tabstop>
<tabstop>pb_MainAtc</tabstop>
<tabstop>pb_MainUsers</tabstop>
<tabstop>pb_MainCockpit</tabstop>
<tabstop>pb_MainSimulator</tabstop>
<tabstop>pb_MainMappings</tabstop>
<tabstop>pb_MainInterpolation</tabstop>
<tabstop>pb_MainTextMessages</tabstop>
<tabstop>pb_MainFlightplan</tabstop>
<tabstop>pb_MainLog</tabstop>
<tabstop>pb_MainSettings</tabstop>
<tabstop>pb_MainWeather</tabstop>
<tabstop>pb_Empty</tabstop>
<tabstop>pb_SoundMaxVolume</tabstop>
<tabstop>pb_Opacity100</tabstop>
<tabstop>pb_CockpitIdent</tabstop>
<tabstop>pb_Audio</tabstop>
<tabstop>pb_SoundMute</tabstop>
<tabstop>pb_Opacity050</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -54,16 +54,16 @@ namespace BlackGui
ui->comp_DataLoadOverview->showVisibleLoadAllButtons(false, false);
connect(ui->comp_SettingsGuiGeneral, &CSettingsGuiComponent::changedWindowsOpacity, this, &CSettingsComponent::changedWindowsOpacity);
connect(ui->pb_Advanced, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Audio, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Gui, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Hotkeys, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Network, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Servers, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Simulator, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_SimulatorBasics, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_SimulatorMessages, &QPushButton::released, this, &CSettingsComponent::ps_overviewButtonClicked);
connect(ui->pb_Advanced, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Audio, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Gui, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Hotkeys, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Network, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Servers, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_Simulator, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_SimulatorBasics, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_DataLoadAndCaches, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
connect(ui->pb_SimulatorMessages, &QPushButton::released, this, &CSettingsComponent::onOverviewButtonClicked);
this->initActions();
}
@@ -77,49 +77,50 @@ namespace BlackGui
a = new QAction(this);
a->setObjectName("overview");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_O));
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
ui->lbl_Hint->setText("Hint: See tooltips for shortcuts, \"ALT+S, O\" for overview.");
a = new QAction(this);
a->setObjectName("audio");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_A));
ui->pb_Audio->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("data");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_D));
ui->pb_DataLoadAndCaches->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("gui");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_G));
ui->pb_Gui->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("hotkeys");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_H));
ui->pb_Hotkeys->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("network");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_N));
ui->pb_Network->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
a = new QAction(this);
a->setObjectName("simulator");
a->setShortcut(QKeySequence(Qt::ALT + Qt::Key_S, Qt::Key_S));
ui->pb_Simulator->setToolTip(a->shortcut().toString());
connect(a, &QAction::triggered, this, &CSettingsComponent::ps_actionTriggered);
connect(a, &QAction::triggered, this, &CSettingsComponent::onActionTriggered);
this->addAction(a);
}
@@ -138,12 +139,17 @@ namespace BlackGui
this->setCurrentIndex(static_cast<int>(tab));
}
void CSettingsComponent::setSettingsOverviewTab()
{
this->setSettingsTab(SettingTabOverview);
}
void CSettingsComponent::setGuiOpacity(double value)
{
ui->comp_SettingsGuiGeneral->setGuiOpacity(value);
}
void CSettingsComponent::ps_overviewButtonClicked()
void CSettingsComponent::onOverviewButtonClicked()
{
const QObject *sender = QObject::sender();
if (sender == ui->pb_Advanced) { this->setCurrentIndex(SettingTabAdvanced); return; }
@@ -159,7 +165,7 @@ namespace BlackGui
this->setCurrentIndex(SettingTabOverview);
}
void CSettingsComponent::ps_actionTriggered()
void CSettingsComponent::onActionTriggered()
{
const QString a = QObject::sender()->objectName().toLower().trimmed();
if (a.isEmpty()) { return; }

View File

@@ -61,6 +61,15 @@ namespace BlackGui
//! Settings for given simulator
BlackMisc::Simulation::Settings::CSpecializedSimulatorSettings getSimulatorSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
//! Set the tab
void setSettingsTab(SettingTab tab);
//! Set the overview tab
void setSettingsOverviewTab();
//! GUI Opacity 0-100%
void setGuiOpacity(double value);
signals:
//! Change the windows opacity 0..100
void changedWindowsOpacity(int opacity);
@@ -74,21 +83,13 @@ namespace BlackGui
//! Update interval changed (users)
void changedUsersUpdateInterval(int seconds);
public slots:
//! Set the tab
void setSettingsTab(SettingTab tab);
//! GUI Opacity 0-100%
void setGuiOpacity(double value);
private slots:
private:
//! An overview button was clicked
void ps_overviewButtonClicked();
void onOverviewButtonClicked();
//! Action triggered
void ps_actionTriggered();
void onActionTriggered();
private:
//! Init actions
void initActions();

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>236</width>
<height>337</height>
<width>204</width>
<height>340</height>
</rect>
</property>
<property name="windowTitle">
@@ -30,7 +30,7 @@
<property name="verticalSpacing">
<number>20</number>
</property>
<item row="6" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<spacer name="vs_OverviewBottom">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -43,20 +43,7 @@
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pb_Network">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Network</string>
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QPushButton" name="pb_Servers">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -69,7 +56,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QPushButton" name="pb_Advanced">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -82,8 +69,8 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="pb_Audio">
<item row="4" column="0">
<widget class="QPushButton" name="pb_Network">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@@ -91,24 +78,11 @@
</sizepolicy>
</property>
<property name="text">
<string>Audio</string>
<string>Network</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pb_Gui">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>GUI</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QPushButton" name="pb_SimulatorBasics">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -121,8 +95,8 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pb_Simulator">
<item row="5" column="0">
<widget class="QPushButton" name="pb_Audio">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@@ -130,11 +104,24 @@
</sizepolicy>
</property>
<property name="text">
<string>Simulator</string>
<string>Audio</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pb_Gui">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>GUI</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pb_DataLoadAndCaches">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@@ -147,33 +134,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pb_Hotkeys">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hotkeys</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pb_SimulatorMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator (messages)</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="1" column="0" colspan="2">
<spacer name="vs_OverviewTop">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -189,6 +150,52 @@
</property>
</spacer>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pb_Hotkeys">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Hotkeys</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="pb_SimulatorMessages">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator (messages)</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="pb_Simulator">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Simulator</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lbl_Hint">
<property name="text">
<string>Hint: see tooltips for shortcuts.</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tb_SettingsTrafficNetworkServers">
@@ -532,8 +539,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>228</width>
<height>295</height>
<width>196</width>
<height>298</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vl_DataLoadOverview">

View File

@@ -120,10 +120,10 @@ namespace BlackGui
const bool v = messagesDetail->ui->form_StatusMessage->isVisible();
const QString formString(v ? "Hide log details" : "Show log details");
this->m_action = menuActions.addAction(this->m_action, BlackMisc::CIcons::databaseTable16(), formString,
m_action = menuActions.addAction(m_action, BlackMisc::CIcons::databaseTable16(), formString,
CMenuAction::pathLog(), { messagesDetail->ui->form_StatusMessage, &CStatusMessageForm::toggleVisibility});
this->m_action->setCheckable(true);
this->m_action->setChecked(v);
m_action->setCheckable(true);
m_action->setChecked(v);
}
} // ns
} // ns