mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +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()
|
||||
{
|
||||
// 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_SettingsServersComponent->reloadSettings();
|
||||
|
||||
// update hot keys
|
||||
this->ui->tvp_SettingsMiscHotkeys->updateContainer(this->getIContextSettings()->getHotkeys());
|
||||
this->ui->comp_SettingsHotkeysComponent->reloadSettings();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -97,7 +96,7 @@ namespace BlackGui
|
||||
*/
|
||||
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);
|
||||
|
||||
// Opacity, intervals
|
||||
@@ -106,11 +105,6 @@ namespace BlackGui
|
||||
this->connect(this->ui->hs_SettingsGuiAtcRefreshTime, &QSlider::valueChanged, this, &CSettingsComponent::changedAtcStationsUpdateInterval);
|
||||
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
|
||||
const QFont font = this->font();
|
||||
this->ui->cb_SettingsGuiFontStyle->setCurrentText(CStyleSheetUtility::fontAsCombinedWeightStyle(font));
|
||||
@@ -138,28 +132,6 @@ namespace BlackGui
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackGui
|
||||
SettingTabAircraftAudio,
|
||||
SettingTabSimulator,
|
||||
SettingTabGui,
|
||||
SettingTabMisc
|
||||
SettingTabHotkeys
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
@@ -98,12 +98,6 @@ namespace BlackGui
|
||||
//! Settings have been changed
|
||||
void ps_changedSettings(uint typeValue);
|
||||
|
||||
//! Save the Hotkeys
|
||||
void ps_saveHotkeys();
|
||||
|
||||
//! Clear single hotkey
|
||||
void ps_clearHotkey();
|
||||
|
||||
//! Font has been changed
|
||||
void ps_fontChanged();
|
||||
|
||||
|
||||
@@ -480,79 +480,46 @@
|
||||
</item>
|
||||
</layout>
|
||||
</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">
|
||||
<string>Misc</string>
|
||||
<string>Hotkeys</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="vl_SettingsMisc">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CKeyboardKeyView" name="tvp_SettingsMiscHotkeys">
|
||||
<property name="cornerButtonEnabled">
|
||||
<bool>true</bool>
|
||||
<widget class="BlackGui::Components::CSettingsHotkeyComponent" name="comp_SettingsHotkeysComponent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_SettingsMisc">
|
||||
<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_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>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -565,11 +532,6 @@
|
||||
<header>blackgui/components/audiosetupcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Views::CKeyboardKeyView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>blackgui/views/keyboardkeyview.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsSimulatorComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
@@ -588,6 +550,12 @@
|
||||
<header>blackgui/components/settingsnetworkcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CSettingsHotkeyComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/settingshotkeycomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<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()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>260</width>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -38,7 +38,7 @@
|
||||
<item>
|
||||
<widget class="BlackGui::Views::CServerView" name="tvp_SettingsTnServers">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -82,7 +82,7 @@
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_SettingsTnServersButtons">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -95,10 +95,10 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="hl_SettingsBottomBar">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="hs_SettingsTnServersSpacer">
|
||||
|
||||
@@ -326,6 +326,13 @@ namespace BlackGui
|
||||
return ok;
|
||||
}
|
||||
|
||||
QString CDockWidget::windowTitleOrBackup() const
|
||||
{
|
||||
QString t(windowTitle());
|
||||
if (t.isEmpty()) { return windowTitleBackup(); }
|
||||
return t;
|
||||
}
|
||||
|
||||
void CDockWidget::ps_onTopLevelChanged(bool topLevel)
|
||||
{
|
||||
if (topLevel)
|
||||
|
||||
@@ -73,6 +73,9 @@ namespace BlackGui
|
||||
//! Window title backup
|
||||
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
|
||||
bool showTitleWhenDocked() const { return this->m_windowTitleWhenDocked; }
|
||||
|
||||
|
||||
@@ -626,47 +626,62 @@ namespace BlackGui
|
||||
{
|
||||
if (tabBarIndex >= this->m_dockWidgetInfoAreas.count() || tabBarIndex < 0) { 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
|
||||
{
|
||||
Q_ASSERT(!title.isEmpty());
|
||||
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "No title");
|
||||
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||
{
|
||||
if (dw->windowTitle() == title) { return dw; }
|
||||
if (dw->windowTitleOrBackup() == title) { return dw; }
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
const QString t(m_dockWidgetInfoAreas.at(i)->windowTitle());
|
||||
if (t == title) { return i; }
|
||||
if (title == m_dockWidgetInfoAreas.at(i)->windowTitleOrBackup()) { return i; }
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "No area for title");
|
||||
return -1;
|
||||
}
|
||||
|
||||
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;}
|
||||
for (int i = 0; i < m_tabBar->count(); i++)
|
||||
{
|
||||
if (m_tabBar->tabText(i) == title) { return i; }
|
||||
}
|
||||
Q_ASSERT_X(!title.isEmpty(), Q_FUNC_INFO, "Wrong title");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int CInfoArea::dockWidgetInfoAreaToTabBarIndex(const CDockWidgetInfoArea *dockWidgetInfoArea) const
|
||||
{
|
||||
if (!dockWidgetInfoArea) return -1;
|
||||
if (dockWidgetInfoArea->isFloating()) return -1;
|
||||
return getTabBarIndexByTitle(dockWidgetInfoArea->windowTitle());
|
||||
if (!dockWidgetInfoArea) { return -1; }
|
||||
if (dockWidgetInfoArea->isFloating()) { return -1; }
|
||||
return getTabBarIndexByTitle(dockWidgetInfoArea->windowTitleOrBackup());
|
||||
}
|
||||
|
||||
void CInfoArea::selectArea(const CDockWidgetInfoArea *dockWidgetInfoArea)
|
||||
@@ -693,7 +708,7 @@ namespace BlackGui
|
||||
for (int i = 0; i < this->m_tabBar->count(); 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);
|
||||
this->m_tabBar->setTabIcon(i, p);
|
||||
}
|
||||
@@ -754,7 +769,7 @@ namespace BlackGui
|
||||
|
||||
void CInfoArea::ps_showTabTexts(bool show)
|
||||
{
|
||||
if (show == this->m_showTabTexts) return;
|
||||
if (show == this->m_showTabTexts) { return; }
|
||||
this->m_showTabTexts = show;
|
||||
for (CDockWidgetInfoArea *dw : this->m_dockWidgetInfoAreas)
|
||||
{
|
||||
|
||||
@@ -6,10 +6,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>206</width>
|
||||
<height>190</height>
|
||||
<width>313</width>
|
||||
<height>164</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
@@ -36,16 +42,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="fl_NetworkServer">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_ServerForm">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
@@ -58,6 +55,9 @@
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<property name="text">
|
||||
@@ -65,10 +65,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="le_Name">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_Address">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -79,69 +104,38 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>Real name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="le_RealName">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@@ -154,6 +148,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user