mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
some fixes noticed during today's discussion around refs #302
* move hotkey settings in own GUI component -> easier adjustments * some fixes for dock widgets when tab widget is shown without names (unrelated but found + fixed in same step)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
a6591cfe2c
commit
6119c22c78
@@ -77,11 +77,10 @@ namespace BlackGui
|
|||||||
void CSettingsComponent::reloadSettings()
|
void CSettingsComponent::reloadSettings()
|
||||||
{
|
{
|
||||||
// reload components
|
// reload components
|
||||||
|
//! \todo Settings are loaded twice, this here is for init but each component also consumes the signal changed slot
|
||||||
this->ui->comp_AudioSetup->reloadSettings();
|
this->ui->comp_AudioSetup->reloadSettings();
|
||||||
this->ui->comp_SettingsServersComponent->reloadSettings();
|
this->ui->comp_SettingsServersComponent->reloadSettings();
|
||||||
|
this->ui->comp_SettingsHotkeysComponent->reloadSettings();
|
||||||
// update hot keys
|
|
||||||
this->ui->tvp_SettingsMiscHotkeys->updateContainer(this->getIContextSettings()->getHotkeys());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -97,7 +96,7 @@ namespace BlackGui
|
|||||||
*/
|
*/
|
||||||
void CSettingsComponent::runtimeHasBeenSet()
|
void CSettingsComponent::runtimeHasBeenSet()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->getIContextSettings(), "runtimeHasBeenSet", "Missing settings");
|
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "Missing settings");
|
||||||
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsComponent::ps_changedSettings);
|
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsComponent::ps_changedSettings);
|
||||||
|
|
||||||
// Opacity, intervals
|
// Opacity, intervals
|
||||||
@@ -106,11 +105,6 @@ namespace BlackGui
|
|||||||
this->connect(this->ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
|
this->connect(this->ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
|
||||||
this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedUsersUpdateInterval);
|
this->connect(this->ui->hs_SettingsGuiUserRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedUsersUpdateInterval);
|
||||||
|
|
||||||
// Settings hotkeys
|
|
||||||
this->connect(this->ui->pb_SettingsMiscCancel, &QPushButton::clicked, this, &CSettingsComponent::reloadSettings);
|
|
||||||
this->connect(this->ui->pb_SettingsMiscSave, &QPushButton::clicked, this, &CSettingsComponent::ps_saveHotkeys);
|
|
||||||
this->connect(this->ui->pb_SettingsMiscRemove, &QPushButton::clicked, this, &CSettingsComponent::ps_clearHotkey);
|
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
const QFont font = this->font();
|
const QFont font = this->font();
|
||||||
this->ui->cb_SettingsGuiFontStyle->setCurrentText(CStyleSheetUtility::fontAsCombinedWeightStyle(font));
|
this->ui->cb_SettingsGuiFontStyle->setCurrentText(CStyleSheetUtility::fontAsCombinedWeightStyle(font));
|
||||||
@@ -138,28 +132,6 @@ namespace BlackGui
|
|||||||
Q_UNUSED(type);
|
Q_UNUSED(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Save the hotkeys
|
|
||||||
*/
|
|
||||||
void CSettingsComponent::ps_saveHotkeys()
|
|
||||||
{
|
|
||||||
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys());
|
|
||||||
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->ui->tvp_SettingsMiscHotkeys->derivedModel()->getContainer().toCVariant());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Clear particular hotkey
|
|
||||||
*/
|
|
||||||
void CSettingsComponent::ps_clearHotkey()
|
|
||||||
{
|
|
||||||
QModelIndex i = this->ui->tvp_SettingsMiscHotkeys->currentIndex();
|
|
||||||
if (i.row() < 0 || i.row() >= this->ui->tvp_SettingsMiscHotkeys->rowCount()) return;
|
|
||||||
CSettingKeyboardHotkey hotkey = this->ui->tvp_SettingsMiscHotkeys->at(i);
|
|
||||||
CSettingKeyboardHotkey defaultHotkey;
|
|
||||||
defaultHotkey.setFunction(hotkey.getFunction());
|
|
||||||
this->ui->tvp_SettingsMiscHotkeys->derivedModel()->update(i, defaultHotkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Font has been changed
|
* Font has been changed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
|||||||
SettingTabAircraftAudio,
|
SettingTabAircraftAudio,
|
||||||
SettingTabSimulator,
|
SettingTabSimulator,
|
||||||
SettingTabGui,
|
SettingTabGui,
|
||||||
SettingTabMisc
|
SettingTabHotkeys
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
@@ -98,12 +98,6 @@ namespace BlackGui
|
|||||||
//! Settings have been changed
|
//! Settings have been changed
|
||||||
void ps_changedSettings(uint typeValue);
|
void ps_changedSettings(uint typeValue);
|
||||||
|
|
||||||
//! Save the Hotkeys
|
|
||||||
void ps_saveHotkeys();
|
|
||||||
|
|
||||||
//! Clear single hotkey
|
|
||||||
void ps_clearHotkey();
|
|
||||||
|
|
||||||
//! Font has been changed
|
//! Font has been changed
|
||||||
void ps_fontChanged();
|
void ps_fontChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -480,79 +480,46 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tb_SettingsMisc">
|
<widget class="QWidget" name="tb_SettingsHotkeys">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Misc</string>
|
<string>Hotkeys</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="vl_SettingsMisc">
|
<layout class="QVBoxLayout" name="vl_SettingsMisc">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Views::CKeyboardKeyView" name="tvp_SettingsMiscHotkeys">
|
<widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_SettingsHotkeysComponent">
|
||||||
<property name="cornerButtonEnabled">
|
<property name="sizePolicy">
|
||||||
<bool>true</bool>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFrame" name="fr_SettingsMisc">
|
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::StyledPanel</enum>
|
<enum>QFrame::StyledPanel</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hl_SettingsMisc">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_SettingsMiscSave">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_SettingsMiscRemove">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pb_SettingsMiscCancel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cancel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -565,11 +532,6 @@
|
|||||||
<header>blackgui/components/audiosetupcomponent.h</header>
|
<header>blackgui/components/audiosetupcomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
|
||||||
<class>BlackGui::Views::CKeyboardKeyView</class>
|
|
||||||
<extends>QTableView</extends>
|
|
||||||
<header>blackgui/views/keyboardkeyview.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>BlackGui::Components::CSettingsSimulatorComponent</class>
|
<class>BlackGui::Components::CSettingsSimulatorComponent</class>
|
||||||
<extends>QFrame</extends>
|
<extends>QFrame</extends>
|
||||||
@@ -588,6 +550,12 @@
|
|||||||
<header>blackgui/components/settingsnetworkcomponent.h</header>
|
<header>blackgui/components/settingsnetworkcomponent.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Components::CSettingsHotkeyComponent</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>blackgui/components/settingshotkeycomponent.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
73
src/blackgui/components/settingshotkeycomponent.cpp
Normal file
73
src/blackgui/components/settingshotkeycomponent.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/* Copyright (C) 2015
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "settingshotkeycomponent.h"
|
||||||
|
#include "ui_settingshotkeycomponent.h"
|
||||||
|
#include "blackcore/context_settings.h"
|
||||||
|
#include "blackmisc/settingutilities.h"
|
||||||
|
|
||||||
|
using namespace BlackCore;
|
||||||
|
using namespace BlackMisc::Settings;
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
CSettingsHotkeyComponent::CSettingsHotkeyComponent(QWidget *parent) :
|
||||||
|
QFrame(parent),
|
||||||
|
ui(new Ui::CSettingsHotkeyComponent)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSettingsHotkeyComponent::~CSettingsHotkeyComponent() { }
|
||||||
|
|
||||||
|
void CSettingsHotkeyComponent::runtimeHasBeenSet()
|
||||||
|
{
|
||||||
|
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "Missing settings");
|
||||||
|
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsHotkeyComponent::ps_changedSettings);
|
||||||
|
|
||||||
|
// Settings hotkeys
|
||||||
|
this->connect(this->ui->pb_SettingsCancel, &QPushButton::clicked, this, &CSettingsHotkeyComponent::reloadSettings);
|
||||||
|
this->connect(this->ui->pb_SettingsSave, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_saveHotkeys);
|
||||||
|
this->connect(this->ui->pb_SettingsRemove, &QPushButton::clicked, this, &CSettingsHotkeyComponent::ps_clearHotkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsHotkeyComponent::reloadSettings()
|
||||||
|
{
|
||||||
|
// update hot keys
|
||||||
|
this->ui->tvp_SettingsMiscHotkeys->updateContainer(this->getIContextSettings()->getHotkeys());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsHotkeyComponent::ps_changedSettings(uint typeValue)
|
||||||
|
{
|
||||||
|
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
|
||||||
|
this->reloadSettings();
|
||||||
|
Q_UNUSED(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsHotkeyComponent::ps_saveHotkeys()
|
||||||
|
{
|
||||||
|
const QString path = CSettingUtilities::appendPaths(IContextSettings::PathRoot(), IContextSettings::PathHotkeys());
|
||||||
|
this->getIContextSettings()->value(path, CSettingUtilities::CmdUpdate(), this->ui->tvp_SettingsMiscHotkeys->derivedModel()->getContainer().toCVariant());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSettingsHotkeyComponent::ps_clearHotkey()
|
||||||
|
{
|
||||||
|
QModelIndex i = this->ui->tvp_SettingsMiscHotkeys->currentIndex();
|
||||||
|
if (i.row() < 0 || i.row() >= this->ui->tvp_SettingsMiscHotkeys->rowCount()) return;
|
||||||
|
CSettingKeyboardHotkey hotkey = this->ui->tvp_SettingsMiscHotkeys->at(i);
|
||||||
|
CSettingKeyboardHotkey defaultHotkey;
|
||||||
|
defaultHotkey.setFunction(hotkey.getFunction());
|
||||||
|
this->ui->tvp_SettingsMiscHotkeys->derivedModel()->update(i, defaultHotkey);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
65
src/blackgui/components/settingshotkeycomponent.h
Normal file
65
src/blackgui/components/settingshotkeycomponent.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/* Copyright (C) 2015
|
||||||
|
* swift project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \file
|
||||||
|
|
||||||
|
#ifndef BLACKGUI_COMPONENTS_SETTINGSHOTKEYCOMPONENT_H
|
||||||
|
#define BLACKGUI_COMPONENTS_SETTINGSHOTKEYCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
|
#include "blackgui/components/enableforruntime.h"
|
||||||
|
#include <QFrame>
|
||||||
|
|
||||||
|
namespace Ui { class CSettingsHotkeyComponent; }
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Components
|
||||||
|
{
|
||||||
|
|
||||||
|
//! Define hotkeys
|
||||||
|
class BLACKGUI_EXPORT CSettingsHotkeyComponent :
|
||||||
|
public QFrame,
|
||||||
|
public CEnableForRuntime
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CSettingsHotkeyComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~CSettingsHotkeyComponent();
|
||||||
|
|
||||||
|
//! Reload settings
|
||||||
|
void reloadSettings();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! \copydoc CRuntimeBasedComponent::runtimeHasBeenSet
|
||||||
|
virtual void runtimeHasBeenSet() override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
//! Settings have been changed
|
||||||
|
void ps_changedSettings(uint typeValue);
|
||||||
|
|
||||||
|
//! Save the Hotkeys
|
||||||
|
void ps_saveHotkeys();
|
||||||
|
|
||||||
|
//! Clear single hotkey
|
||||||
|
void ps_clearHotkey();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<Ui::CSettingsHotkeyComponent> ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // ns
|
||||||
|
} // ns
|
||||||
|
|
||||||
|
#endif // guard
|
||||||
104
src/blackgui/components/settingshotkeycomponent.ui
Normal file
104
src/blackgui/components/settingshotkeycomponent.ui
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CSettingsHotkeyComponent</class>
|
||||||
|
<widget class="QFrame" name="CSettingsHotkeyComponent">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Frame</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="vl_SettingsHotkeyComponent">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="BlackGui::Views::CKeyboardKeyView" name="tvp_SettingsMiscHotkeys">
|
||||||
|
<property name="cornerButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="fr_SettingsHotkeyComponent">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Raised</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="hl_SettingsMisc">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsSave">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsRemove">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pb_SettingsCancel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>BlackGui::Views::CKeyboardKeyView</class>
|
||||||
|
<extends>QTableView</extends>
|
||||||
|
<header>blackgui/views/keyboardkeyview.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -44,7 +44,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CSettingsNetworkServersComponent::runtimeHasBeenSet()
|
void CSettingsNetworkServersComponent::runtimeHasBeenSet()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->getIContextSettings(), "runtimeHasBeenSet", "Missing settings");
|
Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "Missing settings");
|
||||||
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsNetworkServersComponent::ps_changedSettings);
|
this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CSettingsNetworkServersComponent::ps_changedSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>260</width>
|
||||||
<height>300</height>
|
<height>141</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Views::CServerView" name="tvp_SettingsTnServers">
|
<widget class="BlackGui::Views::CServerView" name="tvp_SettingsTnServers">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="fr_SettingsTnServersButtons">
|
<widget class="QFrame" name="fr_SettingsTnServersButtons">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
@@ -95,10 +95,10 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="hl_SettingsBottomBar">
|
<layout class="QHBoxLayout" name="hl_SettingsBottomBar">
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="hs_SettingsTnServersSpacer">
|
<spacer name="hs_SettingsTnServersSpacer">
|
||||||
|
|||||||
@@ -326,6 +326,13 @@ namespace BlackGui
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CDockWidget::windowTitleOrBackup() const
|
||||||
|
{
|
||||||
|
QString t(windowTitle());
|
||||||
|
if (t.isEmpty()) { return windowTitleBackup(); }
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
void CDockWidget::ps_onTopLevelChanged(bool topLevel)
|
void CDockWidget::ps_onTopLevelChanged(bool topLevel)
|
||||||
{
|
{
|
||||||
if (topLevel)
|
if (topLevel)
|
||||||
|
|||||||
@@ -73,6 +73,9 @@ namespace BlackGui
|
|||||||
//! Window title backup
|
//! Window title backup
|
||||||
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
|
const QString &windowTitleBackup() const { return this->m_windowTitleBackup; }
|
||||||
|
|
||||||
|
//! If current window title is empty, use backup
|
||||||
|
QString windowTitleOrBackup() const;
|
||||||
|
|
||||||
//! Window title when window is docked
|
//! Window title when window is docked
|
||||||
bool showTitleWhenDocked() const { return this->m_windowTitleWhenDocked; }
|
bool showTitleWhenDocked() const { return this->m_windowTitleWhenDocked; }
|
||||||
|
|
||||||
|
|||||||
@@ -626,47 +626,62 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (tabBarIndex >= this->m_dockWidgetInfoAreas.count() || tabBarIndex < 0) { return nullptr; }
|
if (tabBarIndex >= this->m_dockWidgetInfoAreas.count() || tabBarIndex < 0) { return nullptr; }
|
||||||
if (!this->m_tabBar) { return nullptr; }
|
if (!this->m_tabBar) { return nullptr; }
|
||||||
return getDockWidgetInfoAreaByWindowTitle(this->m_tabBar->tabText(tabBarIndex));
|
const QString t(this->m_tabBar->tabText(tabBarIndex));
|
||||||
|
|
||||||
|
// we have a title and search by that (best option, as order does not matter)
|
||||||
|
if (!t.isEmpty()) { return getDockWidgetInfoAreaByWindowTitle(t); }
|
||||||
|
|
||||||
|
// no title, we assume the n-th not floating tab is correct
|
||||||
|
// this will work if the order in m_dockWidgetInfoAreas matches
|
||||||
|
int c = 0;
|
||||||
|
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||||
|
{
|
||||||
|
if (dw->isFloating()) { continue; }
|
||||||
|
if (c == tabBarIndex) { return dw; }
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
Q_ASSERT_X(false, Q_FUNC_INFO, "no dock widgte found");
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDockWidgetInfoArea *CInfoArea::getDockWidgetInfoAreaByWindowTitle(const QString &title) const
|
CDockWidgetInfoArea *CInfoArea::getDockWidgetInfoAreaByWindowTitle(const QString &title) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!title.isEmpty());
|
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "No title");
|
||||||
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||||
{
|
{
|
||||||
if (dw->windowTitle() == title) { return dw; }
|
if (dw->windowTitleOrBackup() == title) { return dw; }
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CInfoArea::getAreaIndexByWindowTitle(const QString &title) const
|
int CInfoArea::getAreaIndexByWindowTitle(const QString &title) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!title.isEmpty());
|
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "No title");
|
||||||
for (int i = 0; i < m_dockWidgetInfoAreas.size(); i++)
|
for (int i = 0; i < m_dockWidgetInfoAreas.size(); i++)
|
||||||
{
|
{
|
||||||
const QString t(m_dockWidgetInfoAreas.at(i)->windowTitle());
|
if (title == m_dockWidgetInfoAreas.at(i)->windowTitleOrBackup()) { return i; }
|
||||||
if (t == title) { return i; }
|
|
||||||
}
|
}
|
||||||
Q_ASSERT(false);
|
Q_ASSERT_X(false, Q_FUNC_INFO, "No area for title");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CInfoArea::getTabBarIndexByTitle(const QString &title) const
|
int CInfoArea::getTabBarIndexByTitle(const QString &title) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(!title.isEmpty());
|
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "No title");
|
||||||
if (m_tabBar->count() < 1) { return -1;}
|
if (m_tabBar->count() < 1) { return -1;}
|
||||||
for (int i = 0; i < m_tabBar->count(); i++)
|
for (int i = 0; i < m_tabBar->count(); i++)
|
||||||
{
|
{
|
||||||
if (m_tabBar->tabText(i) == title) { return i; }
|
if (m_tabBar->tabText(i) == title) { return i; }
|
||||||
}
|
}
|
||||||
|
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "Wrong title");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CInfoArea::dockWidgetInfoAreaToTabBarIndex(const CDockWidgetInfoArea *dockWidgetInfoArea) const
|
int CInfoArea::dockWidgetInfoAreaToTabBarIndex(const CDockWidgetInfoArea *dockWidgetInfoArea) const
|
||||||
{
|
{
|
||||||
if (!dockWidgetInfoArea) return -1;
|
if (!dockWidgetInfoArea) { return -1; }
|
||||||
if (dockWidgetInfoArea->isFloating()) return -1;
|
if (dockWidgetInfoArea->isFloating()) { return -1; }
|
||||||
return getTabBarIndexByTitle(dockWidgetInfoArea->windowTitle());
|
return getTabBarIndexByTitle(dockWidgetInfoArea->windowTitleOrBackup());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoArea::selectArea(const CDockWidgetInfoArea *dockWidgetInfoArea)
|
void CInfoArea::selectArea(const CDockWidgetInfoArea *dockWidgetInfoArea)
|
||||||
@@ -693,7 +708,7 @@ namespace BlackGui
|
|||||||
for (int i = 0; i < this->m_tabBar->count(); i++)
|
for (int i = 0; i < this->m_tabBar->count(); i++)
|
||||||
{
|
{
|
||||||
const QString t(this->m_tabBar->tabText(i));
|
const QString t(this->m_tabBar->tabText(i));
|
||||||
int areaIndex = this->getAreaIndexByWindowTitle(t);
|
int areaIndex = t.isEmpty() ? i : this->getAreaIndexByWindowTitle(t);
|
||||||
const QPixmap p = indexToPixmap(areaIndex);
|
const QPixmap p = indexToPixmap(areaIndex);
|
||||||
this->m_tabBar->setTabIcon(i, p);
|
this->m_tabBar->setTabIcon(i, p);
|
||||||
}
|
}
|
||||||
@@ -754,7 +769,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInfoArea::ps_showTabTexts(bool show)
|
void CInfoArea::ps_showTabTexts(bool show)
|
||||||
{
|
{
|
||||||
if (show == this->m_showTabTexts) return;
|
if (show == this->m_showTabTexts) { return; }
|
||||||
this->m_showTabTexts = show;
|
this->m_showTabTexts = show;
|
||||||
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,10 +6,16 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>206</width>
|
<width>313</width>
|
||||||
<height>190</height>
|
<height>164</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Frame</string>
|
<string>Frame</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -36,16 +42,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="fl_NetworkServer">
|
<layout class="QGridLayout" name="gl_ServerForm">
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="verticalSpacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -58,6 +55,9 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="lbl_Name">
|
<widget class="QLabel" name="lbl_Name">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -65,10 +65,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="2" column="0">
|
||||||
<widget class="QLineEdit" name="le_Name">
|
<widget class="QLabel" name="lbl_Address">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Addr./ port</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLineEdit" name="le_Port">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>75</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -79,69 +104,38 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_Description"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_Address">
|
|
||||||
<property name="text">
|
|
||||||
<string>Address</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_Address"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lbl_Port">
|
|
||||||
<property name="text">
|
|
||||||
<string>Port</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_Port">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_RealName">
|
<widget class="QLabel" name="lbl_RealName">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Real name</string>
|
<string>Real name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_RealName">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="lbl_NetworkId">
|
|
||||||
<property name="text">
|
|
||||||
<string>Id:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLineEdit" name="le_NetworkId">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="lbl_Password">
|
<widget class="QLabel" name="lbl_Password">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Password</string>
|
<string>Password</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_NetworkId">
|
||||||
|
<property name="text">
|
||||||
|
<string>Id:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_Address"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_NetworkId">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="2">
|
||||||
<widget class="QLineEdit" name="le_Password">
|
<widget class="QLineEdit" name="le_Password">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
@@ -154,6 +148,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_RealName">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_Description"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="le_Name">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user