From c13ecf1e2527236101492c160a5d7d4e380314a3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 28 Feb 2023 12:15:25 +0100 Subject: Tweak window layout, vertical scrollbar as needed --- src/mainwindow.cpp | 17 +++++- src/mainwindow.h | 4 ++ src/mainwindow.ui | 170 +++++++++++++++++++++++++++++------------------------ 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 #include +#include +#include + 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 _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 @@ 0 0 - 587 - 300 + 656 + 308 @@ -15,98 +15,112 @@ - - - - - - - - 75 - true - - - - Output - - - + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 636 + 288 + + + - + + + + + + + + true + + + + Output + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + true + + + + Input + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + - + - Qt::Vertical - - - - 20 - 40 - + Qt::Horizontal - + - - - - - - - - 75 - true - - + - Input + Card/Profile - - - - - - Qt::Vertical - - - - 20 - 40 - - - + - - - - - - - Card/Profile - + - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - -- cgit v1.2.3-55-g7522