summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2023-02-28 12:15:25 +0100
committerSimon Rettberg2023-02-28 12:15:25 +0100
commitc13ecf1e2527236101492c160a5d7d4e380314a3 (patch)
tree3184c72bf455d0c0aca3a23b6c4e05fd1f82ff98 /src
parentTurn deprecated-declarations into warning (diff)
downloadpavucontrol-slx-c13ecf1e2527236101492c160a5d7d4e380314a3.tar.gz
pavucontrol-slx-c13ecf1e2527236101492c160a5d7d4e380314a3.tar.xz
pavucontrol-slx-c13ecf1e2527236101492c160a5d7d4e380314a3.zip
Tweak window layout, vertical scrollbar as needed
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp17
-rw-r--r--src/mainwindow.h4
-rw-r--r--src/mainwindow.ui170
3 files changed, 111 insertions, 80 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2d09504..f70f0be 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -6,6 +6,9 @@
#include <PulseAudioQt/Card>
#include <PulseAudioQt/Profile>
+#include <QShowEvent>
+#include <QDesktopWidget>
+
MainWindow::MainWindow() : QDialog()
{
setupUi(this);
@@ -24,6 +27,16 @@ MainWindow::~MainWindow()
}
+void MainWindow::showEvent(QShowEvent *)
+{
+ int height = qApp->desktop()->size().height();
+ int off = height / 12;
+ if (off < 70) {
+ off = 70;
+ }
+ this->sac->setMaximumHeight(height - off);
+}
+
SlxOutput* MainWindow::getDevice(const PulseAudioQt::Card *card, const PulseAudioQt::Device *device, const PulseAudioQt::Port *port, bool output)
{
PulseAudioQt::Profile *profile = nullptr;
@@ -34,7 +47,7 @@ SlxOutput* MainWindow::getDevice(const PulseAudioQt::Card *card, const PulseAudi
if (card != nullptr) {
cardId = card->name();
- if (card->activeProfileIndex() < card->profiles().size()) {
+ if ((int)card->activeProfileIndex() < card->profiles().size()) {
profile = card->profiles().at(card->activeProfileIndex());
heading.append(QLatin1String(" (")).append(profile->description()).append(QLatin1String(")"));
}
@@ -82,7 +95,7 @@ SlxOutput* MainWindow::getCardPort(const PulseAudioQt::Card *card, const PulseAu
return w;
}
-void MainWindow::insertItemWidget(SlxOutput* w, bool isDevice)
+void MainWindow::insertItemWidget(SlxOutput* w, bool)
{
bool done = false;
int idx;
diff --git a/src/mainwindow.h b/src/mainwindow.h
index cd9f5cb..f814d00 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -8,6 +8,7 @@
#include "ui_mainwindow.h"
class SlxOutput;
+class QShowEvent;
namespace PulseAudioQt {
class Device;
class Port;
@@ -32,6 +33,9 @@ public:
void mark();
void sweep();
+protected:
+ void showEvent(QShowEvent *ev) override;
+
private:
QMap<QString, SlxOutput*> _widgets;
QSize _originalSize;
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 03e1aae..646c26a 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>587</width>
- <height>300</height>
+ <width>656</width>
+ <height>308</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,98 +15,112 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="outputLabel">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Output</string>
- </property>
- </widget>
- </item>
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="horizontalScrollBarPolicy">
+ <enum>Qt::ScrollBarAlwaysOff</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="sac">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>288</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
<item>
- <layout class="QVBoxLayout" name="outputListLayout"/>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="outputLabel">
+ <property name="font">
+ <font>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Output</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="outputListLayout"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="inputLabel">
+ <property name="font">
+ <font>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Input</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="inputListLayout"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</item>
<item>
- <spacer name="verticalSpacer_3">
+ <widget class="Line" name="line">
<property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <enum>Qt::Horizontal</enum>
</property>
- </spacer>
+ </widget>
</item>
- </layout>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QLabel" name="inputLabel">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
+ <widget class="QLabel" name="cardLabel">
<property name="text">
- <string>Input</string>
+ <string>Card/Profile</string>
</property>
</widget>
</item>
<item>
- <layout class="QVBoxLayout" name="inputListLayout"/>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
+ <layout class="QVBoxLayout" name="cards"/>
</item>
</layout>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="cardLabel">
- <property name="text">
- <string>Card/Profile</string>
- </property>
+ </widget>
</widget>
</item>
- <item>
- <layout class="QVBoxLayout" name="cards"/>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</widget>
<resources/>