Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DlgPrefController layout fixes #3

Open
wants to merge 7 commits into
base: controller_pref_tab_layout
Choose a base branch
from
12 changes: 9 additions & 3 deletions src/controllers/dlgprefcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ DlgPrefController::DlgPrefController(
m_outputMappingsTabIndex = m_ui.controllerTabs->indexOf(m_ui.outputMappingsTab);
m_settingsTabIndex = m_ui.controllerTabs->indexOf(m_ui.settingsTab);
m_screensTabIndex = m_ui.controllerTabs->indexOf(m_ui.screensTab);

#ifndef MIXXX_USE_QML
// Remove the screens tab
m_ui.controllerTabs->removeTab(m_screensTabIndex);
// Just to be save
m_screensTabIndex = -1;
#endif
}

DlgPrefController::~DlgPrefController() {
Expand Down Expand Up @@ -798,7 +805,7 @@ unsigned int DlgPrefController::getNumberOfVisibleTabs() {
return visibleTabsCount;
}

int DlgPrefController::getIndexOfFirstVisibleTabs() {
int DlgPrefController::getIndexOfFirstVisibleTab() {
for (int tabIdx = 0; tabIdx < m_ui.controllerTabs->count(); ++tabIdx) {
if (m_ui.controllerTabs->isTabVisible(tabIdx)) {
return tabIdx;
Expand Down Expand Up @@ -1052,7 +1059,6 @@ void DlgPrefController::slotShowMapping(std::shared_ptr<LegacyControllerMapping>
}

// Show or hide the settings tab based on the presence of settings

m_ui.controllerTabs->setTabVisible(
m_settingsTabIndex, pMapping && !pMapping->getSettings().isEmpty());

Expand Down Expand Up @@ -1141,7 +1147,7 @@ void DlgPrefController::slotShowMapping(std::shared_ptr<LegacyControllerMapping>
m_ui.controllerTabs->setVisible(getNumberOfVisibleTabs() > 0);

// Set the first visible tab as the current tab
int firstVisibleTabIndex = getIndexOfFirstVisibleTabs();
int firstVisibleTabIndex = getIndexOfFirstVisibleTab();
if (firstVisibleTabIndex >= 0) {
m_ui.controllerTabs->setCurrentIndex(firstVisibleTabIndex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/dlgprefcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DlgPrefController : public DlgPreferencePage {
bool saveMapping();
void initTableView(QTableView* pTable);
unsigned int getNumberOfVisibleTabs();
int getIndexOfFirstVisibleTabs();
int getIndexOfFirstVisibleTab();

/// Set dirty state (i.e. changes have been made).
///
Expand Down
24 changes: 9 additions & 15 deletions src/controllers/dlgprefcontrollerdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayoutDeviceInfo" rowstretch="0,0,0,0,0,0,0,0,0,0,0" rowminimumheight="1,1,1,1,1,1,1,1,1,1,0">
<layout class="QGridLayout" name="gridLayoutDeviceInfo" rowminimumheight="1,1,1,1,1,1,1,1,1,1,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<enum>QLayout::SetMaximumSize</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelPhysicalInterface">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -162,7 +162,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Data handling protocol:</string>
<string>Data protocol:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
Expand Down Expand Up @@ -477,7 +477,7 @@
<item row="10" column="0" colspan="2">
<widget class="QWidget" name="spacerDeviceInfo" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Ignored" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -513,9 +513,9 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayoutMappingInfo" rowstretch="0,0,0,0,0,0" rowminimumheight="1,1,1,1,1,0">
<layout class="QGridLayout" name="gridLayoutMappingInfo" columnstretch="0,1" rowminimumheight="1,1,1,1,1,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="bottomMargin">
<number>9</number>
Expand All @@ -526,7 +526,7 @@
<item row="0" column="0">
<widget class="QLabel" name="labelMappingName">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down Expand Up @@ -623,12 +623,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
Expand Down Expand Up @@ -752,7 +746,7 @@
<item row="5" column="0" colspan="2">
<widget class="QWidget" name="spacerMappingInfo" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="Ignored" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down
Loading