From 64ce4642c650a75351ffdf6524b53b243a1a3945 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 28 Apr 2020 15:26:22 +1000 Subject: [PATCH 1/2] linux: fixes bug where layout was wonky on startup for some systems --- app/window/mainwindow/mainwindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 1a83578e5..067e2603b 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -33,18 +33,21 @@ OLIVE_NAMESPACE_ENTER MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { -#ifdef Q_OS_WINDOWS - // Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the window beforehand - // works around that issue and we just set it to whatever size is available + // Resizes main window to desktop geometry on startup. Fixes the following issues: + // * Qt on Windows has a bug that "de-maximizes" the window when widgets are added, resizing the + // window beforehand works around that issue and we just set it to whatever size is available. + // * On Linux, it seems the window starts off at a vastly different size and then maximizes + // which throws off the proportions and makes the resulting layout wonky. resize(qApp->desktop()->availableGeometry(this).size()); +#ifdef Q_OS_WINDOWS // Set up taskbar button progress bar (used for some modal tasks like exporting) taskbar_btn_id_ = RegisterWindowMessage("TaskbarButtonCreated"); taskbar_interface_ = nullptr; #endif - // Create empty central widget - we don't actually want a central widget but some of Qt's docking/undocking fails - // without it + // Create empty central widget - we don't actually want a central widget (so we set its maximum + // size to 0,0) but some of Qt's docking/undocking fails without it QWidget* centralWidget = new QWidget(this); centralWidget->setMaximumSize(QSize(0, 0)); setCentralWidget(centralWidget); From 1b2c68c92764efd9cdac0ad861c30dffdeca6f61 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 28 Apr 2020 15:39:31 +1000 Subject: [PATCH 2/2] preferencesaudiotab: fixed bug that didn't disable UI when refreshing audio devices --- .../preferences/tabs/preferencesaudiotab.cpp | 20 +++++++++++++------ .../preferences/tabs/preferencesaudiotab.h | 8 ++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/app/dialog/preferences/tabs/preferencesaudiotab.cpp b/app/dialog/preferences/tabs/preferencesaudiotab.cpp index af70cb1d2..dfe3536a7 100644 --- a/app/dialog/preferences/tabs/preferencesaudiotab.cpp +++ b/app/dialog/preferences/tabs/preferencesaudiotab.cpp @@ -22,7 +22,6 @@ #include #include -#include #include "audio/audiomanager.h" #include "config/config.h" @@ -80,14 +79,14 @@ PreferencesAudioTab::PreferencesAudioTab() row++; - QPushButton* refresh_devices = new QPushButton(tr("Refresh Devices")); - audio_tab_layout->addWidget(refresh_devices, row, 1); + refresh_devices_btn_ = new QPushButton(tr("Refresh Devices")); + audio_tab_layout->addWidget(refresh_devices_btn_, row, 1); row++; RetrieveDeviceLists(); - connect(refresh_devices, &QPushButton::clicked, this, &PreferencesAudioTab::RefreshDevices); + connect(refresh_devices_btn_, &QPushButton::clicked, this, &PreferencesAudioTab::RefreshDevices); connect(AudioManager::instance(), &AudioManager::OutputListReady, this, &PreferencesAudioTab::RetrieveOutputList); connect(AudioManager::instance(), &AudioManager::InputListReady, this, &PreferencesAudioTab::RetrieveInputList); } @@ -151,6 +150,8 @@ void PreferencesAudioTab::RetrieveOutputList() AudioManager::instance()->IsRefreshingOutputs(), AudioManager::instance()->ListOutputDevices(), Config::Current()["AudioOutput"].toString()); + + UpdateRefreshButtonEnabled(); } void PreferencesAudioTab::RetrieveInputList() @@ -159,6 +160,8 @@ void PreferencesAudioTab::RetrieveInputList() AudioManager::instance()->IsRefreshingInputs(), AudioManager::instance()->ListInputDevices(), Config::Current()["AudioInput"].toString()); + + UpdateRefreshButtonEnabled(); } void PreferencesAudioTab::RetrieveDeviceLists() @@ -167,17 +170,22 @@ void PreferencesAudioTab::RetrieveDeviceLists() RetrieveInputList(); } +void PreferencesAudioTab::UpdateRefreshButtonEnabled() +{ + refresh_devices_btn_->setEnabled(audio_output_devices_->isEnabled() + && audio_input_devices_->isEnabled()); +} + void PreferencesAudioTab::PopulateComboBox(QComboBox *cb, bool still_refreshing, const QList &list, const QString& preferred) { cb->clear(); - cb->setEnabled(still_refreshing); + cb->setEnabled(!still_refreshing); if (still_refreshing) { cb->addItem(tr("Please wait...")); } else { bool found_preferred_device = false; - cb->setEnabled(true); // Add null default item cb->addItem(tr("Default"), QVariant()); diff --git a/app/dialog/preferences/tabs/preferencesaudiotab.h b/app/dialog/preferences/tabs/preferencesaudiotab.h index f91445774..dcf9252b7 100644 --- a/app/dialog/preferences/tabs/preferencesaudiotab.h +++ b/app/dialog/preferences/tabs/preferencesaudiotab.h @@ -23,6 +23,7 @@ #include #include +#include #include "preferencestab.h" @@ -57,6 +58,11 @@ private: */ QComboBox* recording_combobox_; + /** + * @brief Button that triggers a refresh of the available audio devices + */ + QPushButton* refresh_devices_btn_; + private slots: void RefreshDevices(); @@ -67,6 +73,8 @@ private slots: private: void RetrieveDeviceLists(); + void UpdateRefreshButtonEnabled(); + static void PopulateComboBox(QComboBox* cb, bool still_refreshing, const QList& list, const QString &preferred); };