mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
refs #617, naming conventions for UI
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2b61213746
commit
f87a06f6d2
@@ -72,21 +72,21 @@ namespace BlackGui
|
||||
m_inputManager = BlackCore::CInputManager::instance();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->advancedFrame->hide();
|
||||
ui->qf_Advanced->hide();
|
||||
|
||||
ui->tv_actions->setModel(&m_actionModel);
|
||||
ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16());
|
||||
ui->tv_Actions->setModel(&m_actionModel);
|
||||
ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16());
|
||||
selectAction();
|
||||
|
||||
if (!actionHotkey.getCombination().isEmpty()) { ui->pb_selectedHotkey->setText(actionHotkey.getCombination().toQString()); }
|
||||
if (!actionHotkey.getCombination().isEmpty()) { ui->pb_SelectedHotkey->setText(actionHotkey.getCombination().toQString()); }
|
||||
|
||||
connect(ui->pb_advancedMode, &QPushButton::clicked, this, &CHotkeyDialog::ps_advancedModeChanged);
|
||||
connect(ui->pb_selectedHotkey, &QPushButton::clicked, this, &CHotkeyDialog::ps_selectHotkey);
|
||||
connect(ui->pb_accept, &QPushButton::clicked, this, &CHotkeyDialog::ps_accept);
|
||||
connect(ui->pb_cancel, &QPushButton::clicked, this, &CHotkeyDialog::reject);
|
||||
connect(ui->pb_AdvancedMode, &QPushButton::clicked, this, &CHotkeyDialog::ps_advancedModeChanged);
|
||||
connect(ui->pb_SelectedHotkey, &QPushButton::clicked, this, &CHotkeyDialog::ps_selectHotkey);
|
||||
connect(ui->pb_Accept, &QPushButton::clicked, this, &CHotkeyDialog::ps_accept);
|
||||
connect(ui->pb_Cancel, &QPushButton::clicked, this, &CHotkeyDialog::reject);
|
||||
connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionChanged, this, &CHotkeyDialog::ps_combinationSelectionChanged);
|
||||
connect(m_inputManager, &BlackCore::CInputManager::combinationSelectionFinished, this, &CHotkeyDialog::ps_combinationSelectionFinished);
|
||||
connect(ui->tv_actions->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CHotkeyDialog::ps_changeSelectedAction);
|
||||
connect(ui->tv_Actions->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CHotkeyDialog::ps_changeSelectedAction);
|
||||
|
||||
initStyleSheet();
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace BlackGui
|
||||
{
|
||||
for (const auto &app : applications)
|
||||
{
|
||||
ui->cb_identifier->addItem(app.getMachineName(), QVariant::fromValue(app));
|
||||
ui->cb_Identifier->addItem(app.getMachineName(), QVariant::fromValue(app));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,29 +129,29 @@ namespace BlackGui
|
||||
{
|
||||
if (m_actionHotkey.getCombination().isEmpty()) return;
|
||||
|
||||
if (!ui->advancedFrame->isVisible())
|
||||
if (!ui->qf_Advanced->isVisible())
|
||||
{
|
||||
setupAdvancedFrame();
|
||||
ui->advancedFrame->show();
|
||||
ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumNorth16());
|
||||
ui->qf_Advanced->show();
|
||||
ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumNorth16());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->pb_advancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16());
|
||||
ui->advancedFrame->hide();
|
||||
ui->gb_hotkey->resize(0, 0);
|
||||
ui->pb_AdvancedMode->setIcon(BlackMisc::CIcons::arrowMediumSouth16());
|
||||
ui->qf_Advanced->hide();
|
||||
ui->gb_Hotkey->resize(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CHotkeyDialog::ps_selectHotkey()
|
||||
{
|
||||
ui->pb_selectedHotkey->setText("Press any key/button...");
|
||||
ui->pb_SelectedHotkey->setText("Press any key/button...");
|
||||
m_inputManager->startCapture();
|
||||
}
|
||||
|
||||
void CHotkeyDialog::ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination)
|
||||
{
|
||||
ui->pb_selectedHotkey->setText(combination.toFormattedQString());
|
||||
ui->pb_SelectedHotkey->setText(combination.toFormattedQString());
|
||||
}
|
||||
|
||||
void CHotkeyDialog::ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination)
|
||||
@@ -171,19 +171,19 @@ namespace BlackGui
|
||||
{
|
||||
if (m_actionHotkey.getApplicableMachine().getMachineName().isEmpty())
|
||||
{
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_machine->title();
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_Machine->title();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_actionHotkey.getCombination().isEmpty())
|
||||
{
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_hotkey->title();
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_Hotkey->title();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_actionHotkey.getAction().isEmpty())
|
||||
{
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_action->title();
|
||||
CLogMessage().validationWarning("Missing %1") << ui->gb_Action->title();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -198,12 +198,12 @@ namespace BlackGui
|
||||
|
||||
void CHotkeyDialog::synchronizeSimpleSelection()
|
||||
{
|
||||
ui->pb_selectedHotkey->setText(m_actionHotkey.getCombination().toFormattedQString());
|
||||
ui->pb_SelectedHotkey->setText(m_actionHotkey.getCombination().toFormattedQString());
|
||||
}
|
||||
|
||||
void CHotkeyDialog::synchronizeAdvancedSelection()
|
||||
{
|
||||
if (ui->advancedFrame->isVisible()) { setupAdvancedFrame(); }
|
||||
if (ui->qf_Advanced->isVisible()) { setupAdvancedFrame(); }
|
||||
}
|
||||
|
||||
void CHotkeyDialog::setupAdvancedFrame()
|
||||
@@ -217,7 +217,7 @@ namespace BlackGui
|
||||
if (splittedKey == "+") continue;
|
||||
|
||||
int currentIndex = -1;
|
||||
CKeySelectionBox *ksb = new CKeySelectionBox(ui->advancedFrame);
|
||||
CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced);
|
||||
for (const auto &supportedKey : allSupportedKeys)
|
||||
{
|
||||
QString supportedKeyAsString = supportedKey.toQString();
|
||||
@@ -228,8 +228,8 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
ksb->setSelectedIndex(currentIndex);
|
||||
ui->advancedFrame->layout()->addWidget(ksb);
|
||||
int position = ui->advancedFrame->layout()->count() - 1;
|
||||
ui->qf_Advanced->layout()->addWidget(ksb);
|
||||
int position = ui->qf_Advanced->layout()->count() - 1;
|
||||
ksb->setProperty("position", position);
|
||||
connect(ksb, &CKeySelectionBox::keySelectionChanged, this, &CHotkeyDialog::advancedKeyChanged);
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace BlackGui
|
||||
|
||||
void CHotkeyDialog::clearAdvancedFrame()
|
||||
{
|
||||
QLayout *layout = ui->advancedFrame->layout();
|
||||
QLayout *layout = ui->qf_Advanced->layout();
|
||||
QLayoutItem *child;
|
||||
|
||||
while ((child = layout->takeAt(0)) != 0)
|
||||
@@ -273,10 +273,10 @@ namespace BlackGui
|
||||
auto indexList = m_actionModel.match(startIndex, Qt::DisplayRole, QVariant::fromValue(token));
|
||||
if (indexList.isEmpty()) return;
|
||||
parentIndex = indexList.first();
|
||||
ui->tv_actions->expand(parentIndex);
|
||||
ui->tv_Actions->expand(parentIndex);
|
||||
}
|
||||
|
||||
QItemSelectionModel *selectionModel = ui->tv_actions->selectionModel();
|
||||
QItemSelectionModel *selectionModel = ui->tv_Actions->selectionModel();
|
||||
selectionModel->select(parentIndex, QItemSelectionModel::Select);
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace BlackGui
|
||||
CHotkeyDialog(const BlackMisc::Input::CActionHotkey &actionHotkey, QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CHotkeyDialog();
|
||||
virtual ~CHotkeyDialog();
|
||||
|
||||
//! Get hotkey selected by user
|
||||
BlackMisc::Input::CActionHotkey getSelectedActionHotkey() const { return m_actionHotkey; }
|
||||
@@ -81,7 +81,7 @@ namespace BlackGui
|
||||
//! Init style sheet
|
||||
void initStyleSheet();
|
||||
|
||||
//! getHotkey runs the hotkey dialog and returns the result
|
||||
//! Runs the hotkey dialog and returns the result
|
||||
static BlackMisc::Input::CActionHotkey getActionHotkey(const BlackMisc::Input::CActionHotkey &initial, const BlackMisc::CIdentifierList &applications,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
|
||||
@@ -15,25 +15,25 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="gb_machine">
|
||||
<widget class="QGroupBox" name="gb_Machine">
|
||||
<property name="title">
|
||||
<string>Machine</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="cb_identifier"/>
|
||||
<widget class="QComboBox" name="cb_Identifier"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="gb_hotkey">
|
||||
<widget class="QGroupBox" name="gb_Hotkey">
|
||||
<property name="title">
|
||||
<string>Combination</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="pb_advancedMode">
|
||||
<widget class="QPushButton" name="pb_AdvancedMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -58,7 +58,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="rb_press">
|
||||
<widget class="QRadioButton" name="rb_Press">
|
||||
<property name="text">
|
||||
<string>Press</string>
|
||||
</property>
|
||||
@@ -68,7 +68,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QPushButton" name="pb_selectedHotkey">
|
||||
<widget class="QPushButton" name="pb_SelectedHotkey">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -81,7 +81,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="hs_Hotkey">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -94,14 +94,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="rb_release">
|
||||
<widget class="QRadioButton" name="rb_Release">
|
||||
<property name="text">
|
||||
<string>Release</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="4">
|
||||
<widget class="QFrame" name="advancedFrame">
|
||||
<widget class="QFrame" name="qf_Advanced">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -118,13 +118,13 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="gb_action">
|
||||
<widget class="QGroupBox" name="gb_Action">
|
||||
<property name="title">
|
||||
<string>Action</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTreeView" name="tv_actions">
|
||||
<widget class="QTreeView" name="tv_Actions">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
@@ -134,7 +134,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<spacer name="hs_Dialog">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@@ -147,14 +147,14 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QPushButton" name="pb_accept">
|
||||
<widget class="QPushButton" name="pb_Accept">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pb_cancel">
|
||||
<widget class="QPushButton" name="pb_Cancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace BlackGui
|
||||
ui(new Ui::CSettingsHotkeyComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tv_hotkeys->setModel(&m_model);
|
||||
ui->tv_Hotkeys->setModel(&m_model);
|
||||
|
||||
connect(ui->pb_addHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_addEntry);
|
||||
connect(ui->pb_editHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_editEntry);
|
||||
connect(ui->pb_removeHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_removeEntry);
|
||||
connect(ui->pb_AddHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_addEntry);
|
||||
connect(ui->pb_EditHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_editEntry);
|
||||
connect(ui->pb_RemoveHotkey, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_removeEntry);
|
||||
|
||||
reloadHotkeysFromSettings();
|
||||
ui->tv_hotkeys->selectRow(0);
|
||||
ui->tv_Hotkeys->selectRow(0);
|
||||
}
|
||||
|
||||
CSettingsHotkeyComponent::~CSettingsHotkeyComponent()
|
||||
@@ -75,10 +75,10 @@ namespace BlackGui
|
||||
|
||||
void CSettingsHotkeyComponent::ps_editEntry()
|
||||
{
|
||||
auto index = ui->tv_hotkeys->selectionModel()->currentIndex();
|
||||
auto index = ui->tv_Hotkeys->selectionModel()->currentIndex();
|
||||
if (!index.isValid()) return;
|
||||
|
||||
const auto model = ui->tv_hotkeys->model();
|
||||
const auto model = ui->tv_Hotkeys->model();
|
||||
const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex());
|
||||
Q_ASSERT(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert<CActionHotkey>());
|
||||
CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value<CActionHotkey>();
|
||||
@@ -96,7 +96,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsHotkeyComponent::ps_removeEntry()
|
||||
{
|
||||
QModelIndexList indexes = ui->tv_hotkeys->selectionModel()->selectedRows();
|
||||
QModelIndexList indexes = ui->tv_Hotkeys->selectionModel()->selectedRows();
|
||||
for (const auto &index : indexes)
|
||||
{
|
||||
CActionHotkey actionHotkey = index.data(CActionHotkeyListModel::ActionHotkeyRole).value<CActionHotkey>();
|
||||
@@ -165,7 +165,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsHotkeyComponent::ps_hotkeySlot(bool keyDown)
|
||||
{
|
||||
if (keyDown) QMessageBox::information(this, "Test", "Push-To-Talk");
|
||||
if (keyDown) { QMessageBox::information(this, "Test", "Hotkey test"); }
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
||||
CSettingsHotkeyComponent(QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CSettingsHotkeyComponent();
|
||||
virtual ~CSettingsHotkeyComponent();
|
||||
|
||||
private slots:
|
||||
void ps_addEntry();
|
||||
|
||||
@@ -11,15 +11,9 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>sample_hotkeys</string>
|
||||
<string>Hotkeys</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gl_HotKeyComponent">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
@@ -30,21 +24,21 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="pb_addHotkey">
|
||||
<widget class="QPushButton" name="pb_AddHotkey">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pb_editHotkey">
|
||||
<widget class="QPushButton" name="pb_EditHotkey">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="pb_removeHotkey">
|
||||
<widget class="QPushButton" name="pb_RemoveHotkey">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
@@ -64,7 +58,10 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QTableView" name="tv_hotkeys">
|
||||
<widget class="QTableView" name="tv_Hotkeys">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
@@ -77,9 +74,6 @@
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
|
||||
Reference in New Issue
Block a user